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

C++ CONV函数代码示例

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

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



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

示例1: C2F

int C2F(db2int)(int *typ, int *n, double *dx, int *incx, int *dy, int *incy)
{
    int i1;
    static int i, ix, iy;

    --dx;
    i1 = *n;
    if (i1 <= 0)
    {
        return 0;
    }
    switch (*typ)
    {
        case 1:
            CONV(integer1);
            break;
        case 2:
            CONV(integer2);
            break;
        case 4:
            CONV(int) ;
            break;
    }
    return 0;
}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:25,代码来源:db2int.c


示例2: calcFrameTransform

	void BoneNode::generateBoneLine( std::vector< Vector3 >& lineVec , Matrix4 const& trans , int frame )
	{
#if 0
		Matrix4 nextMat;
		calcFrameTransform( nextMat , trans , frame );

		Vector3 org = motionData[0].pos * trans;

		for( NodeList::iterator iter ( mChildren.begin() ) , end( mChildren.end() );
			iter != end ; ++iter )
		{
			BoneNode* bone = static_cast< BoneNode* >( CONV(iter) );
			Vector3 pos =  bone->motionData[0].pos * nextMat;

			lineVec.push_back( org );
			lineVec.push_back( pos );
		}

		for( NodeList::iterator iter ( mChildren.begin() ) , end( mChildren.end() );
			iter != end ; ++iter )
		{
			castBone( CONV(iter) )->generateBoneLine( lineVec , nextMat , frame );
		}
#endif
	}
开发者ID:uvbs,项目名称:GameProject,代码行数:25,代码来源:CFSkeleton.cpp


示例3: ipclose

static void
ipclose(Chan* c)
{
	Fs *f;

	f = ipfs[c->dev];
	switch(TYPE(c->qid)) {
	default:
		break;
	case Qlog:
		if(c->flag & COPEN)
			netlogclose(f);
		break;
	case Qdata:
	case Qctl:
	case Qerr:
		if(c->flag & COPEN)
			closeconv(f->p[PROTO(c->qid)]->conv[CONV(c->qid)]);
		break;
	case Qsnoop:
		if(c->flag & COPEN)
			decref(&f->p[PROTO(c->qid)]->conv[CONV(c->qid)]->snoopers);
		break;
	}
	free(((IPaux*)c->aux)->owner);
	free(c->aux);
}
开发者ID:99years,项目名称:plan9,代码行数:27,代码来源:devip.c


示例4: to_PCM_double

