• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cpos函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cpos函数的典型用法代码示例。如果您正苦于以下问题:C++ cpos函数的具体用法?C++ cpos怎么用?C++ cpos使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了cpos函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: draw_box

void draw_box(Var* obj, int x, int y, float ignore, char* out)
{
	int i, j, k;
	int v;

	for (j = 0; j < y; j++) {
		for (i = 0; i < x; i++) {
			v = extract_int(obj, cpos(i, j, 0, obj));
			if (v != ignore && v > 0) {
				for (k = -v; k <= v; k++) {
					if (i + k >= 0 && i + k < x) {
						if (j - v >= 0 && j - v < y) {
							out[cpos(i + k, j - v, 0, obj)] = 1;
						}
						if (j + v >= 0 && j + v < y) {
							out[cpos(i + k, j + v, 0, obj)] = 1;
						}
					}
					if (j + k >= 0 && j + k < y) {
						if (i - v >= 0 && i - v < x) {
							out[cpos(i - v, j + k, 0, obj)] = 1;
						}
						if (i + v >= 0 && i + v < x) {
							out[cpos(i + v, j + k, 0, obj)] = 1;
						}
					}
				}
			}
		}
	}
}
开发者ID:robwink,项目名称:davinci,代码行数:31,代码来源:ff_radial.c


示例2: addsymtable

static void
addsymtable(void)
{
	IMAGE_SECTION_HEADER *h;
	int i, size;
	LSym *s;
	
	fh.NumberOfSymbols = sizeof(symlabels)/sizeof(symlabels[0]);
	size = nextsymoff + 4 + 18*fh.NumberOfSymbols;
	h = addpesection(".symtab", size, size);
	h->Characteristics = IMAGE_SCN_MEM_READ|
		IMAGE_SCN_MEM_DISCARDABLE;
	chksectoff(h, cpos());
	fh.PointerToSymbolTable = cpos();
	
	// put COFF symbol table
	for (i=0; i<fh.NumberOfSymbols; i++) {
		s = linkrlookup(ctxt, symlabels[i], 0);
		strnput(s->name, 8);
		lputl(datoff(s->value));
		wputl(textsect);
		wputl(0x0308);  // "array of structs"
		cput(2);        // storage class: external
		cput(0);        // no aux entries
	}

	// put COFF string table
	lputl(nextsymoff + 4);
	for (i=0; i<nextsymoff; i++)
		cput(symnames[i]);
	strnput("", h->SizeOfRawData - size);
}
开发者ID:rosrad,项目名称:go-rep,代码行数:32,代码来源:pe.c


示例3: elfrelocsect

void
elfrelocsect(Section *sect, Sym *first)
{
	Sym *sym, *rs;
	int32 eaddr;
	Reloc *r;
	int64 add;

	// If main section is SHT_NOBITS, nothing to relocate.
	// Also nothing to relocate in .shstrtab.
	if(sect->vaddr >= sect->seg->vaddr + sect->seg->filelen)
		return;
	if(strcmp(sect->name, ".shstrtab") == 0)
		return;

	sect->reloff = cpos();
	for(sym = first; sym != nil; sym = sym->next) {
		if(!sym->reachable)
			continue;
		if(sym->value >= sect->vaddr)
			break;
	}
	
	eaddr = sect->vaddr + sect->len;
	for(; sym != nil; sym = sym->next) {
		if(!sym->reachable)
			continue;
		if(sym->value >= eaddr)
			break;
		cursym = sym;
		
		for(r = sym->r; r < sym->r+sym->nr; r++) {
			// Ignore relocations handled by reloc already.
			switch(r->type) {
			case D_SIZE:
				continue;
			case D_ADDR:
			case D_PCREL:
				if(r->sym->type == SCONST)
					continue;
				break;
			}

			add = r->add;
			rs = r->sym;
			while(rs->outer != nil) {
				add += rs->value - rs->outer->value;
				rs = rs->outer;
			}
				
			if(rs->elfsym == 0)
				diag("reloc %d to non-elf symbol %s (rs=%s) %d", r->type, r->sym->name, rs->name, rs->type);

			if(elfreloc1(r, sym->value - sect->vaddr + r->off, rs->elfsym, add) < 0)
				diag("unsupported obj reloc %d/%d to %s", r->type, r->siz, r->sym->name);
		}
	}
		
	sect->rellen = cpos() - sect->reloff;
}	
开发者ID:serge-hulne,项目名称:golang,代码行数:60,代码来源:elf.c


