symdef.inc 100 KB

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