- AddNumericMacro ("__CC65__", (VER_MAJOR * 0x100) + (VER_MINOR * 0x10) + VER_PATCH);
-
- /* Strict ANSI macro */
- if (ANSI) {
- AddNumericMacro ("__STRICT_ANSI__", 1);
+ DefineNumericMacro ("__CC65__", GetVersionAsNumber ());
+
+ /* Language standard that is supported */
+ DefineNumericMacro ("__CC65_STD_C89__", STD_C89);
+ DefineNumericMacro ("__CC65_STD_C99__", STD_C99);
+ DefineNumericMacro ("__CC65_STD_CC65__", STD_CC65);
+ DefineNumericMacro ("__CC65_STD__", IS_Get (&Standard));
+
+ /* Optimization macros. Since no source code has been parsed for now, the
+ * IS_Get functions access the values in effect now, regardless of any
+ * changes using #pragma later.
+ */
+ if (IS_Get (&Optimize)) {
+ long CodeSize = IS_Get (&CodeSizeFactor);
+ DefineNumericMacro ("__OPT__", 1);
+ if (CodeSize > 100) {
+ DefineNumericMacro ("__OPT_i__", CodeSize);
+ }
+ if (IS_Get (&EnableRegVars)) {
+ DefineNumericMacro ("__OPT_r__", 1);
+ }
+ if (IS_Get (&InlineStdFuncs)) {
+ DefineNumericMacro ("__OPT_s__", 1);
+ }