Skip to content
Snippets Groups Projects
Select Git revision
  • 080e3aa0338503b9cfbbbe577bd3a9d858bfc73e
  • master default protected
  • 9.0
  • 8.0
  • 7.8
  • 7.6
  • 7.4
  • 7.2
  • 7.0
  • 0.6
  • rosuav/latex-markdown-renderer
  • rxnpatch/rxnpatch
  • marcus/gobject-introspection
  • rxnpatch/8.0
  • rosuav/pre-listening-ports
  • nt-tools
  • rosuav/async-annotations
  • rosuav/pgsql-ssl
  • rxnpatch/rxnpatch-broken/2023-10-06T094250
  • grubba/fdlib
  • grubba/wip/sakura/8.0
  • v8.0.2000
  • v8.0.1998
  • v8.0.1996
  • v8.0.1994
  • v8.0.1992
  • v8.0.1990
  • v8.0.1988
  • v8.0.1986
  • rxnpatch/clusters/8.0/2025-04-29T124414
  • rxnpatch/2025-04-29T124414
  • v8.0.1984
  • v8.0.1982
  • v8.0.1980
  • v8.0.1978
  • v8.0.1976
  • v8.0.1974
  • v8.0.1972
  • v8.0.1970
  • v8.0.1968
  • v8.0.1966
41 results

cpp.c

  • Per Hedbor's avatar
    080e3aa0
    Added support for dynamic compile-time macros. · 080e3aa0
    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
    080e3aa0
    History
    Added support for dynamic compile-time macros.
    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