next up previous contents index
Next: Xic Version Up: Main Functions 1 Previous: Technology File   Contents   Index

Variables

Set(name, string)
The Set function allows variable name to be set to string as with the !set keyboard operation in Xic. Some variables, such as the search paths, directly affect Xic operation. The Set function can also set arbitrary variables, which may be useful to the script programmer. To set a variable, both arguments should be strings. If the second argument is the constant zero (0 or NULL, not "0") or a null (not empty) string, the variable will be unset if set. As with !set, forms like $(name) are expanded. If name matches the name of a previously set variable, that variable's value string replaces the form. Otherwise, if name matches an environment variable, the environment variable text replaces the form.

The Set function will permanently change the variable value. See the PushSet function for an alternative.

Unset(name)
This function will unset the variable. No action is taken if the variable is not already set. This is equivalent to Set(name, 0).

PushSet(name, string)
This function is similar to Set, however the previous value is stored internally, and can be restored with PopSet. In addition, all variables set (or unset) with PushSet are reverted to original values when the script exits, thus avoiding permanent changes. There can be arbitrarily many PushSet and PopSet operations on a variable.

PopSet(name)
This reverts a variable set with PushSet to its previous state. If the variable has not been set (or unset) with PushSet, no action is taken.

(string) SetExpand(string, use_env)
This function returns a copy of string which expands variable references in the form $(word) in string. The word is expected to be a variable previously set with the Set function or !set command. The value of the variable replaces the reference in the returned string. If the integer use_env is nonzero, variables found in the environment will also be substituted. If word is not resolved, no change is made. Otherwise, in general, the token is replaced with the value of word.

There is an exception to the direct-substitution rule. If any substitution string is of the form ``(...)'', then the parentheses and leading/trailing white space are stripped before substitution, and the entire substituted string is enclosed in parentheses if it is not already. This is for convenience when adding a directory to a search path (see 2.6) variable, and the path is enclosed in parentheses. See the !set command description in 19.26 for more information.

(string) Get(name)
The Get function returns a string containing the value of name, which has been previously set with the Set function, or otherwise from within Xic. A null string is returned if the named variable has not been set.

JoinLimits(flag)
This is a convenience function to set/unset the variables which control the polygon joining process, i.e., JoinMaxPolyVerts, JoinMaxPolyQueue, and JoinMaxPolyGroup. If the argument is zero, each of these variables is set to zero, removing all limits. If the argument is nonzero, the variables are unset, meaning that the default limits will be applied. The default limits generally speed processing, but will often leave unjoined joinable pieces when complex polygons are constructed. The status of the variables will persist after the script terminates. This function has no return value.


next up previous contents index
Next: Xic Version Up: Main Functions 1 Previous: Technology File   Contents   Index
Stephen R. Whiteley 2024-09-29