AutoLoad
AutoLoad — allows for run-time symbol lookup.
AutoLoad ("pattern", `action)
patternA shell style pattern.
actionAn action to be taken when the pattern
is matched.
The _auto_load_alist_, which is a list of all currently
stored AutoLoad rules. Each rule is itself formatted as
a list. This is the _auto_load_alist_ syntax:
((patternaction_funcaction_arg...) ...)
The members of each rule list are as follows:
patternThe AutoLoad
pattern parameter.
action_funcThe function specified in the AutoLoad
action parameter.
action_argThe function argument(s) specified in the
AutoLoad
action parameter.
For example, the AutoLoad rules in
AutoLoadLib.g (at the time of this writing) would
be returned as follows:
(("P[Tthg]*" DllLoad "libgammaph.so") ("gl[A-Z]*" DllLoad "libgammagl.so")
("GLUT_*" DllLoad "libgammagl.so") ("GLU_*" DllLoad "libgammagl.so")
("GL_*" DllLoad "libgammagl.so") ("ASCII_*" DllLoad "libgammamgl.so")
("KB_*" DllLoad "libgammamgl.so") ("GM_*" DllLoad "libgammamgl.so")
("EVT_*" DllLoad "libgammamgl.so") ("[mM][gG][lL]*" DllLoad "libgammamgl.so")
("[gG]tk*" DllLoad "gammagtk.so"))This function gives Gamma a way to look up symbols during run-time. If
Gamma comes across an undefined symbol while executing a program, and if the
symbol matches the pattern, then Gamma executes the
action. Normally the
action is either a direct definition of the
symbol, or an attempt to load a DLL that defines the symbol, using DllLoad, for
example.
The available patterns are as follows:
* matches any number of characters, including zero.
[c] matches a single character which is a member of the set contained within the
square brackets.
[^c] matches any single character which is not a member of the set contained within
the square brackets.
? matches a single character.
{xx,yy} matches either of the simple strings contained within the braces.
\c (a backslash followed by a character) - matches that character.
![]() | |
This function is not part of the base Gamma executable. It is provided
by a Gamma library require ("/usr/cogent/require/AutoLoadLib.g"); |
![]() | |
|
Gamma>require ("/usr/cogent/require/AutoLoadLib.g");tGamma>ClearAutoLoad();nilGamma>AutoLoad ("[gG]tk*", `DllLoad ("gammagtk.so"));(("[gG]tk*" DllLoad "gammagtk.so"))Gamma>gtk_arg_new;Looking for gtk_arg_new (defun gtk_arg_new (arg_type) ...)Gamma>gtk_main;(defun gtk_main () ...)Gamma>testvar;Looking for testvar Symbol is undefined: testvar debug 1> (Ctrl - D)Gamma>AutoLoad("testvar", `testvar = 5);(("testvar" setq testvar 5) ("[gG]tk*" DllLoad "gammagtk.so"))Gamma>testvar;Looking for testvar 5Gamma>NoAutoLoad("testvar");(("[gG]tk*" DllLoad "gammagtk.so"))Gamma>testvar;5Gamma>ClearAutoLoad();nilGamma>gtk_main;(defun gtk_main () ...)Gamma>gtk_false;(defun gtk_false () ...)Gamma>