1 line
27 KiB
ObjectPascal
1 line
27 KiB
ObjectPascal
|
{$optimize -1}
{---------------------------------------------------------------}
{ }
{ PCommon }
{ }
{ Common variables and low-level utility subroutines used by }
{ by the compiler. }
{ }
{---------------------------------------------------------------}
unit PCommon;
interface
const
displimit = 20; {max # proc levels, nested records,}
{ with statements.}
maxaddr = maxint4; {max legal value for a pointer}
maxcnt = 256; {number of characters in a line+1}
maxLine = 255; {number of characters in a line}
maxLabel = 2400; {max # of compiler generated labels}
maxlevel = 10; {max # proc levels}
maxgoto = 10; {max nesting level for goto check}
{NOTE: maxPath also defined in scanner.asm}
maxPath = 255; {max length of a path name}
ordmaxchar = 127; {ord of largest char}
ordminchar = 0; {ord of smallest char}
sethigh = 2047; {number of bits in set variable - 1}
setlow = 0; {"ord" of lsb of set variable}
setsize = 256; {set size in bytes; (sethigh+1) div 8}
intsize = 2; {storage in bytes required for base}
realsize = 4; { types}
doublesize = 8;
compsize = 8;
extendedsize = 10;
bytesize = 1;
longsize = 4;
packedcharsize = 1;
charsize = 2;
boolsize = 2;
ptrsize = 4;
procsize = 6;
extSize = 10; {size of real when passed as parm}
constantRec_longC = 6; {partial sizes for constantRec}
constantRec_reel = 10;
constantRec_pset = 260;
constantRec_chset = 258;
constantRec_strg = 258;
{error reporting}
{---------------}
maxErr = 10; {max errors on one line}
{file types}
{----------}
BIN = $06; {binary file}
DVU = $5E; {developer utility data file}
AuxUnit = $008009; {Pascal unit Aux Type}
type
{misc}
{----}
disprange = 0..displimit; {nesting level for procs + withs}
markPtr = ^integer; {pointer type for mark, release}
ptr = ^byte; {general pointer}
handle = ^ptr; {general handle}
stringKind = (lengthString,nullString); {string formats}
pString = packed array [0..maxLine] of char; {length string}
pStringPtr = ^pString;
unsigned = 0..maxint; {unsigned integer}
where = (blck,crec,vrec,rec); {origin of a set of symbols}
long = record {for extracting words}
case boolean of
true: (lsw, msw: integer);
false: (l: longint);
end;
{error reporting}
{---------------}
{NOTE: disps defined in Scanner.asm}
errtype = record
nmr: unsigned; {error number}
pos: unsigned; {position in line}
end;
{basic symbols}
{-------------}
packedkinds = (pkpacked,pkunpacked,pkeither);
symbol = (ident,intconst,realconst,stringconst,notsy,mulop,addop,relop,
lparent,rparent,lbrack,rbrack,comma,semicolon,period,arrow,
colon,dotdot,becomes,labelsy,constsy,typesy,varsy,funcsy,
progsy,procsy,setsy,packedsy,arraysy,recordsy,filesy,nilsy,
beginsy,ifsy,casesy,repeatsy,whilesy,forsy,withsy,gotosy,
endsy,elsesy,untilsy,ofsy,dosy,tosy,downtosy,thensy,
othersy,otherwisesy,powersy,bitnot,usessy,stringsy,atsy,
longintconst,unitsy,interfacesy,implementationsy,univsy,
objectsy,inheritedsy);
setofsys = set of symbol;
operator = (noop,mul,rdiv,andop,idiv,imod,plus,minus,orop,ltop,leop,geop,gtop,
neop,eqop,inop,band,bor,xor,rshift,lshift);
{data structures}
{---------------}
ctp = ^identifier;
addrrange = longint; {valid range for pointers}
declkind = (standard,declared);
structform = (scalar,subrange,pointerStruct,power,arrays,records,objects,
files,tagfld,variant);
stp = ^structure;
structure = record
size: addrrange;
ispacked: packedkinds;
hasSFile: boolean;
case form: structform of
scalar: (case scalkind: declkind of
declared: (fconst: ctp);
standard: ());
subrange: (rangetype: stp; min,
|