{ History ------- 11/09/85 - ecodes inserted, const MaxImpstr & type ImpStr defined, field Adid inserted in RuntimeAddress & BlockLabel. 23/09/85 - Pascal specific ecodes inserted. 25/09/85 - PlabelId,GlaOffset,StatOffset,GSTOffset defined. 07/10/85 - insert Ecodes LOADCAP & INDEXCAP. 08/10/85 - modify IdRecord to fix variant access error. (agh) 15/10/85 - add InputSpelling, OutputSpelling for file binding. (agh) 16/10/85 - History tidied. (agh) 16/10/85 - Value ForChar added to Repkind, TypeRepresentation simplified for ForSelector. CAPList removed and StackOffset, ParamOffset re-typed to ByteRange in FrameRecord. (agh) 17/10/85 - declared LastFlowLine for diagnostics module. (agh) 18/10/85 - declare FirstChoice for better error recovery. (agh) 22/10/85 - simplify FrameRecord and ManualList for file initialisations. Delete ItemShapes. (agh) 22/10/85 - Add Pascal ecodes PRESETFILE and POSTSETFILE. Interim definition of MCFCBSize. (agh) 22/10/85 - Remove PresetCode and PostsetCode from Type- Representation. (agh) 23/10/85 - Add ParamCount field to FrameRecord for proc declaration/ call consistency check. (agh) 23/10/85 - Add declarations of 5-, 11-, 16-, 22-Value for default write field-widths. (agh) 25/10/85 - Simplify heap-request records. (agh) 25/10/85 - Add interim Pascal Special E-codes. (agh) 25/10/85 - Add ParamSpace mods to simplify procedure call. (agh) 28/10/85 - Delete TypeActions, simplify BpRecord, modify ActualRecord. (agh) 28/10/85 - Add E-codes CHKUNDEF, CHKNEW2 and LAZYOP for heap-checks and lazy i/o. Remove all declarations ralating to ancillary check-operations. (agh) 28/10/85 - Delete redundant declaration of AccessCodes. (agh) 06/11/85 - Extend stack node for ICL standard operations. (agh) 06/11/85 - Add ICL special E-codes ICLPDT, ICLPTM, ICLPSH, ICLPROT. (agh) 07/11/85 - Add unary operation ConvertOp for integer-integer conversion. (agh) 08/11/85 - Replace Jump field for Conditions by BooleanOp field for easier manipulation of compound Boolean expressions. Remove IfFalseConditional and IfTrueConditional. (agh) 08/11/85 - Add ShortCircuit as Boolean control option. (agh) 11/11/85 - Add IsCheck ActualKind value for range-check control when passing a bounded-conformant array to an unbounded conformant array. (agh) 12/11/85 - Modify Offset field of RuntimeAddress to take negative offsets when negative stack model is used. (agh) 15/11/85 - Modify CaseLabelRecord and CaseRecord for label ranges otherwise clause. (agh) 22/11/85 - Set ICLWord to word, add WordBounds flag to IndexRecord and BpRecord. (agh) 23/11/85 - Add E-codes for unsigned arithmetic and array access. (agh) 29/11/85 - Add HeapRef to identify p^ factors. (agh) 01/12/85 - Changes to TypeRepresentation, FieldOffset, StackNode and OptionType to support bit-level packing. 04/12/85 - Remove CHKLWD, CHKUPD, CHKATFR, CHKCTFR. (agh) 04/12/85 - Add CAPOp as a binary operation. Change CAPLoad to CAPSize. (agh) 04/12/85 - Remove all conformant array E-codes. Add INDEXP and CAPMOVE. (agh) 05/12/85 - Add type Intrinsic defining run-time system routines. (agh) 08/12/85 - Remove redundant E-codes. (agh) 09/12/85 - Re-name Pascal Op-codes for consistency. (agh) ---------------------------------------------------------------------- 12/12/85 - Add complete set of string E-codes and re-order. (agh) 12/12/85 - Improve option-handling for real-precision. (agh) 13/12/85 - Adjust E-code definitions agains. (agh) ---------------------------------------------------------------------- 04/02/86 - Add BNOT to E-machine instruction set } { MODULE 2 Global Definitions and Declarations Because of the rigid order of definitions and declarations imposed by Pascal, this module contains all of the global definitions and declarations on which the procedures in the subsequent modules depend. In this module, only a brief indication of the overall nature of the constants, types and variables introduced is given, together with a reference to the module in which they are used. A more detailed explanation of the nature and purpose of each is given in the referenced module itself. } const { constants used by pnx-dependent code in modules 3 and 4 } MaxArgString = 80 ; { maximum size of argument string } MaxArgs = 6 ; { maximum number of arguments } BufferSize = 512 ; { disk buffer size in bytes } Null = 0 ; { ASCII null character } BackSpace = 8 ; { ASCII back-space character } Tab = 9 ; { ASCII tab character } NewLine = 10 ; { ASCII new line character } FormFeed = 12 ; { ASCII form-feed character } CarriageReturn = 13 ; { ASCII carriage-return character } BackSlash = 92 ; { ASCII back-slash character } { constants used by the option-handler, module 3 } Level0 = 0 ; { conform to ISO 7185, level 0 } Level1 = 1 ; { conform to ISO 7185, level 1 } Level2 = 2 ; { conform to ICL Pascal, level 2 } Level3 = 3 ; { conform to ICL Pascal, level 3 } OptionFlag = '$' ; { introduce option-list } OptionSize = 12 ; { size of string below } UnknownOption = ' ' ; { denotes unknown option } FileWarning = 'Error summary not found.' ; { constants used by the source handler, module 5 } LinesPerPage = 60 ; { source-text lines per page } BannerTitleSize = 24 ; { length of banner titles } ProgName = 'ICL Pascal - Version v.r' ; VerNumPos = 22 ; { position of 'v' in above } RelNumPos = 24 ; { position of 'r' in above } VerNum = 4 ; { compiler version } RelNum = 1 ; { compiler release } LineMax = 132 ; { maximum length of source line } StartCode = 0 ; { analysis error code base } MaxCode = 499 ; { total error range: 0..499 } AnalysisBase = StartCode ; { analysis errors: 1..300 } PredictedBase = 300 ; { runtime errors : 301..400 } SystemBase = 400 ; { system limit errors: 401..420 } FatalBase = 420 ; { fatal errors: 421..450 } OptionBase = 450 ; { option errors: 451..470 } PragmaticBase = 470 ; { pragmatic errors: 471..490 } WarningBase = 490 ; { warning errors: 491..500 } LinesPerText = 2 ; { lines per error text } { constant used by the diagnostics handler, module 7 } NilSerial = 0 ; { unallocated serial number } { constants used by the lexical analyser, module 8 } NoWords = 54 ; { upper bound of word symbol table } AlfaSize = 12 ; { size of alfa header string } EquivSize = AlfaSize ; { identifier equivalence measure } ChunkLength = 4 ; { size of trailing alfa chunks } DefaultSpelling = '????????????' ; { default alfa-header } { constants used in semantic analysis, module 10 } DispLimit = 20 ; { upper bound of display } GlobalLevel = 1 ; { scope level of program block } {************************************************************************} {***** constants used by the object program generator ******} {************************************************************************} Pascal = 14 ; { language code } { constants describing the E-machine } MCBitsPerWord = 32 ; { bits per memory-word } MCBitsPerHalfWord = 16 ; { mcbitsperword div 2 } MCWordSetBits = 31 ; { bits per set-word } MCBitsPerByte = 8 ; { bits per memory-byte } MCBytesPerWord = 4 ; { mcbitsperword div mcbitsperbyte } MCBytesPerHalfWord = 2 ; { mcbytesperword div 2 } MCMaxBitNum = 31 ; { mcbitsperword-1 } MCMaxSetBit = 30 ; { mcwordsetbits-1 } MCMaxByteNum = 3 ; { mcbytesperword-1 } MCMaxint = 2147483647 ; { max mc-integer value } MCMaxDigits = 10 ; { digits in mcmaxint } MCMaxintDiv10 = 214748364 ; { mcmaxint div 10 } MCMaxintMod10 = 7 ; { mcmaxint mod 10 } MCMaxHalfWord = 65535 ; { halfword: 2**16 - 1 } MCMaxWord = 16#FFFFFFFF; { assumes MCBitsPerWord = 32 } MCMaxReal = maxint ; { interim value } MCMaxRealSize = 2 ; { max real size (words) } MCMaxByte = 255 ; { max mc-byte value } MCUndefinedChar= 255 ; { 'undefined' character value } MCMaxChar = 255 ; { max mc-char value } MCMaxSet = 256 ; { maximum members per set } MCMaxMemByte = 16777215; { max byte address: 2**24 - 1 } MCMaxMemWord = 4194303 ; { max word address } MCNegativeStackFlag = 0 ; { control stack layout } MCPfParamSize = MCBytesPerWord ; { formal proc/func param-size } MCFCBSize = 32 ; { byte size of file control block } MCFirstOffset = 0 ; { first available frame offset } MCCAPBpSize = 3 ; { conformant array parameter } { bound pair block size (words) } MCBufferOffset = 8 ; { buffer-variable offset in text } { file variable control block } {************************************************************************} {***** E-machine instruction set ******} {************************************************************************} {00} HALT = 0 ; {00} NOOP = 0 ; { -------------------------- 32-bit (Etos) ----------------------------- } {01} IADD = 1; { (Etos-1) + (Etos) => (Etos) } {02} ISUB = 2; { (Etos-1) - (Etos) => (Etos) } {03} IMULT = 3; { (Etos-1) * (Etos) => (Etos) } {04} INDIV = 4; { (Etos-1) / (Etos) => (Etos) } {05} INEG = 5; { - (Etos) => (Etos) } {06} IABS = 6; { abs( (Etos) ) => (Etos) } {07} IREM = 7; { remainder from } { (Etos-1) / (Etos)=> (Etos) } {08} IAND = 8; { (Etos-1) & (Etos) => (Etos) } {09} IOR = 9; { (Etos-1) (Etos) => (Etos) } {0A} INOT = 10; { ~ (Etos) => (Etos) } {0B} IXOR = 11; { (Etos-1) (Etos) => (Etos) } {0C} ISHLL = 12; { (Etos-1) << (Etos) => (Etos) } {0D} ISHRL = 13; { (Etos-1) >> (Etos) => (Etos) } {0E} ISHLA = 14; { arithmetic left shift } {0F} ISHRA = 15; { arithmetic right shift } {10} IGT = 16; { if } {11} ILT = 17; { (Etos-1) (Etos) } {12} IEQ = 18; { then } {13} INE = 19; { true (1) => (Etos) } {14} IGE = 20; { else } {15} ILE = 21; { false (0) => (Etos) } {16} BNOT = 22; { (Etos) = BNOT (Etos) 0<->1 } {18} JIGT = 24; { if } {19} JILT = 25; { (Etos-1) (Etos) } {1A} JIEQ = 26; { then } {1B} JINE = 27; { ->