示例4: ff_fft

Var* ff_fft(vfuncptr func, Var* arg)
{
	Var *real = NULL, *img = NULL;
	double* data;
	int i, j, n, x, y, z;
	COMPLEX *in, *out;

	Alist alist[4];
	alist[0]      = make_alist("real", ID_VAL, NULL, &real);
	alist[1]      = make_alist("img", ID_VAL, NULL, &img);
	alist[2].name = NULL;

	if (parse_args(func, arg, alist) == 0) return (NULL);

	if (real == NULL && img == NULL) {
		parse_error("%s: No real or imaginary objects specified\n", func->name);
		return (NULL);
	}
	x = GetSamples(V_SIZE(real), V_ORG(real));
	y = GetLines(V_SIZE(real), V_ORG(real));
	z = GetBands(V_SIZE(real), V_ORG(real));

	if (img == NULL && x == 2) {
		n   = y * z;
		in  = (COMPLEX*)calloc(n, sizeof(COMPLEX));
		out = (COMPLEX*)calloc(n, sizeof(COMPLEX));
		for (i = 0; i < y; i++) {
			for (j = 0; j < z; j++) {
				in[i].re = extract_double(real, cpos(0, i, j, real));
				in[i].im = extract_double(real, cpos(1, i, j, real));
			}
		}
	} else {
		n   = V_DSIZE(real);
		in  = (COMPLEX*)calloc(n, sizeof(COMPLEX));
		out = (COMPLEX*)calloc(n, sizeof(COMPLEX));
		for (i = 0; i < n; i++) {
			in[i].re = extract_double(real, i);
			in[i].im = (img == NULL ? 0.0 : extract_double(img, i));
		}
	}

	if (func->fdata == (void*)1) {
		fft(in, n, out);
	} else {
		rft(in, n, out);
	}

	data = (double*)calloc(n * 2, sizeof(double));

	for (i = 0; i < n; i++) {
		data[i * 2]     = out[i].re;
		data[i * 2 + 1] = out[i].im;
	}
	return (newVal(BSQ, 2, n, 1, DV_DOUBLE, data));
}
开发者ID:robwink,项目名称:davinci,代码行数:56,代码来源:ff_fft.c


示例5: phaseSaitoZ

// Third   Step      of     the    saito   algorithm     using      the
//[Meijster/Roerdnik/Hesselink] optimization
void phaseSaitoZ(Var* vxy, Var* vxyz)
{
	int dx       = GetX(vxy);
	int dy       = GetY(vxy);
	int* sdt_xy  = V_DATA(vxy);
	int* sdt_xyz = V_DATA(vxyz);
	int x, y;
	for (y = 0; y < dy; y++) {
		for (x = 0; x < dx; x++) {
			sdt_xyz[cpos(x, y, 0, vxyz)] = sqrt(F(0, 0, sdt_xy[cpos(x, y, 0, vxy)]));
		}
	}
}
开发者ID:robwink,项目名称:davinci,代码行数:15,代码来源:ff_grassfire.c


示例6: lmode

/* Reset modes */
void lmode(void)
{
    switch(parry[0])
    {
    case 1:
        mapplication=0;
        break;
    case 3:
        ttyinit();
        break;
    case 4:
        minsert=0;
        break;
    case 6:
        dowrap=0;
        minmargins=0;
        parry[0]=0;
        parry[1]=0;
        pos();
        break;
    case 7:
        dowrap=0;
        mautowrap=0;
        break;
    case 20:
        mnl=0;
        break;
    case 25:
        minvisable=1;
        cpos(width,height);
        break;
    }
}
开发者ID:weixu8,项目名称:joes-sandbox,代码行数:34,代码来源:tty.c


