struct variable, #9/18, introduce `var_set_xxx()'
This commit is contained in:
parent
cc3a124120
commit
bbbd531d8d
|
|
@ -984,3 +984,38 @@ cp_vprint(void)
|
||||||
|
|
||||||
tfree(vars);
|
tfree(vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
var_set_bool(struct variable *v, bool value)
|
||||||
|
{
|
||||||
|
v->va_type = CP_BOOL;
|
||||||
|
v->va_bool = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
var_set_num(struct variable *v, int value)
|
||||||
|
{
|
||||||
|
v->va_type = CP_NUM;
|
||||||
|
v->va_num = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
var_set_real(struct variable *v, double value)
|
||||||
|
{
|
||||||
|
v->va_type = CP_REAL;
|
||||||
|
v->va_real = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
var_set_string(struct variable *v, char *value)
|
||||||
|
{
|
||||||
|
v->va_type = CP_STRING;
|
||||||
|
v->va_string = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
var_set_vlist(struct variable *v, struct variable *value)
|
||||||
|
{
|
||||||
|
v->va_type = CP_LIST;
|
||||||
|
v->va_vlist = value;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,4 +43,10 @@ wordlist *cp_varwl(struct variable *var);
|
||||||
wordlist *cp_variablesubst(wordlist *wlist);
|
wordlist *cp_variablesubst(wordlist *wlist);
|
||||||
void free_struct_variable(struct variable *v);
|
void free_struct_variable(struct variable *v);
|
||||||
|
|
||||||
|
void var_set_bool(struct variable *, bool);
|
||||||
|
void var_set_num(struct variable *, int);
|
||||||
|
void var_set_real(struct variable *, double);
|
||||||
|
void var_set_string(struct variable *, char *);
|
||||||
|
void var_set_vlist(struct variable *, struct variable *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue