symtable.pas 67 KB

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