符号表定义
{ types of the symtables } 符號表類型
? TSymtabletype = (
??? abstractsymtable,????? { not a real symtable???????????? }抽象符號表
??? globalsymtable,??????? { unit interface symtable???????? }單元接口符號表
??? staticsymtable,??????? { unit implementation symtable??? }單元實現符號表
??? ObjectSymtable,??????? { object symtable???????????????? }對象符號表
??? recordsymtable,??????? { record symtable???????????????? }記錄符號表
??? localsymtable,???????? { subroutine symtable???????????? }子例程符號表
??? parasymtable,????????? { arguments symtable????????????? }參數符號表
??? withsymtable,????????? { with operator symtable????????? }WITH符號表
??? stt_excepTSymtable,??? { try/except symtable???????????? }try/except符號表
??? exportedmacrosymtable, { }?? ??? ??? ??? ??? ?可導出宏符號表
??? localmacrosymtable,??? { }?? ??? ??? ??? ??? ?本地符號表
??? enumsymtable,????????? { symtable for enum members?????? }枚舉符號表
??? arraysymtable????????? { used to store parameterised type 參數類型數組符號表
???????????????????????????? in array??????????????????????? }
? );
符號表類
?????? TSymtable = class
?????? public
????????? name????? : pshortstring;?? ?符號表名
????????? realname? : pshortstring;?? ?真實表名
????????? DefList?? : TFPObjectList;?? ?定義列表
????????? SymList?? : TFPHashObjectList;?? ?符號列表
????????? defowner? : TDefEntry; { for records and objects } 擁有者定義
????????? moduleid? : longint;?? ??? ?模塊ID
????????? refcount? : smallint;?? ??? ?引用數
????????? currentvisibility : tvisibility;?? ?當前可見性
????????? currentlyoptional : boolean;?? ??? ?符號表定義是可參數化
????????? tableoptions : tsymtableoptions;?? ?符號表參數
????????? { level of symtable, used for nested procedures }
????????? symtablelevel : byte;?? ??? ?符號表級別,主要是針對嵌套過程
????????? symtabletype? : TSymtabletype;?? ?符號表類型
????????? constructor Create(const s:string);?? ?創建符號表
????????? destructor? destroy;override;?? ??? ?釋放符號表
????????? procedure freeinstance;override;?? ?釋放符號表內存
????????? function? getcopy:TSymtable;?? ??? ?獲取符號表拷貝
????????? procedure clear;virtual;?? ??? ?清空符號表
????????? function? checkduplicate(var s:THashedIDString;sym:TSymEntry):boolean;virtual;?? ?檢查是否有相同符號
????????? procedure insert(sym:TSymEntry;checkdup:boolean=true);virtual;?? ?插入符號
????????? procedure Delete(sym:TSymEntry);virtual;?? ?刪除符號
????????? function? Find(const s:TIDString) : TSymEntry;?? ?查找符號
????????? function? FindWithHash(const s:THashedIDString) : TSymEntry;virtual;?? ?查找符號通過HASH值
????????? procedure insertdef(def:TDefEntry);virtual;?? ?插入定義
????????? procedure deletedef(def:TDefEntry);?? ?刪除定義
????????? function? iscurrentunit:boolean;virtual;?? ?是否在當前單元
????????? { includes the flag in this symtable and all parent symtables; if
??????????? it's already set the flag is not set again }
????????? procedure includeoption(option:tsymtableoption); 包括符號參數,父符號對象同樣處理
?????? end;
符號表堆棧
?????? TSymtablestack = class
???????? stack : psymtablestackitem;?? ?符號表項目,單鏈表
???????? constructor create;?? ?創建
???????? destructor destroy;override;?? ?釋放
???????? procedure clear;?? ?清空
???????? procedure push(st:TSymtable); virtual;?? ?壓棧
???????? procedure pop(st:TSymtable); virtual;?? ?出棧
???????? function? top:TSymtable;?? ?棧頂
?????? end;
定義項
{************************************************
???????????????? TDefEntry
************************************************}
????? TDefEntry = class
???????? typ?? : tdeftyp;?? ?定義類型
???????? defid : longint;?? ?定義ID
???????? owner : TSymtable;?? ?擁有者符號表
????? end;
符號項
{************************************************
?????????????????? TSymEntry
************************************************}
????? { this object is the base for all symbol objects }
????? TSymEntry = class(TFPHashObject)
????? private
???????? FRealName : pshortstring;?? ??? ?名字
???????? function? GetRealname:shortstring;?? ?
???????? procedure SetRealname(const ANewName:shortstring);
????? public
???????? typ?? : tsymtyp;?? ?類型
???????? SymId : longint;?? ?ID
???????? Owner : TSymtable;?? ?擁有者符號表
???????? destructor destroy;override;?? ?釋放
???????? property RealName:shortstring read GetRealName write SetRealName;
????? end; ?
全局變量
?????? initialmacrosymtable: TSymtable;?? { macros initially defined by the compiler or???? ?
??????????????????????????????????????????? given on the command line. Is common
??????????????????????????????????????????? for all files compiled and do not change. }
?? ?初始宏符號表,初始宏來自于FPC各個選項,如WIN32,CPU,FPU,FEATURE等等。在開始加載OPTION時初始化。由set_system_macro和def_system_macro兩函數初始。
?????? macrosymtablestack,?? ??? ??? ??? ?宏符號表棧
?????? symtablestack??????? : TSymtablestack;?? ??? ?符號表棧
?????????????????????????????????????????????? ?
?? ?宏符號表棧,每次loaddefaultunits都清空棧,然后macrosymtablestack.push(initialmacrosymtable);在loadunits里,將每個ppu模塊的macrosymtablestack.push(pu.u.globalmacrosymtable);當然疊加編譯時也會重置.
?? ?符號表棧非常有用,在過程解析,單元解析,對象解析起到保證符號表一致作用。
?? ?
查找宏
??? function search_macro(const s : string):tsym;
????? var
??????? stackitem? : psymtablestackitem;
??????? hashedid?? : THashedIDString;
??????? srsym????? : tsym;
????? begin
??????? hashedid.id:=s;
??????? { First search the localmacrosymtable before searching the
????????? global macrosymtables from the units }
??????? if assigned(current_module) then
????????? begin
??????????? srsym:=tsym(current_module.localmacrosymtable.FindWithHash(hashedid));?? ?先到模塊本地宏符號表里找
??????????? if assigned(srsym) then
????????????? begin
??????????????? result:= srsym;
??????????????? exit;
????????????? end;
????????? end;
??????? stackitem:=macrosymtablestack.stack;?? ??? ??? ?
??????? while assigned(stackitem) do
????????? begin
??????????? srsym:=tsym(stackitem^.symtable.FindWithHash(hashedid));?? ?模塊本地宏符號表找不到,再到全局宏符號棧里查找
??????????? if assigned(srsym) then
????????????? begin
??????????????? result:= srsym;
??????????????? exit;
????????????? end;
??????????? stackitem:=stackitem^.next;
????????? end;
??????? result:= nil;
????? end;? ?
?? ?
??? var
?????? systemunit???? : tglobalsymtable; { pointer to the system unit }? ?
全局符號表,所有單元不管有沒有引用system.pas都會有一份全局符號表。
以下是傳說中的編譯器內部函數:
??? procedure create_intern_symbols;
????? {
??????? all intern procedures for the system unit
????? }
????? begin
??????? systemunit.insert(tsyssym.create('Concat',in_concat_x));?? ??? ?連接
??????? systemunit.insert(tsyssym.create('Write',in_write_x));?? ??? ??? ?寫
??????? systemunit.insert(tsyssym.create('WriteLn',in_writeln_x));?? ??? ?寫換行
??????? systemunit.insert(tsyssym.create('WriteStr',in_writestr_x));?? ?寫字符串
??????? systemunit.insert(tsyssym.create('Assigned',in_assigned_x));?? ?是否存在
??????? systemunit.insert(tsyssym.create('Read',in_read_x));?? ??? ?讀
??????? systemunit.insert(tsyssym.create('ReadLn',in_readln_x));?? ?讀換行
??????? systemunit.insert(tsyssym.create('ReadStr',in_readstr_x));?? ?讀字符串
??????? systemunit.insert(tsyssym.create('Ofs',in_ofs_x));?? ??? ?偏移
??????? systemunit.insert(tsyssym.create('SizeOf',in_sizeof_x));?? ?大小
??????? systemunit.insert(tsyssym.create('BitSizeOf',in_bitsizeof_x));?? ?位大小
??????? systemunit.insert(tsyssym.create('TypeOf',in_typeof_x));?? ?是否某類型
??????? systemunit.insert(tsyssym.create('Low',in_low_x));?? ??? ?最小大小
??????? systemunit.insert(tsyssym.create('High',in_high_x));?? ??? ?最大大小
??????? systemunit.insert(tsyssym.create('Slice',in_slice_x));?? ??? ?指定數組一部分
??????? systemunit.insert(tsyssym.create('Seg',in_seg_x));?? ??? ?段
??????? systemunit.insert(tsyssym.create('Ord',in_ord_x));?? ??? ?序號
??????? systemunit.insert(tsyssym.create('Pred',in_pred_x));?? ??? ?前趨
??????? systemunit.insert(tsyssym.create('Succ',in_succ_x));?? ??? ?后繼
??????? systemunit.insert(tsyssym.create('Exclude',in_exclude_x_y));?? ?排除
??????? systemunit.insert(tsyssym.create('Include',in_include_x_y));?? ?加入
??????? systemunit.insert(tsyssym.create('Pack',in_pack_x_y_z));?? ?打包
??????? systemunit.insert(tsyssym.create('Unpack',in_unpack_x_y_z));?? ?解包
??????? systemunit.insert(tsyssym.create('Break',in_break));?? ??? ?終止
??????? systemunit.insert(tsyssym.create('Exit',in_exit));?? ??? ?退出
??????? systemunit.insert(tsyssym.create('Continue',in_continue));?? ?繼續
??????? systemunit.insert(tsyssym.create('Leave',in_leave)); {macpas only}?? ?離開
??????? systemunit.insert(tsyssym.create('Cycle',in_cycle)); {macpas only}?? ?園
??????? systemunit.insert(tsyssym.create('Dec',in_dec_x));?? ?減
??????? systemunit.insert(tsyssym.create('Inc',in_inc_x));?? ?加
??????? systemunit.insert(tsyssym.create('Str',in_str_x_string));?? ?字符串
??????? systemunit.insert(tsyssym.create('Assert',in_assert_x_y));?? ?斷言
??????? systemunit.insert(tsyssym.create('Val',in_val_x));?? ?值
??????? systemunit.insert(tsyssym.create('Addr',in_addr_x));?? ?地址
??????? systemunit.insert(tsyssym.create('TypeInfo',in_typeinfo_x));?? ?類型信息
??????? systemunit.insert(tsyssym.create('SetLength',in_setlength_x));?? ?設置長度
??????? systemunit.insert(tsyssym.create('Copy',in_copy_x));?? ??? ?拷貝
??????? systemunit.insert(tsyssym.create('Initialize',in_initialize_x));?? ?初始化
??????? systemunit.insert(tsyssym.create('Finalize',in_finalize_x));?? ?結束
??????? systemunit.insert(tsyssym.create('Length',in_length_x));?? ?長度
??????? systemunit.insert(tsyssym.create('New',in_new_x));?? ?分配內存
??????? systemunit.insert(tsyssym.create('Dispose',in_dispose_x));?? ?釋放內存
{$if defined(x86) or defined(arm)}
??????? systemunit.insert(tsyssym.create('Get_Frame',in_get_frame));?? ?獲取幀
{$endif defined(x86) or defined(arm)}
????? end;
另外全局類型:
{$ifdef x86}
??????? if target_info.system<>system_x86_64_win64 then
????????? addtype('Comp',tfloatdef.create(s64comp));
{$endif x86}
??????? addtype('Currency',s64currencytype);
??????? addtype('Pointer',voidpointertype);
{$ifdef x86}
??????? addtype('FarPointer',voidfarpointertype);
{$endif x86}
??????? addtype('ShortString',cshortstringtype);
{$ifdef support_longstring}
??????? addtype('LongString',clongstringtype);
{$endif support_longstring}
??????? addtype('AnsiString',cansistringtype);
??????? addtype('WideString',cwidestringtype);
??????? addtype('UnicodeString',cunicodestringtype);
??????? addtype('OpenString',openshortstringtype);
??????? addtype('Boolean',pasbool8type);
??????? addtype('Boolean16',pasbool16type);
??????? addtype('Boolean32',pasbool32type);
??????? addtype('Boolean64',pasbool64type);
??????? addtype('ByteBool',bool8type);
??????? addtype('WordBool',bool16type);
??????? addtype('LongBool',bool32type);
??????? addtype('QWordBool',bool64type);
??????? addtype('Byte',u8inttype);
??????? addtype('ShortInt',s8inttype);
??????? addtype('Word',u16inttype);
??????? addtype('SmallInt',s16inttype);
??????? addtype('LongWord',u32inttype);
??????? addtype('LongInt',s32inttype);
??????? addtype('QWord',u64inttype);
??????? addtype('Int64',s64inttype);
??????? addtype('Char',cchartype);
??????? addtype('WideChar',cwidechartype);
??????? addtype('Text',tfiledef.createtext);
??????? addtype('TypedFile',tfiledef.createtyped(voidtype));
??????? addtype('Variant',cvarianttype);
??????? addtype('OleVariant',colevarianttype);
??????? { Internal types }
??????? addtype('$undefined',cundefinedtype);
??????? addtype('$formal',cformaltype);
??????? addtype('$typedformal',ctypedformaltype);
??????? addtype('$void',voidtype);
??????? addtype('$byte',u8inttype);
??????? addtype('$shortint',s8inttype);
??????? addtype('$word',u16inttype);
??????? addtype('$smallint',s16inttype);
??????? addtype('$ulong',u32inttype);
??????? addtype('$longint',s32inttype);
??????? addtype('$qword',u64inttype);
??????? addtype('$int64',s64inttype);
??????? addtype('$char',cchartype);
??????? addtype('$widechar',cwidechartype);
??????? addtype('$shortstring',cshortstringtype);
??????? addtype('$longstring',clongstringtype);
??????? addtype('$ansistring',cansistringtype);
??????? addtype('$widestring',cwidestringtype);
??????? addtype('$unicodestring',cunicodestringtype);
??????? addtype('$openshortstring',openshortstringtype);
??????? addtype('$boolean',pasbool8type);
??????? addtype('$boolean16',pasbool16type);
??????? addtype('$boolean32',pasbool32type);
??????? addtype('$boolean64',pasbool64type);
??????? addtype('$bytebool',bool8type);
??????? addtype('$wordbool',bool16type);
??????? addtype('$longbool',bool32type);
??????? addtype('$qwordbool',bool64type);
??????? addtype('$void_pointer',voidpointertype);
??????? addtype('$char_pointer',charpointertype);
??????? addtype('$widechar_pointer',widecharpointertype);
??????? addtype('$void_farpointer',voidfarpointertype);
??????? addtype('$openchararray',openchararraytype);
??????? addtype('$file',cfiletype);
??????? addtype('$variant',cvarianttype);
??????? addtype('$olevariant',cvarianttype);
??????? if init_settings.fputype<>fpu_none then?? ?如果浮點處理器不為空則加入以下類型
????????? begin
??????????? addtype('$s32real',s32floattype);
??????????? addtype('$s64real',s64floattype);
??????????? addtype('$s80real',s80floattype);
??????????? addtype('$sc80real',sc80floattype);
????????? end;
??????? addtype('$s64currency',s64currencytype);
?? ?systemunit.insert(ttypesym.create('$pvmt',pvmttype));
?? ?addtype('$__vtbl_ptr_type',vmttype);
?? ?addtype('$vtblarray',vmtarraytype);
?? ?addtype('$methodpointer',methodpointertype);
? TSymtabletype = (
??? abstractsymtable,????? { not a real symtable???????????? }抽象符號表
??? globalsymtable,??????? { unit interface symtable???????? }單元接口符號表
??? staticsymtable,??????? { unit implementation symtable??? }單元實現符號表
??? ObjectSymtable,??????? { object symtable???????????????? }對象符號表
??? recordsymtable,??????? { record symtable???????????????? }記錄符號表
??? localsymtable,???????? { subroutine symtable???????????? }子例程符號表
??? parasymtable,????????? { arguments symtable????????????? }參數符號表
??? withsymtable,????????? { with operator symtable????????? }WITH符號表
??? stt_excepTSymtable,??? { try/except symtable???????????? }try/except符號表
??? exportedmacrosymtable, { }?? ??? ??? ??? ??? ?可導出宏符號表
??? localmacrosymtable,??? { }?? ??? ??? ??? ??? ?本地符號表
??? enumsymtable,????????? { symtable for enum members?????? }枚舉符號表
??? arraysymtable????????? { used to store parameterised type 參數類型數組符號表
???????????????????????????? in array??????????????????????? }
? );
符號表類
?????? TSymtable = class
?????? public
????????? name????? : pshortstring;?? ?符號表名
????????? realname? : pshortstring;?? ?真實表名
????????? DefList?? : TFPObjectList;?? ?定義列表
????????? SymList?? : TFPHashObjectList;?? ?符號列表
????????? defowner? : TDefEntry; { for records and objects } 擁有者定義
????????? moduleid? : longint;?? ??? ?模塊ID
????????? refcount? : smallint;?? ??? ?引用數
????????? currentvisibility : tvisibility;?? ?當前可見性
????????? currentlyoptional : boolean;?? ??? ?符號表定義是可參數化
????????? tableoptions : tsymtableoptions;?? ?符號表參數
????????? { level of symtable, used for nested procedures }
????????? symtablelevel : byte;?? ??? ?符號表級別,主要是針對嵌套過程
????????? symtabletype? : TSymtabletype;?? ?符號表類型
????????? constructor Create(const s:string);?? ?創建符號表
????????? destructor? destroy;override;?? ??? ?釋放符號表
????????? procedure freeinstance;override;?? ?釋放符號表內存
????????? function? getcopy:TSymtable;?? ??? ?獲取符號表拷貝
????????? procedure clear;virtual;?? ??? ?清空符號表
????????? function? checkduplicate(var s:THashedIDString;sym:TSymEntry):boolean;virtual;?? ?檢查是否有相同符號
????????? procedure insert(sym:TSymEntry;checkdup:boolean=true);virtual;?? ?插入符號
????????? procedure Delete(sym:TSymEntry);virtual;?? ?刪除符號
????????? function? Find(const s:TIDString) : TSymEntry;?? ?查找符號
????????? function? FindWithHash(const s:THashedIDString) : TSymEntry;virtual;?? ?查找符號通過HASH值
????????? procedure insertdef(def:TDefEntry);virtual;?? ?插入定義
????????? procedure deletedef(def:TDefEntry);?? ?刪除定義
????????? function? iscurrentunit:boolean;virtual;?? ?是否在當前單元
????????? { includes the flag in this symtable and all parent symtables; if
??????????? it's already set the flag is not set again }
????????? procedure includeoption(option:tsymtableoption); 包括符號參數,父符號對象同樣處理
?????? end;
符號表堆棧
?????? TSymtablestack = class
???????? stack : psymtablestackitem;?? ?符號表項目,單鏈表
???????? constructor create;?? ?創建
???????? destructor destroy;override;?? ?釋放
???????? procedure clear;?? ?清空
???????? procedure push(st:TSymtable); virtual;?? ?壓棧
???????? procedure pop(st:TSymtable); virtual;?? ?出棧
???????? function? top:TSymtable;?? ?棧頂
?????? end;
定義項
{************************************************
???????????????? TDefEntry
************************************************}
????? TDefEntry = class
???????? typ?? : tdeftyp;?? ?定義類型
???????? defid : longint;?? ?定義ID
???????? owner : TSymtable;?? ?擁有者符號表
????? end;
符號項
{************************************************
?????????????????? TSymEntry
************************************************}
????? { this object is the base for all symbol objects }
????? TSymEntry = class(TFPHashObject)
????? private
???????? FRealName : pshortstring;?? ??? ?名字
???????? function? GetRealname:shortstring;?? ?
???????? procedure SetRealname(const ANewName:shortstring);
????? public
???????? typ?? : tsymtyp;?? ?類型
???????? SymId : longint;?? ?ID
???????? Owner : TSymtable;?? ?擁有者符號表
???????? destructor destroy;override;?? ?釋放
???????? property RealName:shortstring read GetRealName write SetRealName;
????? end; ?
全局變量
?????? initialmacrosymtable: TSymtable;?? { macros initially defined by the compiler or???? ?
??????????????????????????????????????????? given on the command line. Is common
??????????????????????????????????????????? for all files compiled and do not change. }
?? ?初始宏符號表,初始宏來自于FPC各個選項,如WIN32,CPU,FPU,FEATURE等等。在開始加載OPTION時初始化。由set_system_macro和def_system_macro兩函數初始。
?????? macrosymtablestack,?? ??? ??? ??? ?宏符號表棧
?????? symtablestack??????? : TSymtablestack;?? ??? ?符號表棧
?????????????????????????????????????????????? ?
?? ?宏符號表棧,每次loaddefaultunits都清空棧,然后macrosymtablestack.push(initialmacrosymtable);在loadunits里,將每個ppu模塊的macrosymtablestack.push(pu.u.globalmacrosymtable);當然疊加編譯時也會重置.
?? ?符號表棧非常有用,在過程解析,單元解析,對象解析起到保證符號表一致作用。
?? ?
查找宏
??? function search_macro(const s : string):tsym;
????? var
??????? stackitem? : psymtablestackitem;
??????? hashedid?? : THashedIDString;
??????? srsym????? : tsym;
????? begin
??????? hashedid.id:=s;
??????? { First search the localmacrosymtable before searching the
????????? global macrosymtables from the units }
??????? if assigned(current_module) then
????????? begin
??????????? srsym:=tsym(current_module.localmacrosymtable.FindWithHash(hashedid));?? ?先到模塊本地宏符號表里找
??????????? if assigned(srsym) then
????????????? begin
??????????????? result:= srsym;
??????????????? exit;
????????????? end;
????????? end;
??????? stackitem:=macrosymtablestack.stack;?? ??? ??? ?
??????? while assigned(stackitem) do
????????? begin
??????????? srsym:=tsym(stackitem^.symtable.FindWithHash(hashedid));?? ?模塊本地宏符號表找不到,再到全局宏符號棧里查找
??????????? if assigned(srsym) then
????????????? begin
??????????????? result:= srsym;
??????????????? exit;
????????????? end;
??????????? stackitem:=stackitem^.next;
????????? end;
??????? result:= nil;
????? end;? ?
?? ?
??? var
?????? systemunit???? : tglobalsymtable; { pointer to the system unit }? ?
全局符號表,所有單元不管有沒有引用system.pas都會有一份全局符號表。
以下是傳說中的編譯器內部函數:
??? procedure create_intern_symbols;
????? {
??????? all intern procedures for the system unit
????? }
????? begin
??????? systemunit.insert(tsyssym.create('Concat',in_concat_x));?? ??? ?連接
??????? systemunit.insert(tsyssym.create('Write',in_write_x));?? ??? ??? ?寫
??????? systemunit.insert(tsyssym.create('WriteLn',in_writeln_x));?? ??? ?寫換行
??????? systemunit.insert(tsyssym.create('WriteStr',in_writestr_x));?? ?寫字符串
??????? systemunit.insert(tsyssym.create('Assigned',in_assigned_x));?? ?是否存在
??????? systemunit.insert(tsyssym.create('Read',in_read_x));?? ??? ?讀
??????? systemunit.insert(tsyssym.create('ReadLn',in_readln_x));?? ?讀換行
??????? systemunit.insert(tsyssym.create('ReadStr',in_readstr_x));?? ?讀字符串
??????? systemunit.insert(tsyssym.create('Ofs',in_ofs_x));?? ??? ?偏移
??????? systemunit.insert(tsyssym.create('SizeOf',in_sizeof_x));?? ?大小
??????? systemunit.insert(tsyssym.create('BitSizeOf',in_bitsizeof_x));?? ?位大小
??????? systemunit.insert(tsyssym.create('TypeOf',in_typeof_x));?? ?是否某類型
??????? systemunit.insert(tsyssym.create('Low',in_low_x));?? ??? ?最小大小
??????? systemunit.insert(tsyssym.create('High',in_high_x));?? ??? ?最大大小
??????? systemunit.insert(tsyssym.create('Slice',in_slice_x));?? ??? ?指定數組一部分
??????? systemunit.insert(tsyssym.create('Seg',in_seg_x));?? ??? ?段
??????? systemunit.insert(tsyssym.create('Ord',in_ord_x));?? ??? ?序號
??????? systemunit.insert(tsyssym.create('Pred',in_pred_x));?? ??? ?前趨
??????? systemunit.insert(tsyssym.create('Succ',in_succ_x));?? ??? ?后繼
??????? systemunit.insert(tsyssym.create('Exclude',in_exclude_x_y));?? ?排除
??????? systemunit.insert(tsyssym.create('Include',in_include_x_y));?? ?加入
??????? systemunit.insert(tsyssym.create('Pack',in_pack_x_y_z));?? ?打包
??????? systemunit.insert(tsyssym.create('Unpack',in_unpack_x_y_z));?? ?解包
??????? systemunit.insert(tsyssym.create('Break',in_break));?? ??? ?終止
??????? systemunit.insert(tsyssym.create('Exit',in_exit));?? ??? ?退出
??????? systemunit.insert(tsyssym.create('Continue',in_continue));?? ?繼續
??????? systemunit.insert(tsyssym.create('Leave',in_leave)); {macpas only}?? ?離開
??????? systemunit.insert(tsyssym.create('Cycle',in_cycle)); {macpas only}?? ?園
??????? systemunit.insert(tsyssym.create('Dec',in_dec_x));?? ?減
??????? systemunit.insert(tsyssym.create('Inc',in_inc_x));?? ?加
??????? systemunit.insert(tsyssym.create('Str',in_str_x_string));?? ?字符串
??????? systemunit.insert(tsyssym.create('Assert',in_assert_x_y));?? ?斷言
??????? systemunit.insert(tsyssym.create('Val',in_val_x));?? ?值
??????? systemunit.insert(tsyssym.create('Addr',in_addr_x));?? ?地址
??????? systemunit.insert(tsyssym.create('TypeInfo',in_typeinfo_x));?? ?類型信息
??????? systemunit.insert(tsyssym.create('SetLength',in_setlength_x));?? ?設置長度
??????? systemunit.insert(tsyssym.create('Copy',in_copy_x));?? ??? ?拷貝
??????? systemunit.insert(tsyssym.create('Initialize',in_initialize_x));?? ?初始化
??????? systemunit.insert(tsyssym.create('Finalize',in_finalize_x));?? ?結束
??????? systemunit.insert(tsyssym.create('Length',in_length_x));?? ?長度
??????? systemunit.insert(tsyssym.create('New',in_new_x));?? ?分配內存
??????? systemunit.insert(tsyssym.create('Dispose',in_dispose_x));?? ?釋放內存
{$if defined(x86) or defined(arm)}
??????? systemunit.insert(tsyssym.create('Get_Frame',in_get_frame));?? ?獲取幀
{$endif defined(x86) or defined(arm)}
????? end;
另外全局類型:
{$ifdef x86}
??????? if target_info.system<>system_x86_64_win64 then
????????? addtype('Comp',tfloatdef.create(s64comp));
{$endif x86}
??????? addtype('Currency',s64currencytype);
??????? addtype('Pointer',voidpointertype);
{$ifdef x86}
??????? addtype('FarPointer',voidfarpointertype);
{$endif x86}
??????? addtype('ShortString',cshortstringtype);
{$ifdef support_longstring}
??????? addtype('LongString',clongstringtype);
{$endif support_longstring}
??????? addtype('AnsiString',cansistringtype);
??????? addtype('WideString',cwidestringtype);
??????? addtype('UnicodeString',cunicodestringtype);
??????? addtype('OpenString',openshortstringtype);
??????? addtype('Boolean',pasbool8type);
??????? addtype('Boolean16',pasbool16type);
??????? addtype('Boolean32',pasbool32type);
??????? addtype('Boolean64',pasbool64type);
??????? addtype('ByteBool',bool8type);
??????? addtype('WordBool',bool16type);
??????? addtype('LongBool',bool32type);
??????? addtype('QWordBool',bool64type);
??????? addtype('Byte',u8inttype);
??????? addtype('ShortInt',s8inttype);
??????? addtype('Word',u16inttype);
??????? addtype('SmallInt',s16inttype);
??????? addtype('LongWord',u32inttype);
??????? addtype('LongInt',s32inttype);
??????? addtype('QWord',u64inttype);
??????? addtype('Int64',s64inttype);
??????? addtype('Char',cchartype);
??????? addtype('WideChar',cwidechartype);
??????? addtype('Text',tfiledef.createtext);
??????? addtype('TypedFile',tfiledef.createtyped(voidtype));
??????? addtype('Variant',cvarianttype);
??????? addtype('OleVariant',colevarianttype);
??????? { Internal types }
??????? addtype('$undefined',cundefinedtype);
??????? addtype('$formal',cformaltype);
??????? addtype('$typedformal',ctypedformaltype);
??????? addtype('$void',voidtype);
??????? addtype('$byte',u8inttype);
??????? addtype('$shortint',s8inttype);
??????? addtype('$word',u16inttype);
??????? addtype('$smallint',s16inttype);
??????? addtype('$ulong',u32inttype);
??????? addtype('$longint',s32inttype);
??????? addtype('$qword',u64inttype);
??????? addtype('$int64',s64inttype);
??????? addtype('$char',cchartype);
??????? addtype('$widechar',cwidechartype);
??????? addtype('$shortstring',cshortstringtype);
??????? addtype('$longstring',clongstringtype);
??????? addtype('$ansistring',cansistringtype);
??????? addtype('$widestring',cwidestringtype);
??????? addtype('$unicodestring',cunicodestringtype);
??????? addtype('$openshortstring',openshortstringtype);
??????? addtype('$boolean',pasbool8type);
??????? addtype('$boolean16',pasbool16type);
??????? addtype('$boolean32',pasbool32type);
??????? addtype('$boolean64',pasbool64type);
??????? addtype('$bytebool',bool8type);
??????? addtype('$wordbool',bool16type);
??????? addtype('$longbool',bool32type);
??????? addtype('$qwordbool',bool64type);
??????? addtype('$void_pointer',voidpointertype);
??????? addtype('$char_pointer',charpointertype);
??????? addtype('$widechar_pointer',widecharpointertype);
??????? addtype('$void_farpointer',voidfarpointertype);
??????? addtype('$openchararray',openchararraytype);
??????? addtype('$file',cfiletype);
??????? addtype('$variant',cvarianttype);
??????? addtype('$olevariant',cvarianttype);
??????? if init_settings.fputype<>fpu_none then?? ?如果浮點處理器不為空則加入以下類型
????????? begin
??????????? addtype('$s32real',s32floattype);
??????????? addtype('$s64real',s64floattype);
??????????? addtype('$s80real',s80floattype);
??????????? addtype('$sc80real',sc80floattype);
????????? end;
??????? addtype('$s64currency',s64currencytype);
?? ?systemunit.insert(ttypesym.create('$pvmt',pvmttype));
?? ?addtype('$__vtbl_ptr_type',vmttype);
?? ?addtype('$vtblarray',vmtarraytype);
?? ?addtype('$methodpointer',methodpointertype);
總結
- 上一篇: sis最新ip地址2020入口一_【新版
- 下一篇: html音乐播放心得体会,听音乐讲座心得