symsym.inc 68 KB

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