本文整理汇总了C++中setvalue函数的典型用法代码示例。如果您正苦于以下问题:C++ setvalue函数的具体用法?C++ setvalue怎么用?C++ setvalue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setvalue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nyx_set_audio_params
void nyx_set_audio_params(double rate, long len)
{
LVAL flo;
LVAL con;
xlstkcheck(2);
xlsave(flo);
xlsave(con);
/* Bind the sample rate to the "*sound-srate*" global */
flo = cvflonum(rate);
setvalue(xlenter("*SOUND-SRATE*"), flo);
/* Bind selection len to "len" global */
flo = cvflonum(len);
setvalue(xlenter("LEN"), flo);
/* Set the "*warp*" global based on the length of the audio */
con = cons(NULL, NULL);
flo = cvflonum(len > 0 ? (double) len / rate : 1.0);
con = cons(flo, con);
flo = cvflonum(0);
con = cons(flo, con);
setvalue(xlenter("*WARP*"), con);
xlpopn(2);
}
示例2: xlsave3
/* evalhook - call the evalhook function */
LOCAL NODE *evalhook(NODE *expr)
{
NODE ***oldstk,*ehook __HEAPIFY,*ahook __HEAPIFY,*args __HEAPIFY,*val;
/* create a new stack frame */
oldstk = xlsave3(&ehook,&ahook,&args);
/* make an argument list */
args = consa(expr);
rplacd(args,consa(xlenv));
/* rebind the hook functions to nil */
ehook = getvalue(s_evalhook);
setvalue(s_evalhook,NIL);
ahook = getvalue(s_applyhook);
setvalue(s_applyhook,NIL);
/* call the hook function */
val = xlapply(ehook,args);
/* unbind the symbols */
setvalue(s_evalhook,ehook);
setvalue(s_applyhook,ahook);
/* restore the previous stack frame */
xlstack = oldstk;
/* return the value */
return (val);
}
示例3: P3C
LOCAL VOID set_hardware_address P3C(CPTR, ptr, LVAL, object, int *, type)
{
LVAL t, p, last, result, oblistsym, newoblist;
if (! objectp(object)) xlerror("not an object", object);
oblistsym = s_hardware_objects;
if (! consp(getvalue(oblistsym))) setvalue(oblistsym, NIL);
xlstkcheck(4);
xlsave(t);
xlsave(p);
xlsave(result);
xlsave(newoblist);
t = cvfixnum((FIXTYPE) time_stamp);
p = cvfixnum((FIXTYPE) ptr);
result = last = consa(object);
result = cons(p, result);
result = cons(t, result);
newoblist = cons(result, getvalue(oblistsym));
setvalue(oblistsym, newoblist);
set_slot_value(object, s_hardware_address, result);
for (;*type != NONE; type++, last = cdr(last)) {
t = cvfixnum((FIXTYPE) *type);
t = consa(t);
rplacd(last, t);
}
xlpopn(4);
}
示例4: strwidth
char *askUserPass(const char *title)
{
static window win = NULL;
dialog_data *d;
window prev = current_window;
if (! win) {
int tw, bw, h, middle;
tw = strwidth(SystemFont, G_("Cancel")) * 8;
h = getheight(SystemFont);
if (tw < 150) tw = 150;
win = newwindow(title, rect(0, 0, tw+30, h*9+12),
Titlebar | Centered | Modal);
setbackground(win, dialog_bg());
add_data(win);
d = data(win);
d->question = newlabel(G_("User"), rect(10, h, tw+4, h*2+2), AlignLeft);
bw = strwidth(SystemFont, G_("Password"));
d->text = newfield("", rect(20+bw, h, tw-6-bw, h*3/2));
newlabel(_("Password"), rect(10, h*4, tw+4, h*2+2), AlignLeft);
d->pass = newpassword("", rect(20+bw, h*4, tw-6-bw, h*3/2));
middle = (tw+30)/2;
bw = strwidth(SystemFont, G_("Cancel")) * 3/2;
d->yes = newbutton(G_("OK"),
rect(middle-bw-10, h*7, bw, h+10), hit_button);
setvalue(d->yes, YES);
d->cancel = newbutton(G_("Cancel"),
rect(middle+10, h*7, bw, h+10), hit_button);
setvalue(d->cancel, CANCEL);
setkeydown(win, hit_key);
} else {
d = data(win);
settext(d->text, "");
settext(d->pass, "");
}
if (TopmostDialogs & MB_TOPMOST)
BringToTop(win, 1);
handle_message_dialog(win);
current_window = prev;
{
char *user, *pass;
static char buf[1000];
if (d->hit < YES) /* cancelled */ return "";
if (d->text) user = new_string(GA_gettext(d->text));
else return "";
if (d->pass) pass = new_string(GA_gettext(d->pass));
else return "";
snprintf(buf, 1000, "%s:%s", user, pass);
return buf;
}
return ""; /* -Wall */
}
示例5: parse
/* parse - read and parse an input line */
int parse()
{
if (!parse1())
return (FALSE);
setvalue(V_ACTOR,actor);
setvalue(V_ACTION,action);
setvalue(V_DOBJECT,dobject);
setvalue(V_NDOBJECTS,ndobjects);
setvalue(V_IOBJECT,iobject);
return (TRUE);
}
示例6: newmdimenu
menu newmdimenu()
{
menu m ;
if (!ismdi()) return NULL;
m = newmenu(G_("Windows"));
setvalue(newmenuitem(G_("Cascade"),0,mdimenu),1);
setvalue(newmenuitem(G_("Tile &Horizontally"),0,mdimenu),2);
setvalue(newmenuitem(G_("Tile &Vertically"),0,mdimenu),3);
setvalue(newmenuitem(G_("Arrange Icons"),0,mdimenu),4);
current_menubar->menubar = m;
return m;
}
示例7: next
/* next - get the next command (next direct object) */
int next()
{
if (getvalue(V_NDOBJECTS) > 1) {
setvalue(V_ACTOR,actor);
setvalue(V_ACTION,action);
setvalue(V_DOBJECT,getvalue(V_DOBJECT) + 1);
setvalue(V_NDOBJECTS,getvalue(V_NDOBJECTS) - 1);
setvalue(V_IOBJECT,iobject);
return (TRUE);
}
else
return (FALSE);
}
示例8: cvsymbol
/* xlmakesym - make a new symbol node */
NODE *xlmakesym(char *name,int type)
{
NODE *sym;
sym = (type == DYNAMIC ? cvsymbol(name) : cvcsymbol(name));
setvalue(sym,*name == ':' ? sym : s_unbound);
return (sym);
}
示例9: setvalue
ArrayOfMatrices::ArrayOfMatrices (const mxArray* ptrs[], int numptrs)
: Array<Matrix*>(numptrs) {
setvalue(0);
for (int i = 0; i < numptrs; i++)
elems[i] = new Matrix(ptrs[i]);
}
示例10: strcpy
void
GAParameter::copy(const GAParameter& orig)
{
if(&orig == this)
{
return;
}
delete [] fname;
delete [] sname;
if(orig.fname)
{
fname = new char[strlen(orig.fname) + 1];
strcpy(fname, orig.fname);
}
else
{
fname = (char *)0;
}
if(orig.sname)
{
sname = new char[strlen(orig.sname) + 1];
strcpy(sname, orig.sname);
}
else
{
sname = (char *)0;
}
t = orig.t;
setvalue(orig.value()); /// do this directly...
}
示例11: xlsetvalue
/* xlsetvalue - set the value of a symbol */
void xlsetvalue(LVAL sym, LVAL val)
{
register LVAL fp,ep;
/* look for the symbol in the environment list */
for (fp = xlenv; fp; fp = cdr(fp))
/* check for an instance variable */
if ((ep = car(fp)) && objectp(car(ep))) {
if (xlobsetvalue(ep,sym,val))
return;
}
/* check an environment stack frame */
else {
for (; ep; ep = cdr(ep))
if (sym == car(car(ep))) {
rplacd(car(ep),val);
return;
}
}
/* store the global value */
setvalue(sym,val);
}
示例12: xlrinit
/* xlrinit - initialize the reader */
void xlrinit(void)
{
LVAL rtable;
char *p;
int ch;
/* create the read table */
rtable = newvector(256);
setvalue(s_rtable,rtable);
/* initialize the readtable */
for (p = WSPACE; ch = *p++; )
setelement(rtable,ch,k_wspace);
for (p = CONST1; ch = *p++; )
setelement(rtable,ch,k_const);
for (p = CONST2; ch = *p++; )
setelement(rtable,ch,k_const);
/* setup the escape characters */
setelement(rtable,'\\',k_sescape);
setelement(rtable,'|', k_mescape);
/* install the read macros */
defmacro('#', k_nmacro,FT_RMHASH);
defmacro('\'',k_tmacro,FT_RMQUOTE);
defmacro('"', k_tmacro,FT_RMDQUOTE);
defmacro('`', k_tmacro,FT_RMBQUOTE);
defmacro(',', k_tmacro,FT_RMCOMMA);
defmacro('(', k_tmacro,FT_RMLPAR);
defmacro(')', k_tmacro,FT_RMRPAR);
defmacro(';', k_tmacro,FT_RMSEMI);
}
示例13: nyx_save_obarray
// Make a copy of the original obarray, leaving the original in place
LOCAL void nyx_save_obarray()
{
LVAL newarray;
int i;
// This provide permanent protection for nyx_obarray as we do not want it
// to be garbage-collected.
xlprot1(nyx_obarray);
nyx_obarray = getvalue(obarray);
// Create and set the new vector. This allows us to use xlenter() to
// properly add the new symbol. Probably slower than adding directly,
// but guarantees proper hashing.
newarray = newvector(HSIZE);
setvalue(obarray, newarray);
// Scan all obarray vectors
for (i = 0; i < HSIZE; i++) {
LVAL sym;
// Scan all elements
for (sym = getelement(nyx_obarray, i); sym; sym = cdr(sym)) {
LVAL syma = car(sym);
char *name = (char *) getstring(getpname(syma));
LVAL nsym = xlenter(name);
// Ignore *OBARRAY* since there's no need to copy it
if (strcmp(name, "*OBARRAY*") == 0) {
continue;
}
// Ignore *SCRATCH* since it's allowed to be updated
if (strcmp(name, "*SCRATCH*") == 0) {
continue;
}
// Duplicate the symbol's values
setvalue(nsym, nyx_dup_value(getvalue(syma)));
setplist(nsym, nyx_dup_value(getplist(syma)));
setfunction(nsym, nyx_dup_value(getfunction(syma)));
}
}
// Swap the obarrays, so that the original is put back into service
setvalue(obarray, nyx_obarray);
nyx_obarray = newarray;
}
示例14: decode_array
static int decode_array( rabbit * r, rawbuffer * buf, TValue * tv )
{
int c = decode_read_byte( buf ); // skip ":"
if(c != PHP_COLON) {
kLOG(r, 0, "PHP Deserialize : Expect ':' After 'a'\n");
return -1;
}
int len;
int count = stoi(buf->buf + buf->pos, buf->len - buf->pos, &len);
buf->pos += len;
c = decode_read_byte( buf );
if(c != PHP_COLON) {
kLOG(r, 0, "PHP Deserialize : Expect ':' After 'a:count'\n");
return -1;
}
c = decode_read_byte( buf );
if(c != PHP_LBRACE) {
kLOG(r, 0, "PHP Deserialize : Expect '{' in Decode Array\n");
return -1;
}
Table * t = rbtH_init(r, 1, 4);
int i;
TValue key, val;
for(i = 0; i < count; ++i) {
if(php_deserialize(r, buf, &key) < 0) {
return -1;
}
c = decode_read_byte( buf );
if(c != PHP_SEMICOLON) {
kLOG(r, 0, "PHP Deserialize : Expect ';' Between 'key' and 'value' in Decode Array\n");
return -1;
}
if(php_deserialize(r, buf, &val) < 0) {
return -1;
}
c = decode_read_byte( buf );
if(c != PHP_SEMICOLON) {
buf->pos--;
}
setvalue(rbtH_set(r, t, &key), &val);
}
c = decode_read_byte( buf );
if(c != PHP_RBRACE) {
kLOG(r, 0, "PHP Deserialize : Expect '}' when Array close\n");
return -1;
}
settblvalue(tv, t);
return 0;
}
示例15: xlsinit
/* xlsinit - symbol initialization routine */
void xlsinit(void)
{
NODE *array,*p;
/* initialize the obarray */
obarray = xlmakesym("*OBARRAY*",STATIC);
array = newvector(HSIZE);
setvalue(obarray,array);
/* add the symbol *OBARRAY* to the obarray */
p = consa(obarray);
setelement(array,hash("*OBARRAY*",HSIZE),p);
/* enter the unbound symbol indicator */
s_unbound = xlsenter("*UNBOUND*");
setvalue(s_unbound,s_unbound);
}