struct variable, #14/18, introduce `var_alloc_xxx()'
This commit is contained in:
parent
bf5acda362
commit
57f56f53a6
|
|
@ -974,6 +974,46 @@ var_alloc(char *name, struct variable *next)
|
|||
return v;
|
||||
}
|
||||
|
||||
struct variable *
|
||||
var_alloc_bool(char *name, bool value, struct variable *next)
|
||||
{
|
||||
struct variable *v = var_alloc(name, next);
|
||||
var_set_bool(v, value);
|
||||
return v;
|
||||
}
|
||||
|
||||
struct variable *
|
||||
var_alloc_num(char *name, int value, struct variable *next)
|
||||
{
|
||||
struct variable *v = var_alloc(name, next);
|
||||
var_set_num(v, value);
|
||||
return v;
|
||||
}
|
||||
|
||||
struct variable *
|
||||
var_alloc_real(char *name, double value, struct variable *next)
|
||||
{
|
||||
struct variable *v = var_alloc(name, next);
|
||||
var_set_real(v, value);
|
||||
return v;
|
||||
}
|
||||
|
||||
struct variable *
|
||||
var_alloc_string(char *name, char * value, struct variable *next)
|
||||
{
|
||||
struct variable *v = var_alloc(name, next);
|
||||
var_set_string(v, value);
|
||||
return v;
|
||||
}
|
||||
|
||||
struct variable *
|
||||
var_alloc_vlist(char *name, struct variable * value, struct variable *next)
|
||||
{
|
||||
struct variable *v = var_alloc(name, next);
|
||||
var_set_vlist(v, value);
|
||||
return v;
|
||||
}
|
||||
|
||||
void
|
||||
var_set_bool(struct variable *v, bool value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,6 +45,12 @@ void free_struct_variable(struct variable *v);
|
|||
|
||||
struct variable *var_alloc(char *name, struct variable *next);
|
||||
|
||||
struct variable *var_alloc_bool(char *name, bool, struct variable *next);
|
||||
struct variable *var_alloc_num(char *name, int, struct variable *next);
|
||||
struct variable *var_alloc_real(char *name, double, struct variable *next);
|
||||
struct variable *var_alloc_string(char *name, char *, struct variable *next);
|
||||
struct variable *var_alloc_vlist(char *name, struct variable *, struct variable *next);
|
||||
|
||||
void var_set_bool(struct variable *, bool);
|
||||
void var_set_num(struct variable *, int);
|
||||
void var_set_real(struct variable *, double);
|
||||
|
|
|
|||
Loading…
Reference in New Issue