📄 uextidents.pas
字号:
//Saves the identifier to the stream.
procedure Save(Stream: TIdentStream); override;
//Loads the identifier from the stream.
procedure Load(Stream: TIdentStream; Version: TIdentClassVersion);
override;
//Compares this identifier with the other one.
function CompareWith(Ident: TIdentifier; const MsgPrefix: String;
Messages: TStrings): Boolean; override;
property FuncKind: TFunctionKind read FFuncKind write FFuncKind;
property Params: TIdentifierList read FParams;
property ReturnType: TType read FReturnType write FReturnType;
property CallConvs: TStringList read FCallConvs;
property Attributes: TFunctionAttributes read FAttributes write FAttributes;
property Interf: String read FInterf write FInterf;
property UsedIdents: TIdentifierList read FUsedIdents;
property BodySize: TPosition read FBodySize write FBodySize;
end;
{ * * * *** * * * *** TProgramMainFunction *** * * * *** * * * }
{The class for the main function in units (hopefully only in programs), i.e.
between the "begin" and the "end.". }
TProgramMainFunction = class(TFunction)
private
protected
public
//Creates the object for the function and sets the kind to procedure.
constructor Create; override;
//Gets a description of the identifier, mostly like it has been declared in
//the pascal data.
function GetDescriptionString(TextFormat: TTextFormat;
SourceIdent: TIdentifier = nil): String;
override;
//Gets the declaration of the identifier in an internal representation.
procedure GetDeclaration(Assembly: TDeclarationAssembler); override;
end;
{ * * * *** * * * *** TUnitInitFinalFunction *** * * * *** * * * }
{The class for the initialization and finalization sections of units. }
TUnitInitFinalFunction = class(TProgramMainFunction)
private
FIsInitialization: Boolean; //is it the initialization section?
protected
//Copies all data of this identifier to the Clone.
procedure CloneTo(Clone: TIdentifier); override;
public
//Gets a description of the identifier, mostly like it has been declared in
//the pascal data.
function GetDescriptionString(TextFormat: TTextFormat;
SourceIdent: TIdentifier = nil): String;
override;
//Gets the declaration of the identifier in an internal representation.
procedure GetDeclaration(Assembly: TDeclarationAssembler); override;
//Saves the identifier to the stream.
procedure Save(Stream: TIdentStream); override;
//Loads the identifier from the stream.
procedure Load(Stream: TIdentStream; Version: TIdentClassVersion);
override;
property IsInitialization: Boolean read FIsInitialization
write FIsInitialization;
end;
{ * * * *** * * * *** TStringType *** * * * *** * * * }
{The class for strings. It contains the size of the string in case it is
defined. }
TStringType = class(TType)
private
FSize: String; //the size/capacity of the string
protected
//Copies all data of this identifier to the Clone.
procedure CloneTo(Clone: TIdentifier); override;
public
//Gets a description of the identifier, mostly like it has been declared in
//the pascal data.
function GetDescriptionString(TextFormat: TTextFormat;
SourceIdent: TIdentifier = nil): String;
override;
//Gets the declaration of the identifier in an internal representation.
procedure GetDeclaration(Assembly: TDeclarationAssembler); override;
//Tests if this identifier is equal to Other as regards content.
function ParamEqualTo(Other: TType): Boolean; override;
//Saves the identifier to the stream.
procedure Save(Stream: TIdentStream); override;
//Loads the identifier from the stream.
procedure Load(Stream: TIdentStream; Version: TIdentClassVersion);
override;
//Compares this identifier with the other one.
function CompareWith(Ident: TIdentifier; const MsgPrefix: String;
Messages: TStrings): Boolean; override;
property Size: String read FSize write FSize;
end;
{ * * * *** * * * *** TPointerType *** * * * *** * * * }
{The class for pointers. It contains an identifier for its base class, the
type on which it points. }
TPointerType = class(TType)
private
FBaseType: TType; //the type on which it points
protected
//Copies all data of this identifier to the Clone.
procedure CloneTo(Clone: TIdentifier); override;
public
//Frees the base type.
destructor Destroy; override;
//Calls Proc with each instance of TIdentType.
procedure ForEachIdentType(Proc: TForEachIdentTypeProc; Parent: TIdentifier;
Data: TIdentifier = nil); override;
//Adds the given set to its own and all contained identifiers.
procedure AddPortabilityIssues(Portability: TIdentPortabilities); override;
//Tests if it is or contains Ident.
function RecursiveIsIn(Ident: TIdentifier): Boolean; override;
//Gets a description of the identifier, mostly like it has been declared in
//the pascal data.
function GetDescriptionString(TextFormat: TTextFormat;
SourceIdent: TIdentifier = nil): String;
override;
//Gets the declaration of the identifier in an internal representation.
procedure GetDeclaration(Assembly: TDeclarationAssembler); override;
//Tests if this identifier is equal to Other as regards content.
function ParamEqualTo(Other: TType): Boolean; override;
//Adds itself and all owned identifiers to the list.
procedure AddToList(List: TIdentifierList); override;
//Saves the identifier to the stream.
procedure Save(Stream: TIdentStream); override;
//Loads the identifier from the stream.
procedure Load(Stream: TIdentStream; Version: TIdentClassVersion);
override;
//Compares this identifier with the other one.
function CompareWith(Ident: TIdentifier; const MsgPrefix: String;
Messages: TStrings): Boolean; override;
property BaseType: TType read FBaseType write FBaseType;
end;
{ * * * *** * * * *** TFunctionType *** * * * *** * * * }
{The class for functon types/pointers. It contains the kind of the function,
if it is a function or a procedure, an identifier for the return value, a
list for the parameters, the calling conventions and the information, if it
is a method, i.e. declared with of object. }
TFunctionType = class(TType)
private
FFuncKind: TFunctionKind; //the kind of the function (procedure, function)
FParams: TIdentifierList; //the list of parameters
FReturnType: TType; //the return type (or nil)
FCallConvs: String; //the calling conventions (or '')
FIsMethod: Boolean; //if it is a method-pointer (with of object)
protected
//Copies all data of this identifier to the Clone.
procedure CloneTo(Clone: TIdentifier); override;
public
//Create the object and the list of parameters.
constructor Create; override;
//Free the object and the list of parameters and the return type.
destructor Destroy; override;
//Calls Proc with each instance of TIdentType.
procedure ForEachIdentType(Proc: TForEachIdentTypeProc; Parent: TIdentifier;
Data: TIdentifier = nil); override;
//Adds the given set to its own and all contained identifiers.
procedure AddPortabilityIssues(Portability: TIdentPortabilities); override;
//Tests if it is or contains Ident.
function RecursiveIsIn(Ident: TIdentifier): Boolean; override;
//Gets a description of the identifier, mostly like it has been declared in
//the pascal data.
function GetDescriptionString(TextFormat: TTextFormat;
SourceIdent: TIdentifier = nil): String;
override;
//Gets the declaration of the identifier in an internal representation.
procedure GetDeclaration(Assembly: TDeclarationAssembler); override;
//Tests if this identifier is equal to Other as regards content.
function ParamEqualTo(Other: TType): Boolean; override;
//Adds itself and all owned identifiers to the list.
procedure AddToList(List: TIdentifierList); override;
//Saves the identifier to the stream.
procedure Save(Stream: TIdentStream); override;
//Loads the identifier from the stream.
procedure Load(Stream: TIdentStream; Version: TIdentClassVersion);
override;
//Compares this identifier with the other one.
function CompareWith(Ident: TIdentifier; const MsgPrefix: String;
Messages: TStrings): Boolean; override;
property FuncKind: TFunctionKind read FFuncKind write FFuncKind;
property Params: TIdentifierList read FParams;
property ReturnType: TType read FReturnType write FReturnType;
property CallConvs: String read FCallConvs write FCallConvs;
property IsMethod: Boolean read FIsMethod write FIsMethod;
end;
{ * * * *** * * * *** TEnumType *** * * * *** * * * }
{The class for enumeration types. It contains the string of the declaration
of the items of the enumeration. For each item an own special "constant2 of
the type ~[linkClass TEnumTypeItem] will be created. }
TEnumType = class(TType)
private
//the list of the declared items
FItems: TIdentifierList;
protected
//Copies all data of this identifier to the Clone.
procedure CloneTo(Clone: TIdentifier); override;
public
//Create the object and the list of items.
constructor Create; override;
//Free the object and the list of items.
destructor Destroy; override;
//Gets a description of the identifier, mostly like it has been declared in
//the pascal data.
function GetDescriptionString(TextFormat: TTextFormat;
SourceIdent: TIdentifier = nil): String;
override;
//Gets the declaration of the identifier in an internal representation.
procedure GetDeclaration(Assembly: TDeclarationAssembler); override;
//Tests if this identifier is equal to Other as regards content.
function ParamEqualTo(Other: TType): Boolean; override;
//Saves the identifier to the stream.
procedure Save(Stream: TIdentStream); override;
//Loads the identifier from the stream.
procedure Load(Stream: TIdentStream; Version: TIdentClassVersion);
override;
//Compares this identifier with the other one.
function CompareWith(Ident: TIdentifier; const MsgPrefix: String;
Messages: TStrings): Boolean; override;
property Items: TIdentifierList read FItems write FItems;
end;
{ * * * *** * * * *** TEnumTypeItem *** * * * *** * * * }
{The class for enumeration items. Enumeration items are constants. They get a
direct link to the enumeration, i.e. the object of the class ~[linkClass
TEnumType], that means it should not be freed. }
TEnumTypeItem = class(TIdentifier)
private
//the enumeration type this is an item of
FEnumType: TEnumType;
//the value of the constant
FValue: String;
//if the value of the item was explicitly set
FValueSet: Boolean;
protected
//Copies all data of this identifier to the Clone.
procedure CloneTo(Clone: TIdentifier); override;
public
//Calls Proc with each instance of TIdentType.
procedure ForEachIdentType(Proc: TForEachIdentTypeProc; Parent: TIdentifier;
Data: TIdentifier = nil); override;
//Adds the given set to its own and all contained identifiers.
procedure AddPortabilityIssues(Portability: TIdentPortabilities); override;
//Tests if it is or contains Ident.
function RecursiveIsIn(Ident: TIdentifier): Boolean; override;
//Gets a description of the identifier, mostly like it has been declared in
//the pascal data.
function GetDescriptionString(TextFormat: TTextFormat;
SourceIdent: TIdentifier = nil): String;
override;
//Gets the declaration of the identifier in an internal representation.
procedure GetDeclaration(Assembly: TDeclarationAssembler); override;
//Gets a description of the declaration of the item, like it has been
//declared in the pascal data.
function GetItemDeclarationString(TextFormat: TTextFormat;
SourceIdent: TIdentifier): String;
//Gets the declaration of the item of the enumeration.
procedure GetItemDeclaration(Assembly: TDeclarationAssembler);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -