本文整理汇总了C++中setdata函数的典型用法代码示例。如果您正苦于以下问题:C++ setdata函数的具体用法?C++ setdata怎么用?C++ setdata使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setdata函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例4: d12_write_command
static void d12_write_command(uint8_t cmd)
{
sethigh(A0_N);
setlow(WR_N);
setdata(cmd);
sethigh(WR_N);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例11: d12_write_byte
static void d12_write_byte(uint8_t val)
{
setlow(A0_N);
setlow(WR_N);
setdata(val);
sethigh(WR_N);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}