Macros
Warning
This page contains features that are unfinished, were never implemented, or have since been deprecated. We preserve these pages for archival purposes, and also as a foundational resource for prospective developers who may wish to implement the same or similar feature. Many of these pages provide robust explanations of the theory behind a particular module or feature that we hope readers will find useful.
This page does not reflect the current state of GridLAB-D™
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.,
#if _test_
// conditional
#endif
| Macro | Description |
|---|---|
| #binpath path | Define the path to search for executables. DEPRECATED |
| #debug string | Prints string when debugging is enabled. |
| #define variable =value | Define new macro variables. |
| #endif | Closes an #if, #ifdef, or #ifndef conditional block. The #endif must be in the same file the open macro occurred in. |
| #else | Closes a conditional block and opens 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. DEPRECATED |
| #libpath path | Define the path to search for library files. DEPRECATED |
| #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
#define my_class=test
class ${my_class} {
// declarations
}
Macro expansions will expand macro variables, global variables, and environment variables.
Environment Variables
GridLAB-D™ uses many environment variable during operation.
- DBFLAGS - Specifies debugging options to use when compiling inline C and C++ code.
- CC - Specifies the C compiler to use when compiling inline C code.
- COMSPEC (windows only)
- SHELL (linux/unix only)
- GLPATH - Specifies where to search for GridLAB-D™ modules and support files.
- GLTEMP - Specifies the path to GridLAB-D™ temporary folder
- HOMEVAR (windows only)
- HOMEDRIVE (windows only)
- TEMP
- USER (linux/unix only)
- USERNAME (windows only)
- GRIDLABD - Specifies the path to the GridLAB-D™ install.
- PATH
- INCLUDE
- LIB
- CCFLAGS - Specifies the C compiler options to use when compiling inline C code.
- CXXFLAGS - Specifies the C++ compiler options to use when compiling inline C++ code.
- CXX - Specifies the C++ compiler to use when compiling inline C++ code.
- LDFLAGS - Specifies the linker options to use when compiling inline C and C++ code.
- GLBROWSER Template:NEW30
- LD_LIBRARY_PATH (linux/unix only)
- COMPUTERNAME (windows only)
- HOSTNAME (linux/unix only)
- TZ - Specifies the default timezone.
- NUMBER_OF_PROCESSORS
Related Concepts:
- Environment variables
- GLM syntax
- Comments
- Directives
- Global variables