symsym.inc 64 KB

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