symdef.inc 103 KB

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