symsym.inc 71 KB

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