The PASCAL pre-processor/translator that will be used to port LISTSERV to
VMS and unix has successfully translated itself for execution on VMS and
unix and, in both environments, succeeded in translating its original
source code again, generating exactly the same output file as the VM
version. Due to the complexity of the pre-processor and the amount of
transformations performed on the input files, this is a very trustworthy
indication of the feasibility of directly porting the rest of LISTSERV's
PASCAL code to unix and VMS.
The pre-processor was chosen for this exercise because it is a large,
complex and self-contained program, with well-defined input and output in
the form of disk files that can be easily moved around and compared with
a reference. The pre-processor represents about 1700 lines of PASCAL
source code, plus a few hundred lines from PASCAL include files. It uses
most of the P-REXX library, with the exception of date/time functions. A
primitive subset of the library's file system functions, allowing only
sequential I/O to text files, was implemented in order to be able to run
the pre-processor under VMS and unix. The rest of the P-REXX library is
now fully implemented.
The pre-processor was first run under VM to translate itself, creating a
source file suitable for compilation under VMS and another one for
translation via p2c under unix. An unmodified copy of the VMS file was
kept as a reference for future comparisons. The main programs of both
source files were then changed to call system-dependent initialization
functions and extract command-line parameters as appropriate for the
system they were going to run on, but no modification was made to the
rest of the source files. That is, a few lines had to be added to the
6-lines main entry point, but apart from that nothing was changed to the
PASCAL source. One variable had to be renamed under unix due to conflicts
with a #define in a standard SunOS include file.
After compiling everything, executable files were available for VAX/VMS,
AXP/VMS and SunOS. They were fed the VS PASCAL source code for the
pre-processor, with instructions to produce output suitable for VMS. The
resulting files could then be compared directly with the reference output
kept on VM, and not one byte differed.
Out of curiosity, here is the size of the executable file for the various
environments:
VAX: 59k (VAX PASCAL/VAX C)
AXP: 125k (DEC PASCAL/DEC C)
Sun4: 96k (gcc -O4)
It is not possible to compare with the VM version directly because it
includes a nonshared copy of the bulky VS PASCAL run-time library, plus a
host of other VM-specific functions which are not used but are in the
same object file as the storage allocation functions the pre-processor
does need. Without the RTL it adds up to about 48k. We can still draw two
conclusions from these figures:
- The code generated for the VAX (CISC) architecture is not noticeably
bigger than the VM code; little or no overhead is introduced by the
PASCAL translation process.
- Provided that a good optimizing compiler is used, the code generated
through the use of p2c is not significantly larger than it would be if
a native PASCAL compiler were available (without optimization, the
output file is about 140k, which is a lot larger than it should be on a
Sun4). While it is probably not optimal, it should certainly be good
enough given the low cost of unix horsepower.
Eric
|