Select Git revision
cpp.c
-
Per Hedbor authored
Some simple examples; > master()->add_predefine("RND()", lambda( string arg1 ) { return random((int)arg1); }); > RND(10); (2) Result: 9 > cpp("RND(123)") (3) Result: "19" It can also be used to override the default builtin macros. If you want "fun" debug information (not used for backtraces, but code using __LINE__ will be confused): > master()->add_predefine("__LINE__", lambda() { return random(4711); }); > __LINE__; (6) Result: 2593 > __LINE__; (7) Result: 1780
Per Hedbor authoredSome simple examples; > master()->add_predefine("RND()", lambda( string arg1 ) { return random((int)arg1); }); > RND(10); (2) Result: 9 > cpp("RND(123)") (3) Result: "19" It can also be used to override the default builtin macros. If you want "fun" debug information (not used for backtraces, but code using __LINE__ will be confused): > master()->add_predefine("__LINE__", lambda() { return random(4711); }); > __LINE__; (6) Result: 2593 > __LINE__; (7) Result: 1780