symsym.inc 69 KB

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