A large cache of example/test ISO 7185 programs have come to my attention. All depend on the ability of ISO 7185 to bind header files to external files. I propose fixing this, which will be fairly simple.
Background: Although binding exists in the ISO 7185 standard, it requires a system specific procedure to carry out the binding, by definition. There is no other method specified for bindig in the standard.
Pascal-P handled this very cleverly by establishing a short set of standard header files, the prd (input) and prr (output) files. These are then bound to files in the compiled/interpreted program by the same name, ie., a header file named prd or prr are recognized and attached to the underlying compiler/interpreter files.
This effectively puts the system specific problem back on to the host. It does, however, sharply restrict both the names and the number of header files.
Proposed is the following:
Will create a new system call, hfa 'name' (header file associate). It takes the name of the header file symbol (but does not actually need that).
This system call will be generated in the pcom section that currently just produces and error for any header file not in the set input, output, prd and prr. This means that the hfa operator will be issued in the same order that the header files are encountered (important).
The hfa system call will be added to the backend. It will use a name string placed in the constant area (meaning it is N-length). It will simply call a routine of the form:
procedure aschdr(n: filnam; s: adrptr);
begin
{ ###gpc:
code to perform association
}
{elide}
error('General header file association not implemented')
{noelide}
end;
The routine is passed the filenumber and address in the constants area for the header file string.
It will be defined as a simple error. In uncommented code.
The idea is that code that extends the ISO 7185 standard can exist in ISO 7185 compatible code, and still compile. It is uncommented by sed script according to the system specific implementation to be used. Ie., for gpc above, the script will remove the commenting for the gpc code, and comment out the error() call.
The action performed by the routine is to take the command line and parse parameters off that and assign the resulting names to header files, in order. The evaluation will be consumptive, ie., it will keep a copy of the command line and advance a pointer over the names that have been parsed. Each new call of the aschdr() call will parse a new header file name and advance the pointer over each filename to the next.
Note that predefined header files input, output, prd and prr files do not get passed to this function, and so don't get picked up from the command line.
The system is backwards compatible, so that the pcom/pint program itself will continue to use the prd/prr file system, and only programs that use new header file names will use this system.
A large cache of example/test ISO 7185 programs have come to my attention. All depend on the ability of ISO 7185 to bind header files to external files. I propose fixing this, which will be fairly simple. Background: Although binding exists in the ISO 7185 standard, it requires a system specific procedure to carry out the binding, by definition. There is no other method specified for bindig in the standard. Pascal-P handled this very cleverly by establishing a short set of standard header files, the prd (input) and prr (output) files. These are then bound to files in the compiled/interpreted program by the same name, ie., a header file named prd or prr are recognized and attached to the underlying compiler/interpreter files. This effectively puts the system specific problem back on to the host. It does, however, sharply restrict both the names and the number of header files. Proposed is the following: Will create a new system call, hfa 'name' (header file associate). It takes the name of the header file symbol (but does not actually need that). This system call will be generated in the pcom section that currently just produces and error for any header file not in the set input, output, prd and prr. This means that the hfa operator will be issued in the same order that the header files are encountered (important). The hfa system call will be added to the backend. It will use a name string placed in the constant area (meaning it is N-length). It will simply call a routine of the form: procedure aschdr(n: filnam; s: adrptr); begin { ###gpc: code to perform association } {elide} error('General header file association not implemented') {noelide} end; The routine is passed the filenumber and address in the constants area for the header file string. It will be defined as a simple error. In uncommented code. The idea is that code that extends the ISO 7185 standard can exist in ISO 7185 compatible code, and still compile. It is uncommented by sed script according to the system specific implementation to be used. Ie., for gpc above, the script will remove the commenting for the gpc code, and comment out the error() call. The action performed by the routine is to take the command line and parse parameters off that and assign the resulting names to header files, in order. The evaluation will be consumptive, ie., it will keep a copy of the command line and advance a pointer over the names that have been parsed. Each new call of the aschdr() call will parse a new header file name and advance the pointer over each filename to the next. Note that predefined header files input, output, prd and prr files do not get passed to this function, and so don't get picked up from the command line. The system is backwards compatible, so that the pcom/pint program itself will continue to use the prd/prr file system, and only programs that use new header file names will use this system.