symsym.inc 66 KB

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