本文整理汇总了C++中setdata函数的典型用法代码示例。如果您正苦于以下问题:C++ setdata函数的具体用法?C++ setdata怎么用?C++ setdata使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setdata函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
freopen("palsquare.in","r",stdin);
freopen("palsquare.out","w",stdout);
bnumber *bn = (bnumber *)calloc(1,sizeof(bnumber));
bnumber *bp = (bnumber *)calloc(1,sizeof(bnumber));
int base,i;
scanf("%d",&base);
bn->base = bp->base = base;
for(i = 1;i <= 300;i++)
{
setdata(i * i,bp);
if(is_prlindormic(bp->data,bp->length))
{
setdata(i,bn);
printnum(bn->data,bn->length);
printf(" ");
printnum(bp->data,bp->length);
printf("\n");
}
}
fclose(stdin);
fclose(stdout);
return 0;
}
开发者ID:Rolight,项目名称:ACM_ICPC,代码行数:25,代码来源:Palindromic+Squares.c
示例2: main
int main()
{
node* headptr;//保存第一个节点的地址
createlist(&headptr);
insert(&headptr, 10, 2);//无效位置,会更正成末尾
insert(&headptr, 20, 0);//20,10
insert(&headptr, 30, 2);//20,10,30
insert(&headptr, 40, 1);//20,40,10,30
insert(&headptr, 50, 8);//无效位置,会更正成末尾
travel(headptr);
printf("剩余%d个数据\n", listsize(headptr));
int n = find(headptr, 10);
printf("查找10在第%d个节点\n", n);
erase(&headptr, n);
travel(headptr);
n = find(headptr, 10);
printf("查找10在第%d个节点\n", n);
erase(&headptr, n);
travel(headptr);
setdata(headptr, 10, 100);
setdata(headptr, 2, 99);
travel(headptr);
clear(&headptr);
printf("剩余%d个数据\n", listsize(headptr));
return 0;
}
开发者ID:Jacob-jiangbo,项目名称:my-test,代码行数:26,代码来源:list.c
示例3: mips4kboot
/*
* mips4k bootable image.
*/
static int
mips4kboot(int fd, Fhdr *fp, ExecHdr *hp)
{
abort();
#ifdef unused
USED(fd);
fp->type = FMIPSB;
switch(hp->e.h.amagic) {
default:
case 0407: /* some kind of mips */
settext(fp, (u32int)hp->e.h.mentry, (u32int)hp->e.h.text_start,
hp->e.h.tsize, sizeof(struct mips4kexec));
setdata(fp, (u32int)hp->e.h.data_start, hp->e.h.dsize,
fp->txtoff+hp->e.h.tsize, hp->e.h.bsize);
break;
case 0413: /* some kind of mips */
settext(fp, (u32int)hp->e.h.mentry, (u32int)hp->e.h.text_start,
hp->e.h.tsize, 0);
setdata(fp, (u32int)hp->e.h.data_start, hp->e.h.dsize,
hp->e.h.tsize, hp->e.h.bsize);
break;
}
setsym(fp, hp->e.h.nsyms, 0, hp->e.h.pcsize, hp->e.h.symptr);
fp->hdrsz = 0; /* header stripped */
#endif
return 1;
}
开发者ID:8l,项目名称:go-learn,代码行数:30,代码来源:executable.c
示例4: d12_write_command
static void d12_write_command(uint8_t cmd)
{
sethigh(A0_N);
setlow(WR_N);
setdata(cmd);
sethigh(WR_N);
}
开发者ID:artprogramming,项目名称:usb,代码行数:7,代码来源:d12.c
示例5: imc_send_direct
void imc_send_direct(const imc_char_data *from, int channel,
const char *argument, const char *to) {
/* This sends a message out only to those MUDs directly connected to the one running this code.
Added 12/26/98 to cut down on UCMM IMC network traffic -- Scion */
imc_packet out;
char tobuf[IMC_MNAME_LENGTH];
imc_connect *c;
if (imc_active<IA_UP)
return;
setdata(&out, from);
strcpy(out.type, "chat"); /* emulate a broadcast packet so we don't have to add a imc_recv_direct() */
strcpy(out.to, "*@!direct!"); /* But we're not sending to *@* this time. */
imc_addkey(&out.data, "text", argument);
imc_addkeyi(&out.data, "channel", channel);
for (c=imc_connect_list; c; c=c->next) /* Go through the list of direct connections */
if (c->state==IMC_CONNECTED) {
strcpy(tobuf, c->info->name);
strcpy(out.to, "*@");
strcat(out.to, tobuf);
imc_send(&out); /* And send them what they think is a broadcast packet. */
}
imc_freedata(&out.data);
}
开发者ID:bkero,项目名称:Smaug,代码行数:28,代码来源:imc-interp.c
示例6: test
void test(int system)
{
printf("init ...\n");
int mice = lmice_init(system);
if (mice < 0) {
ERROR;
}
OK;
printf("%d mice found\n", mice);
printf("creating result\n");
LMiceResult *result = lmice_result_new();
printf("read ... ");
if (!lmice_read(result, true)) {
ERROR;
}
OK;
printf("count ... ");
if (lmice_count() < 0) {
ERROR;
}
OK;
printf("lmice_count() == (return) lmcie_init() ...");
if (lmice_count() != mice) {
printf("lmice_init returned %d and lmice_count retuned %d\n", mice, lmice_count());
ERROR;
}
OK;
printf("clear ... (void)\n");
lmice_clear();
OK;
setdata(result);
printf("config_set ...");
if (lmice_config_set(result) == false) {
ERROR;
}
OK;
printf("config_save ...");
if (lmice_config_save(NULL) == false) {
ERROR;
}
OK;
printf("config_load ...");
if (lmice_config_load(NULL) == false) {
ERROR;
}
OK;
printf("uninit ... (void)\n");
lmice_uninit(false);
OK;
lmice_result_delete(result);
}
开发者ID:aash29,项目名称:liblmice,代码行数:60,代码来源:test.c
示例7: assert
void cmoorecoinsecret::setkey(const ckey& vchsecret)
{
assert(vchsecret.isvalid());
setdata(params().base58prefix(cchainparams::secret_key), vchsecret.begin(), vchsecret.size());
if (vchsecret.iscompressed())
vchdata.push_back(1);
}
开发者ID:moorecoin,项目名称:MooreCoinMiningAlgorithm,代码行数:7,代码来源:base58.cpp
示例8: imc_send_emote
/* send an emote out on a channel */
void imc_send_emote(const imc_char_data *from, int channel,
const char *argument, const char *to)
{
imc_packet out;
char tobuf[IMC_MNAME_LENGTH];
if (imc_active<IA_UP)
return;
setdata(&out, from);
strcpy(out.type, "emote");
imc_addkeyi(&out.data, "channel", channel);
imc_addkey(&out.data, "text", argument);
to=imc_getarg(to, tobuf, IMC_MNAME_LENGTH);
while (tobuf[0])
{
if (!strcmp(tobuf, "*") || !strcasecmp(tobuf, imc_name) ||
imc_find_reminfo(tobuf, 0))
{
strcpy(out.to, "*@");
strcat(out.to, tobuf);
imc_send(&out);
}
to=imc_getarg(to, tobuf, IMC_MNAME_LENGTH);
}
imc_freedata(&out.data);
}
开发者ID:bkero,项目名称:Smaug,代码行数:32,代码来源:imc-interp.c
示例9: commonllp64
static int
commonllp64(int, Fhdr *fp, ExecHdr *hp)
{
long pgsize;
uvlong entry;
hswal(&hp->e, sizeof(Exec)/sizeof(long), beswal);
if(!(hp->e.magic & HDR_MAGIC))
return 0;
/*
* There can be more magic here if the
* header ever needs more expansion.
* For now just catch use of any of the
* unused bits.
*/
if((hp->e.magic & ~DYN_MAGIC)>>16)
return 0;
entry = beswav(hp->e.hdr[0]);
pgsize = mach->pgsize;
settext(fp, entry, pgsize+fp->hdrsz, hp->e.text, fp->hdrsz);
setdata(fp, _round(pgsize+fp->txtsz+fp->hdrsz, pgsize),
hp->e.data, fp->txtsz+fp->hdrsz, hp->e.bss);
setsym(fp, hp->e.syms, hp->e.spsz, hp->e.pcsz, fp->datoff+fp->datsz);
if(hp->e.magic & DYN_MAGIC) {
fp->txtaddr = 0;
fp->dataddr = fp->txtsz;
return 1;
}
commonboot(fp);
return 1;
}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:34,代码来源:executable.c
示例10: main
int main()
{
freopen("dualpal.in","r",stdin);
freopen("dualpal.out","w",stdout);
int count,std;
scanf("%d%d",&count,&std);
while(count > 0)
{
std++;
int i,flag = 0;
for(i = 2;i <= 10;i++)
{
if(flag == 2) break;
bnumber *bn = (bnumber *)calloc(1,sizeof(bnumber));
bn->base = i;
setdata(std,bn);
if(is_prlindormic(bn->data,bn->length))
flag++;
free(bn);
}
if(flag == 2)
{
printf("%d\n",std);
count--;
}
}
fclose(stdin);
fclose(stdout);
}
开发者ID:Rolight,项目名称:ACM_ICPC,代码行数:30,代码来源:Dual+Palindromes.c
示例11: d12_write_byte
static void d12_write_byte(uint8_t val)
{
setlow(A0_N);
setlow(WR_N);
setdata(val);
sethigh(WR_N);
}
开发者ID:artprogramming,项目名称:usb,代码行数:7,代码来源:d12.c
示例12: setrep
void MCImage::set_gif(uint1 *data, uint4 length)
{
if (data == nil)
setrep(nil);
else
setdata(data, length);
flags |= F_GIF;
obj_id = 1;
}
开发者ID:soapdog,项目名称:livecode,代码行数:10,代码来源:iimport.cpp
示例13: add_data
static void add_data(window w)
{
dialog_data *d;
d = create (dialog_data);
if (! d)
return;
d->hit = NOT_CHOSEN_YET;
setdata(w, d);
}
开发者ID:Chaos1989,项目名称:r-source,代码行数:11,代码来源:dialogs.c
示例14: iom_lcd_write
ssize_t iom_lcd_write(struct file *inode, const char *gdata, size_t length,
loff_t *off_what)
{
int i;
if(length > BUFSZ) length = BUFSZ;
copy_from_user(buf,gdata,length);
printk("%s %d\n",buf,length);
for(i=0; i<length; i++) setdata(buf[i]);
return length;
}
开发者ID:SDRLurker,项目名称:WACOP,代码行数:11,代码来源:lcd_mydrv.c
示例15: dataval
dataval(register expptr repp, register expptr valp)
#endif
{
int i, nrep;
ftnint elen;
register Addrp p;
if (parstate < INDATA) {
frexpr(repp);
goto ret;
}
if(repp == NULL)
nrep = 1;
else if (ISICON(repp) && repp->constblock.Const.ci >= 0)
nrep = repp->constblock.Const.ci;
else
{
err("invalid repetition count in DATA statement");
frexpr(repp);
goto ret;
}
frexpr(repp);
if( ! ISCONST(valp) ) {
if (valp->tag == TADDR
&& valp->addrblock.uname_tag == UNAM_CONST) {
/* kludge */
frexpr(valp->addrblock.memoffset);
valp->tag = TCONST;
}
else {
err("non-constant initializer");
goto ret;
}
}
if(toomanyinit) goto ret;
for(i = 0 ; i < nrep ; ++i)
{
p = nextdata(&elen);
if(p == NULL)
{
err("too many initializers");
toomanyinit = YES;
goto ret;
}
setdata((Addrp)p, (Constp)valp, elen);
frexpr((expptr)p);
}
ret:
frexpr(valp);
}
开发者ID:gauravtewari,项目名称:simplescalar,代码行数:53,代码来源:data.c
示例16: prefork
void
prefork(LinkList list, int flags)
{
LinkNode node;
MUSTUSEHEAP("prefork");
for (node = firstnode(list); node; incnode(node)) {
char *str, *str3;
str = str3 = (char *)getdata(node);
if ((*str == Inang || *str == Outang || *str == Equals) &&
str[1] == Inpar) {
if (*str == Inang || *str == Outang)
setdata(node, (void *) getproc(str)); /* <(...) or >(...) */
else
setdata(node, (void *) getoutputfile(str)); /* =(...) */
if (!getdata(node))
return;
} else {
if (isset(SHFILEEXPANSION))
filesub((char **)getaddrdata(node), flags & 3);
if (!(node = stringsubst(list, node, flags & 4)))
return;
}
}
for (node = firstnode(list); node; incnode(node)) {
if (*(char *)getdata(node)) {
remnulargs(getdata(node));
if (unset(IGNOREBRACES) && !(flags & 4))
while (hasbraces(getdata(node)))
xpandbraces(list, &node);
if (unset(SHFILEEXPANSION))
filesub((char **)getaddrdata(node), flags & 3);
} else if (!(flags & 4))
uremnode(list, node);
if (errflag)
return;
}
}
开发者ID:redwinner,项目名称:unxutils,代码行数:39,代码来源:subst.c
示例17: sparcboot
/*
* sparc bootable image
*/
static int
sparcboot(int fd, Fhdr *fp, ExecHdr *hp)
{
USED(fd);
fp->type = FSPARCB;
settext(fp, hp->e.sentry, hp->e.sentry, hp->e.stext,
sizeof(struct sparcexec));
setdata(fp, hp->e.sentry+hp->e.stext, hp->e.sdata,
fp->txtoff+hp->e.stext, hp->e.sbss);
setsym(fp, hp->e.ssyms, 0, hp->e.sdrsize, fp->datoff+hp->e.sdata);
fp->hdrsz = 0; /* header stripped */
return 1;
}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:16,代码来源:executable.c
示例18: setdata
void*data_sine(ambixtest_presentationformat_t fmt, uint64_t frames, uint32_t channels, float32_t freq) {
float64_t periods=freq/44100.;
void*data=data_calloc(fmt, frames*channels);
int64_t frame;
for(frame=0; frame<frames; frame++) {
int32_t chan;
float64_t f=(float64_t)frame*periods;
float64_t value=0.5*sin(f);
for(chan=0; chan<channels; chan++)
setdata(fmt, data, f*channels+chan, value);
}
return data;
}
开发者ID:iem-projects,项目名称:ambix,代码行数:13,代码来源:common.c
示例19: nextboot
/*
* next bootable image
*/
static int
nextboot(int fd, Fhdr *fp, ExecHdr *hp)
{
USED(fd);
fp->type = FNEXTB;
settext(fp, hp->e.textc.vmaddr, hp->e.textc.vmaddr,
hp->e.texts.size, hp->e.texts.offset);
setdata(fp, hp->e.datac.vmaddr, hp->e.datas.size,
hp->e.datas.offset, hp->e.bsss.size);
setsym(fp, hp->e.symc.nsyms, hp->e.symc.spoff, hp->e.symc.pcoff,
hp->e.symc.symoff);
fp->hdrsz = 0; /* header stripped */
return 1;
}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:17,代码来源:executable.c
示例20: adotout
/*
* Crack a normal a.out-type header
*/
static int
adotout(int fd, Fhdr *fp, ExecHdr *hp)
{
long pgsize;
USED(fd);
pgsize = mach->pgsize;
settext(fp, hp->e.entry, pgsize+sizeof(Exec),
hp->e.text, sizeof(Exec));
setdata(fp, _round(pgsize+fp->txtsz+sizeof(Exec), pgsize),
hp->e.data, fp->txtsz+sizeof(Exec), hp->e.bss);
setsym(fp, hp->e.syms, hp->e.spsz, hp->e.pcsz, fp->datoff+fp->datsz);
return 1;
}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:17,代码来源:executable.c
注:本文中的setdata函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论