symsym.inc 74 KB

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