Next: preprocessor nameref partial, Previous: preprocessor nameref access, Up: preprocessor nameref [Contents][Index]
When defining array variables we must use the specific macros, rather than the ones below; Special NAMEREF declarations.
Expands into:
local mbfl_a_variable_NAME mbfl_variable_alloc mbfl_a_variable_NAME local LOCAL_OPTIONS $mbfl_a_variable_NAME local -n NAME=$mbfl_a_variable_NAME
and when INIT_VALUE is not empty, it finishes with:
NAME=INIT_VALUE
A local name variable mbfl_a_variable_NAME
is declared and filled with a unique
data variable name by mbfl_variable_alloc()
; then the data variable is declared as
local; finally a proxy variable NAME
is defined as alias for the data variable.
The data variable is given the LOCAL_OPTIONS.
Expands into:
local mbfl_a_variable_NAME mbfl_variable_alloc mbfl_a_variable_NAME declare -g DECLARE_OPTIONS $mbfl_a_variable_NAME local -n NAME=$mbfl_a_variable_NAME
and when INIT_VALUE is not empty, it finishes with:
NAME=INIT_VALUE
A local name variable mbfl_a_variable_NAME
is declared and filled with a unique
data variable name by mbfl_variable_alloc()
; then the data variable is declared as
global; finally a proxy variable NAME
is defined as alias for the data variable.
The data variable is given the DECLARE_OPTIONS.
When we have finished using a global varref set of variables, we must unset the global data variable; we can do it as follows:
function main () { mbfl_global_varref(VAR) mbfl_location_enter { mbfl_location_handler "unset -v mbfl_datavar(VAR)" # Do something here with VAR. ... } mbfl_location_leave }
Next: preprocessor nameref partial, Previous: preprocessor nameref access, Up: preprocessor nameref [Contents][Index]