symsym.inc 70 KB

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