diff --git a/src/frontend/variable.c b/src/frontend/variable.c index 11e475cee..95af485ba 100644 --- a/src/frontend/variable.c +++ b/src/frontend/variable.c @@ -984,3 +984,38 @@ cp_vprint(void) 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; +} diff --git a/src/frontend/variable.h b/src/frontend/variable.h index 313d7622d..00877b7e8 100644 --- a/src/frontend/variable.h +++ b/src/frontend/variable.h @@ -43,4 +43,10 @@ wordlist *cp_varwl(struct variable *var); wordlist *cp_variablesubst(wordlist *wlist); 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