symsym.inc 67 KB

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