1 line
32 KiB
ObjectPascal
1 line
32 KiB
ObjectPascal
|
{$optimize -1}
{------------------------------------------------------------}
{ }
{ SymbolTables }
{ }
{ This unit implements the symbol table for ORCA/Pascal. }
{ Also included are many of the declarations that tie the }
{ various units together. The specialized memory manager }
{ used to make symbol table disposal more efficient is also }
{ included in this module. }
{ }
{ The interfaces for the scanner and object module output }
{ units are in this unit. This eliminates the need for a }
{ common module that would have most of the pertinant }
{ symbol table type information. }
{ }
{ By Mike Westerfield }
{ }
{ Copyright August 1987 }
{ By the Byte Works, Inc. }
{ }
{------------------------------------------------------------}
unit SymbolTables;
{$segment 'Pascal2'}
interface
{$libprefix '0/obj/'}
uses PCommon, CGI, CGC, ObjOut, Native, Scanner;
{---------------------------------------------------------------}
var
{pointers:}
{---------}
intptr,realptr,charptr,
byteptr,longptr,compptr,
doubleptr,extendedptr,stringptr,
boolptr,nilptr,textptr: stp; {pointers to entries of standard ids}
externIdentifier: ctp; {extern ID entry}
forwardIdentifier: ctp; {forward ID entry}
utypptr,ucstptr,uvarptr,
ufldptr,uprcptr,ufctptr, {pointers to entries for undeclared ids}
fwptr: ctp; {head of chain for forw decl type ids}
inptr,outptr,erroroutputptr: ctp; {standard I/O}
dummyString: stp; {index entry for string constants}
{---------------------------------------------------------------}
function CompObjects (fsp1, fsp2: stp): boolean;
{ See if two objects are assignment compatible }
{ }
{ parameters: }
{ fsp1 - object to assign to }
{ fsp2 - object to assign }
{ }
{ Returns: True if the structures are compatible, else false }
function CompTypes (fsp1, fsp2: stp): boolean;
{ determine if two structures are type compatible }
{ }
{ parameters: }
{ fsp1, fsp2 - structures to check }
{ }
{ Returns: True if the structures are compatible, else false }
procedure EnterStdTypes;
{ enter the base types }
procedure EntStdNames;
{ enter standard names in the program symbol table }
procedure EnterId (fcp: ctp); extern;
{ Enter an identifier at the current stack frame level }
{ }
{ parameters: }
{ fcp - identifier to enter }
procedure EnterUndecl;
{ enter fake identifiers for use when identifiers are }
{ undeclared }
procedure GenSymbols (sym: ctp; doGlobals: integer);
{ generate the symbol table }
{ }
{ Notes: Defined as extern in Native.pas }
procedure GetBounds (fsp: stp; var fmin,fmax: longint);
{ get internal bounds of subrange or scalar type }
{ (assume fsp<>longptr and fsp<>realptr) }
{ }
{ parameters: }
{ fsp - type to get the bounds for }
{ fmin, fmax - (output) bounds }
function GetType (tp: stp; isPacked: boolean): baseTypeEnum;
{ find the base type for a variable type }
{ }
{ parameters: }
{ tp - variable type }
{ isPacked - is the variable packed? }
{ }
{ returns: Variable base type }
function IsReal (fsp: stp): boolean;
{ determine if fsp is one of the real types }
{ }
{ parameters: }
{ fsp - structure to check }
{ }
{ Returns: True if fsp is a real, else false }
function IsString (fsp: stp): boolean;
{ determine if fsp is a string }
{ }
{ parameters: }
{ fsp - structure to check }
{ }
{ Returns: True if fsp is a string, else false }
procedure SearchSection (fcp: ctp; var fcpl: ctp); extern;
{ find record fields and forward declared procedure id's }
{ }
{ parameters: }
{ fcp - top of identifier tree }
{ fcpl - (outout) identifier }
procedure SearchId (fidcls: setofids; var fcp: ctp); extern;
{ find
|