symdef.inc 101 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl, Pierre Muller
  4. Symbol table implementation for the definitions
  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. TDEF (base class for definitions)
  20. ****************************************************************************}
  21. const
  22. { if you change one of the following contants, }
  23. { you have also to change the typinfo unit }
  24. tkUnknown = 0;
  25. tkInteger = 1;
  26. tkChar = 2;
  27. tkEnumeration = 3;
  28. tkFloat = 4;
  29. tkSet = 5;
  30. tkMethod = 6;
  31. tkSString = 7;
  32. tkString = tkSString;
  33. tkLString = 8;
  34. tkAString = 9;
  35. tkWString = 10;
  36. tkVariant = 11;
  37. tkArray = 12;
  38. tkRecord = 13;
  39. tkInterface = 14;
  40. tkClass = 15;
  41. tkObject = 16;
  42. tkWChar = 17;
  43. tkBool = 18;
  44. otSByte = 0;
  45. otUByte = 1;
  46. otSWord = 2;
  47. otUWord = 3;
  48. otSLong = 4;
  49. otULong = 5;
  50. ftSingle = 0;
  51. ftDouble = 1;
  52. ftExtended = 2;
  53. ftComp = 3;
  54. ftCurr = 4;
  55. ftFixed16 = 5;
  56. ftFixed32 = 6;
  57. constructor tdef.init;
  58. begin
  59. deftype:=abstractdef;
  60. owner := nil;
  61. next := nil;
  62. sym := nil;
  63. indexnb := 0;
  64. if registerdef then
  65. symtablestack^.registerdef(@self);
  66. has_rtti:=false;
  67. has_inittable:=false;
  68. {$ifdef GDB}
  69. is_def_stab_written := false;
  70. globalnb := 0;
  71. {$endif GDB}
  72. if assigned(lastglobaldef) then
  73. begin
  74. lastglobaldef^.nextglobal := @self;
  75. previousglobal:=lastglobaldef;
  76. end
  77. else
  78. begin
  79. firstglobaldef := @self;
  80. previousglobal := nil;
  81. end;
  82. lastglobaldef := @self;
  83. nextglobal := nil;
  84. end;
  85. constructor tdef.load;
  86. begin
  87. deftype:=abstractdef;
  88. indexnb := 0;
  89. sym := nil;
  90. owner := nil;
  91. next := nil;
  92. has_rtti:=false;
  93. has_inittable:=false;
  94. {$ifdef GDB}
  95. is_def_stab_written := false;
  96. globalnb := 0;
  97. {$endif GDB}
  98. if assigned(lastglobaldef) then
  99. begin
  100. lastglobaldef^.nextglobal := @self;
  101. previousglobal:=lastglobaldef;
  102. end
  103. else
  104. begin
  105. firstglobaldef := @self;
  106. previousglobal:=nil;
  107. end;
  108. lastglobaldef := @self;
  109. nextglobal := nil;
  110. end;
  111. destructor tdef.done;
  112. begin
  113. { first element ? }
  114. if not(assigned(previousglobal)) then
  115. begin
  116. firstglobaldef := nextglobal;
  117. if assigned(firstglobaldef) then
  118. firstglobaldef^.previousglobal:=nil;
  119. end
  120. else
  121. begin
  122. { remove reference in the element before }
  123. previousglobal^.nextglobal:=nextglobal;
  124. end;
  125. { last element ? }
  126. if not(assigned(nextglobal)) then
  127. begin
  128. lastglobaldef := previousglobal;
  129. if assigned(lastglobaldef) then
  130. lastglobaldef^.nextglobal:=nil;
  131. end
  132. else
  133. nextglobal^.previousglobal:=previousglobal;
  134. previousglobal:=nil;
  135. nextglobal:=nil;
  136. end;
  137. { used for enumdef because the symbols are
  138. inserted in the owner symtable }
  139. procedure tdef.correct_owner_symtable;
  140. var
  141. st : psymtable;
  142. begin
  143. if assigned(owner) and
  144. (owner^.symtabletype in [recordsymtable,objectsymtable]) then
  145. begin
  146. { no other definition
  147. has been inserted !! (PM) }
  148. owner^.rootdef:=next;
  149. st:=owner;
  150. while (st^.symtabletype in [recordsymtable,objectsymtable]) do
  151. st:=st^.next;
  152. st^.registerdef(@self);
  153. end;
  154. end;
  155. procedure tdef.write;
  156. begin
  157. {$ifdef GDB}
  158. if globalnb = 0 then
  159. begin
  160. if assigned(owner) then
  161. globalnb := owner^.getnewtypecount
  162. else
  163. begin
  164. globalnb := PGlobalTypeCount^;
  165. Inc(PGlobalTypeCount^);
  166. end;
  167. end;
  168. {$endif GDB}
  169. end;
  170. function tdef.size : longint;
  171. begin
  172. size:=savesize;
  173. end;
  174. {$ifdef GDB}
  175. procedure tdef.set_globalnb;
  176. begin
  177. globalnb :=PGlobalTypeCount^;
  178. inc(PglobalTypeCount^);
  179. end;
  180. function tdef.stabstring : pchar;
  181. begin
  182. stabstring := strpnew('t'+numberstring+';');
  183. end;
  184. function tdef.numberstring : string;
  185. var table : psymtable;
  186. begin
  187. {formal def have no type !}
  188. if deftype = formaldef then
  189. begin
  190. numberstring := voiddef^.numberstring;
  191. exit;
  192. end;
  193. if (not assigned(sym)) or (not sym^.isusedinstab) then
  194. begin
  195. {set even if debuglist is not defined}
  196. if assigned(sym) then
  197. sym^.isusedinstab := true;
  198. if assigned(debuglist) and not is_def_stab_written then
  199. concatstabto(debuglist);
  200. end;
  201. if not (cs_gdb_dbx in aktglobalswitches) then
  202. begin
  203. if globalnb = 0 then
  204. set_globalnb;
  205. numberstring := tostr(globalnb);
  206. end
  207. else
  208. begin
  209. if globalnb = 0 then
  210. begin
  211. if assigned(owner) then
  212. globalnb := owner^.getnewtypecount
  213. else
  214. begin
  215. globalnb := PGlobalTypeCount^;
  216. Inc(PGlobalTypeCount^);
  217. end;
  218. end;
  219. if assigned(sym) then
  220. begin
  221. table := sym^.owner;
  222. if table^.unitid > 0 then
  223. numberstring := '('+tostr(table^.unitid)+','
  224. +tostr(sym^.definition^.globalnb)+')'
  225. else
  226. numberstring := tostr(globalnb);
  227. exit;
  228. end;
  229. numberstring := tostr(globalnb);
  230. end;
  231. end;
  232. function tdef.allstabstring : pchar;
  233. var stabchar : string[2];
  234. ss,st : pchar;
  235. name : string;
  236. sym_line_no : longint;
  237. begin
  238. ss := stabstring;
  239. getmem(st,strlen(ss)+512);
  240. stabchar := 't';
  241. if deftype in tagtypes then
  242. stabchar := 'Tt';
  243. if assigned(sym) then
  244. begin
  245. name := sym^.name;
  246. sym_line_no:=sym^.fileinfo.line;
  247. end
  248. else
  249. begin
  250. name := ' ';
  251. sym_line_no:=0;
  252. end;
  253. strpcopy(st,'"'+name+':'+stabchar+numberstring+'=');
  254. strpcopy(strecopy(strend(st),ss),'",'+tostr(N_LSYM)+',0,'+tostr(sym_line_no)+',0');
  255. allstabstring := strnew(st);
  256. freemem(st,strlen(ss)+512);
  257. strdispose(ss);
  258. end;
  259. procedure tdef.concatstabto(asmlist : paasmoutput);
  260. var stab_str : pchar;
  261. begin
  262. if ((sym = nil) or sym^.isusedinstab or (cs_gdb_dbx in aktglobalswitches))
  263. and not is_def_stab_written then
  264. begin
  265. If cs_gdb_dbx in aktglobalswitches then
  266. begin
  267. { otherwise you get two of each def }
  268. If assigned(sym) then
  269. begin
  270. if sym^.typ=typesym then
  271. sym^.isusedinstab:=true;
  272. if (sym^.owner = nil) or
  273. ((sym^.owner^.symtabletype = unitsymtable) and
  274. punitsymtable(sym^.owner)^.dbx_count_ok) then
  275. begin
  276. {with DBX we get the definition from the other objects }
  277. is_def_stab_written := true;
  278. exit;
  279. end;
  280. end;
  281. end;
  282. { to avoid infinite loops }
  283. is_def_stab_written := true;
  284. stab_str := allstabstring;
  285. if asmlist = debuglist then do_count_dbx := true;
  286. { count_dbx(stab_str); moved to GDB.PAS}
  287. asmlist^.concat(new(pai_stabs,init(stab_str)));
  288. end;
  289. end;
  290. {$endif GDB}
  291. procedure tdef.deref;
  292. begin
  293. end;
  294. { rtti generation }
  295. procedure tdef.generate_rtti;
  296. begin
  297. has_rtti:=true;
  298. getlabel(rtti_label);
  299. write_child_rtti_data;
  300. rttilist^.concat(new(pai_label,init(rtti_label)));
  301. write_rtti_data;
  302. end;
  303. function tdef.get_rtti_label : string;
  304. begin
  305. if not(has_rtti) then
  306. generate_rtti;
  307. get_rtti_label:=lab2str(rtti_label);
  308. end;
  309. { init table handling }
  310. function tdef.needs_inittable : boolean;
  311. begin
  312. needs_inittable:=false;
  313. end;
  314. procedure tdef.generate_inittable;
  315. begin
  316. has_inittable:=true;
  317. getlabel(inittable_label);
  318. write_child_init_data;
  319. rttilist^.concat(new(pai_label,init(inittable_label)));
  320. write_init_data;
  321. end;
  322. procedure tdef.write_init_data;
  323. begin
  324. write_rtti_data;
  325. end;
  326. procedure tdef.write_child_init_data;
  327. begin
  328. write_child_rtti_data;
  329. end;
  330. function tdef.get_inittable_label : plabel;
  331. begin
  332. if not(has_inittable) then
  333. generate_inittable;
  334. get_inittable_label:=inittable_label;
  335. end;
  336. procedure tdef.writename;
  337. var
  338. str : string;
  339. begin
  340. { name }
  341. if assigned(sym) then
  342. begin
  343. str:=sym^.name;
  344. rttilist^.concat(new(pai_string,init(chr(length(str))+str)));
  345. end
  346. else
  347. rttilist^.concat(new(pai_string,init(#0)))
  348. end;
  349. { returns true, if the definition can be published }
  350. function tdef.is_publishable : boolean;
  351. begin
  352. is_publishable:=false;
  353. end;
  354. procedure tdef.write_rtti_data;
  355. begin
  356. end;
  357. procedure tdef.write_child_rtti_data;
  358. begin
  359. end;
  360. {****************************************************************************
  361. TSTRINGDEF
  362. ****************************************************************************}
  363. constructor tstringdef.shortinit(l : byte);
  364. begin
  365. tdef.init;
  366. string_typ:=st_shortstring;
  367. deftype:=stringdef;
  368. len:=l;
  369. savesize:=len+1;
  370. end;
  371. constructor tstringdef.shortload;
  372. begin
  373. tdef.load;
  374. string_typ:=st_shortstring;
  375. deftype:=stringdef;
  376. len:=readbyte;
  377. savesize:=len+1;
  378. end;
  379. constructor tstringdef.longinit(l : longint);
  380. begin
  381. tdef.init;
  382. string_typ:=st_longstring;
  383. deftype:=stringdef;
  384. len:=l;
  385. savesize:=target_os.size_of_pointer;
  386. end;
  387. constructor tstringdef.longload;
  388. begin
  389. tdef.load;
  390. deftype:=stringdef;
  391. string_typ:=st_longstring;
  392. len:=readlong;
  393. savesize:=target_os.size_of_pointer;
  394. end;
  395. constructor tstringdef.ansiinit(l : longint);
  396. begin
  397. tdef.init;
  398. string_typ:=st_ansistring;
  399. deftype:=stringdef;
  400. len:=l;
  401. savesize:=target_os.size_of_pointer;
  402. end;
  403. constructor tstringdef.ansiload;
  404. begin
  405. tdef.load;
  406. deftype:=stringdef;
  407. string_typ:=st_ansistring;
  408. len:=readlong;
  409. savesize:=target_os.size_of_pointer;
  410. end;
  411. constructor tstringdef.wideinit(l : longint);
  412. begin
  413. tdef.init;
  414. string_typ:=st_widestring;
  415. deftype:=stringdef;
  416. len:=l;
  417. savesize:=target_os.size_of_pointer;
  418. end;
  419. constructor tstringdef.wideload;
  420. begin
  421. tdef.load;
  422. deftype:=stringdef;
  423. string_typ:=st_widestring;
  424. len:=readlong;
  425. savesize:=target_os.size_of_pointer;
  426. end;
  427. function tstringdef.size : longint;
  428. begin
  429. size:=savesize;
  430. end;
  431. procedure tstringdef.write;
  432. begin
  433. tdef.write;
  434. if string_typ=st_shortstring then
  435. writebyte(len)
  436. else
  437. writelong(len);
  438. case string_typ of
  439. st_shortstring : current_ppu^.writeentry(ibstringdef);
  440. st_longstring : current_ppu^.writeentry(iblongstringdef);
  441. st_ansistring : current_ppu^.writeentry(ibansistringdef);
  442. st_widestring : current_ppu^.writeentry(ibwidestringdef);
  443. end;
  444. end;
  445. {$ifdef GDB}
  446. function tstringdef.stabstring : pchar;
  447. var
  448. bytest,charst,longst : string;
  449. begin
  450. case string_typ of
  451. st_shortstring:
  452. begin
  453. charst := typeglobalnumber('char');
  454. { this is what I found in stabs.texinfo but
  455. gdb 4.12 for go32 doesn't understand that !! }
  456. {$IfDef GDBknowsstrings}
  457. stabstring := strpnew('n'+charst+';'+tostr(len));
  458. {$else}
  459. bytest := typeglobalnumber('byte');
  460. stabstring := strpnew('s'+tostr(len+1)+'length:'+bytest
  461. +',0,8;st:ar'+bytest
  462. +';1;'+tostr(len)+';'+charst+',8,'+tostr(len*8)+';;');
  463. {$EndIf}
  464. end;
  465. st_longstring:
  466. begin
  467. charst := typeglobalnumber('char');
  468. { this is what I found in stabs.texinfo but
  469. gdb 4.12 for go32 doesn't understand that !! }
  470. {$IfDef GDBknowsstrings}
  471. stabstring := strpnew('n'+charst+';'+tostr(len));
  472. {$else}
  473. bytest := typeglobalnumber('byte');
  474. longst := typeglobalnumber('longint');
  475. stabstring := strpnew('s'+tostr(len+5)+'length:'+longst
  476. +',0,32;dummy:'+bytest+',32,8;st:ar'+bytest
  477. +';1;'+tostr(len)+';'+charst+',40,'+tostr(len*8)+';;');
  478. {$EndIf}
  479. end;
  480. st_ansistring:
  481. begin
  482. { an ansi string looks like a pchar easy !! }
  483. stabstring:=strpnew('*'+typeglobalnumber('char'));
  484. end;
  485. st_widestring:
  486. begin
  487. { an ansi string looks like a pchar easy !! }
  488. stabstring:=strpnew('*'+typeglobalnumber('char'));
  489. end;
  490. end;
  491. end;
  492. procedure tstringdef.concatstabto(asmlist : paasmoutput);
  493. begin
  494. inherited concatstabto(asmlist);
  495. end;
  496. {$endif GDB}
  497. function tstringdef.needs_inittable : boolean;
  498. begin
  499. needs_inittable:=string_typ in [st_ansistring,st_widestring];
  500. end;
  501. procedure tstringdef.write_rtti_data;
  502. begin
  503. case string_typ of
  504. st_ansistring:
  505. begin
  506. rttilist^.concat(new(pai_const,init_8bit(tkAString)));
  507. end;
  508. st_widestring:
  509. begin
  510. rttilist^.concat(new(pai_const,init_8bit(tkWString)));
  511. end;
  512. st_longstring:
  513. begin
  514. rttilist^.concat(new(pai_const,init_8bit(tkLString)));
  515. end;
  516. st_shortstring:
  517. begin
  518. rttilist^.concat(new(pai_const,init_8bit(tkSString)));
  519. rttilist^.concat(new(pai_const,init_8bit(len)));
  520. end;
  521. end;
  522. end;
  523. function tstringdef.is_publishable : boolean;
  524. begin
  525. is_publishable:=true;
  526. end;
  527. {****************************************************************************
  528. TENUMDEF
  529. ****************************************************************************}
  530. constructor tenumdef.init;
  531. begin
  532. tdef.init;
  533. deftype:=enumdef;
  534. minval:=0;
  535. maxval:=0;
  536. calcsavesize;
  537. has_jumps:=false;
  538. basedef:=nil;
  539. rangenr:=0;
  540. first:=nil;
  541. correct_owner_symtable;
  542. end;
  543. constructor tenumdef.init_subrange(_basedef:penumdef;_min,_max:longint);
  544. begin
  545. tdef.init;
  546. deftype:=enumdef;
  547. minval:=_min;
  548. maxval:=_max;
  549. basedef:=_basedef;
  550. calcsavesize;
  551. has_jumps:=false;
  552. rangenr:=0;
  553. first:=nil;
  554. correct_owner_symtable;
  555. end;
  556. constructor tenumdef.load;
  557. begin
  558. tdef.load;
  559. deftype:=enumdef;
  560. basedef:=penumdef(readdefref);
  561. minval:=readlong;
  562. maxval:=readlong;
  563. savesize:=readlong;
  564. has_jumps:=false;
  565. first:=Nil;
  566. end;
  567. procedure tenumdef.calcsavesize;
  568. begin
  569. if (aktpackenum=4) or (min<0) or (max>65535) then
  570. savesize:=4
  571. else
  572. if (aktpackenum=2) or (min<0) or (max>255) then
  573. savesize:=2
  574. else
  575. savesize:=1;
  576. end;
  577. procedure tenumdef.setmax(_max:longint);
  578. begin
  579. maxval:=_max;
  580. calcsavesize;
  581. end;
  582. procedure tenumdef.setmin(_min:longint);
  583. begin
  584. minval:=_min;
  585. calcsavesize;
  586. end;
  587. function tenumdef.min:longint;
  588. begin
  589. min:=minval;
  590. end;
  591. function tenumdef.max:longint;
  592. begin
  593. max:=maxval;
  594. end;
  595. procedure tenumdef.deref;
  596. begin
  597. resolvedef(pdef(basedef));
  598. end;
  599. destructor tenumdef.done;
  600. begin
  601. inherited done;
  602. end;
  603. procedure tenumdef.write;
  604. begin
  605. tdef.write;
  606. writedefref(basedef);
  607. writelong(min);
  608. writelong(max);
  609. writelong(savesize);
  610. current_ppu^.writeentry(ibenumdef);
  611. end;
  612. function tenumdef.getrangecheckstring : string;
  613. begin
  614. if (cs_smartlink in aktmoduleswitches) then
  615. getrangecheckstring:='R_'+current_module^.modulename^+tostr(rangenr)
  616. else
  617. getrangecheckstring:='R_'+tostr(rangenr);
  618. end;
  619. procedure tenumdef.genrangecheck;
  620. begin
  621. if rangenr=0 then
  622. begin
  623. { generate two constant for bounds }
  624. getlabelnr(rangenr);
  625. if (cs_smartlink in aktmoduleswitches) then
  626. datasegment^.concat(new(pai_symbol,init_global(getrangecheckstring)))
  627. else
  628. datasegment^.concat(new(pai_symbol,init(getrangecheckstring)));
  629. datasegment^.concat(new(pai_const,init_32bit(min)));
  630. datasegment^.concat(new(pai_const,init_32bit(max)));
  631. end;
  632. end;
  633. {$ifdef GDB}
  634. function tenumdef.stabstring : pchar;
  635. var st,st2 : pchar;
  636. p : penumsym;
  637. s : string;
  638. memsize : word;
  639. begin
  640. memsize := memsizeinc;
  641. getmem(st,memsize);
  642. strpcopy(st,'e');
  643. p := first;
  644. while assigned(p) do
  645. begin
  646. s :=p^.name+':'+tostr(p^.value)+',';
  647. { place for the ending ';' also }
  648. if (strlen(st)+length(s)+1<memsize) then
  649. strpcopy(strend(st),s)
  650. else
  651. begin
  652. getmem(st2,memsize+memsizeinc);
  653. strcopy(st2,st);
  654. freemem(st,memsize);
  655. st := st2;
  656. memsize := memsize+memsizeinc;
  657. strpcopy(strend(st),s);
  658. end;
  659. p := p^.next;
  660. end;
  661. strpcopy(strend(st),';');
  662. stabstring := strnew(st);
  663. freemem(st,memsize);
  664. end;
  665. {$endif GDB}
  666. procedure tenumdef.write_child_rtti_data;
  667. begin
  668. if assigned(basedef) then
  669. basedef^.get_rtti_label;
  670. end;
  671. procedure tenumdef.write_rtti_data;
  672. var
  673. hp : penumsym;
  674. begin
  675. rttilist^.concat(new(pai_const,init_8bit(tkEnumeration)));
  676. case savesize of
  677. 1:
  678. rttilist^.concat(new(pai_const,init_8bit(otUByte)));
  679. 2:
  680. rttilist^.concat(new(pai_const,init_8bit(otUWord)));
  681. 4:
  682. rttilist^.concat(new(pai_const,init_8bit(otULong)));
  683. end;
  684. rttilist^.concat(new(pai_const,init_32bit(min)));
  685. rttilist^.concat(new(pai_const,init_32bit(max)));
  686. if assigned(basedef) then
  687. rttilist^.concat(new(pai_const,init_symbol(strpnew(basedef^.get_rtti_label))))
  688. else
  689. rttilist^.concat(new(pai_const,init_32bit(0)));
  690. hp:=first;
  691. while assigned(hp) do
  692. begin
  693. rttilist^.concat(new(pai_const,init_8bit(length(hp^.name))));
  694. rttilist^.concat(new(pai_string,init(hp^.name)));
  695. hp:=hp^.next;
  696. end;
  697. rttilist^.concat(new(pai_const,init_8bit(0)));
  698. end;
  699. function tenumdef.is_publishable : boolean;
  700. begin
  701. is_publishable:=true;
  702. end;
  703. {****************************************************************************
  704. TORDDEF
  705. ****************************************************************************}
  706. constructor torddef.init(t : tbasetype;v,b : longint);
  707. begin
  708. inherited init;
  709. deftype:=orddef;
  710. low:=v;
  711. high:=b;
  712. typ:=t;
  713. rangenr:=0;
  714. setsize;
  715. end;
  716. constructor torddef.load;
  717. begin
  718. inherited load;
  719. deftype:=orddef;
  720. typ:=tbasetype(readbyte);
  721. low:=readlong;
  722. high:=readlong;
  723. rangenr:=0;
  724. setsize;
  725. end;
  726. procedure torddef.setsize;
  727. begin
  728. if typ=uauto then
  729. begin
  730. { generate a unsigned range if high<0 and low>=0 }
  731. if (low>=0) and (high<0) then
  732. begin
  733. savesize:=4;
  734. typ:=u32bit;
  735. end
  736. else if (low>=0) and (high<=255) then
  737. begin
  738. savesize:=1;
  739. typ:=u8bit;
  740. end
  741. else if (low>=-128) and (high<=127) then
  742. begin
  743. savesize:=1;
  744. typ:=s8bit;
  745. end
  746. else if (low>=0) and (high<=65536) then
  747. begin
  748. savesize:=2;
  749. typ:=u16bit;
  750. end
  751. else if (low>=-32768) and (high<=32767) then
  752. begin
  753. savesize:=2;
  754. typ:=s16bit;
  755. end
  756. else
  757. begin
  758. savesize:=4;
  759. typ:=s32bit;
  760. end;
  761. end
  762. else
  763. begin
  764. case typ of
  765. u8bit,s8bit,
  766. uchar,bool8bit:
  767. savesize:=1;
  768. u16bit,s16bit,
  769. bool16bit:
  770. savesize:=2;
  771. s32bit,u32bit,
  772. bool32bit:
  773. savesize:=4;
  774. u64bit,s64bitint:
  775. savesize:=8;
  776. else
  777. savesize:=0;
  778. end;
  779. end;
  780. { there are no entrys for range checking }
  781. rangenr:=0;
  782. end;
  783. function torddef.getrangecheckstring : string;
  784. begin
  785. if (cs_smartlink in aktmoduleswitches) then
  786. getrangecheckstring:='R_'+current_module^.modulename^+tostr(rangenr)
  787. else
  788. getrangecheckstring:='R_'+tostr(rangenr);
  789. end;
  790. procedure torddef.genrangecheck;
  791. begin
  792. if rangenr=0 then
  793. begin
  794. { generate two constant for bounds }
  795. getlabelnr(rangenr);
  796. if (cs_smartlink in aktmoduleswitches) then
  797. datasegment^.concat(new(pai_symbol,init_global(getrangecheckstring)))
  798. else
  799. datasegment^.concat(new(pai_symbol,init(getrangecheckstring)));
  800. if low<=high then
  801. begin
  802. datasegment^.concat(new(pai_const,init_32bit(low)));
  803. datasegment^.concat(new(pai_const,init_32bit(high)));
  804. end
  805. { for u32bit we need two bounds }
  806. else
  807. begin
  808. datasegment^.concat(new(pai_const,init_32bit(low)));
  809. datasegment^.concat(new(pai_const,init_32bit($7fffffff)));
  810. datasegment^.concat(new(pai_const,init_32bit($80000000)));
  811. datasegment^.concat(new(pai_const,init_32bit(high)));
  812. end;
  813. end;
  814. end;
  815. procedure torddef.write;
  816. begin
  817. tdef.write;
  818. writebyte(byte(typ));
  819. writelong(low);
  820. writelong(high);
  821. current_ppu^.writeentry(iborddef);
  822. end;
  823. {$ifdef GDB}
  824. function torddef.stabstring : pchar;
  825. begin
  826. case typ of
  827. uvoid : stabstring := strpnew(numberstring+';');
  828. {GDB 4.12 for go32 doesn't like boolean as range for 0 to 1 !!!}
  829. {$ifdef Use_integer_types_for_boolean}
  830. bool8bit,
  831. bool16bit,
  832. bool32bit : stabstring := strpnew('r'+numberstring+';0;255;');
  833. {$else : not Use_integer_types_for_boolean}
  834. bool8bit : stabstring := strpnew('-21;');
  835. bool16bit : stabstring := strpnew('-22;');
  836. bool32bit : stabstring := strpnew('-23;');
  837. u64bit : stabstring := strpnew('-32;');
  838. s64bitint : stabstring := strpnew('-31;');
  839. {$endif not Use_integer_types_for_boolean}
  840. { u32bit : stabstring := strpnew('r'+
  841. s32bitdef^.numberstring+';0;-1;'); }
  842. else
  843. stabstring := strpnew('r'+s32bitdef^.numberstring+';'+tostr(low)+';'+tostr(high)+';');
  844. end;
  845. end;
  846. {$endif GDB}
  847. procedure torddef.write_rtti_data;
  848. const
  849. trans : array[uchar..bool8bit] of byte =
  850. (otUByte,otUByte,otUWord,otULong,otSByte,otSWord,otSLong,otUByte);
  851. begin
  852. case typ of
  853. bool8bit:
  854. rttilist^.concat(new(pai_const,init_8bit(tkBool)));
  855. uchar:
  856. rttilist^.concat(new(pai_const,init_8bit(tkChar)));
  857. else
  858. rttilist^.concat(new(pai_const,init_8bit(tkInteger)));
  859. end;
  860. rttilist^.concat(new(pai_const,init_8bit(byte(trans[typ]))));
  861. rttilist^.concat(new(pai_const,init_32bit(low)));
  862. rttilist^.concat(new(pai_const,init_32bit(high)));
  863. end;
  864. function torddef.is_publishable : boolean;
  865. begin
  866. is_publishable:=typ in [uchar..bool8bit];
  867. end;
  868. {****************************************************************************
  869. TFLOATDEF
  870. ****************************************************************************}
  871. constructor tfloatdef.init(t : tfloattype);
  872. begin
  873. inherited init;
  874. deftype:=floatdef;
  875. typ:=t;
  876. setsize;
  877. end;
  878. constructor tfloatdef.load;
  879. begin
  880. inherited load;
  881. deftype:=floatdef;
  882. typ:=tfloattype(readbyte);
  883. setsize;
  884. end;
  885. procedure tfloatdef.setsize;
  886. begin
  887. case typ of
  888. f16bit : savesize:=2;
  889. f32bit,
  890. s32real : savesize:=4;
  891. s64real : savesize:=8;
  892. s64bit : savesize:=8;
  893. s80real : savesize:=extended_size;
  894. else
  895. savesize:=0;
  896. end;
  897. end;
  898. procedure tfloatdef.write;
  899. begin
  900. inherited write;
  901. writebyte(byte(typ));
  902. current_ppu^.writeentry(ibfloatdef);
  903. end;
  904. {$ifdef GDB}
  905. function tfloatdef.stabstring : pchar;
  906. begin
  907. case typ of
  908. s32real,
  909. s64real : stabstring := strpnew('r'+
  910. s32bitdef^.numberstring+';'+tostr(savesize)+';0;');
  911. { for fixed real use longint instead to be able to }
  912. { debug something at least }
  913. f32bit:
  914. stabstring := s32bitdef^.stabstring;
  915. f16bit:
  916. stabstring := strpnew('r'+s32bitdef^.numberstring+';0;'+
  917. tostr($ffff)+';');
  918. { found this solution in stabsread.c from GDB v4.16 }
  919. s64bit : stabstring := strpnew('r'+
  920. s32bitdef^.numberstring+';-'+tostr(savesize)+';0;');
  921. {$ifdef i386}
  922. { under dos at least you must give a size of twelve instead of 10 !! }
  923. { this is probably do to the fact that in gcc all is pushed in 4 bytes size }
  924. s80real : stabstring := strpnew('r'+s32bitdef^.numberstring+';12;0;');
  925. {$endif i386}
  926. else
  927. internalerror(10005);
  928. end;
  929. end;
  930. {$endif GDB}
  931. procedure tfloatdef.write_rtti_data;
  932. const
  933. translate : array[tfloattype] of byte =
  934. (ftFixed32,ftSingle,ftDouble,ftExtended,ftComp,ftFixed16);
  935. begin
  936. rttilist^.concat(new(pai_const,init_8bit(tkFloat)));
  937. rttilist^.concat(new(pai_const,init_8bit(translate[typ])));
  938. end;
  939. function tfloatdef.is_publishable : boolean;
  940. begin
  941. is_publishable:=true;
  942. end;
  943. {****************************************************************************
  944. TFILEDEF
  945. ****************************************************************************}
  946. constructor tfiledef.init(ft : tfiletype;tas : pdef);
  947. begin
  948. inherited init;
  949. deftype:=filedef;
  950. filetype:=ft;
  951. typed_as:=tas;
  952. setsize;
  953. end;
  954. constructor tfiledef.load;
  955. begin
  956. inherited load;
  957. deftype:=filedef;
  958. filetype:=tfiletype(readbyte);
  959. if filetype=ft_typed then
  960. typed_as:=readdefref
  961. else
  962. typed_as:=nil;
  963. setsize;
  964. end;
  965. procedure tfiledef.deref;
  966. begin
  967. if filetype=ft_typed then
  968. resolvedef(typed_as);
  969. end;
  970. procedure tfiledef.setsize;
  971. begin
  972. case filetype of
  973. ft_text : savesize:=572;
  974. ft_typed,
  975. ft_untyped : savesize:=316;
  976. end;
  977. end;
  978. procedure tfiledef.write;
  979. begin
  980. inherited write;
  981. writebyte(byte(filetype));
  982. if filetype=ft_typed then
  983. writedefref(typed_as);
  984. current_ppu^.writeentry(ibfiledef);
  985. end;
  986. {$ifdef GDB}
  987. function tfiledef.stabstring : pchar;
  988. begin
  989. {$IfDef GDBknowsfiles}
  990. case filetyp of
  991. ft_typed : stabstring := strpnew('d'+typed_as^.numberstring{+';'});
  992. ft_untyped : stabstring := strpnew('d'+voiddef^.numberstring{+';'});
  993. ft_text : stabstring := strpnew('d'+cchardef^.numberstring{+';'});
  994. end;
  995. {$Else}
  996. {based on
  997. FileRec = Packed Record
  998. Handle,
  999. Mode,
  1000. RecSize : longint;
  1001. _private : array[1..32] of byte;
  1002. UserData : array[1..16] of byte;
  1003. name : array[0..255] of char;
  1004. End; }
  1005. { the buffer part is still missing !! (PM) }
  1006. { but the string could become too long !! }
  1007. stabstring := strpnew('s'+tostr(savesize)+
  1008. 'HANDLE:'+typeglobalnumber('longint')+',0,32;'+
  1009. 'MODE:'+typeglobalnumber('longint')+',32,32;'+
  1010. 'RECSIZE:'+typeglobalnumber('longint')+',64,32;'+
  1011. '_PRIVATE:ar'+typeglobalnumber('word')+';1;32;'+typeglobalnumber('byte')
  1012. +',96,256;'+
  1013. 'USERDATA:ar'+typeglobalnumber('word')+';1;16;'+typeglobalnumber('byte')
  1014. +',352,128;'+
  1015. 'NAME:ar'+typeglobalnumber('word')+';0;255;'+typeglobalnumber('char')
  1016. +',480,2048;;');
  1017. {$EndIf}
  1018. end;
  1019. procedure tfiledef.concatstabto(asmlist : paasmoutput);
  1020. begin
  1021. { most file defs are unnamed !!! }
  1022. if ((sym = nil) or sym^.isusedinstab or (cs_gdb_dbx in aktglobalswitches)) and
  1023. not is_def_stab_written then
  1024. begin
  1025. if assigned(typed_as) then forcestabto(asmlist,typed_as);
  1026. inherited concatstabto(asmlist);
  1027. end;
  1028. end;
  1029. {$endif GDB}
  1030. {****************************************************************************
  1031. TPOINTERDEF
  1032. ****************************************************************************}
  1033. constructor tpointerdef.init(def : pdef);
  1034. begin
  1035. inherited init;
  1036. deftype:=pointerdef;
  1037. definition:=def;
  1038. savesize:=target_os.size_of_pointer;
  1039. end;
  1040. constructor tpointerdef.load;
  1041. begin
  1042. inherited load;
  1043. deftype:=pointerdef;
  1044. { the real address in memory is calculated later (deref) }
  1045. definition:=readdefref;
  1046. savesize:=target_os.size_of_pointer;
  1047. end;
  1048. procedure tpointerdef.deref;
  1049. begin
  1050. resolvedef(definition);
  1051. end;
  1052. procedure tpointerdef.write;
  1053. begin
  1054. inherited write;
  1055. writedefref(definition);
  1056. current_ppu^.writeentry(ibpointerdef);
  1057. end;
  1058. {$ifdef GDB}
  1059. function tpointerdef.stabstring : pchar;
  1060. begin
  1061. stabstring := strpnew('*'+definition^.numberstring);
  1062. end;
  1063. procedure tpointerdef.concatstabto(asmlist : paasmoutput);
  1064. var st,nb : string;
  1065. sym_line_no : longint;
  1066. begin
  1067. if ( (sym=nil) or sym^.isusedinstab or (cs_gdb_dbx in aktglobalswitches)) and
  1068. not is_def_stab_written then
  1069. begin
  1070. if assigned(definition) then
  1071. if definition^.deftype in [recorddef,objectdef] then
  1072. begin
  1073. is_def_stab_written := true;
  1074. {to avoid infinite recursion in record with next-like fields }
  1075. nb := definition^.numberstring;
  1076. is_def_stab_written := false;
  1077. if not definition^.is_def_stab_written then
  1078. begin
  1079. if assigned(definition^.sym) then
  1080. begin
  1081. if assigned(sym) then
  1082. begin
  1083. st := sym^.name;
  1084. sym_line_no:=sym^.fileinfo.line;
  1085. end
  1086. else
  1087. begin
  1088. st := ' ';
  1089. sym_line_no:=0;
  1090. end;
  1091. st := '"'+st+':t'+numberstring+'=*'+definition^.numberstring
  1092. +'=xs'+definition^.sym^.name+':",'+tostr(N_LSYM)+',0,'+tostr(sym_line_no)+',0';
  1093. if asmlist = debuglist then do_count_dbx := true;
  1094. asmlist^.concat(new(pai_stabs,init(strpnew(st))));
  1095. end;
  1096. end else inherited concatstabto(asmlist);
  1097. is_def_stab_written := true;
  1098. end else
  1099. begin
  1100. forcestabto(asmlist,definition);
  1101. inherited concatstabto(asmlist);
  1102. end;
  1103. end;
  1104. end;
  1105. {$endif GDB}
  1106. {****************************************************************************
  1107. TCLASSREFDEF
  1108. ****************************************************************************}
  1109. constructor tclassrefdef.init(def : pdef);
  1110. begin
  1111. inherited init(def);
  1112. deftype:=classrefdef;
  1113. definition:=def;
  1114. savesize:=target_os.size_of_pointer;
  1115. end;
  1116. constructor tclassrefdef.load;
  1117. begin
  1118. inherited load;
  1119. deftype:=classrefdef;
  1120. end;
  1121. procedure tclassrefdef.write;
  1122. begin
  1123. { be careful, tclassdefref inherits from tpointerdef }
  1124. tdef.write;
  1125. writedefref(definition);
  1126. current_ppu^.writeentry(ibclassrefdef);
  1127. end;
  1128. {$ifdef GDB}
  1129. function tclassrefdef.stabstring : pchar;
  1130. begin
  1131. stabstring:=strpnew('');
  1132. end;
  1133. procedure tclassrefdef.concatstabto(asmlist : paasmoutput);
  1134. begin
  1135. end;
  1136. {$endif GDB}
  1137. {***************************************************************************
  1138. TSETDEF
  1139. ***************************************************************************}
  1140. { For i386 smallsets work,
  1141. for m68k there are problems
  1142. can be test by compiling with -dusesmallset PM }
  1143. {$ifdef i386}
  1144. {$define usesmallset}
  1145. {$endif i386}
  1146. constructor tsetdef.init(s : pdef;high : longint);
  1147. begin
  1148. inherited init;
  1149. deftype:=setdef;
  1150. setof:=s;
  1151. {$ifdef usesmallset}
  1152. { small sets only working for i386 PM }
  1153. if high<32 then
  1154. begin
  1155. settype:=smallset;
  1156. savesize:=Sizeof(longint);
  1157. end
  1158. else
  1159. {$endif usesmallset}
  1160. if high<256 then
  1161. begin
  1162. settype:=normset;
  1163. savesize:=32;
  1164. end
  1165. else
  1166. {$ifdef testvarsets}
  1167. if high<$10000 then
  1168. begin
  1169. settype:=varset;
  1170. savesize:=4*((high+31) div 32);
  1171. end
  1172. else
  1173. {$endif testvarsets}
  1174. Message(sym_e_ill_type_decl_set);
  1175. end;
  1176. constructor tsetdef.load;
  1177. begin
  1178. inherited load;
  1179. deftype:=setdef;
  1180. setof:=readdefref;
  1181. settype:=tsettype(readbyte);
  1182. case settype of
  1183. normset : savesize:=32;
  1184. varset : savesize:=readlong;
  1185. smallset : savesize:=Sizeof(longint);
  1186. end;
  1187. end;
  1188. procedure tsetdef.write;
  1189. begin
  1190. inherited write;
  1191. writedefref(setof);
  1192. writebyte(byte(settype));
  1193. if settype=varset then
  1194. writelong(savesize);
  1195. current_ppu^.writeentry(ibsetdef);
  1196. end;
  1197. {$ifdef GDB}
  1198. function tsetdef.stabstring : pchar;
  1199. begin
  1200. stabstring := strpnew('S'+setof^.numberstring);
  1201. end;
  1202. procedure tsetdef.concatstabto(asmlist : paasmoutput);
  1203. begin
  1204. if ( not assigned(sym) or sym^.isusedinstab or (cs_gdb_dbx in aktglobalswitches)) and
  1205. not is_def_stab_written then
  1206. begin
  1207. if assigned(setof) then
  1208. forcestabto(asmlist,setof);
  1209. inherited concatstabto(asmlist);
  1210. end;
  1211. end;
  1212. {$endif GDB}
  1213. procedure tsetdef.deref;
  1214. begin
  1215. resolvedef(setof);
  1216. end;
  1217. procedure tsetdef.write_rtti_data;
  1218. begin
  1219. rttilist^.concat(new(pai_const,init_8bit(tkSet)));
  1220. rttilist^.concat(new(pai_const,init_8bit(otULong)));
  1221. rttilist^.concat(new(pai_const,init_symbol(strpnew(setof^.get_rtti_label))));
  1222. end;
  1223. procedure tsetdef.write_child_rtti_data;
  1224. begin
  1225. setof^.get_rtti_label;
  1226. end;
  1227. function tsetdef.is_publishable : boolean;
  1228. begin
  1229. is_publishable:=settype=smallset;
  1230. end;
  1231. {***************************************************************************
  1232. TFORMALDEF
  1233. ***************************************************************************}
  1234. constructor tformaldef.init;
  1235. begin
  1236. inherited init;
  1237. deftype:=formaldef;
  1238. savesize:=target_os.size_of_pointer;
  1239. end;
  1240. constructor tformaldef.load;
  1241. begin
  1242. inherited load;
  1243. deftype:=formaldef;
  1244. savesize:=target_os.size_of_pointer;
  1245. end;
  1246. procedure tformaldef.write;
  1247. begin
  1248. inherited write;
  1249. current_ppu^.writeentry(ibformaldef);
  1250. end;
  1251. {$ifdef GDB}
  1252. function tformaldef.stabstring : pchar;
  1253. begin
  1254. stabstring := strpnew('formal'+numberstring+';');
  1255. end;
  1256. procedure tformaldef.concatstabto(asmlist : paasmoutput);
  1257. begin
  1258. { formaldef can't be stab'ed !}
  1259. end;
  1260. {$endif GDB}
  1261. {***************************************************************************
  1262. TARRAYDEF
  1263. ***************************************************************************}
  1264. constructor tarraydef.init(l,h : longint;rd : pdef);
  1265. begin
  1266. inherited init;
  1267. deftype:=arraydef;
  1268. lowrange:=l;
  1269. highrange:=h;
  1270. rangedef:=rd;
  1271. definition:=nil;
  1272. IsVariant:=false;
  1273. IsConstructor:=false;
  1274. IsArrayOfConst:=false;
  1275. rangenr:=0;
  1276. end;
  1277. constructor tarraydef.load;
  1278. begin
  1279. inherited load;
  1280. deftype:=arraydef;
  1281. { the addresses are calculated later }
  1282. definition:=readdefref;
  1283. rangedef:=readdefref;
  1284. lowrange:=readlong;
  1285. highrange:=readlong;
  1286. IsArrayOfConst:=boolean(readbyte);
  1287. IsVariant:=false;
  1288. IsConstructor:=false;
  1289. rangenr:=0;
  1290. end;
  1291. function tarraydef.getrangecheckstring : string;
  1292. begin
  1293. if (cs_smartlink in aktmoduleswitches) then
  1294. getrangecheckstring:='R_'+current_module^.modulename^+tostr(rangenr)
  1295. else
  1296. getrangecheckstring:='R_'+tostr(rangenr);
  1297. end;
  1298. procedure tarraydef.genrangecheck;
  1299. begin
  1300. if rangenr=0 then
  1301. begin
  1302. { generates the data for range checking }
  1303. getlabelnr(rangenr);
  1304. if (cs_smartlink in aktmoduleswitches) then
  1305. datasegment^.concat(new(pai_symbol,init_global(getrangecheckstring)))
  1306. else
  1307. datasegment^.concat(new(pai_symbol,init(getrangecheckstring)));
  1308. datasegment^.concat(new(pai_const,init_32bit(lowrange)));
  1309. datasegment^.concat(new(pai_const,init_32bit(highrange)));
  1310. end;
  1311. end;
  1312. procedure tarraydef.deref;
  1313. begin
  1314. resolvedef(definition);
  1315. resolvedef(rangedef);
  1316. end;
  1317. procedure tarraydef.write;
  1318. begin
  1319. inherited write;
  1320. writedefref(definition);
  1321. writedefref(rangedef);
  1322. writelong(lowrange);
  1323. writelong(highrange);
  1324. writebyte(byte(IsArrayOfConst));
  1325. current_ppu^.writeentry(ibarraydef);
  1326. end;
  1327. {$ifdef GDB}
  1328. function tarraydef.stabstring : pchar;
  1329. begin
  1330. stabstring := strpnew('ar'+rangedef^.numberstring+';'
  1331. +tostr(lowrange)+';'+tostr(highrange)+';'+definition^.numberstring);
  1332. end;
  1333. procedure tarraydef.concatstabto(asmlist : paasmoutput);
  1334. begin
  1335. if (not assigned(sym) or sym^.isusedinstab or (cs_gdb_dbx in aktglobalswitches))
  1336. and not is_def_stab_written then
  1337. begin
  1338. {when array are inserted they have no definition yet !!}
  1339. if assigned(definition) then
  1340. inherited concatstabto(asmlist);
  1341. end;
  1342. end;
  1343. {$endif GDB}
  1344. function tarraydef.elesize : longint;
  1345. begin
  1346. elesize:=definition^.size;
  1347. end;
  1348. function tarraydef.size : longint;
  1349. begin
  1350. { dirty hack to overcome an overflow (PFV) }
  1351. if highrange=$7fffffff then
  1352. size:=$7fffffff
  1353. else
  1354. size:=(highrange-lowrange+1)*elesize;
  1355. end;
  1356. function tarraydef.needs_inittable : boolean;
  1357. begin
  1358. needs_inittable:=definition^.needs_inittable;
  1359. end;
  1360. procedure tarraydef.write_child_rtti_data;
  1361. begin
  1362. definition^.get_rtti_label;
  1363. end;
  1364. procedure tarraydef.write_rtti_data;
  1365. begin
  1366. rttilist^.concat(new(pai_const,init_8bit(13)));
  1367. writename;
  1368. { size of elements }
  1369. rttilist^.concat(new(pai_const,init_32bit(definition^.size)));
  1370. { count of elements }
  1371. rttilist^.concat(new(pai_const,init_32bit(highrange-lowrange+1)));
  1372. { element type }
  1373. rttilist^.concat(new(pai_const,init_symbol(strpnew(definition^.get_rtti_label))));
  1374. end;
  1375. {***************************************************************************
  1376. TRECDEF
  1377. ***************************************************************************}
  1378. constructor trecdef.init(p : psymtable);
  1379. begin
  1380. inherited init;
  1381. deftype:=recorddef;
  1382. symtable:=p;
  1383. savesize:=symtable^.datasize;
  1384. symtable^.defowner := @self;
  1385. end;
  1386. constructor trecdef.load;
  1387. var
  1388. oldread_member : boolean;
  1389. begin
  1390. inherited load;
  1391. deftype:=recorddef;
  1392. savesize:=readlong;
  1393. oldread_member:=read_member;
  1394. read_member:=true;
  1395. symtable:=new(psymtable,loadasstruct(recordsymtable));
  1396. read_member:=oldread_member;
  1397. symtable^.defowner := @self;
  1398. end;
  1399. destructor trecdef.done;
  1400. begin
  1401. if assigned(symtable) then dispose(symtable,done);
  1402. inherited done;
  1403. end;
  1404. var
  1405. binittable : boolean;
  1406. procedure check_rec_inittable(s : psym);
  1407. begin
  1408. if (s^.typ=varsym) and
  1409. ((pvarsym(s)^.definition^.deftype<>objectdef)
  1410. or not(pobjectdef(pvarsym(s)^.definition)^.isclass)) then
  1411. binittable:=pvarsym(s)^.definition^.needs_inittable;
  1412. end;
  1413. function trecdef.needs_inittable : boolean;
  1414. var
  1415. oldb : boolean;
  1416. begin
  1417. { there are recursive calls to needs_rtti possible, }
  1418. { so we have to change to old value how else should }
  1419. { we do that ? check_rec_rtti can't be a nested }
  1420. { procedure of needs_rtti ! }
  1421. oldb:=binittable;
  1422. binittable:=false;
  1423. symtable^.foreach(check_rec_inittable);
  1424. needs_inittable:=binittable;
  1425. binittable:=oldb;
  1426. end;
  1427. procedure trecdef.deref;
  1428. var
  1429. hp : pdef;
  1430. oldrecsyms : psymtable;
  1431. begin
  1432. oldrecsyms:=aktrecordsymtable;
  1433. aktrecordsymtable:=symtable;
  1434. { now dereference the definitions }
  1435. hp:=symtable^.rootdef;
  1436. while assigned(hp) do
  1437. begin
  1438. hp^.deref;
  1439. { set owner }
  1440. hp^.owner:=symtable;
  1441. hp:=hp^.next;
  1442. end;
  1443. {$ifdef tp}
  1444. symtable^.foreach(derefsym);
  1445. {$else}
  1446. symtable^.foreach(@derefsym);
  1447. {$endif}
  1448. aktrecordsymtable:=oldrecsyms;
  1449. end;
  1450. procedure trecdef.write;
  1451. var
  1452. oldread_member : boolean;
  1453. begin
  1454. oldread_member:=read_member;
  1455. read_member:=true;
  1456. inherited write;
  1457. writelong(savesize);
  1458. current_ppu^.writeentry(ibrecorddef);
  1459. self.symtable^.writeasstruct;
  1460. read_member:=oldread_member;
  1461. end;
  1462. {$ifdef GDB}
  1463. Const StabRecString : pchar = Nil;
  1464. StabRecSize : longint = 0;
  1465. RecOffset : Longint = 0;
  1466. procedure addname(p : psym);
  1467. var
  1468. news, newrec : pchar;
  1469. spec : string[2];
  1470. begin
  1471. { static variables from objects are like global objects }
  1472. if ((p^.properties and sp_static)<>0) then
  1473. exit;
  1474. if ((p^.properties and sp_protected)<>0) then
  1475. spec:='/1'
  1476. else if ((p^.properties and sp_private)<>0) then
  1477. spec:='/0'
  1478. else
  1479. spec:='';
  1480. If p^.typ = varsym then
  1481. begin
  1482. newrec := strpnew(p^.name+':'+spec+pvarsym(p)^.definition^.numberstring
  1483. +','+tostr(pvarsym(p)^.address*8)+','
  1484. +tostr(pvarsym(p)^.definition^.size*8)+';');
  1485. if strlen(StabRecString) + strlen(newrec) >= StabRecSize-256 then
  1486. begin
  1487. getmem(news,stabrecsize+memsizeinc);
  1488. strcopy(news,stabrecstring);
  1489. freemem(stabrecstring,stabrecsize);
  1490. stabrecsize:=stabrecsize+memsizeinc;
  1491. stabrecstring:=news;
  1492. end;
  1493. strcat(StabRecstring,newrec);
  1494. strdispose(newrec);
  1495. {This should be used for case !!}
  1496. RecOffset := RecOffset + pvarsym(p)^.definition^.size;
  1497. end;
  1498. end;
  1499. function trecdef.stabstring : pchar;
  1500. Var oldrec : pchar;
  1501. oldsize : longint;
  1502. cur : psym;
  1503. begin
  1504. oldrec := stabrecstring;
  1505. oldsize:=stabrecsize;
  1506. GetMem(stabrecstring,memsizeinc);
  1507. stabrecsize:=memsizeinc;
  1508. strpcopy(stabRecString,'s'+tostr(savesize));
  1509. RecOffset := 0;
  1510. {$ifdef nonextfield}
  1511. {$ifdef tp}
  1512. symtable^.foreach(addname);
  1513. {$else}
  1514. symtable^.foreach(@addname);
  1515. {$endif}
  1516. {$else nonextfield}
  1517. cur:=symtable^.root;
  1518. while assigned(cur) do
  1519. begin
  1520. addname(cur);
  1521. cur:=cur^.nextsym;
  1522. end;
  1523. {$endif nonextfield}
  1524. { FPC doesn't want to convert a char to a pchar}
  1525. { is this a bug ? }
  1526. strpcopy(strend(StabRecString),';');
  1527. stabstring := strnew(StabRecString);
  1528. Freemem(stabrecstring,stabrecsize);
  1529. stabrecstring := oldrec;
  1530. stabrecsize:=oldsize;
  1531. end;
  1532. procedure trecdef.concatstabto(asmlist : paasmoutput);
  1533. begin
  1534. if (not assigned(sym) or sym^.isusedinstab or (cs_gdb_dbx in aktglobalswitches)) and
  1535. (not is_def_stab_written) then
  1536. inherited concatstabto(asmlist);
  1537. end;
  1538. {$endif GDB}
  1539. var
  1540. count : longint;
  1541. procedure count_inittable_fields(sym : psym);{$ifndef fpc}far;{$endif}
  1542. begin
  1543. if (sym^.typ=varsym) and (pvarsym(sym)^.definition^.needs_inittable) then
  1544. inc(count);
  1545. end;
  1546. procedure count_fields(sym : psym);{$ifndef fpc}far;{$endif}
  1547. begin
  1548. inc(count);
  1549. end;
  1550. procedure write_field_inittable(sym : psym);{$ifndef fpc}far;{$endif}
  1551. begin
  1552. if (sym^.typ=varsym) and pvarsym(sym)^.definition^.needs_inittable then
  1553. begin
  1554. rttilist^.concat(new(pai_const,init_symbol(strpnew(lab2str(pvarsym(sym)^.definition^.get_inittable_label)))));
  1555. rttilist^.concat(new(pai_const,init_32bit(pvarsym(sym)^.address)));
  1556. end;
  1557. end;
  1558. procedure write_field_rtti(sym : psym);{$ifndef fpc}far;{$endif}
  1559. begin
  1560. rttilist^.concat(new(pai_const,init_symbol(strpnew(pvarsym(sym)^.definition^.get_rtti_label))));
  1561. rttilist^.concat(new(pai_const,init_32bit(pvarsym(sym)^.address)));
  1562. end;
  1563. procedure generate_child_inittable(sym : psym);{$ifndef fpc}far;{$endif}
  1564. begin
  1565. if (sym^.typ=varsym) and pvarsym(sym)^.definition^.needs_inittable then
  1566. { force inittable generation }
  1567. pvarsym(sym)^.definition^.get_inittable_label;
  1568. end;
  1569. procedure generate_child_rtti(sym : psym);{$ifndef fpc}far;{$endif}
  1570. begin
  1571. pvarsym(sym)^.definition^.get_rtti_label;
  1572. end;
  1573. procedure trecdef.write_child_rtti_data;
  1574. begin
  1575. symtable^.foreach(generate_child_rtti);
  1576. end;
  1577. procedure trecdef.write_child_init_data;
  1578. begin
  1579. symtable^.foreach(generate_child_inittable);
  1580. end;
  1581. procedure trecdef.write_rtti_data;
  1582. begin
  1583. rttilist^.concat(new(pai_const,init_8bit(14)));
  1584. writename;
  1585. rttilist^.concat(new(pai_const,init_32bit(size)));
  1586. count:=0;
  1587. symtable^.foreach(count_fields);
  1588. rttilist^.concat(new(pai_const,init_32bit(count)));
  1589. symtable^.foreach(write_field_rtti);
  1590. end;
  1591. procedure trecdef.write_init_data;
  1592. begin
  1593. rttilist^.concat(new(pai_const,init_8bit(14)));
  1594. writename;
  1595. rttilist^.concat(new(pai_const,init_32bit(size)));
  1596. count:=0;
  1597. symtable^.foreach(count_inittable_fields);
  1598. rttilist^.concat(new(pai_const,init_32bit(count)));
  1599. symtable^.foreach(write_field_inittable);
  1600. end;
  1601. {***************************************************************************
  1602. TABSTRACTPROCDEF
  1603. ***************************************************************************}
  1604. constructor tabstractprocdef.init;
  1605. begin
  1606. inherited init;
  1607. para1:=nil;
  1608. fpu_used:=0;
  1609. options:=0;
  1610. retdef:=voiddef;
  1611. savesize:=target_os.size_of_pointer;
  1612. end;
  1613. procedure disposepdefcoll(var para1 : pdefcoll);
  1614. var
  1615. hp : pdefcoll;
  1616. begin
  1617. hp:=para1;
  1618. while assigned(hp) do
  1619. begin
  1620. para1:=hp^.next;
  1621. dispose(hp);
  1622. hp:=para1;
  1623. end;
  1624. end;
  1625. destructor tabstractprocdef.done;
  1626. begin
  1627. disposepdefcoll(para1);
  1628. inherited done;
  1629. end;
  1630. procedure tabstractprocdef.concatdef(p : pdef;vsp : tvarspez);
  1631. var
  1632. hp : pdefcoll;
  1633. begin
  1634. new(hp);
  1635. hp^.paratyp:=vsp;
  1636. hp^.data:=p;
  1637. hp^.next:=para1;
  1638. para1:=hp;
  1639. end;
  1640. { all functions returning in FPU are
  1641. assume to use 2 FPU registers
  1642. until the function implementation
  1643. is processed PM }
  1644. procedure tabstractprocdef.test_if_fpu_result;
  1645. begin
  1646. if assigned(retdef) and is_fpu(retdef) then
  1647. fpu_used:=2;
  1648. end;
  1649. procedure tabstractprocdef.deref;
  1650. var
  1651. hp : pdefcoll;
  1652. begin
  1653. inherited deref;
  1654. resolvedef(retdef);
  1655. hp:=para1;
  1656. while assigned(hp) do
  1657. begin
  1658. resolvedef(hp^.data);
  1659. hp:=hp^.next;
  1660. end;
  1661. end;
  1662. constructor tabstractprocdef.load;
  1663. var
  1664. last,hp : pdefcoll;
  1665. count,i : word;
  1666. begin
  1667. inherited load;
  1668. retdef:=readdefref;
  1669. fpu_used:=readbyte;
  1670. options:=readlong;
  1671. count:=readword;
  1672. para1:=nil;
  1673. savesize:=target_os.size_of_pointer;
  1674. for i:=1 to count do
  1675. begin
  1676. new(hp);
  1677. hp^.paratyp:=tvarspez(readbyte);
  1678. hp^.data:=readdefref;
  1679. hp^.next:=nil;
  1680. if para1=nil then
  1681. para1:=hp
  1682. else
  1683. last^.next:=hp;
  1684. last:=hp;
  1685. end;
  1686. end;
  1687. function tabstractprocdef.para_size : longint;
  1688. var
  1689. pdc : pdefcoll;
  1690. l : longint;
  1691. begin
  1692. l:=0;
  1693. pdc:=para1;
  1694. while assigned(pdc) do
  1695. begin
  1696. case pdc^.paratyp of
  1697. vs_var : inc(l,target_os.size_of_pointer);
  1698. {$ifndef VALUEPARA}
  1699. vs_value : inc(l,align(pdc^.data^.size,target_os.stackalignment));
  1700. vs_const : if dont_copy_const_param(pdc^.data) then
  1701. inc(l,target_os.size_of_pointer)
  1702. else
  1703. inc(l,align(pdc^.data^.size,target_os.stackalignment));
  1704. {$else}
  1705. vs_value,
  1706. vs_const : if push_addr_param(pdc^.data) then
  1707. inc(l,target_os.size_of_pointer)
  1708. else
  1709. inc(l,align(pdc^.data^.size,target_os.stackalignment));
  1710. {$endif}
  1711. end;
  1712. pdc:=pdc^.next;
  1713. end;
  1714. para_size:=l;
  1715. end;
  1716. procedure tabstractprocdef.write;
  1717. var
  1718. count : word;
  1719. hp : pdefcoll;
  1720. begin
  1721. inherited write;
  1722. writedefref(retdef);
  1723. writebyte(fpu_used);
  1724. writelong(options);
  1725. hp:=para1;
  1726. count:=0;
  1727. while assigned(hp) do
  1728. begin
  1729. inc(count);
  1730. hp:=hp^.next;
  1731. end;
  1732. writeword(count);
  1733. hp:=para1;
  1734. while assigned(hp) do
  1735. begin
  1736. writebyte(byte(hp^.paratyp));
  1737. writedefref(hp^.data);
  1738. hp:=hp^.next;
  1739. end;
  1740. end;
  1741. function tabstractprocdef.demangled_paras : string;
  1742. var s : string;
  1743. p : pdefcoll;
  1744. begin
  1745. s:='';
  1746. p:=para1;
  1747. if assigned(p) then
  1748. begin
  1749. s:=s+'(';
  1750. while assigned(p) do
  1751. begin
  1752. if assigned(p^.data^.sym) then
  1753. s:=s+p^.data^.sym^.name
  1754. else if p^.paratyp=vs_var then
  1755. s:=s+'var'
  1756. else if p^.paratyp=vs_const then
  1757. s:=s+'const';
  1758. p:=p^.next;
  1759. if assigned(p) then
  1760. s:=s+','
  1761. else
  1762. s:=s+')';
  1763. end;
  1764. end;
  1765. demangled_paras:=s;
  1766. end;
  1767. {$ifdef GDB}
  1768. function tabstractprocdef.stabstring : pchar;
  1769. begin
  1770. stabstring := strpnew('abstractproc'+numberstring+';');
  1771. end;
  1772. procedure tabstractprocdef.concatstabto(asmlist : paasmoutput);
  1773. begin
  1774. if (not assigned(sym) or sym^.isusedinstab or (cs_gdb_dbx in aktglobalswitches))
  1775. and not is_def_stab_written then
  1776. begin
  1777. if assigned(retdef) then forcestabto(asmlist,retdef);
  1778. inherited concatstabto(asmlist);
  1779. end;
  1780. end;
  1781. {$endif GDB}
  1782. {***************************************************************************
  1783. TPROCDEF
  1784. ***************************************************************************}
  1785. constructor tprocdef.init;
  1786. begin
  1787. inherited init;
  1788. deftype:=procdef;
  1789. _mangledname:=nil;
  1790. nextoverloaded:=nil;
  1791. extnumber:=-1;
  1792. localst:=new(psymtable,init(localsymtable));
  1793. parast:=new(psymtable,init(parasymtable));
  1794. { this is used by insert
  1795. to check same names in parast and localst }
  1796. localst^.next:=parast;
  1797. {$ifdef UseBrowser}
  1798. defref:=nil;
  1799. lastwritten:=nil;
  1800. refcount:=0;
  1801. if (cs_browser in aktmoduleswitches) and make_ref then
  1802. begin
  1803. defref:=new(pref,init(defref,@tokenpos));
  1804. inc(refcount);
  1805. end;
  1806. lastref:=defref;
  1807. {$endif UseBrowser}
  1808. { first, we assume, that all registers are used }
  1809. {$ifdef i386}
  1810. usedregisters:=$ff;
  1811. {$endif i386}
  1812. {$ifdef m68k}
  1813. usedregisters:=$FFFF;
  1814. {$endif}
  1815. {$ifdef alpha}
  1816. usedregisters_int:=$ffffffff;
  1817. usedregisters_fpu:=$ffffffff;
  1818. {$endif alpha}
  1819. forwarddef:=true;
  1820. _class := nil;
  1821. code:=nil;
  1822. end;
  1823. constructor tprocdef.load;
  1824. var
  1825. s : string;
  1826. begin
  1827. inherited load;
  1828. deftype:=procdef;
  1829. {$ifdef i386}
  1830. usedregisters:=readbyte;
  1831. {$endif i386}
  1832. {$ifdef m68k}
  1833. usedregisters:=readword;
  1834. {$endif}
  1835. {$ifdef alpha}
  1836. usedregisters_int:=readlong;
  1837. usedregisters_fpu:=readlong;
  1838. {$endif alpha}
  1839. s:=readstring;
  1840. setstring(_mangledname,s);
  1841. extnumber:=readlong;
  1842. nextoverloaded:=pprocdef(readdefref);
  1843. _class := pobjectdef(readdefref);
  1844. if (cs_link_deffile in aktglobalswitches) and ((options and poexports)<>0) then
  1845. deffile.AddExport(mangledname);
  1846. parast:=nil;
  1847. localst:=nil;
  1848. forwarddef:=false;
  1849. {$ifdef UseBrowser}
  1850. lastref:=nil;
  1851. lastwritten:=nil;
  1852. defref:=nil;
  1853. refcount:=0;
  1854. {$endif UseBrowser}
  1855. end;
  1856. {$ifdef UseBrowser}
  1857. procedure tprocdef.load_references;
  1858. var
  1859. pos : tfileposinfo;
  1860. move_last : boolean;
  1861. begin
  1862. move_last:=lastwritten=lastref;
  1863. while (not current_ppu^.endofentry) do
  1864. begin
  1865. readposinfo(pos);
  1866. inc(refcount);
  1867. lastref:=new(pref,init(lastref,@pos));
  1868. lastref^.is_written:=true;
  1869. if refcount=1 then
  1870. defref:=lastref;
  1871. end;
  1872. if move_last then
  1873. lastwritten:=lastref;
  1874. if (current_module^.flags and uf_local_browser)<>0 then
  1875. begin
  1876. new(parast,load);
  1877. parast^.load_browser;
  1878. new(localst,load);
  1879. localst^.load_browser;
  1880. end;
  1881. end;
  1882. function tprocdef.write_references : boolean;
  1883. var
  1884. ref : pref;
  1885. move_last : boolean;
  1886. begin
  1887. move_last:=lastwritten=lastref;
  1888. if move_last and ((current_module^.flags and uf_local_browser)=0) then
  1889. exit;
  1890. { write address of this symbol }
  1891. writedefref(@self);
  1892. { write refs }
  1893. if assigned(lastwritten) then
  1894. ref:=lastwritten
  1895. else
  1896. ref:=defref;
  1897. while assigned(ref) do
  1898. begin
  1899. if ref^.moduleindex=current_module^.unit_index then
  1900. begin
  1901. writeposinfo(ref^.posinfo);
  1902. ref^.is_written:=true;
  1903. if move_last then
  1904. lastwritten:=ref;
  1905. end
  1906. else if not ref^.is_written then
  1907. move_last:=false
  1908. else if move_last then
  1909. lastwritten:=ref;
  1910. ref:=ref^.nextref;
  1911. end;
  1912. current_ppu^.writeentry(ibdefref);
  1913. write_references:=true;
  1914. if (current_module^.flags and uf_local_browser)<>0 then
  1915. begin
  1916. { we need dummy para and local symtables
  1917. PPU files are then easier to read PM }
  1918. if not assigned(parast) then
  1919. parast:=new(psymtable,init(parasymtable));
  1920. parast^.write;
  1921. parast^.write_browser;
  1922. if not assigned(localst) then
  1923. localst:=new(psymtable,init(localsymtable));
  1924. localst^.write;
  1925. localst^.write_browser;
  1926. end;
  1927. end;
  1928. procedure tprocdef.add_to_browserlog;
  1929. begin
  1930. if assigned(defref) then
  1931. begin
  1932. Browse.AddLog('***'+mangledname);
  1933. Browse.AddLogRefs(defref);
  1934. if (current_module^.flags and uf_local_browser)<>0 then
  1935. begin
  1936. if assigned(parast) then
  1937. parast^.writebrowserlog;
  1938. if assigned(localst) then
  1939. localst^.writebrowserlog;
  1940. end;
  1941. end;
  1942. end;
  1943. {$endif UseBrowser}
  1944. destructor tprocdef.done;
  1945. begin
  1946. {$ifdef UseBrowser}
  1947. if assigned(defref) then
  1948. dispose(defref,done);
  1949. {$endif UseBrowser}
  1950. if assigned(parast) then
  1951. dispose(parast,done);
  1952. if assigned(localst) and (localst^.symtabletype<>staticsymtable) then
  1953. dispose(localst,done);
  1954. if assigned(code) and ((options and poinline) <> 0) then
  1955. disposetree(ptree(code));
  1956. if
  1957. {$ifdef tp}
  1958. not(use_big) and
  1959. {$endif}
  1960. assigned(_mangledname) then
  1961. strdispose(_mangledname);
  1962. inherited done;
  1963. end;
  1964. procedure tprocdef.write;
  1965. begin
  1966. inherited write;
  1967. {$ifdef i386}
  1968. writebyte(usedregisters);
  1969. {$endif i386}
  1970. {$ifdef m68k}
  1971. writeword(usedregisters);
  1972. {$endif}
  1973. {$ifdef alpha}
  1974. writelong(usedregisters_int);
  1975. writelong(usedregisters_fpu);
  1976. {$endif alpha}
  1977. writestring(mangledname);
  1978. writelong(extnumber);
  1979. if (options and pooperator) = 0 then
  1980. writedefref(nextoverloaded)
  1981. else
  1982. begin
  1983. { only write the overloads from the same unit }
  1984. if nextoverloaded^.owner=owner then
  1985. writedefref(nextoverloaded)
  1986. else
  1987. writedefref(nil);
  1988. end;
  1989. writedefref(_class);
  1990. if (options and poinline) <> 0 then
  1991. begin
  1992. { we need to save
  1993. - the para and the local symtable
  1994. - the code ptree !! PM
  1995. writesymtable(parast);
  1996. writesymtable(localst);
  1997. writeptree(ptree(code));
  1998. }
  1999. end;
  2000. current_ppu^.writeentry(ibprocdef);
  2001. end;
  2002. {$ifdef GDB}
  2003. procedure addparaname(p : psym);
  2004. var vs : char;
  2005. begin
  2006. if pvarsym(p)^.varspez = vs_value then vs := '1'
  2007. else vs := '0';
  2008. strpcopy(strend(StabRecString),p^.name+':'+pvarsym(p)^.definition^.numberstring+','+vs+';');
  2009. end;
  2010. function tprocdef.stabstring : pchar;
  2011. var param : pdefcoll;
  2012. i : word;
  2013. oldrec : pchar;
  2014. begin
  2015. oldrec := stabrecstring;
  2016. getmem(StabRecString,1024);
  2017. param := para1;
  2018. i := 0;
  2019. while assigned(param) do
  2020. begin
  2021. inc(i);
  2022. param := param^.next;
  2023. end;
  2024. strpcopy(StabRecString,'f'+retdef^.numberstring);
  2025. if i>0 then
  2026. begin
  2027. strpcopy(strend(StabRecString),','+tostr(i)+';');
  2028. (* confuse gdb !! PM
  2029. if assigned(parast) then
  2030. {$IfDef TP}
  2031. parast^.foreach(addparaname)
  2032. {$Else}
  2033. parast^.foreach(@addparaname)
  2034. {$EndIf}
  2035. else
  2036. begin
  2037. param := para1;
  2038. i := 0;
  2039. while assigned(param) do
  2040. begin
  2041. inc(i);
  2042. if param^.paratyp = vs_value then vartyp := '1' else vartyp := '0';
  2043. {Here we have lost the parameter names !!}
  2044. {using lower case parameters }
  2045. strpcopy(strend(stabrecstring),'p'+tostr(i)
  2046. +':'+param^.data^.numberstring+','+vartyp+';');
  2047. param := param^.next;
  2048. end;
  2049. end; *)
  2050. {strpcopy(strend(StabRecString),';');}
  2051. end;
  2052. stabstring := strnew(stabrecstring);
  2053. freemem(stabrecstring,1024);
  2054. stabrecstring := oldrec;
  2055. end;
  2056. procedure tprocdef.concatstabto(asmlist : paasmoutput);
  2057. begin
  2058. end;
  2059. {$endif GDB}
  2060. procedure tprocdef.deref;
  2061. begin
  2062. inherited deref;
  2063. resolvedef(pdef(nextoverloaded));
  2064. resolvedef(pdef(_class));
  2065. end;
  2066. function tprocdef.mangledname : string;
  2067. {$ifdef tp}
  2068. var
  2069. oldpos : longint;
  2070. s : string;
  2071. b : byte;
  2072. {$endif tp}
  2073. begin
  2074. {$ifdef tp}
  2075. if use_big then
  2076. begin
  2077. symbolstream.seek(longint(_mangledname));
  2078. symbolstream.read(b,1);
  2079. symbolstream.read(s[1],b);
  2080. s[0]:=chr(b);
  2081. mangledname:=s;
  2082. end
  2083. else
  2084. {$endif}
  2085. mangledname:=strpas(_mangledname);
  2086. end;
  2087. {$IfDef GDB}
  2088. function tprocdef.cplusplusmangledname : string;
  2089. var
  2090. s,s2 : string;
  2091. param : pdefcoll;
  2092. begin
  2093. s := sym^.name;
  2094. if _class <> nil then
  2095. begin
  2096. s2 := _class^.name^;
  2097. s := s+'__'+tostr(length(s2))+s2;
  2098. end else s := s + '_';
  2099. param := para1;
  2100. while assigned(param) do
  2101. begin
  2102. s2 := param^.data^.sym^.name;
  2103. s := s+tostr(length(s2))+s2;
  2104. param := param^.next;
  2105. end;
  2106. cplusplusmangledname:=s;
  2107. end;
  2108. {$EndIf GDB}
  2109. procedure tprocdef.setmangledname(const s : string);
  2110. begin
  2111. if {$ifdef tp}not(use_big) and{$endif} (assigned(_mangledname)) then
  2112. strdispose(_mangledname);
  2113. setstring(_mangledname,s);
  2114. {$ifdef UseBrowser}
  2115. if assigned(parast) then
  2116. begin
  2117. stringdispose(parast^.name);
  2118. parast^.name:=stringdup('args of '+s);
  2119. end;
  2120. if assigned(localst) then
  2121. begin
  2122. stringdispose(localst^.name);
  2123. localst^.name:=stringdup('locals of '+s);
  2124. end;
  2125. {$endif UseBrowser}
  2126. end;
  2127. {***************************************************************************
  2128. TPROCVARDEF
  2129. ***************************************************************************}
  2130. constructor tprocvardef.init;
  2131. begin
  2132. inherited init;
  2133. deftype:=procvardef;
  2134. end;
  2135. constructor tprocvardef.load;
  2136. begin
  2137. inherited load;
  2138. deftype:=procvardef;
  2139. end;
  2140. procedure tprocvardef.write;
  2141. begin
  2142. { here we cannot get a real good value so just give something }
  2143. { plausible (PM) }
  2144. { a more secure way would be
  2145. to allways store in a temp }
  2146. if is_fpu(retdef) then
  2147. fpu_used:=2
  2148. else
  2149. fpu_used:=0;
  2150. inherited write;
  2151. current_ppu^.writeentry(ibprocvardef);
  2152. end;
  2153. function tprocvardef.size : longint;
  2154. begin
  2155. if (options and pomethodpointer)=0 then
  2156. size:=target_os.size_of_pointer
  2157. else
  2158. size:=2*target_os.size_of_pointer;
  2159. end;
  2160. {$ifdef GDB}
  2161. function tprocvardef.stabstring : pchar;
  2162. var
  2163. nss : pchar;
  2164. i : word;
  2165. param : pdefcoll;
  2166. begin
  2167. i := 0;
  2168. param := para1;
  2169. while assigned(param) do
  2170. begin
  2171. inc(i);
  2172. param := param^.next;
  2173. end;
  2174. getmem(nss,1024);
  2175. strpcopy(nss,'f'+retdef^.numberstring{+','+tostr(i)}+';');
  2176. param := para1;
  2177. i := 0;
  2178. { this confuses gdb !!
  2179. we should use 'F' instead of 'f' but
  2180. as we use c++ language mode
  2181. it does not like that either
  2182. Please do not remove this part
  2183. might be used once
  2184. gdb for pascal is ready PM }
  2185. (* while assigned(param) do
  2186. begin
  2187. inc(i);
  2188. if param^.paratyp = vs_value then vartyp := '1' else vartyp := '0';
  2189. {Here we have lost the parameter names !!}
  2190. pst := strpnew('p'+tostr(i)+':'+param^.data^.numberstring+','+vartyp+';');
  2191. strcat(nss,pst);
  2192. strdispose(pst);
  2193. param := param^.next;
  2194. end; *)
  2195. {strpcopy(strend(nss),';');}
  2196. stabstring := strnew(nss);
  2197. freemem(nss,1024);
  2198. end;
  2199. procedure tprocvardef.concatstabto(asmlist : paasmoutput);
  2200. begin
  2201. if ( not assigned(sym) or sym^.isusedinstab or (cs_gdb_dbx in aktglobalswitches))
  2202. and not is_def_stab_written then
  2203. inherited concatstabto(asmlist);
  2204. is_def_stab_written:=true;
  2205. end;
  2206. {$endif GDB}
  2207. procedure tprocvardef.write_rtti_data;
  2208. begin
  2209. {!!!!!!!}
  2210. end;
  2211. procedure tprocvardef.write_child_rtti_data;
  2212. begin
  2213. {!!!!!!!!}
  2214. end;
  2215. function tprocvardef.is_publishable : boolean;
  2216. begin
  2217. is_publishable:=(options and pomethodpointer)<>0;
  2218. end;
  2219. {***************************************************************************
  2220. TOBJECTDEF
  2221. ***************************************************************************}
  2222. {$ifdef GDB}
  2223. const
  2224. vtabletype : word = 0;
  2225. vtableassigned : boolean = false;
  2226. {$endif GDB}
  2227. constructor tobjectdef.init(const n : string;c : pobjectdef);
  2228. begin
  2229. tdef.init;
  2230. deftype:=objectdef;
  2231. options:=0;
  2232. childof:=nil;
  2233. publicsyms:=new(psymtable,init(objectsymtable));
  2234. publicsyms^.name := stringdup(n);
  2235. { create space for vmt !! }
  2236. {$ifdef OLDVMTSTYLE}
  2237. publicsyms^.datasize:=target_os.size_of_pointer;
  2238. options:=oo_hasvmt;
  2239. vmt_offset:=0;
  2240. {$else }
  2241. options:=0;
  2242. vmt_offset:=0;
  2243. publicsyms^.datasize:=0;
  2244. {$endif }
  2245. publicsyms^.defowner:=@self;
  2246. set_parent(c);
  2247. name:=stringdup(n);
  2248. end;
  2249. procedure tobjectdef.set_parent( c : pobjectdef);
  2250. begin
  2251. { nothing to do if the parent was not forward !}
  2252. if assigned(childof) then
  2253. exit;
  2254. childof:=c;
  2255. { some options are inherited !! }
  2256. if assigned(c) then
  2257. begin
  2258. options:= options or (c^.options and
  2259. (oo_hasvirtual or oo_hasprivate or
  2260. oo_hasprotected or
  2261. oo_hasconstructor or oo_hasdestructor
  2262. ));
  2263. { add the data of the anchestor class }
  2264. publicsyms^.datasize:=publicsyms^.datasize
  2265. +childof^.publicsyms^.datasize;
  2266. if ((options and oo_hasvmt)<>0) and
  2267. ((c^.options and oo_hasvmt)<>0) then
  2268. publicsyms^.datasize:=publicsyms^.datasize-target_os.size_of_pointer;
  2269. { if parent has a vmt field then
  2270. the offset is the same for the child PM }
  2271. if ((c^.options and oo_hasvmt)<>0) or isclass then
  2272. begin
  2273. vmt_offset:=c^.vmt_offset;
  2274. options:=options or oo_hasvmt;
  2275. end;
  2276. end;
  2277. savesize := publicsyms^.datasize;
  2278. end;
  2279. constructor tobjectdef.load;
  2280. var
  2281. oldread_member : boolean;
  2282. begin
  2283. tdef.load;
  2284. deftype:=objectdef;
  2285. savesize:=readlong;
  2286. vmt_offset:=readlong;
  2287. name:=stringdup(readstring);
  2288. childof:=pobjectdef(readdefref);
  2289. options:=readlong;
  2290. oldread_member:=read_member;
  2291. read_member:=true;
  2292. object_options:=true;
  2293. publicsyms:=new(psymtable,loadasstruct(objectsymtable));
  2294. object_options:=false;
  2295. read_member:=oldread_member;
  2296. publicsyms^.defowner:=@self;
  2297. { publicsyms^.datasize:=savesize; }
  2298. publicsyms^.name := stringdup(name^);
  2299. { handles the predefined class tobject }
  2300. { the last TOBJECT which is loaded gets }
  2301. { it ! }
  2302. if (name^='TOBJECT') and not(cs_compilesystem in aktmoduleswitches) and
  2303. isclass and (childof=pointer($ffffffff)) then
  2304. class_tobject:=@self;
  2305. has_rtti:=true;
  2306. end;
  2307. procedure tobjectdef.insertvmt;
  2308. begin
  2309. if (options and oo_hasvmt)<>0 then
  2310. internalerror(12345)
  2311. else
  2312. begin
  2313. { first round up to multiple of 4 }
  2314. if (aktpackrecords=2) then
  2315. begin
  2316. if (publicsyms^.datasize and 1)<>0 then
  2317. inc(publicsyms^.datasize);
  2318. end;
  2319. if (aktpackrecords>=4) then
  2320. begin
  2321. if (publicsyms^.datasize mod 4) <> 0 then
  2322. publicsyms^.datasize:=publicsyms^.datasize+4-(publicsyms^.datasize mod 4);
  2323. end;
  2324. vmt_offset:=publicsyms^.datasize;
  2325. publicsyms^.datasize:=publicsyms^.datasize+target_os.size_of_pointer;
  2326. options:=options or oo_hasvmt;
  2327. end;
  2328. end;
  2329. procedure tobjectdef.check_forwards;
  2330. begin
  2331. publicsyms^.check_forwards;
  2332. if (options and oo_isforward)<>0 then
  2333. begin
  2334. { ok, in future, the forward can be resolved }
  2335. Message1(sym_e_class_forward_not_resolved,name^);
  2336. options:=options and not(oo_isforward);
  2337. end;
  2338. end;
  2339. destructor tobjectdef.done;
  2340. begin
  2341. {!!!!
  2342. if assigned(privatesyms) then
  2343. dispose(privatesyms,done);
  2344. if assigned(protectedsyms) then
  2345. dispose(protectedsyms,done); }
  2346. if assigned(publicsyms) then
  2347. dispose(publicsyms,done);
  2348. if (options and oo_isforward)<>0 then
  2349. Message1(sym_e_class_forward_not_resolved,name^);
  2350. stringdispose(name);
  2351. tdef.done;
  2352. end;
  2353. { true, if self inherits from d (or if they are equal) }
  2354. function tobjectdef.isrelated(d : pobjectdef) : boolean;
  2355. var
  2356. hp : pobjectdef;
  2357. begin
  2358. hp:=@self;
  2359. while assigned(hp) do
  2360. begin
  2361. if hp=d then
  2362. begin
  2363. isrelated:=true;
  2364. exit;
  2365. end;
  2366. hp:=hp^.childof;
  2367. end;
  2368. isrelated:=false;
  2369. end;
  2370. function tobjectdef.size : longint;
  2371. begin
  2372. if (options and oo_is_class)<>0 then
  2373. size:=target_os.size_of_pointer
  2374. else
  2375. size:=publicsyms^.datasize;
  2376. end;
  2377. procedure tobjectdef.deref;
  2378. var
  2379. hp : pdef;
  2380. oldrecsyms : psymtable;
  2381. begin
  2382. resolvedef(pdef(childof));
  2383. oldrecsyms:=aktrecordsymtable;
  2384. aktrecordsymtable:=publicsyms;
  2385. { nun die Definitionen dereferenzieren }
  2386. hp:=publicsyms^.rootdef;
  2387. while assigned(hp) do
  2388. begin
  2389. hp^.deref;
  2390. { set owner }
  2391. hp^.owner:=publicsyms;
  2392. hp:=hp^.next;
  2393. end;
  2394. {$ifdef tp}
  2395. publicsyms^.foreach(derefsym);
  2396. {$else}
  2397. publicsyms^.foreach(@derefsym);
  2398. {$endif}
  2399. aktrecordsymtable:=oldrecsyms;
  2400. end;
  2401. function tobjectdef.vmt_mangledname : string;
  2402. {DM: I get a nil pointer on the owner name. I don't know if this
  2403. mayhappen, and I have therefore fixed the problem by doing nil pointer
  2404. checks.}
  2405. var
  2406. s1,s2:string;
  2407. begin
  2408. if (options and oo_hasvmt)=0 then
  2409. internalerror(12346);
  2410. if owner^.name=nil then
  2411. s1:=''
  2412. else
  2413. s1:=owner^.name^;
  2414. if name=nil then
  2415. s2:=''
  2416. else
  2417. s2:=name^;
  2418. vmt_mangledname:='VMT_'+s1+'$_'+s2;
  2419. end;
  2420. function tobjectdef.rtti_name : string;
  2421. var
  2422. s1,s2:string;
  2423. begin
  2424. if owner^.name=nil then
  2425. s1:=''
  2426. else
  2427. s1:=owner^.name^;
  2428. if name=nil then
  2429. s2:=''
  2430. else
  2431. s2:=name^;
  2432. rtti_name:='RTTI_'+s1+'$_'+s2;
  2433. end;
  2434. function tobjectdef.isclass : boolean;
  2435. begin
  2436. isclass:=(options and oo_is_class)<>0;
  2437. end;
  2438. procedure tobjectdef.write;
  2439. var
  2440. oldread_member : boolean;
  2441. begin
  2442. tdef.write;
  2443. writelong(size);
  2444. writelong(vmt_offset);
  2445. writestring(name^);
  2446. writedefref(childof);
  2447. writelong(options);
  2448. current_ppu^.writeentry(ibobjectdef);
  2449. oldread_member:=read_member;
  2450. read_member:=true;
  2451. object_options:=true;
  2452. publicsyms^.writeasstruct;
  2453. object_options:=false;
  2454. read_member:=oldread_member;
  2455. end;
  2456. {$ifdef GDB}
  2457. procedure addprocname(p :psym);
  2458. var virtualind,argnames : string;
  2459. news, newrec : pchar;
  2460. pd,ipd : pprocdef;
  2461. lindex : longint;
  2462. para : pdefcoll;
  2463. arglength : byte;
  2464. sp : char;
  2465. begin
  2466. If p^.typ = procsym then
  2467. begin
  2468. pd := pprocsym(p)^.definition;
  2469. { this will be used for full implementation of object stabs
  2470. not yet done }
  2471. ipd := pd;
  2472. while assigned(ipd^.nextoverloaded) do ipd := ipd^.nextoverloaded;
  2473. if (pd^.options and povirtualmethod) <> 0 then
  2474. begin
  2475. lindex := pd^.extnumber;
  2476. {doesnt seem to be necessary
  2477. lindex := lindex or $80000000;}
  2478. virtualind := '*'+tostr(lindex)+';'+ipd^._class^.numberstring+';'
  2479. end else virtualind := '.';
  2480. { arguments are not listed here }
  2481. {we don't need another definition}
  2482. para := pd^.para1;
  2483. { used by gdbpas to recognize constructor and destructors }
  2484. if (pd^.options and poconstructor) <> 0 then
  2485. argnames:='__ct__'
  2486. else if (pd^.options and podestructor) <> 0 then
  2487. argnames:='__dt__'
  2488. else
  2489. argnames := '';
  2490. while assigned(para) do
  2491. begin
  2492. if para^.data^.deftype = formaldef then
  2493. begin
  2494. if para^.paratyp=vs_var then
  2495. argnames := argnames+'3var'
  2496. else if para^.paratyp=vs_const then
  2497. argnames:=argnames+'5const';
  2498. end
  2499. else
  2500. begin
  2501. { if the arg definition is like (v: ^byte;..
  2502. there is no sym attached to data !!! }
  2503. if assigned(para^.data^.sym) then
  2504. begin
  2505. arglength := length(para^.data^.sym^.name);
  2506. argnames := argnames + tostr(arglength)+para^.data^.sym^.name;
  2507. end
  2508. else
  2509. begin
  2510. argnames:=argnames+'11unnamedtype';
  2511. end;
  2512. end;
  2513. para := para^.next;
  2514. end;
  2515. ipd^.is_def_stab_written := true;
  2516. { here 2A must be changed for private and protected }
  2517. { 0 is private 1 protected and 2 public }
  2518. if (p^.properties and sp_private)<>0 then sp:='0'
  2519. else if (p^.properties and sp_protected)<>0 then sp:='1'
  2520. else sp:='2';
  2521. newrec := strpnew(p^.name+'::'+ipd^.numberstring
  2522. +'=##'+pd^.retdef^.numberstring+';:'+argnames+';'+sp+'A'
  2523. +virtualind+';');
  2524. { get spare place for a string at the end }
  2525. if strlen(StabRecString) + strlen(newrec) >= StabRecSize-256 then
  2526. begin
  2527. getmem(news,stabrecsize+memsizeinc);
  2528. strcopy(news,stabrecstring);
  2529. freemem(stabrecstring,stabrecsize);
  2530. stabrecsize:=stabrecsize+memsizeinc;
  2531. stabrecstring:=news;
  2532. end;
  2533. strcat(StabRecstring,newrec);
  2534. {freemem(newrec,memsizeinc); }
  2535. strdispose(newrec);
  2536. {This should be used for case !!}
  2537. RecOffset := RecOffset + pd^.size;
  2538. end;
  2539. end;
  2540. function tobjectdef.stabstring : pchar;
  2541. var anc : pobjectdef;
  2542. oldrec : pchar;
  2543. oldrecsize : longint;
  2544. str_end : string;
  2545. {$ifndef nonextfield}
  2546. cur : psym;
  2547. {$endif nonextfield}
  2548. begin
  2549. oldrec := stabrecstring;
  2550. oldrecsize:=stabrecsize;
  2551. stabrecsize:=memsizeinc;
  2552. GetMem(stabrecstring,stabrecsize);
  2553. strpcopy(stabRecString,'s'+tostr(size));
  2554. if assigned(childof) then
  2555. {only one ancestor not virtual, public, at base offset 0 }
  2556. { !1 , 0 2 0 , }
  2557. strpcopy(strend(stabrecstring),'!1,020,'+childof^.numberstring+';');
  2558. {virtual table to implement yet}
  2559. RecOffset := 0;
  2560. {$ifdef nonextfield}
  2561. {$ifdef tp}
  2562. publicsyms^.foreach(addname);
  2563. {$else}
  2564. publicsyms^.foreach(@addname);
  2565. {$endif}
  2566. {$else nonextfield}
  2567. cur:=publicsyms^.root;
  2568. while assigned(cur) do
  2569. begin
  2570. addname(cur);
  2571. cur:=cur^.nextsym;
  2572. end;
  2573. {$endif nonextfield}
  2574. if (options and oo_hasvmt) <> 0 then
  2575. if not assigned(childof) or ((childof^.options and oo_hasvmt) = 0) then
  2576. begin
  2577. strpcopy(strend(stabrecstring),'$vf'+numberstring+':'+typeglobalnumber('vtblarray')
  2578. +','+tostr(vmt_offset*8)+';');
  2579. end;
  2580. {$ifdef nonextfield}
  2581. {$ifdef tp}
  2582. publicsyms^.foreach(addprocname);
  2583. {$else}
  2584. publicsyms^.foreach(@addprocname);
  2585. {$endif tp }
  2586. {$else nonextfield}
  2587. cur:=publicsyms^.root;
  2588. while assigned(cur) do
  2589. begin
  2590. addprocname(cur);
  2591. cur:=cur^.nextsym;
  2592. end;
  2593. {$endif nonextfield}
  2594. if (options and oo_hasvmt) <> 0 then
  2595. begin
  2596. anc := @self;
  2597. while assigned(anc^.childof) and ((anc^.childof^.options and oo_hasvmt) <> 0) do
  2598. anc := anc^.childof;
  2599. str_end:=';~%'+anc^.numberstring+';';
  2600. end
  2601. else
  2602. str_end:=';';
  2603. strpcopy(strend(stabrecstring),str_end);
  2604. stabstring := strnew(StabRecString);
  2605. freemem(stabrecstring,stabrecsize);
  2606. stabrecstring := oldrec;
  2607. stabrecsize:=oldrecsize;
  2608. end;
  2609. {$endif GDB}
  2610. procedure tobjectdef.write_child_init_data;
  2611. begin
  2612. end;
  2613. procedure tobjectdef.write_init_data;
  2614. begin
  2615. if isclass then
  2616. rttilist^.concat(new(pai_const,init_8bit(tkclass)))
  2617. else
  2618. rttilist^.concat(new(pai_const,init_8bit(tkobject)));
  2619. { generate the name }
  2620. rttilist^.concat(new(pai_const,init_8bit(length(name^))));
  2621. rttilist^.concat(new(pai_string,init(name^)));
  2622. rttilist^.concat(new(pai_const,init_32bit(size)));
  2623. count:=0;
  2624. publicsyms^.foreach(count_inittable_fields);
  2625. rttilist^.concat(new(pai_const,init_32bit(count)));
  2626. publicsyms^.foreach(write_field_inittable);
  2627. end;
  2628. function tobjectdef.needs_inittable : boolean;
  2629. var
  2630. oldb : boolean;
  2631. begin
  2632. { there are recursive calls to needs_inittable possible, }
  2633. { so we have to change to old value how else should }
  2634. { we do that ? check_rec_rtti can't be a nested }
  2635. { procedure of needs_rtti ! }
  2636. oldb:=binittable;
  2637. binittable:=false;
  2638. publicsyms^.foreach(check_rec_inittable);
  2639. needs_inittable:=binittable;
  2640. binittable:=oldb;
  2641. end;
  2642. procedure count_published_properties(sym : psym);{$ifndef fpc}far;{$endif}
  2643. begin
  2644. if (sym^.typ=propertysym) and ((sym^.properties and sp_published)<>0) then
  2645. inc(count);
  2646. end;
  2647. procedure write_property_info(sym : psym);{$ifndef fpc}far;{$endif}
  2648. var
  2649. proctypesinfo : byte;
  2650. procedure writeproc(sym : psym;def : pdef;shiftvalue : byte);
  2651. var
  2652. typvalue : byte;
  2653. begin
  2654. if not(assigned(sym)) then
  2655. begin
  2656. rttilist^.concat(new(pai_const,init_32bit(1)));
  2657. typvalue:=3;
  2658. end
  2659. else if sym^.typ=varsym then
  2660. begin
  2661. rttilist^.concat(new(pai_const,init_32bit(
  2662. pvarsym(sym)^.address)));
  2663. typvalue:=0;
  2664. end
  2665. else
  2666. begin
  2667. if (pprocdef(def)^.options and povirtualmethod)=0 then
  2668. begin
  2669. rttilist^.concat(new(pai_const,init_symbol(strpnew(pprocdef(def)^.mangledname))));
  2670. typvalue:=1;
  2671. end
  2672. else
  2673. begin
  2674. { virtual method, write vmt offset }
  2675. rttilist^.concat(new(pai_const,init_32bit(pprocdef(def)^.extnumber*4+12)));
  2676. typvalue:=2;
  2677. end;
  2678. end;
  2679. proctypesinfo:=proctypesinfo or (typvalue shl shiftvalue);
  2680. end;
  2681. begin
  2682. if (ppropertysym(sym)^.options and ppo_indexed)<>0 then
  2683. proctypesinfo:=$40
  2684. else
  2685. proctypesinfo:=0;
  2686. if (sym^.typ=propertysym) and ((sym^.properties and sp_published)<>0) then
  2687. begin
  2688. rttilist^.concat(new(pai_const,init_symbol(strpnew(ppropertysym(sym)^.proptype^.get_rtti_label))));
  2689. writeproc(ppropertysym(sym)^.readaccesssym,ppropertysym(sym)^.readaccessdef,0);
  2690. writeproc(ppropertysym(sym)^.writeaccesssym,ppropertysym(sym)^.writeaccessdef,2);
  2691. { isn't it stored ? }
  2692. if (ppropertysym(sym)^.options and ppo_stored)=0 then
  2693. begin
  2694. rttilist^.concat(new(pai_const,init_32bit(1)));
  2695. proctypesinfo:=proctypesinfo or (3 shl 4);
  2696. end
  2697. else
  2698. writeproc(ppropertysym(sym)^.storedsym,ppropertysym(sym)^.storeddef,4);
  2699. rttilist^.concat(new(pai_const,init_32bit(ppropertysym(sym)^.index)));
  2700. rttilist^.concat(new(pai_const,init_32bit(ppropertysym(sym)^.default)));
  2701. rttilist^.concat(new(pai_const,init_16bit(count)));
  2702. inc(count);
  2703. rttilist^.concat(new(pai_const,init_8bit(proctypesinfo)));
  2704. rttilist^.concat(new(pai_const,init_8bit(length(ppropertysym(sym)^.name))));
  2705. rttilist^.concat(new(pai_string,init(ppropertysym(sym)^.name)));
  2706. end;
  2707. end;
  2708. procedure generate_published_child_rtti(sym : psym);{$ifndef fpc}far;{$endif}
  2709. begin
  2710. if (sym^.typ=propertysym) and ((sym^.properties and sp_published)<>0) then
  2711. ppropertysym(sym)^.proptype^.get_rtti_label;
  2712. end;
  2713. procedure tobjectdef.write_child_rtti_data;
  2714. begin
  2715. publicsyms^.foreach(generate_published_child_rtti);
  2716. end;
  2717. procedure tobjectdef.generate_rtti;
  2718. begin
  2719. has_rtti:=true;
  2720. getlabel(rtti_label);
  2721. write_child_rtti_data;
  2722. rttilist^.concat(new(pai_symbol,init_global(rtti_name)));
  2723. rttilist^.concat(new(pai_label,init(rtti_label)));
  2724. write_rtti_data;
  2725. end;
  2726. function tobjectdef.next_free_name_index : longint;
  2727. var
  2728. i : longint;
  2729. begin
  2730. if assigned(childof) and ((childof^.options and oo_can_have_published)<>0) then
  2731. i:=childof^.next_free_name_index
  2732. else
  2733. i:=0;
  2734. count:=0;
  2735. publicsyms^.foreach(count_published_properties);
  2736. next_free_name_index:=i+count;
  2737. end;
  2738. procedure tobjectdef.write_rtti_data;
  2739. begin
  2740. if isclass then
  2741. rttilist^.concat(new(pai_const,init_8bit(tkclass)))
  2742. else
  2743. rttilist^.concat(new(pai_const,init_8bit(tkobject)));
  2744. { generate the name }
  2745. rttilist^.concat(new(pai_const,init_8bit(length(name^))));
  2746. rttilist^.concat(new(pai_string,init(name^)));
  2747. { write class type }
  2748. rttilist^.concat(new(pai_const,init_symbol(strpnew(vmt_mangledname))));
  2749. { write owner typeinfo }
  2750. if assigned(childof) and ((childof^.options and oo_can_have_published)<>0) then
  2751. rttilist^.concat(new(pai_const,init_symbol(strpnew(childof^.get_rtti_label))))
  2752. else
  2753. rttilist^.concat(new(pai_const,init_32bit(0)));
  2754. { count total number of properties }
  2755. if assigned(childof) and ((childof^.options and oo_can_have_published)<>0) then
  2756. count:=childof^.next_free_name_index
  2757. else
  2758. count:=0;
  2759. { write it }
  2760. publicsyms^.foreach(count_published_properties);
  2761. rttilist^.concat(new(pai_const,init_16bit(count)));
  2762. { write unit name }
  2763. if assigned(owner^.name) then
  2764. begin
  2765. rttilist^.concat(new(pai_const,init_8bit(length(owner^.name^))));
  2766. rttilist^.concat(new(pai_string,init(owner^.name^)));
  2767. end
  2768. else
  2769. rttilist^.concat(new(pai_const,init_8bit(0)));
  2770. { write published properties count }
  2771. count:=0;
  2772. publicsyms^.foreach(count_published_properties);
  2773. rttilist^.concat(new(pai_const,init_16bit(count)));
  2774. { count is used to write nameindex }
  2775. { but we need an offset of the owner }
  2776. { to give each property an own slot }
  2777. if assigned(childof) and ((childof^.options and oo_can_have_published)<>0) then
  2778. count:=childof^.next_free_name_index
  2779. else
  2780. count:=0;
  2781. publicsyms^.foreach(write_property_info);
  2782. end;
  2783. function tobjectdef.is_publishable : boolean;
  2784. begin
  2785. is_publishable:=isclass;
  2786. end;
  2787. function tobjectdef.get_rtti_label : string;
  2788. begin
  2789. get_rtti_label:=rtti_name;
  2790. end;
  2791. {****************************************************************************
  2792. TERRORDEF
  2793. ****************************************************************************}
  2794. constructor terrordef.init;
  2795. begin
  2796. inherited init;
  2797. deftype:=errordef;
  2798. end;
  2799. {$ifdef GDB}
  2800. function terrordef.stabstring : pchar;
  2801. begin
  2802. stabstring:=strpnew('error'+numberstring);
  2803. end;
  2804. {$endif GDB}
  2805. {
  2806. $Log$
  2807. Revision 1.81 1998-12-11 08:57:22 pierre
  2808. * internal gdb types for booleans and 64bit integers
  2809. Revision 1.80 1998/12/10 09:47:26 florian
  2810. + basic operations with int64/qord (compiler with -dint64)
  2811. + rtti of enumerations extended: names are now written
  2812. Revision 1.79 1998/12/08 10:18:12 peter
  2813. + -gh for heaptrc unit
  2814. Revision 1.78 1998/12/08 09:06:30 pierre
  2815. + constructor destructor info for gdbpas
  2816. Revision 1.77 1998/12/01 23:37:39 pierre
  2817. * function type problem for gdb fix
  2818. Revision 1.76 1998/11/29 21:45:48 florian
  2819. * problem with arrays with init tables fixed
  2820. Revision 1.75 1998/11/29 12:45:59 peter
  2821. * hack for arraydef.size overflow
  2822. Revision 1.74 1998/11/27 14:50:47 peter
  2823. + open strings, $P switch support
  2824. Revision 1.73 1998/11/26 14:47:00 michael
  2825. + Fixed RTTI constants
  2826. Revision 1.72 1998/11/25 14:35:28 florian
  2827. * writting of rtti for properties fixed
  2828. Revision 1.71 1998/11/20 15:35:59 florian
  2829. * problems with rtti fixed, hope it works
  2830. Revision 1.70 1998/11/18 15:44:16 peter
  2831. * VALUEPARA for tp7 compatible value parameters
  2832. Revision 1.69 1998/11/10 17:54:56 peter
  2833. * removed warning
  2834. Revision 1.68 1998/11/05 23:34:36 peter
  2835. * don't dispose staticsymtable (caused crash under tp7 after a fatal
  2836. error)
  2837. Revision 1.67 1998/11/05 12:02:56 peter
  2838. * released useansistring
  2839. * removed -Sv, its now available in fpc modes
  2840. Revision 1.66 1998/10/26 22:58:22 florian
  2841. * new introduded problem with classes fix, the parent class wasn't set
  2842. correct, if the class was defined forward before
  2843. Revision 1.65 1998/10/26 14:19:28 pierre
  2844. + added options -lS and -lT for source and target os output
  2845. (to have a easier way to test OS_SOURCE abd OS_TARGET in makefiles)
  2846. * several problems with rtti data
  2847. (type of sym was not checked)
  2848. assumed to be varsym when they could be procsym or property syms !!
  2849. Revision 1.64 1998/10/22 17:11:21 pierre
  2850. + terminated the include exclude implementation for i386
  2851. * enums inside records fixed
  2852. Revision 1.63 1998/10/20 09:32:56 peter
  2853. * removed some unused vars
  2854. Revision 1.62 1998/10/20 08:06:58 pierre
  2855. * several memory corruptions due to double freemem solved
  2856. => never use p^.loc.location:=p^.left^.loc.location;
  2857. + finally I added now by default
  2858. that ra386dir translates global and unit symbols
  2859. + added a first field in tsymtable and
  2860. a nextsym field in tsym
  2861. (this allows to obtain ordered type info for
  2862. records and objects in gdb !)
  2863. Revision 1.61 1998/10/19 08:55:05 pierre
  2864. * wrong stabs info corrected once again !!
  2865. + variable vmt offset with vmt field only if required
  2866. implemented now !!!
  2867. Revision 1.60 1998/10/16 13:12:53 pierre
  2868. * added vmt_offsets in destructors code also !!!
  2869. * vmt_offset code for m68k
  2870. Revision 1.59 1998/10/16 08:51:51 peter
  2871. + target_os.stackalignment
  2872. + stack can be aligned at 2 or 4 byte boundaries
  2873. Revision 1.58 1998/10/15 15:13:30 pierre
  2874. + added oo_hasconstructor and oo_hasdestructor
  2875. for objects options
  2876. Revision 1.57 1998/10/14 15:54:20 pierre
  2877. * smallsets are not entirely implemented for
  2878. m68k added a ifdef usesmallset
  2879. that is allways defined for i386
  2880. (enables testing for m68k)
  2881. Revision 1.56 1998/10/09 11:47:56 pierre
  2882. * still more memory leaks fixes !!
  2883. Revision 1.55 1998/10/06 17:16:55 pierre
  2884. * some memory leaks fixed (thanks to Peter for heaptrc !)
  2885. Revision 1.54 1998/10/05 21:33:28 peter
  2886. * fixed 161,165,166,167,168
  2887. Revision 1.53 1998/10/05 12:48:39 pierre
  2888. * wrong handling of range check for arrays fixed
  2889. Revision 1.52 1998/10/02 07:20:38 florian
  2890. * range checking in units doesn't work if the units are smartlinked, fixed
  2891. Revision 1.51 1998/09/25 12:01:41 florian
  2892. * tobjectdef.publicsyms.datasize was set to savesize, this is wrong now
  2893. because the symtable size is read from the ppu file
  2894. Revision 1.50 1998/09/23 15:46:40 florian
  2895. * problem with with and classes fixed
  2896. Revision 1.49 1998/09/23 12:03:55 peter
  2897. * overloading fix for array of const
  2898. Revision 1.48 1998/09/22 15:37:23 peter
  2899. + array of const start
  2900. Revision 1.47 1998/09/21 15:46:01 michael
  2901. Applied florians fix for check_rec_inittable
  2902. Revision 1.46 1998/09/21 08:45:21 pierre
  2903. + added vmt_offset in tobjectdef.write for fututre use
  2904. (first steps to have objects without vmt if no virtual !!)
  2905. + added fpu_used field for tabstractprocdef :
  2906. sets this level to 2 if the functions return with value in FPU
  2907. (is then set to correct value at parsing of implementation)
  2908. THIS MIGHT refuse some code with FPU expression too complex
  2909. that were accepted before and even in some cases
  2910. that don't overflow in fact
  2911. ( like if f : float; is a forward that finally in implementation
  2912. only uses one fpu register !!)
  2913. Nevertheless I think that it will improve security on
  2914. FPU operations !!
  2915. * most other changes only for UseBrowser code
  2916. (added symtable references for record and objects)
  2917. local switch for refs to args and local of each function
  2918. (static symtable still missing)
  2919. UseBrowser still not stable and probably broken by
  2920. the definition hash array !!
  2921. Revision 1.45 1998/09/20 08:31:29 florian
  2922. + bit 6 of tpropinfo.propprocs is set, if the property contains a
  2923. constant index
  2924. Revision 1.44 1998/09/19 15:23:58 florian
  2925. * rtti for ordtypes corrected
  2926. Revision 1.43 1998/09/18 17:12:40 florian
  2927. * problem with writing of class references fixed
  2928. Revision 1.42 1998/09/17 13:41:20 pierre
  2929. sizeof(TPOINT) problem
  2930. Revision 1.40.2.2 1998/09/17 08:42:33 pierre
  2931. TPOINT sizeof fix
  2932. Revision 1.41 1998/09/15 17:39:30 jonas
  2933. + bugfix from bugfix branch
  2934. Revision 1.40.2.1 1998/09/15 17:35:32 jonas
  2935. * chenged string_typ in tstringdef.wideload from ansistring to widestring
  2936. Revision 1.40 1998/09/09 15:34:00 peter
  2937. * removed warnings
  2938. Revision 1.39 1998/09/08 10:23:44 pierre
  2939. * name field of filedef corrected
  2940. Revision 1.38 1998/09/07 23:10:23 florian
  2941. * a lot of stuff fixed regarding rtti and publishing of properties,
  2942. basics should now work
  2943. Revision 1.37 1998/09/07 19:33:24 florian
  2944. + some stuff for property rtti added:
  2945. - NameIndex of the TPropInfo record is now written correctly
  2946. - the DEFAULT/NODEFAULT keyword is supported now
  2947. - the default value and the storedsym/def are now written to
  2948. the PPU fiel
  2949. Revision 1.36 1998/09/07 17:37:01 florian
  2950. * first fixes for published properties
  2951. Revision 1.35 1998/09/06 22:42:02 florian
  2952. + rtti genreation for properties added
  2953. Revision 1.34 1998/09/04 18:15:02 peter
  2954. * filedef updated
  2955. Revision 1.33 1998/09/03 17:08:49 pierre
  2956. * better lines for stabs
  2957. (no scroll back to if before else part
  2958. no return to case line at jump outside case)
  2959. + source lines also if not in order
  2960. Revision 1.32 1998/09/03 16:03:20 florian
  2961. + rtti generation
  2962. * init table generation changed
  2963. Revision 1.31 1998/09/02 15:14:28 peter
  2964. * enum packing changed from len to max
  2965. Revision 1.30 1998/09/01 17:37:29 peter
  2966. * removed debug writeln :(
  2967. Revision 1.29 1998/09/01 12:53:25 peter
  2968. + aktpackenum
  2969. Revision 1.28 1998/09/01 07:54:22 pierre
  2970. * UseBrowser a little updated (might still be buggy !!)
  2971. * bug in psub.pas in function specifier removed
  2972. * stdcall allowed in interface and in implementation
  2973. (FPC will not yet complain if it is missing in either part
  2974. because stdcall is only a dummy !!)
  2975. Revision 1.27 1998/08/28 12:51:43 florian
  2976. + ansistring to pchar type cast fixed
  2977. Revision 1.26 1998/08/25 12:42:44 pierre
  2978. * CDECL changed to CVAR for variables
  2979. specifications are read in structures also
  2980. + started adding GPC compatibility mode ( option -Sp)
  2981. * names changed to lowercase
  2982. Revision 1.25 1998/08/23 21:04:38 florian
  2983. + rtti generation for classes added
  2984. + new/dispose do now also a call to INITIALIZE/FINALIZE, if necessaray
  2985. Revision 1.24 1998/08/20 12:53:26 peter
  2986. * object_options are always written for object syms
  2987. Revision 1.23 1998/08/19 00:42:42 peter
  2988. + subrange types for enums
  2989. + checking for bounds type with ranges
  2990. Revision 1.22 1998/08/17 10:10:10 peter
  2991. - removed OLDPPU
  2992. Revision 1.21 1998/08/10 14:50:28 peter
  2993. + localswitches, moduleswitches, globalswitches splitting
  2994. Revision 1.20 1998/07/18 22:54:30 florian
  2995. * some ansi/wide/longstring support fixed:
  2996. o parameter passing
  2997. o returning as result from functions
  2998. Revision 1.19 1998/07/14 14:47:05 peter
  2999. * released NEWINPUT
  3000. Revision 1.18 1998/07/10 10:51:04 peter
  3001. * m68k updates
  3002. Revision 1.16 1998/07/07 11:20:13 peter
  3003. + NEWINPUT for a better inputfile and scanner object
  3004. Revision 1.15 1998/06/24 14:48:37 peter
  3005. * ifdef newppu -> ifndef oldppu
  3006. Revision 1.14 1998/06/16 08:56:31 peter
  3007. + targetcpu
  3008. * cleaner pmodules for newppu
  3009. Revision 1.13 1998/06/15 15:38:09 pierre
  3010. * small bug in systems.pas corrected
  3011. + operators in different units better hanlded
  3012. Revision 1.12 1998/06/15 14:30:12 daniel
  3013. * Reverted my changes.
  3014. Revision 1.10 1998/06/13 00:10:16 peter
  3015. * working browser and newppu
  3016. * some small fixes against crashes which occured in bp7 (but not in
  3017. fpc?!)
  3018. Revision 1.9 1998/06/12 14:10:37 michael
  3019. * Fixed wrong code for ansistring
  3020. Revision 1.8 1998/06/11 10:11:58 peter
  3021. * -gb works again
  3022. Revision 1.7 1998/06/07 15:30:25 florian
  3023. + first working rtti
  3024. + data init/final. for local variables
  3025. Revision 1.6 1998/06/05 14:37:37 pierre
  3026. * fixes for inline for operators
  3027. * inline procedure more correctly restricted
  3028. Revision 1.5 1998/06/04 23:52:01 peter
  3029. * m68k compiles
  3030. + .def file creation moved to gendef.pas so it could also be used
  3031. for win32
  3032. Revision 1.4 1998/06/04 09:55:45 pierre
  3033. * demangled name of procsym reworked to become independant of the mangling
  3034. scheme
  3035. Revision 1.3 1998/06/03 22:49:03 peter
  3036. + wordbool,longbool
  3037. * rename bis,von -> high,low
  3038. * moved some systemunit loading/creating to psystem.pas
  3039. Revision 1.2 1998/05/31 14:13:37 peter
  3040. * fixed call bugs with assembler readers
  3041. + OPR_SYMBOL to hold a symbol in the asm parser
  3042. * fixed staticsymtable vars which were acessed through %ebp instead of
  3043. name
  3044. Revision 1.1 1998/05/27 19:45:09 peter
  3045. * symtable.pas splitted into includefiles
  3046. * symtable adapted for $ifndef OLDPPU
  3047. }