symsym.inc 72 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl, Pierre Muller
  4. Implementation for the symbols types of the symtable
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. {****************************************************************************
  19. TSYM (base for all symtypes)
  20. ****************************************************************************}
  21. constructor tsym.init(const n : string);
  22. begin
  23. inherited initname(n);
  24. typ:=abstractsym;
  25. properties:=current_object_option;
  26. {$ifdef GDB}
  27. isstabwritten := false;
  28. {$endif GDB}
  29. fileinfo:=tokenpos;
  30. defref:=nil;
  31. lastwritten:=nil;
  32. refcount:=0;
  33. if (cs_browser in aktmoduleswitches) and make_ref then
  34. begin
  35. defref:=new(pref,init(defref,@tokenpos));
  36. inc(refcount);
  37. end;
  38. lastref:=defref;
  39. end;
  40. constructor tsym.load;
  41. begin
  42. inherited init;
  43. indexnr:=readword;
  44. setname(readstring);
  45. typ:=abstractsym;
  46. properties:=symprop(readbyte);
  47. readposinfo(fileinfo);
  48. lastref:=nil;
  49. defref:=nil;
  50. lastwritten:=nil;
  51. refcount:=0;
  52. {$ifdef GDB}
  53. isstabwritten := false;
  54. {$endif GDB}
  55. end;
  56. procedure tsym.load_references;
  57. var
  58. pos : tfileposinfo;
  59. move_last : boolean;
  60. begin
  61. move_last:=lastwritten=lastref;
  62. while (not current_ppu^.endofentry) do
  63. begin
  64. readposinfo(pos);
  65. inc(refcount);
  66. lastref:=new(pref,init(lastref,@pos));
  67. lastref^.is_written:=true;
  68. if refcount=1 then
  69. defref:=lastref;
  70. end;
  71. if move_last then
  72. lastwritten:=lastref;
  73. end;
  74. { big problem here :
  75. wrong refs were written because of
  76. interface parsing of other units PM
  77. moduleindex must be checked !! }
  78. function tsym.write_references : boolean;
  79. var
  80. ref : pref;
  81. symref_written,move_last : boolean;
  82. begin
  83. write_references:=false;
  84. if lastwritten=lastref then
  85. exit;
  86. { should we update lastref }
  87. move_last:=true;
  88. symref_written:=false;
  89. { write symbol refs }
  90. if assigned(lastwritten) then
  91. ref:=lastwritten
  92. else
  93. ref:=defref;
  94. while assigned(ref) do
  95. begin
  96. if ref^.moduleindex=current_module^.unit_index then
  97. begin
  98. { write address to this symbol }
  99. if not symref_written then
  100. begin
  101. writesymref(@self);
  102. symref_written:=true;
  103. end;
  104. writeposinfo(ref^.posinfo);
  105. ref^.is_written:=true;
  106. if move_last then
  107. lastwritten:=ref;
  108. end
  109. else if not ref^.is_written then
  110. move_last:=false
  111. else if move_last then
  112. lastwritten:=ref;
  113. ref:=ref^.nextref;
  114. end;
  115. if symref_written then
  116. current_ppu^.writeentry(ibsymref);
  117. write_references:=symref_written;
  118. end;
  119. {$ifdef BrowserLog}
  120. procedure tsym.add_to_browserlog;
  121. begin
  122. if assigned(defref) then
  123. begin
  124. browserlog.AddLog('***'+name+'***');
  125. browserlog.AddLogRefs(defref);
  126. end;
  127. end;
  128. {$endif BrowserLog}
  129. destructor tsym.done;
  130. begin
  131. if assigned(defref) then
  132. dispose(defref,done);
  133. inherited done;
  134. end;
  135. procedure tsym.write;
  136. begin
  137. writeword(indexnr);
  138. writestring(name);
  139. writebyte(byte(properties));
  140. writeposinfo(fileinfo);
  141. end;
  142. procedure tsym.deref;
  143. begin
  144. end;
  145. function tsym.mangledname : string;
  146. begin
  147. mangledname:=name;
  148. end;
  149. { for most symbol types there is nothing to do at all }
  150. procedure tsym.insert_in_data;
  151. begin
  152. end;
  153. {$ifdef GDB}
  154. function tsym.stabstring : pchar;
  155. begin
  156. stabstring:=strpnew('"'+name+'",'+tostr(N_LSYM)+',0,'+
  157. tostr(fileinfo.line)+',0');
  158. end;
  159. procedure tsym.concatstabto(asmlist : paasmoutput);
  160. var stab_str : pchar;
  161. begin
  162. if not isstabwritten then
  163. begin
  164. stab_str := stabstring;
  165. if asmlist = debuglist then do_count_dbx := true;
  166. { count_dbx(stab_str); moved to GDB.PAS }
  167. asmlist^.concat(new(pai_stabs,init(stab_str)));
  168. isstabwritten:=true;
  169. end;
  170. end;
  171. {$endif GDB}
  172. {****************************************************************************
  173. TLABELSYM
  174. ****************************************************************************}
  175. constructor tlabelsym.init(const n : string; l : pasmlabel);
  176. begin
  177. inherited init(n);
  178. typ:=labelsym;
  179. lab:=l;
  180. defined:=false;
  181. end;
  182. constructor tlabelsym.load;
  183. begin
  184. tsym.load;
  185. typ:=labelsym;
  186. { this is all dummy
  187. it is only used for local browsing }
  188. lab:=nil;
  189. defined:=true;
  190. end;
  191. destructor tlabelsym.done;
  192. begin
  193. inherited done;
  194. end;
  195. function tlabelsym.mangledname : string;
  196. begin
  197. mangledname:=lab^.name;
  198. end;
  199. procedure tlabelsym.write;
  200. begin
  201. if owner^.symtabletype in [unitsymtable,globalsymtable] then
  202. Message(sym_e_ill_label_decl)
  203. else
  204. begin
  205. tsym.write;
  206. current_ppu^.writeentry(iblabelsym);
  207. end;
  208. end;
  209. {****************************************************************************
  210. TUNITSYM
  211. ****************************************************************************}
  212. constructor tunitsym.init(const n : string;ref : punitsymtable);
  213. var
  214. old_make_ref : boolean;
  215. begin
  216. old_make_ref:=make_ref;
  217. make_ref:=false;
  218. inherited init(n);
  219. make_ref:=old_make_ref;
  220. typ:=unitsym;
  221. unitsymtable:=ref;
  222. prevsym:=ref^.unitsym;
  223. ref^.unitsym:=@self;
  224. refs:=0;
  225. end;
  226. constructor tunitsym.load;
  227. begin
  228. tsym.load;
  229. typ:=unitsym;
  230. unitsymtable:=punitsymtable(current_module^.globalsymtable);
  231. prevsym:=nil;
  232. end;
  233. { we need to remove it from the prevsym chain ! }
  234. destructor tunitsym.done;
  235. var pus,ppus : punitsym;
  236. begin
  237. if assigned(unitsymtable) then
  238. begin
  239. ppus:=nil;
  240. pus:=unitsymtable^.unitsym;
  241. if pus=@self then
  242. unitsymtable^.unitsym:=prevsym
  243. else while assigned(pus) do
  244. begin
  245. if pus=@self then
  246. begin
  247. ppus^.prevsym:=prevsym;
  248. break;
  249. end
  250. else
  251. begin
  252. ppus:=pus;
  253. pus:=ppus^.prevsym;
  254. end;
  255. end;
  256. end;
  257. prevsym:=nil;
  258. unitsymtable:=nil;
  259. inherited done;
  260. end;
  261. procedure tunitsym.write;
  262. begin
  263. tsym.write;
  264. current_ppu^.writeentry(ibunitsym);
  265. end;
  266. {$ifdef GDB}
  267. procedure tunitsym.concatstabto(asmlist : paasmoutput);
  268. begin
  269. {Nothing to write to stabs !}
  270. end;
  271. {$endif GDB}
  272. {****************************************************************************
  273. TPROCSYM
  274. ****************************************************************************}
  275. constructor tprocsym.init(const n : string);
  276. begin
  277. tsym.init(n);
  278. typ:=procsym;
  279. definition:=nil;
  280. owner:=nil;
  281. {$ifdef GDB}
  282. is_global := false;
  283. {$endif GDB}
  284. end;
  285. constructor tprocsym.load;
  286. begin
  287. tsym.load;
  288. typ:=procsym;
  289. definition:=pprocdef(readdefref);
  290. {$ifdef GDB}
  291. is_global := false;
  292. {$endif GDB}
  293. end;
  294. destructor tprocsym.done;
  295. begin
  296. { don't check if errors !! }
  297. if Errorcount=0 then
  298. check_forward;
  299. tsym.done;
  300. end;
  301. function tprocsym.mangledname : string;
  302. begin
  303. mangledname:=definition^.mangledname;
  304. end;
  305. function tprocsym.demangledname:string;
  306. begin
  307. demangledname:=name+definition^.demangled_paras;
  308. end;
  309. procedure tprocsym.write_parameter_lists;
  310. var
  311. p : pprocdef;
  312. begin
  313. p:=definition;
  314. while assigned(p) do
  315. begin
  316. { force the error to be printed }
  317. Verbose.Message1(sym_b_param_list,name+p^.demangled_paras);
  318. p:=p^.nextoverloaded;
  319. end;
  320. end;
  321. procedure tprocsym.check_forward;
  322. var
  323. pd : pprocdef;
  324. begin
  325. pd:=definition;
  326. while assigned(pd) do
  327. begin
  328. if pd^.forwarddef then
  329. begin
  330. if assigned(pd^._class) then
  331. MessagePos1(fileinfo,sym_e_forward_not_resolved,pd^._class^.objname^+'.'+name+
  332. demangledparas(pd^.demangled_paras))
  333. else
  334. MessagePos1(fileinfo,sym_e_forward_not_resolved,name+pd^.demangled_paras);
  335. { Turn futher error messages off }
  336. pd^.forwarddef:=false;
  337. end;
  338. pd:=pd^.nextoverloaded;
  339. end;
  340. end;
  341. procedure tprocsym.deref;
  342. var
  343. t : ttoken;
  344. last : pprocdef;
  345. begin
  346. resolvedef(pdef(definition));
  347. if (definition^.options and pooperator) <> 0 then
  348. begin
  349. last:=definition;
  350. while assigned(last^.nextoverloaded) do
  351. last:=last^.nextoverloaded;
  352. for t:=first_overloaded to last_overloaded do
  353. if (name=overloaded_names[t]) then
  354. begin
  355. if assigned(overloaded_operators[t]) then
  356. last^.nextoverloaded:=overloaded_operators[t]^.definition;
  357. overloaded_operators[t]:=@self;
  358. end;
  359. end;
  360. end;
  361. procedure tprocsym.write;
  362. begin
  363. tsym.write;
  364. writedefref(pdef(definition));
  365. current_ppu^.writeentry(ibprocsym);
  366. end;
  367. procedure tprocsym.load_references;
  368. (*var
  369. prdef,prdef2 : pprocdef;
  370. b : byte; *)
  371. begin
  372. inherited load_references;
  373. (*prdef:=definition;
  374. done in tsymtable.load_browser (PM)
  375. { take care about operators !! }
  376. if (current_module^.flags and uf_has_browser) <>0 then
  377. while assigned(prdef) and (prdef^.owner=definition^.owner) do
  378. begin
  379. b:=current_ppu^.readentry;
  380. if b<>ibdefref then
  381. Message(unit_f_ppu_read_error);
  382. prdef2:=pprocdef(readdefref);
  383. resolvedef(prdef2);
  384. if prdef<>prdef2 then
  385. Message(unit_f_ppu_read_error);
  386. prdef^.load_references;
  387. prdef:=prdef^.nextoverloaded;
  388. end; *)
  389. end;
  390. function tprocsym.write_references : boolean;
  391. var
  392. prdef : pprocdef;
  393. begin
  394. write_references:=false;
  395. if not inherited write_references then
  396. exit;
  397. write_references:=true;
  398. prdef:=definition;
  399. while assigned(prdef) and (prdef^.owner=definition^.owner) do
  400. begin
  401. prdef^.write_references;
  402. prdef:=prdef^.nextoverloaded;
  403. end;
  404. end;
  405. {$ifdef BrowserLog}
  406. procedure tprocsym.add_to_browserlog;
  407. var
  408. prdef : pprocdef;
  409. begin
  410. inherited add_to_browserlog;
  411. prdef:=definition;
  412. while assigned(prdef) do
  413. begin
  414. pprocdef(prdef)^.add_to_browserlog;
  415. prdef:=pprocdef(prdef)^.nextoverloaded;
  416. end;
  417. end;
  418. {$endif BrowserLog}
  419. {$ifdef GDB}
  420. function tprocsym.stabstring : pchar;
  421. Var RetType : Char;
  422. Obj,Info : String;
  423. stabsstr : string;
  424. p : pchar;
  425. begin
  426. obj := name;
  427. info := '';
  428. if is_global then
  429. RetType := 'F'
  430. else
  431. RetType := 'f';
  432. if assigned(owner) then
  433. begin
  434. if (owner^.symtabletype = objectsymtable) then
  435. obj := owner^.name^+'__'+name;
  436. { this code was correct only as long as the local symboltable
  437. of the parent had the same name as the function
  438. but this is no true anymore !! PM
  439. if (owner^.symtabletype=localsymtable) and assigned(owner^.name) then
  440. info := ','+name+','+owner^.name^; }
  441. if (owner^.symtabletype=localsymtable) and assigned(owner^.defowner) and
  442. assigned(owner^.defowner^.sym) then
  443. info := ','+name+','+owner^.defowner^.sym^.name;
  444. end;
  445. stabsstr:=definition^.mangledname;
  446. getmem(p,length(stabsstr)+255);
  447. strpcopy(p,'"'+obj+':'+RetType
  448. +definition^.retdef^.numberstring+info+'",'+tostr(n_function)
  449. +',0,'+
  450. tostr(aktfilepos.line)
  451. +',');
  452. strpcopy(strend(p),stabsstr);
  453. stabstring:=strnew(p);
  454. freemem(p,length(stabsstr)+255);
  455. end;
  456. procedure tprocsym.concatstabto(asmlist : paasmoutput);
  457. begin
  458. if (definition^.options and pointernproc) <> 0 then exit;
  459. if not isstabwritten then
  460. asmlist^.concat(new(pai_stabs,init(stabstring)));
  461. isstabwritten := true;
  462. if assigned(definition^.parast) then
  463. definition^.parast^.concatstabto(asmlist);
  464. if assigned(definition^.localst) then
  465. definition^.localst^.concatstabto(asmlist);
  466. definition^.is_def_stab_written := true;
  467. end;
  468. {$endif GDB}
  469. {****************************************************************************
  470. TPROGRAMSYM
  471. ****************************************************************************}
  472. constructor tprogramsym.init(const n : string);
  473. begin
  474. inherited init(n);
  475. typ:=programsym;
  476. end;
  477. {****************************************************************************
  478. TERRORSYM
  479. ****************************************************************************}
  480. constructor terrorsym.init;
  481. begin
  482. inherited init('');
  483. typ:=errorsym;
  484. end;
  485. {****************************************************************************
  486. TPROPERTYSYM
  487. ****************************************************************************}
  488. constructor tpropertysym.init(const n : string);
  489. begin
  490. inherited init(n);
  491. typ:=propertysym;
  492. options:=0;
  493. proptype:=nil;
  494. readaccessdef:=nil;
  495. writeaccessdef:=nil;
  496. readaccesssym:=nil;
  497. writeaccesssym:=nil;
  498. storedsym:=nil;
  499. storeddef:=nil;
  500. index:=0;
  501. default:=0;
  502. end;
  503. destructor tpropertysym.done;
  504. begin
  505. inherited done;
  506. end;
  507. constructor tpropertysym.load;
  508. begin
  509. inherited load;
  510. typ:=propertysym;
  511. proptype:=readdefref;
  512. options:=readlong;
  513. index:=readlong;
  514. default:=readlong;
  515. { it's hack ... }
  516. {$ifdef oldpropppu}
  517. readaccesssym:=psym(stringdup(readstring));
  518. writeaccesssym:=psym(stringdup(readstring));
  519. storedsym:=psym(stringdup(readstring));
  520. {$else oldpropppu}
  521. readaccesssym:=readsymref;
  522. writeaccesssym:=readsymref;
  523. storedsym:=readsymref;
  524. {$endif oldpropppu}
  525. { now the defs: }
  526. readaccessdef:=readdefref;
  527. writeaccessdef:=readdefref;
  528. storeddef:=readdefref;
  529. end;
  530. procedure tpropertysym.deref;
  531. begin
  532. resolvedef(proptype);
  533. resolvedef(readaccessdef);
  534. resolvedef(writeaccessdef);
  535. resolvedef(storeddef);
  536. {$ifdef oldpropppu}
  537. { solve the hack we did in load: }
  538. if pstring(readaccesssym)^<>'' then
  539. begin
  540. srsym:=search_class_member(pobjectdef(owner^.defowner),pstring(readaccesssym)^);
  541. if not(assigned(srsym)) then
  542. srsym:=generrorsym;
  543. end
  544. else
  545. srsym:=nil;
  546. stringdispose(pstring(readaccesssym));
  547. readaccesssym:=srsym;
  548. if pstring(writeaccesssym)^<>'' then
  549. begin
  550. srsym:=search_class_member(pobjectdef(owner^.defowner),pstring(writeaccesssym)^);
  551. if not(assigned(srsym)) then
  552. srsym:=generrorsym;
  553. end
  554. else
  555. srsym:=nil;
  556. stringdispose(pstring(writeaccesssym));
  557. writeaccesssym:=srsym;
  558. if pstring(storedsym)^<>'' then
  559. begin
  560. srsym:=search_class_member(pobjectdef(owner^.defowner),pstring(storedsym)^);
  561. if not(assigned(srsym)) then
  562. srsym:=generrorsym;
  563. end
  564. else
  565. srsym:=nil;
  566. stringdispose(pstring(storedsym));
  567. storedsym:=srsym;
  568. {$else oldpropppu}
  569. resolvesym(readaccesssym);
  570. resolvesym(writeaccesssym);
  571. resolvesym(storedsym);
  572. {$endif oldpropppu}
  573. end;
  574. function tpropertysym.getsize : longint;
  575. begin
  576. getsize:=0;
  577. end;
  578. procedure tpropertysym.write;
  579. begin
  580. tsym.write;
  581. writedefref(proptype);
  582. writelong(options);
  583. writelong(index);
  584. writelong(default);
  585. {$ifdef oldpropppu}
  586. if assigned(readaccesssym) then
  587. writestring(readaccesssym^.name)
  588. else
  589. writestring('');
  590. if assigned(writeaccesssym) then
  591. writestring(writeaccesssym^.name)
  592. else
  593. writestring('');
  594. if assigned(storedsym) then
  595. writestring(storedsym^.name)
  596. else
  597. writestring('');
  598. {$else oldpropppu}
  599. writesymref(readaccesssym);
  600. writesymref(writeaccesssym);
  601. writesymref(storedsym);
  602. {$endif oldpropppu}
  603. writedefref(readaccessdef);
  604. writedefref(writeaccessdef);
  605. writedefref(storeddef);
  606. current_ppu^.writeentry(ibpropertysym);
  607. end;
  608. {$ifdef GDB}
  609. function tpropertysym.stabstring : pchar;
  610. begin
  611. { !!!! don't know how to handle }
  612. stabstring:=strpnew('');
  613. end;
  614. procedure tpropertysym.concatstabto(asmlist : paasmoutput);
  615. begin
  616. { !!!! don't know how to handle }
  617. end;
  618. {$endif GDB}
  619. {****************************************************************************
  620. TFUNCRETSYM
  621. ****************************************************************************}
  622. constructor tfuncretsym.init(const n : string;approcinfo : pointer{pprocinfo});
  623. begin
  624. tsym.init(n);
  625. typ:=funcretsym;
  626. funcretprocinfo:=approcinfo;
  627. funcretdef:=pprocinfo(approcinfo)^.retdef;
  628. { address valid for ret in param only }
  629. { otherwise set by insert }
  630. address:=pprocinfo(approcinfo)^.retoffset;
  631. end;
  632. constructor tfuncretsym.load;
  633. begin
  634. tsym.load;
  635. funcretdef:=readdefref;
  636. address:=readlong;
  637. funcretprocinfo:=nil;
  638. typ:=funcretsym;
  639. end;
  640. procedure tfuncretsym.write;
  641. begin
  642. (*
  643. Normally all references are
  644. transfered to the function symbol itself !! PM *)
  645. tsym.write;
  646. writedefref(funcretdef);
  647. writelong(address);
  648. current_ppu^.writeentry(ibfuncretsym);
  649. end;
  650. procedure tfuncretsym.deref;
  651. begin
  652. resolvedef(funcretdef);
  653. end;
  654. {$ifdef GDB}
  655. procedure tfuncretsym.concatstabto(asmlist : paasmoutput);
  656. begin
  657. { Nothing to do here, it is done in genexitcode }
  658. end;
  659. {$endif GDB}
  660. procedure tfuncretsym.insert_in_data;
  661. var
  662. l : longint;
  663. begin
  664. { allocate space in local if ret in acc or in fpu }
  665. if ret_in_acc(procinfo.retdef) or (procinfo.retdef^.deftype=floatdef) then
  666. begin
  667. l:=funcretdef^.size;
  668. inc(owner^.datasize,l);
  669. {$ifdef m68k}
  670. { word alignment required for motorola }
  671. if (l=1) then
  672. inc(owner^.datasize,1)
  673. else
  674. {$endif}
  675. if (l>=4) and ((owner^.datasize and 3)<>0) then
  676. inc(owner^.datasize,4-(owner^.datasize and 3))
  677. else if (l>=2) and ((owner^.datasize and 1)<>0) then
  678. inc(owner^.datasize,2-(owner^.datasize and 1));
  679. address:=owner^.datasize;
  680. procinfo.retoffset:=-owner^.datasize;
  681. end;
  682. end;
  683. {****************************************************************************
  684. TABSOLUTESYM
  685. ****************************************************************************}
  686. constructor tabsolutesym.init(const n : string;p : pdef);
  687. begin
  688. inherited init(n,p);
  689. typ:=absolutesym;
  690. end;
  691. constructor tabsolutesym.load;
  692. begin
  693. tvarsym.load;
  694. typ:=absolutesym;
  695. ref:=nil;
  696. address:=0;
  697. asmname:=nil;
  698. abstyp:=absolutetyp(readbyte);
  699. absseg:=false;
  700. case abstyp of
  701. tovar :
  702. begin
  703. asmname:=stringdup(readstring);
  704. ref:=srsym;
  705. end;
  706. toasm :
  707. asmname:=stringdup(readstring);
  708. toaddr :
  709. begin
  710. address:=readlong;
  711. absseg:=boolean(readbyte);
  712. end;
  713. end;
  714. end;
  715. procedure tabsolutesym.write;
  716. begin
  717. tsym.write;
  718. writebyte(byte(varspez));
  719. if read_member then
  720. writelong(address);
  721. writedefref(definition);
  722. writebyte(var_options and (not vo_regable));
  723. writebyte(byte(abstyp));
  724. case abstyp of
  725. tovar :
  726. writestring(ref^.name);
  727. toasm :
  728. writestring(asmname^);
  729. toaddr :
  730. begin
  731. writelong(address);
  732. writebyte(byte(absseg));
  733. end;
  734. end;
  735. current_ppu^.writeentry(ibabsolutesym);
  736. end;
  737. procedure tabsolutesym.deref;
  738. begin
  739. resolvedef(definition);
  740. if (abstyp=tovar) and (asmname<>nil) then
  741. begin
  742. { search previous loaded symtables }
  743. getsym(asmname^,false);
  744. if not(assigned(srsym)) then
  745. getsymonlyin(owner,asmname^);
  746. if not(assigned(srsym)) then
  747. srsym:=generrorsym;
  748. ref:=srsym;
  749. stringdispose(asmname);
  750. end;
  751. end;
  752. function tabsolutesym.mangledname : string;
  753. begin
  754. case abstyp of
  755. tovar :
  756. mangledname:=ref^.mangledname;
  757. toasm :
  758. mangledname:=asmname^;
  759. toaddr :
  760. mangledname:='$'+tostr(address);
  761. else
  762. internalerror(10002);
  763. end;
  764. end;
  765. procedure tabsolutesym.insert_in_data;
  766. begin
  767. end;
  768. {$ifdef GDB}
  769. procedure tabsolutesym.concatstabto(asmlist : paasmoutput);
  770. begin
  771. { I don't know how to handle this !! }
  772. end;
  773. {$endif GDB}
  774. {****************************************************************************
  775. TVARSYM
  776. ****************************************************************************}
  777. constructor tvarsym.init(const n : string;p : pdef);
  778. begin
  779. tsym.init(n);
  780. typ:=varsym;
  781. definition:=p;
  782. _mangledname:=nil;
  783. varspez:=vs_value;
  784. address:=0;
  785. islocalcopy:=false;
  786. localvarsym:=nil;
  787. refs:=0;
  788. is_valid := 1;
  789. var_options:=0;
  790. { can we load the value into a register ? }
  791. case p^.deftype of
  792. pointerdef,
  793. enumdef,
  794. procvardef :
  795. var_options:=var_options or vo_regable;
  796. orddef :
  797. case porddef(p)^.typ of
  798. bool8bit,bool16bit,bool32bit,
  799. u8bit,u16bit,u32bit,
  800. s8bit,s16bit,s32bit :
  801. var_options:=var_options or vo_regable;
  802. else
  803. var_options:=var_options and not vo_regable;
  804. end;
  805. setdef:
  806. if psetdef(p)^.settype=smallset then
  807. var_options:=var_options or vo_regable;
  808. else
  809. var_options:=var_options and not vo_regable;
  810. end;
  811. reg:=R_NO;
  812. end;
  813. constructor tvarsym.init_dll(const n : string;p : pdef);
  814. begin
  815. { The tvarsym is necessary for 0.99.5 (PFV) }
  816. tvarsym.init(n,p);
  817. var_options:=var_options or vo_is_dll_var;
  818. end;
  819. constructor tvarsym.init_C(const n,mangled : string;p : pdef);
  820. begin
  821. { The tvarsym is necessary for 0.99.5 (PFV) }
  822. tvarsym.init(n,p);
  823. var_options:=var_options or vo_is_C_var;
  824. setmangledname(mangled);
  825. end;
  826. constructor tvarsym.load;
  827. begin
  828. tsym.load;
  829. typ:=varsym;
  830. _mangledname:=nil;
  831. reg:=R_NO;
  832. refs := 0;
  833. is_valid := 1;
  834. varspez:=tvarspez(readbyte);
  835. if read_member then
  836. address:=readlong
  837. else
  838. address:=0;
  839. islocalcopy:=false;
  840. localvarsym:=nil;
  841. definition:=readdefref;
  842. var_options:=readbyte;
  843. if (var_options and vo_is_C_var)<>0 then
  844. setmangledname(readstring);
  845. end;
  846. procedure tvarsym.deref;
  847. begin
  848. resolvedef(definition);
  849. end;
  850. procedure tvarsym.write;
  851. begin
  852. tsym.write;
  853. writebyte(byte(varspez));
  854. if read_member then
  855. writelong(address);
  856. writedefref(definition);
  857. { symbols which are load are never candidates for a register,
  858. turn off the regable }
  859. writebyte(var_options and (not vo_regable));
  860. if (var_options and vo_is_C_var)<>0 then
  861. writestring(mangledname);
  862. current_ppu^.writeentry(ibvarsym);
  863. end;
  864. procedure tvarsym.setmangledname(const s : string);
  865. begin
  866. _mangledname:=strpnew(s);
  867. end;
  868. function tvarsym.mangledname : string;
  869. var
  870. prefix : string;
  871. begin
  872. if assigned(_mangledname) then
  873. begin
  874. mangledname:=strpas(_mangledname);
  875. exit;
  876. end;
  877. case owner^.symtabletype of
  878. staticsymtable :
  879. if (cs_smartlink in aktmoduleswitches) then
  880. prefix:='_'+owner^.name^+'$$$_'
  881. else
  882. prefix:='_';
  883. unitsymtable,
  884. globalsymtable :
  885. prefix:='U_'+owner^.name^+'_';
  886. else
  887. Message(sym_e_invalid_call_tvarsymmangledname);
  888. end;
  889. mangledname:=prefix+name;
  890. end;
  891. function tvarsym.getsize : longint;
  892. begin
  893. if assigned(definition) and (varspez=vs_value) then
  894. getsize:=definition^.size
  895. else
  896. getsize:=0;
  897. end;
  898. function tvarsym.getpushsize : longint;
  899. begin
  900. if assigned(definition) then
  901. begin
  902. case varspez of
  903. vs_var :
  904. getpushsize:=target_os.size_of_pointer;
  905. vs_value,
  906. vs_const :
  907. begin
  908. (*case definition^.deftype of
  909. arraydef,
  910. setdef,
  911. stringdef,
  912. recorddef,
  913. objectdef :
  914. getpushsize:=target_os.size_of_pointer;
  915. else
  916. getpushsize:=definition^.size;
  917. this is obsolete use push_param instead (PM) *)
  918. if push_addr_param(definition) then
  919. getpushsize:=target_os.size_of_pointer
  920. else
  921. getpushsize:=definition^.size;
  922. end;
  923. end;
  924. end
  925. else
  926. getpushsize:=0;
  927. end;
  928. function data_align(length : longint) : longint;
  929. begin
  930. (* this is useless under go32v2 at least
  931. because the section are only align to dword
  932. if length>8 then
  933. data_align:=16
  934. else if length>4 then
  935. data_align:=8
  936. else *)
  937. if length>2 then
  938. data_align:=4
  939. else if length>1 then
  940. data_align:=2
  941. else
  942. data_align:=1;
  943. end;
  944. procedure tvarsym.insert_in_data;
  945. var
  946. l,ali,modulo : longint;
  947. storefilepos : tfileposinfo;
  948. begin
  949. if (var_options and vo_is_external)<>0 then
  950. exit;
  951. { handle static variables of objects especially }
  952. if read_member and (owner^.symtabletype=objectsymtable) and
  953. ((properties and sp_static)<>0) then
  954. begin
  955. { the data filed is generated in parser.pas
  956. with a tobject_FIELDNAME variable }
  957. { this symbol can't be loaded to a register }
  958. var_options:=var_options and not vo_regable;
  959. end
  960. else
  961. if not(read_member) then
  962. begin
  963. { made problems with parameters etc. ! (FK) }
  964. { check for instance of an abstract object or class }
  965. {
  966. if (pvarsym(sym)^.definition^.deftype=objectdef) and
  967. ((pobjectdef(pvarsym(sym)^.definition)^.options and oo_is_abstract)<>0) then
  968. Message(sym_e_no_instance_of_abstract_object);
  969. }
  970. storefilepos:=aktfilepos;
  971. aktfilepos:=tokenpos;
  972. if ((var_options and vo_is_thread_var)<>0) then
  973. l:=4
  974. else
  975. l:=getsize;
  976. case owner^.symtabletype of
  977. stt_exceptsymtable:
  978. { can contain only one symbol, address calculated later }
  979. ;
  980. localsymtable :
  981. begin
  982. is_valid := 0;
  983. modulo:=owner^.datasize and 3;
  984. {$ifdef m68k}
  985. { word alignment required for motorola }
  986. if (l=1) then
  987. l:=2
  988. else
  989. {$endif}
  990. if (l>=4) and (modulo<>0) then
  991. inc(l,4-modulo)
  992. else
  993. if (l>=2) and ((modulo and 1)<>0) then
  994. inc(l,2-(modulo and 1));
  995. inc(owner^.datasize,l);
  996. address:=owner^.datasize;
  997. end;
  998. staticsymtable :
  999. begin
  1000. { enable unitialized warning for local symbols }
  1001. is_valid := 0;
  1002. if (cs_smartlink in aktmoduleswitches) then
  1003. bsssegment^.concat(new(pai_cut,init));
  1004. ali:=data_align(l);
  1005. if ali>1 then
  1006. begin
  1007. (* this is done
  1008. either by the assembler or in ag386bin
  1009. bsssegment^.concat(new(pai_align,init(ali))); *)
  1010. modulo:=owner^.datasize mod ali;
  1011. if modulo>0 then
  1012. inc(owner^.datasize,ali-modulo);
  1013. end;
  1014. {$ifdef GDB}
  1015. if cs_debuginfo in aktmoduleswitches then
  1016. concatstabto(bsssegment);
  1017. {$endif GDB}
  1018. if (cs_smartlink in aktmoduleswitches) or
  1019. ((var_options and vo_is_c_var)<>0) then
  1020. bsssegment^.concat(new(pai_datablock,init_global(mangledname,l)))
  1021. else
  1022. bsssegment^.concat(new(pai_datablock,init(mangledname,l)));
  1023. { increase datasize }
  1024. inc(owner^.datasize,l);
  1025. { this symbol can't be loaded to a register }
  1026. var_options:=var_options and not vo_regable;
  1027. end;
  1028. globalsymtable :
  1029. begin
  1030. if (cs_smartlink in aktmoduleswitches) then
  1031. bsssegment^.concat(new(pai_cut,init));
  1032. ali:=data_align(l);
  1033. if ali>1 then
  1034. begin
  1035. (* this is done
  1036. either by the assembler or in ag386bin
  1037. bsssegment^.concat(new(pai_align,init(ali))); *)
  1038. modulo:=owner^.datasize mod ali;
  1039. if modulo>0 then
  1040. inc(owner^.datasize,ali-modulo);
  1041. end;
  1042. {$ifdef GDB}
  1043. if cs_debuginfo in aktmoduleswitches then
  1044. concatstabto(bsssegment);
  1045. {$endif GDB}
  1046. bsssegment^.concat(new(pai_datablock,init_global(mangledname,l)));
  1047. inc(owner^.datasize,l);
  1048. { this symbol can't be loaded to a register }
  1049. var_options:=var_options and not vo_regable;
  1050. end;
  1051. recordsymtable,
  1052. objectsymtable :
  1053. begin
  1054. { this symbol can't be loaded to a register }
  1055. var_options:=var_options and not vo_regable;
  1056. { align record and object fields }
  1057. if (l=1) or (aktpackrecords=1) then
  1058. begin
  1059. address:=owner^.datasize;
  1060. inc(owner^.datasize,l)
  1061. end
  1062. else
  1063. if (l=2) or (aktpackrecords=2) then
  1064. begin
  1065. owner^.datasize:=(owner^.datasize+1) and (not 1);
  1066. address:=owner^.datasize;
  1067. inc(owner^.datasize,l)
  1068. end
  1069. else
  1070. if (l<=4) or (aktpackrecords=4) then
  1071. begin
  1072. owner^.datasize:=(owner^.datasize+3) and (not 3);
  1073. address:=owner^.datasize;
  1074. inc(owner^.datasize,l);
  1075. end
  1076. else
  1077. if (l<=8) or (aktpackrecords=8) then
  1078. begin
  1079. owner^.datasize:=(owner^.datasize+7) and (not 7);
  1080. address:=owner^.datasize;
  1081. inc(owner^.datasize,l);
  1082. end
  1083. else
  1084. if (l<=16) or (aktpackrecords=16) then
  1085. begin
  1086. owner^.datasize:=(owner^.datasize+15) and (not 15);
  1087. address:=owner^.datasize;
  1088. inc(owner^.datasize,l);
  1089. end
  1090. else
  1091. if (l<=32) or (aktpackrecords=32) then
  1092. begin
  1093. owner^.datasize:=(owner^.datasize+31) and (not 31);
  1094. address:=owner^.datasize;
  1095. inc(owner^.datasize,l);
  1096. end;
  1097. end;
  1098. parasymtable :
  1099. begin
  1100. { here we need the size of a push instead of the
  1101. size of the data }
  1102. l:=getpushsize;
  1103. address:=owner^.datasize;
  1104. owner^.datasize:=align(owner^.datasize+l,target_os.stackalignment);
  1105. end
  1106. else
  1107. begin
  1108. modulo:=owner^.datasize and 3 ;
  1109. if (l>=4) and (modulo<>0) then
  1110. inc(owner^.datasize,4-modulo)
  1111. else
  1112. if (l>=2) and ((modulo and 1)<>0) then
  1113. inc(owner^.datasize);
  1114. address:=owner^.datasize;
  1115. inc(owner^.datasize,l);
  1116. end;
  1117. end;
  1118. aktfilepos:=storefilepos;
  1119. end;
  1120. end;
  1121. {$ifdef GDB}
  1122. function tvarsym.stabstring : pchar;
  1123. var
  1124. st : char;
  1125. begin
  1126. if (owner^.symtabletype = objectsymtable) and
  1127. ((properties and sp_static)<>0) then
  1128. begin
  1129. if (cs_gdb_gsym in aktglobalswitches) then st := 'G' else st := 'S';
  1130. {$ifndef Delphi}
  1131. stabstring := strpnew('"'+owner^.name^+'__'+name+':'+
  1132. +definition^.numberstring+'",'+
  1133. tostr(N_LCSYM)+',0,'+tostr(fileinfo.line)+','+mangledname);
  1134. {$endif}
  1135. end
  1136. else if (owner^.symtabletype = globalsymtable) or
  1137. (owner^.symtabletype = unitsymtable) then
  1138. begin
  1139. { Here we used S instead of
  1140. because with G GDB doesn't look at the address field
  1141. but searches the same name or with a leading underscore
  1142. but these names don't exist in pascal !}
  1143. if (cs_gdb_gsym in aktglobalswitches) then st := 'G' else st := 'S';
  1144. stabstring := strpnew('"'+name+':'+st
  1145. +definition^.numberstring+'",'+
  1146. tostr(N_LCSYM)+',0,'+tostr(fileinfo.line)+','+mangledname);
  1147. end
  1148. else if owner^.symtabletype = staticsymtable then
  1149. begin
  1150. stabstring := strpnew('"'+name+':S'
  1151. +definition^.numberstring+'",'+
  1152. tostr(N_LCSYM)+',0,'+tostr(fileinfo.line)+','+mangledname);
  1153. end
  1154. else if (owner^.symtabletype=parasymtable) then
  1155. begin
  1156. case varspez of
  1157. vs_var : st := 'v';
  1158. vs_value,
  1159. vs_const : if push_addr_param(definition) then
  1160. st := 'v' { should be 'i' but 'i' doesn't work }
  1161. else
  1162. st := 'p';
  1163. end;
  1164. stabstring := strpnew('"'+name+':'+st
  1165. +definition^.numberstring+'",'+
  1166. tostr(N_PSYM)+',0,'+tostr(fileinfo.line)+','+
  1167. tostr(address+owner^.address_fixup));
  1168. {offset to ebp => will not work if the framepointer is esp
  1169. so some optimizing will make things harder to debug }
  1170. end
  1171. else if (owner^.symtabletype=localsymtable) then
  1172. {$ifdef i386}
  1173. if reg<>R_NO then
  1174. begin
  1175. { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi", "eip", "ps", "cs", "ss", "ds", "es", "fs", "gs", }
  1176. { this is the register order for GDB}
  1177. stabstring:=strpnew('"'+name+':r'
  1178. +definition^.numberstring+'",'+
  1179. tostr(N_RSYM)+',0,'+
  1180. tostr(fileinfo.line)+','+tostr(GDB_i386index[reg]));
  1181. end
  1182. else
  1183. {$endif i386}
  1184. { I don't know if this will work (PM) }
  1185. if (var_options and vo_is_C_var)<>0 then
  1186. stabstring := strpnew('"'+name+':S'
  1187. +definition^.numberstring+'",'+
  1188. tostr(N_LCSYM)+',0,'+tostr(fileinfo.line)+','+mangledname)
  1189. else
  1190. stabstring := strpnew('"'+name+':'
  1191. +definition^.numberstring+'",'+
  1192. tostr(N_LSYM)+',0,'+tostr(fileinfo.line)+',-'+tostr(address))
  1193. else
  1194. stabstring := inherited stabstring;
  1195. end;
  1196. procedure tvarsym.concatstabto(asmlist : paasmoutput);
  1197. {$ifdef i386}
  1198. var stab_str : pchar;
  1199. {$endif i386}
  1200. begin
  1201. inherited concatstabto(asmlist);
  1202. {$ifdef i386}
  1203. if (owner^.symtabletype=parasymtable) and
  1204. (reg<>R_NO) then
  1205. begin
  1206. { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi", "eip", "ps", "cs", "ss", "ds", "es", "fs", "gs", }
  1207. { this is the register order for GDB}
  1208. stab_str:=strpnew('"'+name+':r'
  1209. +definition^.numberstring+'",'+
  1210. tostr(N_RSYM)+',0,'+
  1211. tostr(fileinfo.line)+','+tostr(GDB_i386index[reg]));
  1212. asmlist^.concat(new(pai_stabs,init(stab_str)));
  1213. end;
  1214. {$endif i386}
  1215. end;
  1216. {$endif GDB}
  1217. destructor tvarsym.done;
  1218. begin
  1219. strdispose(_mangledname);
  1220. inherited done;
  1221. end;
  1222. {****************************************************************************
  1223. TTYPEDCONSTSYM
  1224. *****************************************************************************}
  1225. constructor ttypedconstsym.init(const n : string;p : pdef;really_const : boolean);
  1226. begin
  1227. tsym.init(n);
  1228. typ:=typedconstsym;
  1229. definition:=p;
  1230. is_really_const:=really_const;
  1231. prefix:=stringdup(procprefix);
  1232. end;
  1233. constructor ttypedconstsym.load;
  1234. begin
  1235. tsym.load;
  1236. typ:=typedconstsym;
  1237. definition:=readdefref;
  1238. {$ifdef DELPHI_CONST_IN_RODATA}
  1239. is_really_const:=boolean(readbyte);
  1240. {$else DELPHI_CONST_IN_RODATA}
  1241. is_really_const:=false;
  1242. {$endif DELPHI_CONST_IN_RODATA}
  1243. prefix:=stringdup(readstring);
  1244. end;
  1245. destructor ttypedconstsym.done;
  1246. begin
  1247. stringdispose(prefix);
  1248. tsym.done;
  1249. end;
  1250. function ttypedconstsym.mangledname : string;
  1251. begin
  1252. mangledname:='TC_'+prefix^+'_'+name;
  1253. end;
  1254. function ttypedconstsym.getsize : longint;
  1255. begin
  1256. if assigned(definition) then
  1257. getsize:=definition^.size
  1258. else
  1259. getsize:=0;
  1260. end;
  1261. procedure ttypedconstsym.deref;
  1262. begin
  1263. resolvedef(definition);
  1264. end;
  1265. procedure ttypedconstsym.write;
  1266. begin
  1267. tsym.write;
  1268. writedefref(definition);
  1269. writestring(prefix^);
  1270. {$ifdef DELPHI_CONST_IN_RODATA}
  1271. writebyte(byte(is_really_const));
  1272. {$endif DELPHI_CONST_IN_RODATA}
  1273. current_ppu^.writeentry(ibtypedconstsym);
  1274. end;
  1275. { for most symbol types ther is nothing to do at all }
  1276. procedure ttypedconstsym.insert_in_data;
  1277. begin
  1278. { here there is a problem for ansistrings !! }
  1279. { we must write the label only after the 12 header bytes (PM)
  1280. if not is_ansistring(definition) then
  1281. }
  1282. { solved, the ansis string is moved to consts (FK) }
  1283. really_insert_in_data;
  1284. end;
  1285. procedure ttypedconstsym.really_insert_in_data;
  1286. var curconstsegment : paasmoutput;
  1287. l,ali,modulo : longint;
  1288. storefilepos : tfileposinfo;
  1289. begin
  1290. storefilepos:=aktfilepos;
  1291. aktfilepos:=tokenpos;
  1292. if is_really_const then
  1293. curconstsegment:=consts
  1294. else
  1295. curconstsegment:=datasegment;
  1296. if (cs_smartlink in aktmoduleswitches) then
  1297. curconstsegment^.concat(new(pai_cut,init));
  1298. l:=getsize;
  1299. ali:=data_align(l);
  1300. if ali>1 then
  1301. begin
  1302. curconstsegment^.concat(new(pai_align,init(ali)));
  1303. modulo:=owner^.datasize mod ali;
  1304. if modulo>0 then
  1305. inc(owner^.datasize,ali-modulo);
  1306. end;
  1307. { Why was there no owner size update here ??? }
  1308. inc(owner^.datasize,l);
  1309. {$ifdef GDB}
  1310. if cs_debuginfo in aktmoduleswitches then
  1311. concatstabto(curconstsegment);
  1312. {$endif GDB}
  1313. if owner^.symtabletype=globalsymtable then
  1314. begin
  1315. curconstsegment^.concat(new(pai_symbol,initname_global(mangledname)));
  1316. end
  1317. else
  1318. if owner^.symtabletype<>unitsymtable then
  1319. begin
  1320. if (cs_smartlink in aktmoduleswitches) then
  1321. curconstsegment^.concat(new(pai_symbol,initname_global(mangledname)))
  1322. else
  1323. curconstsegment^.concat(new(pai_symbol,initname(mangledname)));
  1324. end;
  1325. aktfilepos:=storefilepos;
  1326. end;
  1327. {$ifdef GDB}
  1328. function ttypedconstsym.stabstring : pchar;
  1329. var
  1330. st : char;
  1331. begin
  1332. if (cs_gdb_gsym in aktglobalswitches) and (owner^.symtabletype in [unitsymtable,globalsymtable]) then
  1333. st := 'G'
  1334. else
  1335. st := 'S';
  1336. stabstring := strpnew('"'+name+':'+st+
  1337. definition^.numberstring+'",'+tostr(n_STSYM)+',0,'+
  1338. tostr(fileinfo.line)+','+mangledname);
  1339. end;
  1340. {$endif GDB}
  1341. {****************************************************************************
  1342. TCONSTSYM
  1343. ****************************************************************************}
  1344. constructor tconstsym.init(const n : string;t : tconsttype;v : longint);
  1345. begin
  1346. inherited init(n);
  1347. typ:=constsym;
  1348. consttype:=t;
  1349. value:=v;
  1350. definition:=nil;
  1351. len:=0;
  1352. end;
  1353. constructor tconstsym.init_def(const n : string;t : tconsttype;v : longint;def : pdef);
  1354. begin
  1355. inherited init(n);
  1356. typ:=constsym;
  1357. consttype:=t;
  1358. value:=v;
  1359. definition:=def;
  1360. len:=0;
  1361. end;
  1362. constructor tconstsym.init_string(const n : string;t : tconsttype;str:pchar;l:longint);
  1363. begin
  1364. inherited init(n);
  1365. typ:=constsym;
  1366. consttype:=t;
  1367. value:=longint(str);
  1368. definition:=nil;
  1369. len:=l;
  1370. end;
  1371. constructor tconstsym.load;
  1372. var
  1373. pd : pbestreal;
  1374. ps : pnormalset;
  1375. begin
  1376. tsym.load;
  1377. typ:=constsym;
  1378. consttype:=tconsttype(readbyte);
  1379. case consttype of
  1380. constint,
  1381. constbool,
  1382. constchar : value:=readlong;
  1383. constord :
  1384. begin
  1385. definition:=readdefref;
  1386. value:=readlong;
  1387. end;
  1388. conststring :
  1389. begin
  1390. len:=readlong;
  1391. getmem(pchar(value),len+1);
  1392. current_ppu^.getdata(pchar(value)^,len);
  1393. end;
  1394. constreal :
  1395. begin
  1396. new(pd);
  1397. pd^:=readreal;
  1398. value:=longint(pd);
  1399. end;
  1400. constset :
  1401. begin
  1402. definition:=readdefref;
  1403. new(ps);
  1404. readnormalset(ps^);
  1405. value:=longint(ps);
  1406. end;
  1407. constnil : ;
  1408. else
  1409. Message1(unit_f_ppu_invalid_entry,tostr(ord(consttype)));
  1410. end;
  1411. end;
  1412. destructor tconstsym.done;
  1413. begin
  1414. case consttype of
  1415. conststring :
  1416. freemem(pchar(value),len+1);
  1417. constreal :
  1418. dispose(pbestreal(value));
  1419. constset :
  1420. dispose(pnormalset(value));
  1421. end;
  1422. inherited done;
  1423. end;
  1424. function tconstsym.mangledname : string;
  1425. begin
  1426. mangledname:=name;
  1427. end;
  1428. procedure tconstsym.deref;
  1429. begin
  1430. if consttype in [constord,constset] then
  1431. resolvedef(pdef(definition));
  1432. end;
  1433. procedure tconstsym.write;
  1434. begin
  1435. tsym.write;
  1436. writebyte(byte(consttype));
  1437. case consttype of
  1438. constnil : ;
  1439. constint,
  1440. constbool,
  1441. constchar :
  1442. writelong(value);
  1443. constord :
  1444. begin
  1445. writedefref(definition);
  1446. writelong(value);
  1447. end;
  1448. conststring :
  1449. begin
  1450. writelong(len);
  1451. current_ppu^.putdata(pchar(value)^,len);
  1452. end;
  1453. constreal :
  1454. writereal(pbestreal(value)^);
  1455. constset :
  1456. begin
  1457. writedefref(definition);
  1458. writenormalset(pointer(value)^);
  1459. end;
  1460. else
  1461. internalerror(13);
  1462. end;
  1463. current_ppu^.writeentry(ibconstsym);
  1464. end;
  1465. {$ifdef GDB}
  1466. function tconstsym.stabstring : pchar;
  1467. var st : string;
  1468. begin
  1469. {even GDB v4.16 only now 'i' 'r' and 'e' !!!}
  1470. case consttype of
  1471. conststring : begin
  1472. { I had to remove ibm2ascii !! }
  1473. st := pstring(value)^;
  1474. {st := ibm2ascii(pstring(value)^);}
  1475. st := 's'''+st+'''';
  1476. end;
  1477. constbool, constint, constord, constchar : st := 'i'+tostr(value);
  1478. constreal : begin
  1479. system.str(pbestreal(value)^,st);
  1480. st := 'r'+st;
  1481. end;
  1482. { if we don't know just put zero !! }
  1483. else st:='i0';
  1484. {***SETCONST}
  1485. {constset:;} {*** I don't know what to do with a set.}
  1486. { sets are not recognized by GDB}
  1487. {***}
  1488. end;
  1489. stabstring := strpnew('"'+name+':c='+st+'",'+tostr(N_function)+',0,'+
  1490. tostr(fileinfo.line)+',0');
  1491. end;
  1492. procedure tconstsym.concatstabto(asmlist : paasmoutput);
  1493. begin
  1494. if consttype <> conststring then
  1495. inherited concatstabto(asmlist);
  1496. end;
  1497. {$endif GDB}
  1498. {****************************************************************************
  1499. TENUMSYM
  1500. ****************************************************************************}
  1501. constructor tenumsym.init(const n : string;def : penumdef;v : longint);
  1502. begin
  1503. tsym.init(n);
  1504. typ:=enumsym;
  1505. definition:=def;
  1506. value:=v;
  1507. if def^.min>v then
  1508. def^.setmin(v);
  1509. if def^.max<v then
  1510. def^.setmax(v);
  1511. order;
  1512. end;
  1513. constructor tenumsym.load;
  1514. begin
  1515. tsym.load;
  1516. typ:=enumsym;
  1517. definition:=penumdef(readdefref);
  1518. value:=readlong;
  1519. nextenum := Nil;
  1520. end;
  1521. procedure tenumsym.deref;
  1522. begin
  1523. resolvedef(pdef(definition));
  1524. order;
  1525. end;
  1526. procedure tenumsym.order;
  1527. var
  1528. sym : penumsym;
  1529. begin
  1530. sym := definition^.firstenum;
  1531. if sym = nil then
  1532. begin
  1533. definition^.firstenum := @self;
  1534. nextenum := nil;
  1535. exit;
  1536. end;
  1537. { reorder the symbols in increasing value }
  1538. if value < sym^.value then
  1539. begin
  1540. nextenum := sym;
  1541. definition^.firstenum := @self;
  1542. end
  1543. else
  1544. begin
  1545. while (sym^.value <= value) and assigned(sym^.nextenum) do
  1546. sym := sym^.nextenum;
  1547. nextenum := sym^.nextenum;
  1548. sym^.nextenum := @self;
  1549. end;
  1550. end;
  1551. procedure tenumsym.write;
  1552. begin
  1553. tsym.write;
  1554. writedefref(definition);
  1555. writelong(value);
  1556. current_ppu^.writeentry(ibenumsym);
  1557. end;
  1558. {$ifdef GDB}
  1559. procedure tenumsym.concatstabto(asmlist : paasmoutput);
  1560. begin
  1561. {enum elements have no stab !}
  1562. end;
  1563. {$EndIf GDB}
  1564. {****************************************************************************
  1565. TTYPESYM
  1566. ****************************************************************************}
  1567. constructor ttypesym.init(const n : string;d : pdef);
  1568. begin
  1569. tsym.init(n);
  1570. typ:=typesym;
  1571. definition:=d;
  1572. {$ifdef GDB}
  1573. isusedinstab := false;
  1574. {$endif GDB}
  1575. forwardpointer:=nil;
  1576. if assigned(definition) then
  1577. begin
  1578. if not(assigned(definition^.sym)) then
  1579. begin
  1580. definition^.sym:=@self;
  1581. synonym:=nil;
  1582. properties:=sp_primary_typesym;
  1583. end
  1584. else
  1585. begin
  1586. synonym:=definition^.sym^.synonym;
  1587. definition^.sym^.synonym:=@self;
  1588. end;
  1589. end;
  1590. end;
  1591. constructor ttypesym.load;
  1592. begin
  1593. tsym.load;
  1594. typ:=typesym;
  1595. forwardpointer:=nil;
  1596. synonym:=nil;
  1597. {$ifdef GDB}
  1598. isusedinstab := false;
  1599. {$endif GDB}
  1600. definition:=readdefref;
  1601. end;
  1602. destructor ttypesym.done;
  1603. var prevsym : ptypesym;
  1604. begin
  1605. if assigned(definition) then
  1606. begin
  1607. prevsym:=definition^.sym;
  1608. if prevsym=@self then
  1609. definition^.sym:=synonym;
  1610. while assigned(prevsym) do
  1611. begin
  1612. if (prevsym^.synonym=@self) then
  1613. begin
  1614. prevsym^.synonym:=synonym;
  1615. break;
  1616. end;
  1617. prevsym:=prevsym^.synonym;
  1618. end;
  1619. end;
  1620. synonym:=nil;
  1621. definition:=nil;
  1622. inherited done;
  1623. end;
  1624. procedure ttypesym.deref;
  1625. begin
  1626. resolvedef(definition);
  1627. if assigned(definition) then
  1628. begin
  1629. if properties=sp_primary_typesym then
  1630. begin
  1631. if definition^.sym<>@self then
  1632. synonym:=definition^.sym;
  1633. definition^.sym:=@self;
  1634. end
  1635. else
  1636. begin
  1637. if assigned(definition^.sym) then
  1638. begin
  1639. synonym:=definition^.sym^.synonym;
  1640. if definition^.sym<>@self then
  1641. definition^.sym^.synonym:=@self;
  1642. end
  1643. else
  1644. definition^.sym:=@self;
  1645. end;
  1646. if (definition^.deftype=recorddef) and assigned(precdef(definition)^.symtable) and
  1647. (definition^.sym=@self) then
  1648. precdef(definition)^.symtable^.name:=stringdup('record '+name);
  1649. end;
  1650. end;
  1651. procedure ttypesym.write;
  1652. begin
  1653. tsym.write;
  1654. writedefref(definition);
  1655. current_ppu^.writeentry(ibtypesym);
  1656. end;
  1657. procedure ttypesym.load_references;
  1658. begin
  1659. inherited load_references;
  1660. if (definition^.deftype=recorddef) then
  1661. precdef(definition)^.symtable^.load_browser;
  1662. if (definition^.deftype=objectdef) then
  1663. pobjectdef(definition)^.publicsyms^.load_browser;
  1664. end;
  1665. function ttypesym.write_references : boolean;
  1666. begin
  1667. if not inherited write_references then
  1668. { write address of this symbol if record or object
  1669. even if no real refs are there
  1670. because we need it for the symtable }
  1671. if (definition^.deftype=recorddef) or
  1672. (definition^.deftype=objectdef) then
  1673. begin
  1674. writesymref(@self);
  1675. current_ppu^.writeentry(ibsymref);
  1676. end;
  1677. write_references:=true;
  1678. if (definition^.deftype=recorddef) then
  1679. precdef(definition)^.symtable^.write_browser;
  1680. if (definition^.deftype=objectdef) then
  1681. pobjectdef(definition)^.publicsyms^.write_browser;
  1682. end;
  1683. procedure ttypesym.addforwardpointer(p:ppointerdef);
  1684. var
  1685. hfp : pforwardpointer;
  1686. begin
  1687. new(hfp);
  1688. hfp^.next:=forwardpointer;
  1689. hfp^.def:=p;
  1690. forwardpointer:=hfp;
  1691. end;
  1692. procedure ttypesym.updateforwarddef(p:pdef);
  1693. var
  1694. lasthfp,hfp : pforwardpointer;
  1695. begin
  1696. definition:=p;
  1697. properties:=current_object_option;
  1698. fileinfo:=tokenpos;
  1699. if assigned(definition) and not(assigned(definition^.sym)) then
  1700. definition^.sym:=@self;
  1701. { update all forwardpointers to this definition }
  1702. hfp:=forwardpointer;
  1703. while assigned(hfp) do
  1704. begin
  1705. lasthfp:=hfp;
  1706. hfp^.def^.definition:=definition;
  1707. hfp:=hfp^.next;
  1708. dispose(lasthfp);
  1709. end;
  1710. end;
  1711. {$ifdef BrowserLog}
  1712. procedure ttypesym.add_to_browserlog;
  1713. begin
  1714. inherited add_to_browserlog;
  1715. if (definition^.deftype=recorddef) then
  1716. precdef(definition)^.symtable^.writebrowserlog;
  1717. if (definition^.deftype=objectdef) then
  1718. pobjectdef(definition)^.publicsyms^.writebrowserlog;
  1719. end;
  1720. {$endif BrowserLog}
  1721. {$ifdef GDB}
  1722. function ttypesym.stabstring : pchar;
  1723. var stabchar : string[2];
  1724. short : string;
  1725. begin
  1726. if definition^.deftype in tagtypes then
  1727. stabchar := 'Tt'
  1728. else
  1729. stabchar := 't';
  1730. short := '"'+name+':'+stabchar+definition^.numberstring
  1731. +'",'+tostr(N_LSYM)+',0,'+tostr(fileinfo.line)+',0';
  1732. stabstring := strpnew(short);
  1733. end;
  1734. procedure ttypesym.concatstabto(asmlist : paasmoutput);
  1735. begin
  1736. {not stabs for forward defs }
  1737. if assigned(definition) then
  1738. if (definition^.sym = @self) then
  1739. definition^.concatstabto(asmlist)
  1740. else
  1741. inherited concatstabto(asmlist);
  1742. end;
  1743. {$endif GDB}
  1744. {****************************************************************************
  1745. TSYSSYM
  1746. ****************************************************************************}
  1747. constructor tsyssym.init(const n : string;l : longint);
  1748. begin
  1749. inherited init(n);
  1750. typ:=syssym;
  1751. number:=l;
  1752. end;
  1753. constructor tsyssym.load;
  1754. begin
  1755. tsym.load;
  1756. typ:=syssym;
  1757. number:=readlong;
  1758. end;
  1759. destructor tsyssym.done;
  1760. begin
  1761. inherited done;
  1762. end;
  1763. procedure tsyssym.write;
  1764. begin
  1765. tsym.write;
  1766. writelong(number);
  1767. current_ppu^.writeentry(ibsyssym);
  1768. end;
  1769. {$ifdef GDB}
  1770. procedure tsyssym.concatstabto(asmlist : paasmoutput);
  1771. begin
  1772. end;
  1773. {$endif GDB}
  1774. {****************************************************************************
  1775. TMACROSYM
  1776. ****************************************************************************}
  1777. constructor tmacrosym.init(const n : string);
  1778. begin
  1779. inherited init(n);
  1780. typ:=macrosym;
  1781. defined:=true;
  1782. buftext:=nil;
  1783. buflen:=0;
  1784. end;
  1785. destructor tmacrosym.done;
  1786. begin
  1787. if assigned(buftext) then
  1788. freemem(buftext,buflen);
  1789. inherited done;
  1790. end;
  1791. {
  1792. $Log$
  1793. Revision 1.97 1999-07-05 12:13:25 florian
  1794. * property reading from PPU fixed (new PPU format), it uses now writesym...
  1795. Revision 1.96 1999/06/28 10:49:48 pierre
  1796. merged from 0-99-12 branch
  1797. Revision 1.94.2.2 1999/06/28 10:32:29 pierre
  1798. * fixes bug453
  1799. Revision 1.94.2.1 1999/06/22 16:26:45 pierre
  1800. * local browser stuff corrected
  1801. Revision 1.94 1999/06/03 16:25:05 pierre
  1802. * local Cvar stabs corrected
  1803. Revision 1.93 1999/05/27 19:45:06 peter
  1804. * removed oldasm
  1805. * plabel -> pasmlabel
  1806. * -a switches to source writing automaticly
  1807. * assembler readers OOPed
  1808. * asmsymbol automaticly external
  1809. * jumptables and other label fixes for asm readers
  1810. Revision 1.92 1999/05/21 13:55:21 peter
  1811. * NEWLAB for label as symbol
  1812. Revision 1.91 1999/05/20 22:22:44 pierre
  1813. + added synonym filed for ttypesym
  1814. allows a clean disposal of tdefs and related ttypesyms
  1815. Revision 1.90 1999/05/17 13:11:40 pierre
  1816. * unitsym security stuff
  1817. Revision 1.89 1999/05/13 21:59:45 peter
  1818. * removed oldppu code
  1819. * warning if objpas is loaded from uses
  1820. * first things for new deref writing
  1821. Revision 1.88 1999/05/10 09:01:43 peter
  1822. * small message fixes
  1823. Revision 1.87 1999/05/08 19:52:38 peter
  1824. + MessagePos() which is enhanced Message() function but also gets the
  1825. position info
  1826. * Removed comp warnings
  1827. Revision 1.86 1999/05/07 00:06:22 pierre
  1828. + added aligmnent of data for typed consts
  1829. for var it is done by AS or LD or in ag386bin for direct object output
  1830. Revision 1.85 1999/05/04 21:45:07 florian
  1831. * changes to compile it with Delphi 4.0
  1832. Revision 1.84 1999/05/04 16:05:13 pierre
  1833. * fix for unitsym problem
  1834. Revision 1.83 1999/04/28 06:02:13 florian
  1835. * changes of Bruessel:
  1836. + message handler can now take an explicit self
  1837. * typinfo fixed: sometimes the type names weren't written
  1838. * the type checking for pointer comparisations and subtraction
  1839. and are now more strict (was also buggy)
  1840. * small bug fix to link.pas to support compiling on another
  1841. drive
  1842. * probable bug in popt386 fixed: call/jmp => push/jmp
  1843. transformation didn't count correctly the jmp references
  1844. + threadvar support
  1845. * warning if ln/sqrt gets an invalid constant argument
  1846. Revision 1.82 1999/04/26 13:31:52 peter
  1847. * release storenumber,double_checksum
  1848. Revision 1.81 1999/04/25 22:38:39 pierre
  1849. + added is_really_const booleanfield for typedconstsym
  1850. for Delphi in $J- mode (not yet implemented !)
  1851. Revision 1.80 1999/04/21 09:43:54 peter
  1852. * storenumber works
  1853. * fixed some typos in double_checksum
  1854. + incompatible types type1 and type2 message (with storenumber)
  1855. Revision 1.79 1999/04/17 13:16:21 peter
  1856. * fixes for storenumber
  1857. Revision 1.78 1999/04/14 09:15:02 peter
  1858. * first things to store the symbol/def number in the ppu
  1859. Revision 1.77 1999/04/08 10:11:32 pierre
  1860. + enable uninitilized warnings for static symbols
  1861. Revision 1.76 1999/03/31 13:55:21 peter
  1862. * assembler inlining working for ag386bin
  1863. Revision 1.75 1999/03/24 23:17:27 peter
  1864. * fixed bugs 212,222,225,227,229,231,233
  1865. Revision 1.74 1999/02/23 18:29:27 pierre
  1866. * win32 compilation error fix
  1867. + some work for local browser (not cl=omplete yet)
  1868. Revision 1.73 1999/02/22 13:07:09 pierre
  1869. + -b and -bl options work !
  1870. + cs_local_browser ($L+) is disabled if cs_browser ($Y+)
  1871. is not enabled when quitting global section
  1872. * local vars and procedures are not yet stored into PPU
  1873. Revision 1.72 1999/02/08 09:51:22 pierre
  1874. * gdb info for local functions was wrong
  1875. Revision 1.71 1999/01/23 23:29:41 florian
  1876. * first running version of the new code generator
  1877. * when compiling exceptions under Linux fixed
  1878. Revision 1.70 1999/01/21 22:10:48 peter
  1879. * fixed array of const
  1880. * generic platform independent high() support
  1881. Revision 1.69 1999/01/20 10:20:20 peter
  1882. * don't make localvar copies for assembler procedures
  1883. Revision 1.68 1999/01/12 14:25:36 peter
  1884. + BrowserLog for browser.log generation
  1885. + BrowserCol for browser info in TCollections
  1886. * released all other UseBrowser
  1887. Revision 1.67 1998/12/30 22:15:54 peter
  1888. + farpointer type
  1889. * absolutesym now also stores if its far
  1890. Revision 1.66 1998/12/30 13:41:14 peter
  1891. * released valuepara
  1892. Revision 1.65 1998/12/26 15:35:44 peter
  1893. + read/write of constnil
  1894. Revision 1.64 1998/12/08 10:18:15 peter
  1895. + -gh for heaptrc unit
  1896. Revision 1.63 1998/11/28 16:20:56 peter
  1897. + support for dll variables
  1898. Revision 1.62 1998/11/27 14:50:48 peter
  1899. + open strings, $P switch support
  1900. Revision 1.61 1998/11/18 15:44:18 peter
  1901. * VALUEPARA for tp7 compatible value parameters
  1902. Revision 1.60 1998/11/16 10:13:51 peter
  1903. * label defines are checked at the end of the proc
  1904. Revision 1.59 1998/11/13 12:09:11 peter
  1905. * unused label is now a warning
  1906. Revision 1.58 1998/11/10 10:50:57 pierre
  1907. * temporary fix for long mangled procsym names
  1908. Revision 1.57 1998/11/05 23:39:31 peter
  1909. + typedconst.getsize
  1910. Revision 1.56 1998/10/28 18:26:18 pierre
  1911. * removed some erros after other errors (introduced by useexcept)
  1912. * stabs works again correctly (for how long !)
  1913. Revision 1.55 1998/10/20 08:07:00 pierre
  1914. * several memory corruptions due to double freemem solved
  1915. => never use p^.loc.location:=p^.left^.loc.location;
  1916. + finally I added now by default
  1917. that ra386dir translates global and unit symbols
  1918. + added a first field in tsymtable and
  1919. a nextsym field in tsym
  1920. (this allows to obtain ordered type info for
  1921. records and objects in gdb !)
  1922. Revision 1.54 1998/10/19 08:55:07 pierre
  1923. * wrong stabs info corrected once again !!
  1924. + variable vmt offset with vmt field only if required
  1925. implemented now !!!
  1926. Revision 1.53 1998/10/16 08:51:53 peter
  1927. + target_os.stackalignment
  1928. + stack can be aligned at 2 or 4 byte boundaries
  1929. Revision 1.52 1998/10/08 17:17:32 pierre
  1930. * current_module old scanner tagged as invalid if unit is recompiled
  1931. + added ppheap for better info on tracegetmem of heaptrc
  1932. (adds line column and file index)
  1933. * several memory leaks removed ith help of heaptrc !!
  1934. Revision 1.51 1998/10/08 13:48:50 peter
  1935. * fixed memory leaks for do nothing source
  1936. * fixed unit interdependency
  1937. Revision 1.50 1998/10/06 17:16:56 pierre
  1938. * some memory leaks fixed (thanks to Peter for heaptrc !)
  1939. Revision 1.49 1998/10/01 09:22:55 peter
  1940. * fixed value openarray
  1941. * ungettemp of arrayconstruct
  1942. Revision 1.48 1998/09/26 17:45:44 peter
  1943. + idtoken and only one token table
  1944. Revision 1.47 1998/09/24 15:11:17 peter
  1945. * fixed enum for not GDB
  1946. Revision 1.46 1998/09/23 15:39:13 pierre
  1947. * browser bugfixes
  1948. was adding a reference when looking for the symbol
  1949. if -bSYM_NAME was used
  1950. Revision 1.45 1998/09/21 08:45:24 pierre
  1951. + added vmt_offset in tobjectdef.write for fututre use
  1952. (first steps to have objects without vmt if no virtual !!)
  1953. + added fpu_used field for tabstractprocdef :
  1954. sets this level to 2 if the functions return with value in FPU
  1955. (is then set to correct value at parsing of implementation)
  1956. THIS MIGHT refuse some code with FPU expression too complex
  1957. that were accepted before and even in some cases
  1958. that don't overflow in fact
  1959. ( like if f : float; is a forward that finally in implementation
  1960. only uses one fpu register !!)
  1961. Nevertheless I think that it will improve security on
  1962. FPU operations !!
  1963. * most other changes only for UseBrowser code
  1964. (added symtable references for record and objects)
  1965. local switch for refs to args and local of each function
  1966. (static symtable still missing)
  1967. UseBrowser still not stable and probably broken by
  1968. the definition hash array !!
  1969. Revision 1.44 1998/09/18 16:03:47 florian
  1970. * some changes to compile with Delphi
  1971. Revision 1.43 1998/09/18 08:01:38 pierre
  1972. + improvement on the usebrowser part
  1973. (does not work correctly for now)
  1974. Revision 1.42 1998/09/07 19:33:25 florian
  1975. + some stuff for property rtti added:
  1976. - NameIndex of the TPropInfo record is now written correctly
  1977. - the DEFAULT/NODEFAULT keyword is supported now
  1978. - the default value and the storedsym/def are now written to
  1979. the PPU fiel
  1980. Revision 1.41 1998/09/07 18:46:12 peter
  1981. * update smartlinking, uses getdatalabel
  1982. * renamed ptree.value vars to value_str,value_real,value_set
  1983. Revision 1.40 1998/09/07 17:37:04 florian
  1984. * first fixes for published properties
  1985. Revision 1.39 1998/09/05 22:11:02 florian
  1986. + switch -vb
  1987. * while/repeat loops accept now also word/longbool conditions
  1988. * makebooltojump did an invalid ungetregister32, fixed
  1989. Revision 1.38 1998/09/01 12:53:26 peter
  1990. + aktpackenum
  1991. Revision 1.37 1998/09/01 07:54:25 pierre
  1992. * UseBrowser a little updated (might still be buggy !!)
  1993. * bug in psub.pas in function specifier removed
  1994. * stdcall allowed in interface and in implementation
  1995. (FPC will not yet complain if it is missing in either part
  1996. because stdcall is only a dummy !!)
  1997. Revision 1.36 1998/08/25 13:09:26 pierre
  1998. * corrected mangling sheme :
  1999. cvar add Cprefix to the mixed case name whereas
  2000. export or public use direct name
  2001. Revision 1.35 1998/08/25 12:42:46 pierre
  2002. * CDECL changed to CVAR for variables
  2003. specifications are read in structures also
  2004. + started adding GPC compatibility mode ( option -Sp)
  2005. * names changed to lowercase
  2006. Revision 1.34 1998/08/21 14:08:53 pierre
  2007. + TEST_FUNCRET now default (old code removed)
  2008. works also for m68k (at least compiles)
  2009. Revision 1.33 1998/08/20 12:53:27 peter
  2010. * object_options are always written for object syms
  2011. Revision 1.32 1998/08/20 09:26:46 pierre
  2012. + funcret setting in underproc testing
  2013. compile with _dTEST_FUNCRET
  2014. Revision 1.31 1998/08/17 10:10:12 peter
  2015. - removed OLDPPU
  2016. Revision 1.30 1998/08/13 10:57:29 peter
  2017. * constant sets are now written correctly to the ppufile
  2018. Revision 1.29 1998/08/11 15:31:42 peter
  2019. * write extended to ppu file
  2020. * new version 0.99.7
  2021. Revision 1.28 1998/08/11 14:07:27 peter
  2022. * fixed pushing of high value for openarray
  2023. Revision 1.27 1998/08/10 14:50:31 peter
  2024. + localswitches, moduleswitches, globalswitches splitting
  2025. Revision 1.26 1998/08/10 10:18:35 peter
  2026. + Compiler,Comphook unit which are the new interface units to the
  2027. compiler
  2028. Revision 1.25 1998/07/30 11:18:19 florian
  2029. + first implementation of try ... except on .. do end;
  2030. * limitiation of 65535 bytes parameters for cdecl removed
  2031. Revision 1.24 1998/07/20 18:40:16 florian
  2032. * handling of ansi string constants should now work
  2033. Revision 1.23 1998/07/14 21:37:24 peter
  2034. * fixed packrecords as discussed at the alias
  2035. Revision 1.22 1998/07/14 14:47:08 peter
  2036. * released NEWINPUT
  2037. Revision 1.21 1998/07/13 21:17:38 florian
  2038. * changed to compile with TP
  2039. Revision 1.20 1998/07/10 00:00:05 peter
  2040. * fixed ttypesym bug finally
  2041. * fileinfo in the symtable and better using for unused vars
  2042. Revision 1.19 1998/07/07 17:40:39 peter
  2043. * packrecords 4 works
  2044. * word aligning of parameters
  2045. Revision 1.18 1998/07/07 11:20:15 peter
  2046. + NEWINPUT for a better inputfile and scanner object
  2047. Revision 1.17 1998/06/24 14:48:40 peter
  2048. * ifdef newppu -> ifndef oldppu
  2049. Revision 1.16 1998/06/19 15:40:42 peter
  2050. * removed cosntructor/constructor warning and 0.99.5 recompiles it again
  2051. Revision 1.15 1998/06/17 14:10:18 peter
  2052. * small os2 fixes
  2053. * fixed interdependent units with newppu (remake3 under linux works now)
  2054. Revision 1.14 1998/06/16 08:56:34 peter
  2055. + targetcpu
  2056. * cleaner pmodules for newppu
  2057. Revision 1.13 1998/06/15 15:38:10 pierre
  2058. * small bug in systems.pas corrected
  2059. + operators in different units better hanlded
  2060. Revision 1.12 1998/06/15 14:23:44 daniel
  2061. * Reverted my changes.
  2062. Revision 1.10 1998/06/13 00:10:18 peter
  2063. * working browser and newppu
  2064. * some small fixes against crashes which occured in bp7 (but not in
  2065. fpc?!)
  2066. Revision 1.9 1998/06/12 16:15:35 pierre
  2067. * external name 'C_var';
  2068. export name 'intern_C_var';
  2069. cdecl;
  2070. cdecl;external;
  2071. are now supported only with -Sv switch
  2072. Revision 1.8 1998/06/11 10:11:59 peter
  2073. * -gb works again
  2074. Revision 1.7 1998/06/09 16:01:51 pierre
  2075. + added procedure directive parsing for procvars
  2076. (accepted are popstack cdecl and pascal)
  2077. + added C vars with the following syntax
  2078. var C calias 'true_c_name';(can be followed by external)
  2079. reason is that you must add the Cprefix
  2080. which is target dependent
  2081. Revision 1.6 1998/06/08 22:59:53 peter
  2082. * smartlinking works for win32
  2083. * some defines to exclude some compiler parts
  2084. Revision 1.5 1998/06/04 23:52:02 peter
  2085. * m68k compiles
  2086. + .def file creation moved to gendef.pas so it could also be used
  2087. for win32
  2088. Revision 1.4 1998/06/04 09:55:46 pierre
  2089. * demangled name of procsym reworked to become independant of the mangling scheme
  2090. Revision 1.3 1998/06/03 22:14:20 florian
  2091. * problem with sizes of classes fixed (if the anchestor was declared
  2092. forward, the compiler doesn't update the child classes size)
  2093. Revision 1.2 1998/05/28 14:40:29 peter
  2094. * fixes for newppu, remake3 works now with it
  2095. Revision 1.1 1998/05/27 19:45:09 peter
  2096. * symtable.pas splitted into includefiles
  2097. * symtable adapted for $ifndef OLDPPU
  2098. }