Skip to content

Preprocessor

Trin Wasinger edited this page Apr 6, 2024 · 9 revisions

Preprocessing Files

MTSC includes a heavily modified C/C++ preprocessor based on Boost Wave. For compatibility, it is gated behind the -p/--preprocessor CLI flag. Since #abc is already valid JavaScript for ES6 private class fields, MTSC instead looks for preprocessor directives within single-line triple-slash comments (e.g. ///#define ...).

Directives

Unless otherwise stated, the following directives behave like their C/C++ counterparts.

Macro Directives

  • ///#define
    • Variadics and placemarkers are supported
  • ///#undef

Control Directives

  • ///#if
  • ///#ifdef
  • ///#ifndef
  • ///#else
  • ///#elif
  • ///#endif

Misc Directives

  • ///#error
  • ///#warning
  • ///#line
  • ///#pragma
  • ///#embed
    • Only supports the ///#embed "path/to/file..." form
    • The byte contents of the relative file are inserted as comma separated hex literals

Pragmas

Macros

Clone this wiki locally