symsym.inc 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664
  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. left:=nil;
  24. right:=nil;
  25. setname(n);
  26. typ:=abstractsym;
  27. properties:=current_object_option;
  28. {$ifdef GDB}
  29. isstabwritten := false;
  30. {$endif GDB}
  31. fileinfo:=aktfilepos;
  32. {$ifdef UseBrowser}
  33. defref:=nil;
  34. lastwritten:=nil;
  35. refcount:=0;
  36. if (cs_browser in aktmoduleswitches) and make_ref then
  37. begin
  38. defref:=new(pref,init(defref,@tokenpos));
  39. inc(refcount);
  40. end;
  41. lastref:=defref;
  42. {$endif UseBrowser}
  43. end;
  44. constructor tsym.load;
  45. begin
  46. left:=nil;
  47. right:=nil;
  48. setname(readstring);
  49. typ:=abstractsym;
  50. fillchar(fileinfo,sizeof(fileinfo),0);
  51. if object_options then
  52. properties:=symprop(readbyte)
  53. else
  54. properties:=sp_public;
  55. {$ifdef UseBrowser}
  56. lastref:=nil;
  57. defref:=nil;
  58. lastwritten:=nil;
  59. refcount:=0;
  60. {$endif UseBrowser}
  61. {$ifdef GDB}
  62. isstabwritten := false;
  63. {$endif GDB}
  64. end;
  65. {$ifdef UseBrowser}
  66. procedure tsym.load_references;
  67. var
  68. pos : tfileposinfo;
  69. begin
  70. while (not current_ppu^.endofentry) do
  71. begin
  72. readposinfo(pos);
  73. inc(refcount);
  74. lastref:=new(pref,init(lastref,@pos));
  75. if refcount=1 then
  76. defref:=lastref;
  77. end;
  78. lastwritten:=lastref;
  79. end;
  80. procedure tsym.write_references;
  81. var
  82. ref : pref;
  83. prdef : pdef;
  84. begin
  85. if lastwritten=lastref then
  86. exit;
  87. { write address to this symbol }
  88. writesymref(@self);
  89. { write symbol refs }
  90. if assigned(lastwritten) then
  91. ref:=lastwritten
  92. else
  93. ref:=defref;
  94. while assigned(ref) do
  95. begin
  96. writeposinfo(ref^.posinfo);
  97. ref:=ref^.nextref;
  98. end;
  99. lastwritten:=lastref;
  100. current_ppu^.writeentry(ibsymref);
  101. { when it's a procsym then write also the refs to the definition
  102. due the overloading }
  103. if typ=procsym then
  104. begin
  105. prdef:=pprocsym(@self)^.definition;
  106. while assigned(prdef) do
  107. begin
  108. pprocdef(prdef)^.write_references;
  109. prdef:=pprocdef(prdef)^.nextoverloaded;
  110. end;
  111. end;
  112. end;
  113. procedure tsym.add_to_browserlog;
  114. var
  115. prdef : pprocdef;
  116. begin
  117. if assigned(defref) then
  118. begin
  119. Browse.AddLog('***'+name+'***');
  120. Browse.AddLogRefs(defref);
  121. end;
  122. { when it's a procsym then write also the refs to the definition
  123. due the overloading }
  124. if typ=procsym then
  125. begin
  126. prdef:=pprocsym(@self)^.definition;
  127. while assigned(prdef) do
  128. begin
  129. pprocdef(prdef)^.add_to_browserlog;
  130. prdef:=pprocdef(prdef)^.nextoverloaded;
  131. end;
  132. end;
  133. end;
  134. {$endif UseBrowser}
  135. destructor tsym.done;
  136. begin
  137. {$ifdef tp}
  138. if not(use_big) then
  139. {$endif tp}
  140. strdispose(_name);
  141. {$ifdef UseBrowser}
  142. if assigned(defref) then
  143. dispose(defref,done);
  144. {$endif UseBrowser}
  145. if assigned(left) then
  146. dispose(left,done);
  147. if assigned(right) then
  148. dispose(right,done);
  149. end;
  150. destructor tsym.single_done;
  151. begin
  152. {$ifdef tp}
  153. if not(use_big) then
  154. {$endif tp}
  155. strdispose(_name);
  156. end;
  157. procedure tsym.write;
  158. begin
  159. writestring(name);
  160. if object_options then
  161. writebyte(byte(properties));
  162. {$ifdef UseBrowser}
  163. { if cs_browser in aktmoduleswitches then
  164. write_references; }
  165. {$endif UseBrowser}
  166. end;
  167. procedure tsym.deref;
  168. begin
  169. end;
  170. function tsym.name : string;
  171. {$ifdef tp}
  172. var
  173. s : string;
  174. b : byte;
  175. {$endif}
  176. begin
  177. {$ifdef tp}
  178. if use_big then
  179. begin
  180. symbolstream.seek(longint(_name));
  181. symbolstream.read(b,1);
  182. symbolstream.read(s[1],b);
  183. s[0]:=chr(b);
  184. name:=s;
  185. end
  186. else
  187. {$endif}
  188. if assigned(_name) then
  189. name:=strpas(_name)
  190. else
  191. name:='';
  192. end;
  193. function tsym.mangledname : string;
  194. begin
  195. mangledname:=name;
  196. end;
  197. procedure tsym.setname(const s : string);
  198. begin
  199. setstring(_name,s);
  200. end;
  201. { for most symbol types ther is nothing to do at all }
  202. procedure tsym.insert_in_data;
  203. begin
  204. end;
  205. {$ifdef GDB}
  206. function tsym.stabstring : pchar;
  207. begin
  208. stabstring:=strpnew('"'+name+'",'+tostr(N_LSYM)+',0,'+
  209. tostr(fileinfo.line)+',0');
  210. end;
  211. procedure tsym.concatstabto(asmlist : paasmoutput);
  212. var stab_str : pchar;
  213. begin
  214. if not isstabwritten then
  215. begin
  216. stab_str := stabstring;
  217. if asmlist = debuglist then do_count_dbx := true;
  218. { count_dbx(stab_str); moved to GDB.PAS }
  219. asmlist^.concat(new(pai_stabs,init(stab_str)));
  220. isstabwritten:=true;
  221. end;
  222. end;
  223. {$endif GDB}
  224. {****************************************************************************
  225. TLABELSYM
  226. ****************************************************************************}
  227. constructor tlabelsym.init(const n : string; l : plabel);
  228. begin
  229. inherited init(n);
  230. typ:=labelsym;
  231. number:=l;
  232. number^.is_used:=false;
  233. number^.is_set:=true;
  234. number^.refcount:=0;
  235. defined:=false;
  236. end;
  237. destructor tlabelsym.done;
  238. begin
  239. if not(defined) then
  240. Message1(sym_e_label_not_defined,name);
  241. inherited done;
  242. end;
  243. function tlabelsym.mangledname : string;
  244. begin
  245. { this also sets the is_used field }
  246. mangledname:=lab2str(number);
  247. end;
  248. procedure tlabelsym.write;
  249. begin
  250. Message(sym_e_ill_label_decl);
  251. end;
  252. {****************************************************************************
  253. TUNITSYM
  254. ****************************************************************************}
  255. constructor tunitsym.init(const n : string;ref : punitsymtable);
  256. var
  257. old_make_ref : boolean;
  258. begin
  259. old_make_ref:=make_ref;
  260. make_ref:=false;
  261. inherited init(n);
  262. make_ref:=old_make_ref;
  263. typ:=unitsym;
  264. unitsymtable:=ref;
  265. prevsym:=ref^.unitsym;
  266. ref^.unitsym:=@self;
  267. refs:=0;
  268. end;
  269. destructor tunitsym.done;
  270. begin
  271. if assigned(unitsymtable) and (unitsymtable^.unitsym=@self) then
  272. unitsymtable^.unitsym:=prevsym;
  273. inherited done;
  274. end;
  275. procedure tunitsym.write;
  276. begin
  277. end;
  278. {$ifdef GDB}
  279. procedure tunitsym.concatstabto(asmlist : paasmoutput);
  280. begin
  281. {Nothing to write to stabs !}
  282. end;
  283. {$endif GDB}
  284. {****************************************************************************
  285. TPROCSYM
  286. ****************************************************************************}
  287. constructor tprocsym.init(const n : string);
  288. begin
  289. tsym.init(n);
  290. typ:=procsym;
  291. definition:=nil;
  292. owner:=nil;
  293. {$ifdef GDB}
  294. is_global := false;
  295. {$endif GDB}
  296. end;
  297. constructor tprocsym.load;
  298. begin
  299. tsym.load;
  300. typ:=procsym;
  301. definition:=pprocdef(readdefref);
  302. {$ifdef GDB}
  303. is_global := false;
  304. {$endif GDB}
  305. end;
  306. destructor tprocsym.done;
  307. begin
  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.check_forward;
  320. var
  321. pd : pprocdef;
  322. oldaktfilepos : tfileposinfo;
  323. begin
  324. pd:=definition;
  325. while assigned(pd) do
  326. begin
  327. if pd^.forwarddef then
  328. begin
  329. oldaktfilepos:=aktfilepos;
  330. aktfilepos:=fileinfo;
  331. if assigned(pd^._class) then
  332. Message1(sym_e_forward_not_resolved,pd^._class^.name^+'.'+name+demangledparas(pd^.demangled_paras))
  333. else
  334. Message1(sym_e_forward_not_resolved,name+pd^.demangled_paras);
  335. aktfilepos:=oldaktfilepos;
  336. end;
  337. pd:=pd^.nextoverloaded;
  338. end;
  339. end;
  340. procedure tprocsym.deref;
  341. var t : ttoken;
  342. last : pprocdef;
  343. begin
  344. resolvedef(pdef(definition));
  345. if (definition^.options and pooperator) <> 0 then
  346. begin
  347. last:=definition;
  348. while assigned(last^.nextoverloaded) do
  349. last:=last^.nextoverloaded;
  350. for t:=PLUS to last_overloaded do
  351. if (name=overloaded_names[t]) then
  352. begin
  353. if assigned(overloaded_operators[t]) then
  354. last^.nextoverloaded:=overloaded_operators[t]^.definition;
  355. overloaded_operators[t]:=@self;
  356. end;
  357. end;
  358. end;
  359. procedure tprocsym.write;
  360. begin
  361. tsym.write;
  362. writedefref(pdef(definition));
  363. current_ppu^.writeentry(ibprocsym);
  364. end;
  365. {$ifdef GDB}
  366. function tprocsym.stabstring : pchar;
  367. Var RetType : Char;
  368. Obj,Info : String;
  369. begin
  370. obj := name;
  371. info := '';
  372. if is_global then
  373. RetType := 'F'
  374. else
  375. RetType := 'f';
  376. if assigned(owner) then
  377. begin
  378. if (owner^.symtabletype = objectsymtable) then
  379. obj := owner^.name^+'__'+name;
  380. if (owner^.symtabletype=localsymtable) and assigned(owner^.name) then
  381. info := ','+name+','+owner^.name^;
  382. end;
  383. stabstring :=strpnew('"'+obj+':'+RetType
  384. +definition^.retdef^.numberstring+info+'",'+tostr(n_function)
  385. +',0,'+
  386. tostr(aktfilepos.line)
  387. +','+definition^.mangledname);
  388. end;
  389. procedure tprocsym.concatstabto(asmlist : paasmoutput);
  390. begin
  391. if (definition^.options and pointernproc) <> 0 then exit;
  392. if not isstabwritten then
  393. asmlist^.concat(new(pai_stabs,init(stabstring)));
  394. isstabwritten := true;
  395. if assigned(definition^.parast) then
  396. definition^.parast^.concatstabto(asmlist);
  397. if assigned(definition^.localst) then
  398. definition^.localst^.concatstabto(asmlist);
  399. definition^.is_def_stab_written := true;
  400. end;
  401. {$endif GDB}
  402. {****************************************************************************
  403. TPROGRAMSYM
  404. ****************************************************************************}
  405. constructor tprogramsym.init(const n : string);
  406. begin
  407. inherited init(n);
  408. typ:=programsym;
  409. end;
  410. {****************************************************************************
  411. TERRORSYM
  412. ****************************************************************************}
  413. constructor terrorsym.init;
  414. begin
  415. inherited init('');
  416. typ:=errorsym;
  417. end;
  418. {****************************************************************************
  419. TPROPERTYSYM
  420. ****************************************************************************}
  421. constructor tpropertysym.init(const n : string);
  422. begin
  423. inherited init(n);
  424. typ:=propertysym;
  425. options:=0;
  426. proptype:=nil;
  427. readaccessdef:=nil;
  428. writeaccessdef:=nil;
  429. readaccesssym:=nil;
  430. writeaccesssym:=nil;
  431. index:=$0;
  432. end;
  433. destructor tpropertysym.done;
  434. begin
  435. inherited done;
  436. end;
  437. constructor tpropertysym.load;
  438. begin
  439. inherited load;
  440. typ:=propertysym;
  441. proptype:=readdefref;
  442. options:=readlong;
  443. index:=readlong;
  444. { it's hack ... }
  445. readaccesssym:=psym(stringdup(readstring));
  446. writeaccesssym:=psym(stringdup(readstring));
  447. { now the defs: }
  448. readaccessdef:=readdefref;
  449. writeaccessdef:=readdefref;
  450. end;
  451. procedure tpropertysym.deref;
  452. begin
  453. resolvedef(proptype);
  454. resolvedef(readaccessdef);
  455. resolvedef(writeaccessdef);
  456. { solve the hack we did in load: }
  457. if pstring(readaccesssym)^<>'' then
  458. begin
  459. srsym:=search_class_member(pobjectdef(owner^.defowner),pstring(readaccesssym)^);
  460. if not(assigned(srsym)) then
  461. srsym:=generrorsym;
  462. end
  463. else
  464. srsym:=nil;
  465. stringdispose(pstring(readaccesssym));
  466. readaccesssym:=srsym;
  467. if pstring(writeaccesssym)^<>'' then
  468. begin
  469. srsym:=search_class_member(pobjectdef(owner^.defowner),pstring(writeaccesssym)^);
  470. if not(assigned(srsym)) then
  471. srsym:=generrorsym;
  472. end
  473. else
  474. srsym:=nil;
  475. stringdispose(pstring(writeaccesssym));
  476. writeaccesssym:=srsym;
  477. end;
  478. function tpropertysym.getsize : longint;
  479. begin
  480. getsize:=0;
  481. end;
  482. procedure tpropertysym.write;
  483. begin
  484. tsym.write;
  485. writedefref(proptype);
  486. writelong(options);
  487. writelong(index);
  488. if assigned(readaccesssym) then
  489. writestring(readaccesssym^.name)
  490. else
  491. writestring('');
  492. if assigned(writeaccesssym) then
  493. writestring(writeaccesssym^.name)
  494. else
  495. writestring('');
  496. writedefref(readaccessdef);
  497. writedefref(writeaccessdef);
  498. current_ppu^.writeentry(ibpropertysym);
  499. end;
  500. {$ifdef GDB}
  501. function tpropertysym.stabstring : pchar;
  502. begin
  503. { !!!! don't know how to handle }
  504. stabstring:=strpnew('');
  505. end;
  506. procedure tpropertysym.concatstabto(asmlist : paasmoutput);
  507. begin
  508. { !!!! don't know how to handle }
  509. end;
  510. {$endif GDB}
  511. {****************************************************************************
  512. TFUNCRETSYM
  513. ****************************************************************************}
  514. {$ifdef TEST_FUNCRET}
  515. constructor tfuncretsym.init(const n : string;approcinfo : pointer{pprocinfo});
  516. begin
  517. tsym.init(n);
  518. funcretprocinfo:=approcinfo;
  519. funcretdef:=pprocinfo(approcinfo)^.retdef;
  520. { address valid for ret in param only }
  521. { otherwise set by insert }
  522. address:=pprocinfo(approcinfo)^.retoffset;
  523. end;
  524. {$endif TEST_FUNCRET}
  525. {****************************************************************************
  526. TABSOLUTESYM
  527. ****************************************************************************}
  528. { constructor tabsolutesym.init(const s : string;p : pdef;newref : psym);
  529. begin
  530. inherited init(s,p);
  531. ref:=newref;
  532. typ:=absolutesym;
  533. end; }
  534. constructor tabsolutesym.load;
  535. begin
  536. tvarsym.load;
  537. typ:=absolutesym;
  538. ref:=nil;
  539. address:=0;
  540. asmname:=nil;
  541. abstyp:=absolutetyp(readbyte);
  542. absseg:=false;
  543. case abstyp of
  544. tovar : begin
  545. asmname:=stringdup(readstring);
  546. ref:=srsym;
  547. end;
  548. toasm : asmname:=stringdup(readstring);
  549. toaddr : address:=readlong;
  550. end;
  551. end;
  552. procedure tabsolutesym.write;
  553. begin
  554. tsym.write;
  555. writebyte(byte(varspez));
  556. if read_member then
  557. writelong(address);
  558. writedefref(definition);
  559. writebyte(byte(abstyp));
  560. case abstyp of
  561. tovar : writestring(ref^.name);
  562. toasm : writestring(asmname^);
  563. toaddr : writelong(address);
  564. end;
  565. current_ppu^.writeentry(ibabsolutesym);
  566. end;
  567. procedure tabsolutesym.deref;
  568. begin
  569. resolvedef(definition);
  570. if (abstyp=tovar) and (asmname<>nil) then
  571. begin
  572. { search previous loaded symtables }
  573. getsym(asmname^,false);
  574. if not(assigned(srsym)) then
  575. getsymonlyin(owner,asmname^);
  576. if not(assigned(srsym)) then
  577. srsym:=generrorsym;
  578. ref:=srsym;
  579. stringdispose(asmname);
  580. end;
  581. end;
  582. function tabsolutesym.mangledname : string;
  583. begin
  584. case abstyp of
  585. tovar : mangledname:=ref^.mangledname;
  586. toasm : mangledname:=asmname^;
  587. toaddr : mangledname:='$'+tostr(address);
  588. else
  589. internalerror(10002);
  590. end;
  591. end;
  592. procedure tabsolutesym.insert_in_data;
  593. begin
  594. end;
  595. {$ifdef GDB}
  596. procedure tabsolutesym.concatstabto(asmlist : paasmoutput);
  597. begin
  598. { I don't know how to handle this !! }
  599. end;
  600. {$endif GDB}
  601. {****************************************************************************
  602. TVARSYM
  603. ****************************************************************************}
  604. constructor tvarsym.init(const n : string;p : pdef);
  605. begin
  606. tsym.init(n);
  607. typ:=varsym;
  608. definition:=p;
  609. _mangledname:=nil;
  610. varspez:=vs_value;
  611. address:=0;
  612. refs:=0;
  613. is_valid := 1;
  614. var_options:=0;
  615. { can we load the value into a register ? }
  616. case p^.deftype of
  617. pointerdef,
  618. enumdef,
  619. procvardef : var_options:=var_options or vo_regable;
  620. orddef : case porddef(p)^.typ of
  621. u8bit,u16bit,u32bit,
  622. bool8bit,bool16bit,bool32bit,
  623. s8bit,s16bit,s32bit :
  624. var_options:=var_options or vo_regable;
  625. else
  626. var_options:=var_options and not vo_regable;
  627. end;
  628. else
  629. var_options:=var_options and not vo_regable;
  630. end;
  631. reg:=R_NO;
  632. end;
  633. constructor tvarsym.load;
  634. begin
  635. tsym.load;
  636. typ:=varsym;
  637. _mangledname:=nil;
  638. varspez:=tvarspez(readbyte);
  639. if read_member then
  640. address:=readlong
  641. else
  642. address:=0;
  643. definition:=readdefref;
  644. refs := 0;
  645. is_valid := 1;
  646. { symbols which are load are never candidates for a register }
  647. var_options:=0;
  648. { was regable:=false; }
  649. reg:=R_NO;
  650. end;
  651. constructor tvarsym.init_C(const n,mangled : string;p : pdef);
  652. begin
  653. { The tvarsym is necessary for 0.99.5 (PFV) }
  654. tvarsym.init(n,p);
  655. var_options:=var_options or vo_is_C_var;
  656. _mangledname:=strpnew(target_os.Cprefix+mangled);
  657. end;
  658. constructor tvarsym.load_C;
  659. begin
  660. { Adding tvarsym removes the warning }
  661. tvarsym.load;
  662. typ:=varsym;
  663. var_options:=readbyte;
  664. _mangledname:=strpnew(readstring);
  665. end;
  666. procedure tvarsym.deref;
  667. begin
  668. resolvedef(definition);
  669. end;
  670. procedure tvarsym.write;
  671. begin
  672. tsym.write;
  673. writebyte(byte(varspez));
  674. if read_member then
  675. writelong(address);
  676. writedefref(definition);
  677. if (var_options and vo_is_C_var)<>0 then
  678. begin
  679. writebyte(var_options);
  680. writestring(mangledname);
  681. end;
  682. if (var_options and vo_is_C_var)<>0 then
  683. current_ppu^.writeentry(ibvarsym_C)
  684. else
  685. current_ppu^.writeentry(ibvarsym);
  686. end;
  687. function tvarsym.mangledname : string;
  688. var
  689. prefix : string;
  690. begin
  691. if assigned(_mangledname) then
  692. begin
  693. mangledname:=strpas(_mangledname);
  694. exit;
  695. end;
  696. case owner^.symtabletype of
  697. staticsymtable : if (cs_smartlink in aktmoduleswitches) then
  698. prefix:='_'+owner^.name^+'$$$_'
  699. else
  700. prefix:='_';
  701. unitsymtable,
  702. globalsymtable : prefix:='U_'+owner^.name^+'_';
  703. else
  704. Message(sym_e_invalid_call_tvarsymmangledname);
  705. end;
  706. mangledname:=prefix+name;
  707. end;
  708. function tvarsym.getsize : longint;
  709. begin
  710. { only if the definition is set, we could determine the }
  711. { size, this is if an error occurs while reading the type }
  712. { also used for operator, this allows not to allocate the }
  713. { return size twice }
  714. if assigned(definition) then
  715. begin
  716. case varspez of
  717. vs_value : getsize:=definition^.size;
  718. vs_var : begin
  719. { open arrays push also the high valye }
  720. if (definition^.deftype=arraydef) and
  721. (parraydef(definition)^.lowrange=0) and
  722. (parraydef(definition)^.highrange=-1) then
  723. getsize:=sizeof(pointer)+4
  724. else
  725. getsize:=sizeof(pointer);
  726. end;
  727. vs_const : begin
  728. case definition^.deftype of
  729. stringdef,
  730. recorddef,
  731. objectdef,
  732. setdef : getsize:=sizeof(pointer);
  733. arraydef : begin
  734. { open arrays push also the high valye }
  735. if (parraydef(definition)^.lowrange=0) and
  736. (parraydef(definition)^.highrange=-1) then
  737. getsize:=sizeof(pointer)+4
  738. else
  739. getsize:=sizeof(pointer);
  740. end;
  741. else
  742. getsize:=definition^.size;
  743. end;
  744. end;
  745. end;
  746. end
  747. else
  748. getsize:=0;
  749. end;
  750. procedure tvarsym.insert_in_data;
  751. var
  752. l,modulo : longint;
  753. begin
  754. if (var_options and vo_is_external)<>0 then
  755. exit;
  756. { handle static variables of objects especially }
  757. if read_member and (owner^.symtabletype=objectsymtable) and
  758. ((properties and sp_static)<>0) then
  759. begin
  760. { the data filed is generated in parser.pas
  761. with a tobject_FIELDNAME variable }
  762. { this symbol can't be loaded to a register }
  763. var_options:=var_options and not vo_regable;
  764. end
  765. else
  766. if not(read_member) then
  767. begin
  768. { made problems with parameters etc. ! (FK) }
  769. { check for instance of an abstract object or class }
  770. {
  771. if (pvarsym(sym)^.definition^.deftype=objectdef) and
  772. ((pobjectdef(pvarsym(sym)^.definition)^.options and oois_abstract)<>0) then
  773. Message(sym_e_no_instance_of_abstract_object);
  774. }
  775. l:=getsize;
  776. case owner^.symtabletype of
  777. stt_exceptsymtable:
  778. { can contain only one symbol, address calculated later }
  779. ;
  780. localsymtable : begin
  781. is_valid := 0;
  782. modulo:=owner^.datasize and 3;
  783. {$ifdef m68k}
  784. { word alignment required for motorola }
  785. if (l=1) then
  786. l:=2
  787. else
  788. {$endif}
  789. if (l>=4) and (modulo<>0) then
  790. inc(l,4-modulo)
  791. else
  792. if (l>=2) and ((modulo and 1)<>0) then
  793. inc(l,2-(modulo and 1));
  794. inc(owner^.datasize,l);
  795. address:=owner^.datasize;
  796. end;
  797. staticsymtable : begin
  798. if (cs_smartlink in aktmoduleswitches) then
  799. bsssegment^.concat(new(pai_cut,init));
  800. {$ifdef GDB}
  801. if cs_debuginfo in aktmoduleswitches then
  802. concatstabto(bsssegment);
  803. {$endif GDB}
  804. if (cs_smartlink in aktmoduleswitches) or
  805. ((var_options and vo_is_c_var)<>0) then
  806. bsssegment^.concat(new(pai_datablock,init_global(mangledname,l)))
  807. else
  808. bsssegment^.concat(new(pai_datablock,init(mangledname,l)));
  809. { increase datasize }
  810. inc(owner^.datasize,l);
  811. { this symbol can't be loaded to a register }
  812. var_options:=var_options and not vo_regable;
  813. end;
  814. globalsymtable : begin
  815. if (cs_smartlink in aktmoduleswitches) then
  816. bsssegment^.concat(new(pai_cut,init));
  817. {$ifdef GDB}
  818. if cs_debuginfo in aktmoduleswitches then
  819. concatstabto(bsssegment);
  820. {$endif GDB}
  821. bsssegment^.concat(new(pai_datablock,init_global(mangledname,l)));
  822. inc(owner^.datasize,l);
  823. { this symbol can't be loaded to a register }
  824. var_options:=var_options and not vo_regable;
  825. end;
  826. recordsymtable,
  827. objectsymtable : begin
  828. { this symbol can't be loaded to a register }
  829. var_options:=var_options and not vo_regable;
  830. { align record and object fields }
  831. if (l=1) or (aktpackrecords=1) then
  832. begin
  833. address:=owner^.datasize;
  834. inc(owner^.datasize,l)
  835. end
  836. else
  837. if (l=2) or (aktpackrecords=2) then
  838. begin
  839. owner^.datasize:=(owner^.datasize+1) and (not 1);
  840. address:=owner^.datasize;
  841. inc(owner^.datasize,l)
  842. end
  843. else
  844. if (l<=4) or (aktpackrecords=4) then
  845. begin
  846. owner^.datasize:=(owner^.datasize+3) and (not 3);
  847. address:=owner^.datasize;
  848. inc(owner^.datasize,l);
  849. end
  850. else
  851. if (l<=16) or (aktpackrecords=16) then
  852. begin
  853. owner^.datasize:=(owner^.datasize+15) and (not 15);
  854. address:=owner^.datasize;
  855. inc(owner^.datasize,l);
  856. end;
  857. end;
  858. parasymtable : begin
  859. address:=owner^.datasize;
  860. { needs word alignment }
  861. if odd(l) then
  862. inc(owner^.datasize,l+1)
  863. else
  864. inc(owner^.datasize,l);
  865. end
  866. else
  867. begin
  868. modulo:=owner^.datasize and 3 ;
  869. if (l>=4) and (modulo<>0) then
  870. inc(owner^.datasize,4-modulo)
  871. else
  872. if (l>=2) and ((modulo and 1)<>0) then
  873. { nice piece of code !!
  874. inc(owner^.datasize,2-(datasize and 1));
  875. 2 - (datasize and 1) is allways 1 in this case
  876. Florian when will your global stream analyser
  877. find this out ?? }
  878. inc(owner^.datasize);
  879. address:=owner^.datasize;
  880. inc(owner^.datasize,l);
  881. end;
  882. end;
  883. end;
  884. end;
  885. {$ifdef GDB}
  886. function tvarsym.stabstring : pchar;
  887. var
  888. st : char;
  889. begin
  890. if (owner^.symtabletype = objectsymtable) and
  891. ((properties and sp_static)<>0) then
  892. begin
  893. if use_gsym then st := 'G' else st := 'S';
  894. stabstring := strpnew('"'+owner^.name^+'__'+name+':'+
  895. +definition^.numberstring+'",'+
  896. tostr(N_LCSYM)+',0,'+tostr(fileinfo.line)+','+mangledname);
  897. end
  898. else if (owner^.symtabletype = globalsymtable) or
  899. (owner^.symtabletype = unitsymtable) then
  900. begin
  901. { Here we used S instead of
  902. because with G GDB doesn't look at the address field
  903. but searches the same name or with a leading underscore
  904. but these names don't exist in pascal !}
  905. if use_gsym then st := 'G' else st := 'S';
  906. stabstring := strpnew('"'+name+':'+st
  907. +definition^.numberstring+'",'+
  908. tostr(N_LCSYM)+',0,'+tostr(fileinfo.line)+','+mangledname);
  909. end
  910. else if owner^.symtabletype = staticsymtable then
  911. begin
  912. stabstring := strpnew('"'+name+':S'
  913. +definition^.numberstring+'",'+
  914. tostr(N_LCSYM)+',0,'+tostr(fileinfo.line)+','+mangledname);
  915. end
  916. else if (owner^.symtabletype=parasymtable) then
  917. begin
  918. case varspez of
  919. vs_value : st := 'p';
  920. vs_var : st := 'v';
  921. vs_const : if dont_copy_const_param(definition) then
  922. st := 'v'{ should be 'i' but 'i' doesn't work }
  923. else
  924. st := 'p';
  925. end;
  926. stabstring := strpnew('"'+name+':'+st
  927. +definition^.numberstring+'",'+
  928. tostr(N_PSYM)+',0,'+tostr(fileinfo.line)+','+
  929. tostr(address+owner^.call_offset));
  930. {offset to ebp => will not work if the framepointer is esp
  931. so some optimizing will make things harder to debug }
  932. end
  933. else if (owner^.symtabletype=localsymtable) then
  934. {$ifdef i386}
  935. if reg<>R_NO then
  936. begin
  937. { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi", "eip", "ps", "cs", "ss", "ds", "es", "fs", "gs", }
  938. { this is the register order for GDB}
  939. stabstring:=strpnew('"'+name+':r'
  940. +definition^.numberstring+'",'+
  941. tostr(N_RSYM)+',0,'+
  942. tostr(fileinfo.line)+','+tostr(GDB_i386index[reg]));
  943. end
  944. else
  945. {$endif i386}
  946. stabstring := strpnew('"'+name+':'
  947. +definition^.numberstring+'",'+
  948. tostr(N_LSYM)+',0,'+tostr(fileinfo.line)+',-'+tostr(address))
  949. else
  950. stabstring := inherited stabstring;
  951. end;
  952. procedure tvarsym.concatstabto(asmlist : paasmoutput);
  953. {$ifdef i386}
  954. var stab_str : pchar;
  955. {$endif i386}
  956. begin
  957. inherited concatstabto(asmlist);
  958. {$ifdef i386}
  959. if (owner^.symtabletype=parasymtable) and
  960. (reg<>R_NO) then
  961. begin
  962. { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi", "eip", "ps", "cs", "ss", "ds", "es", "fs", "gs", }
  963. { this is the register order for GDB}
  964. stab_str:=strpnew('"'+name+':r'
  965. +definition^.numberstring+'",'+
  966. tostr(N_RSYM)+',0,'+
  967. tostr(fileinfo.line)+','+tostr(GDB_i386index[reg]));
  968. asmlist^.concat(new(pai_stabs,init(stab_str)));
  969. end;
  970. {$endif i386}
  971. end;
  972. {$endif GDB}
  973. destructor tvarsym.done;
  974. begin
  975. strdispose(_mangledname);
  976. inherited done;
  977. end;
  978. {****************************************************************************
  979. TTYPEDCONSTSYM
  980. *****************************************************************************}
  981. constructor ttypedconstsym.init(const n : string;p : pdef);
  982. begin
  983. tsym.init(n);
  984. typ:=typedconstsym;
  985. definition:=p;
  986. prefix:=stringdup(procprefix);
  987. end;
  988. constructor ttypedconstsym.load;
  989. begin
  990. tsym.load;
  991. typ:=typedconstsym;
  992. definition:=readdefref;
  993. prefix:=stringdup(readstring);
  994. end;
  995. destructor ttypedconstsym.done;
  996. begin
  997. stringdispose(prefix);
  998. tsym.done;
  999. end;
  1000. function ttypedconstsym.mangledname : string;
  1001. begin
  1002. mangledname:='TC_'+prefix^+'_'+name;
  1003. end;
  1004. procedure ttypedconstsym.deref;
  1005. begin
  1006. resolvedef(definition);
  1007. end;
  1008. procedure ttypedconstsym.write;
  1009. begin
  1010. tsym.write;
  1011. writedefref(definition);
  1012. writestring(prefix^);
  1013. current_ppu^.writeentry(ibtypedconstsym);
  1014. end;
  1015. { for most symbol types ther is nothing to do at all }
  1016. procedure ttypedconstsym.insert_in_data;
  1017. begin
  1018. { here there is a problem for ansistrings !! }
  1019. { we must write the label only after the 12 header bytes (PM)
  1020. if not is_ansistring(definition) then
  1021. }
  1022. { solved, the ansis string is moved to consts (FK) }
  1023. really_insert_in_data;
  1024. end;
  1025. procedure ttypedconstsym.really_insert_in_data;
  1026. begin
  1027. if owner^.symtabletype=globalsymtable then
  1028. begin
  1029. if (cs_smartlink in aktmoduleswitches) then
  1030. datasegment^.concat(new(pai_cut,init));
  1031. {$ifdef GDB}
  1032. if cs_debuginfo in aktmoduleswitches then
  1033. concatstabto(datasegment);
  1034. {$endif GDB}
  1035. datasegment^.concat(new(pai_symbol,init_global(mangledname)));
  1036. end
  1037. else
  1038. if owner^.symtabletype<>unitsymtable then
  1039. begin
  1040. if (cs_smartlink in aktmoduleswitches) then
  1041. datasegment^.concat(new(pai_cut,init));
  1042. {$ifdef GDB}
  1043. if cs_debuginfo in aktmoduleswitches then
  1044. concatstabto(datasegment);
  1045. {$endif GDB}
  1046. if (cs_smartlink in aktmoduleswitches) then
  1047. datasegment^.concat(new(pai_symbol,init_global(mangledname)))
  1048. else
  1049. datasegment^.concat(new(pai_symbol,init(mangledname)));
  1050. end;
  1051. end;
  1052. {$ifdef GDB}
  1053. function ttypedconstsym.stabstring : pchar;
  1054. var
  1055. st : char;
  1056. begin
  1057. if use_gsym and (owner^.symtabletype in [unitsymtable,globalsymtable]) then
  1058. st := 'G'
  1059. else
  1060. st := 'S';
  1061. stabstring := strpnew('"'+name+':'+st+
  1062. definition^.numberstring+'",'+tostr(n_STSYM)+',0,'+
  1063. tostr(fileinfo.line)+','+mangledname);
  1064. end;
  1065. {$endif GDB}
  1066. {****************************************************************************
  1067. TCONSTSYM
  1068. ****************************************************************************}
  1069. constructor tconstsym.init(const n : string;t : tconsttype;v : longint;def : pdef);
  1070. begin
  1071. tsym.init(n);
  1072. typ:=constsym;
  1073. definition:=def;
  1074. consttype:=t;
  1075. value:=v;
  1076. end;
  1077. constructor tconstsym.load;
  1078. var
  1079. pd : pbestreal;
  1080. ps : pnormalset;
  1081. begin
  1082. tsym.load;
  1083. typ:=constsym;
  1084. consttype:=tconsttype(readbyte);
  1085. case consttype of
  1086. constint,
  1087. constbool,
  1088. constchar : value:=readlong;
  1089. constord : begin
  1090. definition:=readdefref;
  1091. value:=readlong;
  1092. end;
  1093. conststring : value:=longint(stringdup(readstring));
  1094. constreal : begin
  1095. new(pd);
  1096. pd^:=readreal;
  1097. value:=longint(pd);
  1098. end;
  1099. constseta : begin
  1100. definition:=readdefref;
  1101. new(ps);
  1102. readnormalset(ps^);
  1103. value:=longint(ps);
  1104. end;
  1105. else
  1106. Message1(unit_f_ppu_invalid_entry,tostr(ord(consttype)));
  1107. end;
  1108. end;
  1109. destructor tconstsym.done;
  1110. begin
  1111. case consttype of
  1112. conststring : stringdispose(pstring(value));
  1113. constreal : dispose(pbestreal(value));
  1114. constseta : dispose(pnormalset(value));
  1115. end;
  1116. inherited done;
  1117. end;
  1118. function tconstsym.mangledname : string;
  1119. begin
  1120. mangledname:=name;
  1121. end;
  1122. procedure tconstsym.deref;
  1123. begin
  1124. if consttype in [constord,constseta] then
  1125. resolvedef(pdef(definition));
  1126. end;
  1127. procedure tconstsym.write;
  1128. begin
  1129. tsym.write;
  1130. writebyte(byte(consttype));
  1131. case consttype of
  1132. constint,
  1133. constbool,
  1134. constchar : writelong(value);
  1135. constord : begin
  1136. writedefref(definition);
  1137. writelong(value);
  1138. end;
  1139. conststring : writestring(pstring(value)^);
  1140. constreal : writereal(pbestreal(value)^);
  1141. constseta : begin
  1142. writedefref(definition);
  1143. writenormalset(pointer(value)^);
  1144. end;
  1145. else
  1146. internalerror(13);
  1147. end;
  1148. current_ppu^.writeentry(ibconstsym);
  1149. end;
  1150. {$ifdef GDB}
  1151. function tconstsym.stabstring : pchar;
  1152. var st : string;
  1153. begin
  1154. {even GDB v4.16 only now 'i' 'r' and 'e' !!!}
  1155. case consttype of
  1156. conststring : begin
  1157. { I had to remove ibm2ascii !! }
  1158. st := pstring(value)^;
  1159. {st := ibm2ascii(pstring(value)^);}
  1160. st := 's'''+st+'''';
  1161. end;
  1162. constbool, constint, constord, constchar : st := 'i'+tostr(value);
  1163. constreal : begin
  1164. system.str(pbestreal(value)^,st);
  1165. st := 'r'+st;
  1166. end;
  1167. { if we don't know just put zero !! }
  1168. else st:='i0';
  1169. {***SETCONST}
  1170. {constset:;} {*** I don't know what to do with a set.}
  1171. { sets are not recognized by GDB}
  1172. {***}
  1173. end;
  1174. stabstring := strpnew('"'+name+':c='+st+'",'+tostr(N_function)+',0,'+
  1175. tostr(fileinfo.line)+',0');
  1176. end;
  1177. procedure tconstsym.concatstabto(asmlist : paasmoutput);
  1178. begin
  1179. if consttype <> conststring then
  1180. inherited concatstabto(asmlist);
  1181. end;
  1182. {$endif GDB}
  1183. {****************************************************************************
  1184. TENUMSYM
  1185. ****************************************************************************}
  1186. constructor tenumsym.init(const n : string;def : penumdef;v : longint);
  1187. begin
  1188. tsym.init(n);
  1189. typ:=enumsym;
  1190. definition:=def;
  1191. value:=v;
  1192. {$ifdef GDB}
  1193. order;
  1194. {$endif GDB}
  1195. end;
  1196. constructor tenumsym.load;
  1197. begin
  1198. tsym.load;
  1199. typ:=enumsym;
  1200. definition:=penumdef(readdefref);
  1201. value:=readlong;
  1202. {$ifdef GDB}
  1203. next := Nil;
  1204. {$endif GDB}
  1205. end;
  1206. procedure tenumsym.deref;
  1207. begin
  1208. resolvedef(pdef(definition));
  1209. {$ifdef GDB}
  1210. order;
  1211. {$endif}
  1212. end;
  1213. {$ifdef GDB}
  1214. procedure tenumsym.order;
  1215. var sym : penumsym;
  1216. begin
  1217. sym := definition^.first;
  1218. if sym = nil then
  1219. begin
  1220. definition^.first := @self;
  1221. next := nil;
  1222. exit;
  1223. end;
  1224. {reorder the symbols in increasing value }
  1225. if value < sym^.value then
  1226. begin
  1227. next := sym;
  1228. definition^.first := @self;
  1229. end else
  1230. begin
  1231. while (sym^.value <= value) and assigned(sym^.next) do
  1232. sym := sym^.next;
  1233. next := sym^.next;
  1234. sym^.next := @self;
  1235. end;
  1236. end;
  1237. {$endif GDB}
  1238. procedure tenumsym.write;
  1239. begin
  1240. tsym.write;
  1241. writedefref(definition);
  1242. writelong(value);
  1243. current_ppu^.writeentry(ibenumsym);
  1244. end;
  1245. {$ifdef GDB}
  1246. procedure tenumsym.concatstabto(asmlist : paasmoutput);
  1247. begin
  1248. {enum elements have no stab !}
  1249. end;
  1250. {$EndIf GDB}
  1251. {****************************************************************************
  1252. TTYPESYM
  1253. ****************************************************************************}
  1254. constructor ttypesym.init(const n : string;d : pdef);
  1255. begin
  1256. tsym.init(n);
  1257. typ:=typesym;
  1258. definition:=d;
  1259. {$ifdef GDB}
  1260. isusedinstab := false;
  1261. {$endif GDB}
  1262. forwardpointer:=nil;
  1263. { this allows to link definitions with the type with declares }
  1264. { them }
  1265. if assigned(definition) then
  1266. if definition^.sym=nil then
  1267. definition^.sym:=@self;
  1268. end;
  1269. constructor ttypesym.load;
  1270. begin
  1271. tsym.load;
  1272. typ:=typesym;
  1273. forwardpointer:=nil;
  1274. {$ifdef GDB}
  1275. isusedinstab := false;
  1276. {$endif GDB}
  1277. definition:=readdefref;
  1278. end;
  1279. destructor ttypesym.done;
  1280. begin
  1281. if assigned(definition) then
  1282. if definition^.sym=@self then
  1283. definition^.sym:=nil;
  1284. inherited done;
  1285. end;
  1286. procedure ttypesym.deref;
  1287. begin
  1288. resolvedef(definition);
  1289. if assigned(definition) then
  1290. if definition^.sym=nil then
  1291. definition^.sym:=@self;
  1292. if definition^.deftype=recorddef then
  1293. precdef(definition)^.symtable^.name:=stringdup('record '+name);
  1294. {if definition^.deftype=objectdef then
  1295. pobjectdef(definition)^.publicsyms^.name:=stringdup('object '+name);
  1296. done in tobjectdef.load }
  1297. end;
  1298. procedure ttypesym.write;
  1299. begin
  1300. tsym.write;
  1301. writedefref(definition);
  1302. current_ppu^.writeentry(ibtypesym);
  1303. end;
  1304. {$ifdef GDB}
  1305. function ttypesym.stabstring : pchar;
  1306. var stabchar : string[2];
  1307. short : string;
  1308. begin
  1309. if definition^.deftype in tagtypes then
  1310. stabchar := 'Tt'
  1311. else
  1312. stabchar := 't';
  1313. short := '"'+name+':'+stabchar+definition^.numberstring
  1314. +'",'+tostr(N_LSYM)+',0,'+tostr(fileinfo.line)+',0';
  1315. stabstring := strpnew(short);
  1316. end;
  1317. procedure ttypesym.concatstabto(asmlist : paasmoutput);
  1318. begin
  1319. {not stabs for forward defs }
  1320. if assigned(definition) then
  1321. if (definition^.sym = @self) then
  1322. definition^.concatstabto(asmlist)
  1323. else
  1324. inherited concatstabto(asmlist);
  1325. end;
  1326. {$endif GDB}
  1327. {****************************************************************************
  1328. TSYSSYM
  1329. ****************************************************************************}
  1330. constructor tsyssym.init(const n : string;l : longint);
  1331. begin
  1332. inherited init(n);
  1333. typ:=syssym;
  1334. number:=l;
  1335. end;
  1336. procedure tsyssym.write;
  1337. begin
  1338. end;
  1339. {$ifdef GDB}
  1340. procedure tsyssym.concatstabto(asmlist : paasmoutput);
  1341. begin
  1342. end;
  1343. {$endif GDB}
  1344. {****************************************************************************
  1345. TMACROSYM
  1346. ****************************************************************************}
  1347. constructor tmacrosym.init(const n : string);
  1348. begin
  1349. inherited init(n);
  1350. defined:=true;
  1351. buftext:=nil;
  1352. buflen:=0;
  1353. end;
  1354. destructor tmacrosym.done;
  1355. begin
  1356. if assigned(buftext) then
  1357. freemem(buftext,buflen);
  1358. inherited done;
  1359. end;
  1360. {
  1361. $Log$
  1362. Revision 1.31 1998-08-17 10:10:12 peter
  1363. - removed OLDPPU
  1364. Revision 1.30 1998/08/13 10:57:29 peter
  1365. * constant sets are now written correctly to the ppufile
  1366. Revision 1.29 1998/08/11 15:31:42 peter
  1367. * write extended to ppu file
  1368. * new version 0.99.7
  1369. Revision 1.28 1998/08/11 14:07:27 peter
  1370. * fixed pushing of high value for openarray
  1371. Revision 1.27 1998/08/10 14:50:31 peter
  1372. + localswitches, moduleswitches, globalswitches splitting
  1373. Revision 1.26 1998/08/10 10:18:35 peter
  1374. + Compiler,Comphook unit which are the new interface units to the
  1375. compiler
  1376. Revision 1.25 1998/07/30 11:18:19 florian
  1377. + first implementation of try ... except on .. do end;
  1378. * limitiation of 65535 bytes parameters for cdecl removed
  1379. Revision 1.24 1998/07/20 18:40:16 florian
  1380. * handling of ansi string constants should now work
  1381. Revision 1.23 1998/07/14 21:37:24 peter
  1382. * fixed packrecords as discussed at the alias
  1383. Revision 1.22 1998/07/14 14:47:08 peter
  1384. * released NEWINPUT
  1385. Revision 1.21 1998/07/13 21:17:38 florian
  1386. * changed to compile with TP
  1387. Revision 1.20 1998/07/10 00:00:05 peter
  1388. * fixed ttypesym bug finally
  1389. * fileinfo in the symtable and better using for unused vars
  1390. Revision 1.19 1998/07/07 17:40:39 peter
  1391. * packrecords 4 works
  1392. * word aligning of parameters
  1393. Revision 1.18 1998/07/07 11:20:15 peter
  1394. + NEWINPUT for a better inputfile and scanner object
  1395. Revision 1.17 1998/06/24 14:48:40 peter
  1396. * ifdef newppu -> ifndef oldppu
  1397. Revision 1.16 1998/06/19 15:40:42 peter
  1398. * removed cosntructor/constructor warning and 0.99.5 recompiles it again
  1399. Revision 1.15 1998/06/17 14:10:18 peter
  1400. * small os2 fixes
  1401. * fixed interdependent units with newppu (remake3 under linux works now)
  1402. Revision 1.14 1998/06/16 08:56:34 peter
  1403. + targetcpu
  1404. * cleaner pmodules for newppu
  1405. Revision 1.13 1998/06/15 15:38:10 pierre
  1406. * small bug in systems.pas corrected
  1407. + operators in different units better hanlded
  1408. Revision 1.12 1998/06/15 14:23:44 daniel
  1409. * Reverted my changes.
  1410. Revision 1.10 1998/06/13 00:10:18 peter
  1411. * working browser and newppu
  1412. * some small fixes against crashes which occured in bp7 (but not in
  1413. fpc?!)
  1414. Revision 1.9 1998/06/12 16:15:35 pierre
  1415. * external name 'C_var';
  1416. export name 'intern_C_var';
  1417. cdecl;
  1418. cdecl;external;
  1419. are now supported only with -Sv switch
  1420. Revision 1.8 1998/06/11 10:11:59 peter
  1421. * -gb works again
  1422. Revision 1.7 1998/06/09 16:01:51 pierre
  1423. + added procedure directive parsing for procvars
  1424. (accepted are popstack cdecl and pascal)
  1425. + added C vars with the following syntax
  1426. var C calias 'true_c_name';(can be followed by external)
  1427. reason is that you must add the Cprefix
  1428. which is target dependent
  1429. Revision 1.6 1998/06/08 22:59:53 peter
  1430. * smartlinking works for win32
  1431. * some defines to exclude some compiler parts
  1432. Revision 1.5 1998/06/04 23:52:02 peter
  1433. * m68k compiles
  1434. + .def file creation moved to gendef.pas so it could also be used
  1435. for win32
  1436. Revision 1.4 1998/06/04 09:55:46 pierre
  1437. * demangled name of procsym reworked to become independant of the mangling scheme
  1438. Revision 1.3 1998/06/03 22:14:20 florian
  1439. * problem with sizes of classes fixed (if the anchestor was declared
  1440. forward, the compiler doesn't update the child classes size)
  1441. Revision 1.2 1998/05/28 14:40:29 peter
  1442. * fixes for newppu, remake3 works now with it
  1443. Revision 1.1 1998/05/27 19:45:09 peter
  1444. * symtable.pas splitted into includefiles
  1445. * symtable adapted for $ifndef OLDPPU
  1446. }