Gri Commands
|
12.25: The `
|
new .variable_name. | \synonym_name \ [.variable_name. | \synonym_name \ [...]] |
Set aside storage for new version of the named variable(s) and/or
synonym(s). Any number of variables and synonyms may be specified. If
a given variable/synonym already exists, this will create a new version
of it, and future assignments will be stored in this new version
without affecting the pre-existing version. If the
variable/synonym is `delete
'ed, the new version is deleted, making
the old, unaltered, version accessible again.
This command is used mostly for temporary use, to prevent clashing with
existing values. Suppose you want to change the font size inside a new
command or an if block. Then you might do the following, where the
variable `.tmp.
' is used to store the old font size. Note that the
use of the `new/delete
' statements prevents the assignment to the
local version of the variable `.tmp.
' from affecting the value
known outside the `if
' block, if in fact `.tmp.
' happened to
exist outside the block.
set font size 10 draw label "This is in fontsize 10" at 10 2 cm if .want_title. new .tmp. .tmp. = ..fontsize.. set font size 22 draw label "This is 22 font" at 10 5 cm set font size .tmp. delete .tmp. end if draw label "This is 10 font" at 10 8 cm |