symsym.inc 65 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl, Pierre Muller
  4. Implementation for the symbols types of the symtable
  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. {****************************************************************************
  19. TSYM (base for all symtypes)
  20. ****************************************************************************}
  21. constructor tsym.init(const n : string);
  22. begin
  23. if n[1]='$' then
  24. inherited initname(copy(n,2,255))
  25. else
  26. inherited initname(upper(n));
  27. _realname:=stringdup(n);
  28. typ:=abstractsym;
  29. symoptions:=current_object_option;
  30. {$ifdef GDB}
  31. isstabwritten := false;
  32. {$endif GDB}
  33. fileinfo:=tokenpos;
  34. defref:=nil;
  35. refs:=0;
  36. lastwritten:=nil;
  37. refcount:=0;
  38. if (cs_browser in aktmoduleswitches) and make_ref then
  39. begin
  40. defref:=new(pref,init(defref,@tokenpos));
  41. inc(refcount);
  42. end;
  43. lastref:=defref;
  44. end;
  45. constructor tsym.load;
  46. begin
  47. inherited init;
  48. indexnr:=readword;
  49. _realname:=stringdup(readstring);
  50. if _realname^[1]='$' then
  51. setname(copy(_realname^,2,255))
  52. else
  53. setname(upper(_realname^));
  54. typ:=abstractsym;
  55. readsmallset(symoptions);
  56. readposinfo(fileinfo);
  57. lastref:=nil;
  58. defref:=nil;
  59. refs:=0;
  60. lastwritten:=nil;
  61. refcount:=0;
  62. {$ifdef GDB}
  63. isstabwritten := false;
  64. {$endif GDB}
  65. end;
  66. procedure tsym.load_references;
  67. var
  68. pos : tfileposinfo;
  69. move_last : boolean;
  70. begin
  71. move_last:=lastwritten=lastref;
  72. while (not current_ppu^.endofentry) do
  73. begin
  74. readposinfo(pos);
  75. inc(refcount);
  76. lastref:=new(pref,init(lastref,@pos));
  77. lastref^.is_written:=true;
  78. if refcount=1 then
  79. defref:=lastref;
  80. end;
  81. if move_last then
  82. lastwritten:=lastref;
  83. end;
  84. { big problem here :
  85. wrong refs were written because of
  86. interface parsing of other units PM
  87. moduleindex must be checked !! }
  88. function tsym.write_references : boolean;
  89. var
  90. ref : pref;
  91. symref_written,move_last : boolean;
  92. begin
  93. write_references:=false;
  94. if lastwritten=lastref then
  95. exit;
  96. { should we update lastref }
  97. move_last:=true;
  98. symref_written:=false;
  99. { write symbol refs }
  100. if assigned(lastwritten) then
  101. ref:=lastwritten
  102. else
  103. ref:=defref;
  104. while assigned(ref) do
  105. begin
  106. if ref^.moduleindex=current_module^.unit_index then
  107. begin
  108. { write address to this symbol }
  109. if not symref_written then
  110. begin
  111. writesymref(@self);
  112. symref_written:=true;
  113. end;
  114. writeposinfo(ref^.posinfo);
  115. ref^.is_written:=true;
  116. if move_last then
  117. lastwritten:=ref;
  118. end
  119. else if not ref^.is_written then
  120. move_last:=false
  121. else if move_last then
  122. lastwritten:=ref;
  123. ref:=ref^.nextref;
  124. end;
  125. if symref_written then
  126. current_ppu^.writeentry(ibsymref);
  127. write_references:=symref_written;
  128. end;
  129. {$ifdef BrowserLog}
  130. procedure tsym.add_to_browserlog;
  131. begin
  132. if assigned(defref) then
  133. begin
  134. browserlog.AddLog('***'+name+'***');
  135. browserlog.AddLogRefs(defref);
  136. end;
  137. end;
  138. {$endif BrowserLog}
  139. destructor tsym.done;
  140. begin
  141. if assigned(defref) then
  142. begin
  143. defref^.freechain;
  144. dispose(defref,done);
  145. end;
  146. stringdispose(_realname);
  147. inherited done;
  148. end;
  149. procedure tsym.write;
  150. begin
  151. writeword(indexnr);
  152. writestring(_realname^);
  153. writesmallset(symoptions);
  154. writeposinfo(fileinfo);
  155. end;
  156. procedure tsym.prederef;
  157. begin
  158. end;
  159. procedure tsym.deref;
  160. begin
  161. end;
  162. function tsym.realname : string;
  163. begin
  164. if assigned(_realname) then
  165. realname:=_realname^
  166. else
  167. realname:=name;
  168. end;
  169. function tsym.mangledname : string;
  170. begin
  171. mangledname:=name;
  172. end;
  173. { for most symbol types there is nothing to do at all }
  174. procedure tsym.insert_in_data;
  175. begin
  176. end;
  177. {$ifdef GDB}
  178. function tsym.stabstring : pchar;
  179. begin
  180. stabstring:=strpnew('"'+name+'",'+tostr(N_LSYM)+',0,'+
  181. tostr(fileinfo.line)+',0');
  182. end;
  183. procedure tsym.concatstabto(asmlist : paasmoutput);
  184. var stab_str : pchar;
  185. begin
  186. if not isstabwritten then
  187. begin
  188. stab_str := stabstring;
  189. { count_dbx(stab_str); moved to GDB.PAS }
  190. asmlist^.concat(new(pai_stabs,init(stab_str)));
  191. isstabwritten:=true;
  192. end;
  193. end;
  194. {$endif GDB}
  195. {****************************************************************************
  196. TLABELSYM
  197. ****************************************************************************}
  198. constructor tlabelsym.init(const n : string; l : pasmlabel);
  199. begin
  200. inherited init(n);
  201. typ:=labelsym;
  202. lab:=l;
  203. used:=false;
  204. defined:=false;
  205. code:=nil;
  206. end;
  207. constructor tlabelsym.load;
  208. begin
  209. tsym.load;
  210. typ:=labelsym;
  211. { this is all dummy
  212. it is only used for local browsing }
  213. lab:=nil;
  214. code:=nil;
  215. used:=false;
  216. defined:=true;
  217. end;
  218. destructor tlabelsym.done;
  219. begin
  220. inherited done;
  221. end;
  222. function tlabelsym.mangledname : string;
  223. begin
  224. mangledname:=lab^.name;
  225. end;
  226. procedure tlabelsym.write;
  227. begin
  228. if owner^.symtabletype in [unitsymtable,globalsymtable] then
  229. Message(sym_e_ill_label_decl)
  230. else
  231. begin
  232. tsym.write;
  233. current_ppu^.writeentry(iblabelsym);
  234. end;
  235. end;
  236. {****************************************************************************
  237. TUNITSYM
  238. ****************************************************************************}
  239. constructor tunitsym.init(const n : string;ref : punitsymtable);
  240. var
  241. old_make_ref : boolean;
  242. begin
  243. old_make_ref:=make_ref;
  244. make_ref:=false;
  245. inherited init(n);
  246. make_ref:=old_make_ref;
  247. typ:=unitsym;
  248. unitsymtable:=ref;
  249. prevsym:=ref^.unitsym;
  250. ref^.unitsym:=@self;
  251. refs:=0;
  252. end;
  253. constructor tunitsym.load;
  254. begin
  255. tsym.load;
  256. typ:=unitsym;
  257. unitsymtable:=punitsymtable(current_module^.globalsymtable);
  258. prevsym:=nil;
  259. end;
  260. { we need to remove it from the prevsym chain ! }
  261. procedure tunitsym.restoreunitsym;
  262. var pus,ppus : punitsym;
  263. begin
  264. if assigned(unitsymtable) then
  265. begin
  266. ppus:=nil;
  267. pus:=unitsymtable^.unitsym;
  268. if pus=@self then
  269. unitsymtable^.unitsym:=prevsym
  270. else while assigned(pus) do
  271. begin
  272. if pus=@self then
  273. begin
  274. ppus^.prevsym:=prevsym;
  275. break;
  276. end
  277. else
  278. begin
  279. ppus:=pus;
  280. pus:=ppus^.prevsym;
  281. end;
  282. end;
  283. end;
  284. prevsym:=nil;
  285. end;
  286. destructor tunitsym.done;
  287. begin
  288. restoreunitsym;
  289. inherited done;
  290. end;
  291. procedure tunitsym.write;
  292. begin
  293. tsym.write;
  294. current_ppu^.writeentry(ibunitsym);
  295. end;
  296. {$ifdef GDB}
  297. procedure tunitsym.concatstabto(asmlist : paasmoutput);
  298. begin
  299. {Nothing to write to stabs !}
  300. end;
  301. {$endif GDB}
  302. {****************************************************************************
  303. TPROCSYM
  304. ****************************************************************************}
  305. constructor tprocsym.init(const n : string);
  306. begin
  307. tsym.init(n);
  308. typ:=procsym;
  309. definition:=nil;
  310. owner:=nil;
  311. is_global := false;
  312. end;
  313. constructor tprocsym.load;
  314. begin
  315. tsym.load;
  316. typ:=procsym;
  317. definition:=pprocdef(readdefref);
  318. is_global := false;
  319. end;
  320. destructor tprocsym.done;
  321. begin
  322. { don't check if errors !! }
  323. if Errorcount=0 then
  324. check_forward;
  325. tsym.done;
  326. end;
  327. function tprocsym.mangledname : string;
  328. begin
  329. mangledname:=definition^.mangledname;
  330. end;
  331. function tprocsym.demangledname:string;
  332. begin
  333. demangledname:=name+definition^.demangled_paras;
  334. end;
  335. procedure tprocsym.write_parameter_lists(skipdef:pprocdef);
  336. var
  337. p : pprocdef;
  338. begin
  339. p:=definition;
  340. while assigned(p) do
  341. begin
  342. if p<>skipdef then
  343. MessagePos1(p^.fileinfo,sym_b_param_list,name+p^.demangled_paras);
  344. p:=p^.nextoverloaded;
  345. end;
  346. end;
  347. procedure tprocsym.check_forward;
  348. var
  349. pd : pprocdef;
  350. begin
  351. pd:=definition;
  352. while assigned(pd) do
  353. begin
  354. if pd^.forwarddef then
  355. begin
  356. if assigned(pd^._class) then
  357. MessagePos1(fileinfo,sym_e_forward_not_resolved,pd^._class^.objname^+'.'+demangledname)
  358. else
  359. MessagePos1(fileinfo,sym_e_forward_not_resolved,demangledname);
  360. { Turn futher error messages off }
  361. pd^.forwarddef:=false;
  362. end;
  363. pd:=pd^.nextoverloaded;
  364. { do not check defs of operators in other units }
  365. if assigned(pd) and (pd^.procsym<>@self) then
  366. pd:=nil;
  367. end;
  368. end;
  369. procedure tprocsym.deref;
  370. {$ifdef DONOTCHAINOPERATORS}
  371. var
  372. t : ttoken;
  373. last,pd : pprocdef;
  374. {$endif DONOTCHAINOPERATORS}
  375. begin
  376. resolvedef(pdef(definition));
  377. {$ifdef DONOTCHAINOPERATORS}
  378. if (definition^.proctypeoption=potype_operator) then
  379. begin
  380. last:=definition;
  381. while assigned(last^.nextoverloaded) do
  382. last:=last^.nextoverloaded;
  383. for t:=first_overloaded to last_overloaded do
  384. if (name=overloaded_names[t]) then
  385. begin
  386. if assigned(overloaded_operators[t]) then
  387. begin
  388. pd:=overloaded_operators[t]^.definition;
  389. { test if not already in list, bug report by KC Wong PM }
  390. while assigned(pd) do
  391. if pd=last then
  392. break
  393. else
  394. pd:=pd^.nextoverloaded;
  395. if pd=last then
  396. break;
  397. last^.nextoverloaded:=overloaded_operators[t]^.definition;
  398. end;
  399. overloaded_operators[t]:=@self;
  400. break;
  401. end;
  402. end;
  403. {$endif DONOTCHAINOPERATORS}
  404. end;
  405. procedure tprocsym.order_overloaded;
  406. var firstdef,currdef,lastdef,nextopdef : pprocdef;
  407. begin
  408. if not assigned(definition) then
  409. exit;
  410. firstdef:=definition;
  411. currdef:=definition;
  412. while assigned(currdef) and (currdef^.owner=firstdef^.owner) do
  413. begin
  414. currdef^.count:=false;
  415. currdef:=currdef^.nextoverloaded;
  416. end;
  417. nextopdef:=currdef;
  418. definition:=definition^.nextoverloaded;
  419. firstdef^.nextoverloaded:=nil;
  420. while (definition<>nextopdef) do
  421. begin
  422. currdef:=firstdef;
  423. lastdef:=definition;
  424. definition:=definition^.nextoverloaded;
  425. if lastdef^.mangledname<firstdef^.mangledname then
  426. begin
  427. lastdef^.nextoverloaded:=firstdef;
  428. firstdef:=lastdef;
  429. end
  430. else
  431. begin
  432. while assigned(currdef^.nextoverloaded) and
  433. (lastdef^.mangledname>currdef^.nextoverloaded^.mangledname) do
  434. currdef:=currdef^.nextoverloaded;
  435. lastdef^.nextoverloaded:=currdef^.nextoverloaded;
  436. currdef^.nextoverloaded:=lastdef;
  437. end;
  438. end;
  439. definition:=firstdef;
  440. currdef:=definition;
  441. while assigned(currdef) do
  442. begin
  443. currdef^.count:=true;
  444. lastdef:=currdef;
  445. currdef:=currdef^.nextoverloaded;
  446. end;
  447. lastdef^.nextoverloaded:=nextopdef;
  448. end;
  449. procedure tprocsym.write;
  450. begin
  451. tsym.write;
  452. writedefref(pdef(definition));
  453. current_ppu^.writeentry(ibprocsym);
  454. end;
  455. procedure tprocsym.load_references;
  456. (*var
  457. prdef,prdef2 : pprocdef;
  458. b : byte; *)
  459. begin
  460. inherited load_references;
  461. (*prdef:=definition;
  462. done in tsymtable.load_browser (PM)
  463. { take care about operators !! }
  464. if (current_module^.flags and uf_has_browser) <>0 then
  465. while assigned(prdef) and (prdef^.owner=definition^.owner) do
  466. begin
  467. b:=current_ppu^.readentry;
  468. if b<>ibdefref then
  469. Message(unit_f_ppu_read_error);
  470. prdef2:=pprocdef(readdefref);
  471. resolvedef(prdef2);
  472. if prdef<>prdef2 then
  473. Message(unit_f_ppu_read_error);
  474. prdef^.load_references;
  475. prdef:=prdef^.nextoverloaded;
  476. end; *)
  477. end;
  478. function tprocsym.write_references : boolean;
  479. var
  480. prdef : pprocdef;
  481. begin
  482. write_references:=false;
  483. if not inherited write_references then
  484. exit;
  485. write_references:=true;
  486. prdef:=definition;
  487. while assigned(prdef) and (prdef^.owner=definition^.owner) do
  488. begin
  489. prdef^.write_references;
  490. prdef:=prdef^.nextoverloaded;
  491. end;
  492. end;
  493. {$ifdef BrowserLog}
  494. procedure tprocsym.add_to_browserlog;
  495. var
  496. prdef : pprocdef;
  497. begin
  498. inherited add_to_browserlog;
  499. prdef:=definition;
  500. while assigned(prdef) do
  501. begin
  502. pprocdef(prdef)^.add_to_browserlog;
  503. prdef:=pprocdef(prdef)^.nextoverloaded;
  504. end;
  505. end;
  506. {$endif BrowserLog}
  507. {$ifdef GDB}
  508. function tprocsym.stabstring : pchar;
  509. Var RetType : Char;
  510. Obj,Info : String;
  511. stabsstr : string;
  512. p : pchar;
  513. begin
  514. obj := name;
  515. info := '';
  516. if is_global then
  517. RetType := 'F'
  518. else
  519. RetType := 'f';
  520. if assigned(owner) then
  521. begin
  522. if (owner^.symtabletype = objectsymtable) then
  523. obj := owner^.name^+'__'+name;
  524. { this code was correct only as long as the local symboltable
  525. of the parent had the same name as the function
  526. but this is no true anymore !! PM
  527. if (owner^.symtabletype=localsymtable) and assigned(owner^.name) then
  528. info := ','+name+','+owner^.name^; }
  529. if (owner^.symtabletype=localsymtable) and assigned(owner^.defowner) and
  530. assigned(pprocdef(owner^.defowner)^.procsym) then
  531. info := ','+name+','+pprocdef(owner^.defowner)^.procsym^.name;
  532. end;
  533. stabsstr:=definition^.mangledname;
  534. getmem(p,length(stabsstr)+255);
  535. strpcopy(p,'"'+obj+':'+RetType
  536. +definition^.rettype.def^.numberstring+info+'",'+tostr(n_function)
  537. +',0,'+
  538. tostr(aktfilepos.line)
  539. +',');
  540. strpcopy(strend(p),stabsstr);
  541. stabstring:=strnew(p);
  542. freemem(p,length(stabsstr)+255);
  543. end;
  544. procedure tprocsym.concatstabto(asmlist : paasmoutput);
  545. begin
  546. if (pocall_internproc in definition^.proccalloptions) then exit;
  547. if not isstabwritten then
  548. asmlist^.concat(new(pai_stabs,init(stabstring)));
  549. isstabwritten := true;
  550. if assigned(definition^.parast) then
  551. definition^.parast^.concatstabto(asmlist);
  552. { local type defs and vars should not be written
  553. inside the main proc stab }
  554. if assigned(definition^.localst) and
  555. (lexlevel>main_program_level) then
  556. definition^.localst^.concatstabto(asmlist);
  557. definition^.is_def_stab_written := written;
  558. end;
  559. {$endif GDB}
  560. {****************************************************************************
  561. TPROGRAMSYM
  562. ****************************************************************************}
  563. constructor tprogramsym.init(const n : string);
  564. begin
  565. inherited init(n);
  566. typ:=programsym;
  567. end;
  568. {****************************************************************************
  569. TERRORSYM
  570. ****************************************************************************}
  571. constructor terrorsym.init;
  572. begin
  573. inherited init('');
  574. typ:=errorsym;
  575. end;
  576. {****************************************************************************
  577. TPROPERTYSYM
  578. ****************************************************************************}
  579. constructor tpropertysym.init(const n : string);
  580. begin
  581. inherited init(n);
  582. typ:=propertysym;
  583. propoptions:=[];
  584. index:=0;
  585. default:=0;
  586. proptype.reset;
  587. indextype.reset;
  588. new(readaccess,init);
  589. new(writeaccess,init);
  590. new(storedaccess,init);
  591. end;
  592. constructor tpropertysym.load;
  593. begin
  594. inherited load;
  595. typ:=propertysym;
  596. readsmallset(propoptions);
  597. if (ppo_is_override in propoptions) then
  598. begin
  599. propoverriden:=ppropertysym(readsymref);
  600. { we need to have these objects initialized }
  601. new(readaccess,init);
  602. new(writeaccess,init);
  603. new(storedaccess,init);
  604. end
  605. else
  606. begin
  607. proptype.load;
  608. index:=readlong;
  609. default:=readlong;
  610. indextype.load;
  611. new(readaccess,load);
  612. new(writeaccess,load);
  613. new(storedaccess,load);
  614. end;
  615. end;
  616. destructor tpropertysym.done;
  617. begin
  618. dispose(readaccess,done);
  619. dispose(writeaccess,done);
  620. dispose(storedaccess,done);
  621. inherited done;
  622. end;
  623. procedure tpropertysym.deref;
  624. begin
  625. if (ppo_is_override in propoptions) then
  626. begin
  627. resolvesym(psym(propoverriden));
  628. dooverride(propoverriden);
  629. end
  630. else
  631. begin
  632. proptype.resolve;
  633. indextype.resolve;
  634. readaccess^.resolve;
  635. writeaccess^.resolve;
  636. storedaccess^.resolve;
  637. end;
  638. end;
  639. function tpropertysym.getsize : longint;
  640. begin
  641. getsize:=0;
  642. end;
  643. procedure tpropertysym.write;
  644. begin
  645. tsym.write;
  646. writesmallset(propoptions);
  647. if (ppo_is_override in propoptions) then
  648. writesymref(propoverriden)
  649. else
  650. begin
  651. proptype.write;
  652. writelong(index);
  653. writelong(default);
  654. indextype.write;
  655. readaccess^.write;
  656. writeaccess^.write;
  657. storedaccess^.write;
  658. end;
  659. current_ppu^.writeentry(ibpropertysym);
  660. end;
  661. procedure tpropertysym.dooverride(overriden:ppropertysym);
  662. begin
  663. propoverriden:=overriden;
  664. proptype:=overriden^.proptype;
  665. propoptions:=overriden^.propoptions+[ppo_is_override];
  666. index:=overriden^.index;
  667. default:=overriden^.default;
  668. indextype:=overriden^.indextype;
  669. readaccess^.clear;
  670. readaccess:=overriden^.readaccess^.getcopy;
  671. writeaccess^.clear;
  672. writeaccess:=overriden^.writeaccess^.getcopy;
  673. storedaccess^.clear;
  674. storedaccess:=overriden^.storedaccess^.getcopy;
  675. end;
  676. {$ifdef GDB}
  677. function tpropertysym.stabstring : pchar;
  678. begin
  679. { !!!! don't know how to handle }
  680. stabstring:=strpnew('');
  681. end;
  682. procedure tpropertysym.concatstabto(asmlist : paasmoutput);
  683. begin
  684. { !!!! don't know how to handle }
  685. end;
  686. {$endif GDB}
  687. {****************************************************************************
  688. TFUNCRETSYM
  689. ****************************************************************************}
  690. constructor tfuncretsym.init(const n : string;approcinfo : pointer{pprocinfo});
  691. begin
  692. tsym.init(n);
  693. typ:=funcretsym;
  694. funcretprocinfo:=approcinfo;
  695. rettype:=pprocinfo(approcinfo)^.returntype;
  696. { address valid for ret in param only }
  697. { otherwise set by insert }
  698. address:=pprocinfo(approcinfo)^.return_offset;
  699. end;
  700. constructor tfuncretsym.load;
  701. begin
  702. tsym.load;
  703. rettype.load;
  704. address:=readlong;
  705. funcretprocinfo:=nil;
  706. typ:=funcretsym;
  707. end;
  708. destructor tfuncretsym.done;
  709. begin
  710. inherited done;
  711. end;
  712. procedure tfuncretsym.write;
  713. begin
  714. tsym.write;
  715. rettype.write;
  716. writelong(address);
  717. current_ppu^.writeentry(ibfuncretsym);
  718. end;
  719. procedure tfuncretsym.deref;
  720. begin
  721. rettype.resolve;
  722. end;
  723. {$ifdef GDB}
  724. procedure tfuncretsym.concatstabto(asmlist : paasmoutput);
  725. begin
  726. { Nothing to do here, it is done in genexitcode }
  727. end;
  728. {$endif GDB}
  729. procedure tfuncretsym.insert_in_data;
  730. var
  731. l : longint;
  732. begin
  733. { if retoffset is already set then reuse it, this is needed
  734. when inserting the result variable }
  735. if procinfo^.return_offset<>0 then
  736. address:=procinfo^.return_offset
  737. else
  738. begin
  739. { allocate space in local if ret in acc or in fpu }
  740. if ret_in_acc(procinfo^.returntype.def) or (procinfo^.returntype.def^.deftype=floatdef) then
  741. begin
  742. l:=rettype.def^.size;
  743. inc(owner^.datasize,l);
  744. {$ifdef m68k}
  745. { word alignment required for motorola }
  746. if (l=1) then
  747. inc(owner^.datasize,1)
  748. else
  749. {$endif}
  750. if (l>=4) and ((owner^.datasize and 3)<>0) then
  751. inc(owner^.datasize,4-(owner^.datasize and 3))
  752. else if (l>=2) and ((owner^.datasize and 1)<>0) then
  753. inc(owner^.datasize,2-(owner^.datasize and 1));
  754. address:=owner^.datasize;
  755. procinfo^.return_offset:=-owner^.datasize;
  756. end;
  757. end;
  758. end;
  759. {****************************************************************************
  760. TABSOLUTESYM
  761. ****************************************************************************}
  762. constructor tabsolutesym.init(const n : string;const tt : ttype);
  763. begin
  764. inherited init(n,tt);
  765. typ:=absolutesym;
  766. end;
  767. constructor tabsolutesym.initdef(const n : string;p : pdef);
  768. var
  769. t : ttype;
  770. begin
  771. t.setdef(p);
  772. tabsolutesym.init(n,t);
  773. end;
  774. constructor tabsolutesym.load;
  775. begin
  776. tvarsym.load;
  777. typ:=absolutesym;
  778. ref:=nil;
  779. address:=0;
  780. asmname:=nil;
  781. abstyp:=absolutetyp(readbyte);
  782. absseg:=false;
  783. case abstyp of
  784. tovar :
  785. begin
  786. asmname:=stringdup(readstring);
  787. ref:=srsym;
  788. end;
  789. toasm :
  790. asmname:=stringdup(readstring);
  791. toaddr :
  792. begin
  793. address:=readlong;
  794. absseg:=boolean(readbyte);
  795. end;
  796. end;
  797. end;
  798. procedure tabsolutesym.write;
  799. var
  800. hvo : tvaroptions;
  801. begin
  802. { Note: This needs to write everything of tvarsym.write }
  803. tsym.write;
  804. writebyte(byte(varspez));
  805. if read_member then
  806. writelong(address);
  807. { write only definition or definitionsym }
  808. vartype.write;
  809. hvo:=varoptions-[vo_regable];
  810. writesmallset(hvo);
  811. writebyte(byte(abstyp));
  812. case abstyp of
  813. tovar :
  814. writestring(ref^.name);
  815. toasm :
  816. writestring(asmname^);
  817. toaddr :
  818. begin
  819. writelong(address);
  820. writebyte(byte(absseg));
  821. end;
  822. end;
  823. current_ppu^.writeentry(ibabsolutesym);
  824. end;
  825. procedure tabsolutesym.deref;
  826. begin
  827. tvarsym.deref;
  828. if (abstyp=tovar) and (asmname<>nil) then
  829. begin
  830. { search previous loaded symtables }
  831. getsym(asmname^,false);
  832. if not(assigned(srsym)) then
  833. getsymonlyin(owner,asmname^);
  834. if not(assigned(srsym)) then
  835. srsym:=generrorsym;
  836. ref:=srsym;
  837. stringdispose(asmname);
  838. end;
  839. end;
  840. function tabsolutesym.mangledname : string;
  841. begin
  842. case abstyp of
  843. tovar :
  844. mangledname:=ref^.mangledname;
  845. toasm :
  846. mangledname:=asmname^;
  847. toaddr :
  848. mangledname:='$'+tostr(address);
  849. else
  850. internalerror(10002);
  851. end;
  852. end;
  853. procedure tabsolutesym.insert_in_data;
  854. begin
  855. end;
  856. {$ifdef GDB}
  857. procedure tabsolutesym.concatstabto(asmlist : paasmoutput);
  858. begin
  859. { I don't know how to handle this !! }
  860. end;
  861. {$endif GDB}
  862. {****************************************************************************
  863. TVARSYM
  864. ****************************************************************************}
  865. constructor tvarsym.init(const n : string;const tt : ttype);
  866. begin
  867. tsym.init(n);
  868. typ:=varsym;
  869. vartype:=tt;
  870. _mangledname:=nil;
  871. varspez:=vs_value;
  872. address:=0;
  873. localvarsym:=nil;
  874. refs:=0;
  875. varstate:=vs_used;
  876. varoptions:=[];
  877. { can we load the value into a register ? }
  878. if tt.def^.is_intregable then
  879. include(varoptions,vo_regable)
  880. else
  881. exclude(varoptions,vo_regable);
  882. if tt.def^.is_fpuregable then
  883. include(varoptions,vo_fpuregable)
  884. else
  885. exclude(varoptions,vo_fpuregable);
  886. reg:=R_NO;
  887. end;
  888. constructor tvarsym.init_dll(const n : string;const tt : ttype);
  889. begin
  890. tvarsym.init(n,tt);
  891. include(varoptions,vo_is_dll_var);
  892. end;
  893. constructor tvarsym.init_C(const n,mangled : string;const tt : ttype);
  894. begin
  895. tvarsym.init(n,tt);
  896. include(varoptions,vo_is_C_var);
  897. setmangledname(mangled);
  898. end;
  899. constructor tvarsym.initdef(const n : string;p : pdef);
  900. var
  901. t : ttype;
  902. begin
  903. t.setdef(p);
  904. tvarsym.init(n,t);
  905. end;
  906. constructor tvarsym.load;
  907. begin
  908. tsym.load;
  909. typ:=varsym;
  910. _mangledname:=nil;
  911. reg:=R_NO;
  912. refs := 0;
  913. varstate:=vs_used;
  914. varspez:=tvarspez(readbyte);
  915. if read_member then
  916. address:=readlong
  917. else
  918. address:=0;
  919. localvarsym:=nil;
  920. vartype.load;
  921. readsmallset(varoptions);
  922. if (vo_is_C_var in varoptions) then
  923. setmangledname(readstring);
  924. end;
  925. destructor tvarsym.done;
  926. begin
  927. strdispose(_mangledname);
  928. inherited done;
  929. end;
  930. procedure tvarsym.deref;
  931. begin
  932. vartype.resolve;
  933. end;
  934. procedure tvarsym.write;
  935. var
  936. hvo : tvaroptions;
  937. begin
  938. tsym.write;
  939. writebyte(byte(varspez));
  940. if read_member then
  941. writelong(address);
  942. vartype.write;
  943. { symbols which are load are never candidates for a register,
  944. turn off the regable }
  945. hvo:=varoptions-[vo_regable];
  946. writesmallset(hvo);
  947. if (vo_is_C_var in varoptions) then
  948. writestring(mangledname);
  949. current_ppu^.writeentry(ibvarsym);
  950. end;
  951. procedure tvarsym.setmangledname(const s : string);
  952. begin
  953. _mangledname:=strpnew(s);
  954. end;
  955. function tvarsym.mangledname : string;
  956. var
  957. prefix : string;
  958. begin
  959. if assigned(_mangledname) then
  960. begin
  961. mangledname:=strpas(_mangledname);
  962. exit;
  963. end;
  964. case owner^.symtabletype of
  965. staticsymtable :
  966. if (cs_create_smart in aktmoduleswitches) then
  967. prefix:='_'+owner^.name^+'$$$_'
  968. else
  969. prefix:='_';
  970. unitsymtable,
  971. globalsymtable :
  972. prefix:=
  973. 'U_'+owner^.name^+'_';
  974. else
  975. Message(sym_e_invalid_call_tvarsymmangledname);
  976. end;
  977. mangledname:=prefix+name;
  978. end;
  979. function tvarsym.getsize : longint;
  980. begin
  981. if assigned(vartype.def) then
  982. getsize:=vartype.def^.size
  983. else
  984. getsize:=0;
  985. end;
  986. function tvarsym.getvaluesize : longint;
  987. begin
  988. if assigned(vartype.def) and
  989. (varspez=vs_value) and
  990. ((vartype.def^.deftype<>arraydef) or
  991. (Parraydef(vartype.def)^.highrange>=Parraydef(vartype.def)^.lowrange)) then
  992. getvaluesize:=vartype.def^.size
  993. else
  994. getvaluesize:=0;
  995. end;
  996. function tvarsym.getpushsize : longint;
  997. begin
  998. if assigned(vartype.def) then
  999. begin
  1000. case varspez of
  1001. vs_out,
  1002. vs_var :
  1003. getpushsize:=target_os.size_of_pointer;
  1004. vs_value,
  1005. vs_const :
  1006. begin
  1007. if push_addr_param(vartype.def) then
  1008. getpushsize:=target_os.size_of_pointer
  1009. else
  1010. getpushsize:=vartype.def^.size;
  1011. end;
  1012. end;
  1013. end
  1014. else
  1015. getpushsize:=0;
  1016. end;
  1017. function data_align(length : longint) : longint;
  1018. begin
  1019. (* this is useless under go32v2 at least
  1020. because the section are only align to dword
  1021. if length>8 then
  1022. data_align:=16
  1023. else if length>4 then
  1024. data_align:=8
  1025. else *)
  1026. if length>2 then
  1027. data_align:=4
  1028. else
  1029. if length>1 then
  1030. data_align:=2
  1031. else
  1032. data_align:=1;
  1033. end;
  1034. procedure tvarsym.insert_in_data;
  1035. var
  1036. varalign,
  1037. l,ali,modulo : longint;
  1038. storefilepos : tfileposinfo;
  1039. begin
  1040. if (vo_is_external in varoptions) then
  1041. exit;
  1042. { handle static variables of objects especially }
  1043. if read_member and (owner^.symtabletype=objectsymtable) and
  1044. (sp_static in symoptions) then
  1045. begin
  1046. { the data filed is generated in parser.pas
  1047. with a tobject_FIELDNAME variable }
  1048. { this symbol can't be loaded to a register }
  1049. exclude(varoptions,vo_regable);
  1050. exclude(varoptions,vo_fpuregable);
  1051. end
  1052. else
  1053. if not(read_member) then
  1054. begin
  1055. { made problems with parameters etc. ! (FK) }
  1056. { check for instance of an abstract object or class }
  1057. {
  1058. if (pvarsym(sym)^.definition^.deftype=objectdef) and
  1059. ((pobjectdef(pvarsym(sym)^.definition)^.options and oo_is_abstract)<>0) then
  1060. Message(sym_e_no_instance_of_abstract_object);
  1061. }
  1062. storefilepos:=aktfilepos;
  1063. aktfilepos:=tokenpos;
  1064. if (vo_is_thread_var in varoptions) then
  1065. l:=4
  1066. else
  1067. l:=getvaluesize;
  1068. case owner^.symtabletype of
  1069. stt_exceptsymtable:
  1070. { can contain only one symbol, address calculated later }
  1071. ;
  1072. localsymtable :
  1073. begin
  1074. varstate:=vs_declared;
  1075. modulo:=owner^.datasize and 3;
  1076. {$ifdef m68k}
  1077. { word alignment required for motorola }
  1078. if (l=1) then
  1079. l:=2
  1080. else
  1081. {$endif}
  1082. {
  1083. if (cs_optimize in aktglobalswitches) and
  1084. (aktoptprocessor in [classp5,classp6]) and
  1085. (l>=8) and ((owner^.datasize and 7)<>0) then
  1086. inc(owner^.datasize,8-(owner^.datasize and 7))
  1087. else
  1088. }
  1089. begin
  1090. if (l>=4) and (modulo<>0) then
  1091. inc(l,4-modulo)
  1092. else
  1093. if (l>=2) and ((modulo and 1)<>0) then
  1094. inc(l,2-(modulo and 1));
  1095. end;
  1096. inc(owner^.datasize,l);
  1097. address:=owner^.datasize;
  1098. end;
  1099. staticsymtable :
  1100. begin
  1101. { enable unitialized warning for local symbols }
  1102. varstate:=vs_declared;
  1103. if (cs_create_smart in aktmoduleswitches) then
  1104. bsssegment^.concat(new(pai_cut,init));
  1105. ali:=data_align(l);
  1106. if ali>1 then
  1107. begin
  1108. modulo:=owner^.datasize mod ali;
  1109. if modulo>0 then
  1110. inc(owner^.datasize,ali-modulo);
  1111. end;
  1112. {$ifdef GDB}
  1113. if cs_debuginfo in aktmoduleswitches then
  1114. concatstabto(bsssegment);
  1115. {$endif GDB}
  1116. if (cs_create_smart in aktmoduleswitches) or
  1117. DLLSource or
  1118. (vo_is_exported in varoptions) or
  1119. (vo_is_C_var in varoptions) then
  1120. bsssegment^.concat(new(pai_datablock,init_global(mangledname,l)))
  1121. else
  1122. bsssegment^.concat(new(pai_datablock,init(mangledname,l)));
  1123. { increase datasize }
  1124. inc(owner^.datasize,l);
  1125. { this symbol can't be loaded to a register }
  1126. exclude(varoptions,vo_regable);
  1127. exclude(varoptions,vo_fpuregable);
  1128. end;
  1129. globalsymtable :
  1130. begin
  1131. if (cs_create_smart in aktmoduleswitches) then
  1132. bsssegment^.concat(new(pai_cut,init));
  1133. ali:=data_align(l);
  1134. if ali>1 then
  1135. begin
  1136. modulo:=owner^.datasize mod ali;
  1137. if modulo>0 then
  1138. inc(owner^.datasize,ali-modulo);
  1139. end;
  1140. {$ifdef GDB}
  1141. if cs_debuginfo in aktmoduleswitches then
  1142. concatstabto(bsssegment);
  1143. {$endif GDB}
  1144. bsssegment^.concat(new(pai_datablock,init_global(mangledname,l)));
  1145. inc(owner^.datasize,l);
  1146. { this symbol can't be loaded to a register }
  1147. exclude(varoptions,vo_regable);
  1148. exclude(varoptions,vo_fpuregable);
  1149. end;
  1150. recordsymtable,
  1151. objectsymtable :
  1152. begin
  1153. { this symbol can't be loaded to a register }
  1154. exclude(varoptions,vo_regable);
  1155. exclude(varoptions,vo_fpuregable);
  1156. { get the alignment size }
  1157. if (aktpackrecords=packrecord_C) then
  1158. begin
  1159. varalign:=vartype.def^.alignment;
  1160. if (varalign>4) and ((varalign mod 4)<>0) and
  1161. (vartype.def^.deftype=arraydef) then
  1162. begin
  1163. Message1(sym_w_wrong_C_pack,vartype.def^.typename);
  1164. end;
  1165. if varalign=0 then
  1166. varalign:=l;
  1167. if (owner^.dataalignment<target_os.maxCrecordalignment) then
  1168. begin
  1169. if (varalign>16) and (owner^.dataalignment<32) then
  1170. owner^.dataalignment:=32
  1171. else if (varalign>12) and (owner^.dataalignment<16) then
  1172. owner^.dataalignment:=16
  1173. { 12 is needed for long double }
  1174. else if (varalign>8) and (owner^.dataalignment<12) then
  1175. owner^.dataalignment:=12
  1176. else if (varalign>4) and (owner^.dataalignment<8) then
  1177. owner^.dataalignment:=8
  1178. else if (varalign>2) and (owner^.dataalignment<4) then
  1179. owner^.dataalignment:=4
  1180. else if (varalign>1) and (owner^.dataalignment<2) then
  1181. owner^.dataalignment:=2;
  1182. end;
  1183. if owner^.dataalignment>target_os.maxCrecordalignment then
  1184. owner^.dataalignment:=target_os.maxCrecordalignment;
  1185. end
  1186. else
  1187. varalign:=vartype.def^.alignment;
  1188. if varalign=0 then
  1189. varalign:=l;
  1190. { align record and object fields }
  1191. if (varalign=1) or (owner^.dataalignment=1) then
  1192. begin
  1193. address:=owner^.datasize;
  1194. inc(owner^.datasize,l)
  1195. end
  1196. else if (varalign=2) or (owner^.dataalignment=2) then
  1197. begin
  1198. owner^.datasize:=(owner^.datasize+1) and (not 1);
  1199. address:=owner^.datasize;
  1200. inc(owner^.datasize,l)
  1201. end
  1202. else if (varalign<=4) or (owner^.dataalignment=4) then
  1203. begin
  1204. owner^.datasize:=(owner^.datasize+3) and (not 3);
  1205. address:=owner^.datasize;
  1206. inc(owner^.datasize,l);
  1207. end
  1208. else if (varalign<=8) or (owner^.dataalignment=8) then
  1209. begin
  1210. owner^.datasize:=(owner^.datasize+7) and (not 7);
  1211. address:=owner^.datasize;
  1212. inc(owner^.datasize,l);
  1213. end
  1214. { 12 is needed for C long double support }
  1215. else if (varalign<=12) and (owner^.dataalignment=12) then
  1216. begin
  1217. owner^.datasize:=((owner^.datasize+11) div 12) * 12;
  1218. address:=owner^.datasize;
  1219. inc(owner^.datasize,l);
  1220. end
  1221. else if (varalign<=16) or (owner^.dataalignment=16) then
  1222. begin
  1223. owner^.datasize:=(owner^.datasize+15) and (not 15);
  1224. address:=owner^.datasize;
  1225. inc(owner^.datasize,l);
  1226. end
  1227. else if (varalign<=32) or (owner^.dataalignment=32) then
  1228. begin
  1229. owner^.datasize:=(owner^.datasize+31) and (not 31);
  1230. address:=owner^.datasize;
  1231. inc(owner^.datasize,l);
  1232. end
  1233. else
  1234. internalerror(1000022);
  1235. end;
  1236. parasymtable :
  1237. begin
  1238. { here we need the size of a push instead of the
  1239. size of the data }
  1240. l:=getpushsize;
  1241. varstate:=vs_assigned;
  1242. address:=owner^.datasize;
  1243. owner^.datasize:=align(owner^.datasize+l,target_os.stackalignment);
  1244. end
  1245. else
  1246. begin
  1247. modulo:=owner^.datasize and 3;
  1248. if (l>=4) and (modulo<>0) then
  1249. inc(owner^.datasize,4-modulo)
  1250. else
  1251. if (l>=2) and ((modulo and 1)<>0) then
  1252. inc(owner^.datasize);
  1253. address:=owner^.datasize;
  1254. inc(owner^.datasize,l);
  1255. end;
  1256. end;
  1257. aktfilepos:=storefilepos;
  1258. end;
  1259. end;
  1260. {$ifdef GDB}
  1261. function tvarsym.stabstring : pchar;
  1262. var
  1263. st : string;
  1264. begin
  1265. st:=vartype.def^.numberstring;
  1266. if (owner^.symtabletype = objectsymtable) and
  1267. (sp_static in symoptions) then
  1268. begin
  1269. if (cs_gdb_gsym in aktglobalswitches) then st := 'G'+st else st := 'S'+st;
  1270. {$ifndef Delphi}
  1271. stabstring := strpnew('"'+owner^.name^+'__'+name+':'+st+
  1272. '",'+
  1273. tostr(N_LCSYM)+',0,'+tostr(fileinfo.line)+','+mangledname);
  1274. {$endif}
  1275. end
  1276. else if (owner^.symtabletype = globalsymtable) or
  1277. (owner^.symtabletype = unitsymtable) then
  1278. begin
  1279. { Here we used S instead of
  1280. because with G GDB doesn't look at the address field
  1281. but searches the same name or with a leading underscore
  1282. but these names don't exist in pascal !}
  1283. if (cs_gdb_gsym in aktglobalswitches) then st := 'G'+st else st := 'S'+st;
  1284. stabstring := strpnew('"'+name+':'+st+'",'+
  1285. tostr(N_LCSYM)+',0,'+tostr(fileinfo.line)+','+mangledname);
  1286. end
  1287. else if owner^.symtabletype = staticsymtable then
  1288. begin
  1289. stabstring := strpnew('"'+name+':S'+st+'",'+
  1290. tostr(N_LCSYM)+',0,'+tostr(fileinfo.line)+','+mangledname);
  1291. end
  1292. else if (owner^.symtabletype in [parasymtable,inlineparasymtable]) then
  1293. begin
  1294. case varspez of
  1295. vs_out,
  1296. vs_var : st := 'v'+st;
  1297. vs_value,
  1298. vs_const : if push_addr_param(vartype.def) then
  1299. st := 'v'+st { should be 'i' but 'i' doesn't work }
  1300. else
  1301. st := 'p'+st;
  1302. end;
  1303. stabstring := strpnew('"'+name+':'+st+'",'+
  1304. tostr(N_PSYM)+',0,'+tostr(fileinfo.line)+','+
  1305. tostr(address+owner^.address_fixup));
  1306. {offset to ebp => will not work if the framepointer is esp
  1307. so some optimizing will make things harder to debug }
  1308. end
  1309. else if (owner^.symtabletype in [localsymtable,inlinelocalsymtable]) then
  1310. {$ifdef i386}
  1311. if reg<>R_NO then
  1312. begin
  1313. { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi", "eip", "ps", "cs", "ss", "ds", "es", "fs", "gs", }
  1314. { this is the register order for GDB}
  1315. stabstring:=strpnew('"'+name+':r'+st+'",'+
  1316. tostr(N_RSYM)+',0,'+
  1317. tostr(fileinfo.line)+','+tostr(GDB_i386index[reg]));
  1318. end
  1319. else
  1320. {$endif i386}
  1321. { I don't know if this will work (PM) }
  1322. if (vo_is_C_var in varoptions) then
  1323. stabstring := strpnew('"'+name+':S'+st+'",'+
  1324. tostr(N_LCSYM)+',0,'+tostr(fileinfo.line)+','+mangledname)
  1325. else
  1326. stabstring := strpnew('"'+name+':'+st+'",'+
  1327. tostr(N_LSYM)+',0,'+tostr(fileinfo.line)+',-'+tostr(address-owner^.address_fixup))
  1328. else
  1329. stabstring := inherited stabstring;
  1330. end;
  1331. procedure tvarsym.concatstabto(asmlist : paasmoutput);
  1332. {$ifdef i386}
  1333. var stab_str : pchar;
  1334. {$endif i386}
  1335. begin
  1336. inherited concatstabto(asmlist);
  1337. {$ifdef i386}
  1338. if (owner^.symtabletype=parasymtable) and
  1339. (reg<>R_NO) then
  1340. begin
  1341. { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi", "eip", "ps", "cs", "ss", "ds", "es", "fs", "gs", }
  1342. { this is the register order for GDB}
  1343. stab_str:=strpnew('"'+name+':r'
  1344. +vartype.def^.numberstring+'",'+
  1345. tostr(N_RSYM)+',0,'+
  1346. tostr(fileinfo.line)+','+tostr(GDB_i386index[reg]));
  1347. asmlist^.concat(new(pai_stabs,init(stab_str)));
  1348. end;
  1349. {$endif i386}
  1350. end;
  1351. {$endif GDB}
  1352. {****************************************************************************
  1353. TTYPEDCONSTSYM
  1354. *****************************************************************************}
  1355. constructor ttypedconstsym.init(const n : string;p : pdef;really_const : boolean);
  1356. begin
  1357. tsym.init(n);
  1358. typ:=typedconstsym;
  1359. typedconsttype.setdef(p);
  1360. is_really_const:=really_const;
  1361. prefix:=stringdup(procprefix);
  1362. end;
  1363. constructor ttypedconstsym.inittype(const n : string;const tt : ttype;really_const : boolean);
  1364. begin
  1365. ttypedconstsym.init(n,nil,really_const);
  1366. typedconsttype:=tt;
  1367. end;
  1368. constructor ttypedconstsym.load;
  1369. begin
  1370. tsym.load;
  1371. typ:=typedconstsym;
  1372. typedconsttype.load;
  1373. prefix:=stringdup(readstring);
  1374. is_really_const:=boolean(readbyte);
  1375. end;
  1376. destructor ttypedconstsym.done;
  1377. begin
  1378. stringdispose(prefix);
  1379. tsym.done;
  1380. end;
  1381. function ttypedconstsym.mangledname : string;
  1382. begin
  1383. mangledname:='TC_'+prefix^+'_'+name;
  1384. end;
  1385. function ttypedconstsym.getsize : longint;
  1386. begin
  1387. if assigned(typedconsttype.def) then
  1388. getsize:=typedconsttype.def^.size
  1389. else
  1390. getsize:=0;
  1391. end;
  1392. procedure ttypedconstsym.deref;
  1393. begin
  1394. typedconsttype.resolve;
  1395. end;
  1396. procedure ttypedconstsym.write;
  1397. begin
  1398. tsym.write;
  1399. typedconsttype.write;
  1400. writestring(prefix^);
  1401. writebyte(byte(is_really_const));
  1402. current_ppu^.writeentry(ibtypedconstsym);
  1403. end;
  1404. procedure ttypedconstsym.insert_in_data;
  1405. var
  1406. curconstsegment : paasmoutput;
  1407. l,ali,modulo : longint;
  1408. storefilepos : tfileposinfo;
  1409. begin
  1410. storefilepos:=aktfilepos;
  1411. aktfilepos:=tokenpos;
  1412. if is_really_const then
  1413. curconstsegment:=consts
  1414. else
  1415. curconstsegment:=datasegment;
  1416. if (cs_create_smart in aktmoduleswitches) then
  1417. curconstsegment^.concat(new(pai_cut,init));
  1418. l:=getsize;
  1419. ali:=data_align(l);
  1420. if ali>1 then
  1421. begin
  1422. curconstsegment^.concat(new(pai_align,init(ali)));
  1423. modulo:=owner^.datasize mod ali;
  1424. if modulo>0 then
  1425. inc(owner^.datasize,ali-modulo);
  1426. end;
  1427. { Why was there no owner size update here ??? }
  1428. inc(owner^.datasize,l);
  1429. {$ifdef GDB}
  1430. if cs_debuginfo in aktmoduleswitches then
  1431. concatstabto(curconstsegment);
  1432. {$endif GDB}
  1433. if owner^.symtabletype=globalsymtable then
  1434. begin
  1435. curconstsegment^.concat(new(pai_symbol,initdataname_global(mangledname,getsize)));
  1436. end
  1437. else
  1438. if owner^.symtabletype<>unitsymtable then
  1439. begin
  1440. if (cs_create_smart in aktmoduleswitches) or
  1441. DLLSource then
  1442. curconstsegment^.concat(new(pai_symbol,initdataname_global(mangledname,getsize)))
  1443. else
  1444. curconstsegment^.concat(new(pai_symbol,initdataname(mangledname,getsize)));
  1445. end;
  1446. aktfilepos:=storefilepos;
  1447. end;
  1448. {$ifdef GDB}
  1449. function ttypedconstsym.stabstring : pchar;
  1450. var
  1451. st : char;
  1452. begin
  1453. if (cs_gdb_gsym in aktglobalswitches) and (owner^.symtabletype in [unitsymtable,globalsymtable]) then
  1454. st := 'G'
  1455. else
  1456. st := 'S';
  1457. stabstring := strpnew('"'+name+':'+st+
  1458. typedconsttype.def^.numberstring+'",'+tostr(n_STSYM)+',0,'+
  1459. tostr(fileinfo.line)+','+mangledname);
  1460. end;
  1461. {$endif GDB}
  1462. {****************************************************************************
  1463. TCONSTSYM
  1464. ****************************************************************************}
  1465. constructor tconstsym.init(const n : string;t : tconsttyp;v : TConstExprInt);
  1466. begin
  1467. inherited init(n);
  1468. typ:=constsym;
  1469. consttyp:=t;
  1470. value:=v;
  1471. ResStrIndex:=0;
  1472. consttype.reset;
  1473. len:=0;
  1474. end;
  1475. constructor tconstsym.init_def(const n : string;t : tconsttyp;v : TConstExprInt;def : pdef);
  1476. begin
  1477. inherited init(n);
  1478. typ:=constsym;
  1479. consttyp:=t;
  1480. value:=v;
  1481. consttype.setdef(def);
  1482. len:=0;
  1483. end;
  1484. constructor tconstsym.init_string(const n : string;t : tconsttyp;str:pchar;l:longint);
  1485. begin
  1486. inherited init(n);
  1487. typ:=constsym;
  1488. consttyp:=t;
  1489. value:=longint(str);
  1490. consttype.reset;
  1491. len:=l;
  1492. if t=constresourcestring then
  1493. ResStrIndex:=ResourceStrings^.Register(name,
  1494. pchar(tpointerord(value)),len);
  1495. end;
  1496. constructor tconstsym.load;
  1497. var
  1498. pd : pbestreal;
  1499. ps : pnormalset;
  1500. pc : pchar;
  1501. l1,l2 : longint;
  1502. begin
  1503. tsym.load;
  1504. typ:=constsym;
  1505. consttype.reset;
  1506. consttyp:=tconsttyp(readbyte);
  1507. case consttyp of
  1508. constint:
  1509. if sizeof(tconstexprint)=8 then
  1510. begin
  1511. l1:=readlong;
  1512. l2:=readlong;
  1513. {$ifopt R+}
  1514. {$define Range_check_on}
  1515. {$endif opt R+}
  1516. {$R- needed here }
  1517. value:=qword(l1)+(int64(l2) shl 32);
  1518. {$ifdef Range_check_on}
  1519. {$R+}
  1520. {$undef Range_check_on}
  1521. {$endif Range_check_on}
  1522. end
  1523. else
  1524. value:=readlong;
  1525. constbool,
  1526. constchar :
  1527. value:=readlong;
  1528. constpointer,
  1529. constord :
  1530. begin
  1531. consttype.load;
  1532. if sizeof(TConstExprInt)=8 then
  1533. begin
  1534. l1:=readlong;
  1535. l2:=readlong;
  1536. {$ifopt R+}
  1537. {$define Range_check_on}
  1538. {$endif opt R+}
  1539. {$R- needed here }
  1540. value:=qword(l1)+(int64(l2) shl 32);
  1541. {$ifdef Range_check_on}
  1542. {$R+}
  1543. {$undef Range_check_on}
  1544. {$endif Range_check_on}
  1545. end
  1546. else
  1547. value:=readlong;
  1548. end;
  1549. conststring,constresourcestring :
  1550. begin
  1551. len:=readlong;
  1552. getmem(pc,len+1);
  1553. current_ppu^.getdata(pc^,len);
  1554. if consttyp=constresourcestring then
  1555. ResStrIndex:=readlong;
  1556. value:=tpointerord(pc);
  1557. end;
  1558. constreal :
  1559. begin
  1560. new(pd);
  1561. pd^:=readreal;
  1562. value:=tpointerord(pd);
  1563. end;
  1564. constset :
  1565. begin
  1566. consttype.load;
  1567. new(ps);
  1568. readnormalset(ps^);
  1569. value:=tpointerord(ps);
  1570. end;
  1571. constnil : ;
  1572. else
  1573. Message1(unit_f_ppu_invalid_entry,tostr(ord(consttyp)));
  1574. end;
  1575. end;
  1576. destructor tconstsym.done;
  1577. begin
  1578. case consttyp of
  1579. conststring,constresourcestring :
  1580. freemem(pchar(tpointerord(value)),len+1);
  1581. constreal :
  1582. dispose(pbestreal(tpointerord(value)));
  1583. constset :
  1584. dispose(pnormalset(tpointerord(value)));
  1585. end;
  1586. inherited done;
  1587. end;
  1588. function tconstsym.mangledname : string;
  1589. begin
  1590. mangledname:=name;
  1591. end;
  1592. procedure tconstsym.deref;
  1593. begin
  1594. if consttyp in [constord,constpointer,constset] then
  1595. consttype.resolve;
  1596. end;
  1597. procedure tconstsym.write;
  1598. begin
  1599. tsym.write;
  1600. writebyte(byte(consttyp));
  1601. case consttyp of
  1602. constnil : ;
  1603. constint:
  1604. if sizeof(TConstExprInt)=8 then
  1605. begin
  1606. writelong(lo(value));
  1607. writelong(hi(value));
  1608. end
  1609. else
  1610. writelong(value);
  1611. constbool,
  1612. constchar :
  1613. writelong(value);
  1614. constpointer,
  1615. constord :
  1616. begin
  1617. consttype.write;
  1618. if sizeof(TConstExprInt)=8 then
  1619. begin
  1620. writelong(lo(value));
  1621. writelong(hi(value));
  1622. end
  1623. else
  1624. writelong(value);
  1625. end;
  1626. conststring,constresourcestring :
  1627. begin
  1628. writelong(len);
  1629. current_ppu^.putdata(pchar(TPointerOrd(value))^,len);
  1630. if consttyp=constresourcestring then
  1631. writelong(ResStrIndex);
  1632. end;
  1633. constreal :
  1634. writereal(pbestreal(TPointerOrd(value))^);
  1635. constset :
  1636. begin
  1637. consttype.write;
  1638. writenormalset(pointer(TPointerOrd(value))^);
  1639. end;
  1640. else
  1641. internalerror(13);
  1642. end;
  1643. current_ppu^.writeentry(ibconstsym);
  1644. end;
  1645. {$ifdef GDB}
  1646. function tconstsym.stabstring : pchar;
  1647. var st : string;
  1648. begin
  1649. {even GDB v4.16 only now 'i' 'r' and 'e' !!!}
  1650. case consttyp of
  1651. conststring : begin
  1652. { I had to remove ibm2ascii !! }
  1653. st := pstring(TPointerOrd(value))^;
  1654. {st := ibm2ascii(pstring(value)^);}
  1655. st := 's'''+st+'''';
  1656. end;
  1657. constbool,
  1658. constint,
  1659. constpointer,
  1660. constord,
  1661. constchar : st := 'i'+tostr(value);
  1662. constreal : begin
  1663. system.str(pbestreal(TPointerOrd(value))^,st);
  1664. st := 'r'+st;
  1665. end;
  1666. { if we don't know just put zero !! }
  1667. else st:='i0';
  1668. {***SETCONST}
  1669. {constset:;} {*** I don't know what to do with a set.}
  1670. { sets are not recognized by GDB}
  1671. {***}
  1672. end;
  1673. stabstring := strpnew('"'+name+':c='+st+'",'+tostr(N_function)+',0,'+
  1674. tostr(fileinfo.line)+',0');
  1675. end;
  1676. procedure tconstsym.concatstabto(asmlist : paasmoutput);
  1677. begin
  1678. if consttyp <> conststring then
  1679. inherited concatstabto(asmlist);
  1680. end;
  1681. {$endif GDB}
  1682. {****************************************************************************
  1683. TENUMSYM
  1684. ****************************************************************************}
  1685. constructor tenumsym.init(const n : string;def : penumdef;v : longint);
  1686. begin
  1687. tsym.init(n);
  1688. typ:=enumsym;
  1689. definition:=def;
  1690. value:=v;
  1691. if def^.min>v then
  1692. def^.setmin(v);
  1693. if def^.max<v then
  1694. def^.setmax(v);
  1695. order;
  1696. end;
  1697. constructor tenumsym.load;
  1698. begin
  1699. tsym.load;
  1700. typ:=enumsym;
  1701. definition:=penumdef(readdefref);
  1702. value:=readlong;
  1703. nextenum := Nil;
  1704. end;
  1705. procedure tenumsym.deref;
  1706. begin
  1707. resolvedef(pdef(definition));
  1708. order;
  1709. end;
  1710. procedure tenumsym.order;
  1711. var
  1712. sym : penumsym;
  1713. begin
  1714. sym := definition^.firstenum;
  1715. if sym = nil then
  1716. begin
  1717. definition^.firstenum := @self;
  1718. nextenum := nil;
  1719. exit;
  1720. end;
  1721. { reorder the symbols in increasing value }
  1722. if value < sym^.value then
  1723. begin
  1724. nextenum := sym;
  1725. definition^.firstenum := @self;
  1726. end
  1727. else
  1728. begin
  1729. while (sym^.value <= value) and assigned(sym^.nextenum) do
  1730. sym := sym^.nextenum;
  1731. nextenum := sym^.nextenum;
  1732. sym^.nextenum := @self;
  1733. end;
  1734. end;
  1735. procedure tenumsym.write;
  1736. begin
  1737. tsym.write;
  1738. writedefref(definition);
  1739. writelong(value);
  1740. current_ppu^.writeentry(ibenumsym);
  1741. end;
  1742. {$ifdef GDB}
  1743. procedure tenumsym.concatstabto(asmlist : paasmoutput);
  1744. begin
  1745. {enum elements have no stab !}
  1746. end;
  1747. {$EndIf GDB}
  1748. {****************************************************************************
  1749. TTYPESYM
  1750. ****************************************************************************}
  1751. constructor ttypesym.init(const n : string;const tt : ttype);
  1752. begin
  1753. tsym.init(n);
  1754. typ:=typesym;
  1755. restype:=tt;
  1756. {$ifdef GDB}
  1757. isusedinstab := false;
  1758. {$endif GDB}
  1759. {$ifdef SYNONYM}
  1760. if assigned(restype.def) then
  1761. begin
  1762. if not(assigned(restype.def^.typesym)) then
  1763. begin
  1764. restype.def^.typesym:=@self;
  1765. synonym:=nil;
  1766. include(symoptions,sp_primary_typesym);
  1767. end
  1768. else
  1769. begin
  1770. synonym:=restype.def^.typesym^.synonym;
  1771. restype.def^.typesym^.synonym:=@self;
  1772. end;
  1773. end;
  1774. {$else}
  1775. { register the typesym for the definition }
  1776. if assigned(restype.def) and
  1777. not(assigned(restype.def^.typesym)) then
  1778. restype.def^.typesym:=@self;
  1779. {$endif}
  1780. end;
  1781. constructor ttypesym.initdef(const n : string;d : pdef);
  1782. var
  1783. t : ttype;
  1784. begin
  1785. t.setdef(d);
  1786. ttypesym.init(n,t);
  1787. end;
  1788. constructor ttypesym.load;
  1789. begin
  1790. tsym.load;
  1791. typ:=typesym;
  1792. {$ifdef SYNONYM}
  1793. synonym:=nil;
  1794. {$endif}
  1795. {$ifdef GDB}
  1796. isusedinstab := false;
  1797. {$endif GDB}
  1798. restype.load;
  1799. end;
  1800. {$ifdef SYNONYM}
  1801. destructor ttypesym.done;
  1802. var
  1803. prevsym : ptypesym;
  1804. begin
  1805. if assigned(restype.def) then
  1806. begin
  1807. prevsym:=restype.def^.typesym;
  1808. if prevsym=@self then
  1809. restype.def^.typesym:=synonym;
  1810. while assigned(prevsym) do
  1811. begin
  1812. if (prevsym^.synonym=@self) then
  1813. begin
  1814. prevsym^.synonym:=synonym;
  1815. break;
  1816. end;
  1817. prevsym:=prevsym^.synonym;
  1818. end;
  1819. end;
  1820. synonym:=nil;
  1821. inherited done;
  1822. end;
  1823. {$endif}
  1824. procedure ttypesym.prederef;
  1825. begin
  1826. restype.resolve;
  1827. {$ifdef SYNONYM}
  1828. if assigned(restype.def) then
  1829. begin
  1830. if (sp_primary_typesym in symoptions) then
  1831. begin
  1832. if restype.def^.typesym<>@self then
  1833. synonym:=restype.def^.typesym;
  1834. restype.def^.typesym:=@self;
  1835. end
  1836. else
  1837. begin
  1838. if assigned(restype.def^.typesym) then
  1839. begin
  1840. synonym:=restype.def^.typesym^.synonym;
  1841. if restype.def^.typesym<>@self then
  1842. restype.def^.typesym^.synonym:=@self;
  1843. end
  1844. else
  1845. restype.def^.typesym:=@self;
  1846. end;
  1847. if (restype.def^.deftype=recorddef) and assigned(precorddef(restype.def)^.symtable) and
  1848. (restype.def^.typesym=@self) then
  1849. precorddef(restype.def)^.symtable^.name:=stringdup('record '+name);
  1850. end;
  1851. {$endif}
  1852. end;
  1853. procedure ttypesym.write;
  1854. begin
  1855. tsym.write;
  1856. restype.write;
  1857. current_ppu^.writeentry(ibtypesym);
  1858. end;
  1859. procedure ttypesym.load_references;
  1860. begin
  1861. inherited load_references;
  1862. if (restype.def^.deftype=recorddef) then
  1863. precorddef(restype.def)^.symtable^.load_browser;
  1864. if (restype.def^.deftype=objectdef) then
  1865. pobjectdef(restype.def)^.symtable^.load_browser;
  1866. end;
  1867. function ttypesym.write_references : boolean;
  1868. begin
  1869. if not inherited write_references then
  1870. { write address of this symbol if record or object
  1871. even if no real refs are there
  1872. because we need it for the symtable }
  1873. if (restype.def^.deftype=recorddef) or
  1874. (restype.def^.deftype=objectdef) then
  1875. begin
  1876. writesymref(@self);
  1877. current_ppu^.writeentry(ibsymref);
  1878. end;
  1879. write_references:=true;
  1880. if (restype.def^.deftype=recorddef) then
  1881. precorddef(restype.def)^.symtable^.write_browser;
  1882. if (restype.def^.deftype=objectdef) then
  1883. pobjectdef(restype.def)^.symtable^.write_browser;
  1884. end;
  1885. {$ifdef BrowserLog}
  1886. procedure ttypesym.add_to_browserlog;
  1887. begin
  1888. inherited add_to_browserlog;
  1889. if (restype.def^.deftype=recorddef) then
  1890. precorddef(restype.def)^.symtable^.writebrowserlog;
  1891. if (restype.def^.deftype=objectdef) then
  1892. pobjectdef(restype.def)^.symtable^.writebrowserlog;
  1893. end;
  1894. {$endif BrowserLog}
  1895. {$ifdef GDB}
  1896. function ttypesym.stabstring : pchar;
  1897. var
  1898. stabchar : string[2];
  1899. short : string;
  1900. begin
  1901. if restype.def^.deftype in tagtypes then
  1902. stabchar := 'Tt'
  1903. else
  1904. stabchar := 't';
  1905. short := '"'+name+':'+stabchar+restype.def^.numberstring
  1906. +'",'+tostr(N_LSYM)+',0,'+tostr(fileinfo.line)+',0';
  1907. stabstring := strpnew(short);
  1908. end;
  1909. procedure ttypesym.concatstabto(asmlist : paasmoutput);
  1910. begin
  1911. {not stabs for forward defs }
  1912. if assigned(restype.def) then
  1913. if (restype.def^.typesym = @self) then
  1914. restype.def^.concatstabto(asmlist)
  1915. else
  1916. inherited concatstabto(asmlist);
  1917. end;
  1918. {$endif GDB}
  1919. {****************************************************************************
  1920. TSYSSYM
  1921. ****************************************************************************}
  1922. constructor tsyssym.init(const n : string;l : longint);
  1923. begin
  1924. inherited init(n);
  1925. typ:=syssym;
  1926. number:=l;
  1927. end;
  1928. constructor tsyssym.load;
  1929. begin
  1930. tsym.load;
  1931. typ:=syssym;
  1932. number:=readlong;
  1933. end;
  1934. destructor tsyssym.done;
  1935. begin
  1936. inherited done;
  1937. end;
  1938. procedure tsyssym.write;
  1939. begin
  1940. tsym.write;
  1941. writelong(number);
  1942. current_ppu^.writeentry(ibsyssym);
  1943. end;
  1944. {$ifdef GDB}
  1945. procedure tsyssym.concatstabto(asmlist : paasmoutput);
  1946. begin
  1947. end;
  1948. {$endif GDB}
  1949. {****************************************************************************
  1950. TMACROSYM
  1951. ****************************************************************************}
  1952. constructor tmacrosym.init(const n : string);
  1953. begin
  1954. inherited init(n);
  1955. typ:=macrosym;
  1956. defined:=true;
  1957. defined_at_startup:=false;
  1958. is_used:=false;
  1959. buftext:=nil;
  1960. buflen:=0;
  1961. end;
  1962. destructor tmacrosym.done;
  1963. begin
  1964. if assigned(buftext) then
  1965. freemem(buftext,buflen);
  1966. inherited done;
  1967. end;
  1968. {
  1969. $Log$
  1970. Revision 1.9 2000-09-24 21:19:52 peter
  1971. * delphi compile fixes
  1972. Revision 1.8 2000/09/19 23:08:03 pierre
  1973. * fixes for local class debuggging problem (merged)
  1974. Revision 1.7 2000/08/27 20:19:39 peter
  1975. * store strings with case in ppu, when an internal symbol is created
  1976. a '$' is prefixed so it's not automatic uppercased
  1977. Revision 1.6 2000/08/21 11:27:44 pierre
  1978. * fix the stabs problems
  1979. Revision 1.5 2000/08/16 13:06:07 florian
  1980. + support of 64 bit integer constants
  1981. Revision 1.4 2000/08/13 12:54:56 peter
  1982. * class member decl wrong then no other error after it
  1983. * -vb has now also line numbering
  1984. * -vb is also used for interface/implementation different decls and
  1985. doesn't list the current function (merged)
  1986. Revision 1.3 2000/07/13 12:08:27 michael
  1987. + patched to 1.1.0 with former 1.09patch from peter
  1988. Revision 1.2 2000/07/13 11:32:49 michael
  1989. + removed logs
  1990. }