| |||||||||||||||||
| |||||||||||||||||
|
Preprocessing Mosel code Description It is possible to use standard C preprocessors such as cpp or m4 with Mosel. Mosel treats the preprocessor symbol '#' at the beginning of lines like a comment sign, with the exception of line numbers/positioning markers that are handled to obtain the original line numbers (see the discussion in Section 2.5.3 Line control directives of the Mosel Language Reference Manual).
Difficulty rating: 3 (intermediate)
Source Files By clicking on a file name, a preview is opened at the bottom of this page.
preproc.mos
(!******************************************************
Mosel Example Problems
======================
file preproc.mos
````````````````
Example of using preprocessor definitions within a Mosel model
!!! The C preprocessor 'cpp' must be available in order
!!! to process this file before running it with Mosel
Compile and run the resulting BIM file with:
mosel comp "mmsystem.pipe:cpp preproc.mos -DA=1 -DDEBUG" -o preproc.bim
mosel run preproc
Produce the prepocessed source via cpp:
cpp preproc.mos -DA=1 -DDEBUG -o preprocA1.mos
(c) 2020-2022 Fair Isaac Corporation
author: S. Heipcke, Aug. 2020, rev. Oct. 2022
*******************************************************!)
model "preprocess via cpp"
#ifdef A
writeln("A defined")
#if A==1
writeln("A is 1")
#endif
#else
writeln("A not defined")
#endif
!writeln("Uncommenting this line produces a syntax error",,)
#ifdef DEBUG
writeln_("This is a debug message.")
#endif
writeln_("Terminating.")
end-model
| |||||||||||||||||
| © Copyright 2025 Fair Isaac Corporation. |