Current SVN version of Delphi Web Script now supports the following directives (all new but include and filter):
- $I, $INCLUDE, $F, $FILTER: include specified file (which can be on disk or come through the virtual file system), the FILTER variants will include the file after filtering it.
{$INCLUDE 'mysource.inc'}
- $DEFINE, $UNDEF: define and un-define a conditional.
{$DEFINE SPECIAL_CODE}
- $IFDEF, $IFNDEF, $ELSE, $ENDIF: allow specifying conditionally compiled blocks.
{$IFDEF SPECIAL_CODE} ...special code here... {$ELSE} ...not so special code here... {$ENDIF}
- $HINT, $WARNING, $ERROR, $FATAL: output a custom compiler hint, warning or error message.
{$HINT 'That is not wise...'} {$WARNING 'You should NOT be doing that!'} {$ERROR 'Do not do that. Period.'} {$FATAL 'After that, I won''t even try to compile your code!'}
Conditionals are case-insensitive names, conditional blocks can be nested.
Default conditionals when compiling can be adjusted via a new property in the TdwsConfiguration.
edit: added $FATAL
Very good, many thanks!
Wonderful job Eric!!
Hi Eric,
i have an old project using DWS2 and i tried to switch to your new implementation.
Unfornately i cannot compile it with D7. Do you plan to supporting it?
Best regards
Dirk Carstensen
No, as I don’t use it anymore and haven’t for a while. If a D7 version it’ll have to be supported by someone else.
If at the moment it could be somewhat still reasonnable to make the code compatible, modern constructs (like generics) will be made use of, and that’ll make things quite a bit more complex however.
Ok Eric,
thanks for your answer! So i’ve to update my application first..
Best regards
Dirk