symsym.inc 65 KB

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