[fpc-pascal] InstantFPC and argv

Marco van de Voort marcov at stack.nl
Fri May 4 21:58:14 CEST 2012

In our previous episode, Tomas Hajny said:
> 1) Find the first alphabetic character after the first line (which is
> already processed/skipped by InstantFPC anyway) while ignoring all
> whitespaces and possible comments (in all allowed formats, i.e. including
> (* *) ) - the only small complexity here are nested comments, but even
> that is not so difficult to handle.
> 2) If there is the 'program' keyword, find the semicolon and continue
> searching for the next alphabetic character while still ignoring comments
> and whitespaces (to skip possible global compiler directives).
> 3) Write down 'const InstantFPCScriptName = ...;' + LineEnding immediately
> before the found alphabetic character (there should be no need to parse
> it).

Will cause some "misplaced global compiler switch" if after the program came
an {$mode originally.

More information about the fpc-pascal mailing list