symsym.inc 65 KB

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