The Free Pascal Compiler’s Reference Guide states:
The program header is provided for backwards compatibility, and is ignored by the compiler.
Therefore, it has no significance to the program’s meaning1 and (for FPC) it can be omitted.
(If it is there, it has to be syntactically correct.)
Then, however, the Programmer’s Guide states with respect to {$mode ISO} (and also to {$mode extendedPascal}):
- External files are declared as parameters in the program statement.
- Files have associated ”buffer variables”.
- The procedures ”get” and ”put” operate on file buffer variables.
- […]
So then the program header can have significance.
The details have not found their way into the official documentation (yet), but the FPC’s wiki describes two methods.
- Compile your code with
fpc -Miso -Sr source.pas.
Then the program parameter a becomes associated with A.TXT.
- Or, specify file names on the command-line as parameters (in the appropriate order).
This still requires compiling your code with
fpc -Miso source.pas.
(The ‑Miso can omitted if you place {$mode ISO} in your source code [before the program header].)
1: In non-ISO modes the program name becomes reserved though and can be used in fully-qualified identifiers.
This behavior is actually implementation-defined.
If I compile the following source code with the GPC – the GNU Pascal Compiler
program fileTest(foobar);
var
foobar: text;
begin
reset(foobar);
end.
and run it, I get the following prompt during execution:
Input file `foobar': /tmp/fileTest.pas
(The /tmp/fileTest.pas is my user input.)
There you do not have the automatic mapping command-line parameter → file name.
A different compiler might show a different behavior again, so you need to look up its documentation.
(And you cannot simply use Iriepascal documentation [or any other compiler’s documentation] for Delphi, FPC or GPC.)
I am (currently) the main contributor to the Pascal Programming WikiBook you referred to.
But from this page, I just use this:
program prg_name(a, b, c);
And try to read from a, b, c.
On “this page” the sentence
[…] This is a program parameter.
In fact, it is a list. Here, it only contains one item, but the general form is (a, b, c, d, e, …) and so on.
[…]
was merely meant to express that
- generally speaking, in Pascal a list takes the form
(a, b, c, …), and
- you are not limited to
input/output.
This is emphasized in a following sentence:
[…] We will go into detail later on, but for now we need to know there are two special program parameters: input and output. […]
Regardless of that, thank you; your (implicit) feedback is appreciated, and you are welcome to contribute yourself.