symsym.inc 68 KB

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