symtable.pas 105 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl, Pierre Muller
  4. This unit handles the symbol tables
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. {$ifdef TP}
  19. {$N+,E+,F+,D-}
  20. {$endif}
  21. unit symtable;
  22. interface
  23. uses
  24. {$ifdef TP}
  25. {$ifndef Delphi}
  26. objects,
  27. {$endif Delphi}
  28. {$endif}
  29. strings,cobjects,
  30. globtype,globals,tokens,systems,verbose,
  31. symconst,
  32. aasm
  33. ,cpubase
  34. ,cpuinfo
  35. {$ifdef GDB}
  36. ,gdb
  37. {$endif}
  38. ;
  39. {************************************************
  40. Some internal constants
  41. ************************************************}
  42. const
  43. hasharraysize = 256;
  44. {$ifdef TP}
  45. indexgrowsize = 16;
  46. {$else}
  47. indexgrowsize = 64;
  48. {$endif}
  49. {************************************************
  50. Needed forward pointers
  51. ************************************************}
  52. type
  53. { needed for owner (table) of symbol }
  54. psymtable = ^tsymtable;
  55. punitsymtable = ^tunitsymtable;
  56. { needed for names by the definitions }
  57. ptypesym = ^ttypesym;
  58. penumsym = ^tenumsym;
  59. pprocsym = ^tprocsym;
  60. pref = ^tref;
  61. tref = object
  62. nextref : pref;
  63. posinfo : tfileposinfo;
  64. moduleindex : word;
  65. is_written : boolean;
  66. constructor init(ref:pref;pos:pfileposinfo);
  67. destructor done; virtual;
  68. end;
  69. { Deref entry options }
  70. tdereftype = (derefnil,derefaktrecordindex,derefaktstaticindex,
  71. derefunit,derefrecord,derefindex,
  72. dereflocal,derefpara,derefaktlocal);
  73. pderef = ^tderef;
  74. tderef = object
  75. dereftype : tdereftype;
  76. index : word;
  77. next : pderef;
  78. constructor init(typ:tdereftype;i:word);
  79. destructor done;
  80. end;
  81. psymtableentry = ^tsymtableentry;
  82. tsymtableentry = object(tnamedindexobject)
  83. owner : psymtable;
  84. end;
  85. {************************************************
  86. TDef
  87. ************************************************}
  88. {$i symdefh.inc}
  89. {************************************************
  90. TSym
  91. ************************************************}
  92. {$i symsymh.inc}
  93. {************************************************
  94. TSymtable
  95. ************************************************}
  96. tsymtabletype = (invalidsymtable,withsymtable,staticsymtable,
  97. globalsymtable,unitsymtable,
  98. objectsymtable,recordsymtable,
  99. macrosymtable,localsymtable,
  100. parasymtable,inlineparasymtable,
  101. inlinelocalsymtable,stt_exceptsymtable,
  102. { only used for PPU reading of static part
  103. of a unit }
  104. staticppusymtable);
  105. tcallback = procedure(p : psym);
  106. tsearchhasharray = array[0..hasharraysize-1] of psym;
  107. psearchhasharray = ^tsearchhasharray;
  108. tsymtable = object
  109. symtabletype : tsymtabletype;
  110. { each symtable gets a number }
  111. unitid : word{integer give range check errors PM};
  112. name : pstring;
  113. datasize : longint;
  114. dataalignment : longint;
  115. symindex,
  116. defindex : pindexarray;
  117. symsearch : pdictionary;
  118. next : psymtable;
  119. defowner : pdef; { for records and objects }
  120. { alignment used in this symtable }
  121. alignment : longint;
  122. { only used for parameter symtable to determine the offset relative }
  123. { to the frame pointer and for local inline }
  124. address_fixup : longint;
  125. { this saves all definition to allow a proper clean up }
  126. { separate lexlevel from symtable type }
  127. symtablelevel : byte;
  128. constructor init(t : tsymtabletype);
  129. destructor done;virtual;
  130. { access }
  131. function getdefnr(l : longint) : pdef;
  132. function getsymnr(l : longint) : psym;
  133. { load/write }
  134. constructor load;
  135. procedure write;
  136. constructor loadas(typ : tsymtabletype);
  137. procedure writeas;
  138. procedure loaddefs;
  139. procedure loadsyms;
  140. procedure writedefs;
  141. procedure writesyms;
  142. procedure deref;
  143. procedure clear;
  144. function rename(const olds,news : stringid):psym;
  145. procedure foreach(proc2call : tnamedindexcallback);
  146. function insert(sym : psym):psym;
  147. function search(const s : stringid) : psym;
  148. function speedsearch(const s : stringid;speedvalue : longint) : psym;
  149. procedure registerdef(p : pdef);
  150. procedure allsymbolsused;
  151. procedure allunitsused;
  152. procedure check_forwards;
  153. procedure checklabels;
  154. { change alignment for args only parasymtable }
  155. procedure set_alignment(_alignment : byte);
  156. { find arg having offset only parasymtable }
  157. function find_at_offset(l : longint) : pvarsym;
  158. {$ifdef CHAINPROCSYMS}
  159. procedure chainprocsyms;
  160. {$endif CHAINPROCSYMS}
  161. procedure load_browser;
  162. procedure write_browser;
  163. {$ifdef BrowserLog}
  164. procedure writebrowserlog;
  165. {$endif BrowserLog}
  166. {$ifdef GDB}
  167. procedure concatstabto(asmlist : paasmoutput);virtual;
  168. {$endif GDB}
  169. function getnewtypecount : word; virtual;
  170. end;
  171. tunitsymtable = object(tsymtable)
  172. unittypecount : word;
  173. unitsym : punitsym;
  174. {$ifdef GDB}
  175. dbx_count : longint;
  176. prev_dbx_counter : plongint;
  177. dbx_count_ok : boolean;
  178. is_stab_written : boolean;
  179. {$endif GDB}
  180. constructor init(t : tsymtabletype;const n : string);
  181. constructor loadasunit;
  182. destructor done;virtual;
  183. procedure writeasunit;
  184. {$ifdef GDB}
  185. procedure concattypestabto(asmlist : paasmoutput);
  186. {$endif GDB}
  187. procedure load_symtable_refs;
  188. function getnewtypecount : word; virtual;
  189. end;
  190. pwithsymtable = ^twithsymtable;
  191. twithsymtable = object(tsymtable)
  192. { used for withsymtable for allowing constructors }
  193. direct_with : boolean;
  194. { in fact it is a ptree }
  195. withnode : pointer;
  196. { ptree to load of direct with var }
  197. { already usable before firstwith
  198. needed for firstpass of function parameters PM }
  199. withrefnode : pointer;
  200. constructor init;
  201. destructor done;virtual;
  202. end;
  203. {****************************************************************************
  204. Var / Consts
  205. ****************************************************************************}
  206. const
  207. systemunit : punitsymtable = nil; { pointer to the system unit }
  208. current_object_option : tsymoptions = [sp_public];
  209. var
  210. { for STAB debugging }
  211. globaltypecount : word;
  212. pglobaltypecount : pword;
  213. registerdef : boolean; { true, when defs should be registered }
  214. defaultsymtablestack, { symtablestack after default units
  215. have been loaded }
  216. symtablestack : psymtable; { linked list of symtables }
  217. srsym : psym; { result of the last search }
  218. srsymtable : psymtable;
  219. lastsrsym : psym; { last sym found in statement }
  220. lastsrsymtable : psymtable;
  221. lastsymknown : boolean;
  222. constsymtable : psymtable; { symtable were the constants can be
  223. inserted }
  224. voidpointerdef : ppointerdef; { pointer for Void-Pointerdef }
  225. charpointerdef : ppointerdef; { pointer for Char-Pointerdef }
  226. voidfarpointerdef : ppointerdef;
  227. cformaldef : pformaldef; { unique formal definition }
  228. voiddef : porddef; { Pointer to Void (procedure) }
  229. cchardef : porddef; { Pointer to Char }
  230. booldef : porddef; { pointer to boolean type }
  231. u8bitdef : porddef; { Pointer to 8-Bit unsigned }
  232. u16bitdef : porddef; { Pointer to 16-Bit unsigned }
  233. u32bitdef : porddef; { Pointer to 32-Bit unsigned }
  234. s32bitdef : porddef; { Pointer to 32-Bit signed }
  235. cu64bitdef : porddef; { pointer to 64 bit unsigned def }
  236. cs64bitdef : porddef; { pointer to 64 bit signed def, }
  237. { calculated by the int unit on i386 }
  238. s32floatdef : pfloatdef; { pointer for realconstn }
  239. s64floatdef : pfloatdef; { pointer for realconstn }
  240. s80floatdef : pfloatdef; { pointer to type of temp. floats }
  241. s32fixeddef : pfloatdef; { pointer to type of temp. fixed }
  242. cshortstringdef : pstringdef; { pointer to type of short string const }
  243. clongstringdef : pstringdef; { pointer to type of long string const }
  244. cansistringdef : pstringdef; { pointer to type of ansi string const }
  245. cwidestringdef : pstringdef; { pointer to type of wide string const }
  246. openshortstringdef : pstringdef; { pointer to type of an open shortstring,
  247. needed for readln() }
  248. openchararraydef : parraydef; { pointer to type of an open array of char,
  249. needed for readln() }
  250. cfiledef : pfiledef; { get the same definition for all file }
  251. { uses for stabs }
  252. firstglobaldef, { linked list of all globals defs }
  253. lastglobaldef : pdef; { used to reset stabs/ranges }
  254. class_tobject : pobjectdef; { pointer to the anchestor of all }
  255. { clases }
  256. pvmtdef : ppointerdef; { type of classrefs }
  257. aktprocsym : pprocsym; { pointer to the symbol for the
  258. currently be parsed procedure }
  259. aktcallprocsym : pprocsym; { pointer to the symbol for the
  260. currently be called procedure,
  261. only set/unset in firstcall }
  262. aktvarsym : pvarsym; { pointer to the symbol for the
  263. currently read var, only used
  264. for variable directives }
  265. procprefix : string; { eindeutige Namen bei geschachtel- }
  266. { ten Unterprogrammen erzeugen }
  267. lexlevel : longint; { level of code }
  268. { 1 for main procedure }
  269. { 2 for normal function or proc }
  270. { higher for locals }
  271. const
  272. main_program_level = 1;
  273. unit_init_level = 1;
  274. normal_function_level = 2;
  275. in_loading : boolean = false;
  276. {$ifdef i386}
  277. bestrealdef : ^pfloatdef = @s80floatdef;
  278. {$endif}
  279. {$ifdef m68k}
  280. bestrealdef : ^pfloatdef = @s64floatdef;
  281. {$endif}
  282. {$ifdef alpha}
  283. bestrealdef : ^pfloatdef = @s64floatdef;
  284. {$endif}
  285. {$ifdef powerpc}
  286. bestrealdef : ^pfloatdef = @s64floatdef;
  287. {$endif}
  288. var
  289. macros : psymtable; { pointer for die Symboltabelle mit }
  290. { Makros }
  291. read_member : boolean; { true, wenn Members aus einer PPU- }
  292. { Datei gelesen werden, d.h. ein }
  293. { varsym seine Adresse einlesen soll }
  294. generrorsym : psym; { Jokersymbol, wenn das richtige }
  295. { Symbol nicht gefunden wird }
  296. generrordef : pdef; { Jokersymbol for eine fehlerhafte }
  297. { Typdefinition }
  298. aktobjectdef : pobjectdef; { used for private functions check !! }
  299. const
  300. { last operator which can be overloaded }
  301. first_overloaded = _PLUS;
  302. last_overloaded = _ASSIGNMENT;
  303. var
  304. overloaded_operators : array[first_overloaded..last_overloaded] of pprocsym;
  305. { unequal is not equal}
  306. const
  307. overloaded_names : array [first_overloaded..last_overloaded] of string[16] =
  308. ('plus','minus','star','slash','equal',
  309. 'greater','lower','greater_or_equal',
  310. 'lower_or_equal','as','is','in','sym_diff',
  311. 'starstar','assign');
  312. {$ifdef UNITALIASES}
  313. type
  314. punit_alias = ^tunit_alias;
  315. tunit_alias = object(tnamedindexobject)
  316. newname : pstring;
  317. constructor init(const n:string);
  318. destructor done;virtual;
  319. end;
  320. var
  321. unitaliases : pdictionary;
  322. procedure addunitalias(const n:string);
  323. function getunitalias(const n:string):string;
  324. {$endif UNITALIASES}
  325. {****************************************************************************
  326. Functions
  327. ****************************************************************************}
  328. {*** Misc ***}
  329. function globaldef(const s : string) : pdef;
  330. function findunitsymtable(st:psymtable):psymtable;
  331. procedure duplicatesym(sym:psym);
  332. {*** Search ***}
  333. function search_a_symtable(const symbol:string;symtabletype:tsymtabletype):Psym;
  334. procedure getsym(const s : stringid;notfounderror : boolean);
  335. procedure getsymonlyin(p : psymtable;const s : stringid);
  336. {*** PPU Write/Loading ***}
  337. procedure writeunitas(const s : string;unittable : punitsymtable;only_crc : boolean);
  338. procedure closecurrentppu;
  339. procedure numberunits;
  340. procedure load_interface;
  341. {*** GDB ***}
  342. {$ifdef GDB}
  343. function typeglobalnumber(const s : string) : string;
  344. {$endif}
  345. {*** Definition ***}
  346. procedure reset_global_defs;
  347. {*** Object Helpers ***}
  348. function search_class_member(pd : pobjectdef;const n : string) : psym;
  349. function search_default_property(pd : pobjectdef) : ppropertysym;
  350. {*** Macro ***}
  351. procedure def_macro(const s : string);
  352. procedure set_macro(const s : string;value : string);
  353. {*** symtable stack ***}
  354. procedure dellexlevel;
  355. {$ifdef DEBUG}
  356. procedure test_symtablestack;
  357. procedure list_symtablestack;
  358. {$endif DEBUG}
  359. {*** Init / Done ***}
  360. procedure InitSymtable;
  361. procedure DoneSymtable;
  362. implementation
  363. uses
  364. version,
  365. types,ppu,
  366. gendef,files
  367. ,tree
  368. ,cresstr
  369. {$ifdef newcg}
  370. ,cgbase
  371. {$else}
  372. ,hcodegen
  373. {$endif}
  374. {$ifdef BrowserLog}
  375. ,browlog
  376. {$endif BrowserLog}
  377. ;
  378. var
  379. aktrecordsymtable : psymtable; { current record read from ppu symtable }
  380. aktstaticsymtable : psymtable; { current static for local ppu symtable }
  381. aktlocalsymtable : psymtable; { current proc local for local ppu symtable }
  382. {$ifdef GDB}
  383. asmoutput : paasmoutput;
  384. {$endif GDB}
  385. {$ifdef TP}
  386. {$ifndef Delphi}
  387. {$ifndef dpmi}
  388. symbolstream : temsstream; { stream which is used to store some info }
  389. {$else}
  390. symbolstream : tmemorystream;
  391. {$endif}
  392. {$endif Delphi}
  393. {$endif}
  394. {to dispose the global symtable of a unit }
  395. const
  396. dispose_global : boolean = false;
  397. memsizeinc = 2048; { for long stabstrings }
  398. tagtypes : Set of tdeftype =
  399. [recorddef,enumdef,
  400. {$IfNDef GDBKnowsStrings}
  401. stringdef,
  402. {$EndIf not GDBKnowsStrings}
  403. {$IfNDef GDBKnowsFiles}
  404. filedef,
  405. {$EndIf not GDBKnowsFiles}
  406. objectdef];
  407. {*****************************************************************************
  408. Helper Routines
  409. *****************************************************************************}
  410. {$ifdef unused}
  411. function demangledparas(s : string) : string;
  412. var
  413. r : string;
  414. l : longint;
  415. begin
  416. demangledparas:='';
  417. r:=',';
  418. { delete leading $$'s }
  419. l:=pos('$$',s);
  420. while l<>0 do
  421. begin
  422. delete(s,1,l+1);
  423. l:=pos('$$',s);
  424. end;
  425. { delete leading _$'s }
  426. l:=pos('_$',s);
  427. while l<>0 do
  428. begin
  429. delete(s,1,l+1);
  430. l:=pos('_$',s);
  431. end;
  432. l:=pos('$',s);
  433. if l=0 then
  434. exit;
  435. delete(s,1,l);
  436. while s<>'' do
  437. begin
  438. l:=pos('$',s);
  439. if l=0 then
  440. l:=length(s)+1;
  441. r:=r+copy(s,1,l-1)+',';
  442. delete(s,1,l);
  443. end;
  444. delete(r,1,1);
  445. delete(r,length(r),1);
  446. demangledparas:=r;
  447. end;
  448. {$endif}
  449. procedure numberunits;
  450. var
  451. counter : longint;
  452. hp : pused_unit;
  453. hp1 : pmodule;
  454. begin
  455. { Reset all numbers to -1 }
  456. hp1:=pmodule(loaded_units.first);
  457. while assigned(hp1) do
  458. begin
  459. if assigned(hp1^.globalsymtable) then
  460. psymtable(hp1^.globalsymtable)^.unitid:=$ffff;
  461. hp1:=pmodule(hp1^.next);
  462. end;
  463. { Our own symtable gets unitid 0, for a program there is
  464. no globalsymtable }
  465. if assigned(current_module^.globalsymtable) then
  466. psymtable(current_module^.globalsymtable)^.unitid:=0;
  467. { number units }
  468. counter:=1;
  469. hp:=pused_unit(current_module^.used_units.first);
  470. while assigned(hp) do
  471. begin
  472. psymtable(hp^.u^.globalsymtable)^.unitid:=counter;
  473. inc(counter);
  474. hp:=pused_unit(hp^.next);
  475. end;
  476. end;
  477. function findunitsymtable(st:psymtable):psymtable;
  478. begin
  479. findunitsymtable:=nil;
  480. repeat
  481. if not assigned(st) then
  482. internalerror(5566561);
  483. case st^.symtabletype of
  484. localsymtable,
  485. parasymtable,
  486. staticsymtable :
  487. break;
  488. globalsymtable,
  489. unitsymtable :
  490. begin
  491. findunitsymtable:=st;
  492. break;
  493. end;
  494. objectsymtable,
  495. recordsymtable :
  496. st:=st^.defowner^.owner;
  497. else
  498. internalerror(5566562);
  499. end;
  500. until false;
  501. end;
  502. procedure setstring(var p : pchar;const s : string);
  503. begin
  504. {$ifndef Delphi}
  505. {$ifdef TP}
  506. if use_big then
  507. begin
  508. p:=pchar(symbolstream.getsize);
  509. symbolstream.seek(longint(p));
  510. symbolstream.writestr(@s);
  511. end
  512. else
  513. {$endif TP}
  514. {$endif Delphi}
  515. p:=strpnew(s);
  516. end;
  517. procedure duplicatesym(sym:psym);
  518. var
  519. st : psymtable;
  520. begin
  521. Message1(sym_e_duplicate_id,sym^.name);
  522. st:=findunitsymtable(sym^.owner);
  523. if assigned(st) then
  524. begin
  525. with sym^.fileinfo do
  526. begin
  527. if st^.unitid=0 then
  528. Message2(sym_h_duplicate_id_where,current_module^.sourcefiles^.get_file_name(fileindex),tostr(line))
  529. else
  530. Message2(sym_h_duplicate_id_where,'unit '+st^.name^,tostr(line));
  531. end;
  532. end;
  533. end;
  534. {****************************************************************************
  535. TRef
  536. ****************************************************************************}
  537. constructor tref.init(ref :pref;pos : pfileposinfo);
  538. begin
  539. nextref:=nil;
  540. if pos<>nil then
  541. posinfo:=pos^;
  542. if assigned(current_module) then
  543. moduleindex:=current_module^.unit_index;
  544. if assigned(ref) then
  545. ref^.nextref:=@self;
  546. is_written:=false;
  547. end;
  548. destructor tref.done;
  549. var
  550. inputfile : pinputfile;
  551. begin
  552. inputfile:=get_source_file(moduleindex,posinfo.fileindex);
  553. if inputfile<>nil then
  554. dec(inputfile^.ref_count);
  555. if assigned(nextref) then
  556. dispose(nextref,done);
  557. nextref:=nil;
  558. end;
  559. {****************************************************************************
  560. TDeref
  561. ****************************************************************************}
  562. constructor tderef.init(typ:tdereftype;i:word);
  563. begin
  564. dereftype:=typ;
  565. index:=i;
  566. next:=nil;
  567. end;
  568. destructor tderef.done;
  569. begin
  570. end;
  571. {*****************************************************************************
  572. PPU Reading Writing
  573. *****************************************************************************}
  574. {$I symppu.inc}
  575. {*****************************************************************************
  576. Definition Helpers
  577. *****************************************************************************}
  578. function globaldef(const s : string) : pdef;
  579. var st : string;
  580. symt : psymtable;
  581. begin
  582. srsym := nil;
  583. if pos('.',s) > 0 then
  584. begin
  585. st := copy(s,1,pos('.',s)-1);
  586. getsym(st,false);
  587. st := copy(s,pos('.',s)+1,255);
  588. if assigned(srsym) then
  589. begin
  590. if srsym^.typ = unitsym then
  591. begin
  592. symt := punitsym(srsym)^.unitsymtable;
  593. srsym := symt^.search(st);
  594. end else srsym := nil;
  595. end;
  596. end else st := s;
  597. if srsym = nil then getsym(st,false);
  598. if srsym = nil then
  599. getsymonlyin(systemunit,st);
  600. if srsym^.typ<>typesym then
  601. begin
  602. Message(type_e_type_id_expected);
  603. exit;
  604. end;
  605. globaldef := ptypesym(srsym)^.definition;
  606. end;
  607. {*****************************************************************************
  608. Symbol / Definition Resolving
  609. *****************************************************************************}
  610. procedure resolvederef(var p:pderef;var st:psymtable;var idx:word);
  611. var
  612. hp : pderef;
  613. pd : pdef;
  614. begin
  615. st:=nil;
  616. idx:=0;
  617. while assigned(p) do
  618. begin
  619. case p^.dereftype of
  620. derefaktrecordindex :
  621. begin
  622. st:=aktrecordsymtable;
  623. idx:=p^.index;
  624. end;
  625. derefaktstaticindex :
  626. begin
  627. st:=aktstaticsymtable;
  628. idx:=p^.index;
  629. end;
  630. derefaktlocal :
  631. begin
  632. st:=aktlocalsymtable;
  633. idx:=p^.index;
  634. end;
  635. derefunit :
  636. begin
  637. {$ifdef NEWMAP}
  638. st:=psymtable(current_module^.map^[p^.index]^.globalsymtable);
  639. {$else NEWMAP}
  640. st:=psymtable(current_module^.map^[p^.index]);
  641. {$endif NEWMAP}
  642. end;
  643. derefrecord :
  644. begin
  645. pd:=st^.getdefnr(p^.index);
  646. case pd^.deftype of
  647. recorddef :
  648. st:=precorddef(pd)^.symtable;
  649. objectdef :
  650. st:=pobjectdef(pd)^.symtable;
  651. else
  652. internalerror(556658);
  653. end;
  654. end;
  655. dereflocal :
  656. begin
  657. pd:=st^.getdefnr(p^.index);
  658. case pd^.deftype of
  659. procdef :
  660. st:=pprocdef(pd)^.localst;
  661. else
  662. internalerror(556658);
  663. end;
  664. end;
  665. derefpara :
  666. begin
  667. pd:=st^.getdefnr(p^.index);
  668. case pd^.deftype of
  669. procdef :
  670. st:=pprocdef(pd)^.parast;
  671. else
  672. internalerror(556658);
  673. end;
  674. end;
  675. derefindex :
  676. begin
  677. idx:=p^.index;
  678. end;
  679. else
  680. internalerror(556658);
  681. end;
  682. hp:=p;
  683. p:=p^.next;
  684. dispose(hp,done);
  685. end;
  686. end;
  687. procedure resolvedef(var def:pdef);
  688. var
  689. st : psymtable;
  690. idx : word;
  691. begin
  692. resolvederef(pderef(def),st,idx);
  693. if assigned(st) then
  694. def:=st^.getdefnr(idx)
  695. else
  696. def:=nil;
  697. end;
  698. procedure resolvesym(var sym:psym);
  699. var
  700. st : psymtable;
  701. idx : word;
  702. begin
  703. resolvederef(pderef(sym),st,idx);
  704. if assigned(st) then
  705. sym:=st^.getsymnr(idx)
  706. else
  707. sym:=nil;
  708. end;
  709. {*****************************************************************************
  710. Symbol Call Back Functions
  711. *****************************************************************************}
  712. procedure derefsym(p : pnamedindexobject);
  713. begin
  714. psym(p)^.deref;
  715. end;
  716. procedure derefsymsdelayed(p : pnamedindexobject);
  717. begin
  718. if psym(p)^.typ in [absolutesym,propertysym] then
  719. psym(p)^.deref;
  720. end;
  721. procedure check_forward(sym : pnamedindexobject);
  722. begin
  723. if psym(sym)^.typ=procsym then
  724. pprocsym(sym)^.check_forward
  725. { check also object method table }
  726. { we needn't to test the def list }
  727. { because each object has to have a type sym }
  728. else
  729. if (psym(sym)^.typ=typesym) and
  730. assigned(ptypesym(sym)^.definition) and
  731. (ptypesym(sym)^.definition^.deftype=objectdef) then
  732. pobjectdef(ptypesym(sym)^.definition)^.check_forwards;
  733. end;
  734. procedure labeldefined(p : pnamedindexobject);
  735. begin
  736. if (psym(p)^.typ=labelsym) and
  737. not(plabelsym(p)^.defined) then
  738. Message1(sym_w_label_not_defined,p^.name);
  739. end;
  740. procedure unitsymbolused(p : pnamedindexobject);
  741. begin
  742. if (psym(p)^.typ=unitsym) and
  743. (punitsym(p)^.refs=0) then
  744. comment(V_info,'Unit '+p^.name+' is not used');
  745. end;
  746. procedure varsymbolused(p : pnamedindexobject);
  747. begin
  748. if (psym(p)^.typ=varsym) and
  749. ((psym(p)^.owner^.symtabletype in [parasymtable,localsymtable,staticsymtable])) then
  750. { unused symbol should be reported only if no }
  751. { error is reported }
  752. { if the symbol is in a register it is used }
  753. { also don't count the value parameters which have local copies }
  754. { also don't claim for high param of open parameters (PM) }
  755. if (pvarsym(p)^.refs=0) and
  756. (Errorcount=0) and
  757. (copy(p^.name,1,3)<>'val') and
  758. (copy(p^.name,1,4)<>'high') then
  759. begin
  760. if (psym(p)^.owner^.symtabletype=parasymtable) or pvarsym(p)^.islocalcopy then
  761. MessagePos1(psym(p)^.fileinfo,sym_h_para_identifier_not_used,p^.name)
  762. else
  763. MessagePos1(psym(p)^.fileinfo,sym_n_local_identifier_not_used,p^.name);
  764. end;
  765. end;
  766. {$ifdef GDB}
  767. procedure concatstab(p : pnamedindexobject);
  768. begin
  769. if psym(p)^.typ <> procsym then
  770. psym(p)^.concatstabto(asmoutput);
  771. end;
  772. procedure concattypestab(p : pnamedindexobject);
  773. begin
  774. if psym(p)^.typ = typesym then
  775. begin
  776. psym(p)^.isstabwritten:=false;
  777. psym(p)^.concatstabto(asmoutput);
  778. end;
  779. end;
  780. procedure forcestabto(asmlist : paasmoutput; pd : pdef);
  781. begin
  782. if not pd^.is_def_stab_written then
  783. begin
  784. if assigned(pd^.sym) then
  785. pd^.sym^.isusedinstab := true;
  786. pd^.concatstabto(asmlist);
  787. end;
  788. end;
  789. {$endif}
  790. {$ifdef CHAINPROCSYMS}
  791. procedure chainprocsym(p : psym);
  792. var
  793. storesymtablestack : psymtable;
  794. begin
  795. if p^.typ=procsym then
  796. begin
  797. storesymtablestack:=symtablestack;
  798. symtablestack:=p^.owner^.next;
  799. while assigned(symtablestack) do
  800. begin
  801. { search for same procsym in other units }
  802. getsym(p^.name,false);
  803. if assigned(srsym) and (srsym^.typ=procsym) then
  804. begin
  805. pprocsym(p)^.nextprocsym:=pprocsym(srsym);
  806. symtablestack:=storesymtablestack;
  807. exit;
  808. end
  809. else if srsym=nil then
  810. symtablestack:=nil
  811. else
  812. symtablestack:=srsymtable^.next;
  813. end;
  814. symtablestack:=storesymtablestack;
  815. end;
  816. end;
  817. {$endif}
  818. procedure write_refs(sym : pnamedindexobject);
  819. begin
  820. psym(sym)^.write_references;
  821. end;
  822. {$ifdef BrowserLog}
  823. procedure add_to_browserlog(sym : pnamedindexobject);
  824. begin
  825. psym(sym)^.add_to_browserlog;
  826. end;
  827. {$endif UseBrowser}
  828. {*****************************************************************************
  829. Search Symtables for Syms
  830. *****************************************************************************}
  831. procedure getsym(const s : stringid;notfounderror : boolean);
  832. var
  833. speedvalue : longint;
  834. begin
  835. speedvalue:=getspeedvalue(s);
  836. lastsrsym:=nil;
  837. srsymtable:=symtablestack;
  838. while assigned(srsymtable) do
  839. begin
  840. srsym:=srsymtable^.speedsearch(s,speedvalue);
  841. if assigned(srsym) then
  842. exit
  843. else
  844. srsymtable:=srsymtable^.next;
  845. end;
  846. if notfounderror then
  847. begin
  848. Message1(sym_e_id_not_found,s);
  849. srsym:=generrorsym;
  850. end
  851. else
  852. srsym:=nil;
  853. end;
  854. procedure getsymonlyin(p : psymtable;const s : stringid);
  855. begin
  856. { the caller have to take care if srsym=nil (FK) }
  857. srsym:=nil;
  858. if assigned(p) then
  859. begin
  860. srsymtable:=p;
  861. srsym:=srsymtable^.search(s);
  862. if assigned(srsym) then
  863. exit
  864. else
  865. begin
  866. if (punitsymtable(srsymtable)=punitsymtable(current_module^.globalsymtable)) then
  867. begin
  868. getsymonlyin(psymtable(current_module^.localsymtable),s);
  869. if assigned(srsym) then
  870. srsymtable:=psymtable(current_module^.localsymtable)
  871. else
  872. Message1(sym_e_id_not_found,s);
  873. end
  874. else
  875. Message1(sym_e_id_not_found,s);
  876. end;
  877. end;
  878. end;
  879. function search_a_symtable(const symbol:string;symtabletype:tsymtabletype):Psym;
  880. {Search for a symbol in a specified symbol table. Returns nil if
  881. the symtable is not found, and also if the symbol cannot be found
  882. in the desired symtable }
  883. var hsymtab:Psymtable;
  884. res:Psym;
  885. begin
  886. res:=nil;
  887. hsymtab:=symtablestack;
  888. while (hsymtab<>nil) and (hsymtab^.symtabletype<>symtabletype) do
  889. hsymtab:=hsymtab^.next;
  890. if hsymtab<>nil then
  891. {We found the desired symtable. Now check if the symbol we
  892. search for is defined in it }
  893. res:=hsymtab^.search(symbol);
  894. search_a_symtable:=res;
  895. end;
  896. {****************************************************************************
  897. TSYMTABLE
  898. ****************************************************************************}
  899. constructor tsymtable.init(t : tsymtabletype);
  900. begin
  901. symtabletype:=t;
  902. symtablelevel:=0;
  903. defowner:=nil;
  904. unitid:=0;
  905. next:=nil;
  906. name:=nil;
  907. address_fixup:=0;
  908. datasize:=0;
  909. dataalignment:=1;
  910. new(symindex,init(indexgrowsize));
  911. new(defindex,init(indexgrowsize));
  912. if symtabletype<>withsymtable then
  913. begin
  914. new(symsearch,init);
  915. symsearch^.noclear:=true;
  916. end
  917. else
  918. symsearch:=nil;
  919. alignment:=def_alignment;
  920. end;
  921. destructor tsymtable.done;
  922. begin
  923. stringdispose(name);
  924. dispose(symindex,done);
  925. dispose(defindex,done);
  926. { symsearch can already be disposed or set to nil for withsymtable }
  927. if assigned(symsearch) then
  928. begin
  929. dispose(symsearch,done);
  930. symsearch:=nil;
  931. end;
  932. end;
  933. constructor twithsymtable.init;
  934. begin
  935. inherited init(withsymtable);
  936. direct_with:=false;
  937. withnode:=nil;
  938. withrefnode:=nil;
  939. end;
  940. destructor twithsymtable.done;
  941. begin
  942. symsearch:=nil;
  943. inherited done;
  944. end;
  945. {***********************************************
  946. Helpers
  947. ***********************************************}
  948. function tsymtable.getnewtypecount : word;
  949. begin
  950. getnewtypecount:=pglobaltypecount^;
  951. inc(pglobaltypecount^);
  952. end;
  953. procedure tsymtable.registerdef(p : pdef);
  954. begin
  955. defindex^.insert(p);
  956. { set def owner and indexnb }
  957. p^.owner:=@self;
  958. end;
  959. procedure tsymtable.foreach(proc2call : tnamedindexcallback);
  960. begin
  961. symindex^.foreach(proc2call);
  962. end;
  963. {***********************************************
  964. LOAD / WRITE SYMTABLE FROM PPU
  965. ***********************************************}
  966. procedure tsymtable.loaddefs;
  967. var
  968. hp : pdef;
  969. b : byte;
  970. begin
  971. { load start of definition section, which holds the amount of defs }
  972. if current_ppu^.readentry<>ibstartdefs then
  973. Message(unit_f_ppu_read_error);
  974. current_ppu^.getlongint;
  975. { read definitions }
  976. repeat
  977. b:=current_ppu^.readentry;
  978. case b of
  979. ibpointerdef : hp:=new(ppointerdef,load);
  980. ibarraydef : hp:=new(parraydef,load);
  981. iborddef : hp:=new(porddef,load);
  982. ibfloatdef : hp:=new(pfloatdef,load);
  983. ibprocdef : hp:=new(pprocdef,load);
  984. ibshortstringdef : hp:=new(pstringdef,shortload);
  985. iblongstringdef : hp:=new(pstringdef,longload);
  986. ibansistringdef : hp:=new(pstringdef,ansiload);
  987. ibwidestringdef : hp:=new(pstringdef,wideload);
  988. ibrecorddef : hp:=new(precorddef,load);
  989. ibobjectdef : hp:=new(pobjectdef,load);
  990. ibenumdef : hp:=new(penumdef,load);
  991. ibsetdef : hp:=new(psetdef,load);
  992. ibprocvardef : hp:=new(pprocvardef,load);
  993. ibfiledef : hp:=new(pfiledef,load);
  994. ibclassrefdef : hp:=new(pclassrefdef,load);
  995. ibformaldef : hp:=new(pformaldef,load);
  996. ibenddefs : break;
  997. ibend : Message(unit_f_ppu_read_error);
  998. else
  999. Message1(unit_f_ppu_invalid_entry,tostr(b));
  1000. end;
  1001. hp^.owner:=@self;
  1002. defindex^.insert(hp);
  1003. until false;
  1004. end;
  1005. procedure tsymtable.loadsyms;
  1006. var
  1007. b : byte;
  1008. sym : psym;
  1009. begin
  1010. { load start of definition section, which holds the amount of defs }
  1011. if current_ppu^.readentry<>ibstartsyms then
  1012. Message(unit_f_ppu_read_error);
  1013. { skip amount of symbols, not used currently }
  1014. current_ppu^.getlongint;
  1015. { load datasize,dataalignment of this symboltable }
  1016. datasize:=current_ppu^.getlongint;
  1017. dataalignment:=current_ppu^.getlongint;
  1018. { now read the symbols }
  1019. repeat
  1020. b:=current_ppu^.readentry;
  1021. case b of
  1022. ibtypesym : sym:=new(ptypesym,load);
  1023. ibprocsym : sym:=new(pprocsym,load);
  1024. ibconstsym : sym:=new(pconstsym,load);
  1025. ibvarsym : sym:=new(pvarsym,load);
  1026. ibfuncretsym : sym:=new(pfuncretsym,load);
  1027. ibabsolutesym : sym:=new(pabsolutesym,load);
  1028. ibenumsym : sym:=new(penumsym,load);
  1029. ibtypedconstsym : sym:=new(ptypedconstsym,load);
  1030. ibpropertysym : sym:=new(ppropertysym,load);
  1031. ibunitsym : sym:=new(punitsym,load);
  1032. iblabelsym : sym:=new(plabelsym,load);
  1033. ibsyssym : sym:=new(psyssym,load);
  1034. ibendsyms : break;
  1035. ibend : Message(unit_f_ppu_read_error);
  1036. else
  1037. Message1(unit_f_ppu_invalid_entry,tostr(b));
  1038. end;
  1039. sym^.owner:=@self;
  1040. symindex^.insert(sym);
  1041. symsearch^.insert(sym);
  1042. until false;
  1043. end;
  1044. procedure tsymtable.writedefs;
  1045. var
  1046. pd : pdef;
  1047. begin
  1048. { each definition get a number, write then the amount of defs to the
  1049. ibstartdef entry }
  1050. current_ppu^.putlongint(defindex^.count);
  1051. current_ppu^.writeentry(ibstartdefs);
  1052. { now write the definition }
  1053. pd:=pdef(defindex^.first);
  1054. while assigned(pd) do
  1055. begin
  1056. pd^.write;
  1057. pd:=pdef(pd^.next);
  1058. end;
  1059. { write end of definitions }
  1060. current_ppu^.writeentry(ibenddefs);
  1061. end;
  1062. procedure tsymtable.writesyms;
  1063. var
  1064. pd : psym;
  1065. begin
  1066. { each definition get a number, write then the amount of syms and the
  1067. datasize to the ibsymdef entry }
  1068. current_ppu^.putlongint(symindex^.count);
  1069. current_ppu^.putlongint(datasize);
  1070. current_ppu^.putlongint(dataalignment);
  1071. current_ppu^.writeentry(ibstartsyms);
  1072. { foreach is used to write all symbols }
  1073. pd:=psym(symindex^.first);
  1074. while assigned(pd) do
  1075. begin
  1076. pd^.write;
  1077. pd:=psym(pd^.next);
  1078. end;
  1079. { end of symbols }
  1080. current_ppu^.writeentry(ibendsyms);
  1081. end;
  1082. procedure tsymtable.deref;
  1083. var
  1084. hp : pdef;
  1085. hs : psym;
  1086. begin
  1087. hp:=pdef(defindex^.first);
  1088. while assigned(hp) do
  1089. begin
  1090. hp^.deref;
  1091. hp^.symderef;
  1092. hp:=pdef(hp^.next);
  1093. end;
  1094. hs:=psym(symindex^.first);
  1095. while assigned(hs) do
  1096. begin
  1097. hs^.deref;
  1098. hs:=psym(hs^.next);
  1099. end;
  1100. end;
  1101. constructor tsymtable.load;
  1102. var
  1103. st_loading : boolean;
  1104. begin
  1105. st_loading:=in_loading;
  1106. in_loading:=true;
  1107. {$ifndef NEWMAP}
  1108. current_module^.map^[0]:=@self;
  1109. {$else NEWMAP}
  1110. current_module^.globalsymtable:=@self;
  1111. {$endif NEWMAP}
  1112. symtabletype:=unitsymtable;
  1113. symtablelevel:=0;
  1114. { unused for units }
  1115. address_fixup:=0;
  1116. datasize:=0;
  1117. defowner:=nil;
  1118. name:=nil;
  1119. unitid:=0;
  1120. defowner:=nil;
  1121. new(symindex,init(indexgrowsize));
  1122. new(defindex,init(indexgrowsize));
  1123. new(symsearch,init);
  1124. symsearch^.usehash;
  1125. symsearch^.noclear:=true;
  1126. alignment:=def_alignment;
  1127. { load definitions }
  1128. loaddefs;
  1129. { load symbols }
  1130. loadsyms;
  1131. { Now we can deref the symbols and definitions }
  1132. if not(symtabletype in [objectsymtable,recordsymtable]) then
  1133. deref;
  1134. {$ifdef NEWMAP}
  1135. { necessary for dependencies }
  1136. current_module^.globalsymtable:=nil;
  1137. {$endif NEWMAP}
  1138. in_loading:=st_loading;
  1139. end;
  1140. procedure tsymtable.write;
  1141. begin
  1142. { write definitions }
  1143. writedefs;
  1144. { write symbols }
  1145. writesyms;
  1146. end;
  1147. constructor tsymtable.loadas(typ : tsymtabletype);
  1148. var
  1149. storesymtable : psymtable;
  1150. st_loading : boolean;
  1151. begin
  1152. st_loading:=in_loading;
  1153. in_loading:=true;
  1154. symtabletype:=typ;
  1155. new(symindex,init(indexgrowsize));
  1156. new(defindex,init(indexgrowsize));
  1157. new(symsearch,init);
  1158. symsearch^.noclear:=true;
  1159. defowner:=nil;
  1160. if typ in [recordsymtable,objectsymtable] then
  1161. begin
  1162. storesymtable:=aktrecordsymtable;
  1163. aktrecordsymtable:=@self;
  1164. end;
  1165. if typ in [parasymtable,localsymtable] then
  1166. begin
  1167. storesymtable:=aktlocalsymtable;
  1168. aktlocalsymtable:=@self;
  1169. end;
  1170. { used for local browser }
  1171. if typ=staticppusymtable then
  1172. begin
  1173. aktstaticsymtable:=@self;
  1174. symsearch^.usehash;
  1175. end;
  1176. name:=nil;
  1177. alignment:=def_alignment;
  1178. { isn't used there }
  1179. datasize:=0;
  1180. address_fixup:= 0;
  1181. { also unused }
  1182. unitid:=0;
  1183. { load definitions }
  1184. { we need the correct symtable for registering }
  1185. if not (typ in [localsymtable,parasymtable,recordsymtable,objectsymtable]) then
  1186. begin
  1187. next:=symtablestack;
  1188. symtablestack:=@self;
  1189. end;
  1190. { load definitions }
  1191. loaddefs;
  1192. { load symbols }
  1193. loadsyms;
  1194. { now we can deref the syms and defs }
  1195. if not (typ in [localsymtable,parasymtable,
  1196. recordsymtable,objectsymtable]) then
  1197. deref;
  1198. if typ in [recordsymtable,objectsymtable] then
  1199. aktrecordsymtable:=storesymtable;
  1200. if typ in [localsymtable,parasymtable] then
  1201. aktlocalsymtable:=storesymtable;
  1202. if not (typ in [localsymtable,parasymtable,recordsymtable,objectsymtable]) then
  1203. begin
  1204. symtablestack:=next;
  1205. end;
  1206. in_loading:=st_loading;
  1207. end;
  1208. procedure tsymtable.writeas;
  1209. var
  1210. oldtyp : byte;
  1211. storesymtable : psymtable;
  1212. begin
  1213. oldtyp:=current_ppu^.entrytyp;
  1214. storesymtable:=aktrecordsymtable;
  1215. if symtabletype in [recordsymtable,objectsymtable] then
  1216. begin
  1217. storesymtable:=aktrecordsymtable;
  1218. aktrecordsymtable:=@self;
  1219. end;
  1220. if symtabletype in [parasymtable,localsymtable] then
  1221. begin
  1222. storesymtable:=aktlocalsymtable;
  1223. aktlocalsymtable:=@self;
  1224. end;
  1225. if (symtabletype in [recordsymtable,objectsymtable]) then
  1226. current_ppu^.entrytyp:=subentryid;
  1227. { write definitions }
  1228. writedefs;
  1229. { write symbols }
  1230. writesyms;
  1231. current_ppu^.entrytyp:=oldtyp;
  1232. if symtabletype in [recordsymtable,objectsymtable] then
  1233. aktrecordsymtable:=storesymtable;
  1234. if symtabletype in [localsymtable,parasymtable] then
  1235. aktlocalsymtable:=storesymtable;
  1236. end;
  1237. {***********************************************
  1238. Get Symbol / Def by Number
  1239. ***********************************************}
  1240. function tsymtable.getsymnr(l : longint) : psym;
  1241. var
  1242. hp : psym;
  1243. begin
  1244. hp:=psym(symindex^.search(l));
  1245. if hp=nil then
  1246. internalerror(10999);
  1247. getsymnr:=hp;
  1248. end;
  1249. function tsymtable.getdefnr(l : longint) : pdef;
  1250. var
  1251. hp : pdef;
  1252. begin
  1253. hp:=pdef(defindex^.search(l));
  1254. if hp=nil then
  1255. internalerror(10998);
  1256. getdefnr:=hp;
  1257. end;
  1258. {***********************************************
  1259. Table Access
  1260. ***********************************************}
  1261. procedure tsymtable.clear;
  1262. begin
  1263. { remove no entry from a withsymtable as it is only a pointer to the
  1264. recorddef or objectdef symtable }
  1265. if symtabletype=withsymtable then
  1266. exit;
  1267. symindex^.clear;
  1268. defindex^.clear;
  1269. end;
  1270. function tsymtable.insert(sym:psym):psym;
  1271. var
  1272. hp : psymtable;
  1273. hsym : psym;
  1274. begin
  1275. { set owner and sym indexnb }
  1276. sym^.owner:=@self;
  1277. {$ifdef CHAINPROCSYMS}
  1278. { set the nextprocsym field }
  1279. if sym^.typ=procsym then
  1280. chainprocsym(sym);
  1281. {$endif CHAINPROCSYMS}
  1282. { writes the symbol in data segment if required }
  1283. { also sets the datasize of owner }
  1284. if not in_loading then
  1285. sym^.insert_in_data;
  1286. if (symtabletype in [staticsymtable,globalsymtable]) then
  1287. begin
  1288. hp:=symtablestack;
  1289. while assigned(hp) do
  1290. begin
  1291. if hp^.symtabletype in [staticsymtable,globalsymtable] then
  1292. begin
  1293. hsym:=hp^.search(sym^.name);
  1294. if assigned(hsym) then
  1295. DuplicateSym(hsym);
  1296. end;
  1297. hp:=hp^.next;
  1298. end;
  1299. end;
  1300. { check for duplicate id in local and parsymtable symtable }
  1301. if (symtabletype=localsymtable) then
  1302. { to be on the sure side: }
  1303. begin
  1304. if assigned(next) and
  1305. (next^.symtabletype=parasymtable) then
  1306. begin
  1307. hsym:=next^.search(sym^.name);
  1308. if assigned(hsym) then
  1309. DuplicateSym(hsym);
  1310. end
  1311. else if (current_module^.flags and uf_local_browser)=0 then
  1312. internalerror(43789);
  1313. end;
  1314. { check for duplicate id in local symtable of methods }
  1315. if (symtabletype=localsymtable) and
  1316. assigned(next) and
  1317. assigned(next^.next) and
  1318. { funcretsym is allowed !! }
  1319. (sym^.typ <> funcretsym) and
  1320. (next^.next^.symtabletype=objectsymtable) then
  1321. begin
  1322. hsym:=search_class_member(pobjectdef(next^.next^.defowner),sym^.name);
  1323. { but private ids can be reused }
  1324. if assigned(hsym) and
  1325. (not(sp_private in hsym^.symoptions) or
  1326. (hsym^.owner^.defowner^.owner^.symtabletype<>unitsymtable)) then
  1327. DuplicateSym(hsym);
  1328. end;
  1329. { check for duplicate id in para symtable of methods }
  1330. if (symtabletype=parasymtable) and
  1331. assigned(procinfo^._class) and
  1332. { but not in nested procedures !}
  1333. (not(assigned(procinfo^.parent)) or
  1334. (assigned(procinfo^.parent) and
  1335. not(assigned(procinfo^.parent^._class)))
  1336. ) and
  1337. { funcretsym is allowed !! }
  1338. (sym^.typ <> funcretsym) then
  1339. begin
  1340. hsym:=search_class_member(procinfo^._class,sym^.name);
  1341. { but private ids can be reused }
  1342. if assigned(hsym) and
  1343. (not(sp_private in hsym^.symoptions) or
  1344. (hsym^.owner^.defowner^.owner^.symtabletype<>unitsymtable)) then
  1345. DuplicateSym(hsym);
  1346. end;
  1347. { check for duplicate field id in inherited classes }
  1348. if (sym^.typ=varsym) and
  1349. (symtabletype=objectsymtable) and
  1350. assigned(defowner) then
  1351. begin
  1352. hsym:=search_class_member(pobjectdef(defowner),sym^.name);
  1353. { but private ids can be reused }
  1354. if assigned(hsym) and
  1355. (not(sp_private in hsym^.symoptions) or
  1356. (hsym^.owner^.defowner^.owner^.symtabletype<>unitsymtable)) then
  1357. DuplicateSym(hsym);
  1358. end;
  1359. { register definition of typesym }
  1360. if (sym^.typ = typesym) and
  1361. assigned(ptypesym(sym)^.definition) then
  1362. begin
  1363. if not(assigned(ptypesym(sym)^.definition^.owner)) and
  1364. (ptypesym(sym)^.definition^.deftype<>errordef) then
  1365. registerdef(ptypesym(sym)^.definition);
  1366. {$ifdef GDB}
  1367. if (cs_debuginfo in aktmoduleswitches) and assigned(debuglist) and
  1368. (symtabletype in [globalsymtable,staticsymtable]) then
  1369. begin
  1370. ptypesym(sym)^.isusedinstab := true;
  1371. sym^.concatstabto(debuglist);
  1372. end;
  1373. {$endif GDB}
  1374. end;
  1375. { insert in index and search hash }
  1376. symindex^.insert(sym);
  1377. symsearch^.insert(sym);
  1378. insert:=sym;
  1379. end;
  1380. function tsymtable.search(const s : stringid) : psym;
  1381. begin
  1382. {search:=psym(symsearch^.search(s));
  1383. this bypasses the ref generation (PM) }
  1384. search:=speedsearch(s,getspeedvalue(s));
  1385. end;
  1386. function tsymtable.speedsearch(const s : stringid;speedvalue : longint) : psym;
  1387. var
  1388. hp : psym;
  1389. begin
  1390. hp:=psym(symsearch^.speedsearch(s,speedvalue));
  1391. if assigned(hp) then
  1392. begin
  1393. { reject non static members in static procedures,
  1394. be carefull aktprocsym^.definition is not allways
  1395. loaded already (PFV) }
  1396. if (symtabletype=objectsymtable) and
  1397. not(sp_static in hp^.symoptions) and
  1398. allow_only_static
  1399. {assigned(aktprocsym) and
  1400. assigned(aktprocsym^.definition) and
  1401. ((aktprocsym^.definition^.options and postaticmethod)<>0)} then
  1402. Message(sym_e_only_static_in_static);
  1403. if (symtabletype=unitsymtable) and
  1404. assigned(punitsymtable(@self)^.unitsym) then
  1405. inc(punitsymtable(@self)^.unitsym^.refs);
  1406. { unitsym are only loaded for browsing PM }
  1407. { this was buggy anyway because we could use }
  1408. { unitsyms from other units in _USES !! }
  1409. if (symtabletype=unitsymtable) and (hp^.typ=unitsym) and
  1410. assigned(current_module) and (current_module^.globalsymtable<>@self) then
  1411. hp:=nil;
  1412. if assigned(hp) and
  1413. (cs_browser in aktmoduleswitches) and make_ref then
  1414. begin
  1415. hp^.lastref:=new(pref,init(hp^.lastref,@tokenpos));
  1416. { for symbols that are in tables without
  1417. browser info or syssyms (PM) }
  1418. if hp^.refcount=0 then
  1419. hp^.defref:=hp^.lastref;
  1420. inc(hp^.refcount);
  1421. end;
  1422. end;
  1423. speedsearch:=hp;
  1424. end;
  1425. function tsymtable.rename(const olds,news : stringid):psym;
  1426. begin
  1427. rename:=psym(symsearch^.rename(olds,news));
  1428. end;
  1429. {***********************************************
  1430. Browser
  1431. ***********************************************}
  1432. procedure tsymtable.load_browser;
  1433. var
  1434. b : byte;
  1435. sym : psym;
  1436. prdef : pdef;
  1437. oldrecsyms : psymtable;
  1438. begin
  1439. if symtabletype in [recordsymtable,objectsymtable] then
  1440. begin
  1441. oldrecsyms:=aktrecordsymtable;
  1442. aktrecordsymtable:=@self;
  1443. end;
  1444. if symtabletype in [parasymtable,localsymtable] then
  1445. begin
  1446. oldrecsyms:=aktlocalsymtable;
  1447. aktlocalsymtable:=@self;
  1448. end;
  1449. if symtabletype=staticppusymtable then
  1450. aktstaticsymtable:=@self;
  1451. b:=current_ppu^.readentry;
  1452. if b <> ibbeginsymtablebrowser then
  1453. Message1(unit_f_ppu_invalid_entry,tostr(b));
  1454. repeat
  1455. b:=current_ppu^.readentry;
  1456. case b of
  1457. ibsymref : begin
  1458. sym:=readsymref;
  1459. resolvesym(sym);
  1460. if assigned(sym) then
  1461. sym^.load_references;
  1462. end;
  1463. ibdefref : begin
  1464. prdef:=readdefref;
  1465. resolvedef(prdef);
  1466. if assigned(prdef) then
  1467. begin
  1468. if prdef^.deftype<>procdef then
  1469. Message(unit_f_ppu_read_error);
  1470. pprocdef(prdef)^.load_references;
  1471. end;
  1472. end;
  1473. ibendsymtablebrowser : break;
  1474. else
  1475. Message1(unit_f_ppu_invalid_entry,tostr(b));
  1476. end;
  1477. until false;
  1478. if symtabletype in [recordsymtable,objectsymtable] then
  1479. aktrecordsymtable:=oldrecsyms;
  1480. if symtabletype in [parasymtable,localsymtable] then
  1481. aktlocalsymtable:=oldrecsyms;
  1482. end;
  1483. procedure tsymtable.write_browser;
  1484. var
  1485. oldrecsyms : psymtable;
  1486. begin
  1487. { symbol numbering for references
  1488. should have been done in write PM
  1489. number_symbols;
  1490. number_defs; }
  1491. if symtabletype in [recordsymtable,objectsymtable] then
  1492. begin
  1493. oldrecsyms:=aktrecordsymtable;
  1494. aktrecordsymtable:=@self;
  1495. end;
  1496. if symtabletype in [parasymtable,localsymtable] then
  1497. begin
  1498. oldrecsyms:=aktlocalsymtable;
  1499. aktlocalsymtable:=@self;
  1500. end;
  1501. current_ppu^.writeentry(ibbeginsymtablebrowser);
  1502. foreach({$ifndef TP}@{$endif}write_refs);
  1503. current_ppu^.writeentry(ibendsymtablebrowser);
  1504. if symtabletype in [recordsymtable,objectsymtable] then
  1505. aktrecordsymtable:=oldrecsyms;
  1506. if symtabletype in [parasymtable,localsymtable] then
  1507. aktlocalsymtable:=oldrecsyms;
  1508. end;
  1509. {$ifdef BrowserLog}
  1510. procedure tsymtable.writebrowserlog;
  1511. begin
  1512. if cs_browser in aktmoduleswitches then
  1513. begin
  1514. if assigned(name) then
  1515. Browserlog.AddLog('---Symtable '+name^)
  1516. else
  1517. begin
  1518. if (symtabletype=recordsymtable) and
  1519. assigned(defowner^.sym) then
  1520. Browserlog.AddLog('---Symtable '+defowner^.sym^.name)
  1521. else
  1522. Browserlog.AddLog('---Symtable with no name');
  1523. end;
  1524. Browserlog.Ident;
  1525. foreach({$ifndef TP}@{$endif}add_to_browserlog);
  1526. browserlog.Unident;
  1527. end;
  1528. end;
  1529. {$endif BrowserLog}
  1530. {***********************************************
  1531. Process all entries
  1532. ***********************************************}
  1533. { checks, if all procsyms and methods are defined }
  1534. procedure tsymtable.check_forwards;
  1535. begin
  1536. foreach({$ifndef TP}@{$endif}check_forward);
  1537. end;
  1538. procedure tsymtable.checklabels;
  1539. begin
  1540. foreach({$ifndef TP}@{$endif}labeldefined);
  1541. end;
  1542. procedure tsymtable.set_alignment(_alignment : byte);
  1543. var
  1544. sym : pvarsym;
  1545. l : longint;
  1546. begin
  1547. { this can not be done if there is an
  1548. hasharray ! }
  1549. alignment:=_alignment;
  1550. if (symtabletype<>parasymtable) then
  1551. internalerror(1111);
  1552. sym:=pvarsym(symindex^.first);
  1553. datasize:=0;
  1554. { there can be only varsyms }
  1555. while assigned(sym) do
  1556. begin
  1557. l:=sym^.getpushsize;
  1558. sym^.address:=datasize;
  1559. datasize:=align(datasize+l,alignment);
  1560. sym:=pvarsym(sym^.next);
  1561. end;
  1562. end;
  1563. function tsymtable.find_at_offset(l : longint) : pvarsym;
  1564. var
  1565. sym : pvarsym;
  1566. begin
  1567. find_at_offset:=nil;
  1568. { this can not be done if there is an
  1569. hasharray ! }
  1570. if (symtabletype<>parasymtable) then
  1571. internalerror(1111);
  1572. sym:=pvarsym(symindex^.first);
  1573. while assigned(sym) do
  1574. begin
  1575. if sym^.address+address_fixup=l then
  1576. begin
  1577. find_at_offset:=sym;
  1578. exit;
  1579. end;
  1580. sym:=pvarsym(sym^.next);
  1581. end;
  1582. end;
  1583. procedure tsymtable.allunitsused;
  1584. begin
  1585. foreach({$ifndef TP}@{$endif}unitsymbolused);
  1586. end;
  1587. procedure tsymtable.allsymbolsused;
  1588. begin
  1589. foreach({$ifndef TP}@{$endif}varsymbolused);
  1590. end;
  1591. {$ifdef CHAINPROCSYMS}
  1592. procedure tsymtable.chainprocsyms;
  1593. begin
  1594. foreach({$ifndef TP}@{$endif}chainprocsym);
  1595. end;
  1596. {$endif CHAINPROCSYMS}
  1597. {$ifdef GDB}
  1598. procedure tsymtable.concatstabto(asmlist : paasmoutput);
  1599. begin
  1600. asmoutput:=asmlist;
  1601. foreach({$ifndef TP}@{$endif}concatstab);
  1602. end;
  1603. {$endif}
  1604. {****************************************************************************
  1605. TUNITSYMTABLE
  1606. ****************************************************************************}
  1607. constructor tunitsymtable.init(t : tsymtabletype; const n : string);
  1608. begin
  1609. inherited init(t);
  1610. name:=stringdup(upper(n));
  1611. unitid:=0;
  1612. unitsym:=nil;
  1613. symsearch^.usehash;
  1614. { reset GDB things }
  1615. {$ifdef GDB}
  1616. if (t = globalsymtable) then
  1617. begin
  1618. prev_dbx_counter := dbx_counter;
  1619. dbx_counter := nil;
  1620. end;
  1621. is_stab_written:=false;
  1622. dbx_count := -1;
  1623. if cs_gdb_dbx in aktglobalswitches then
  1624. begin
  1625. dbx_count := 0;
  1626. unittypecount:=1;
  1627. if (symtabletype=globalsymtable) then
  1628. pglobaltypecount := @unittypecount;
  1629. unitid:=current_module^.unitcount;
  1630. debuglist^.concat(new(pai_asm_comment,init(strpnew('Global '+name^+' has index '+tostr(unitid)))));
  1631. debuglist^.concat(new(pai_stabs,init(strpnew('"'+name^+'",'+tostr(N_BINCL)+',0,0,0'))));
  1632. inc(current_module^.unitcount);
  1633. dbx_count_ok:=false;
  1634. dbx_counter:=@dbx_count;
  1635. do_count_dbx:=true;
  1636. end;
  1637. {$endif GDB}
  1638. end;
  1639. constructor tunitsymtable.loadasunit;
  1640. var
  1641. storeGlobalTypeCount : pword;
  1642. b : byte;
  1643. begin
  1644. unitsym:=nil;
  1645. unitid:=0;
  1646. {$ifdef GDB}
  1647. if cs_gdb_dbx in aktglobalswitches then
  1648. begin
  1649. UnitTypeCount:=1;
  1650. storeGlobalTypeCount:=PGlobalTypeCount;
  1651. PglobalTypeCount:=@UnitTypeCount;
  1652. end;
  1653. {$endif GDB}
  1654. { load symtables }
  1655. inherited load;
  1656. { set the name after because it is set to nil in tsymtable.load !! }
  1657. name:=stringdup(current_module^.modulename^);
  1658. { dbx count }
  1659. {$ifdef GDB}
  1660. if (current_module^.flags and uf_has_dbx)<>0 then
  1661. begin
  1662. b := current_ppu^.readentry;
  1663. if b <> ibdbxcount then
  1664. Message(unit_f_ppu_dbx_count_problem)
  1665. else
  1666. dbx_count := readlong;
  1667. dbx_count_ok := true;
  1668. end
  1669. else
  1670. begin
  1671. dbx_count := -1;
  1672. dbx_count_ok:=false;
  1673. end;
  1674. if cs_gdb_dbx in aktglobalswitches then
  1675. PGlobalTypeCount:=storeGlobalTypeCount;
  1676. is_stab_written:=false;
  1677. {$endif GDB}
  1678. b:=current_ppu^.readentry;
  1679. if b<>ibendimplementation then
  1680. Message1(unit_f_ppu_invalid_entry,tostr(b));
  1681. end;
  1682. destructor tunitsymtable.done;
  1683. var
  1684. pus : punitsym;
  1685. begin
  1686. pus:=unitsym;
  1687. while assigned(pus) do
  1688. begin
  1689. unitsym:=pus^.prevsym;
  1690. pus^.prevsym:=nil;
  1691. pus^.unitsymtable:=nil;
  1692. pus:=unitsym;
  1693. end;
  1694. inherited done;
  1695. end;
  1696. procedure tunitsymtable.load_symtable_refs;
  1697. var
  1698. b : byte;
  1699. unitindex : word;
  1700. begin
  1701. if ((current_module^.flags and uf_local_browser)<>0) then
  1702. begin
  1703. current_module^.localsymtable:=new(punitsymtable,loadas(staticppusymtable));
  1704. psymtable(current_module^.localsymtable)^.name:=
  1705. stringdup('implementation of '+psymtable(current_module^.globalsymtable)^.name^);
  1706. end;
  1707. { load browser }
  1708. if (current_module^.flags and uf_has_browser)<>0 then
  1709. begin
  1710. {if not (cs_browser in aktmoduleswitches) then
  1711. current_ppu^.skipuntilentry(ibendbrowser)
  1712. else }
  1713. begin
  1714. load_browser;
  1715. unitindex:=1;
  1716. while assigned(current_module^.map^[unitindex]) do
  1717. begin
  1718. {each unit wrote one browser entry }
  1719. load_browser;
  1720. inc(unitindex);
  1721. end;
  1722. b:=current_ppu^.readentry;
  1723. if b<>ibendbrowser then
  1724. Message1(unit_f_ppu_invalid_entry,tostr(b));
  1725. end;
  1726. end;
  1727. if ((current_module^.flags and uf_local_browser)<>0) then
  1728. psymtable(current_module^.localsymtable)^.load_browser;
  1729. end;
  1730. procedure tunitsymtable.writeasunit;
  1731. var
  1732. pu : pused_unit;
  1733. begin
  1734. { first the unitname }
  1735. current_ppu^.putstring(name^);
  1736. current_ppu^.writeentry(ibmodulename);
  1737. writesourcefiles;
  1738. writeusedmacros;
  1739. writeusedunit;
  1740. { write the objectfiles and libraries that come for this unit,
  1741. preserve the containers becuase they are still needed to load
  1742. the link.res. All doesn't depend on the crc! It doesn't matter
  1743. if a unit is in a .o or .a file }
  1744. current_ppu^.do_crc:=false;
  1745. writelinkcontainer(current_module^.linkunitofiles,iblinkunitofiles,true);
  1746. writelinkcontainer(current_module^.linkunitstaticlibs,iblinkunitstaticlibs,true);
  1747. writelinkcontainer(current_module^.linkunitsharedlibs,iblinkunitsharedlibs,true);
  1748. writelinkcontainer(current_module^.linkotherofiles,iblinkotherofiles,false);
  1749. writelinkcontainer(current_module^.linkotherstaticlibs,iblinkotherstaticlibs,true);
  1750. writelinkcontainer(current_module^.linkothersharedlibs,iblinkothersharedlibs,true);
  1751. current_ppu^.do_crc:=true;
  1752. current_ppu^.writeentry(ibendinterface);
  1753. { write the symtable entries }
  1754. inherited write;
  1755. { all after doesn't affect crc }
  1756. current_ppu^.do_crc:=false;
  1757. { write dbx count }
  1758. {$ifdef GDB}
  1759. if cs_gdb_dbx in aktglobalswitches then
  1760. begin
  1761. {$IfDef EXTDEBUG}
  1762. writeln('Writing dbx_count ',dbx_count,' in unit ',name^,'.ppu');
  1763. {$ENDIF EXTDEBUG}
  1764. current_ppu^.putlongint(dbx_count);
  1765. current_ppu^.writeentry(ibdbxcount);
  1766. end;
  1767. {$endif GDB}
  1768. current_ppu^.writeentry(ibendimplementation);
  1769. { write static symtable
  1770. needed for local debugging of unit functions }
  1771. if ((current_module^.flags and uf_local_browser)<>0) and
  1772. assigned(current_module^.localsymtable) then
  1773. psymtable(current_module^.localsymtable)^.write;
  1774. { write all browser section }
  1775. if (current_module^.flags and uf_has_browser)<>0 then
  1776. begin
  1777. write_browser;
  1778. pu:=pused_unit(current_module^.used_units.first);
  1779. while assigned(pu) do
  1780. begin
  1781. psymtable(pu^.u^.globalsymtable)^.write_browser;
  1782. pu:=pused_unit(pu^.next);
  1783. end;
  1784. current_ppu^.writeentry(ibendbrowser);
  1785. end;
  1786. if ((current_module^.flags and uf_local_browser)<>0) and
  1787. assigned(current_module^.localsymtable) then
  1788. psymtable(current_module^.localsymtable)^.write_browser;
  1789. { the last entry ibend is written automaticly }
  1790. end;
  1791. function tunitsymtable.getnewtypecount : word;
  1792. begin
  1793. {$ifdef GDB}
  1794. if not (cs_gdb_dbx in aktglobalswitches) then
  1795. getnewtypecount:=tsymtable.getnewtypecount
  1796. else
  1797. {$endif GDB}
  1798. if symtabletype = staticsymtable then
  1799. getnewtypecount:=tsymtable.getnewtypecount
  1800. else
  1801. begin
  1802. getnewtypecount:=unittypecount;
  1803. inc(unittypecount);
  1804. end;
  1805. end;
  1806. {$ifdef GDB}
  1807. procedure tunitsymtable.concattypestabto(asmlist : paasmoutput);
  1808. var prev_dbx_count : plongint;
  1809. begin
  1810. if is_stab_written then exit;
  1811. if not assigned(name) then name := stringdup('Main_program');
  1812. if (symtabletype = unitsymtable) and
  1813. (current_module^.globalsymtable<>@Self) then
  1814. begin
  1815. unitid:=current_module^.unitcount;
  1816. inc(current_module^.unitcount);
  1817. end;
  1818. asmlist^.concat(new(pai_asm_comment,init(strpnew('Begin unit '+name^
  1819. +' has index '+tostr(unitid)))));
  1820. if cs_gdb_dbx in aktglobalswitches then
  1821. begin
  1822. if dbx_count_ok then
  1823. begin
  1824. asmlist^.concat(new(pai_asm_comment,init(strpnew('"repeated" unit '+name^
  1825. +' has index '+tostr(unitid)+' dbx count = '+tostr(dbx_count)))));
  1826. asmlist^.concat(new(pai_stabs,init(strpnew('"'+name^+'",'
  1827. +tostr(N_EXCL)+',0,0,'+tostr(dbx_count)))));
  1828. exit;
  1829. end
  1830. else if (current_module^.globalsymtable<>@Self) then
  1831. begin
  1832. prev_dbx_count := dbx_counter;
  1833. dbx_counter := nil;
  1834. do_count_dbx:=false;
  1835. if symtabletype = unitsymtable then
  1836. asmlist^.concat(new(pai_stabs,init(strpnew('"'+name^+'",'
  1837. +tostr(N_BINCL)+',0,0,0'))));
  1838. dbx_counter := @dbx_count;
  1839. dbx_count:=0;
  1840. do_count_dbx:=assigned(dbx_counter);
  1841. end;
  1842. end;
  1843. asmoutput:=asmlist;
  1844. foreach({$ifndef TP}@{$endif}concattypestab);
  1845. if cs_gdb_dbx in aktglobalswitches then
  1846. begin
  1847. if (current_module^.globalsymtable<>@Self) then
  1848. begin
  1849. dbx_counter := prev_dbx_count;
  1850. do_count_dbx:=false;
  1851. asmlist^.concat(new(pai_asm_comment,init(strpnew('End unit '+name^
  1852. +' has index '+tostr(unitid)))));
  1853. asmlist^.concat(new(pai_stabs,init(strpnew('"'+name^+'",'
  1854. +tostr(N_EINCL)+',0,0,0'))));
  1855. do_count_dbx:=assigned(dbx_counter);
  1856. dbx_count_ok := true;
  1857. end;
  1858. end;
  1859. is_stab_written:=true;
  1860. end;
  1861. {$endif}
  1862. {****************************************************************************
  1863. Definitions
  1864. ****************************************************************************}
  1865. {$I symdef.inc}
  1866. {****************************************************************************
  1867. Symbols
  1868. ****************************************************************************}
  1869. {$I symsym.inc}
  1870. {****************************************************************************
  1871. GDB Helpers
  1872. ****************************************************************************}
  1873. {$ifdef GDB}
  1874. function typeglobalnumber(const s : string) : string;
  1875. var st : string;
  1876. symt : psymtable;
  1877. old_make_ref : boolean;
  1878. begin
  1879. old_make_ref:=make_ref;
  1880. make_ref:=false;
  1881. typeglobalnumber := '0';
  1882. srsym := nil;
  1883. if pos('.',s) > 0 then
  1884. begin
  1885. st := copy(s,1,pos('.',s)-1);
  1886. getsym(st,false);
  1887. st := copy(s,pos('.',s)+1,255);
  1888. if assigned(srsym) then
  1889. begin
  1890. if srsym^.typ = unitsym then
  1891. begin
  1892. symt := punitsym(srsym)^.unitsymtable;
  1893. srsym := symt^.search(st);
  1894. end else srsym := nil;
  1895. end;
  1896. end else st := s;
  1897. if srsym = nil then getsym(st,true);
  1898. if srsym^.typ<>typesym then
  1899. begin
  1900. Message(type_e_type_id_expected);
  1901. exit;
  1902. end;
  1903. typeglobalnumber := ptypesym(srsym)^.definition^.numberstring;
  1904. make_ref:=old_make_ref;
  1905. end;
  1906. {$endif GDB}
  1907. {****************************************************************************
  1908. Definition Helpers
  1909. ****************************************************************************}
  1910. procedure reset_global_defs;
  1911. var
  1912. def : pdef;
  1913. {$ifdef debug}
  1914. prevdef : pdef;
  1915. {$endif debug}
  1916. begin
  1917. {$ifdef debug}
  1918. prevdef:=nil;
  1919. {$endif debug}
  1920. {$ifdef GDB}
  1921. pglobaltypecount:=@globaltypecount;
  1922. {$endif GDB}
  1923. def:=firstglobaldef;
  1924. while assigned(def) do
  1925. begin
  1926. {$ifdef GDB}
  1927. if assigned(def^.sym) then
  1928. def^.sym^.isusedinstab:=false;
  1929. def^.is_def_stab_written:=false;
  1930. {$endif GDB}
  1931. {if not current_module^.in_implementation then}
  1932. begin
  1933. { reset rangenr's }
  1934. case def^.deftype of
  1935. orddef : porddef(def)^.rangenr:=0;
  1936. enumdef : penumdef(def)^.rangenr:=0;
  1937. arraydef : parraydef(def)^.rangenr:=0;
  1938. end;
  1939. if def^.deftype<>objectdef then
  1940. def^.has_rtti:=false;
  1941. def^.has_inittable:=false;
  1942. end;
  1943. {$ifdef debug}
  1944. prevdef:=def;
  1945. {$endif debug}
  1946. def:=def^.nextglobal;
  1947. end;
  1948. end;
  1949. {****************************************************************************
  1950. Object Helpers
  1951. ****************************************************************************}
  1952. function search_class_member(pd : pobjectdef;const n : string) : psym;
  1953. { searches n in symtable of pd and all anchestors }
  1954. var
  1955. sym : psym;
  1956. begin
  1957. sym:=nil;
  1958. while assigned(pd) do
  1959. begin
  1960. sym:=pd^.symtable^.search(n);
  1961. if assigned(sym) then
  1962. break;
  1963. pd:=pd^.childof;
  1964. end;
  1965. { this is needed for static methods in do_member_read pexpr unit PM
  1966. caused bug0214 }
  1967. if assigned(sym) then
  1968. begin
  1969. srsymtable:=pd^.symtable;
  1970. end;
  1971. search_class_member:=sym;
  1972. end;
  1973. var
  1974. _defaultprop : ppropertysym;
  1975. procedure testfordefaultproperty(p : pnamedindexobject);
  1976. begin
  1977. if (psym(p)^.typ=propertysym) and
  1978. (ppo_defaultproperty in ppropertysym(p)^.propoptions) then
  1979. _defaultprop:=ppropertysym(p);
  1980. end;
  1981. function search_default_property(pd : pobjectdef) : ppropertysym;
  1982. { returns the default property of a class, searches also anchestors }
  1983. begin
  1984. _defaultprop:=nil;
  1985. while assigned(pd) do
  1986. begin
  1987. pd^.symtable^.foreach({$ifndef TP}@{$endif}testfordefaultproperty);
  1988. if assigned(_defaultprop) then
  1989. break;
  1990. pd:=pd^.childof;
  1991. end;
  1992. search_default_property:=_defaultprop;
  1993. end;
  1994. {****************************************************************************
  1995. Macro's
  1996. ****************************************************************************}
  1997. procedure def_macro(const s : string);
  1998. var
  1999. mac : pmacrosym;
  2000. begin
  2001. mac:=pmacrosym(macros^.search(s));
  2002. if mac=nil then
  2003. begin
  2004. mac:=new(pmacrosym,init(s));
  2005. Message1(parser_m_macro_defined,mac^.name);
  2006. macros^.insert(mac);
  2007. end;
  2008. mac^.defined:=true;
  2009. mac^.defined_at_startup:=true;
  2010. end;
  2011. procedure set_macro(const s : string;value : string);
  2012. var
  2013. mac : pmacrosym;
  2014. begin
  2015. mac:=pmacrosym(macros^.search(s));
  2016. if mac=nil then
  2017. begin
  2018. mac:=new(pmacrosym,init(s));
  2019. macros^.insert(mac);
  2020. end
  2021. else
  2022. begin
  2023. if assigned(mac^.buftext) then
  2024. freemem(mac^.buftext,mac^.buflen);
  2025. end;
  2026. Message2(parser_m_macro_set_to,mac^.name,value);
  2027. mac^.buflen:=length(value);
  2028. getmem(mac^.buftext,mac^.buflen);
  2029. move(value[1],mac^.buftext^,mac^.buflen);
  2030. mac^.defined:=true;
  2031. mac^.defined_at_startup:=true;
  2032. end;
  2033. {$ifdef UNITALIASES}
  2034. {****************************************************************************
  2035. TUNIT_ALIAS
  2036. ****************************************************************************}
  2037. constructor tunit_alias.init(const n:string);
  2038. var
  2039. i : longint;
  2040. begin
  2041. i:=pos('=',n);
  2042. if i=0 then
  2043. fail;
  2044. inherited initname(Copy(n,1,i-1));
  2045. newname:=stringdup(Copy(n,i+1,255));
  2046. end;
  2047. destructor tunit_alias.done;
  2048. begin
  2049. stringdispose(newname);
  2050. inherited done;
  2051. end;
  2052. procedure addunitalias(const n:string);
  2053. begin
  2054. unitaliases^.insert(new(punit_alias,init(Upper(n))));
  2055. end;
  2056. function getunitalias(const n:string):string;
  2057. var
  2058. p : punit_alias;
  2059. begin
  2060. p:=punit_alias(unitaliases^.search(Upper(n)));
  2061. if assigned(p) then
  2062. getunitalias:=punit_alias(p)^.newname^
  2063. else
  2064. getunitalias:=n;
  2065. end;
  2066. {$endif UNITALIASES}
  2067. {****************************************************************************
  2068. Symtable Stack
  2069. ****************************************************************************}
  2070. procedure dellexlevel;
  2071. var
  2072. p : psymtable;
  2073. begin
  2074. p:=symtablestack;
  2075. symtablestack:=p^.next;
  2076. { symbol tables of unit interfaces are never disposed }
  2077. { this is handle by the unit unitm }
  2078. if not(p^.symtabletype in [unitsymtable,globalsymtable,stt_exceptsymtable]) or dispose_global then
  2079. dispose(p,done);
  2080. end;
  2081. {$ifdef DEBUG}
  2082. procedure test_symtablestack;
  2083. var
  2084. p : psymtable;
  2085. i : longint;
  2086. begin
  2087. p:=symtablestack;
  2088. i:=0;
  2089. while assigned(p) do
  2090. begin
  2091. inc(i);
  2092. p:=p^.next;
  2093. if i>500 then
  2094. Message(sym_f_internal_error_in_symtablestack);
  2095. end;
  2096. end;
  2097. procedure list_symtablestack;
  2098. var
  2099. p : psymtable;
  2100. i : longint;
  2101. begin
  2102. p:=symtablestack;
  2103. i:=0;
  2104. while assigned(p) do
  2105. begin
  2106. inc(i);
  2107. writeln(i,' ',p^.name^);
  2108. p:=p^.next;
  2109. if i>500 then
  2110. Message(sym_f_internal_error_in_symtablestack);
  2111. end;
  2112. end;
  2113. {$endif DEBUG}
  2114. {****************************************************************************
  2115. Init/Done Symtable
  2116. ****************************************************************************}
  2117. {$ifndef Delphi}
  2118. {$ifdef tp}
  2119. procedure do_streamerror;
  2120. begin
  2121. if symbolstream.status=-2 then
  2122. WriteLn('Error: Not enough EMS memory')
  2123. else
  2124. WriteLn('Error: EMS Error ',symbolstream.status);
  2125. halt(1);
  2126. end;
  2127. {$endif TP}
  2128. {$endif Delphi}
  2129. procedure InitSymtable;
  2130. begin
  2131. {$ifndef Delphi}
  2132. {$ifdef TP}
  2133. { Allocate stream }
  2134. if use_big then
  2135. begin
  2136. streamerror:=@do_streamerror;
  2137. { symbolstream.init('TMPFILE',stcreate,16000); }
  2138. {$ifndef dpmi}
  2139. symbolstream.init(10000,4000000); {using ems streams}
  2140. {$else}
  2141. symbolstream.init(1000000,16000); {using memory streams}
  2142. {$endif}
  2143. if symbolstream.errorinfo=stiniterror then
  2144. do_streamerror;
  2145. { write something, because pos 0 means nil pointer }
  2146. symbolstream.writestr(@inputfile);
  2147. end;
  2148. {$endif tp}
  2149. {$endif Delphi}
  2150. { Reset symbolstack }
  2151. registerdef:=false;
  2152. read_member:=false;
  2153. symtablestack:=nil;
  2154. systemunit:=nil;
  2155. {$ifdef GDB}
  2156. firstglobaldef:=nil;
  2157. lastglobaldef:=nil;
  2158. {$endif GDB}
  2159. globaltypecount:=1;
  2160. pglobaltypecount:=@globaltypecount;
  2161. { create error syms and def }
  2162. generrorsym:=new(perrorsym,init);
  2163. generrordef:=new(perrordef,init);
  2164. {$ifdef UNITALIASES}
  2165. { unit aliases }
  2166. unitaliases:=new(pdictionary,init);
  2167. {$endif}
  2168. end;
  2169. procedure DoneSymtable;
  2170. begin
  2171. dispose(generrorsym,done);
  2172. dispose(generrordef,done);
  2173. {$ifdef UNITALIASES}
  2174. dispose(unitaliases,done);
  2175. {$endif}
  2176. {$ifndef Delphi}
  2177. {$ifdef TP}
  2178. { close the stream }
  2179. if use_big then
  2180. symbolstream.done;
  2181. {$endif}
  2182. {$endif Delphi}
  2183. end;
  2184. end.
  2185. {
  2186. $Log$
  2187. Revision 1.57 1999-11-05 17:18:03 pierre
  2188. * local browsing works at first level
  2189. ie for function defined in interface or implementation
  2190. not yet for functions inside other functions
  2191. Revision 1.56 1999/11/04 23:13:25 peter
  2192. * moved unit alias support into ifdef
  2193. Revision 1.55 1999/11/04 10:54:02 peter
  2194. + -Ua<oldname>=<newname> unit alias support
  2195. Revision 1.54 1999/10/26 12:30:46 peter
  2196. * const parameter is now checked
  2197. * better and generic check if a node can be used for assigning
  2198. * export fixes
  2199. * procvar equal works now (it never had worked at least from 0.99.8)
  2200. * defcoll changed to linkedlist with pparaitem so it can easily be
  2201. walked both directions
  2202. Revision 1.53 1999/10/06 17:39:15 peter
  2203. * fixed stabs writting for forward types
  2204. Revision 1.52 1999/10/03 19:44:42 peter
  2205. * removed objpasunit reference, tvarrec is now searched in systemunit
  2206. where it already was located
  2207. Revision 1.51 1999/10/01 08:02:49 peter
  2208. * forward type declaration rewritten
  2209. Revision 1.50 1999/09/28 20:48:25 florian
  2210. * fixed bug 610
  2211. + added $D- for TP in symtable.pas else it can't be compiled anymore
  2212. (too much symbols :()
  2213. Revision 1.49 1999/09/27 23:44:59 peter
  2214. * procinfo is now a pointer
  2215. * support for result setting in sub procedure
  2216. Revision 1.48 1999/09/12 21:35:38 florian
  2217. * fixed a crash under Linux. Why doesn't have the damned Windows DPMI nil pointer
  2218. protection???
  2219. Revision 1.47 1999/09/12 08:48:09 florian
  2220. * bugs 593 and 607 fixed
  2221. * some other potential bugs with array constructors fixed
  2222. * for classes compiled in $M+ and it's childs, the default access method
  2223. is now published
  2224. * fixed copyright message (it is now 1993-99)
  2225. Revision 1.46 1999/09/10 18:48:10 florian
  2226. * some bug fixes (e.g. must_be_valid and procinfo^.funcret_is_valid)
  2227. * most things for stored properties fixed
  2228. Revision 1.45 1999/09/08 08:05:44 peter
  2229. * fixed bug 248
  2230. Revision 1.44 1999/08/31 15:46:21 pierre
  2231. * do_crc must be false for all browser stuff
  2232. + tmacrosym defined_at_startup set in def_macro and set_macro
  2233. Revision 1.43 1999/08/27 10:39:24 pierre
  2234. * uf_local_browser made problem when computing interface CRC
  2235. Revision 1.42 1999/08/13 21:33:13 peter
  2236. * support for array constructors extended and more error checking
  2237. Revision 1.41 1999/08/13 14:24:22 pierre
  2238. + stabs for classes and classref working,
  2239. a class still needs an ^ to get that content of it,
  2240. but the class fields inside a class don't result into an
  2241. infinite loop anymore!
  2242. Revision 1.40 1999/08/10 16:25:42 pierre
  2243. * unitid changed to word
  2244. Revision 1.39 1999/08/10 12:33:36 pierre
  2245. * pprocsym defined earlier for use in tprocdef
  2246. Revision 1.38 1999/08/05 16:53:18 peter
  2247. * V_Fatal=1, all other V_ are also increased
  2248. * Check for local procedure when assigning procvar
  2249. * fixed comment parsing because directives
  2250. * oldtp mode directives better supported
  2251. * added some messages to errore.msg
  2252. Revision 1.37 1999/08/04 13:03:09 jonas
  2253. * all tokens now start with an underscore
  2254. * PowerPC compiles!!
  2255. Revision 1.36 1999/08/04 00:23:31 florian
  2256. * renamed i386asm and i386base to cpuasm and cpubase
  2257. Revision 1.35 1999/08/03 22:03:22 peter
  2258. * moved bitmask constants to sets
  2259. * some other type/const renamings
  2260. Revision 1.34 1999/08/03 17:51:45 florian
  2261. * reduced memory usage by factor 2-3 (it
  2262. improved also the speed) by reducing the
  2263. growsize of the symbol tables
  2264. Revision 1.33 1999/08/03 00:03:24 florian
  2265. * added bestrealdef for alpha and powerpc
  2266. Revision 1.32 1999/08/01 23:09:27 michael
  2267. * procbase -> cpubase
  2268. Revision 1.31 1999/08/01 23:04:50 michael
  2269. + Changes for Alpha
  2270. Revision 1.30 1999/07/24 00:13:26 peter
  2271. * also number units for program
  2272. Revision 1.29 1999/07/23 16:05:33 peter
  2273. * alignment is now saved in the symtable
  2274. * C alignment added for records
  2275. * PPU version increased to solve .12 <-> .13 probs
  2276. Revision 1.28 1999/07/23 12:02:20 peter
  2277. * fixed crash in previous commit
  2278. Revision 1.27 1999/07/23 11:37:50 peter
  2279. * error for illegal type reference, instead of 10998
  2280. Revision 1.26 1999/07/22 09:37:58 florian
  2281. + resourcestring implemented
  2282. + start of longstring support
  2283. Revision 1.25 1999/07/18 14:47:34 florian
  2284. * bug 487 fixed, (inc(<property>) isn't allowed)
  2285. * more fixes to compile with Delphi
  2286. Revision 1.24 1999/07/03 00:30:01 peter
  2287. * new link writing to the ppu, one .ppu is needed for all link types,
  2288. static (.o) is now always created also when smartlinking is used
  2289. Revision 1.23 1999/06/28 17:02:44 pierre
  2290. merged from v0-99-12 branch
  2291. Revision 1.21.2.2 1999/06/28 16:59:55 pierre
  2292. * fix to get method reference info
  2293. Revision 1.21.2.1 1999/06/22 16:26:46 pierre
  2294. * local browser stuff corrected
  2295. Revision 1.21 1999/06/08 22:23:50 pierre
  2296. * staticppusymtable was loaded a tsymtable instead of tunitsymtable
  2297. Revision 1.20 1999/06/02 22:44:23 pierre
  2298. * previous wrong log corrected
  2299. Revision 1.19 1999/06/02 22:25:53 pierre
  2300. * changed $ifdef FPC @ into $ifndef TP
  2301. Revision 1.18 1999/06/01 14:45:58 peter
  2302. * @procvar is now always needed for FPC
  2303. Revision 1.17 1999/05/27 19:45:08 peter
  2304. * removed oldasm
  2305. * plabel -> pasmlabel
  2306. * -a switches to source writing automaticly
  2307. * assembler readers OOPed
  2308. * asmsymbol automaticly external
  2309. * jumptables and other label fixes for asm readers
  2310. Revision 1.16 1999/05/23 18:42:16 florian
  2311. * better error recovering in typed constants
  2312. * some problems with arrays of const fixed, some problems
  2313. due my previous
  2314. - the location type of array constructor is now LOC_MEM
  2315. - the pushing of high fixed
  2316. - parameter copying fixed
  2317. - zero temp. allocation removed
  2318. * small problem in the assembler writers fixed:
  2319. ref to nil wasn't written correctly
  2320. Revision 1.15 1999/05/17 23:51:41 peter
  2321. * with temp vars now use a reference with a persistant temp instead
  2322. of setting datasize
  2323. Revision 1.14 1999/05/14 17:52:29 peter
  2324. * new deref code
  2325. Revision 1.13 1999/05/13 21:59:48 peter
  2326. * removed oldppu code
  2327. * warning if objpas is loaded from uses
  2328. * first things for new deref writing
  2329. Revision 1.12 1999/05/10 22:34:59 pierre
  2330. * one more unitsym problem fix
  2331. Revision 1.11 1999/05/10 15:02:51 pierre
  2332. unitsym finally problem fixed
  2333. Revision 1.10 1999/05/09 12:46:26 peter
  2334. + hint where a duplicate sym is already defined
  2335. Revision 1.9 1999/05/08 19:52:40 peter
  2336. + MessagePos() which is enhanced Message() function but also gets the
  2337. position info
  2338. * Removed comp warnings
  2339. Revision 1.8 1999/05/06 21:38:38 peter
  2340. * don't register errordef
  2341. Revision 1.7 1999/05/06 09:05:31 peter
  2342. * generic write_float and str_float
  2343. * fixed constant float conversions
  2344. Revision 1.6 1999/05/05 09:19:16 florian
  2345. * more fixes to get it with delphi running
  2346. Revision 1.5 1999/05/01 13:24:43 peter
  2347. * merged nasm compiler
  2348. * old asm moved to oldasm/
  2349. Revision 1.4 1999/04/29 17:25:37 peter
  2350. * small fix for deref
  2351. Revision 1.3 1999/04/26 18:30:03 peter
  2352. * farpointerdef moved into pointerdef.is_far
  2353. Revision 1.151 1999/04/26 13:31:54 peter
  2354. * release storenumber,double_checksum
  2355. Revision 1.150 1999/04/25 17:36:13 peter
  2356. * typo fix for storenumber
  2357. Revision 1.149 1999/04/21 22:05:28 pierre
  2358. + tsymtable.find_at_offset function
  2359. used by ra386att to give arg name from ebp offset with -vz option
  2360. Revision 1.148 1999/04/21 16:31:44 pierre
  2361. ra386att.pas : commit problem !
  2362. Revision 1.147 1999/04/21 09:43:57 peter
  2363. * storenumber works
  2364. * fixed some typos in double_checksum
  2365. + incompatible types type1 and type2 message (with storenumber)
  2366. Revision 1.146 1999/04/19 09:33:14 pierre
  2367. + added tsymtable.set_alignment(longint) function
  2368. to change the offsets of all function args
  2369. if declared as cdecl or stdcall
  2370. (this must be done after because the cdecl is parsed after
  2371. insertion of the function parameterss into parast symboltable)
  2372. Revision 1.145 1999/04/17 13:16:24 peter
  2373. * fixes for storenumber
  2374. Revision 1.144 1999/04/15 10:01:45 peter
  2375. * small update for storenumber
  2376. Revision 1.143 1999/04/14 09:15:04 peter
  2377. * first things to store the symbol/def number in the ppu
  2378. Revision 1.142 1999/04/08 14:54:10 pierre
  2379. * suppression of val para unused warnings
  2380. Revision 1.141 1999/04/07 15:31:09 pierre
  2381. * all formaldefs are now a sinlge definition
  2382. cformaldef (this was necessary for double_checksum)
  2383. + small part of double_checksum code
  2384. Revision 1.140 1999/03/31 13:55:24 peter
  2385. * assembler inlining working for ag386bin
  2386. Revision 1.139 1999/03/24 23:17:30 peter
  2387. * fixed bugs 212,222,225,227,229,231,233
  2388. Revision 1.138 1999/03/21 22:49:11 florian
  2389. * private ids of objects can be reused in child classes
  2390. if they are in another unit
  2391. Revision 1.137 1999/03/17 22:23:20 florian
  2392. * a FPC compiled compiler checks now also in debug mode in assigned
  2393. if a pointer points to the heap
  2394. * when a symtable is loaded, there is no need to check for duplicate
  2395. symbols. This leads to crashes because defowner isn't assigned
  2396. in this case
  2397. Revision 1.136 1999/03/01 13:45:07 pierre
  2398. + added staticppusymtable symtable type for local browsing
  2399. Revision 1.135 1999/02/23 18:29:28 pierre
  2400. * win32 compilation error fix
  2401. + some work for local browser (not cl=omplete yet)
  2402. Revision 1.134 1999/02/22 15:09:42 florian
  2403. * behaviaor of PROTECTED and PRIVATE fixed, works now like TP/Delphi
  2404. Revision 1.133 1999/02/22 13:07:12 pierre
  2405. + -b and -bl options work !
  2406. + cs_local_browser ($L+) is disabled if cs_browser ($Y+)
  2407. is not enabled when quitting global section
  2408. * local vars and procedures are not yet stored into PPU
  2409. Revision 1.132 1999/02/22 02:15:40 peter
  2410. * updates for ag386bin
  2411. Revision 1.131 1999/02/16 00:44:34 peter
  2412. * tp7 fix, assigned() can only be used on vars, not on functions
  2413. Revision 1.130 1999/02/15 13:13:16 pierre
  2414. * fix for bug0216
  2415. Revision 1.129 1999/02/11 09:46:29 pierre
  2416. * fix for normal method calls inside static methods :
  2417. WARNING there were both parser and codegen errors !!
  2418. added static_call boolean to calln tree
  2419. Revision 1.128 1999/02/09 23:03:05 florian
  2420. * check for duplicate field names in inherited classes/objects
  2421. * bug with self from the mailing list solved (the problem
  2422. was that classes were sometimes pushed wrong)
  2423. Revision 1.127 1999/02/08 11:29:06 pierre
  2424. * fix for bug0214
  2425. several problems where combined
  2426. search_class_member did not set srsymtable
  2427. => in do_member_read the call node got a wrong symtable
  2428. in cg386cal the vmt was pushed twice without chacking if it exists
  2429. now %esi is set to zero and pushed if not vmt
  2430. (not very efficient but should work !)
  2431. Revision 1.126 1999/02/05 08:54:31 pierre
  2432. + linkofiles splitted inot linkofiles and linkunitfiles
  2433. because linkofiles must be stored with directory
  2434. to enabled linking of different objects with same name
  2435. in a different directory
  2436. Revision 1.125 1999/02/03 09:44:33 pierre
  2437. * symbol nubering begins with 1 in number_symbols
  2438. * program tmodule has globalsymtable for its staticsymtable
  2439. (to get it displayed in IDE globals list)
  2440. + list of symbol (browcol) greatly improved for IDE
  2441. Revision 1.124 1999/01/27 12:58:33 pierre
  2442. * unused var warning suppressed for high of open arrays
  2443. Revision 1.123 1999/01/21 16:41:03 pierre
  2444. * fix for constructor inside with statements
  2445. Revision 1.122 1999/01/20 10:16:44 peter
  2446. * don't update crc when writing objs,libs and sources
  2447. Revision 1.121 1999/01/14 21:50:00 peter
  2448. * fixed forwardpointer problem with multiple forwards for the same
  2449. typesym. It now uses a linkedlist instead of a single pointer
  2450. Revision 1.120 1999/01/13 14:29:22 daniel
  2451. * nonextfield repaired
  2452. Revision 1.119 1999/01/12 14:25:38 peter
  2453. + BrowserLog for browser.log generation
  2454. + BrowserCol for browser info in TCollections
  2455. * released all other UseBrowser
  2456. Revision 1.118 1999/01/05 08:20:10 florian
  2457. * mainly problem with invalid case ranges fixed (reported by Jonas)
  2458. Revision 1.117 1998/12/30 22:15:57 peter
  2459. + farpointer type
  2460. * absolutesym now also stores if its far
  2461. Revision 1.116 1998/12/30 13:41:16 peter
  2462. * released valuepara
  2463. Revision 1.115 1998/12/11 00:03:48 peter
  2464. + globtype,tokens,version unit splitted from globals
  2465. Revision 1.114 1998/12/10 09:47:29 florian
  2466. + basic operations with int64/qord (compiler with -dint64)
  2467. + rtti of enumerations extended: names are now written
  2468. Revision 1.113 1998/12/08 10:18:17 peter
  2469. + -gh for heaptrc unit
  2470. Revision 1.112 1998/12/04 10:18:10 florian
  2471. * some stuff for procedures of object added
  2472. * bug with overridden virtual constructors fixed (reported by Italo Gomes)
  2473. Revision 1.111 1998/11/30 16:34:46 pierre
  2474. * corrected problems with rangecheck
  2475. + added needed code for no rangecheck in CRC32 functions in ppu unit
  2476. * enumdef lso need its rangenr reset to zero
  2477. when calling reset_global_defs
  2478. Revision 1.110 1998/11/28 16:20:58 peter
  2479. + support for dll variables
  2480. Revision 1.109 1998/11/27 14:50:49 peter
  2481. + open strings, $P switch support
  2482. Revision 1.108 1998/11/24 23:00:32 peter
  2483. * small crash prevention
  2484. Revision 1.107 1998/11/20 15:36:01 florian
  2485. * problems with rtti fixed, hope it works
  2486. Revision 1.106 1998/11/18 15:44:20 peter
  2487. * VALUEPARA for tp7 compatible value parameters
  2488. Revision 1.105 1998/11/17 10:39:18 peter
  2489. * has_rtti,has_inittable reset
  2490. Revision 1.104 1998/11/16 10:13:52 peter
  2491. * label defines are checked at the end of the proc
  2492. Revision 1.103 1998/11/13 15:40:32 pierre
  2493. + added -Se in Makefile cvstest target
  2494. + lexlevel cleanup
  2495. normal_function_level main_program_level and unit_init_level defined
  2496. * tins_cache grown to A_EMMS (gave range check error in asm readers)
  2497. (test added in code !)
  2498. * -Un option was wrong
  2499. * _FAIL and _SELF only keyword inside
  2500. constructors and methods respectively
  2501. Revision 1.102 1998/11/12 16:43:34 florian
  2502. * functions with ansi strings as result didn't work, solved
  2503. Revision 1.101 1998/11/12 12:55:18 pierre
  2504. * fix for bug0176 and bug0177
  2505. Revision 1.100 1998/11/10 10:09:15 peter
  2506. * va_list -> array of const
  2507. Revision 1.99 1998/11/09 11:44:38 peter
  2508. + va_list for printf support
  2509. Revision 1.98 1998/11/05 23:33:35 peter
  2510. * symtable.done sets vars to nil
  2511. Revision 1.97 1998/11/05 12:03:00 peter
  2512. * released useansistring
  2513. * removed -Sv, its now available in fpc modes
  2514. Revision 1.96 1998/10/28 18:26:19 pierre
  2515. * removed some erros after other errors (introduced by useexcept)
  2516. * stabs works again correctly (for how long !)
  2517. Revision 1.95 1998/10/21 08:40:01 florian
  2518. + ansistring operator +
  2519. + $h and string[n] for n>255 added
  2520. * small problem with TP fixed
  2521. Revision 1.94 1998/10/20 08:07:03 pierre
  2522. * several memory corruptions due to double freemem solved
  2523. => never use p^.loc.location:=p^.left^.loc.location;
  2524. + finally I added now by default
  2525. that ra386dir translates global and unit symbols
  2526. + added a first field in tsymtable and
  2527. a nextsym field in tsym
  2528. (this allows to obtain ordered type info for
  2529. records and objects in gdb !)
  2530. Revision 1.93 1998/10/19 08:55:08 pierre
  2531. * wrong stabs info corrected once again !!
  2532. + variable vmt offset with vmt field only if required
  2533. implemented now !!!
  2534. Revision 1.92 1998/10/16 13:12:56 pierre
  2535. * added vmt_offsets in destructors code also !!!
  2536. * vmt_offset code for m68k
  2537. Revision 1.91 1998/10/16 08:48:38 peter
  2538. * fixed some misplaced $endif GDB
  2539. Revision 1.90 1998/10/15 15:13:32 pierre
  2540. + added oo_hasconstructor and oo_hasdestructor
  2541. for objects options
  2542. Revision 1.89 1998/10/14 13:38:25 peter
  2543. * fixed path with staticlib/objects in ppufiles
  2544. Revision 1.88 1998/10/09 16:36:07 pierre
  2545. * some memory leaks specific to usebrowser define fixed
  2546. * removed tmodule.implsymtable (was like tmodule.localsymtable)
  2547. Revision 1.87 1998/10/09 11:47:57 pierre
  2548. * still more memory leaks fixes !!
  2549. Revision 1.86 1998/10/08 17:17:35 pierre
  2550. * current_module old scanner tagged as invalid if unit is recompiled
  2551. + added ppheap for better info on tracegetmem of heaptrc
  2552. (adds line column and file index)
  2553. * several memory leaks removed ith help of heaptrc !!
  2554. Revision 1.85 1998/10/08 13:48:51 peter
  2555. * fixed memory leaks for do nothing source
  2556. * fixed unit interdependency
  2557. Revision 1.84 1998/10/06 17:16:58 pierre
  2558. * some memory leaks fixed (thanks to Peter for heaptrc !)
  2559. Revision 1.83 1998/09/26 17:45:45 peter
  2560. + idtoken and only one token table
  2561. Revision 1.82 1998/09/25 09:52:57 peter
  2562. + store also datasize and # of symbols in ppu
  2563. * # of defs is now also stored in structs
  2564. Revision 1.81 1998/09/24 23:49:21 peter
  2565. + aktmodeswitches
  2566. Revision 1.80 1998/09/23 12:20:51 pierre
  2567. * main program tmodule had no symtable (crashed browser)
  2568. * unit symbols problem fixed !!
  2569. Revision 1.79 1998/09/23 12:03:57 peter
  2570. * overloading fix for array of const
  2571. Revision 1.78 1998/09/22 17:13:54 pierre
  2572. + browsing updated and developed
  2573. records and objects fields are also stored
  2574. Revision 1.77 1998/09/22 15:37:24 peter
  2575. + array of const start
  2576. Revision 1.76 1998/09/21 10:00:08 peter
  2577. * store number of defs in ppu file
  2578. Revision 1.75 1998/09/21 08:58:31 peter
  2579. + speedsearch, which also needs speedvalue as parameter
  2580. Revision 1.74 1998/09/21 08:45:25 pierre
  2581. + added vmt_offset in tobjectdef.write for fututre use
  2582. (first steps to have objects without vmt if no virtual !!)
  2583. + added fpu_used field for tabstractprocdef :
  2584. sets this level to 2 if the functions return with value in FPU
  2585. (is then set to correct value at parsing of implementation)
  2586. THIS MIGHT refuse some code with FPU expression too complex
  2587. that were accepted before and even in some cases
  2588. that don't overflow in fact
  2589. ( like if f : float; is a forward that finally in implementation
  2590. only uses one fpu register !!)
  2591. Nevertheless I think that it will improve security on
  2592. FPU operations !!
  2593. * most other changes only for UseBrowser code
  2594. (added symtable references for record and objects)
  2595. local switch for refs to args and local of each function
  2596. (static symtable still missing)
  2597. UseBrowser still not stable and probably broken by
  2598. the definition hash array !!
  2599. Revision 1.73 1998/09/20 09:38:47 florian
  2600. * hasharray for defs fixed
  2601. * ansistring code generation corrected (init/final, assignement)
  2602. Revision 1.72 1998/09/19 22:56:18 florian
  2603. + hash table for getdefnr added
  2604. Revision 1.71 1998/09/18 08:01:40 pierre
  2605. + improvement on the usebrowser part
  2606. (does not work correctly for now)
  2607. Revision 1.70 1998/09/09 11:50:57 pierre
  2608. * forward def are not put in record or objects
  2609. + added check for forwards also in record and objects
  2610. * dummy parasymtable for unit initialization removed from
  2611. symtable stack
  2612. Revision 1.69 1998/09/07 23:10:25 florian
  2613. * a lot of stuff fixed regarding rtti and publishing of properties,
  2614. basics should now work
  2615. Revision 1.68 1998/09/07 19:33:26 florian
  2616. + some stuff for property rtti added:
  2617. - NameIndex of the TPropInfo record is now written correctly
  2618. - the DEFAULT/NODEFAULT keyword is supported now
  2619. - the default value and the storedsym/def are now written to
  2620. the PPU fiel
  2621. Revision 1.67 1998/09/07 18:46:14 peter
  2622. * update smartlinking, uses getdatalabel
  2623. * renamed ptree.value vars to value_str,value_real,value_set
  2624. Revision 1.66 1998/09/07 17:37:05 florian
  2625. * first fixes for published properties
  2626. Revision 1.65 1998/09/06 22:42:03 florian
  2627. + rtti genreation for properties added
  2628. Revision 1.64 1998/09/05 22:11:04 florian
  2629. + switch -vb
  2630. * while/repeat loops accept now also word/longbool conditions
  2631. * makebooltojump did an invalid ungetregister32, fixed
  2632. Revision 1.63 1998/09/04 17:34:23 pierre
  2633. * bug with datalabel corrected
  2634. + assembler errors better commented
  2635. * one nested record crash removed
  2636. Revision 1.62 1998/09/04 08:42:10 peter
  2637. * updated some error messages
  2638. Revision 1.61 1998/09/03 16:03:21 florian
  2639. + rtti generation
  2640. * init table generation changed
  2641. Revision 1.60 1998/09/01 17:39:52 peter
  2642. + internal constant functions
  2643. Revision 1.59 1998/09/01 12:53:27 peter
  2644. + aktpackenum
  2645. Revision 1.58 1998/09/01 07:54:26 pierre
  2646. * UseBrowser a little updated (might still be buggy !!)
  2647. * bug in psub.pas in function specifier removed
  2648. * stdcall allowed in interface and in implementation
  2649. (FPC will not yet complain if it is missing in either part
  2650. because stdcall is only a dummy !!)
  2651. Revision 1.57 1998/08/31 12:26:33 peter
  2652. * m68k and palmos updates from surebugfixes
  2653. Revision 1.56 1998/08/21 14:08:55 pierre
  2654. + TEST_FUNCRET now default (old code removed)
  2655. works also for m68k (at least compiles)
  2656. Revision 1.55 1998/08/21 08:43:32 pierre
  2657. * pocdecl and poclearstack are now different
  2658. external must but written as last specification
  2659. Revision 1.54 1998/08/20 09:26:48 pierre
  2660. + funcret setting in underproc testing
  2661. compile with _dTEST_FUNCRET
  2662. Revision 1.53 1998/08/19 18:04:56 peter
  2663. * fixed current_module^.in_implementation flag
  2664. Revision 1.51 1998/08/18 14:17:12 pierre
  2665. * bug about assigning the return value of a function to
  2666. a procvar fixed : warning
  2667. assigning a proc to a procvar need @ in FPC mode !!
  2668. * missing file/line info restored
  2669. Revision 1.50 1998/08/17 10:10:13 peter
  2670. - removed OLDPPU
  2671. Revision 1.49 1998/08/12 19:39:31 peter
  2672. * fixed some crashes
  2673. Revision 1.48 1998/08/10 14:50:32 peter
  2674. + localswitches, moduleswitches, globalswitches splitting
  2675. Revision 1.47 1998/08/10 10:00:19 peter
  2676. * Moved symbolstream to symtable.pas
  2677. Revision 1.46 1998/08/08 10:19:19 florian
  2678. * small fixes to write the extended type correct
  2679. Revision 1.45 1998/08/02 16:42:00 florian
  2680. * on o : tobject do should also work now, the exceptsymtable shouldn't be
  2681. disposed by dellexlevel
  2682. Revision 1.44 1998/07/30 11:18:21 florian
  2683. + first implementation of try ... except on .. do end;
  2684. * limitiation of 65535 bytes parameters for cdecl removed
  2685. Revision 1.43 1998/07/28 21:52:56 florian
  2686. + implementation of raise and try..finally
  2687. + some misc. exception stuff
  2688. Revision 1.42 1998/07/20 10:23:03 florian
  2689. * better ansi string assignement
  2690. Revision 1.41 1998/07/18 22:54:31 florian
  2691. * some ansi/wide/longstring support fixed:
  2692. o parameter passing
  2693. o returning as result from functions
  2694. Revision 1.40 1998/07/14 14:47:09 peter
  2695. * released NEWINPUT
  2696. Revision 1.39 1998/07/10 00:00:06 peter
  2697. * fixed ttypesym bug finally
  2698. * fileinfo in the symtable and better using for unused vars
  2699. Revision 1.38 1998/07/07 11:20:17 peter
  2700. + NEWINPUT for a better inputfile and scanner object
  2701. Revision 1.37 1998/06/24 14:48:42 peter
  2702. * ifdef newppu -> ifndef oldppu
  2703. Revision 1.36 1998/06/17 14:10:19 peter
  2704. * small os2 fixes
  2705. * fixed interdependent units with newppu (remake3 under linux works now)
  2706. Revision 1.35 1998/06/16 08:56:35 peter
  2707. + targetcpu
  2708. * cleaner pmodules for newppu
  2709. Revision 1.34 1998/06/15 15:38:12 pierre
  2710. * small bug in systems.pas corrected
  2711. + operators in different units better hanlded
  2712. Revision 1.33 1998/06/15 14:10:53 daniel
  2713. * File was ruined, fixed.
  2714. Revision 1.31 1998/06/13 00:10:20 peter
  2715. * working browser and newppu
  2716. * some small fixes against crashes which occured in bp7 (but not in
  2717. fpc?!)
  2718. Revision 1.30 1998/06/09 16:01:53 pierre
  2719. + added procedure directive parsing for procvars
  2720. (accepted are popstack cdecl and pascal)
  2721. + added C vars with the following syntax
  2722. var C calias 'true_c_name';(can be followed by external)
  2723. reason is that you must add the Cprefix
  2724. which is target dependent
  2725. Revision 1.29 1998/06/07 15:30:26 florian
  2726. + first working rtti
  2727. + data init/final. for local variables
  2728. Revision 1.28 1998/06/06 09:27:39 peter
  2729. * new depend file generated
  2730. Revision 1.27 1998/06/05 14:37:38 pierre
  2731. * fixes for inline for operators
  2732. * inline procedure more correctly restricted
  2733. Revision 1.26 1998/06/04 23:52:03 peter
  2734. * m68k compiles
  2735. + .def file creation moved to gendef.pas so it could also be used
  2736. for win32
  2737. Revision 1.25 1998/06/04 09:55:48 pierre
  2738. * demangled name of procsym reworked to become independant of the
  2739. mangling scheme
  2740. Revision 1.24 1998/06/03 22:49:04 peter
  2741. + wordbool,longbool
  2742. * rename bis,von -> high,low
  2743. * moved some systemunit loading/creating to psystem.pas
  2744. Revision 1.23 1998/05/28 14:40:30 peter
  2745. * fixes for newppu, remake3 works now with it
  2746. Revision 1.22 1998/05/27 19:45:09 peter
  2747. * symtable.pas splitted into includefiles
  2748. * symtable adapted for $ifndef OLDPPU
  2749. Revision 1.21 1998/05/23 01:21:31 peter
  2750. + aktasmmode, aktoptprocessor, aktoutputformat
  2751. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  2752. + $LIBNAME to set the library name where the unit will be put in
  2753. * splitted cgi386 a bit (codeseg to large for bp7)
  2754. * nasm, tasm works again. nasm moved to ag386nsm.pas
  2755. Revision 1.20 1998/05/21 19:33:37 peter
  2756. + better procedure directive handling and only one table
  2757. Revision 1.19 1998/05/20 09:42:37 pierre
  2758. + UseTokenInfo now default
  2759. * unit in interface uses and implementation uses gives error now
  2760. * only one error for unknown symbol (uses lastsymknown boolean)
  2761. the problem came from the label code !
  2762. + first inlined procedures and function work
  2763. (warning there might be allowed cases were the result is still wrong !!)
  2764. * UseBrower updated gives a global list of all position of all used symbols
  2765. with switch -gb
  2766. Revision 1.18 1998/05/11 13:07:57 peter
  2767. + $ifndef OLDPPU for the new ppuformat
  2768. + $define GDB not longer required
  2769. * removed all warnings and stripped some log comments
  2770. * no findfirst/findnext anymore to remove smartlink *.o files
  2771. Revision 1.17 1998/05/06 08:38:48 pierre
  2772. * better position info with UseTokenInfo
  2773. UseTokenInfo greatly simplified
  2774. + added check for changed tree after first time firstpass
  2775. (if we could remove all the cases were it happen
  2776. we could skip all firstpass if firstpasscount > 1)
  2777. Only with ExtDebug
  2778. Revision 1.16 1998/05/05 15:24:20 michael
  2779. * Fix to save units with classes.
  2780. Revision 1.15 1998/05/04 17:54:29 peter
  2781. + smartlinking works (only case jumptable left todo)
  2782. * redesign of systems.pas to support assemblers and linkers
  2783. + Unitname is now also in the PPU-file, increased version to 14
  2784. Revision 1.14 1998/05/01 16:38:46 florian
  2785. * handling of private and protected fixed
  2786. + change_keywords_to_tp implemented to remove
  2787. keywords which aren't supported by tp
  2788. * break and continue are now symbols of the system unit
  2789. + widestring, longstring and ansistring type released
  2790. Revision 1.13 1998/05/01 09:01:25 florian
  2791. + correct semantics of private and protected
  2792. * small fix in variable scope:
  2793. a id can be used in a parameter list of a method, even it is used in
  2794. an anchestor class as field id
  2795. Revision 1.12 1998/05/01 07:43:57 florian
  2796. + basics for rtti implemented
  2797. + switch $m (generate rtti for published sections)
  2798. Revision 1.11 1998/04/30 15:59:42 pierre
  2799. * GDB works again better :
  2800. correct type info in one pass
  2801. + UseTokenInfo for better source position
  2802. * fixed one remaining bug in scanner for line counts
  2803. * several little fixes
  2804. Revision 1.10 1998/04/29 10:34:05 pierre
  2805. + added some code for ansistring (not complete nor working yet)
  2806. * corrected operator overloading
  2807. * corrected nasm output
  2808. + started inline procedures
  2809. + added starstarn : use ** for exponentiation (^ gave problems)
  2810. + started UseTokenInfo cond to get accurate positions
  2811. Revision 1.9 1998/04/27 23:10:29 peter
  2812. + new scanner
  2813. * $makelib -> if smartlink
  2814. * small filename fixes pmodule.setfilename
  2815. * moved import from files.pas -> import.pas
  2816. Revision 1.8 1998/04/21 10:16:48 peter
  2817. * patches from strasbourg
  2818. * objects is not used anymore in the fpc compiled version
  2819. Revision 1.7 1998/04/13 22:20:36 florian
  2820. + stricter checking for duplicate id, solves also bug0097
  2821. Revision 1.6 1998/04/13 17:20:43 florian
  2822. * tdef.done much faster implemented
  2823. Revision 1.5 1998/04/10 21:36:56 florian
  2824. + some stuff to support method pointers (procedure of object) added
  2825. (declaration, parameter handling)
  2826. Revision 1.4 1998/04/08 16:58:08 pierre
  2827. * several bugfixes
  2828. ADD ADC and AND are also sign extended
  2829. nasm output OK (program still crashes at end
  2830. and creates wrong assembler files !!)
  2831. procsym types sym in tdef removed !!
  2832. Revision 1.3 1998/04/07 13:19:52 pierre
  2833. * bugfixes for reset_gdb_info
  2834. in MEM parsing for go32v2
  2835. better external symbol creation
  2836. support for rhgdb.exe (lowercase file names)
  2837. Revision 1.2 1998/04/06 13:09:04 daniel
  2838. * Emergency solution for bug in reset_gdb_info.
  2839. }