Conditional comments are similar to #ifdef directives in the C
preprocessor, allowing to exclude parts of a script depending on whether
a certain flag is enabled or not.
The feature is designed to offer backward compatibility to scripts that
use it, letting older engines seamlessly ignore the conditional part as
if it was a comment.
The structure of a conditional comment is the following:
// The following block is only parsed if FLAG is defined. If not
// defined, or when loaded by an older engine, the block is treated as a
// block comment.
/*@FLAG
.@x = 1;
//@*/
// The following block is only parsed if FLAG is not defined. If
// defined, or when loaded by an older engine, the block is treated as a
// block comment.
/*@!FLAG
.@x = 1;
//@*/
// The following block is only parsed if FLAG is defined. If not
// defined, the block is treated as a block comment. When loaded by an
older engine, the block is also parsed.
/*@FLAG*/
.@x = 1;
//@*/
// The following block is only parsed if FLAG is not defined. If
// defined, the block is treated as a block comment. When loaded by an
// older engine, the block is also parsed.
/*@!FLAG*/
.@x = 1;
//@*/
The following flags are currently always defined:
- TRUE
- HERCULES
The following flag is currently never defined and can be used to
temporarily disable blocks of code:
- FALSE
The following flags are currently conditionally defined, based on the
renewal/pre-renewal compile time toggle:
- RENEWAL
- PRERENEWAL
Plugins can define conditional flags at runtime by calling
script->declare_conditional_feature("FLAG_NAME"), allowing scripts to
behave differently when a plugin is loaded.
Signed-off-by: Haru <haru@dotalux.com>
When supplied with the current time, it had an inconsistent and
unexpected behavior of using the same day/time in some cases.
Now it will always point for the next day.
Also added a CI test and improved documentation to clarify this
- deprecated `*debugmes` script command.
- added `*consolemes` script command which display the console message based on `type`.
- allow map-server console to auto logging into text file depend on type of message.
This removes the remaining unsupported symbols (despite they being
official names) in AegisNames: The apostrophe (`'`) sign is suppressed.
The full replacement rules (cumulative with the step 1 commit) are thus:
- Any apostrophe is suppressed.
- Any non-`[A-Za-z0-9_]` character is replaced with an underscore (`_`).
- If the replaced symbol is at a word boundary (beginning or end of the
string, or next to another underscore), it is suppressed instead.
- If the replacement causes an AegisName conflict, underscores are
appended appropriately.
Signed-off-by: Haru <haru@dotalux.com>
- The function now checks its arguments, rather than passing them to
the system implementation (safer against arbitrary memory access or
wrong variable type)
- Implemented positional ('%1$d') specifiers (POSIX style)
- See script_commands.txt for details about the supported format
specifiers.
Signed-off-by: Haru <haru@dotalux.com>
The plugin is used by the Travis CI build, and it makes more sense to be
present here, so that it can be kept up to date when the HPM is
updated, to avoid build failures.
Signed-off-by: Haru <haru@dotalux.com>
- Parallelized pre-re and re tests
- Added mapserver and script engine tests: this means that travis will
detect parse errors in scripts as well as the source now)
Signed-off-by: Haru <haru@dotalux.com>
- Moved tests into a function, so that they can be easily called by
external scripts. Ensured that the tests are only executed once.
Signed-off-by: Haru <haru@dotalux.com>