示例7: left

/* Cursor left */
void left(void)
{
    if(!parry[0]) ++parry[0];
    if(parry[0]>x) x=0;
    else x-=parry[0];
    if(!minvisable) cpos(x,y);
}
开发者ID:weixu8,项目名称:joes-sandbox,代码行数:8,代码来源:tty.c


示例8: read_editor_help

int read_editor_help (void)
{
   FILE *fp;
   int i;
   char linea[128];

   strcpy (linea, text_path);
   strcat (linea, "FSHELP");

   if ((fp = get_system_file (linea)) == NULL) {
      strcpy (linea, config->glob_text_path);
      strcat (linea, "FSHELP");

      if ((fp = get_system_file (linea)) == NULL)
         return (0);
   }

   i = 6;

   while (fgets (linea, 120, fp) != NULL) {
      while (strlen (linea) > 0 && (linea[strlen (linea) - 1] == 0x0D || linea[strlen (linea) - 1] == 0x0A))
         linea[strlen (linea) -1] = '\0';

      cpos (i++, (usr.width ? (usr.width - 1) : 79) - strlen (linea));
      m_print ("\026\001\007%s", linea);
   }

   fclose (fp);
   input (linea, 0);

   return (-1);
}
开发者ID:maccasoft,项目名称:lora2,代码行数:32,代码来源:fulled.c


示例9: c_changed_pos

int
c_changed_pos (struct changed_pos *cp0, struct changed_pos *cp1)
{
  int c = cpos (&cp0->p, &cp1->p);
  if (c) return c;
  else return cint ((int *) &cp0->reason, (int *) &cp1->reason);
}
开发者ID:allisson128,项目名称:mininim,代码行数:7,代码来源:multi-room.c


示例10: edupd

void edupd(int flg)
{
	W *w;
	int wid, hei;

	if (dostaupd) {
		staupd = 1;
		dostaupd = 0;
	}
	ttgtsz(&wid, &hei);
	if (nresize(maint->t, wid, hei)) {
		sresize(maint);
#ifdef MOUSE_GPM
		gpm_mx = wid;
		gpm_my = hei;
#endif
	}
	dofollows();
	ttflsh();
	nscroll(maint->t, BG_COLOR(bg_text));
	help_display(maint);
	w = maint->curwin;
	do {
		if (w->y != -1) {
			if (w->object && w->watom->disp)
				w->watom->disp(w->object, flg);
			msgout(w);
		}
		w = (W *) (w->link.next);
	} while (w != maint->curwin);
	cpos(maint->t, maint->curwin->x + maint->curwin->curx, maint->curwin->y + maint->curwin->cury);
	staupd = 0;
}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:33,代码来源:main.c


示例11: if

