symsym.inc 66 KB

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