 |
 |
 |
 |
| Author |
Message |
OWHorus
Joined: 04 Feb 2006 Posts: 7 Location: Vienna, Austria
|
Posted: Tue Jul 04, 2006 6:48 pm Post subject: Feature for ecompile - small Preprocessor |
|
|
Hello,
it would be a fine thing to have at least a few preprocessor commands available in ecompile. (GNU CPP could be adapted, but it would be rather complex and much too large).
Only very few commands would help a lot:
#define VARIABLE [value] ... define a Variable in the Preprocessors namespace and optionally give it a value other than 1 (String or interger number would suffice).
#ifdef VARIABLE
... // Compile this lines only if #ifdef VARIABLE evalues to true.
...
...
#else
... // else compile this lines
...
...
#endif
With this simple commands we could for example have different includes, or could modify an entire code base with the new *.em files, and have it valid for an older version (096) too.
If the preprocessor variables could be replaced at any place in the code, a lot of practical things would be possible.
#ifdef POL_096_1
#define BUFFER 12
#else
#define BUFFER 14
#endif
const BUF_SIZE := BUFFER;
function xyz(x)
...
endfunction
I like eScript, and use it now for years, the only thing missing for me is a preprocessor. It could be written externally, but ecompile has a make function integrated and I think it would be ideally a part of ecompile.
OWHorus |
|
 |
|
|
 |
 |
|
 |
 |
| Author |
Message |
Marilla
Joined: 02 Feb 2006 Posts: 329
|
Posted: Tue Jul 04, 2006 10:31 pm Post subject: |
|
|
Ahhh.... I had actually suspected just that...
I've been using a nearly globally included "TESTING" const for some time now, to generate different compiles for testing or production, and sometimes it did seem to me that the file size really was different based solely on that single constant. I had mostly been assuming I was going nuts, though. hehe.
I did know, however, that eCompile never includes functions that are not used. I know that because I know that assuming the function block itself is properly defined, you could have an error in an include function's code that goes for a while without being realized, until you compile a script that actually USES the function.
I usually try to remove any 'testing' code, but use the const just as a second level of assurance... but knowing this now, that makes things interesting! |
|
 |
|
|