std-var-init | ![]() |
(std-var-init <alst>) ; full version
(std-%var-simple-init <alst>) ; acad independent, sets *std-simple-error*
Error handler and environment initialization.
To be called at the beginning of a user function. Must be used pairwise with STD-VAR-RESTORE
Does some housekeeping, applies useful defaults and passes then the argument to STD-VAR-PUSH
. The simple version is for short functions or function blocks which don't deal with acad dependency, such as open files or function overloading.
The most likely error is a user break by hitting <Esc>.
In detail:
Sets CMDECHO to 0, *ERROR*
to *STD-ERROR*
if not otherwise defined in alst and then all elements in alst according the description below. The simple version sets *ERROR*
to *STD-SIMPLE-ERROR*
It stores internally all old settings to set them back on errors, break or STD-VAR-RESTORE
at the end of the function.
The argument alist is a list of key value pairs. The keys are either strings or symbols.
Each string must be a valid and writable systemvariable. STD-%VAR-SIMPLE-INIT
ignores those keys.
Each symbol marks a special feature. In general functions the pair STD-SAVE-
<symbol-name> and STD-RESTORE-
<symbol-name> are called to save and restore system settings.
See STDTBL for some predefined save/restore pairs
Special predefined symbols are: #- SMALL
;;; Entities, Graphics: (ignored by std-%var-simple-init)
;;; Tables: (ignored by std-%var-simple-init)
(:LAYER [laynam]), see STDTBL
(:UCS [ucs]), see STDTBL
These symbols are prefixed with a colon (":") and are keywords, symbols evaluating to themselves, which means that they don't have to be quoted.
With the SMALL package those predefined symbols above are no keywords.
So you have to explicitly quote them, otherwise they will evaluate to nil.
The values have special meanings according the above table. They are special initialization parameters dependent on the key. They are usually parameters for the accompanied STD-SAVE-
function.
For a more detailed description per key and a discussion about error stack frames
see STD-VAR-PUSH
(defun c:usercommand () (std-var-init '(("OSMODE" . 0) ("SNAPMODE" . 0))) ... (std-var-restore) )
alst: list of special key value pairs, a dotted pair list
undefined
This function is only called because of it's side-effects. It sets and safe various system settings, dependent on the argument alist. See the description above.
It stores the intermediate stack frame in the global variable *STD:VAR-STACK*, a list of all active stack frames.
(std-require 'STDERROR)
Defined in STDERROR