static void to_PCM_double(NeAACDecHandle hDecoder, real_t **input,
                          uint8_t channels, uint16_t frame_len,
                          double **sample_buffer)
{
    uint8_t ch, ch1;
    uint16_t i;

    switch (CONV(channels,hDecoder->downMatrix))
    {
    case CONV(1,0):
    case CONV(1,1):
        for(i = 0; i < frame_len; i++)
        {
            real_t inp = input[hDecoder->internal_channel[0]][i];
            (*sample_buffer)[i] = (double)inp*FLOAT_SCALE;
        }
        break;
    case CONV(2,0):
        if (hDecoder->upMatrix)
        {
            ch = hDecoder->internal_channel[0];
            for(i = 0; i < frame_len; i++)
            {
                real_t inp0 = input[ch][i];
                (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE;
                (*sample_buffer)[(i*2)+1] = (double)inp0*FLOAT_SCALE;
            }
        } else {
            ch  = hDecoder->internal_channel[0];
            ch1 = hDecoder->internal_channel[1];
            for(i = 0; i < frame_len; i++)
            {
                real_t inp0 = input[ch ][i];
                real_t inp1 = input[ch1][i];
                (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE;
                (*sample_buffer)[(i*2)+1] = (double)inp1*FLOAT_SCALE;
            }
        }
        break;
    default:
        for (ch = 0; ch < channels; ch++)
        {
            for(i = 0; i < frame_len; i++)
            {
                real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
                (*sample_buffer)[(i*channels)+ch] = (double)inp*FLOAT_SCALE;
            }
        }
        break;
    }
}
开发者ID:IngenicSemiconductor,项目名称:XBOMX,代码行数:51,代码来源:output.c


示例5: cmdread

static long
cmdread(Chan *ch, void *a, long n, vlong offset)
{
	Conv *c;
	char *p, *cmds;
	int fd;

	USED(offset);

	p = a;
	switch(TYPE(ch->qid)) {
	default:
		error(Eperm);
	case Qcmd:
	case Qtopdir:
	case Qconvdir:
		return devdirread(ch, a, n, 0, 0, cmdgen);
	case Qctl:
		sprint(up->genbuf, "%ld", CONV(ch->qid));
		return readstr(offset, p, n, up->genbuf);
	case Qstatus:
		c = cmd.conv[CONV(ch->qid)];
		cmds = "";
		if(c->cmd != nil)
			cmds = c->cmd->f[1];
		snprint(up->genbuf, sizeof(up->genbuf), "cmd/%d %d %s %q %q\n",
			c->x, c->inuse, c->state, c->dir, cmds);
		return readstr(offset, p, n, up->genbuf);
	case Qdata:
	case Qstderr:
		fd = 1;
		if(TYPE(ch->qid) == Qstderr)
			fd = 2;
		c = cmd.conv[CONV(ch->qid)];
		qlock(&c->l);
		if(c->fd[fd] == -1){
			qunlock(&c->l);
			return 0;
		}
		qunlock(&c->l);
		osenter();
		n = read(c->fd[fd], a, n);
		osleave();
		if(n < 0)
			oserror();
		return n;
	case Qwait:
		c = cmd.conv[CONV(ch->qid)];
		return qread(c->waitq, a, n);
	}
}
开发者ID:8l,项目名称:inferno,代码行数:51,代码来源:devcmd.c


示例6: ipread

long
ipread(Chan *ch, void *a, long n, vlong offset)
{
	int r;
	Conv *c;
	Proto *x;
	uchar ip[4];
	char buf[128], *p;

/*print("ipread %s %lux\n", c2name(ch), (long)ch->qid.path);*/
	p = a;
	switch(TYPE(ch->qid)) {
	default:
		error(Eperm);
	case Qcs:
		return csread(ch, a, n, offset);
	case Qprotodir:
	case Qtopdir:
	case Qconvdir:
		return devdirread(ch, a, n, 0, 0, ipgen);
	case Qctl:
		sprint(buf, "%d", CONV(ch->qid));
		return readstr(offset, p, n, buf);
	case Qremote:
		c = proto[PROTO(ch->qid)].conv[CONV(ch->qid)];
		hnputl(ip, c->raddr);
		sprint(buf, "%I!%d\n", ip, c->rport);
		return readstr(offset, p, n, buf);
	case Qlocal:
		c = proto[PROTO(ch->qid)].conv[CONV(ch->qid)];
		hnputl(ip, c->laddr);
		sprint(buf, "%I!%d\n", ip, c->lport);
		return readstr(offset, p, n, buf);
	case Qstatus:
		x = &proto[PROTO(ch->qid)];
		c = x->conv[CONV(ch->qid)];
		sprint(buf, "%s/%d %d %s \n",
			c->p->name, c->x, c->r.ref, c->state);
		return readstr(offset, p, n, buf);
	case Qdata:
		c = proto[PROTO(ch->qid)].conv[CONV(ch->qid)];
		r = so_recv(c->sfd, a, n, 0);
		if(r < 0){
			oserrstr();
			nexterror();
		}
		return r;
	}
}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:49,代码来源:devip.c


示例7: cmdwstat

static int
cmdwstat(Chan *c, uchar *dp, int n)
{
	Dir *d;
	Conv *cv;

	switch(TYPE(c->qid)){
	default:
		error(Eperm);
	case Qctl:
	case Qdata:
	case Qstderr:
		d = malloc(sizeof(*d)+n);
		if(d == nil)
			error(Enomem);
		if(waserror()){
			free(d);
			nexterror();
		}
		n = convM2D(dp, n, d, (char*)&d[1]);
		if(n == 0)
			error(Eshortstat);
		cv = cmd.conv[CONV(c->qid)];
		if(!iseve() && strcmp(up->env->user, cv->owner) != 0)
			error(Eperm);
		if(!emptystr(d->uid))
			kstrdup(&cv->owner, d->uid);
		if(d->mode != ~0UL)
			cv->perm = d->mode & 0777;
		poperror();
		free(d);
		break;
	}
	return n;
}
开发者ID:8l,项目名称:inferno,代码行数:35,代码来源:devcmd.c


示例8: ipwstat

static int
ipwstat(Chan *c, uchar *dp, int n)
{
	Dir d;
	Conv *cv;
	Fs *f;
	Proto *p;

	f = ipfs[c->dev];
	switch(TYPE(c->qid)) {
	default:
		error(Eperm);
		break;
	case Qctl:
	case Qdata:
		break;
	}

	n = convM2D(dp, n, &d, nil);
	if(n > 0){
		p = f->p[PROTO(c->qid)];
		cv = p->conv[CONV(c->qid)];
		if(!iseve() && strcmp(ATTACHER(c), cv->owner) != 0)
			error(Eperm);
		if(d.uid[0])
			kstrdup(&cv->owner, d.uid);
		cv->perm = d.mode & 0777;
	}
	return n;
}
开发者ID:99years,项目名称:plan9,代码行数:30,代码来源:devip.c


示例9: ipbwrite

static long
ipbwrite(Chan* ch, Block* bp, ulong offset)
{
	Conv *c;
	Proto *x;
	Fs *f;
	int n;

	switch(TYPE(ch->qid)){
	case Qdata:
		f = ipfs[ch->dev];
		x = f->p[PROTO(ch->qid)];
		c = x->conv[CONV(ch->qid)];

		if(c->wq == nil)
			error(Eperm);

		if(bp->next)
			bp = concatblock(bp);
		n = BLEN(bp);
		qbwrite(c->wq, bp);
		return n;
	default:
		return devbwrite(ch, bp, offset);
	}
}
开发者ID:99years,项目名称:plan9,代码行数:26,代码来源:devip.c


示例10: ipclose

void
ipclose(Chan *c)
{
	Conv *cc;

	switch(TYPE(c->qid)) {
	case Qcs:
		csclose(c);
		break;
	case Qdata:
	case Qctl:
		if((c->flag & COPEN) == 0)
			break;
		cc = proto[PROTO(c->qid)].conv[CONV(c->qid)];
		if(decref(&cc->r) != 0)
			break;
		strcpy(cc->owner, "network");
		cc->perm = 0666;
		cc->state = "Closed";
		cc->laddr = 0;
		cc->raddr = 0;
		cc->lport = 0;
		cc->rport = 0;
		close(cc->sfd);
		break;
	}
}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:27,代码来源:devip.c


示例11: parse_sheet

/*  BAD  Sheets need work  */
void parse_sheet (int fd)
{
    char localbuf[1000];
    char filename[1000];
    char filetext[1000];
    int size;
    int index;
    int n;
    int x1,y1,x2,y2;

    size = read_block(fd,localbuf,15,sizeof(localbuf));
    // fprintf(stderr,"Sheet %d bytes\n",size);

    x1=CONVX(CONV16(localbuf,0));
    y1=CONVY(CONV16(localbuf,2));

    x2=CONV(CONV16(localbuf,4));
    y2=CONV(CONV16(localbuf,6));
    index = 8;

    /* BAD 5 bytes - dunno? */
    index += 5;

    n = 1+read_string(filename,sizeof(filename),localbuf+index);
    index += n;
    n = 1+read_string(filetext,sizeof(filetext),localbuf+index);
    index += n;

    /* BAD Implement Hierarchy properly! */
    fprintf(stderr,"Hierarchy\n");
    fprintf(stderr,"xy = %d %d %d %d\n",x1,y1,x2,y2);
    for (n=8; n<13; ++n) fprintf(stderr,"%02x ",localbuf[n] & 0xff);
    fprintf(stderr,"\nfile = %s\n",filename);
    fprintf(stderr,"text = %s\n",filetext);

    /* BAD not the way to do it... */
    fprintf(stdout,"C %d %d 0 0 0 include-1.sym\n",x1,y1-y2);
    fprintf(stdout,"{\n");
    fprintf(stdout,"B %d %d %d %d %d 0 0 0 -1 -1 0 -1 -1 -1 -1 -1\n",
					x1,y1-y2,x2,y2,GRAPHIC_COLOR);
    fprintf(stdout,"T %d %d %d %d 0 1 0 0\n"
		   "source=%s\n",x1,y1-y2,ATTRIBUTE_COLOR,TEXTSIZE,filename);
    fprintf(stdout,"T %d %d %d %d 1 1 0 0\n"
		   "%s\n",x1,(y1-y2)-scale,ATTRIBUTE_COLOR,TEXTSIZE,filetext);
    fprintf(stdout,"}\n");
}
开发者ID:SayCV,项目名称:geda-gaf,代码行数:47,代码来源:sarlacc_schem.c


示例12: ip3gen

static int
ip3gen(Chan *c, int i, Dir *dp)
{
	Qid q;
	Conv *cv;
	char *p;

	cv = ipfs[c->dev]->p[PROTO(c->qid)]->conv[CONV(c->qid)];
	if(cv->owner == nil)
		kstrdup(&cv->owner, eve);
	mkqid(&q, QID(PROTO(c->qid), CONV(c->qid), i), 0, QTFILE);

	switch(i) {
	default:
		return -1;
	case Qctl:
		devdir(c, q, "ctl", 0, cv->owner, cv->perm, dp);
		return 1;
	case Qdata:
		devdir(c, q, "data", qlen(cv->rq), cv->owner, cv->perm, dp);
		return 1;
	case Qerr:
		devdir(c, q, "err", qlen(cv->eq), cv->owner, cv->perm, dp);
		return 1;
	case Qlisten:
		devdir(c, q, "listen", 0, cv->owner, cv->perm, dp);
		return 1;
	case Qlocal:
		p = "local";
		break;
	case Qremote:
		p = "remote";
		break;
	case Qsnoop:
		if(strcmp(cv->p->name, "ipifc") != 0)
			return -1;
		devdir(c, q, "snoop", qlen(cv->sq), cv->owner, 0400, dp);
		return 1;
	case Qstatus:
		p = "status";
		break;
	}
	devdir(c, q, p, 0, cv->owner, 0444, dp);
	return 1;
}
开发者ID:99years,项目名称:plan9,代码行数:45,代码来源:devip.c


示例13: convert_packet

void convert_packet (struct rtp_packet_t *packet, enum conversion conv_dir)
{
  if (conv_dir == NTOH)
  {
#define CONV(var) var = ntohs ((uint16_t) var);
  }
  else
  {
#define CONV(var) var = ntohs ((uint16_t) var);
  }

  CONV (packet->connection_id);
  CONV (packet->type);
  CONV (packet->status);

  char tmp[PATH_LEN];
  string_byte_order_convert (tmp, packet->buffer, PATH_LEN, conv_dir);

  strcpy (packet->buffer, tmp);
}
开发者ID:rajatkhanduja,项目名称:Network-assignments,代码行数:20,代码来源:common.c


示例14: cmostime

// qemu seems to use 24-hour GWT and the values are BCD encoded
void
cmostime(struct rtcdate *r)
{
  struct rtcdate t1, t2;
  int sb, bcd;

  sb = cmos_read(CMOS_STATB);

  bcd = (sb & (1 << 2)) == 0;

  // make sure CMOS doesn't modify time while we read it
  for(;;) {
    fill_rtcdate(&t1);
    if(cmos_read(CMOS_STATA) & CMOS_UIP)
        continue;
    fill_rtcdate(&t2);
    if(memcmp(&t1, &t2, sizeof(t1)) == 0)
      break;
  }

  // convert
  if(bcd) {
#define    CONV(x)     (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf))
    CONV(second);
    CONV(minute);
    CONV(hour  );
    CONV(day   );
    CONV(month );
    CONV(year  );
#undef     CONV
  }

  *r = t1;
  r->year += 2000;
}
开发者ID:buf1024,项目名称:xv6-public,代码行数:36,代码来源:lapic.c


示例15: cmd3gen

static int
cmd3gen(Chan *c, int i, Dir *dp)
{
	Qid q;
	Conv *cv;

	cv = cmd.conv[CONV(c->qid)];
	switch(i){
	default:
		return -1;
	case Qdata:
		mkqid(&q, QID(CONV(c->qid), Qdata), 0, QTFILE);
		devdir(c, q, "data", 0, cv->owner, cv->perm, dp);
		return 1;
	case Qstderr:
		mkqid(&q, QID(CONV(c->qid), Qstderr), 0, QTFILE);
		devdir(c, q, "stderr", 0, cv->owner, 0444, dp);
		return 1;
	case Qctl:
		mkqid(&q, QID(CONV(c->qid), Qctl), 0, QTFILE);
		devdir(c, q, "ctl", 0, cv->owner, cv->perm, dp);
		return 1;
	case Qstatus:
		mkqid(&q, QID(CONV(c->qid), Qstatus), 0, QTFILE);
		devdir(c, q, "status", 0, cv->owner, 0444, dp);
		return 1;
	case Qwait:
		mkqid(&q, QID(CONV(c->qid), Qwait), 0, QTFILE);
		devdir(c, q, "wait", 0, cv->owner, 0444, dp);
		return 1;
	}
}
开发者ID:8l,项目名称:inferno,代码行数:32,代码来源:devcmd.c


示例16: ipclose

static void
ipclose(Chan *c)
{
	Fs *f;

	f = ipfs[c->dev];
	switch(TYPE(c->qid)) {
	case Qdata:
	case Qctl:
		if(c->flag & COPEN)
			closeconv(f->p[PROTO(c->qid)]->conv[CONV(c->qid)]);
		break;
	}
}
开发者ID:Vykook,项目名称:acme-sac,代码行数:14,代码来源:devip.c


示例17: ipbread

static Block*
ipbread(Chan* ch, long n, ulong offset)
{
	Conv *c;
	Proto *x;
	Fs *f;

	switch(TYPE(ch->qid)){
	case Qdata:
		f = ipfs[ch->dev];
		x = f->p[PROTO(ch->qid)];
		c = x->conv[CONV(ch->qid)];
		return qbread(c->rq, n);
	default:
		return devbread(ch, n, offset);
	}
}
开发者ID:99years,项目名称:plan9,代码行数:17,代码来源:devip.c


示例18: cmdclose

static void
cmdclose(Chan *c)
{
	Conv *cc;
	int r;

	if((c->flag & COPEN) == 0)
		return;

	switch(TYPE(c->qid)) {
	case Qctl:
	case Qalloc:
	case Qexec:
	case Qdata:
	case Qstderr:
	case Qwait:
		cc = cmd.conv[CONV(c->qid)];
		qlock(&cc->l);
		if(TYPE(c->qid) == Qdata){
			if(c->mode == OWRITE || c->mode == ORDWR)
				cmdfdclose(cc, 0);
			if(c->mode == OREAD || c->mode == ORDWR)
				cmdfdclose(cc, 1);
		}else if(TYPE(c->qid) == Qstderr)
			cmdfdclose(cc, 2);

		r = --cc->inuse;
		if(cc->child != nil){
			if(!cc->killed)
			if(r == 0 || (cc->killonclose && TYPE(c->qid) == Qctl)){
				// oscmdkill(cc->child);
				cc->killed = 1;
			}
		}else if(r == 0)
			closeconv(cc);

		qunlock(&cc->l);
		break;
	}
}
开发者ID:dalmonian,项目名称:harvey,代码行数:40,代码来源:devcmd.c


示例19: ipwstat

static int
ipwstat(Chan *c, uchar *dp, int n)
{
	Dir *d;
	Conv *cv;
	Proto *p;
	Fs *f;

	f = ipfs[c->dev];
	switch(TYPE(c->qid)) {
	default:
		error(Eperm);
		break;
	case Qctl:
	case Qdata:
		break;
	}

	d = smalloc(sizeof(*d)+n);
	if(waserror()){
		free(d);
		nexterror();
	}
	n = convM2D(dp, n, d, (char*)&d[1]);
	if(n == 0)
		error(Eshortstat);
	p = f->p[PROTO(c->qid)];
	cv = p->conv[CONV(c->qid)];
	if(!iseve() && strcmp(up->env->user, cv->owner) != 0)
		error(Eperm);
	if(!emptystr(d->uid))
		kstrdup(&cv->owner, d->uid);
	if(d->mode != ~0UL)
		cv->perm = d->mode & 0777;
	poperror();
	free(d);
	return n;
}
开发者ID:Vykook,项目名称:acme-sac,代码行数:38,代码来源:devip.c


示例20: main

int main(int argc, char **argv)
{
	FILE *in = stdin, *out = stdout;
	progname = basename(*argv);

	if (*(argv+1)) {
		in = fopen(*(argv+1), "rb");
		if (!in) return 1;
	}

	if (*(argv+1) && *(argv+2)) {
		out = fopen(*(argv+2), "wb");
		if (!out) return 2;
	}

	if (0) {}

/* host to target functions */
	CONV(htobe16, x16)
	CONV(htole16, x16)
	CONV(htobe32, x32)
	CONV(htole32, x32)
	CONV(htobe64, x64)
	CONV(htole64, x64)

/* from target to host functions */
	CONV(be16toh, x16)
	CONV(le16toh, x16)
	CONV(be32toh, x32)
	CONV(le32toh, x32)
	CONV(be64toh, x64)
	CONV(le64toh, x64)

	else usage();

	fclose(in);
	fclose(out);

	return 0;
}
开发者ID:robbie-cao,项目名称:lynxware,代码行数:40,代码来源:endconv.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ CONVERT_TO_SHORTPTR函数代码示例发布时间:2022-05-30
下一篇:
C++ CONTROL函数代码示例发布时间: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