{ 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 IndexedFromLeft = true ; { for host Pascal compiler } { constants used by pnx-dependent code in modules 3 and 4 } MaxArgString = 60 ; { 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 exported from 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 object-program generator interface, module 6 } MaxWord = 2147483647; { 2**31- 1 } { 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 } 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 ******} {*************************************************************************} { constants describing the model P-machine } MCBitsPerWord = 32 ; { bits per memory-word } MCWordSetBits = 31 ; { bits per set-word } MCBitsPerByte = 8 ; { bits per memory-byte } MCBytesPerWord = 4 ; { mcbitsperword div mcbitsperbyte } 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 } MCRealSize = 1 ; { real size in words } MCMaxHalfWord = 65535 ; { max unsigned half word value } MCMaxByte = 255 ; { max mc-byte value } MCUndefinedChar= 255 ; { 'undefined' character value } MCMaxChar = 255 ; { max mc-char value } MCMaxSet = 256 ; { maximum members per set } MCMaxMemWord = 16383 ; { max memory-word address } { constants used by the code-file emitter, module 16 } CodeByteLimit = 8191 ; { codewordlimit*mcbytesperword + } { mcbytesperword - 1 } { stack frame layout } FirstOffset = 0 ; { first available frame offset } FrameSize = 6 ; { stack-frame header size } { constants used by the object-program generator, moduless 13-29 } FileSize = 5 ; { file-variable size } CAPBpSize = 3 ; { conformant array parameter } BufferVarOffset= 2 ; { buffer-variable offset in text } { files variable } MaxLevels = 9 ; { max variant nesting level } MaxCaseGap =256 ; { max permissable discontinuity } { in case label values } FileLockOffset = 1 ; { file lock word offset } type { types used by unix-dependent code in module 4 and 5 } ArgIndex = 1..MaxArgString; ArgSize = 0..MaxArgString; ArgString = packed array[ArgIndex] of char; ArgStringPtr = ^ ArgString; ArgArray = array[0..MaxArgs] of ArgStringPtr; ArgPointer = ^ ArgArray; FileMode = (ForReading, ForWriting, ForBoth); BufferPosition = 1..BufferSize; FileBuffer = packed array[BufferPosition] of char; UnixFile = record Buffer: FileBuffer; Descriptor, FileAddress: integer; StartOfLine, EndOfLine, EndOfBuffer, BufferIndex: BufferPosition; Mode: FileMode; EofFlag: Boolean end; ImportEntry = ^ ImportRecord; ImportRecord = record FileName: ArgString; Next: ImportEntry end; { types applied globally } HostWord = integer ; Scalar = 0..maxint ; DeclKind = ( Predefined,Declared ) ; StdProcFuncs = (Getp,Putp,Resetp,Rewritep, Readp,Writep,Readlnp,Writelnp,Pagep, Newp,Disposep,Packp,Unpackp, Appendp,Linesp,Closep, Datep,Timep, Absf,Sqrf,Oddf,Succf,Predf,Ordf,Chrf,Truncf,Roundf, Sinf,Cosf,Expf,Lnf,Sqrtf,Arctanf,Eoff,Eolnf, Sizef,Ptrf,CPtrf,Wrdf,Intf,MinValf,MaxValf, AndWf,OrWf,NeqWf,NotWf,ShWf,RotWf,Floatf,Recastf) ; TypeForm = (Scalars,Subranges,Pointers,Arrays,CAPSchema, Records,Sets,Files,VariantPart,Variant) ; SetForms = ( Unpacked,IsPacked,Constructed ) ; IdClass = ( Domain,Types,Consts,Vars,Bound, PresetVars,ReadOnlyVars,Field,Proc,Func,Prog); { types describing the model P-machine } MCBit = 0..1 ; MCByte = 0..MCMaxByte ; MCHalfWord = 0..MCmaxHalfWord ; MCWord = HostWord ; { target=host } MCScalar = 0..MCMaxint ; MCIntegerForm = HostWord ; { MC-integer-space: target=host } MCRealForm = real ; { MC-real-space: target=host } MCCharSet = 0..MCMaxChar ; MCBitRange = 0..MCBitsPerWord ; MCBitIndex = 0..MCMaxBitNum ; MCSetBits = 0..MCMaxSetBit ; MCBitArray = packed array[MCBitIndex] of MCBit ; MCByteIndex = 0..MCMaxByteNum ; MCByteArray = packed array[MCByteIndex] of MCByte ; MCWordSet = set of MCSetBits ; WordCast = ( AsSet,AsBits,AsBytes,AsReal,AsValue,AsLabel ) ; MCWordForm = record case WordCast of AsSet : ( WSet : MCWordSet ) ; AsBits : ( WBits : MCBitArray ) ; AsBytes : ( WBytes : MCByteArray ) ; AsReal : ( WReal : MCRealForm ) ; AsValue : ( WValue : MCWord ) ; AsLabel : ( Linked : Boolean ; Address : MCScalar ) end ; WordRange = 0..MCMaxMemWord ; CodeByteRange = 0..CodeByteLimit ; WordEntry = ^ ListWord ; ListWord = record Word : MCWordForm ; Next : WordEntry end ; { types used by the option-handler, module 3 } OptionContext = ( Locally,Globally) ; OptionClass = ( BoolClass,IntClass ) ; OptionType = ( Listing,Directives,Imports,Checks,PMDump, Level,Margin,Other ) ; BoolOptions = Listing..PMDump ; IntOptions = Level..Margin ; OptionIndex = 1..OptionSize ; OptionString = packed array[OptionIndex] of char ; SetOfOptions = set of OptionType ; ICLDirectives = (DoInclude,DoRead,DoPage,DoLines, DoHeading,DoList,DoNothing); DirectiveString = OptionString; { types used by the source-handler, module 5 } PageDepth = 0..LinesPerPage; BannerPositions = 1..BannerTitleSize ; BannerString = packed array[BannerPositions] of char ; DateString = packed array[1..8] of char ; ErrorSpan = 0..MaxCode ; LinePosition = 1..LineMax ; TextPosition = record LineNumber : Scalar ; CharNumber : LinePosition end ; ErrorEntry = ^ErrorRecord ; ErrorRecord = record ErrorCode : ErrorSpan ; ErrorPosition : TextPosition ; Next : ErrorEntry end ; ErrorList = record First,Last : ErrorEntry end ; SourceEntry = ^ SourceRecord; SourceRecord = record SourceFile: UnixFile; FirstLine,BlankLine : Boolean ; FirstRead,FirstNonBlank,LastNonBlank, LastSignificant : BufferPosition ; Position : TextPosition ; ErrorsToReport,ErrorStarted : Boolean ; ErrorsOnThisLine,EarlierErrors : ErrorList ; Control: SetOfOptions; Next: SourceEntry end ; { types used by the object-program generator interface, module 6 } GeneratorDefined = integer ; ICLWord = 0..MaxWord; { Cast = (AsInteger,AsWord) ; ObjectValue = record case Cast of AsInteger : ( IVal : integer) ; AsWord : ( WVal : ICLWord ); end; } ValueKind = ( OrdValue,IntValue,BoolValue,CharValue,RealValue, BaseValue,SetValue,StringValue,PntrValue ) ; ObjectValue = record WordSize : WordRange ; case Kind : ValueKind of OrdValue, IntValue, BoolValue, CharValue : ( Ival : MCIntegerForm ); RealValue : ( Rval : MCRealForm ) ; BaseValue : ( Wval : ICLWord ) ; SetValue : ( Setval : WordEntry ) ; StringValue : ( Length : MCScalar ; Stringval : WordEntry ) ; PntrValue : ( Pval : WordEntry ) end; ValueDetails = record Velue : ObjectValue ; case Kind : ValueKind of OrdValue : ( IVal : integer ) ; BaseValue, IntValue, BoolValue, CharValue, RealValue, SetValue, StringValue: ( Length : 0..LineMax ; String : packed array [1..LineMax] of char) ; PntrValue : ( ) end ; AddressLevel = 0..DispLimit ; { RunTimeAddress = GeneratorDefined ; FieldOffset = GeneratorDefined ; BlockLabel = GeneratorDefined ; StatementLabel = GeneratorDefined ; TypeRepresentation = GeneratorDefined ; } RuntimeAddress = record Blocklevel : AddressLevel ; WordOffset : WordRange end; FieldLevel = Scalar; FieldOffset = record WordOffset : WordRange ; Level : FieldLevel ; case PartWord : Boolean of false : ( WordSize : WordRange ) ; true : ( BitSize : MCBitRange ; BitOffset : MCBitIndex ) end; BlockLabel = record BlockLevel : AddressLevel ; EntryOffset : MCHalfWord end; StatementLabel = BlockLabel ; RepKind = ( ForScalar,ForSet,ForArray,ForARecord,ForVntRecord, ForFile,ForPnter,ForVariant,ForSelector,ForCAP,ForReal, ForString,ForOther ); MachineValue = record Multiple : Scalar; case Defined : Boolean of false : () ; true : ( Magnitude : MCIntegerForm ) end; TypeRepresentation = record WordSize : WordRange ; BitSize : MCBitRange ; Kind : RepKind ; CheckValue : MachineValue ; Min,Max : MCIntegerForm ; PresetCode,PostsetCode,CheckCode : BlockLabel ; Selector : FieldOffset end ; JumpType = ( IfFalse,IfTrue,IfFalseConditional,IfTrueConditional, Absolute ); CodeLabel = GeneratorDefined ; StackTop = (TopOfStack,NextToTop) ; OutputKind = (IntKind,RealKind,CharKind,BoolKind, WordKind,StringKind,CAPKind,DefaultKind ) ; InputKind = IntKind..CharKind ; FormatKind = (Default,Floating,Fixed) ; IOFormat = (Standard,Named,Flagged,Repeated,Full); { types used by the diagnostics handler, module 7 } SerialRange = Scalar ; { types used by the lexical analyser, module 8 } SymbolType = (Ident,IntConst,RealConst,CharConst,StringConst,NilSy, NotSy,MulOp,AddOp,RelOp, LeftParent,RightParent,LeftBracket,RightBracket, Comma,Semicolon,Period,Arrow,Colon,Becomes,Thru, LabelSy,ConstSy,TypeSy,VarSy,FuncSy,ProcSy, PackedSy,ArraySy,RecordSy,SetSy,FileSy, BeginSy,IfSy,CaseSy,RepeatSy,WhileSy,ForSy,WithSy,GoToSy, EndSy,ThenSy,ElseSy,UntilSy,OfSy,DoSy,ToSy, ProgramSy,PresetOp, BasedConst,ExternSy,VisibleSy,PresetSy,ReadOnlySy, PragmaSy,OccupiesSy,OtherwiseSy,Bar,Shriek,OtherSy) ; OpType = ( Mul,RDiv,AndOp,IDiv,IMod,Plus,Minus,OrOp, LtOp,LeOp,GeOp,GtOp,NeOp,EqOp,InOp,NotOp, SingleOp,RangeOp ) ; AlfaIndex = 1..AlfaSize ; AlfaHead = packed array[AlfaIndex] of char ; AlfaEntry = ^AlfaRecord ; AlfaRecord = record Chunk : packed array[1..ChunkLength] of char ; NextChunk : AlfaEntry end ; Alfa = record Head : AlfaHead ; Tail : AlfaEntry end ; CharSet = set of char; BaseValues = 2..16; { type used by syntax analysis and recovery, module 9 } SetOfSymbols = set of SymbolType ; { types used in static semantic analysis, modules 10,11 } TypEntry = ^TypeRecord ; IdEntry = ^IdRecord ; FormalEntry = ^FormalRecord ; LabelEntry = ^LabelRecord ; ScopeCopy = ^ScopeRecord ; ListEntry = ^ListRecord ; ListRecord = record Id : IdEntry ; Next : ListEntry end ; IdList = record FirstEntry,LastEntry : ListEntry end ; IdSet = IdList ; CAPBound = record case Fixed: Boolean of false : (Address: RunTimeAddress); true : (Value: ObjectValue) end; TypeRecord = record Serial : SerialRange ; Occupying : TypEntry; Next : TypEntry ; Representation : TypeRepresentation ; case Form : TypeForm of Scalars : (case ScalarKind : DeclKind of Predefined : ( ) ; Declared : (FirstConst : IdEntry)) ; Subranges : (RangeType : TypEntry ; Min,Max : ObjectValue) ; Pointers : (DomainType : TypEntry) ; Sets : (FormOfset : SetForms ; BaseType : TypEntry ) ; Arrays : (PackedArray,StringConstant : Boolean ; AelType,InxType : TypEntry) ; CAPSchema : (PackedSchema,ValueSchema, FirstIndex, Bounded : Boolean ; CompType,InxSpec : TypEntry ; LowBound, HighBound: CAPBound ) ; Records : (FileFree,PackedRecord : Boolean ; FieldScope : IdEntry ; FixedPart : IdEntry ; VarPart : TypEntry) ; Files : (PackedFile,TextFile : Boolean ; FelType : TypEntry) ; VariantPart : (TagType : TypEntry ; TagField,SelectorField : IdEntry ; DefaultVariant,FirstVariant : TypEntry) ; Variant : (VarFileFree,Distinct : Boolean ; SubFixedPart : IdEntry ; NextVariant,SubVarPart : TypEntry ; VariantValue1, VariantValue2: ObjectValue) end ; SetOfIdClass = set of IdClass ; IdKind = (Actual,Formal) ; KindOfVar = (ValueParam,VarParam,LocalVar, ReadOnlyParam, ExternalVar, VisibleVar) ; KindOfBlock = (LocalBlock, VisibleBlock, ExternalBlock); ScopeNumber = integer ; IdRecord = record Serial : SerialRange ; Name : Alfa ; LastUse : ScopeNumber ; LeftLink,RightLink : IdEntry ; IdType : TypEntry ; case Klass : IdClass of Domain, Types : ( ) ; Consts: ( Values : ObjectValue ; SuccId : IdEntry ) ; PresetVars, ReadOnlyVars, Vars: ( VarKind : KindOfVar ; VarAddress : RunTimeAddress ) ; Field: ( Offset : FieldOffset ; Tag : Boolean ; NextField : IdEntry ) ; Bound : ( BdAddress : RunTimeAddress ; NextBound : IdEntry ) ; Proc, Func: ( case PfDecKind : DeclKind of Predefined: ( PfIndex : StdProcFuncs ) ; Declared: ( Formals : FormalEntry ; case PfKind : IdKind of Actual: ( CodeBody : BlockLabel ; Assignable : Boolean ; Assigned : Boolean ; BlockKind: KindOfBlock; Declaration : TextPosition ; case Forwrd : Boolean of false: ( Result : RunTimeAddress ) ; true : ( FormalScope : ScopeCopy )) ; Formal: ( FAddress : RunTimeAddress ))) ; Prog: ( ProgBody : BlockLabel ) end ; ParmKind = (BoundParm,ValueParm,VarParm,ProcParm,FuncParm,ReadOnlyParm) ; FormalRecord = packed record Next : FormalEntry ; Section : Scalar ; FormalType : TypEntry ; case Parm : ParmKind of ReadOnlyParm, BoundParm, ValueParm, VarParm : ( ) ; ProcParm, FuncParm : ( ItsFormals : FormalEntry ) end ; LabelDepth = 1..maxint ; LabelRecord = record LabelValue : ObjectValue ; NextLabel : LabelEntry ; LabelledCode : StatementLabel ; case Defined : Boolean of false : (Declaration : TextPosition ; MaxDepth : LabelDepth ) ; true : (case Accessible : Boolean of false : ( ) ; true : (DefinedDepth : LabelDepth ) ) end ; ProgPmEntry = ^ ProgPmRecord ; ProgPmRecord = record Name : Alfa ; Declaration : TextPosition ; ParamId : IdEntry ; NextParam : ProgPmEntry end ; FrameEntry = ^ FrameRecord ; ScopeKind = ( ActualBlock,FormalBlock,RecordScope ) ; ScopeRecord = record ScopeNo : ScopeNumber ; Locals : IdEntry ; case Scope : ScopeKind of ActualBlock, FormalBlock : ( Threatened : IdSet ; TypeChain : TypEntry ; LabelChain : LabelEntry ) ; RecordScope : ( RecordType : TypEntry ; ReadOnlyScope, FieldsPacked : Boolean ) end ; DispRange = 0..DispLimit ; RefSecurity = ( Secure,MayBeInsecure ) ; {*************************************************************************} {****** types used by the object program generator ******} {*************************************************************************} { types used by the storage allocator, chapter 13 } Shapes = ( Word,WordStructure,PartWrd,PartWrdStructure ) ; TypeCode = ( None,Indirect,Inline ) ; TypeActions = ( Presets,Postsets,ValueChecks ) ; ManualEntry = ^ ManualItem; ManualItem = record ItsShape : Shapes; ItsRepresentation : TypeRepresentation; ItsCode : TypeCode; ItsOffset : FieldOffset; Repeated : Scalar; NextItem : ManualEntry; end; ManualList = record FirstEntry,LastEntry : ManualEntry end; FrameRecord = record NextOffset, LockDepth,MaxDepth : WordRange ; PresetList,PostsetList : ManualList ; CAPList : IdList ; Next : FrameEntry end ; { types used by the code-file emitter, module 16 } Pcodes = Generatordefined; { types used by the object-program generator, modules 17-27 } StackEntry = ^ StackNode ; Accesses = (Local,Enclosing,Intermediate,Global ) ; AccessOps = (LoadOp,StoreOp,LoadRefOp ) ; BpEntry = ^ BpRecord ; RangeEntry = BpEntry ; BpRecord = record Size : WordRange ; Lower,Upper : MCIntegerForm ; Next : BpEntry ; case CAPBounds : Boolean of false : ( ) ; true : ( BpAddress : RuntimeAddress ) end ; ActualKind = ( IsValue,IsVar,IsBlock,IsBounds,IsRef ) ; ActualEntry = ^ ActualRecord ; ActualRecord = record Next : ActualEntry ; case Kind : ActualKind of IsValue, IsRef, IsVar, IsBlock : ( ActualParam : StackEntry ; FormalRep : TypeRepresentation ) ; IsBounds : ( BpList : BpEntry ) end ; IndexEntry = ^ IndexRecord ; IndexRecord = record TheIndex : StackEntry ; Factor : MCIntegerForm ; Next : IndexEntry ; case CAPIndex : Boolean of false : ( Lower,Upper : MCIntegerForm ) ; true : ( BpAddress : RuntimeAddress ) end ; RefClasses = ( VarRef,TagRef,PnterRef,FileRef ) ; OperatorKind = ( Unary,Binary,Stdrd,Condition,BlockCall,CAPLoad, RangeChk,ReadOp ) ; Unaries = ( NegateOp,FloatOp ) ; OperandKind = ( AnInteger,AReal,ABoolean,ASet,AString,APointer,AFile ) ; NodeKind = ( Reference,BlockRef,Result,Address,AConstant,Operation ) ; KindOfRangeCheck = ( SubrangeChecks,TransferChecks,MemberChecks ) ; Offsets = -MCMaxMemWord..+MCMaxMemWord ; AnOperator = ( CheckSelector,SetSelector,CheckIfActive, CheckIfNew,SetALock ) ; AncillaryEntry = ^ AncillaryRecord ; AncillaryRecord = record Next : AncillaryEntry ; case WhichOp : AnOperator of CheckSelector : ( SelectorField : FieldOffset ; SelectorValue : MCIntegerForm ) ; SetSelector : ( Selector : BlockLabel ; TagValue : MCIntegerForm ) ; CheckIfActive : ( SelectorLevel : FieldLevel ) ; SetALock : ( LockWord : Offsets ; LockBit : MCBitIndex ) ; CheckIfNew : ( ) ; end ; AncillaryList = record FirstEntry,LastEntry : AncillaryEntry end ; IOFileEntry = ^ IOFileRecord; StackNode = record NextNode : StackEntry ; DataRep : TypeRepresentation ; DataBytes : MCScalar ; Vulnerable,MayHaveOverflowed : Boolean ; RunError : Scalar ; CheckList : AncillaryList ; case Kind : NodeKind of Reference : ( BaseAddress : RuntimeAddress ; Adjustment : Offsets ; Level : Scalar ; Indirect : Boolean ; AccessList : StackEntry ; Class : RefClasses ; case PartOfWord : Boolean of false : ( case Indexed : Boolean of false:( ) ; true :(Indices : IndexEntry)) ; true : ( BitSize : MCBitRange ; BitOffset : MCBitRange ; OnByteBoundary : Boolean ; case IndexedPartWord : Boolean of false : ( ) ; true : (Index:IndexEntry) ) ) ; BlockRef : ( CallToBeGenerated : Boolean ; First,Last : ActualEntry ; OldDepth : Scalar ; case BlockKind : IdKind of Actual : ( BlockBase : BlockLabel ) ; Formal : (FormalAddress : RuntimeAddress)) ; Result : ( ) ; Address : ( case Loaded : Boolean of false : ( APartWord : Boolean ; TempAddress : RuntimeAddress ) ; true : ( ) ) ; AConstant : ( TheConst : ObjectValue ) ; Operation : ( OpGroup : OperandKind ; case OpForm : OperatorKind of Unary : ( UnaryEntry : StackEntry ; UnaryOp : Unaries ) ; Binary : ( LeftEntry,RightEntry : StackEntry ; BinaryOp : OpType ) ; Condition : ( Jump : JumpType ; OpList : StackEntry ) ; BlockCall : ( FnBlockEntry : StackEntry ) ; RangeChk : ( CheckKind : KindOfRangeCheck ; RequiredRange,TransferRange : RangeEntry; EntryToCheck : StackEntry ) ; ReadOp : ( Mode : IntKind..RealKind ) ; CAPLoad : ( CAPEntry : StackEntry ; CAPPacked : Boolean ; BpAddress : RuntimeAddress ) ; Stdrd : ( StdOp : StdProcFuncs ; case Boolean of false : ( StdEntry : StackEntry ) ; true : ( IOEntry : IOFileEntry ))) ; end ; { types used by the with-statement controller, module 21 } WithEntry = ^WithRecord; WithRecord = record BaseNum : DispRange; Entry : StackEntry; OldDepth : Scalar; Next : WithEntry end; { types used by the standard procedures generator, module 22 } IOFileRecord = record FileType : TypEntry ; FileEntry : StackEntry ; Next : IOFileEntry end ; RequestEntry = ^RequestRecord; RequestRecord = record Next: RequestEntry; Request : TypeRepresentation; ReqLevel : FieldLevel; SelectorField : FieldOffset; SelectorValue : MCIntegerForm end; { types used by the case and for-statement controllers, module 23 } CaseLabelEntry = ^ CaseLabelRecord ; CaseLabelRecord = record LabelValue : MCIntegerForm ; LimbAddress : CodeByteRange ; NextLabel : CaseLabelEntry end ; CaseEntry = ^ CaseRecord ; CaseRecord = record Selector : StackEntry ; CaseCode : CodeLabel ; MinLabel,MaxLabel : CaseLabelEntry ; Next : CaseEntry end ; ForEntry = ^ ForRecord ; ForRecord = record Incrementing : Boolean ; ControlVar,FinalEntry : StackEntry ; StartOfLoop,EndOfLoop : CodeLabel ; Next : ForEntry end ; var { variables used by pnx-dependent code in modules 3 and 4 } Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, BlankString: ArgString; visible; pargc: integer; extern; pargv: ArgPointer; extern; { global variables used by the option-handler, module 3 } CodeIsToBeGenerated : Boolean ; visible; OptionCh : char; visible; Requested,LocallyRequested : SetOfOptions ; visible; OptionFile : text; visible; AnyWarningsToReport : Boolean ; visible; OptionWarning : BannerString ; visible; OptionValue : array[IntOptions] of integer ;visible; OptionMap : array[OptionType] of record Name : OptionString ; Option : OptionType ; Class : OptionClass end ; visible; InHousePascal, ICLPascal : Boolean ; visible; Directive: ICLDirectives; visible; DirChars: CharSet; visible; DirName: array[ICLDirectives] of DirectiveString; visible; { global variables used by the source-handler, module 5 } Heading, SubHeading: BannerString; visible; PageLayout: record Title,SubTitle,BoolOps,IntOps : BannerString ; Today, Now: DateString ; PageNum : Scalar ; LinesLeft: PageDepth end ; visible; Ch: char ; visible; Source : SourceEntry ; visible; ImportList : ImportEntry ; visible; ErrorCount : Scalar ; visible; Reported : packed array[ErrorSpan] of Boolean ; visible; SourceFile, ListFile, ErrorFile : text; visible; { global variables provided for use with the object } { code generator interface, module 6 } EmptyRepresentation, RealRepresentation,BooleanRepresentation, CharRepresentation,IntegerRepresentation, PtrRepresentation,DefaultRepresentation, WordRepresentation: TypeRepresentation ; visible; UndefinedValue : MachineValue ; EightValue, NilValue,EmptyValue, FalseValue,TrueValue, ZeroValue,ZeroReal,OneValue,MaxintValue, MinLabValue,MaxLabValue, MinCharValue,MaxCharValue, MaxWordValue,MaxRealValue,MaxSetValue, LineFeed,PageThrow, DftValue,DftLayout : ObjectValue ; visible; DftAddress : RunTimeAddress ; visible; DftOffset : FieldOffset ; visible; DftLabel : BlockLabel ; visible; { global variables used by the diagnostics handler, module 6 } NextSerial : SerialRange; visible; { global variables used by the lexical analyser, module 8 } PrecedingPeriod, TailToBeDisposed : Boolean ; visible; Symbol : SymbolType ; visible; Operator : OpType ; visible; Constant : ValueDetails ; visible; Spelling : Alfa ; visible; StartOfSymbol : TextPosition ; visible; WordSymbol : array[1..NoWords] of record Spelling : AlfaHead ; SymbolValue : SymbolType ; OpValue : OpType end ; visible; LastOfLength : array[0..AlfaSize] of 0..NoWords ; visible; Letters, Digits, LettersAndDigits, UnixSpecials, LowerCaseLetters, SymbolStarters : CharSet; visible; DigitsForBase: array[BaseValues] of CharSet; visible; { global variables used in syntax analysis, modules 9,11 } ConstFacBegSys, BlockBegSys,TypeBegSys,ConstBegSys,SimpTypeBegSys,TypeDels, StatBegSys,FacBegSys,SelectSymbols,ParamBegSys, ConformantParamBegSys, IndexSpecBegSys : SetOfSymbols ; visible; SymbolsSkipped,Recovering,ErrorReported : Boolean ; visible; { global variables used by semantic analysis, modules 10,11 } IntType,RealType,BoolType,CharType,PtrType, TextType,NilType,EmptyType,WordType,NaturalType,Unknown : TypEntry ; visible; ScopeLevel,BlockLevel,LevelFound : DispRange ; visible; Display : array [DispRange] of ScopeRecord ; visible; DummyVarId : IdEntry ; visible; ControlVars : IdSet ; visible; NextScopeNo : ScopeNumber ; visible; Depth : LabelDepth ; visible; ExpType,VarType : TypEntry ; visible; VntSelector : TypEntry ; visible; PackedVar,SimpleVar,TagVar,NewRecVar : Boolean ; visible; InputFile,OutputFile : IdEntry ; visible; SystemSpelling: Alfa; visible; {*************************************************************************} {****** variables used by the object program generator ******} {*************************************************************************} { variable used by the storage allocator, module 14 } FrameLevel : AddressLevel ; extern; ItemShapes : array[Boolean,Boolean] of Shapes ; extern; { variables used by thr code-file emitter, module 16 } CodeCounter : CodeByteRange ; { variables used by the object program generator, modules 17-27 } SelectedFile : IOFileEntry ; extern; HpRequests : record FirstReq,LastReq : RequestEntry; PointerEntry : StackEntry end; extern; ZeroEntry,DefaultWidth, TopStackEntry : StackEntry ; extern; TopFrameEntry : FrameEntry ; extern; TopWithEntry : WithEntry ; extern; TopCaseEntry : CaseEntry ; extern; TopForEntry : ForEntry ; extern; BufferOffset : FieldOffset; extern; Overflow : record Occurred,Positive : Boolean end ; extern; ContextOfCheck : ( IsSucc,IsPred,IsUnknown ) ; extern; TransferCodes,CheckCodes : array[Boolean,Boolean] of Pcodes; extern; ProgPmCount : Scalar ;