symtable.pas 68 KB

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