symsym.inc 67 KB

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