RELEASE NOTES FOR ================= SWEDISH PASCAL VERSION 5+ ========================= Originally obtained from John Barr, DECUS Pascal SIG chairman. He got it from Seved Torstendahl in Stockholm. Modified, corrected and repackaged by: Gerry Pelletier Transport Canada (TARI) Transport Canada Bldg. Place de Ville, Ottawa, Ontario, Canada K1A 0N8 613-994-2378 CONTENTS ======== 1. Introduction................................ 1 2. Files and their contents.................... 2 3. Installing Pascal........................... 6 3.1 Preparing PASLIB......................... 6 3.2 Preparing PAS compiler................... 7 3.3 Preparing PAZ compiler................... 8 4. The Heap and what to do with it.............10 5. Bugs........................................12 6. Incomplete implementation...................12 7. Crosscompiler on DEC-10.....................13 1. Introduction ================ The version 5 Swedish Pascal for PDP-11 as distributed by DECUS was chosen as an interim compiler for the development of a large software project at Transport Canada. Upon encountering severe bugs and limitations of this package, we embarked on a program of maintaining it ourselves. This was made easier by the inovation of a method for compiling the main source module of the compiler on a PDP-11 whereas previously, this could only be done by cross compiling on a DEC system 10. To date, there have been about 53 modifications made to the compiler and runtime routines. Many of these constitute corrections for bugs and other deficiencies, but some are enhancements and extensions. A few of these are worthy of note here: - Type CHAR has been redefined to cover the subrange chr(0) to chr(255) (it was ' '..'_' or chr(32)..chr(95)). This is more useful in an environment with modern data terminals where non-printing control characters are just as common as printing characters. - Line addresses are displayed instead of line numbers in PASRUN error messages. This is an easier way of identifying error locations in programs made up of many separatly compiled procedures. - TTY file is the default standard file in a separatly compiled procedure (see section 2.6 in the user manual). - Files no longer have to be declared in the main program. - Bugs were corrected which make possible the use of string parameters (see section 2.13 of user manual). 29-NOV-79 - 1 - 2. Files and their contents ============================ The release tape has all files divided into 4 distinct UICs: [76,100] - documentation and runtime library PASLIB, [76,101] - the PAS version of the compiler, [76,102] - the PAZ version of the compiler, and [76,103] - utility and sample programs. The following is a brief outline of the files and their contents. [76,100] Documentation ====================== README.TXT This document USER.FMT User manual (Software Tools formatter format) USER.TXT User manual (Printable text) PASERR.HLP Help text for compilation error codes PASRUN.HLP Help text for runtime error codes [76,100] Runtime Library ======================== PASLIB.OLB Pascal runtime routines. As distributed, this is for PDP-11 processors with no EIS, FIS or FPP running RSX. To upgrade it to your system, apply appropriate library replacement. LBR PASLIB/RP = PASEIS for EIS LBR PASLIB/RP = PASFIS for FIS LBR PASLIB/RP = PASFPP for FPP LBR PASLIB/RP = PASIAS for IAS PASEIS.OBJ Concatenated object modules to do EIS multiply and divide. These are: 29-NOV-79 - 2 - Module MULI from P11EISMPI.MAC DIVI from P11EISDVI.MAC PASFIS.OBJ Contains object module for FIS real aritmetic operations. This is module P11RAR from source P11FIS.MAC. PASFPP.OBJ Concatenated object modules for FPP real arithmetic operations. These are: Module P11INI from source P11FPPINI.MAC, P11RAR from source P11FPP.MAC, FORTR from source P11FORFPP.MAC. PASIAS.OBJ Contains object module that has special difference for tasks run under IAS operating system. This is module RUNCHK from source P11IASRNC.MAC. PASNOX.OBJ Concatenated object modules that can be applied to a PASLIB.OLB that has been upgraded from the distributed PASLIB.OLB to restore it to a state that is useable on a processor with no extra hardware. It contains the following modules: MULI from source P11MPI.MAC DIVI P11DVI.MAC P11RAR P11REAL.MAC P11INI P11INIT.MAC RUNCHK P11RUNCHK.MAC FORTR P11FORTR.MAC PASLIB.PAC Packed source modules for runtime library. (Use P11DEF.MAC module as prefix for assembling all MAC modules in this package.) [76,101] Compiler (PAS) ======================== P11PAS.PAS Pascal source of general part of compiler. P11FIL.PAS PDP-11-specific part of compiler. P11CRS.PAS DEC-10-specific part of compiler. 29-NOV-79 - 3 - SPECAL.PAC Packed source for special runtime routines required by the compiler itself. PAS.BLD PAS.ODL TKB files to build compiler PAS.OLB Library of object modules of compiler. These are the objects obtained from compiling P11PAS.PAS, P11FIL.PAS and all the modules in SPECAL.PAC. PAS.TSK Task image of compiler. This version is to run under RSX-11M in 32K on processor with no extra hardware (ie. no EIS, FIS or FPP). TRICK, ACOMPI, ADEC1, ADEC2 AINI2, AFCS (.MAC and .OBJ) These routines are used to accomplish some convoluted overlaying which is required to reduce the task size to give reasonable com- piler capacity. [76,102] Big Compiler (PAZ) ============================ This version of the compiler is esentially the same as the PAS task. It is built with considerably heavier overlaying and as a result uses memory resident overlays to maintain good speed performance. It needs about 67K words to run. The main application of this compiler is to compile the compiler itself since the PAS compiler does'nt have enough capacity to compile P11PAS.PAS. PAZ can compile P11PAS.PAS (about 8300 lines) in about 13 minutes (PDP-11/40 - RK06). PAZ.BLD PAZ.ODL TKB files to build PAZ PAZ.TSK PAZ compiler task to run under RSX-11M on processors with no extra hardware. OVTRIK.PAC Packed source for routines that are needed for doing extra overlaying. 29-NOV-79 - 4 - ABOD1, ABOD2, ACALLN, ACALLS, ACOMPI, ADEC1, ADEC2, ADEC3, AEXPR, ASTMN1, ASTMN2, ASTMN3, HEAP, TRICK (.OBJ) These are the objects of routines in OVTRIK.PAC [76,103] Pascal Utilities ========================= UNPACK Asks for the name of a packed file and splits it into its constituent files. LISTPACK Lists the names of files in a packed file. PACK Packs arbitrary source files into a new packed file. When it asks for name of source file, you can also enter "@file" where "file" itself contains the names of files to be packed. SELECT Can extract a particular file from a packed file. CROSS Program for formatting and crossreferencing a Pascal program. Eg.: >RUN CROSS FILE: device and directory not allowed, .PAS default type. Gives new source and cross reference listing in .CRL. PASREF Another Pascal crossreferencer. FLIST Lists a source file on terminal with line numbers. Task images (for RSX-11M v3) for some of these these utilities are provided. (No optional hardware required.) 29-NOV-79 - 5 - 3. Installing Pascal ===================== Use FLX to read the files from tape to disk. The files do not have to go into directories with the same UICs as used on the tape, but they should not be combined into one directory. Each directory of files on tape must be in a separate directory on disk. The remainder of the discussion will assume that the files are on disk in the same directories they were in on tape (use FLX /UI switch). 3.1 Preparing PASLIB ===================== In uic [76,100] apply the appropriate library replacements to PASLIB.OLB. LBR PASLIB/RP = PASEIS if processor has EIS LBR PASLIB/RP = PASFIS if processor has FIS LBR PASLIB/RP = PASFPP if processor has FPP LBR PASLIB/RP = PASIAS if operating system is IAS Note that on many PDP-11 models (eg. 34,45,55) the EIS (Extended Instruction Set) is built into the processor and is not refered to as an option. Treat these models as if they have EIS. The EIS and FPP replacements should be done if Fortran IV Plus (F4P) routines will be called from Pascal. After these replacements, the Pascal runtime library will be ready as a separate OLB file. If you want to install PASLIB into the system library, SYSLIB, then do a library extraction and insertion. Eg. >LBR PASLIB = PASLIB/EX ! Creates PASLIB.OBJ >SET /UIC=[1,1] >PIP /NV = SYSLIB.OLB ! Keep copy of old SYSLIB >LBR SYSLIB = [76,100]PASLIB ! Insert PASLIB routines 29-NOV-79 - 6 - 3.2 Preparing PAS compiler =========================== The distributed compiler task image in [76,101] is built to run under RSX-11 with no requirement for optional hardware and only has to be INStalled to run on any RSX system. If you want an upgraded compiler that takes advantage of arithmetic hardware then there are two levels to which this can be done: re-building only or re-compiling and re-building. (IAS users will have to at least re-build). Re-building the compiler with the upgraded PASLIB will mean that the software-only arithmetic routines will be replaced by routines that use your hardware instead. Re-compiling the compiler Pascal source will result in a task that is even more closely matched to the hardware. For example, if your processor has EIS then the compiler, if compiled accordingly, will have MUL instructions in-line rather than calling the MULI routine. To re-compile the compiler source: - intall the PAZ compiler from [76,102] (it will only run on mapped systems with a partition of at least 67K) - in uic [76,101] compile the two source modules: >PAZ P11PAS{switches} = P11PAS >PAZ P11FIL{switches} = P11FIL where switches ::= /E for processors with EIS /E/G for processors with EIS/FIS /E/F for processors with EIS/FPP - replace the object in PAS.OLB: >LBR PAS/RP = P11PAS, P11FIL >; >; Compress and purge to recover space >LBR PAS/CO = PAS >PIP PAS.OLB/PU To build the PAS compiler: - edit the PAS.BLD file to set the new default switches 29-NOV-79 - 7 - for the compiler (see comments in PAS.BLD) and to set the /FP switch if FPP is being used. - if the compiler source was recompiled with /E switch as shown above then edit the PAS.ODL file to remove the MULI routine from the root (see comments in PAS.ODL). - arrange access to PASLIB.OLB in [76,100]: >PIP /EN = [76,100]PASLIB.OLB - invoke the task builder (eg. >TKB @PAS.BLD) and disregard the multiply define diagnostic messages from TKB. - install the compiler and try it out. If the resulting task image is larger than 32K words, it will not install without using the /INC switch to change the task extention. In this case, the EXTTSK option in the PAS.BLD file should be adjusted to result in a 32K task image. Remember that the compiler's workspace is greatest when the task image is exactly 32K. 3.3 Preparing PAZ compiler =========================== The considerations for arithmetic hardware for the PAS compiler apply equally to the PAZ compiler. It can be re-built from your new PASLIB.OLB (and PAS.OLB if you re-compiled) as follows: - set uic to [76,102] - edit the PAZ.BLD file to set the new default switches for the compiler (see comments in PAZ.BLD) and to set the /FP switch if FPP is being used. - if the compiler source was re-compiled with the /E switch as shown above then edit the PAZ.ODL file to remove the MULI routine from the root (see comments in PAZ.ODL). - arrange access to PASLIB.OLB and PAS.OLB: 29-NOV-79 - 8 - >PIP /EN = [76,100]PASLIB.OLB, [76,101]PAS.OLB - invoke the task builder (eg. >TKB @PAZ.BLD) and disregard the multiply define diagnostic messages from TKB. - install PAZ and try it out. The EXTSCT option statement in PAZ.BLD controls the size of the compiler's workspace. For maximum workspace, this extention should be adjusted to make the root segment 160000 octal bytes long. 29-NOV-79 - 9 - 4. The Heap and what to do with it =================================== Pascal programs (tasks) contain a heap section which is a contiguous area of memory that is used for dynamic variables (heap) at the low end and for static variables and parameters (stack) at the high end. The compiler creates a heap section in the object code of every main program. (Seperatly compiled procedures do not get a heap of their own.) The size of this section is enough to accomodate the static variables (not considering recursion) plus a fixed amount. If this "default" heap is not big enough for your program then you can extend it at task build time or when installing. The heap psect is called 999999. This name causes the task builder to, in general, place the section at the end of the task image. This position is essential because the Pascal runtime initialization assumes that the space that can be used for heap extends from the begining of the heap section to the end of the task partition. At build time the heap can be extended with a TKB option statement such as EXTSCT=999999:n, where n is the number of bytes of extention (octal) or EXTTSK=m where m is the number of words of extention (decimal). At install or run time, the heap can be effectively extended by extending the task size with the /INC=n switch, where n is the number of words of extention. For tasks using overlays, a special procedure must be followed to position the heap section at the end of the task image. If memory resident overlays are being used, the heap section must be placed at the end of the virtual address block accessed by the first mapping window. In both cases, the heap section generated by the compiler, must be made available as a separate object module so that it can be positioned in the overlay structure. The way this is done is to select module splitting when compiling the main program at a point just before the final end statement. So, just before the last end, code {$y+}. The generated object file will then contain a separate module for psect 999999 called $HEAP. The whole object file must then be placed in an object library so that this module can be explicitly refered to in the overlay description (ODL). With a separatly accessible heap module, the overlay 29-NOV-79 - 10 - description can be written to position it at the end of the task. This is done by creating a separate co-tree of one segment. eg. .ROOT SOMLIB/LB:MAIN-*(OV1,OV2,OV3),HEAP HEAP: .FCTR SOMLIB/LB:$HEAP When memory resident overlays are used, there is a severe problem introduced that makes it difficult to position the heap section. This is caused by the task builder's segregation of read-only and read-write psects and the introduction of two read-only psects as part of the overlay management software. One way of surmounting this problem is to use a hand coded heap module which is given the RO attribute so that the task builder will place it after the other RO psects. You will find such a module in [76,102]OVTRIK.PAC and its object is available in [76,102]HEAP.OBJ. For more details, see the comments in HEAP.MAC in OVTRIK.PAC. 29-NOV-79 - 11 - 5. Bugs ======== This Pascal performs comparisons on all structured types as a word compare loop. Since, for odd length character array variables, the last byte is undefined, comparisons of these will, in general, be unpredictable. The correction of this problem is quite involved and has not yet been attempted. To avoid any problems, never declare odd length character arrays. There are certain unusual circumstances of bad source code syntax that will cause the compiler to hang in an endless loop. If you suspect the compiler is hung, abort it and restart the compilation specifying your terminal as the listing device. The listing will stop at the line just before the line with the bad syntax. There is a problem in calling Fortran subroutines that themselves do Fortran I/O. Some F4P users have reported success in circumventing this problem by removing one instruction from PASLIB routine FORTR. The source for this routine is in PASLIB.PAC, module P11FORFPP.MAC. The instruction to be removed is: MOV DAPADDR(GP),$OTSV To incorporate the change in PASLIB: MAC P11FORFPP = P11DEF, P11FORFPP LBR PASLIB/RP = P11FORFPP This fix apparantly does not work for Fortran IV (Version 01C at least). 6. Incomplete implementation ============================= The beginings of a symbolic debug facility are evident in this compiler. It may be complete in a future release. 29-NOV-79 - 12 - 7. Crosscompiler on DEC-10 =========================== To generate a cross compiler on a DEC-10, proceed as follows: - transfer the files P11PAS.PAS and P11CRS.PAS to DEC-10, - compile them with the PASREL compiler from Hamburg, - load the produced modules and save the core image: .LOAD P11PAS,P11CRS .SAVE P11PAS 64 (64 is enough but maybe less will suffice.) When run, the compiler will ask for the filename of the source. A full name including volume and p,pn is allowed. Filename extention is not necessary if it is .PAS. Two new files are produced: a list file with extension .LST and an object file with extention .OBJ. Example: .RUN P11PAS *PROG will produce the files PROG.LST and PROG.OBJ from PROG.PAS . The object file contains one PDP-11 byte per DEC-10 word and is in PDP-11 DOS format. It can be transfered to a PDP-11 on DECtape or other suitable medium. Example: .MOUNT DTA:DT/V:DTNAME/WE .R FILEX *DT:/V/Q/I=PROG.OBJ *^C This object module can then be retrieved on a PDP-11 with RSX-11M by: >FLX SY:/RS=DT:*.*/DO/FB 29-NOV-79 - 13 -