symsym.inc 66 KB

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