symsym.inc 74 KB

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