№еSyntax10.Scn.FntSyntax10b.Scn.FntСќџџаћаћInfoElemsAlloc#Syntax10.Scn.Fnt"Title": ETH SGI Oberon OPM with modifications. "Copyright": 1998 by Claudio Nieder . This module is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This module is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ›џџџанаћHistoryElemsAllocHistory#Syntax10.Scn.Fnt;;"1998-02-28 private@claudio.ch" Added procedure errText. “         ^  ? I:/#h  d o‚ oc Q   s   W   L6 r6} _ ,  +>"‚+A#*Kј'џџџџ€8РдFoldElemsNewvџџџџ€8РдЩ Jџџџџ€8Рд2џџџџ€8РдJџџџџ€8Рдoџџџџ€8Рдџџџџ€8РдO†џџџџ€8РдDq  џџџџ€8Рд<џџџџ€8Рд џџџџ€8РдDџџџџ€8Рд џџџџ€8РдEџџџџ€8Рдџџџџ€8РдVџџџџ€8Рд џџџџ€8Рд>џџџџ€8Рд џџџџ€8РдЏџџџџ€8Рдџџџџ€8РдVџџџџ€8Рд ›џџџ€8Рд#Syntax10.Scn.FntCC Shortcut for Mark, which uses global errpos for the position. џџџџ€8РдОџџџ€8Рд#Syntax10.Scn.Fnt BEGIN Mark(n,errpos); END err;џџџџ€8Рд % џџџ€8Рд#Syntax10.Scn.Fnt>> Like err, but with the possibility to output extra text. џџџџ€8Рд˜џџџ€8Рд#Syntax10.Scn.FntFF BEGIN Mark(n,errpos); LogWStr(" "); LogWStr(message); END errText;џџџџ€8РдV џџџџ€8Рд2џџџџ€8Рдџџџџ€8Рдaџџџџ€8Рд  џџџџ€8Рд:џџџџ€8Рд  џџџџ€8Рд<џџџџ€8Рд  џџџџ€8Рд…џџџџ€8РдXџџџџ€8Рд)џџџџ€8Рд  џџџџ€8Рд0џџџџ€8Рд  џџџџ€8РдRџџџџ€8Рд џџџџ€8Рд.џџџџ€8Рд  џџџџ€8Рд1џџџџ€8Рд  џџџџ€8Рдџџџџ€8Рд /џџџџ€8Рд3џџџџ€8Рд  џџџџ€8Рдџџџџ€8РдY џџџџ€8Рд*џџџџ€8Рд  џџџџ€8Рд-џџџџ€8Рд  џџџџ€8Рд@џџџџ€8Рд  џџџџ€8Рд/џџџџ€8Рд  џџџџ€8Рд2џџџџ€8Рд џџџџ€8Рд5џџџџ€8Рд  џџџџ€8Рдџџџџ€8Рд џџџџ€8Рдгџџџџ€8Рдf џџџџ€8Рд'џџџџ€8Рд  џџџџ€8Рд,џџџџ€8Рд  џџџџ€8Рд'џџџџ€8Рд  џџџџ€8Рд,џџџџ€8Рдџџџџ€8Рд,џџџџ€8Рд  џџџџ€8Рд.џџџџ€8Рд  -џџџџ€8Рд6џџџџ€8Рд  џџџџ€8Рдшџџџџ€8Рд  џџџџ€8Рдџџџџ€8Рд (џџџџ€8Рдcџџџџ€8Рдџџџџ€8Рд'џџџџ€8РдFP0MODULE OROPM;  (* RC 6.3.89 / 9.2.94 *) (* object model 9.2.94 *) (* Machine dependent constants needed before code generation *) (* Host interface *) IMPORT SYSTEM ,Files,Oberon,Texts; CONST (* MIPS R2000 *) (* basic type sizes *) ByteSize*=1; (* SYSTEM.BYTE *) CharSize*=1; (* CHAR *) BoolSize*=1; (* BOOLEAN *) SetSize*=4; (* SET *) SIntSize*=1; (* SHORTINT *) IntSize*=2; (* INTEGER *) LIntSize*=4; (* LONGINT *) RealSize*=4; (* REAL *) LRealSize*=8; (* LONGREAL *) ProcSize*=4; (* PROCEDURE type *) PointerSize*=4; (* POINTER type *) (* value of constant NIL *) nilval*=0; (* target machine minimum values of basic types expressed in host machine format: *) MinSInt*=-80H; MinInt*=-8000H; MinLInt*= 80000000H; (*-2147483648*) MinRealPat=0FF7FFFFFH; (* most negative, 32-bit pattern *) MinLRealPatL=0FFFFFFFFH; (* most negative, lower 32-bit pattern *) MinLRealPatH=0FFEFFFFFH; (* most negative, higher 32-bit pattern *) (* target machine maximum values of basic types expressed in host machine format: *) MaxSInt*=7FH; MaxInt*=7FFFH; MaxLInt*=7FFFFFFFH; (*2147483647*) MaxSet*=31; (* must be >= 15, else the bootstrapped compiler cannot run (IN-tests) *) MaxRealPat=7F7FFFFFH; (* most positive, 32-bit pattern *) MaxLRealPatL=0FFFFFFFFH; (* most positive, lower 32-bit pattern *) MaxLRealPatH=7FEFFFFFH; (* most positive, higher 32-bit pattern *) (* maximal index value for array declaration: *) MaxIndex*=MaxLInt; (* parameterization of numeric scanner: *) MaxHDig*=8; (* maximal hexadecimal longint length *) MaxRExp*=38; (* maximal real exponent *) MaxLExp*=308; (* maximal longreal exponent *) (* inclusive parameter range for standard procedure HALT: *) MinHaltNr*=20; MaxHaltNr*=255; (* inclusive range of register number for procedures SYSTEM.GETREG and SYSTEM.PUTREG: *) MinRegNr*=0; MaxRegNr*=79; (* 0..31: r0-r31, 32..63: f0-f31, 64..79: CP0 r0..r15 *) (* maximal flag value used to mark interface structures: *) MaxSysFlag*=0; (* MIPS R2000: only 0 is valid, not used *) (* maximal condition value of parameter for SYSTEM.CC: *) MaxCC*=-1; (* MIPS R2000: not used *) (* initialization of constant address, must be different from any valid constant address: *) ConstNotAlloc*=-1; (* MIPS R2000: strings and reals are allocated *) (* maximal number of cases in a case statement: *) MaxCases*=128; (* maximal range of a case statement (higher label - lower label ~ jump table size): *) MaxCaseRange*=512; (* whether hidden pointer fields have to be nevertheless exported: *) ExpHdPtrFld*=TRUE; HdPtrName*="@ptr"; (* whether hidden procedure fields have to be nevertheless exported (may be used for System.Free): *) ExpHdProcFld*=FALSE; HdProcName*="@proc"; (* whether hidden bound procedures have to be nevertheless exported: *) ExpHdTProc*=FALSE; HdTProcName*="@tproc"; (* maximal number of hidden fields in an exported record: *) MaxHdFld*=512; (* maximal number of exported stuctures: *) MaxStruct*=256; (* must be < MAX(INTEGER) DIV 2 in object model *) (* maximal number of pointer fields in a record: *) MaxPtr*=16384; (* maximal number of global pointers: *) MaxGPtr*=16384; (* whether field leaf of pointer variable p has to be set to FALSE, when NEW(p) or SYSTEM.NEW(p, n) is used: *) NEWusingAdr*=FALSE; (* special character (< " ") returned by procedure Get, if end of text reached *) Eot*=0X; VAR LEHost*:BOOLEAN; (* little or big endian host *) MinReal*,MaxReal*:REAL; MinLReal*,MaxLReal*:LONGREAL; noerr*:BOOLEAN; (* no error found until now *) curpos*,errpos*:LONGINT; (* character and error position in source file *) breakpc*:LONGINT; (* set by OPV.Init *) objname*:ARRAY 64 OF CHAR; CONST SFext=".Sym"; OFext=".Obj"; SFtag=0FAX; (* symbol file tag *) OFtag=0F9X; (* object file tag *) (* compiler options: *) inxchk*=0; (* index check on *) ovflchk*=1; (* overflow check on *) ranchk*=2; (* range check on *) typchk*=3; (* type check on *) newsf*=4; (* generation of new symbol file allowed *) ptrinit*=5; (* pointer initialization *) intprinf*=6; (* inter-procedural information about register allocation used *) assert*=7; (* assert evaluation *) findpc*=8; (* find text position of breakpc *) extsf*=9; (* extension of old symbol file allowed *) cendian*=10; (* generation of big(little) endian code on a little(big) endian machine *) TYPE FileName=ARRAY 32 OF CHAR; VAR lastpos:LONGINT; (* last position error in source file *) inR:Texts.Reader; Log:Texts.Text; W:Texts.Writer; oldSF,newSF,ObjF,RefF:Files.Rider; oldSFile,newSFile,ObjFile,RefFile:Files.File; PROCEDURE Init*(source:Texts.Reader; log:Texts.Text); BEGIN inR:=source; Log:=log; noerr:=TRUE; curpos:=Texts.Pos(inR); errpos:=curpos; lastpos:=curpos-10; END Init; (* In context of UV4 it is problematic to mix host dependent parts, like the above constants, with code which is dependent only on whether this compiler executes under Oberon or something else. *) PROCEDURE Get*(VAR ch:CHAR); (* read next character from source text, Eot if no more *) BEGIN Texts.Read(inR,ch); INC(curpos); END Get; PROCEDURE MakeFileName(VAR name,FName:ARRAY OF CHAR; ext:ARRAY OF CHAR); (* Given a module name and a file extension build file name, by appending the extension to the module name. *) VAR ch:CHAR; i,j:INTEGER; BEGIN i:=0; LOOP ch:=name[i]; IF ch=0X THEN EXIT END; FName[i]:=ch; INC(i); END; j:=0; REPEAT ch:=ext[j]; FName[i]:=ch; INC(i); INC(j); UNTIL ch=0X; END MakeFileName; (* ------------------------- Log Output ------------------------- *) (* These procedures do not necessarly write to the Oberon Log, thus they can not be replaced by module Log. *) PROCEDURE LogW*(ch:CHAR); BEGIN Texts.Write(W,ch); Texts.Append(Log,W.buf) END LogW; PROCEDURE LogWStr*(s:ARRAY OF CHAR); BEGIN Texts.WriteString(W,s); Texts.Append(Log,W.buf) END LogWStr; PROCEDURE LogWNum*(i,len:LONGINT); BEGIN Texts.WriteInt(W,i,len); Texts.Append(Log,W.buf) END LogWNum; PROCEDURE LogWHex(i:LONGINT); BEGIN Texts.WriteHex(W,i); Texts.Write(W,"H"); Texts.Append(Log,W.buf); END LogWHex; PROCEDURE LogWLn*; BEGIN Texts.WriteLn(W); Texts.Append(Log,W.buf); END LogWLn; PROCEDURE Mark*(n:INTEGER; pos:LONGINT); (* Report an error or warning (negative number). Errors which are near a previous error are filtered out. Sideeffects: Set noerr to FALSE. Uses and modifies lastpos. *) BEGIN IF n>=0 THEN noerr:=FALSE; IF (pos