symsym.inc 66 KB

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