symtable.pas 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 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. unit symtable;
  19. {$i defines.inc}
  20. interface
  21. uses
  22. { common }
  23. cutils,cclasses,
  24. { global }
  25. globtype,tokens,
  26. { symtable }
  27. symconst,symbase,symtype,symdef,symsym,
  28. { ppu }
  29. ppu,symppu,
  30. { assembler }
  31. aasm
  32. ;
  33. {****************************************************************************
  34. Symtable types
  35. ****************************************************************************}
  36. type
  37. tstoredsymtable = class(tsymtable)
  38. private
  39. b_needs_init_final : boolean;
  40. procedure _needs_init_final(p : tnamedindexitem);
  41. procedure check_forward(sym : TNamedIndexItem);
  42. procedure labeldefined(p : TNamedIndexItem);
  43. procedure unitsymbolused(p : TNamedIndexItem);
  44. procedure varsymbolused(p : TNamedIndexItem);
  45. procedure TestPrivate(p : TNamedIndexItem);
  46. procedure objectprivatesymbolused(p : TNamedIndexItem);
  47. {$ifdef GDB}
  48. private
  49. asmoutput : taasmoutput;
  50. procedure concatstab(p : TNamedIndexItem);
  51. procedure resetstab(p : TNamedIndexItem);
  52. procedure concattypestab(p : TNamedIndexItem);
  53. {$endif}
  54. procedure order_overloads(p : TNamedIndexItem);
  55. procedure loaddefs(ppufile:tcompilerppufile);
  56. procedure loadsyms(ppufile:tcompilerppufile);
  57. procedure writedefs(ppufile:tcompilerppufile);
  58. procedure writesyms(ppufile:tcompilerppufile);
  59. public
  60. { load/write }
  61. procedure load(ppufile:tcompilerppufile);virtual;
  62. procedure write(ppufile:tcompilerppufile);virtual;
  63. procedure load_browser(ppufile:tcompilerppufile);virtual;
  64. procedure write_browser(ppufile:tcompilerppufile);virtual;
  65. procedure deref;virtual;
  66. procedure insert(sym : tsymentry);override;
  67. function speedsearch(const s : stringid;speedvalue : cardinal) : tsymentry;override;
  68. procedure allsymbolsused;
  69. procedure allprivatesused;
  70. procedure allunitsused;
  71. procedure check_forwards;
  72. procedure checklabels;
  73. function needs_init_final : boolean;
  74. { change alignment for args only parasymtable }
  75. procedure set_alignment(_alignment : longint);
  76. {$ifdef CHAINPROCSYMS}
  77. procedure chainprocsyms;
  78. {$endif CHAINPROCSYMS}
  79. procedure chainoperators;
  80. {$ifdef GDB}
  81. procedure concatstabto(asmlist : taasmoutput);virtual;
  82. function getnewtypecount : word; override;
  83. {$endif GDB}
  84. procedure testfordefaultproperty(p : TNamedIndexItem);
  85. end;
  86. tabstractrecordsymtable = class(tstoredsymtable)
  87. public
  88. procedure load(ppufile:tcompilerppufile);override;
  89. procedure write(ppufile:tcompilerppufile);override;
  90. procedure load_browser(ppufile:tcompilerppufile);override;
  91. procedure write_browser(ppufile:tcompilerppufile);override;
  92. end;
  93. trecordsymtable = class(tabstractrecordsymtable)
  94. public
  95. constructor create;
  96. procedure insert_in(tsymt : tsymtable;offset : longint);
  97. end;
  98. tobjectsymtable = class(tabstractrecordsymtable)
  99. public
  100. constructor create(const n:string);
  101. procedure insert(sym : tsymentry);override;
  102. end;
  103. tabstractlocalsymtable = class(tstoredsymtable)
  104. public
  105. procedure load(ppufile:tcompilerppufile);override;
  106. procedure write(ppufile:tcompilerppufile);override;
  107. procedure load_browser(ppufile:tcompilerppufile);override;
  108. procedure write_browser(ppufile:tcompilerppufile);override;
  109. end;
  110. tlocalsymtable = class(tabstractlocalsymtable)
  111. public
  112. constructor create;
  113. procedure insert(sym : tsymentry);override;
  114. end;
  115. tparasymtable = class(tabstractlocalsymtable)
  116. public
  117. constructor create;
  118. procedure insert(sym : tsymentry);override;
  119. end;
  120. tabstractunitsymtable = class(tstoredsymtable)
  121. public
  122. {$ifdef GDB}
  123. dbx_count : longint;
  124. prev_dbx_counter : plongint;
  125. dbx_count_ok : boolean;
  126. is_stab_written : boolean;
  127. {$endif GDB}
  128. constructor create(const n : string);
  129. {$ifdef GDB}
  130. procedure concattypestabto(asmlist : taasmoutput);
  131. {$endif GDB}
  132. end;
  133. tglobalsymtable = class(tabstractunitsymtable)
  134. public
  135. unittypecount : word;
  136. unitsym : tunitsym;
  137. constructor create(const n : string);
  138. destructor destroy;
  139. procedure load(ppufile:tcompilerppufile);override;
  140. procedure write(ppufile:tcompilerppufile);override;
  141. {$ifdef GDB}
  142. function getnewtypecount : word; override;
  143. {$endif}
  144. end;
  145. tstaticsymtable = class(tabstractunitsymtable)
  146. public
  147. constructor create(const n : string);
  148. procedure load(ppufile:tcompilerppufile);override;
  149. procedure write(ppufile:tcompilerppufile);override;
  150. procedure load_browser(ppufile:tcompilerppufile);override;
  151. procedure write_browser(ppufile:tcompilerppufile);override;
  152. procedure insert(sym : tsymentry);override;
  153. end;
  154. twithsymtable = class(tsymtable)
  155. direct_with : boolean;
  156. { in fact it is a tnode }
  157. withnode : pointer;
  158. { tnode to load of direct with var }
  159. { already usable before firstwith
  160. needed for firstpass of function parameters PM }
  161. withrefnode : pointer;
  162. constructor create(aowner:tdef;asymsearch:TDictionary);
  163. destructor destroy;override;
  164. procedure clear;override;
  165. end;
  166. tstt_exceptsymtable = class(tsymtable)
  167. public
  168. constructor create;
  169. end;
  170. var
  171. constsymtable : tsymtable; { symtable were the constants can be inserted }
  172. systemunit : tglobalsymtable; { pointer to the system unit }
  173. read_member : boolean; { reading members of an symtable }
  174. lexlevel : longint; { level of code }
  175. { 1 for main procedure }
  176. { 2 for normal function or proc }
  177. { higher for locals }
  178. {****************************************************************************
  179. Functions
  180. ****************************************************************************}
  181. {*** Misc ***}
  182. procedure globaldef(const s : string;var t:ttype);
  183. function findunitsymtable(st:tsymtable):tsymtable;
  184. procedure duplicatesym(sym:tsym);
  185. {*** Search ***}
  186. function searchsym(const s : stringid;var srsym:tsym;var srsymtable:tsymtable):boolean;
  187. function searchsymonlyin(p : tsymtable;const s : stringid):tsym;
  188. function search_class_member(pd : tobjectdef;const s : string):tsym;
  189. {*** Object Helpers ***}
  190. function search_default_property(pd : tobjectdef) : tpropertysym;
  191. {*** symtable stack ***}
  192. procedure dellexlevel;
  193. procedure RestoreUnitSyms;
  194. {$ifdef DEBUG}
  195. procedure test_symtablestack;
  196. procedure list_symtablestack;
  197. {$endif DEBUG}
  198. {$ifdef UNITALIASES}
  199. type
  200. punit_alias = ^tunit_alias;
  201. tunit_alias = object(TNamedIndexItem)
  202. newname : pstring;
  203. constructor init(const n:string);
  204. destructor done;virtual;
  205. end;
  206. var
  207. unitaliases : pdictionary;
  208. procedure addunitalias(const n:string);
  209. function getunitalias(const n:string):string;
  210. {$endif UNITALIASES}
  211. {*** Init / Done ***}
  212. procedure InitSymtable;
  213. procedure DoneSymtable;
  214. type
  215. toverloaded_operators = array[NOTOKEN..last_overloaded] of tprocsym;
  216. var
  217. overloaded_operators : toverloaded_operators;
  218. { unequal is not equal}
  219. const
  220. overloaded_names : array [NOTOKEN..last_overloaded] of string[16] =
  221. ('error',
  222. 'plus','minus','star','slash','equal',
  223. 'greater','lower','greater_or_equal',
  224. 'lower_or_equal',
  225. 'sym_diff','starstar',
  226. 'as','is','in','or',
  227. 'and','div','mod','not','shl','shr','xor',
  228. 'assign');
  229. implementation
  230. uses
  231. { global }
  232. version,verbose,globals,
  233. { target }
  234. systems,
  235. { module }
  236. finput,fmodule,
  237. {$ifdef GDB}
  238. gdb,
  239. {$endif GDB}
  240. { codegen }
  241. hcodegen
  242. ;
  243. var
  244. in_loading : boolean; { remove !!! }
  245. {*****************************************************************************
  246. TStoredSymtable
  247. *****************************************************************************}
  248. procedure tstoredsymtable.load(ppufile:tcompilerppufile);
  249. begin
  250. { load definitions }
  251. loaddefs(ppufile);
  252. { load symbols }
  253. loadsyms(ppufile);
  254. end;
  255. procedure tstoredsymtable.write(ppufile:tcompilerppufile);
  256. begin
  257. { write definitions }
  258. writedefs(ppufile);
  259. { write symbols }
  260. writesyms(ppufile);
  261. end;
  262. procedure tstoredsymtable.loaddefs(ppufile:tcompilerppufile);
  263. var
  264. hp : tdef;
  265. b : byte;
  266. begin
  267. { load start of definition section, which holds the amount of defs }
  268. if ppufile.readentry<>ibstartdefs then
  269. Message(unit_f_ppu_read_error);
  270. ppufile.getlongint;
  271. { read definitions }
  272. repeat
  273. b:=ppufile.readentry;
  274. case b of
  275. ibpointerdef : hp:=tpointerdef.load(ppufile);
  276. ibarraydef : hp:=tarraydef.load(ppufile);
  277. iborddef : hp:=torddef.load(ppufile);
  278. ibfloatdef : hp:=tfloatdef.load(ppufile);
  279. ibprocdef : hp:=tprocdef.load(ppufile);
  280. ibshortstringdef : hp:=tstringdef.loadshort(ppufile);
  281. iblongstringdef : hp:=tstringdef.loadlong(ppufile);
  282. ibansistringdef : hp:=tstringdef.loadansi(ppufile);
  283. ibwidestringdef : hp:=tstringdef.loadwide(ppufile);
  284. ibrecorddef : hp:=trecorddef.load(ppufile);
  285. ibobjectdef : hp:=tobjectdef.load(ppufile);
  286. ibenumdef : hp:=tenumdef.load(ppufile);
  287. ibsetdef : hp:=tsetdef.load(ppufile);
  288. ibprocvardef : hp:=tprocvardef.load(ppufile);
  289. ibfiledef : hp:=tfiledef.load(ppufile);
  290. ibclassrefdef : hp:=tclassrefdef.load(ppufile);
  291. ibformaldef : hp:=tformaldef.load(ppufile);
  292. ibvariantdef : hp:=tvariantdef.load(ppufile);
  293. ibenddefs : break;
  294. ibend : Message(unit_f_ppu_read_error);
  295. else
  296. Message1(unit_f_ppu_invalid_entry,tostr(b));
  297. end;
  298. hp.owner:=self;
  299. defindex.insert(hp);
  300. until false;
  301. end;
  302. procedure tstoredsymtable.loadsyms(ppufile:tcompilerppufile);
  303. var
  304. b : byte;
  305. sym : tsym;
  306. begin
  307. { load start of definition section, which holds the amount of defs }
  308. if ppufile.readentry<>ibstartsyms then
  309. Message(unit_f_ppu_read_error);
  310. { skip amount of symbols, not used currently }
  311. ppufile.getlongint;
  312. { load datasize,dataalignment of this symboltable }
  313. datasize:=ppufile.getlongint;
  314. dataalignment:=ppufile.getlongint;
  315. { now read the symbols }
  316. repeat
  317. b:=ppufile.readentry;
  318. case b of
  319. ibtypesym : sym:=ttypesym.load(ppufile);
  320. ibprocsym : sym:=tprocsym.load(ppufile);
  321. ibconstsym : sym:=tconstsym.load(ppufile);
  322. ibvarsym : sym:=tvarsym.load(ppufile);
  323. ibfuncretsym : sym:=tfuncretsym.load(ppufile);
  324. ibabsolutesym : sym:=tabsolutesym.load(ppufile);
  325. ibenumsym : sym:=tenumsym.load(ppufile);
  326. ibtypedconstsym : sym:=ttypedconstsym.load(ppufile);
  327. ibpropertysym : sym:=tpropertysym.load(ppufile);
  328. ibunitsym : sym:=tunitsym.load(ppufile);
  329. iblabelsym : sym:=tlabelsym.load(ppufile);
  330. ibsyssym : sym:=tsyssym.load(ppufile);
  331. ibendsyms : break;
  332. ibend : Message(unit_f_ppu_read_error);
  333. else
  334. Message1(unit_f_ppu_invalid_entry,tostr(b));
  335. end;
  336. sym.owner:=self;
  337. symindex.insert(sym);
  338. symsearch.insert(sym);
  339. until false;
  340. end;
  341. procedure tstoredsymtable.writedefs(ppufile:tcompilerppufile);
  342. var
  343. pd : tstoreddef;
  344. begin
  345. { each definition get a number, write then the amount of defs to the
  346. ibstartdef entry }
  347. ppufile.putlongint(defindex.count);
  348. ppufile.writeentry(ibstartdefs);
  349. { now write the definition }
  350. pd:=tstoreddef(defindex.first);
  351. while assigned(pd) do
  352. begin
  353. pd.write(ppufile);
  354. pd:=tstoreddef(pd.indexnext);
  355. end;
  356. { write end of definitions }
  357. ppufile.writeentry(ibenddefs);
  358. end;
  359. procedure tstoredsymtable.writesyms(ppufile:tcompilerppufile);
  360. var
  361. pd : tstoredsym;
  362. begin
  363. { each definition get a number, write then the amount of syms and the
  364. datasize to the ibsymdef entry }
  365. ppufile.putlongint(symindex.count);
  366. ppufile.putlongint(datasize);
  367. ppufile.putlongint(dataalignment);
  368. ppufile.writeentry(ibstartsyms);
  369. { foreach is used to write all symbols }
  370. pd:=tstoredsym(symindex.first);
  371. while assigned(pd) do
  372. begin
  373. pd.write(ppufile);
  374. pd:=tstoredsym(pd.indexnext);
  375. end;
  376. { end of symbols }
  377. ppufile.writeentry(ibendsyms);
  378. end;
  379. procedure tstoredsymtable.load_browser(ppufile:tcompilerppufile);
  380. var
  381. b : byte;
  382. sym : tstoredsym;
  383. prdef : tstoreddef;
  384. begin
  385. b:=ppufile.readentry;
  386. if b <> ibbeginsymtablebrowser then
  387. Message1(unit_f_ppu_invalid_entry,tostr(b));
  388. repeat
  389. b:=ppufile.readentry;
  390. case b of
  391. ibsymref :
  392. begin
  393. sym:=tstoredsym(ppufile.getderef);
  394. resolvesym(tsym(sym));
  395. if assigned(sym) then
  396. sym.load_references(ppufile);
  397. end;
  398. ibdefref :
  399. begin
  400. prdef:=tstoreddef(ppufile.getderef);
  401. resolvedef(tdef(prdef));
  402. if assigned(prdef) then
  403. begin
  404. if prdef.deftype<>procdef then
  405. Message(unit_f_ppu_read_error);
  406. tprocdef(prdef).load_references(ppufile);
  407. end;
  408. end;
  409. ibendsymtablebrowser :
  410. break;
  411. else
  412. Message1(unit_f_ppu_invalid_entry,tostr(b));
  413. end;
  414. until false;
  415. end;
  416. procedure tstoredsymtable.write_browser(ppufile:tcompilerppufile);
  417. var
  418. pd : tstoredsym;
  419. begin
  420. ppufile.writeentry(ibbeginsymtablebrowser);
  421. { foreach is used to write all symbols }
  422. pd:=tstoredsym(symindex.first);
  423. while assigned(pd) do
  424. begin
  425. pd.write_references(ppufile);
  426. pd:=tstoredsym(pd.indexnext);
  427. end;
  428. ppufile.writeentry(ibendsymtablebrowser);
  429. end;
  430. procedure tstoredsymtable.deref;
  431. var
  432. hp : tdef;
  433. hs : tsym;
  434. begin
  435. { deref the definitions }
  436. hp:=tdef(defindex.first);
  437. while assigned(hp) do
  438. begin
  439. hp.deref;
  440. hp:=tdef(hp.indexnext);
  441. end;
  442. { first deref the ttypesyms }
  443. hs:=tsym(symindex.first);
  444. while assigned(hs) do
  445. begin
  446. hs.prederef;
  447. hs:=tsym(hs.indexnext);
  448. end;
  449. { deref the symbols }
  450. hs:=tsym(symindex.first);
  451. while assigned(hs) do
  452. begin
  453. hs.deref;
  454. hs:=tsym(hs.indexnext);
  455. end;
  456. end;
  457. procedure tstoredsymtable.insert(sym:tsymentry);
  458. var
  459. hsym : tsym;
  460. begin
  461. { set owner and sym indexnb }
  462. sym.owner:=self;
  463. {$ifdef CHAINPROCSYMS}
  464. { set the nextprocsym field }
  465. if sym.typ=procsym then
  466. chainprocsym(sym);
  467. {$endif CHAINPROCSYMS}
  468. { writes the symbol in data segment if required }
  469. { also sets the datasize of owner }
  470. if not in_loading then
  471. tstoredsym(sym).insert_in_data;
  472. { check the current symtable }
  473. hsym:=tsym(search(sym.name));
  474. if assigned(hsym) then
  475. begin
  476. { in TP and Delphi you can have a local with the
  477. same name as the function, the function is then hidden for
  478. the user. (Under delphi it can still be accessed using result),
  479. but don't allow hiding of RESULT }
  480. if (m_tp in aktmodeswitches) and
  481. (hsym.typ=funcretsym) and
  482. not((m_result in aktmodeswitches) and
  483. (hsym.name='RESULT')) then
  484. hsym.owner.rename(hsym.name,'hidden'+hsym.name)
  485. else
  486. begin
  487. DuplicateSym(hsym);
  488. exit;
  489. end;
  490. end;
  491. { register definition of typesym }
  492. if (sym.typ = typesym) and
  493. assigned(ttypesym(sym).restype.def) then
  494. begin
  495. if not(assigned(ttypesym(sym).restype.def.owner)) and
  496. (ttypesym(sym).restype.def.deftype<>errordef) then
  497. registerdef(ttypesym(sym).restype.def);
  498. {$ifdef GDB}
  499. if (cs_debuginfo in aktmoduleswitches) and assigned(debuglist) and
  500. (symtabletype in [globalsymtable,staticsymtable]) then
  501. begin
  502. ttypesym(sym).isusedinstab := true;
  503. {sym.concatstabto(debuglist);}
  504. end;
  505. {$endif GDB}
  506. end;
  507. { insert in index and search hash }
  508. symindex.insert(sym);
  509. symsearch.insert(sym);
  510. end;
  511. function tstoredsymtable.speedsearch(const s : stringid;speedvalue : cardinal) : tsymentry;
  512. var
  513. hp : tstoredsym;
  514. newref : tref;
  515. begin
  516. hp:=tstoredsym(inherited speedsearch(s,speedvalue));
  517. if assigned(hp) then
  518. begin
  519. { reject non static members in static procedures,
  520. be carefull aktprocsym.definition is not allways
  521. loaded already (PFV) }
  522. if (symtabletype=objectsymtable) and
  523. not(sp_static in hp.symoptions) and
  524. allow_only_static
  525. {assigned(aktprocsym) and
  526. assigned(aktprocsym.definition) and
  527. ((aktprocsym.definition.options and postaticmethod)<>0)} then
  528. Message(sym_e_only_static_in_static);
  529. if (unitid<>0) and
  530. assigned(tglobalsymtable(self).unitsym) then
  531. inc(tglobalsymtable(self).unitsym.refs);
  532. {$ifdef GDB}
  533. { if it is a type, we need the stabs of this type
  534. this might be the cause of the class debug problems
  535. as TCHILDCLASS.Create did not generate appropriate
  536. stabs debug info if TCHILDCLASS wasn't used anywhere else PM }
  537. if (hp.typ=typesym) and make_ref then
  538. begin
  539. if assigned(ttypesym(hp).restype.def) then
  540. tstoreddef(ttypesym(hp).restype.def).numberstring
  541. else
  542. ttypesym(hp).isusedinstab:=true;
  543. end;
  544. {$endif GDB}
  545. { unitsym are only loaded for browsing PM }
  546. { this was buggy anyway because we could use }
  547. { unitsyms from other units in _USES !! }
  548. {if (symtabletype=unitsymtable) and (hp.typ=unitsym) and
  549. assigned(current_module) and (current_module.globalsymtable<>.load) then
  550. hp:=nil;}
  551. if assigned(hp) and
  552. (cs_browser in aktmoduleswitches) and make_ref then
  553. begin
  554. newref:=tref.create(hp.lastref,@akttokenpos);
  555. { for symbols that are in tables without
  556. browser info or syssyms (PM) }
  557. if hp.refcount=0 then
  558. begin
  559. hp.defref:=newref;
  560. hp.lastref:=newref;
  561. end
  562. else
  563. if resolving_forward and assigned(hp.defref) then
  564. { put it as second reference }
  565. begin
  566. newref.nextref:=hp.defref.nextref;
  567. hp.defref.nextref:=newref;
  568. hp.lastref.nextref:=nil;
  569. end
  570. else
  571. hp.lastref:=newref;
  572. inc(hp.refcount);
  573. end;
  574. if assigned(hp) and make_ref then
  575. begin
  576. inc(hp.refs);
  577. end;
  578. end;
  579. speedsearch:=hp;
  580. end;
  581. {**************************************
  582. Callbacks
  583. **************************************}
  584. procedure TStoredSymtable.check_forward(sym : TNamedIndexItem);
  585. begin
  586. if tsym(sym).typ=procsym then
  587. tprocsym(sym).check_forward
  588. { check also object method table }
  589. { we needn't to test the def list }
  590. { because each object has to have a type sym }
  591. else
  592. if (tsym(sym).typ=typesym) and
  593. assigned(ttypesym(sym).restype.def) and
  594. (ttypesym(sym).restype.def.deftype=objectdef) then
  595. tobjectdef(ttypesym(sym).restype.def).check_forwards;
  596. end;
  597. procedure TStoredSymtable.labeldefined(p : TNamedIndexItem);
  598. begin
  599. if (tsym(p).typ=labelsym) and
  600. not(tlabelsym(p).defined) then
  601. begin
  602. if tlabelsym(p).used then
  603. Message1(sym_e_label_used_and_not_defined,tlabelsym(p).realname)
  604. else
  605. Message1(sym_w_label_not_defined,tlabelsym(p).realname);
  606. end;
  607. end;
  608. procedure TStoredSymtable.unitsymbolused(p : TNamedIndexItem);
  609. begin
  610. if (tsym(p).typ=unitsym) and
  611. (tunitsym(p).refs=0) and
  612. { do not claim for unit name itself !! }
  613. (tunitsym(p).unitsymtable.symtabletype=globalsymtable) then
  614. MessagePos2(tsym(p).fileinfo,sym_n_unit_not_used,
  615. p.name,current_module.modulename^);
  616. end;
  617. procedure TStoredSymtable.varsymbolused(p : TNamedIndexItem);
  618. begin
  619. if (tsym(p).typ=varsym) and
  620. ((tsym(p).owner.symtabletype in
  621. [parasymtable,localsymtable,objectsymtable,staticsymtable])) then
  622. begin
  623. { unused symbol should be reported only if no }
  624. { error is reported }
  625. { if the symbol is in a register it is used }
  626. { also don't count the value parameters which have local copies }
  627. { also don't claim for high param of open parameters (PM) }
  628. if (Errorcount<>0) or
  629. (copy(p.name,1,3)='val') or
  630. (copy(p.name,1,4)='high') then
  631. exit;
  632. if (tvarsym(p).refs=0) then
  633. begin
  634. if (tsym(p).owner.symtabletype=parasymtable) or (vo_is_local_copy in tvarsym(p).varoptions) then
  635. begin
  636. MessagePos1(tsym(p).fileinfo,sym_h_para_identifier_not_used,tsym(p).realname);
  637. end
  638. else if (tsym(p).owner.symtabletype=objectsymtable) then
  639. MessagePos2(tsym(p).fileinfo,sym_n_private_identifier_not_used,tsym(p).owner.name^,tsym(p).realname)
  640. else
  641. MessagePos1(tsym(p).fileinfo,sym_n_local_identifier_not_used,tsym(p).realname);
  642. end
  643. else if tvarsym(p).varstate=vs_assigned then
  644. begin
  645. if (tsym(p).owner.symtabletype=parasymtable) then
  646. begin
  647. if not(tvarsym(p).varspez in [vs_var,vs_out]) then
  648. MessagePos1(tsym(p).fileinfo,sym_h_para_identifier_only_set,tsym(p).realname)
  649. end
  650. else if (vo_is_local_copy in tvarsym(p).varoptions) then
  651. begin
  652. if not(tvarsym(p).varspez in [vs_var,vs_out]) then
  653. MessagePos1(tsym(p).fileinfo,sym_h_para_identifier_only_set,tsym(p).realname);
  654. end
  655. else if (tsym(p).owner.symtabletype=objectsymtable) then
  656. MessagePos2(tsym(p).fileinfo,sym_n_private_identifier_only_set,tsym(p).owner.name^,tsym(p).realname)
  657. else if (tsym(p).owner.symtabletype<>parasymtable) then
  658. if not (vo_is_exported in tvarsym(p).varoptions) then
  659. MessagePos1(tsym(p).fileinfo,sym_n_local_identifier_only_set,tsym(p).realname);
  660. end;
  661. end
  662. else if ((tsym(p).owner.symtabletype in
  663. [objectsymtable,parasymtable,localsymtable,staticsymtable])) then
  664. begin
  665. if (Errorcount<>0) then
  666. exit;
  667. { do not claim for inherited private fields !! }
  668. if (tstoredsym(p).refs=0) and (tsym(p).owner.symtabletype=objectsymtable) then
  669. MessagePos2(tsym(p).fileinfo,sym_n_private_method_not_used,tsym(p).owner.name^,tsym(p).realname)
  670. { units references are problematic }
  671. else if (tstoredsym(p).refs=0) and not(tsym(p).typ in [funcretsym,enumsym,unitsym]) then
  672. if (tsym(p).typ<>procsym) or not (tprocsym(p).is_global) or
  673. { all program functions are declared global
  674. but unused should still be signaled PM }
  675. ((tsym(p).owner.symtabletype=staticsymtable) and
  676. not current_module.is_unit) then
  677. MessagePos2(tsym(p).fileinfo,sym_h_local_symbol_not_used,SymTypeName[tsym(p).typ],tsym(p).realname);
  678. end;
  679. end;
  680. procedure TStoredSymtable.TestPrivate(p : TNamedIndexItem);
  681. begin
  682. if sp_private in tsym(p).symoptions then
  683. varsymbolused(p);
  684. end;
  685. procedure TStoredSymtable.objectprivatesymbolused(p : TNamedIndexItem);
  686. begin
  687. {
  688. Don't test simple object aliases PM
  689. }
  690. if (tsym(p).typ=typesym) and
  691. (ttypesym(p).restype.def.deftype=objectdef) and
  692. (ttypesym(p).restype.def.typesym=tsym(p)) then
  693. tobjectdef(ttypesym(p).restype.def).symtable.foreach({$ifdef FPCPROCVAR}@{$endif}TestPrivate);
  694. end;
  695. procedure tstoredsymtable.order_overloads(p : TNamedIndexItem);
  696. begin
  697. if tsym(p).typ=procsym then
  698. tprocsym(p).order_overloaded;
  699. end;
  700. {$ifdef GDB}
  701. procedure TStoredSymtable.concatstab(p : TNamedIndexItem);
  702. begin
  703. if tsym(p).typ <> procsym then
  704. tstoredsym(p).concatstabto(asmoutput);
  705. end;
  706. procedure TStoredSymtable.resetstab(p : TNamedIndexItem);
  707. begin
  708. if tsym(p).typ <> procsym then
  709. tstoredsym(p).isstabwritten:=false;
  710. end;
  711. procedure TStoredSymtable.concattypestab(p : TNamedIndexItem);
  712. begin
  713. if tsym(p).typ = typesym then
  714. begin
  715. tstoredsym(p).isstabwritten:=false;
  716. tstoredsym(p).concatstabto(asmoutput);
  717. end;
  718. end;
  719. function tstoredsymtable.getnewtypecount : word;
  720. begin
  721. getnewtypecount:=pglobaltypecount^;
  722. inc(pglobaltypecount^);
  723. end;
  724. {$endif GDB}
  725. {$ifdef CHAINPROCSYMS}
  726. procedure chainprocsym(p : tsym);
  727. var
  728. storesymtablestack : tsymtable;
  729. srsym : tsym;
  730. srsymtable : tsymtable;
  731. begin
  732. if p.typ=procsym then
  733. begin
  734. storesymtablestack:=symtablestack;
  735. symtablestack:=p.owner.next;
  736. while assigned(symtablestack) do
  737. begin
  738. { search for same procsym in other units }
  739. searchsym(p.name,srsym,srsymtable)
  740. if assigned(srsym) and
  741. (srsym.typ=procsym) then
  742. begin
  743. tprocsym(p).nextprocsym:=tprocsym(srsym);
  744. symtablestack:=storesymtablestack;
  745. exit;
  746. end
  747. else if srsym=nil then
  748. symtablestack:=nil
  749. else
  750. symtablestack:=srsymtable.next;
  751. end;
  752. symtablestack:=storesymtablestack;
  753. end;
  754. end;
  755. {$endif}
  756. procedure tstoredsymtable.chainoperators;
  757. var
  758. p : tprocsym;
  759. t : ttoken;
  760. def : tprocdef;
  761. srsym : tsym;
  762. srsymtable,
  763. storesymtablestack : tsymtable;
  764. begin
  765. storesymtablestack:=symtablestack;
  766. symtablestack:=self;
  767. make_ref:=false;
  768. for t:=first_overloaded to last_overloaded do
  769. begin
  770. p:=nil;
  771. def:=nil;
  772. overloaded_operators[t]:=nil;
  773. { each operator has a unique lowercased internal name PM }
  774. while assigned(symtablestack) do
  775. begin
  776. searchsym(overloaded_names[t],srsym,srsymtable);
  777. if not assigned(srsym) then
  778. begin
  779. if (t=_STARSTAR) then
  780. begin
  781. symtablestack:=systemunit;
  782. searchsym('POWER',srsym,srsymtable);
  783. end;
  784. end;
  785. if assigned(srsym) then
  786. begin
  787. if (srsym.typ<>procsym) then
  788. internalerror(12344321);
  789. if assigned(p) then
  790. begin
  791. {$ifdef CHAINPROCSYMS}
  792. p.nextprocsym:=tprocsym(srsym);
  793. {$endif CHAINPROCSYMS}
  794. def.nextoverloaded:=tprocsym(srsym).definition;
  795. end
  796. else
  797. overloaded_operators[t]:=tprocsym(srsym);
  798. p:=tprocsym(srsym);
  799. def:=p.definition;
  800. while assigned(def.nextoverloaded) and
  801. (def.nextoverloaded.owner=p.owner) do
  802. def:=def.nextoverloaded;
  803. def.nextoverloaded:=nil;
  804. symtablestack:=srsym.owner.next;
  805. end
  806. else
  807. begin
  808. symtablestack:=nil;
  809. {$ifdef CHAINPROCSYMS}
  810. if assigned(p) then
  811. p.nextprocsym:=nil;
  812. {$endif CHAINPROCSYMS}
  813. end;
  814. { search for same procsym in other units }
  815. end;
  816. symtablestack:=self;
  817. end;
  818. make_ref:=true;
  819. symtablestack:=storesymtablestack;
  820. end;
  821. {***********************************************
  822. Process all entries
  823. ***********************************************}
  824. { checks, if all procsyms and methods are defined }
  825. procedure tstoredsymtable.check_forwards;
  826. begin
  827. foreach({$ifdef FPCPROCVAR}@{$endif}check_forward);
  828. end;
  829. procedure tstoredsymtable.checklabels;
  830. begin
  831. foreach({$ifdef FPCPROCVAR}@{$endif}labeldefined);
  832. end;
  833. procedure tstoredsymtable.set_alignment(_alignment : longint);
  834. var
  835. sym : tvarsym;
  836. l : longint;
  837. begin
  838. dataalignment:=_alignment;
  839. if (symtabletype<>parasymtable) then
  840. internalerror(1111);
  841. sym:=tvarsym(symindex.first);
  842. datasize:=0;
  843. { there can be only varsyms }
  844. while assigned(sym) do
  845. begin
  846. l:=sym.getpushsize;
  847. sym.address:=datasize;
  848. datasize:=align(datasize+l,dataalignment);
  849. sym:=tvarsym(sym.indexnext);
  850. end;
  851. end;
  852. procedure tstoredsymtable.allunitsused;
  853. begin
  854. foreach({$ifdef FPCPROCVAR}@{$endif}unitsymbolused);
  855. end;
  856. procedure tstoredsymtable.allsymbolsused;
  857. begin
  858. foreach({$ifdef FPCPROCVAR}@{$endif}varsymbolused);
  859. end;
  860. procedure tstoredsymtable.allprivatesused;
  861. begin
  862. foreach({$ifdef FPCPROCVAR}@{$endif}objectprivatesymbolused);
  863. end;
  864. {$ifdef CHAINPROCSYMS}
  865. procedure tstoredsymtable.chainprocsyms;
  866. begin
  867. foreach({$ifdef FPCPROCVAR}@{$endif}chainprocsym);
  868. end;
  869. {$endif CHAINPROCSYMS}
  870. {$ifdef GDB}
  871. procedure tstoredsymtable.concatstabto(asmlist : taasmoutput);
  872. begin
  873. asmoutput:=asmlist;
  874. if symtabletype in [inlineparasymtable,inlinelocalsymtable] then
  875. foreach({$ifdef FPCPROCVAR}@{$endif}resetstab);
  876. foreach({$ifdef FPCPROCVAR}@{$endif}concatstab);
  877. end;
  878. {$endif}
  879. {****************************************************************************
  880. TAbstractRecordSymtable
  881. ****************************************************************************}
  882. procedure tabstractrecordsymtable.load(ppufile:tcompilerppufile);
  883. var
  884. storesymtable : tsymtable;
  885. begin
  886. storesymtable:=aktrecordsymtable;
  887. aktrecordsymtable:=self;
  888. inherited load(ppufile);
  889. aktrecordsymtable:=storesymtable;
  890. end;
  891. procedure tabstractrecordsymtable.write(ppufile:tcompilerppufile);
  892. var
  893. oldtyp : byte;
  894. storesymtable : tsymtable;
  895. begin
  896. storesymtable:=aktrecordsymtable;
  897. aktrecordsymtable:=self;
  898. oldtyp:=ppufile.entrytyp;
  899. ppufile.entrytyp:=subentryid;
  900. { order procsym overloads }
  901. foreach({$ifdef FPCPROCVAR}@{$endif}Order_overloads);
  902. inherited write(ppufile);
  903. ppufile.entrytyp:=oldtyp;
  904. aktrecordsymtable:=storesymtable;
  905. end;
  906. procedure tabstractrecordsymtable.load_browser(ppufile:tcompilerppufile);
  907. var
  908. storesymtable : tsymtable;
  909. begin
  910. storesymtable:=aktrecordsymtable;
  911. aktrecordsymtable:=self;
  912. inherited load_browser(ppufile);
  913. aktrecordsymtable:=storesymtable;
  914. end;
  915. procedure tabstractrecordsymtable.write_browser(ppufile:tcompilerppufile);
  916. var
  917. storesymtable : tsymtable;
  918. begin
  919. storesymtable:=aktrecordsymtable;
  920. aktrecordsymtable:=self;
  921. inherited write_browser(ppufile);
  922. aktrecordsymtable:=storesymtable;
  923. end;
  924. procedure TStoredSymtable._needs_init_final(p : tnamedindexitem);
  925. begin
  926. if (not b_needs_init_final) and
  927. (tsym(p).typ=varsym) and
  928. assigned(tvarsym(p).vartype.def) and
  929. not is_class(tvarsym(p).vartype.def) and
  930. tstoreddef(tvarsym(p).vartype.def).needs_inittable then
  931. b_needs_init_final:=true;
  932. end;
  933. { returns true, if p contains data which needs init/final code }
  934. function tstoredsymtable.needs_init_final : boolean;
  935. begin
  936. b_needs_init_final:=false;
  937. foreach({$ifdef FPCPROCVAR}@{$endif}_needs_init_final);
  938. needs_init_final:=b_needs_init_final;
  939. end;
  940. {****************************************************************************
  941. TRecordSymtable
  942. ****************************************************************************}
  943. constructor trecordsymtable.create;
  944. begin
  945. inherited create('');
  946. symtabletype:=recordsymtable;
  947. end;
  948. { this procedure is reserved for inserting case variant into
  949. a record symtable }
  950. { the offset is the location of the start of the variant
  951. and datasize and dataalignment corresponds to
  952. the complete size (see code in pdecl unit) PM }
  953. procedure trecordsymtable.insert_in(tsymt : tsymtable;offset : longint);
  954. var
  955. ps,nps : tvarsym;
  956. pd,npd : tdef;
  957. storesize,storealign : longint;
  958. begin
  959. storesize:=tsymt.datasize;
  960. storealign:=tsymt.dataalignment;
  961. tsymt.datasize:=offset;
  962. ps:=tvarsym(symindex.first);
  963. while assigned(ps) do
  964. begin
  965. { this is used to insert case variant into the main
  966. record }
  967. tsymt.datasize:=ps.address+offset;
  968. nps:=tvarsym(ps.indexnext);
  969. symindex.deleteindex(ps);
  970. ps.left:=nil;
  971. ps.right:=nil;
  972. tsymt.insert(ps);
  973. ps:=nps;
  974. end;
  975. pd:=tdef(defindex.first);
  976. while assigned(pd) do
  977. begin
  978. npd:=tdef(pd.indexnext);
  979. defindex.deleteindex(pd);
  980. pd.left:=nil;
  981. pd.right:=nil;
  982. tsymt.registerdef(pd);
  983. pd:=npd;
  984. end;
  985. tsymt.datasize:=storesize;
  986. tsymt.dataalignment:=storealign;
  987. end;
  988. {****************************************************************************
  989. TObjectSymtable
  990. ****************************************************************************}
  991. constructor tobjectsymtable.create(const n:string);
  992. begin
  993. inherited create(n);
  994. symtabletype:=objectsymtable;
  995. end;
  996. procedure tobjectsymtable.insert(sym:tsymentry);
  997. var
  998. hsym : tsym;
  999. begin
  1000. { check for duplicate field id in inherited classes }
  1001. if (sym.typ=varsym) and
  1002. assigned(defowner) and
  1003. (
  1004. not(m_delphi in aktmodeswitches) or
  1005. is_object(tdef(defowner))
  1006. ) then
  1007. begin
  1008. { but private ids can be reused }
  1009. hsym:=search_class_member(tobjectdef(defowner),sym.name);
  1010. if assigned(hsym) and
  1011. (not(sp_private in hsym.symoptions) or
  1012. (hsym.owner.defowner.owner.unitid=0)) then
  1013. begin
  1014. DuplicateSym(hsym);
  1015. exit;
  1016. end;
  1017. end;
  1018. inherited insert(sym);
  1019. end;
  1020. {****************************************************************************
  1021. TAbstractLocalSymtable
  1022. ****************************************************************************}
  1023. procedure tabstractlocalsymtable.load(ppufile:tcompilerppufile);
  1024. var
  1025. storesymtable : tsymtable;
  1026. begin
  1027. storesymtable:=aktlocalsymtable;
  1028. aktlocalsymtable:=self;
  1029. inherited load(ppufile);
  1030. aktlocalsymtable:=storesymtable;
  1031. end;
  1032. procedure tabstractlocalsymtable.write(ppufile:tcompilerppufile);
  1033. var
  1034. oldtyp : byte;
  1035. storesymtable : tsymtable;
  1036. begin
  1037. storesymtable:=aktlocalsymtable;
  1038. aktlocalsymtable:=self;
  1039. oldtyp:=ppufile.entrytyp;
  1040. ppufile.entrytyp:=subentryid;
  1041. { order procsym overloads }
  1042. foreach({$ifdef FPCPROCVAR}@{$endif}Order_overloads);
  1043. { write definitions }
  1044. writedefs(ppufile);
  1045. { write symbols }
  1046. writesyms(ppufile);
  1047. ppufile.entrytyp:=oldtyp;
  1048. aktlocalsymtable:=storesymtable;
  1049. end;
  1050. procedure tabstractlocalsymtable.load_browser(ppufile:tcompilerppufile);
  1051. var
  1052. storesymtable : tsymtable;
  1053. begin
  1054. storesymtable:=aktlocalsymtable;
  1055. aktlocalsymtable:=self;
  1056. inherited load_browser(ppufile);
  1057. aktlocalsymtable:=storesymtable;
  1058. end;
  1059. procedure tabstractlocalsymtable.write_browser(ppufile:tcompilerppufile);
  1060. var
  1061. storesymtable : tsymtable;
  1062. begin
  1063. storesymtable:=aktlocalsymtable;
  1064. aktlocalsymtable:=self;
  1065. inherited load_browser(ppufile);
  1066. aktlocalsymtable:=storesymtable;
  1067. end;
  1068. {****************************************************************************
  1069. TLocalSymtable
  1070. ****************************************************************************}
  1071. constructor tlocalsymtable.create;
  1072. begin
  1073. inherited create('');
  1074. symtabletype:=localsymtable;
  1075. end;
  1076. procedure tlocalsymtable.insert(sym:tsymentry);
  1077. var
  1078. hsym : tsym;
  1079. begin
  1080. if assigned(next) then
  1081. begin
  1082. if (next.symtabletype=parasymtable) then
  1083. begin
  1084. hsym:=tsym(next.search(sym.name));
  1085. if assigned(hsym) then
  1086. begin
  1087. { a parameter and the function can have the same
  1088. name in TP and Delphi, but RESULT not }
  1089. if (m_tp in aktmodeswitches) and
  1090. (sym.typ=funcretsym) and
  1091. not((m_result in aktmodeswitches) and
  1092. (sym.name='RESULT')) then
  1093. sym.name:='hidden'+sym.name
  1094. else
  1095. begin
  1096. DuplicateSym(hsym);
  1097. exit;
  1098. end;
  1099. end;
  1100. end;
  1101. { check for duplicate id in local symtable of methods }
  1102. if assigned(next.next) and
  1103. { funcretsym is allowed !! }
  1104. (sym.typ <> funcretsym) and
  1105. (next.next.symtabletype=objectsymtable) then
  1106. begin
  1107. hsym:=search_class_member(tobjectdef(next.next.defowner),sym.name);
  1108. if assigned(hsym) and
  1109. { private ids can be reused }
  1110. (not(sp_private in hsym.symoptions) or
  1111. (hsym.owner.defowner.owner.symtabletype<>globalsymtable)) then
  1112. begin
  1113. { delphi allows to reuse the names in a class, but not
  1114. in object (tp7 compatible) }
  1115. if not((m_delphi in aktmodeswitches) and
  1116. is_class(tdef(next.next.defowner))) then
  1117. begin
  1118. DuplicateSym(hsym);
  1119. exit;
  1120. end;
  1121. end;
  1122. end;
  1123. end;
  1124. inherited insert(sym);
  1125. end;
  1126. {****************************************************************************
  1127. TParaSymtable
  1128. ****************************************************************************}
  1129. constructor tparasymtable.create;
  1130. begin
  1131. inherited create('');
  1132. symtabletype:=parasymtable;
  1133. dataalignment:=4;
  1134. end;
  1135. procedure tparasymtable.insert(sym:tsymentry);
  1136. var
  1137. hsym : tsym;
  1138. begin
  1139. { check for duplicate id in para symtable of methods }
  1140. if assigned(procinfo^._class) and
  1141. { but not in nested procedures !}
  1142. (not(assigned(procinfo^.parent)) or
  1143. (assigned(procinfo^.parent) and
  1144. not(assigned(procinfo^.parent^._class)))
  1145. ) and
  1146. { funcretsym is allowed !! }
  1147. (sym.typ <> funcretsym) then
  1148. begin
  1149. hsym:=search_class_member(procinfo^._class,sym.name);
  1150. if assigned(hsym) and
  1151. { private ids can be reused }
  1152. (not(sp_private in hsym.symoptions) or
  1153. (hsym.owner.defowner.owner.unitid=0)) then
  1154. begin
  1155. { delphi allows to reuse the names in a class, but not
  1156. in object (tp7 compatible) }
  1157. if not((m_delphi in aktmodeswitches) and
  1158. is_class(procinfo^._class)) then
  1159. begin
  1160. DuplicateSym(hsym);
  1161. exit;
  1162. end;
  1163. end;
  1164. end;
  1165. inherited insert(sym);
  1166. end;
  1167. {****************************************************************************
  1168. TAbstractUnitSymtable
  1169. ****************************************************************************}
  1170. constructor tabstractunitsymtable.create(const n : string);
  1171. begin
  1172. inherited create(n);
  1173. symsearch.usehash;
  1174. {$ifdef GDB}
  1175. { reset GDB things }
  1176. prev_dbx_counter := dbx_counter;
  1177. dbx_counter := nil;
  1178. is_stab_written:=false;
  1179. dbx_count := -1;
  1180. {$endif GDB}
  1181. end;
  1182. {$ifdef GDB}
  1183. procedure tabstractunitsymtable.concattypestabto(asmlist : taasmoutput);
  1184. var prev_dbx_count : plongint;
  1185. begin
  1186. if is_stab_written then
  1187. exit;
  1188. if not assigned(name) then
  1189. name := stringdup('Main_program');
  1190. if (symtabletype = globalsymtable) and
  1191. (current_module.globalsymtable<>self) then
  1192. begin
  1193. unitid:=current_module.unitcount;
  1194. inc(current_module.unitcount);
  1195. end;
  1196. asmList.concat(Tai_asm_comment.Create(strpnew('Begin unit '+name^+' has index '+tostr(unitid))));
  1197. if cs_gdb_dbx in aktglobalswitches then
  1198. begin
  1199. if dbx_count_ok then
  1200. begin
  1201. asmList.concat(Tai_asm_comment.Create(strpnew('"repeated" unit '+name^
  1202. +' has index '+tostr(unitid)+' dbx count = '+tostr(dbx_count))));
  1203. asmList.concat(Tai_stabs.Create(strpnew('"'+name^+'",'
  1204. +tostr(N_EXCL)+',0,0,'+tostr(dbx_count))));
  1205. exit;
  1206. end
  1207. else if (current_module.globalsymtable<>self) then
  1208. begin
  1209. prev_dbx_count := dbx_counter;
  1210. dbx_counter := nil;
  1211. do_count_dbx:=false;
  1212. if (symtabletype = globalsymtable) and (unitid<>0) then
  1213. asmList.concat(Tai_stabs.Create(strpnew('"'+name^+'",'+tostr(N_BINCL)+',0,0,0')));
  1214. dbx_counter := @dbx_count;
  1215. dbx_count:=0;
  1216. do_count_dbx:=assigned(dbx_counter);
  1217. end;
  1218. end;
  1219. asmoutput:=asmlist;
  1220. foreach({$ifdef FPCPROCVAR}@{$endif}concattypestab);
  1221. if cs_gdb_dbx in aktglobalswitches then
  1222. begin
  1223. if (current_module.globalsymtable<>self) then
  1224. begin
  1225. dbx_counter := prev_dbx_count;
  1226. do_count_dbx:=false;
  1227. asmList.concat(Tai_asm_comment.Create(strpnew('End unit '+name^
  1228. +' has index '+tostr(unitid))));
  1229. asmList.concat(Tai_stabs.Create(strpnew('"'+name^+'",'
  1230. +tostr(N_EINCL)+',0,0,0')));
  1231. do_count_dbx:=assigned(dbx_counter);
  1232. dbx_count_ok := {true}false;
  1233. end;
  1234. end;
  1235. is_stab_written:=true;
  1236. end;
  1237. {$endif GDB}
  1238. {****************************************************************************
  1239. TStaticSymtable
  1240. ****************************************************************************}
  1241. constructor tstaticsymtable.create(const n : string);
  1242. begin
  1243. inherited create(n);
  1244. symtabletype:=staticsymtable;
  1245. end;
  1246. procedure tstaticsymtable.load(ppufile:tcompilerppufile);
  1247. begin
  1248. aktstaticsymtable:=self;
  1249. next:=symtablestack;
  1250. symtablestack:=self;
  1251. inherited load(ppufile);
  1252. { now we can deref the syms and defs }
  1253. deref;
  1254. { restore symtablestack }
  1255. symtablestack:=next;
  1256. end;
  1257. procedure tstaticsymtable.write(ppufile:tcompilerppufile);
  1258. begin
  1259. aktstaticsymtable:=self;
  1260. { order procsym overloads }
  1261. foreach({$ifdef FPCPROCVAR}@{$endif}Order_overloads);
  1262. inherited write(ppufile);
  1263. end;
  1264. procedure tstaticsymtable.load_browser(ppufile:tcompilerppufile);
  1265. begin
  1266. aktstaticsymtable:=self;
  1267. inherited load_browser(ppufile);
  1268. end;
  1269. procedure tstaticsymtable.write_browser(ppufile:tcompilerppufile);
  1270. begin
  1271. aktstaticsymtable:=self;
  1272. inherited write_browser(ppufile);
  1273. end;
  1274. procedure tstaticsymtable.insert(sym:tsymentry);
  1275. var
  1276. hsym : tsym;
  1277. begin
  1278. { also check the global symtable }
  1279. if assigned(next) and
  1280. (next.unitid=0) then
  1281. begin
  1282. hsym:=tsym(next.search(sym.name));
  1283. if assigned(hsym) then
  1284. begin
  1285. DuplicateSym(hsym);
  1286. exit;
  1287. end;
  1288. end;
  1289. inherited insert(sym);
  1290. end;
  1291. {****************************************************************************
  1292. TGlobalSymtable
  1293. ****************************************************************************}
  1294. constructor tglobalsymtable.create(const n : string);
  1295. begin
  1296. inherited create(n);
  1297. symtabletype:=globalsymtable;
  1298. unitid:=0;
  1299. unitsym:=nil;
  1300. {$ifdef GDB}
  1301. if cs_gdb_dbx in aktglobalswitches then
  1302. begin
  1303. dbx_count := 0;
  1304. unittypecount:=1;
  1305. pglobaltypecount := @unittypecount;
  1306. unitid:=current_module.unitcount;
  1307. debugList.concat(Tai_asm_comment.Create(strpnew('Global '+name^+' has index '+tostr(unitid))));
  1308. debugList.concat(Tai_stabs.Create(strpnew('"'+name^+'",'+tostr(N_BINCL)+',0,0,0')));
  1309. inc(current_module.unitcount);
  1310. dbx_count_ok:=false;
  1311. dbx_counter:=@dbx_count;
  1312. do_count_dbx:=true;
  1313. end;
  1314. {$endif GDB}
  1315. end;
  1316. destructor tglobalsymtable.destroy;
  1317. var
  1318. pus : tunitsym;
  1319. begin
  1320. pus:=unitsym;
  1321. while assigned(pus) do
  1322. begin
  1323. unitsym:=pus.prevsym;
  1324. pus.prevsym:=nil;
  1325. pus.unitsymtable:=nil;
  1326. pus:=unitsym;
  1327. end;
  1328. inherited destroy;
  1329. end;
  1330. procedure tglobalsymtable.load(ppufile:tcompilerppufile);
  1331. {$ifdef GDB}
  1332. var
  1333. storeGlobalTypeCount : pword;
  1334. {$endif GDB}
  1335. begin
  1336. {$ifdef GDB}
  1337. if cs_gdb_dbx in aktglobalswitches then
  1338. begin
  1339. UnitTypeCount:=1;
  1340. storeGlobalTypeCount:=PGlobalTypeCount;
  1341. PglobalTypeCount:=@UnitTypeCount;
  1342. end;
  1343. {$endif GDB}
  1344. symtablelevel:=0;
  1345. {$ifndef NEWMAP}
  1346. current_module.map^[0]:=self;
  1347. {$else NEWMAP}
  1348. current_module.globalsymtable:=self;
  1349. {$endif NEWMAP}
  1350. next:=symtablestack;
  1351. symtablestack:=self;
  1352. inherited load(ppufile);
  1353. { now we can deref the syms and defs }
  1354. deref;
  1355. { restore symtablestack }
  1356. symtablestack:=next;
  1357. {$ifdef NEWMAP}
  1358. { necessary for dependencies }
  1359. current_module.globalsymtable:=nil;
  1360. {$endif NEWMAP}
  1361. end;
  1362. procedure tglobalsymtable.write(ppufile:tcompilerppufile);
  1363. begin
  1364. { order procsym overloads }
  1365. foreach({$ifdef FPCPROCVAR}@{$endif}Order_overloads);
  1366. { write the symtable entries }
  1367. inherited write(ppufile);
  1368. { write dbx count }
  1369. {$ifdef GDB}
  1370. if cs_gdb_dbx in aktglobalswitches then
  1371. begin
  1372. {$IfDef EXTDEBUG}
  1373. writeln('Writing dbx_count ',dbx_count,' in unit ',name^,'.ppu');
  1374. {$ENDIF EXTDEBUG}
  1375. ppufile.do_crc:=false;
  1376. ppufile.putlongint(dbx_count);
  1377. ppufile.writeentry(ibdbxcount);
  1378. ppufile.do_crc:=true;
  1379. end;
  1380. {$endif GDB}
  1381. end;
  1382. {$ifdef GDB}
  1383. function tglobalsymtable.getnewtypecount : word;
  1384. begin
  1385. if not (cs_gdb_dbx in aktglobalswitches) then
  1386. getnewtypecount:=inherited getnewtypecount
  1387. else
  1388. begin
  1389. getnewtypecount:=unittypecount;
  1390. inc(unittypecount);
  1391. end;
  1392. end;
  1393. {$endif}
  1394. {****************************************************************************
  1395. TWITHSYMTABLE
  1396. ****************************************************************************}
  1397. constructor twithsymtable.create(aowner:tdef;asymsearch:TDictionary);
  1398. begin
  1399. inherited create('');
  1400. symtabletype:=withsymtable;
  1401. direct_with:=false;
  1402. withnode:=nil;
  1403. withrefnode:=nil;
  1404. { we don't need the symsearch }
  1405. symsearch.free;
  1406. { set the defaults }
  1407. symsearch:=asymsearch;
  1408. defowner:=aowner;
  1409. end;
  1410. destructor twithsymtable.destroy;
  1411. begin
  1412. symsearch:=nil;
  1413. inherited destroy;
  1414. end;
  1415. procedure twithsymtable.clear;
  1416. begin
  1417. { remove no entry from a withsymtable as it is only a pointer to the
  1418. recorddef or objectdef symtable }
  1419. end;
  1420. {****************************************************************************
  1421. TSTT_ExceptionSymtable
  1422. ****************************************************************************}
  1423. constructor tstt_exceptsymtable.create;
  1424. begin
  1425. inherited create('');
  1426. symtabletype:=stt_exceptsymtable;
  1427. end;
  1428. {*****************************************************************************
  1429. Helper Routines
  1430. *****************************************************************************}
  1431. function findunitsymtable(st:tsymtable):tsymtable;
  1432. begin
  1433. findunitsymtable:=nil;
  1434. repeat
  1435. if not assigned(st) then
  1436. internalerror(5566561);
  1437. case st.symtabletype of
  1438. localsymtable,
  1439. parasymtable,
  1440. staticsymtable :
  1441. break;
  1442. globalsymtable :
  1443. begin
  1444. findunitsymtable:=st;
  1445. break;
  1446. end;
  1447. objectsymtable,
  1448. recordsymtable :
  1449. st:=st.defowner.owner;
  1450. else
  1451. internalerror(5566562);
  1452. end;
  1453. until false;
  1454. end;
  1455. procedure duplicatesym(sym:tsym);
  1456. var
  1457. st : tsymtable;
  1458. begin
  1459. Message1(sym_e_duplicate_id,sym.realname);
  1460. st:=findunitsymtable(sym.owner);
  1461. with sym.fileinfo do
  1462. begin
  1463. if assigned(st) and (st.unitid<>0) then
  1464. Message2(sym_h_duplicate_id_where,'unit '+st.name^,tostr(line))
  1465. else
  1466. Message2(sym_h_duplicate_id_where,current_module.sourcefiles.get_file_name(fileindex),tostr(line));
  1467. end;
  1468. end;
  1469. {*****************************************************************************
  1470. Search
  1471. *****************************************************************************}
  1472. function searchsym(const s : stringid;var srsym:tsym;var srsymtable:tsymtable):boolean;
  1473. var
  1474. speedvalue : cardinal;
  1475. begin
  1476. speedvalue:=getspeedvalue(s);
  1477. srsymtable:=symtablestack;
  1478. while assigned(srsymtable) do
  1479. begin
  1480. srsym:=tsym(srsymtable.speedsearch(s,speedvalue));
  1481. if assigned(srsym) then
  1482. begin
  1483. searchsym:=true;
  1484. exit;
  1485. end
  1486. else
  1487. srsymtable:=srsymtable.next;
  1488. end;
  1489. searchsym:=false;
  1490. end;
  1491. function searchsymonlyin(p : tsymtable;const s : stringid):tsym;
  1492. var
  1493. srsym : tsym;
  1494. begin
  1495. { the caller have to take care if srsym=nil }
  1496. if assigned(p) then
  1497. begin
  1498. srsym:=tsym(p.search(s));
  1499. if assigned(srsym) then
  1500. begin
  1501. searchsymonlyin:=srsym;
  1502. exit;
  1503. end;
  1504. { also check in the local symtbale if it exists }
  1505. if (p=tsymtable(current_module.globalsymtable)) then
  1506. begin
  1507. srsym:=tsym(current_module.localsymtable.search(s));
  1508. if assigned(srsym) then
  1509. begin
  1510. searchsymonlyin:=srsym;
  1511. exit;
  1512. end;
  1513. end
  1514. end;
  1515. searchsymonlyin:=nil;
  1516. end;
  1517. function search_class_member(pd : tobjectdef;const s : string):tsym;
  1518. { searches n in symtable of pd and all anchestors }
  1519. var
  1520. speedvalue : cardinal;
  1521. srsym : tsym;
  1522. begin
  1523. speedvalue:=getspeedvalue(s);
  1524. while assigned(pd) do
  1525. begin
  1526. srsym:=tsym(pd.symtable.speedsearch(s,speedvalue));
  1527. if assigned(srsym) then
  1528. begin
  1529. search_class_member:=srsym;
  1530. exit;
  1531. end;
  1532. pd:=pd.childof;
  1533. end;
  1534. search_class_member:=nil;
  1535. end;
  1536. {*****************************************************************************
  1537. Definition Helpers
  1538. *****************************************************************************}
  1539. procedure globaldef(const s : string;var t:ttype);
  1540. var st : string;
  1541. symt : tsymtable;
  1542. srsym : tsym;
  1543. srsymtable : tsymtable;
  1544. begin
  1545. srsym := nil;
  1546. if pos('.',s) > 0 then
  1547. begin
  1548. st := copy(s,1,pos('.',s)-1);
  1549. searchsym(st,srsym,srsymtable);
  1550. st := copy(s,pos('.',s)+1,255);
  1551. if assigned(srsym) then
  1552. begin
  1553. if srsym.typ = unitsym then
  1554. begin
  1555. symt := tunitsym(srsym).unitsymtable;
  1556. srsym := tsym(symt.search(st));
  1557. end else srsym := nil;
  1558. end;
  1559. end else st := s;
  1560. if srsym = nil then
  1561. searchsym(st,srsym,srsymtable);
  1562. if srsym = nil then
  1563. srsym:=searchsymonlyin(systemunit,st);
  1564. if (not assigned(srsym)) or
  1565. (srsym.typ<>typesym) then
  1566. begin
  1567. Message(type_e_type_id_expected);
  1568. t:=generrortype;
  1569. exit;
  1570. end;
  1571. t := ttypesym(srsym).restype;
  1572. end;
  1573. {****************************************************************************
  1574. Object Helpers
  1575. ****************************************************************************}
  1576. var
  1577. _defaultprop : tpropertysym;
  1578. procedure tstoredsymtable.testfordefaultproperty(p : TNamedIndexItem);
  1579. begin
  1580. if (tsym(p).typ=propertysym) and
  1581. (ppo_defaultproperty in tpropertysym(p).propoptions) then
  1582. _defaultprop:=tpropertysym(p);
  1583. end;
  1584. function search_default_property(pd : tobjectdef) : tpropertysym;
  1585. { returns the default property of a class, searches also anchestors }
  1586. begin
  1587. _defaultprop:=nil;
  1588. while assigned(pd) do
  1589. begin
  1590. pd.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}tstoredsymtable(pd.symtable).testfordefaultproperty);
  1591. if assigned(_defaultprop) then
  1592. break;
  1593. pd:=pd.childof;
  1594. end;
  1595. search_default_property:=_defaultprop;
  1596. end;
  1597. {$ifdef UNITALIASES}
  1598. {****************************************************************************
  1599. TUNIT_ALIAS
  1600. ****************************************************************************}
  1601. constructor tunit_alias.create(const n:string);
  1602. var
  1603. i : longint;
  1604. begin
  1605. i:=pos('=',n);
  1606. if i=0 then
  1607. fail;
  1608. inherited createname(Copy(n,1,i-1));
  1609. newname:=stringdup(Copy(n,i+1,255));
  1610. end;
  1611. destructor tunit_alias.destroy;
  1612. begin
  1613. stringdispose(newname);
  1614. inherited destroy;
  1615. end;
  1616. procedure addunitalias(const n:string);
  1617. begin
  1618. unitaliases^.insert(tunit_alias,init(Upper(n))));
  1619. end;
  1620. function getunitalias(const n:string):string;
  1621. var
  1622. p : punit_alias;
  1623. begin
  1624. p:=punit_alias(unitaliases^.search(Upper(n)));
  1625. if assigned(p) then
  1626. getunitalias:=punit_alias(p).newname^
  1627. else
  1628. getunitalias:=n;
  1629. end;
  1630. {$endif UNITALIASES}
  1631. {****************************************************************************
  1632. Symtable Stack
  1633. ****************************************************************************}
  1634. procedure dellexlevel;
  1635. var
  1636. p : tsymtable;
  1637. begin
  1638. p:=symtablestack;
  1639. symtablestack:=p.next;
  1640. { symbol tables of unit interfaces are never disposed }
  1641. { this is handle by the unit unitm }
  1642. if not(p.symtabletype in [globalsymtable,stt_exceptsymtable]) then
  1643. p.free;
  1644. end;
  1645. procedure RestoreUnitSyms;
  1646. var
  1647. p : tsymtable;
  1648. begin
  1649. p:=symtablestack;
  1650. while assigned(p) do
  1651. begin
  1652. if (p.symtabletype=globalsymtable) and
  1653. assigned(tglobalsymtable(p).unitsym) and
  1654. ((tglobalsymtable(p).unitsym.owner=current_module.globalsymtable) or
  1655. (tglobalsymtable(p).unitsym.owner=current_module.localsymtable)) then
  1656. tglobalsymtable(p).unitsym.restoreunitsym;
  1657. p:=p.next;
  1658. end;
  1659. end;
  1660. {$ifdef DEBUG}
  1661. procedure test_symtablestack;
  1662. var
  1663. p : tsymtable;
  1664. i : longint;
  1665. begin
  1666. p:=symtablestack;
  1667. i:=0;
  1668. while assigned(p) do
  1669. begin
  1670. inc(i);
  1671. p:=p.next;
  1672. if i>500 then
  1673. Message(sym_f_internal_error_in_symtablestack);
  1674. end;
  1675. end;
  1676. procedure list_symtablestack;
  1677. var
  1678. p : tsymtable;
  1679. i : longint;
  1680. begin
  1681. p:=symtablestack;
  1682. i:=0;
  1683. while assigned(p) do
  1684. begin
  1685. inc(i);
  1686. writeln(i,' ',p.name^);
  1687. p:=p.next;
  1688. if i>500 then
  1689. Message(sym_f_internal_error_in_symtablestack);
  1690. end;
  1691. end;
  1692. {$endif DEBUG}
  1693. {****************************************************************************
  1694. Init/Done Symtable
  1695. ****************************************************************************}
  1696. procedure InitSymtable;
  1697. var
  1698. token : ttoken;
  1699. begin
  1700. { Reset symbolstack }
  1701. registerdef:=false;
  1702. read_member:=false;
  1703. symtablestack:=nil;
  1704. systemunit:=nil;
  1705. {$ifdef GDB}
  1706. firstglobaldef:=nil;
  1707. lastglobaldef:=nil;
  1708. globaltypecount:=1;
  1709. pglobaltypecount:=@globaltypecount;
  1710. {$endif GDB}
  1711. { create error syms and def }
  1712. generrorsym:=terrorsym.create;
  1713. generrortype.setdef(terrordef.create);
  1714. {$ifdef UNITALIASES}
  1715. { unit aliases }
  1716. unitaliases:=tdictionary.create;
  1717. {$endif}
  1718. for token:=first_overloaded to last_overloaded do
  1719. overloaded_operators[token]:=nil;
  1720. end;
  1721. procedure DoneSymtable;
  1722. begin
  1723. generrorsym.free;
  1724. generrortype.def.free;
  1725. {$ifdef UNITALIASES}
  1726. unitaliases.free;
  1727. {$endif}
  1728. end;
  1729. end.
  1730. {
  1731. $Log$
  1732. Revision 1.36 2001-06-03 21:57:38 peter
  1733. + hint directive parsing support
  1734. Revision 1.35 2001/05/06 14:49:18 peter
  1735. * ppu object to class rewrite
  1736. * move ppu read and write stuff to fppu
  1737. Revision 1.34 2001/04/18 22:01:59 peter
  1738. * registration of targets and assemblers
  1739. Revision 1.33 2001/04/13 20:05:15 peter
  1740. * better check for globalsymtable
  1741. Revision 1.32 2001/04/13 18:08:37 peter
  1742. * scanner object to class
  1743. Revision 1.31 2001/04/13 01:22:16 peter
  1744. * symtable change to classes
  1745. * range check generation and errors fixed, make cycle DEBUG=1 works
  1746. * memory leaks fixed
  1747. Revision 1.30 2001/04/02 21:20:35 peter
  1748. * resulttype rewrite
  1749. Revision 1.29 2001/03/22 00:10:58 florian
  1750. + basic variant type support in the compiler
  1751. Revision 1.28 2001/03/13 18:45:07 peter
  1752. * fixed some memory leaks
  1753. Revision 1.27 2001/03/11 22:58:51 peter
  1754. * getsym redesign, removed the globals srsym,srsymtable
  1755. Revision 1.26 2001/02/21 19:37:19 peter
  1756. * moved deref to be done after loading of implementation units. prederef
  1757. is still done directly after loading of symbols and definitions.
  1758. Revision 1.25 2001/02/20 21:41:16 peter
  1759. * new fixfilename, findfile for unix. Look first for lowercase, then
  1760. NormalCase and last for UPPERCASE names.
  1761. Revision 1.24 2001/01/08 21:40:27 peter
  1762. * fixed crash with unsupported token overloading
  1763. Revision 1.23 2000/12/25 00:07:30 peter
  1764. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  1765. tlinkedlist objects)
  1766. Revision 1.22 2000/12/23 19:50:09 peter
  1767. * fixed mem leak with withsymtable
  1768. Revision 1.21 2000/12/10 20:25:32 peter
  1769. * fixed missing typecast
  1770. Revision 1.20 2000/12/10 14:14:51 florian
  1771. * fixed web bug 1203: class fields can be now redefined
  1772. in Delphi mode though I don't like this :/
  1773. Revision 1.19 2000/11/30 22:16:49 florian
  1774. * moved to i386
  1775. Revision 1.18 2000/11/29 00:30:42 florian
  1776. * unused units removed from uses clause
  1777. * some changes for widestrings
  1778. Revision 1.17 2000/11/28 00:28:07 pierre
  1779. * stabs fixing
  1780. Revision 1.1.2.8 2000/11/17 11:14:37 pierre
  1781. * one more class stabs fix
  1782. Revision 1.16 2000/11/12 22:17:47 peter
  1783. * some realname updates for messages
  1784. Revision 1.15 2000/11/06 15:54:15 florian
  1785. * fixed two bugs to get make cycle work, but it's not enough
  1786. Revision 1.14 2000/11/04 14:25:22 florian
  1787. + merged Attila's changes for interfaces, not tested yet
  1788. Revision 1.13 2000/11/01 23:04:38 peter
  1789. * tprocdef.fullprocname added for better casesensitve writing of
  1790. procedures
  1791. Revision 1.12 2000/10/31 22:02:52 peter
  1792. * symtable splitted, no real code changes
  1793. Revision 1.1.2.7 2000/10/16 19:43:04 pierre
  1794. * trying to correct class stabss once more
  1795. Revision 1.11 2000/10/15 07:47:53 peter
  1796. * unit names and procedure names are stored mixed case
  1797. Revision 1.10 2000/10/14 10:14:53 peter
  1798. * moehrendorf oct 2000 rewrite
  1799. Revision 1.9 2000/10/01 19:48:25 peter
  1800. * lot of compile updates for cg11
  1801. Revision 1.8 2000/09/24 15:06:29 peter
  1802. * use defines.inc
  1803. Revision 1.7 2000/08/27 16:11:54 peter
  1804. * moved some util functions from globals,cobjects to cutils
  1805. * splitted files into finput,fmodule
  1806. Revision 1.6 2000/08/21 11:27:45 pierre
  1807. * fix the stabs problems
  1808. Revision 1.5 2000/08/20 14:58:41 peter
  1809. * give fatal if objfpc/delphi mode things are found (merged)
  1810. Revision 1.1.2.6 2000/08/20 14:56:46 peter
  1811. * give fatal if objfpc/delphi mode things are found
  1812. Revision 1.4 2000/08/16 18:33:54 peter
  1813. * splitted namedobjectitem.next into indexnext and listnext so it
  1814. can be used in both lists
  1815. * don't allow "word = word" type definitions (merged)
  1816. Revision 1.3 2000/08/08 19:28:57 peter
  1817. * memdebug/memory patches (merged)
  1818. * only once illegal directive (merged)
  1819. }