symdef.inc 101 KB

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