Macros

Macros are used by the GridLAB-D GLM loader to control how the GLM is interpreted. All macros are introduced by a hash mark, e.g.,

// conditional
 * 1) if test
 * 1) endif


 * #binpath path : Define the path to search for executables.


 * #debug string : Prints string when debugging is enabled.


 * #define variable=value : Define new macro variables.


 * #endif : End an #if, #ifdef, or #ifndef block.


 * #else : Open an alternative block after an #if, #ifexist, #ifdef, or #ifndef block.


 * #error message : Force the GLM loader to print an error message and stop.


 * #if test : Open an #if block.


 * #ifdef variable : Open an #ifdef block.


 * #ifexist file : Open an #ifexist block.


 * #ifndef variable : Open an #ifndef block.


 * #include [using(name=value[,...])] file : Include another GLM file.


 * #incpath path : Define the path to search for include files.


 * #libpath path : Define the path to search for library files.


 * #option command-option : Runs a command option


 * #print message : Print a message.


 * #set variable=value : Set global variables.


 * #setenv variable=value : Set environment variables.


 * #start file-name : Start a program asynchronously.


 * #system command : Execute a command in an operating system shell.


 * #warning message : Display a warning message and continue loading the GLM file.


 * #wget url : Download a web resource from the specified URL.

= Variables =

Macro variables are expanded in-line while the GLM file is being loaded, so expansion is immediate. The normal syntax for defining and including a macro variables is

class ${my_class} { // declarations }
 * 1) define my_class=test

Macro expansions will expand macro variables, global variables, and environment variables.

= See also =


 * Environment variables
 * GLM syntax
 * Comments
 * Directives
 * Global variables