A couple of questions on Inform6 (compiler, 6.41)

I some may have noticed I currently trying to fi up the Reform-decompiled version of Curses!. I want to change the source as little as possible and want to desing a couple of batch-scripts that build the code in different versions (a release version, a debug version, a z5-version, a z8-version, a version built with 6.31, a version built with 6.41… you get the drift).

Questions on 6.41:

  • Is it possible to supress the DEBUG constant from the command line (the reverse of the switch -D)?
  • Are there any compiler directives that can have different code segments depending on wich version of the compiler that is used (something like the #Ifv5; #Endif;)?
  • Is possible to add an include file on the command line? I would want to use a file “abbreviations.inf” on some, but not all, versions. Therefore keeping the Include statement outside the source code.

Yes, by inserting a tilde: -~D. (And similarly to disable strict mode: -~S.)

Version 6.35 and newer can define arbitrary constants from the command line: --define SYMBOL or --define SYMBOL=number.

Not that I know of. However, the compiler will only apply abbreviations if you specify -e on the command line.

1 Like

Any boolean command-line switch can be turned off with the ~ character. So -~D is what you’re asking about.

However, if the source code contains a !% -D header comment, the -~D will not turn that off. Switches in header comments override command-line switches. It would be better if it worked the other way around, but at present this is what we have.

Are there any compiler directives that can have different code segments depending on wich version of the compiler that is used

Yes, you can do this:

#ifdef VN_1640;
#endif

This will compile if the compiler is I6 6.40 or later.

(Documented in DM4 §38.)

Is possible to add an include file on the command line?

No.

3 Likes

I believe you can use --define USE_ABBREVIATIONS on the command line and Ifdef USE_ABBREVIATIONS around your Include directive, which gets a similar effect.

The 96 abbreviations are defined by an external program, but I solved it with #ifdef VN_1636 (that’s the first version that accepts that many).

I’m not sure the -~D works as described.
.
If I have the debug constant defined.

CONSTANT DEBUG;

The size of the output is the same with or without -~D.

It is not a big deal. You only have to do it the other way around - Don’t define the constant in the source and use the -D in the script that compiles for the debug version.

Yep, -~D tells the compiler “don’t define the DEBUG constant”. If you then define the DEBUG constant yourself, the -~D flag isn’t going to have much effect.