|
|
In sac2c there are a lot of global variables that are used to store context information.
|
|
|
For instance compiler flags passed to the compiler.
|
|
|
However, the usage of global variables should be as limited as possible since a functional programming style is preferred in the SAC project.
|
|
|
These globals are stored in the global variable `global` of type `global_t`.
|
|
|
|
|
|
These are defined in `src/libsac2c/global/globals.c`, `src/libsac2c/global/globals.h` and `src/libsac2c/global/globals.mac`.
|
|
|
The `global_t` type is defined in `types.h` and generated from these 3 files.
|
|
|
|
|
|
A global is defined like this insdie `globals.mac` using the `GLOBAL()` macro from `types.h`:
|
|
|
|
|
|
```c
|
|
|
GLOBAL (bool, loadprelude, TRUE, xfree_dummy, )
|
|
|
```
|
|
|
|
|
|
The value type, the name, the default value, the free function are passed to the macro in this order. |
|
|
\ No newline at end of file |