/**
* @brief Finds the queued command that would be canceled by the Command c
* @return An iterator located at the command, or commandQue.end() if no such queued command exsists
**/
std::deque<Command>::iterator CCommandAI::GetCancelQueued(Command &c){
	if(!commandQue.empty()){
		std::deque<Command>::iterator ci=commandQue.end();
		do{
			--ci;			//iterate from the end and dont check the current order
			if((ci->id==c.id || (c.id<0 && ci->id<0)) && ci->params.size()==c.params.size()){
				if(c.params.size()==1){			//we assume the param is a unit of feature id
					if(ci->params[0]==c.params[0]){
						return ci;
					}
				} else if(c.params.size()>=3){		//we assume this means that the first 3 makes a position
					float3 cpos(c.params[0],c.params[1],c.params[2]);
					float3 cipos(ci->params[0],ci->params[1],ci->params[2]);
					if(c.id < 0){
						UnitDef* u1 = unitDefHandler->GetUnitByID(-c.id);
						UnitDef* u2 = unitDefHandler->GetUnitByID(-ci->id);
						if(u1 && u2
							&& fabs(cpos.x-cipos.x)*2 <= max(u1->xsize, u2->xsize)*SQUARE_SIZE
							&& fabs(cpos.z-cipos.z)*2 <= max(u1->ysize, u2->ysize)*SQUARE_SIZE)
						{
							return ci;
						}
					} else {
                        if((cpos-cipos).SqLength2D()<17*17){
							return ci;
						}
					}
				}
			}
		}while(ci!=commandQue.begin());
	}
	return commandQue.end();
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:37,代码来源:CommandAI.cpp


示例12: get_constant

void AcceptDialog::_update_child_rect() {
	Size2 label_size=label->get_minimum_size();
	if (label->get_text().empty()) {
		label_size.height = 0;
	}
	int margin = get_constant("margin","Dialogs");
	Size2 size = get_size();
	Size2 hminsize = hbc->get_combined_minimum_size();

	Vector2 cpos(margin,margin+label_size.height);
	Vector2 csize(size.x-margin*2,size.y-margin*3-hminsize.y-label_size.height);

	if (child) {

		child->set_pos(cpos);
		child->set_size(csize);
	}

	cpos.y+=csize.y+margin;
	csize.y=hminsize.y;

	hbc->set_pos(cpos);
	hbc->set_size(csize);

}
开发者ID:lonesurvivor,项目名称:godot,代码行数:25,代码来源:dialogs.cpp


示例13: addpersrc

void
addpersrc(void)
{
	IMAGE_SECTION_HEADER *h;
	uchar *p;
	uint32 val;
	Reloc *r;

	if(rsrcsym == nil)
		return;
	
	h = addpesection(".rsrc", rsrcsym->size, rsrcsym->size);
	h->Characteristics = IMAGE_SCN_MEM_READ|
		IMAGE_SCN_MEM_WRITE | IMAGE_SCN_CNT_INITIALIZED_DATA;
	chksectoff(h, cpos());
	// relocation
	for(r=rsrcsym->r; r<rsrcsym->r+rsrcsym->nr; r++) {
		p = rsrcsym->p + r->off;
		val = h->VirtualAddress + r->add;
		// 32-bit little-endian
		p[0] = val;
		p[1] = val>>8;
		p[2] = val>>16;
		p[3] = val>>24;
	}
	cwrite(rsrcsym->p, rsrcsym->size);
	strnput("", h->SizeOfRawData - rsrcsym->size);

	// update data directory
	dd[IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress = h->VirtualAddress;
	dd[IMAGE_DIRECTORY_ENTRY_RESOURCE].Size = h->VirtualSize;
}
开发者ID:rosrad,项目名称:go-rep,代码行数:32,代码来源:pe.c


示例14: right

/* Cursor right */
void right(void)
{
    if(!parry[0]) ++parry[0];
    x+=parry[0];
    if(x>=width) x=width-1;
    if(!minvisable) cpos(x,y);
}
开发者ID:weixu8,项目名称:joes-sandbox,代码行数:8,代码来源:tty.c


示例15: fullscreen_editor

void fullscreen_editor (void)
{
   char *p = "\026\001\020\234^X=Down  ^E=Up  ^S=Left  ^D=Right  ^Z=Save  ^K?=Help";

   cls();

   change_attr (BLUE|_LGREY);
   del_line ();
   m_print (" * %s\n", sys.msg_name);

   msg_attrib (&msg, last_msg + 1, 0, 0);

   change_attr (RED|_BLUE);
   del_line ();
   cpos (5, (usr.width ? usr.width : 80) - strlen (p) - 1 + 4);
   m_print (p);

   change_attr (CYAN|_BLACK);
   m_print (bbstxt[B_ONE_CR]);

   fulleditor = 1;
   XON_DISABLE ();
   _BRK_DISABLE ();

   edit_file ("MSGTMP", usr.len - 5, usr.width ? (usr.width - 1) : 79);

   fulleditor = 0;
   XON_ENABLE ();
   _BRK_ENABLE ();
}
开发者ID:maccasoft,项目名称:lora2,代码行数:30,代码来源:fulled.c


示例16: hmode

/* Set modes */
void hmode(void)
{
    switch(parry[0])
    {
    case 1:
        mapplication=1;
        break;
    case 3:
        ttyinit();
        break;
    case 4:
        minsert=1;
        break;
    case 6:
        dowrap=0;
        minmargins=1;
        parry[0]=0;
        parry[1]=0;
        pos();
        break;
    case 7:
        mautowrap=1;
        break;
    case 20:
        mnl=1;
        break;
    case 25:
        minvisable=0;
        cpos(x,y);
        break;
    }
}
开发者ID:weixu8,项目名称:joes-sandbox,代码行数:33,代码来源:tty.c


示例17: codeblk

void
codeblk(int64 addr, int64 size)
{
	LSym *sym;
	int64 eaddr, n;
	uchar *q;

	if(debug['a'])
		Bprint(&bso, "codeblk [%#x,%#x) at offset %#llx\n", addr, addr+size, cpos());

	blk(ctxt->textp, addr, size);

	/* again for printing */
	if(!debug['a'])
		return;

	for(sym = ctxt->textp; sym != nil; sym = sym->next) {
		if(!sym->reachable)
			continue;
		if(sym->value >= addr)
			break;
	}

	eaddr = addr + size;
	for(; sym != nil; sym = sym->next) {
		if(!sym->reachable)
			continue;
		if(sym->value >= eaddr)
			break;

		if(addr < sym->value) {
			Bprint(&bso, "%-20s %.8llux|", "_", (vlong)addr);
			for(; addr < sym->value; addr++)
				Bprint(&bso, " %.2ux", 0);
			Bprint(&bso, "\n");
		}

		Bprint(&bso, "%.6llux\t%-20s\n", (vlong)addr, sym->name);
		n = sym->size;
		q = sym->p;

		while(n >= 16) {
			Bprint(&bso, "%.6ux\t%-20.16I\n", addr, q);
			addr += 16;
			q += 16;
			n -= 16;
		}
		if(n > 0)
			Bprint(&bso, "%.6ux\t%-20.*I\n", addr, (int)n, q);
		addr += n;
	}

	if(addr < eaddr) {
		Bprint(&bso, "%-20s %.8llux|", "_", (vlong)addr);
		for(; addr < eaddr; addr++)
			Bprint(&bso, " %.2ux", 0);
	}
	Bflush(&bso);
}
开发者ID:LEEWEN-DALIAN,项目名称:golang,代码行数:59,代码来源:data.c


示例18: up

/* Cursor up */
void up(void)
{
    if(y<stop)
    {
        if(!parry[0]) ++parry[0];
        if(parry[0]>y) y=0;
        else y-=parry[0];
        if(!minvisable) cpos(x,y);
    }
    else
    {
        if(!parry[0]) ++parry[0];
        if(parry[0]>y-stop) y=stop;
        else y-=parry[0];
        if(!minvisable) cpos(x,y);
    }
}
开发者ID:weixu8,项目名称:joes-sandbox,代码行数:18,代码来源:tty.c


示例19: down

/* Cursor down */
void down(void)
{
    if(y>sbot)
    {
        if(!parry[0]) ++parry[0];
        y+=parry[0];
        if(y>=height) y=height-1;
        if(!minvisable) cpos(x,y);
    }
    else
    {
        if(!parry[0]) ++parry[0];
        y+=parry[0];
        if(y>sbot) y=sbot;
        if(!minvisable) cpos(x,y);
    }
}
开发者ID:weixu8,项目名称:joes-sandbox,代码行数:18,代码来源:tty.c


示例20: bs

/* Backspace */
void bs(void)
{
    if(x)
    {
        --x;
        if(!minvisable) cpos(x,y);
    }
}
开发者ID:weixu8,项目名称:joes-sandbox,代码行数:9,代码来源:tty.c



注:本文中的cpos函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cpp_define函数代码示例发布时间:2022-05-30
下一篇:
C++ cpmac_write函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap