DavidKinder / Inform6

The latest version of the Inform 6 compiler, used for generating interactive fiction games.
http://inform-fiction.org/
Other
199 stars 32 forks source link

Command-line options should override !% headers #279

Open erkyrath opened 3 months ago

erkyrath commented 3 months ago

Currently the compiler parses command-line options in order (including ICL files mentioned on the command line); then it opens the source file and parses !% headers; then it reopens the source file and compiles it.

This means that !% headers override command-line options. This is not intuitive. Normal procedure is that options ("easy to change") override options baked in a file ("hard to change").

Changing this will be a moderate pain though. Either we have to hold command-line options until a later stage of compilation, or keep track of the priority level of each set option.

On the up side, maybe we can systematize the big swaths of boilerplate option code in memory.c.

(Proposed as an alternative to https://github.com/DavidKinder/Inform6/issues/275 .)

erkyrath commented 3 months ago

Might also clean up the DICT_WORD_SIZE_z, DICT_WORD_SIZE_g hack (where certain options have different defaults on the different platforms).

erkyrath commented 2 months ago

I have a branch for this: https://github.com/erkyrath/Inform6/tree/options-dat

This is a tiny change in behavior, but I took the opportunity to tidy up all the option-handling code (including options help and $LIST). The changelist is therefore pretty hefty and adds a whole new source file options.c. On the up side, adding a new option will be much easier.

I'd like to hold this until 6.43 is wrapped.