Next: Deleting Variables, Previous: Accessing Variables, Up: Dictionaries [Contents][Index]
These functions create a new variable and insert it into a dictionary in a single step.
There is no provision for inserting an already created variable into a dictionary. There is no reason that such a function could not be written, but so far there has been no need for one.
The names provided to one of these functions should be valid variable names and must be plausible variable names.
If a variable with the same name already exists in the dictionary, the
non-assert
variants of these functions return a null pointer,
without modifying the dictionary. The assert
variants, on the
other hand, assert that no duplicate name exists.
A variable may be in only one dictionary at any given time.
Creates a new variable with the given name and width, as
if through a call to var_create
with those arguments
(see var_create), appends the new variable to dict’s array
of variables, and returns the new variable.
Creates a new variable as a clone of var, inserts the new
variable into dict, and returns the new variable. Other
properties of the new variable are copied from old_var, except
for those not copied by var_clone
(see var_clone).
var does not need to be a member of any dictionary.
These functions are similar to dict_clone_var
and
dict_clone_var_assert
, respectively, except that the new
variable is named name instead of keeping old_var’s name.
Next: Deleting Variables, Previous: Accessing Variables, Up: Dictionaries [Contents][Index]