hcgdata.pas 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl
  4. Routines for the code generation of data structures
  5. like VMT, Messages, VTables, Interfaces descs
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. ****************************************************************************
  18. }
  19. unit hcgdata;
  20. {$i defines.inc}
  21. interface
  22. uses
  23. cutils,cclasses,
  24. symdef,aasm;
  25. type
  26. pprocdeftree = ^tprocdeftree;
  27. tprocdeftree = record
  28. data : tprocdef;
  29. nl : tasmlabel;
  30. l,r : pprocdeftree;
  31. end;
  32. pprocdefcoll = ^tprocdefcoll;
  33. tprocdefcoll = record
  34. data : tprocdef;
  35. next : pprocdefcoll;
  36. end;
  37. psymcoll = ^tsymcoll;
  38. tsymcoll = record
  39. name : pstring;
  40. data : pprocdefcoll;
  41. next : psymcoll;
  42. end;
  43. tclassheader=class
  44. private
  45. _Class : tobjectdef;
  46. count : integer;
  47. private
  48. { message tables }
  49. root : pprocdeftree;
  50. procedure disposeprocdeftree(p : pprocdeftree);
  51. procedure insertmsgint(p : tnamedindexitem);
  52. procedure insertmsgstr(p : tnamedindexitem);
  53. procedure insertint(p : pprocdeftree;var at : pprocdeftree);
  54. procedure insertstr(p : pprocdeftree;var at : pprocdeftree);
  55. procedure writenames(p : pprocdeftree);
  56. procedure writeintentry(p : pprocdeftree);
  57. procedure writestrentry(p : pprocdeftree);
  58. {$ifdef WITHDMT}
  59. private
  60. { dmt }
  61. procedure insertdmtentry(p : tnamedindexitem);
  62. procedure writedmtindexentry(p : pprocdeftree);
  63. procedure writedmtaddressentry(p : pprocdeftree);
  64. {$endif}
  65. private
  66. { published methods }
  67. procedure do_count(p : tnamedindexitem);
  68. procedure genpubmethodtableentry(p : tnamedindexitem);
  69. private
  70. { vmt }
  71. wurzel : psymcoll;
  72. nextvirtnumber : integer;
  73. has_constructor,
  74. has_virtual_method : boolean;
  75. procedure eachsym(sym : tnamedindexitem);
  76. procedure disposevmttree;
  77. private
  78. { interface tables }
  79. function gintfgetvtbllabelname(intfindex: integer): string;
  80. procedure gintfcreatevtbl(intfindex: integer; rawdata,rawcode: TAAsmoutput);
  81. procedure gintfgenentry(intfindex, contintfindex: integer; rawdata: TAAsmoutput);
  82. procedure gintfoptimizevtbls(implvtbl : plongint);
  83. procedure gintfwritedata;
  84. function gintfgetcprocdef(proc: tprocdef;const name: string): tprocdef;
  85. procedure gintfdoonintf(intf: tobjectdef; intfindex: longint);
  86. procedure gintfwalkdowninterface(intf: tobjectdef; intfindex: longint);
  87. public
  88. constructor create(c:tobjectdef);
  89. { generates the message tables for a class }
  90. function genstrmsgtab : tasmlabel;
  91. function genintmsgtab : tasmlabel;
  92. function genpublishedmethodstable : tasmlabel;
  93. {$ifdef WITHDMT}
  94. { generates a DMT for _class }
  95. function gendmt : tasmlabel;
  96. {$endif WITHDMT}
  97. { generates a VMT for _class }
  98. procedure genvmt(list : TAAsmoutput);
  99. { interfaces }
  100. function genintftable: tasmlabel;
  101. procedure writevmt;
  102. procedure writeinterfaceids;
  103. end;
  104. implementation
  105. uses
  106. {$ifdef delphi}
  107. sysutils,
  108. {$else}
  109. strings,
  110. {$endif}
  111. globtype,globals,verbose,
  112. symtable,symconst,symtype,symsym,types,
  113. {$ifdef GDB}
  114. gdb,
  115. {$endif GDB}
  116. systems
  117. {$ifdef i386}
  118. ,n386ic
  119. {$endif}
  120. ;
  121. {*****************************************************************************
  122. TClassHeader
  123. *****************************************************************************}
  124. constructor tclassheader.create(c:tobjectdef);
  125. begin
  126. inherited Create;
  127. _Class:=c;
  128. end;
  129. {**************************************
  130. Message Tables
  131. **************************************}
  132. procedure tclassheader.disposeprocdeftree(p : pprocdeftree);
  133. begin
  134. if assigned(p^.l) then
  135. disposeprocdeftree(p^.l);
  136. if assigned(p^.r) then
  137. disposeprocdeftree(p^.r);
  138. dispose(p);
  139. end;
  140. procedure tclassheader.insertint(p : pprocdeftree;var at : pprocdeftree);
  141. begin
  142. if at=nil then
  143. begin
  144. at:=p;
  145. inc(count);
  146. end
  147. else
  148. begin
  149. if p^.data.messageinf.i<at^.data.messageinf.i then
  150. insertint(p,at^.l)
  151. else if p^.data.messageinf.i>at^.data.messageinf.i then
  152. insertint(p,at^.r)
  153. else
  154. Message1(parser_e_duplicate_message_label,tostr(p^.data.messageinf.i));
  155. end;
  156. end;
  157. procedure tclassheader.insertstr(p : pprocdeftree;var at : pprocdeftree);
  158. var
  159. i : integer;
  160. begin
  161. if at=nil then
  162. begin
  163. at:=p;
  164. inc(count);
  165. end
  166. else
  167. begin
  168. i:=strcomp(p^.data.messageinf.str,at^.data.messageinf.str);
  169. if i<0 then
  170. insertstr(p,at^.l)
  171. else if i>0 then
  172. insertstr(p,at^.r)
  173. else
  174. Message1(parser_e_duplicate_message_label,strpas(p^.data.messageinf.str));
  175. end;
  176. end;
  177. procedure tclassheader.insertmsgint(p : tnamedindexitem);
  178. var
  179. hp : tprocdef;
  180. pt : pprocdeftree;
  181. begin
  182. if tsym(p).typ=procsym then
  183. begin
  184. hp:=tprocsym(p).definition;
  185. while assigned(hp) do
  186. begin
  187. if (po_msgint in hp.procoptions) then
  188. begin
  189. new(pt);
  190. pt^.data:=hp;
  191. pt^.l:=nil;
  192. pt^.r:=nil;
  193. insertint(pt,root);
  194. end;
  195. hp:=hp.nextoverloaded;
  196. end;
  197. end;
  198. end;
  199. procedure tclassheader.insertmsgstr(p : tnamedindexitem);
  200. var
  201. hp : tprocdef;
  202. pt : pprocdeftree;
  203. begin
  204. if tsym(p).typ=procsym then
  205. begin
  206. hp:=tprocsym(p).definition;
  207. while assigned(hp) do
  208. begin
  209. if (po_msgstr in hp.procoptions) then
  210. begin
  211. new(pt);
  212. pt^.data:=hp;
  213. pt^.l:=nil;
  214. pt^.r:=nil;
  215. insertstr(pt,root);
  216. end;
  217. hp:=hp.nextoverloaded;
  218. end;
  219. end;
  220. end;
  221. procedure tclassheader.writenames(p : pprocdeftree);
  222. begin
  223. getdatalabel(p^.nl);
  224. if assigned(p^.l) then
  225. writenames(p^.l);
  226. dataSegment.concat(Tai_label.Create(p^.nl));
  227. dataSegment.concat(Tai_const.Create_8bit(strlen(p^.data.messageinf.str)));
  228. dataSegment.concat(Tai_string.Create_pchar(p^.data.messageinf.str));
  229. if assigned(p^.r) then
  230. writenames(p^.r);
  231. end;
  232. procedure tclassheader.writestrentry(p : pprocdeftree);
  233. begin
  234. if assigned(p^.l) then
  235. writestrentry(p^.l);
  236. { write name label }
  237. dataSegment.concat(Tai_const_symbol.Create(p^.nl));
  238. dataSegment.concat(Tai_const_symbol.Createname(p^.data.mangledname));
  239. if assigned(p^.r) then
  240. writestrentry(p^.r);
  241. end;
  242. function tclassheader.genstrmsgtab : tasmlabel;
  243. var
  244. r : tasmlabel;
  245. begin
  246. root:=nil;
  247. count:=0;
  248. { insert all message handlers into a tree, sorted by name }
  249. _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}insertmsgstr);
  250. { write all names }
  251. if assigned(root) then
  252. writenames(root);
  253. { now start writing of the message string table }
  254. getdatalabel(r);
  255. dataSegment.concat(Tai_label.Create(r));
  256. genstrmsgtab:=r;
  257. dataSegment.concat(Tai_const.Create_32bit(count));
  258. if assigned(root) then
  259. begin
  260. writestrentry(root);
  261. disposeprocdeftree(root);
  262. end;
  263. end;
  264. procedure tclassheader.writeintentry(p : pprocdeftree);
  265. begin
  266. if assigned(p^.l) then
  267. writeintentry(p^.l);
  268. { write name label }
  269. dataSegment.concat(Tai_const.Create_32bit(p^.data.messageinf.i));
  270. dataSegment.concat(Tai_const_symbol.Createname(p^.data.mangledname));
  271. if assigned(p^.r) then
  272. writeintentry(p^.r);
  273. end;
  274. function tclassheader.genintmsgtab : tasmlabel;
  275. var
  276. r : tasmlabel;
  277. begin
  278. root:=nil;
  279. count:=0;
  280. { insert all message handlers into a tree, sorted by name }
  281. _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}insertmsgint);
  282. { now start writing of the message string table }
  283. getdatalabel(r);
  284. dataSegment.concat(Tai_label.Create(r));
  285. genintmsgtab:=r;
  286. dataSegment.concat(Tai_const.Create_32bit(count));
  287. if assigned(root) then
  288. begin
  289. writeintentry(root);
  290. disposeprocdeftree(root);
  291. end;
  292. end;
  293. {$ifdef WITHDMT}
  294. {**************************************
  295. DMT
  296. **************************************}
  297. procedure tclassheader.insertdmtentry(p : tnamedindexitem);
  298. var
  299. hp : tprocdef;
  300. pt : pprocdeftree;
  301. begin
  302. if tsym(p).typ=procsym then
  303. begin
  304. hp:=tprocsym(p).definition;
  305. while assigned(hp) do
  306. begin
  307. if (po_msgint in hp.procoptions) then
  308. begin
  309. new(pt);
  310. pt^.p:=hp;
  311. pt^.l:=nil;
  312. pt^.r:=nil;
  313. insertint(pt,root);
  314. end;
  315. hp:=hp.nextoverloaded;
  316. end;
  317. end;
  318. end;
  319. procedure tclassheader.writedmtindexentry(p : pprocdeftree);
  320. begin
  321. if assigned(p^.l) then
  322. writedmtindexentry(p^.l);
  323. dataSegment.concat(Tai_const.Create_32bit(p^.data.messageinf.i));
  324. if assigned(p^.r) then
  325. writedmtindexentry(p^.r);
  326. end;
  327. procedure tclassheader.writedmtaddressentry(p : pprocdeftree);
  328. begin
  329. if assigned(p^.l) then
  330. writedmtaddressentry(p^.l);
  331. dataSegment.concat(Tai_const_symbol.Createname(p^.data.mangledname));
  332. if assigned(p^.r) then
  333. writedmtaddressentry(p^.r);
  334. end;
  335. function tclassheader.gendmt : tasmlabel;
  336. var
  337. r : tasmlabel;
  338. begin
  339. root:=nil;
  340. count:=0;
  341. gendmt:=nil;
  342. { insert all message handlers into a tree, sorted by number }
  343. _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}insertdmtentry);
  344. if count>0 then
  345. begin
  346. getdatalabel(r);
  347. gendmt:=r;
  348. dataSegment.concat(Tai_label.Create(r));
  349. { entries for caching }
  350. dataSegment.concat(Tai_const.Create_32bit(0));
  351. dataSegment.concat(Tai_const.Create_32bit(0));
  352. dataSegment.concat(Tai_const.Create_32bit(count));
  353. if assigned(root) then
  354. begin
  355. writedmtindexentry(root);
  356. writedmtaddressentry(root);
  357. disposeprocdeftree(root);
  358. end;
  359. end;
  360. end;
  361. {$endif WITHDMT}
  362. {**************************************
  363. Published Methods
  364. **************************************}
  365. procedure tclassheader.do_count(p : tnamedindexitem);
  366. begin
  367. if (tsym(p).typ=procsym) and (sp_published in tsym(p).symoptions) then
  368. inc(count);
  369. end;
  370. procedure tclassheader.genpubmethodtableentry(p : tnamedindexitem);
  371. var
  372. hp : tprocdef;
  373. l : tasmlabel;
  374. begin
  375. if (tsym(p).typ=procsym) and (sp_published in tsym(p).symoptions) then
  376. begin
  377. hp:=tprocsym(p).definition;
  378. if assigned(hp.nextoverloaded) then
  379. internalerror(1209992);
  380. getdatalabel(l);
  381. Consts.concat(Tai_label.Create(l));
  382. Consts.concat(Tai_const.Create_8bit(length(p.name)));
  383. Consts.concat(Tai_string.Create(p.name));
  384. dataSegment.concat(Tai_const_symbol.Create(l));
  385. dataSegment.concat(Tai_const_symbol.Createname(hp.mangledname));
  386. end;
  387. end;
  388. function tclassheader.genpublishedmethodstable : tasmlabel;
  389. var
  390. l : tasmlabel;
  391. begin
  392. count:=0;
  393. _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}do_count);
  394. if count>0 then
  395. begin
  396. getdatalabel(l);
  397. dataSegment.concat(Tai_label.Create(l));
  398. dataSegment.concat(Tai_const.Create_32bit(count));
  399. _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}genpubmethodtableentry);
  400. genpublishedmethodstable:=l;
  401. end
  402. else
  403. genpublishedmethodstable:=nil;
  404. end;
  405. {**************************************
  406. VMT
  407. **************************************}
  408. procedure tclassheader.eachsym(sym : tnamedindexitem);
  409. var
  410. procdefcoll : pprocdefcoll;
  411. hp : tprocdef;
  412. symcoll : psymcoll;
  413. _name : string;
  414. stored : boolean;
  415. { creates a new entry in the procsym list }
  416. procedure newentry;
  417. begin
  418. { if not, generate a new symbol item }
  419. new(symcoll);
  420. symcoll^.name:=stringdup(sym.name);
  421. symcoll^.next:=wurzel;
  422. symcoll^.data:=nil;
  423. wurzel:=symcoll;
  424. hp:=tprocsym(sym).definition;
  425. { inserts all definitions }
  426. while assigned(hp) do
  427. begin
  428. new(procdefcoll);
  429. procdefcoll^.data:=hp;
  430. procdefcoll^.next:=symcoll^.data;
  431. symcoll^.data:=procdefcoll;
  432. { if it's a virtual method }
  433. if (po_virtualmethod in hp.procoptions) then
  434. begin
  435. { then it gets a number ... }
  436. hp.extnumber:=nextvirtnumber;
  437. { and we inc the number }
  438. inc(nextvirtnumber);
  439. has_virtual_method:=true;
  440. end;
  441. if (hp.proctypeoption=potype_constructor) then
  442. has_constructor:=true;
  443. { check, if a method should be overridden }
  444. if (po_overridingmethod in hp.procoptions) then
  445. MessagePos1(hp.fileinfo,parser_e_nothing_to_be_overridden,_class.objname^+'.'+_name+hp.demangled_paras);
  446. { next overloaded method }
  447. hp:=hp.nextoverloaded;
  448. end;
  449. end;
  450. procedure newdefentry;
  451. begin
  452. new(procdefcoll);
  453. procdefcoll^.data:=hp;
  454. procdefcoll^.next:=symcoll^.data;
  455. symcoll^.data:=procdefcoll;
  456. { if it's a virtual method }
  457. if (po_virtualmethod in hp.procoptions) then
  458. begin
  459. { then it gets a number ... }
  460. hp.extnumber:=nextvirtnumber;
  461. { and we inc the number }
  462. inc(nextvirtnumber);
  463. has_virtual_method:=true;
  464. end;
  465. if (hp.proctypeoption=potype_constructor) then
  466. has_constructor:=true;
  467. { check, if a method should be overridden }
  468. if (po_overridingmethod in hp.procoptions) then
  469. MessagePos1(hp.fileinfo,parser_e_nothing_to_be_overridden,_class.objname^+'.'+_name+hp.demangled_paras);
  470. end;
  471. label
  472. handlenextdef;
  473. begin
  474. { put only sub routines into the VMT }
  475. if tsym(sym).typ=procsym then
  476. begin
  477. _name:=sym.name;
  478. symcoll:=wurzel;
  479. while assigned(symcoll) do
  480. begin
  481. { does the symbol already exist in the list ? }
  482. if _name=symcoll^.name^ then
  483. begin
  484. { walk through all defs of the symbol }
  485. hp:=tprocsym(sym).definition;
  486. while assigned(hp) do
  487. begin
  488. { compare with all stored definitions }
  489. procdefcoll:=symcoll^.data;
  490. stored:=false;
  491. while assigned(procdefcoll) do
  492. begin
  493. { compare parameters }
  494. if equal_paras(procdefcoll^.data.para,hp.para,cp_all) and
  495. (
  496. (po_virtualmethod in procdefcoll^.data.procoptions) or
  497. (po_virtualmethod in hp.procoptions)
  498. ) then
  499. begin { same parameters }
  500. { wenn sie gleich sind }
  501. { und eine davon virtual deklariert ist }
  502. { Fehler falls nur eine VIRTUAL }
  503. if (po_virtualmethod in procdefcoll^.data.procoptions)<>
  504. (po_virtualmethod in hp.procoptions) then
  505. begin
  506. { in classes, we hide the old method }
  507. if is_class(_class) then
  508. begin
  509. { warn only if it is the first time,
  510. we hide the method }
  511. if _class=hp._class then
  512. Message1(parser_w_should_use_override,hp.fullprocname);
  513. end
  514. else
  515. if _class=hp._class then
  516. begin
  517. if (po_virtualmethod in procdefcoll^.data.procoptions) then
  518. Message1(parser_w_overloaded_are_not_both_virtual,
  519. hp.fullprocname)
  520. else
  521. Message1(parser_w_overloaded_are_not_both_non_virtual,
  522. hp.fullprocname);
  523. end;
  524. { was newentry; exit; (FK) }
  525. newdefentry;
  526. goto handlenextdef;
  527. end
  528. else
  529. { the flags have to match }
  530. { except abstract and override }
  531. { only if both are virtual !! }
  532. if (procdefcoll^.data.proccalloptions<>hp.proccalloptions) or
  533. (procdefcoll^.data.proctypeoption<>hp.proctypeoption) or
  534. ((procdefcoll^.data.procoptions-
  535. [po_abstractmethod,po_overridingmethod,po_assembler])<>
  536. (hp.procoptions-[po_abstractmethod,po_overridingmethod,po_assembler])) then
  537. Message1(parser_e_header_dont_match_forward,hp.fullprocname);
  538. { check, if the overridden directive is set }
  539. { (povirtualmethod is set! }
  540. { class ? }
  541. if is_class(_class) and
  542. not(po_overridingmethod in hp.procoptions) then
  543. begin
  544. { warn only if it is the first time,
  545. we hide the method }
  546. if _class=hp._class then
  547. Message1(parser_w_should_use_override,hp.fullprocname);
  548. { was newentry; (FK) }
  549. newdefentry;
  550. exit;
  551. end;
  552. { error, if the return types aren't equal }
  553. if not(is_equal(procdefcoll^.data.rettype.def,hp.rettype.def)) and
  554. not((procdefcoll^.data.rettype.def.deftype=objectdef) and
  555. (hp.rettype.def.deftype=objectdef) and
  556. is_class(procdefcoll^.data.rettype.def) and
  557. is_class(hp.rettype.def) and
  558. (tobjectdef(hp.rettype.def).is_related(
  559. tobjectdef(procdefcoll^.data.rettype.def)))) then
  560. Message2(parser_e_overridden_methods_not_same_ret,hp.fullprocnamewithret,
  561. procdefcoll^.data.fullprocnamewithret);
  562. { now set the number }
  563. hp.extnumber:=procdefcoll^.data.extnumber;
  564. { and exchange }
  565. procdefcoll^.data:=hp;
  566. stored:=true;
  567. goto handlenextdef;
  568. end; { same parameters }
  569. procdefcoll:=procdefcoll^.next;
  570. end;
  571. { if it isn't saved in the list }
  572. { we create a new entry }
  573. if not(stored) then
  574. begin
  575. new(procdefcoll);
  576. procdefcoll^.data:=hp;
  577. procdefcoll^.next:=symcoll^.data;
  578. symcoll^.data:=procdefcoll;
  579. { if the method is virtual ... }
  580. if (po_virtualmethod in hp.procoptions) then
  581. begin
  582. { ... it will get a number }
  583. hp.extnumber:=nextvirtnumber;
  584. inc(nextvirtnumber);
  585. end;
  586. { check, if a method should be overridden }
  587. if (po_overridingmethod in hp.procoptions) then
  588. MessagePos1(hp.fileinfo,parser_e_nothing_to_be_overridden,
  589. hp.fullprocname);
  590. end;
  591. handlenextdef:
  592. hp:=hp.nextoverloaded;
  593. end;
  594. exit;
  595. end;
  596. symcoll:=symcoll^.next;
  597. end;
  598. newentry;
  599. end;
  600. end;
  601. procedure tclassheader.disposevmttree;
  602. var
  603. symcoll : psymcoll;
  604. procdefcoll : pprocdefcoll;
  605. begin
  606. { disposes the above generated tree }
  607. symcoll:=wurzel;
  608. while assigned(symcoll) do
  609. begin
  610. wurzel:=symcoll^.next;
  611. stringdispose(symcoll^.name);
  612. procdefcoll:=symcoll^.data;
  613. while assigned(procdefcoll) do
  614. begin
  615. symcoll^.data:=procdefcoll^.next;
  616. dispose(procdefcoll);
  617. procdefcoll:=symcoll^.data;
  618. end;
  619. dispose(symcoll);
  620. symcoll:=wurzel;
  621. end;
  622. end;
  623. procedure tclassheader.genvmt(list : TAAsmoutput);
  624. procedure do_genvmt(p : tobjectdef);
  625. begin
  626. { start with the base class }
  627. if assigned(p.childof) then
  628. do_genvmt(p.childof);
  629. { walk through all public syms }
  630. p.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}eachsym);
  631. end;
  632. var
  633. symcoll : psymcoll;
  634. procdefcoll : pprocdefcoll;
  635. i : longint;
  636. begin
  637. wurzel:=nil;
  638. nextvirtnumber:=0;
  639. has_constructor:=false;
  640. has_virtual_method:=false;
  641. { generates a tree of all used methods }
  642. do_genvmt(_class);
  643. if has_virtual_method and not(has_constructor) then
  644. Message1(parser_w_virtual_without_constructor,_class.objname^);
  645. { generates the VMT }
  646. { walk trough all numbers for virtual methods and search }
  647. { the method }
  648. for i:=0 to nextvirtnumber-1 do
  649. begin
  650. symcoll:=wurzel;
  651. { walk trough all symbols }
  652. while assigned(symcoll) do
  653. begin
  654. { walk trough all methods }
  655. procdefcoll:=symcoll^.data;
  656. while assigned(procdefcoll) do
  657. begin
  658. { writes the addresses to the VMT }
  659. { but only this which are declared as virtual }
  660. if procdefcoll^.data.extnumber=i then
  661. begin
  662. if (po_virtualmethod in procdefcoll^.data.procoptions) then
  663. begin
  664. { if a method is abstract, then is also the }
  665. { class abstract and it's not allow to }
  666. { generates an instance }
  667. if (po_abstractmethod in procdefcoll^.data.procoptions) then
  668. begin
  669. include(_class.objectoptions,oo_has_abstract);
  670. List.concat(Tai_const_symbol.Createname('FPC_ABSTRACTERROR'));
  671. end
  672. else
  673. begin
  674. List.concat(Tai_const_symbol.createname(procdefcoll^.data.mangledname));
  675. end;
  676. end;
  677. end;
  678. procdefcoll:=procdefcoll^.next;
  679. end;
  680. symcoll:=symcoll^.next;
  681. end;
  682. end;
  683. disposevmttree;
  684. end;
  685. {**************************************
  686. Interface tables
  687. **************************************}
  688. function tclassheader.gintfgetvtbllabelname(intfindex: integer): string;
  689. begin
  690. gintfgetvtbllabelname:='_$$_'+upper(_class.objname^)+'_$$_'+
  691. upper(_class.implementedinterfaces.interfaces(intfindex).objname^)+'_$$_VTBL';
  692. end;
  693. procedure tclassheader.gintfcreatevtbl(intfindex: integer; rawdata,rawcode: TAAsmoutput);
  694. var
  695. implintf: timplementedinterfaces;
  696. curintf: tobjectdef;
  697. proccount: integer;
  698. tmps: string;
  699. i: longint;
  700. begin
  701. implintf:=_class.implementedinterfaces;
  702. curintf:=implintf.interfaces(intfindex);
  703. rawdata.concat(Tai_symbol.Createname(gintfgetvtbllabelname(intfindex),0));
  704. proccount:=implintf.implproccount(intfindex);
  705. for i:=1 to proccount do
  706. begin
  707. tmps:=implintf.implprocs(intfindex,i).mangledname+'_$$_'+upper(curintf.objname^);
  708. { create wrapper code }
  709. cgintfwrapper(rawcode,implintf.implprocs(intfindex,i),tmps,implintf.ioffsets(intfindex)^);
  710. { create reference }
  711. rawdata.concat(Tai_const_symbol.Createname(tmps));
  712. end;
  713. end;
  714. procedure tclassheader.gintfgenentry(intfindex, contintfindex: integer; rawdata: TAAsmoutput);
  715. var
  716. implintf: timplementedinterfaces;
  717. curintf: tobjectdef;
  718. tmplabel: tasmlabel;
  719. i: longint;
  720. begin
  721. implintf:=_class.implementedinterfaces;
  722. curintf:=implintf.interfaces(intfindex);
  723. { GUID }
  724. if curintf.objecttype in [odt_interfacecom] then
  725. begin
  726. { label for GUID }
  727. getdatalabel(tmplabel);
  728. rawdata.concat(Tai_label.Create(tmplabel));
  729. rawdata.concat(Tai_const.Create_32bit(curintf.iidguid.D1));
  730. rawdata.concat(Tai_const.Create_16bit(curintf.iidguid.D2));
  731. rawdata.concat(Tai_const.Create_16bit(curintf.iidguid.D3));
  732. for i:=Low(curintf.iidguid.D4) to High(curintf.iidguid.D4) do
  733. rawdata.concat(Tai_const.Create_8bit(curintf.iidguid.D4[i]));
  734. dataSegment.concat(Tai_const_symbol.Create(tmplabel));
  735. end
  736. else
  737. begin
  738. { nil for Corba interfaces }
  739. dataSegment.concat(Tai_const.Create_32bit(0)); { nil }
  740. end;
  741. { VTable }
  742. dataSegment.concat(Tai_const_symbol.Createname(gintfgetvtbllabelname(contintfindex)));
  743. { IOffset field }
  744. dataSegment.concat(Tai_const.Create_32bit(implintf.ioffsets(contintfindex)^));
  745. { IIDStr }
  746. getdatalabel(tmplabel);
  747. rawdata.concat(Tai_label.Create(tmplabel));
  748. rawdata.concat(Tai_const.Create_8bit(length(curintf.iidstr^)));
  749. if curintf.objecttype=odt_interfacecom then
  750. rawdata.concat(Tai_string.Create(upper(curintf.iidstr^)))
  751. else
  752. rawdata.concat(Tai_string.Create(curintf.iidstr^));
  753. dataSegment.concat(Tai_const_symbol.Create(tmplabel));
  754. end;
  755. procedure tclassheader.gintfoptimizevtbls(implvtbl : plongint);
  756. type
  757. tcompintfentry = record
  758. weight: longint;
  759. compintf: longint;
  760. end;
  761. { Max 1000 interface in the class header interfaces it's enough imho }
  762. tcompintfs = packed array[1..1000] of tcompintfentry;
  763. pcompintfs = ^tcompintfs;
  764. tequals = packed array[1..1000] of longint;
  765. pequals = ^tequals;
  766. var
  767. max: longint;
  768. equals: pequals;
  769. compats: pcompintfs;
  770. i: longint;
  771. j: longint;
  772. w: longint;
  773. cij: boolean;
  774. cji: boolean;
  775. begin
  776. max:=_class.implementedinterfaces.count;
  777. if max>High(tequals) then
  778. Internalerror(200006135);
  779. getmem(compats,sizeof(tcompintfentry)*max);
  780. getmem(equals,sizeof(longint)*max);
  781. fillchar(compats^,sizeof(tcompintfentry)*max,0);
  782. fillchar(equals^,sizeof(longint)*max,0);
  783. { ismergepossible is a containing relation
  784. meaning of ismergepossible(a,b,w) =
  785. if implementorfunction map of a is contained implementorfunction map of b
  786. imp(a,b) and imp(b,c) => imp(a,c) ; imp(a,b) and imp(b,a) => a == b
  787. }
  788. { the order is very important for correct allocation }
  789. for i:=1 to max do
  790. begin
  791. for j:=i+1 to max do
  792. begin
  793. cij:=_class.implementedinterfaces.isimplmergepossible(i,j,w);
  794. cji:=_class.implementedinterfaces.isimplmergepossible(j,i,w);
  795. if cij and cji then { i equal j }
  796. begin
  797. { get minimum index of equal }
  798. if equals^[j]=0 then
  799. equals^[j]:=i;
  800. end
  801. else if cij then
  802. begin
  803. { get minimum index of maximum weight }
  804. if compats^[i].weight<w then
  805. begin
  806. compats^[i].weight:=w;
  807. compats^[i].compintf:=j;
  808. end;
  809. end
  810. else if cji then
  811. begin
  812. { get minimum index of maximum weight }
  813. if (compats^[j].weight<w) then
  814. begin
  815. compats^[j].weight:=w;
  816. compats^[j].compintf:=i;
  817. end;
  818. end;
  819. end;
  820. end;
  821. for i:=1 to max do
  822. begin
  823. if compats^[i].compintf<>0 then
  824. implvtbl[i]:=compats^[i].compintf
  825. else if equals^[i]<>0 then
  826. implvtbl[i]:=equals^[i]
  827. else
  828. implvtbl[i]:=i;
  829. end;
  830. freemem(compats,sizeof(tcompintfentry)*max);
  831. freemem(equals,sizeof(longint)*max);
  832. end;
  833. procedure tclassheader.gintfwritedata;
  834. var
  835. rawdata,rawcode: taasmoutput;
  836. impintfindexes: plongint;
  837. max: longint;
  838. i: longint;
  839. begin
  840. max:=_class.implementedinterfaces.count;
  841. getmem(impintfindexes,(max+1)*sizeof(longint));
  842. gintfoptimizevtbls(impintfindexes);
  843. rawdata:=TAAsmOutput.Create;
  844. rawcode:=TAAsmOutput.Create;
  845. dataSegment.concat(Tai_const.Create_16bit(max));
  846. { Two pass, one for allocation and vtbl creation }
  847. for i:=1 to max do
  848. begin
  849. if impintfindexes[i]=i then { if implement itself }
  850. begin
  851. { allocate a pointer in the object memory }
  852. with tstoredsymtable(_class.symtable) do
  853. begin
  854. if (dataalignment>=target_os.size_of_pointer) then
  855. datasize:=align(datasize,dataalignment)
  856. else
  857. datasize:=align(datasize,target_os.size_of_pointer);
  858. _class.implementedinterfaces.ioffsets(i)^:=datasize;
  859. datasize:=datasize+target_os.size_of_pointer;
  860. end;
  861. { write vtbl }
  862. gintfcreatevtbl(i,rawdata,rawcode);
  863. end;
  864. end;
  865. { second pass: for fill interfacetable and remained ioffsets }
  866. for i:=1 to max do
  867. begin
  868. if i<>impintfindexes[i] then { why execute x:=x ? }
  869. with _class.implementedinterfaces do
  870. ioffsets(i)^:=ioffsets(impintfindexes[i])^;
  871. gintfgenentry(i,impintfindexes[i],rawdata);
  872. end;
  873. dataSegment.insertlist(rawdata);
  874. rawdata.free;
  875. if (cs_create_smart in aktmoduleswitches) then
  876. rawcode.insert(Tai_cut.Create);
  877. codeSegment.insertlist(rawcode);
  878. rawcode.free;
  879. freemem(impintfindexes,(max+1)*sizeof(longint));
  880. end;
  881. function tclassheader.gintfgetcprocdef(proc: tprocdef;const name: string): tprocdef;
  882. var
  883. sym: tprocsym;
  884. implprocdef: tprocdef;
  885. begin
  886. implprocdef:=nil;
  887. sym:=tprocsym(search_class_member(_class,name));
  888. if assigned(sym) and (sym.typ=procsym) and not (sp_private in sym.symoptions) then
  889. begin
  890. implprocdef:=sym.definition;
  891. while assigned(implprocdef) and not equal_paras(proc.para,implprocdef.para,cp_none) and
  892. (proc.proccalloptions<>implprocdef.proccalloptions) do
  893. implprocdef:=implprocdef.nextoverloaded;
  894. end;
  895. gintfgetcprocdef:=implprocdef;
  896. end;
  897. procedure tclassheader.gintfdoonintf(intf: tobjectdef; intfindex: longint);
  898. var
  899. i: longint;
  900. proc: tprocdef;
  901. procname: string; { for error }
  902. mappedname: string;
  903. nextexist: pointer;
  904. implprocdef: tprocdef;
  905. begin
  906. for i:=1 to intf.symtable.defindex.count do
  907. begin
  908. proc:=tprocdef(intf.symtable.defindex.search(i));
  909. if proc.deftype=procdef then
  910. begin
  911. procname:='';
  912. implprocdef:=nil;
  913. nextexist:=nil;
  914. repeat
  915. mappedname:=_class.implementedinterfaces.getmappings(intfindex,proc.procsym.name,nextexist);
  916. if procname='' then
  917. procname:=mappedname; { for error messages }
  918. if mappedname<>'' then
  919. implprocdef:=gintfgetcprocdef(proc,mappedname);
  920. until assigned(implprocdef) or not assigned(nextexist);
  921. if not assigned(implprocdef) then
  922. implprocdef:=gintfgetcprocdef(proc,proc.procsym.name);
  923. if procname='' then
  924. procname:=proc.procsym.name;
  925. if assigned(implprocdef) then
  926. _class.implementedinterfaces.addimplproc(intfindex,implprocdef)
  927. else
  928. Message1(sym_e_id_not_found,procname);
  929. end;
  930. end;
  931. end;
  932. procedure tclassheader.gintfwalkdowninterface(intf: tobjectdef; intfindex: longint);
  933. begin
  934. if assigned(intf.childof) then
  935. gintfwalkdowninterface(intf.childof,intfindex);
  936. gintfdoonintf(intf,intfindex);
  937. end;
  938. function tclassheader.genintftable: tasmlabel;
  939. var
  940. intfindex: longint;
  941. curintf: tobjectdef;
  942. intftable: tasmlabel;
  943. begin
  944. { 1. step collect implementor functions into the implementedinterfaces.implprocs }
  945. for intfindex:=1 to _class.implementedinterfaces.count do
  946. begin
  947. curintf:=_class.implementedinterfaces.interfaces(intfindex);
  948. gintfwalkdowninterface(curintf,intfindex);
  949. end;
  950. { 2. step calc required fieldcount and their offsets in the object memory map
  951. and write data }
  952. getdatalabel(intftable);
  953. dataSegment.concat(Tai_label.Create(intftable));
  954. gintfwritedata;
  955. _class.implementedinterfaces.clearimplprocs; { release temporary information }
  956. genintftable:=intftable;
  957. end;
  958. { Write interface identifiers to the data section }
  959. procedure tclassheader.writeinterfaceids;
  960. var
  961. i: longint;
  962. s1,s2 : string;
  963. begin
  964. if _class.owner.name=nil then
  965. s1:=''
  966. else
  967. s1:=upper(_class.owner.name^);
  968. if _class.objname=nil then
  969. s2:=''
  970. else
  971. s2:=upper(_class.objname^);
  972. s1:=s1+'$_'+s2;
  973. if _class.isiidguidvalid then
  974. begin
  975. if (cs_create_smart in aktmoduleswitches) then
  976. dataSegment.concat(Tai_cut.Create);
  977. dataSegment.concat(Tai_symbol.Createname_global('IID$_'+s1,0));
  978. dataSegment.concat(Tai_const.Create_32bit(longint(_class.iidguid.D1)));
  979. dataSegment.concat(Tai_const.Create_16bit(_class.iidguid.D2));
  980. dataSegment.concat(Tai_const.Create_16bit(_class.iidguid.D3));
  981. for i:=Low(_class.iidguid.D4) to High(_class.iidguid.D4) do
  982. dataSegment.concat(Tai_const.Create_8bit(_class.iidguid.D4[i]));
  983. end;
  984. if (cs_create_smart in aktmoduleswitches) then
  985. dataSegment.concat(Tai_cut.Create);
  986. dataSegment.concat(Tai_symbol.Createname_global('IIDSTR$_'+s1,0));
  987. dataSegment.concat(Tai_const.Create_8bit(length(_class.iidstr^)));
  988. dataSegment.concat(Tai_string.Create(_class.iidstr^));
  989. end;
  990. { generates the vmt for classes as well as for objects }
  991. procedure tclassheader.writevmt;
  992. var
  993. vmtlist : taasmoutput;
  994. methodnametable,intmessagetable,
  995. strmessagetable,classnamelabel,
  996. fieldtablelabel : tasmlabel;
  997. {$ifdef WITHDMT}
  998. dmtlabel : tasmlabel;
  999. {$endif WITHDMT}
  1000. interfacetable : tasmlabel;
  1001. begin
  1002. {$ifdef WITHDMT}
  1003. dmtlabel:=gendmt;
  1004. {$endif WITHDMT}
  1005. { this generates the entries }
  1006. vmtlist:=TAasmoutput.Create;
  1007. genvmt(vmtlist);
  1008. { write tables for classes, this must be done before the actual
  1009. class is written, because we need the labels defined }
  1010. if is_class(_class) then
  1011. begin
  1012. methodnametable:=genpublishedmethodstable;
  1013. fieldtablelabel:=_class.generate_field_table;
  1014. { rtti }
  1015. if (oo_can_have_published in _class.objectoptions) then
  1016. _class.generate_rtti;
  1017. { write class name }
  1018. getdatalabel(classnamelabel);
  1019. dataSegment.concat(Tai_label.Create(classnamelabel));
  1020. dataSegment.concat(Tai_const.Create_8bit(length(_class.objname^)));
  1021. dataSegment.concat(Tai_string.Create(_class.objname^));
  1022. { generate message and dynamic tables }
  1023. if (oo_has_msgstr in _class.objectoptions) then
  1024. strmessagetable:=genstrmsgtab;
  1025. if (oo_has_msgint in _class.objectoptions) then
  1026. intmessagetable:=genintmsgtab
  1027. else
  1028. dataSegment.concat(Tai_const.Create_32bit(0));
  1029. { interface table }
  1030. if _class.implementedinterfaces.count>0 then
  1031. interfacetable:=genintftable;
  1032. end;
  1033. { write debug info }
  1034. {$ifdef GDB}
  1035. if (cs_debuginfo in aktmoduleswitches) then
  1036. begin
  1037. do_count_dbx:=true;
  1038. if assigned(_class.owner) and assigned(_class.owner.name) then
  1039. dataSegment.concat(Tai_stabs.Create(strpnew('"vmt_'+_class.owner.name^+_class.name+':S'+
  1040. typeglobalnumber('__vtbl_ptr_type')+'",'+tostr(N_STSYM)+',0,0,'+_class.vmt_mangledname)));
  1041. end;
  1042. {$endif GDB}
  1043. dataSegment.concat(Tai_symbol.Createdataname_global(_class.vmt_mangledname,0));
  1044. { determine the size with symtable.datasize, because }
  1045. { size gives back 4 for classes }
  1046. dataSegment.concat(Tai_const.Create_32bit(_class.symtable.datasize));
  1047. dataSegment.concat(Tai_const.Create_32bit(-_class.symtable.datasize));
  1048. {$ifdef WITHDMT}
  1049. if _class.classtype=ct_object then
  1050. begin
  1051. if assigned(dmtlabel) then
  1052. dataSegment.concat(Tai_const_symbol.Create(dmtlabel)))
  1053. else
  1054. dataSegment.concat(Tai_const.Create_32bit(0));
  1055. end;
  1056. {$endif WITHDMT}
  1057. { write pointer to parent VMT, this isn't implemented in TP }
  1058. { but this is not used in FPC ? (PM) }
  1059. { it's not used yet, but the delphi-operators as and is need it (FK) }
  1060. { it is not written for parents that don't have any vmt !! }
  1061. if assigned(_class.childof) and
  1062. (oo_has_vmt in _class.childof.objectoptions) then
  1063. dataSegment.concat(Tai_const_symbol.Createname(_class.childof.vmt_mangledname))
  1064. else
  1065. dataSegment.concat(Tai_const.Create_32bit(0));
  1066. { write extended info for classes, for the order see rtl/inc/objpash.inc }
  1067. if is_class(_class) then
  1068. begin
  1069. { pointer to class name string }
  1070. dataSegment.concat(Tai_const_symbol.Create(classnamelabel));
  1071. { pointer to dynamic table }
  1072. if (oo_has_msgint in _class.objectoptions) then
  1073. dataSegment.concat(Tai_const_symbol.Create(intmessagetable))
  1074. else
  1075. dataSegment.concat(Tai_const.Create_32bit(0));
  1076. { pointer to method table }
  1077. if assigned(methodnametable) then
  1078. dataSegment.concat(Tai_const_symbol.Create(methodnametable))
  1079. else
  1080. dataSegment.concat(Tai_const.Create_32bit(0));
  1081. { pointer to field table }
  1082. dataSegment.concat(Tai_const_symbol.Create(fieldtablelabel));
  1083. { pointer to type info of published section }
  1084. if (oo_can_have_published in _class.objectoptions) then
  1085. dataSegment.concat(Tai_const_symbol.Createname(_class.rtti_name))
  1086. else
  1087. dataSegment.concat(Tai_const.Create_32bit(0));
  1088. { inittable for con-/destruction }
  1089. {
  1090. if _class.needs_inittable then
  1091. }
  1092. { we generate the init table for classes always, because needs_inittable }
  1093. { for classes is always false, it applies only for objects }
  1094. dataSegment.concat(Tai_const_symbol.Create(_class.get_inittable_label));
  1095. {
  1096. else
  1097. dataSegment.concat(Tai_const.Create_32bit(0));
  1098. }
  1099. { auto table }
  1100. dataSegment.concat(Tai_const.Create_32bit(0));
  1101. { interface table }
  1102. if _class.implementedinterfaces.count>0 then
  1103. dataSegment.concat(Tai_const_symbol.Create(interfacetable))
  1104. else
  1105. dataSegment.concat(Tai_const.Create_32bit(0));
  1106. { table for string messages }
  1107. if (oo_has_msgstr in _class.objectoptions) then
  1108. dataSegment.concat(Tai_const_symbol.Create(strmessagetable))
  1109. else
  1110. dataSegment.concat(Tai_const.Create_32bit(0));
  1111. end;
  1112. dataSegment.concatlist(vmtlist);
  1113. vmtlist.free;
  1114. { write the size of the VMT }
  1115. dataSegment.concat(Tai_symbol_end.Createname(_class.vmt_mangledname));
  1116. end;
  1117. end.
  1118. {
  1119. $Log$
  1120. Revision 1.19 2001-04-13 01:22:07 peter
  1121. * symtable change to classes
  1122. * range check generation and errors fixed, make cycle DEBUG=1 works
  1123. * memory leaks fixed
  1124. Revision 1.18 2001/04/04 21:30:43 florian
  1125. * applied several fixes to get the DD8 Delphi Unit compiled
  1126. e.g. "forward"-interfaces are working now
  1127. Revision 1.17 2000/12/25 00:07:26 peter
  1128. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  1129. tlinkedlist objects)
  1130. Revision 1.16 2000/11/29 00:30:30 florian
  1131. * unused units removed from uses clause
  1132. * some changes for widestrings
  1133. Revision 1.15 2000/11/19 16:23:35 florian
  1134. *** empty log message ***
  1135. Revision 1.14 2000/11/12 23:24:10 florian
  1136. * interfaces are basically running
  1137. Revision 1.13 2000/11/08 00:07:40 florian
  1138. * potential range check error fixed
  1139. Revision 1.12 2000/11/06 23:13:53 peter
  1140. * uppercase manglednames
  1141. Revision 1.11 2000/11/04 17:31:00 florian
  1142. * fixed some problems of previous commit
  1143. Revision 1.10 2000/11/04 14:25:19 florian
  1144. + merged Attila's changes for interfaces, not tested yet
  1145. Revision 1.9 2000/11/01 23:04:37 peter
  1146. * tprocdef.fullprocname added for better casesensitve writing of
  1147. procedures
  1148. Revision 1.8 2000/10/31 22:02:47 peter
  1149. * symtable splitted, no real code changes
  1150. Revision 1.7 2000/10/14 10:14:47 peter
  1151. * moehrendorf oct 2000 rewrite
  1152. Revision 1.6 2000/09/24 21:19:50 peter
  1153. * delphi compile fixes
  1154. Revision 1.5 2000/09/24 15:06:17 peter
  1155. * use defines.inc
  1156. Revision 1.4 2000/08/27 16:11:51 peter
  1157. * moved some util functions from globals,cobjects to cutils
  1158. * splitted files into finput,fmodule
  1159. Revision 1.3 2000/07/13 12:08:26 michael
  1160. + patched to 1.1.0 with former 1.09patch from peter
  1161. Revision 1.2 2000/07/13 11:32:41 michael
  1162. + removed logs
  1163. }