ppudump.pp 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640
  1. {
  2. Copyright (c) 1998-2002 by the FPC Development Team
  3. Dumps the contents of a FPC unit file (PPU File)
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************}
  16. program ppudump;
  17. {$mode objfpc}
  18. {$H+}
  19. uses
  20. { do NOT add symconst or globtype to make merging easier }
  21. SysUtils,
  22. constexp,
  23. ppu,
  24. globals,
  25. tokens;
  26. const
  27. Version = 'Version 2.5.1';
  28. Title = 'PPU-Analyser';
  29. Copyright = 'Copyright (c) 1998-2010 by the Free Pascal Development Team';
  30. { verbosity }
  31. v_none = $0;
  32. v_header = $1;
  33. v_defs = $2;
  34. v_syms = $4;
  35. v_interface = $8;
  36. v_implementation = $10;
  37. // v_browser = $20;
  38. v_all = $ff;
  39. type
  40. tprocinfoflag=(
  41. { procedure has at least one assembler block }
  42. pi_has_assembler_block,
  43. { procedure does a call }
  44. pi_do_call,
  45. { procedure has a try statement = no register optimization }
  46. pi_uses_exceptions,
  47. { procedure is declared as @var(assembler), don't optimize}
  48. pi_is_assembler,
  49. { procedure contains data which needs to be finalized }
  50. pi_needs_implicit_finally,
  51. { procedure has the implicit try..finally generated }
  52. pi_has_implicit_finally,
  53. { procedure uses fpu}
  54. pi_uses_fpu,
  55. { procedure uses GOT for PIC code }
  56. pi_needs_got,
  57. { references var/proc/type/const in static symtable,
  58. i.e. not allowed for inlining from other units }
  59. pi_uses_static_symtable,
  60. { set if the procedure has to push parameters onto the stack }
  61. pi_has_stackparameter,
  62. { set if the procedure has at least one got }
  63. pi_has_goto,
  64. { calls itself recursive }
  65. pi_is_recursive,
  66. { stack frame optimization not possible (only on x86 probably) }
  67. pi_needs_stackframe,
  68. { set if the procedure has at least one register saved on the stack }
  69. pi_has_saved_regs,
  70. { dfa was generated for this proc }
  71. pi_dfaavailable
  72. );
  73. tprocinfoflags=set of tprocinfoflag;
  74. tspecialgenerictoken = (ST_LOADSETTINGS,ST_LINE,ST_COLUMN,ST_FILEINDEX);
  75. { Copied from systems.pas }
  76. tsystemcpu=
  77. (
  78. cpu_no, { 0 }
  79. cpu_i386, { 1 }
  80. cpu_m68k, { 2 }
  81. cpu_alpha, { 3 }
  82. cpu_powerpc, { 4 }
  83. cpu_sparc, { 5 }
  84. cpu_vm, { 6 }
  85. cpu_iA64, { 7 }
  86. cpu_x86_64, { 8 }
  87. cpu_mips, { 9 }
  88. cpu_arm, { 10 }
  89. cpu_powerpc64, { 11 }
  90. cpu_avr { 12 }
  91. );
  92. var
  93. ppufile : tppufile;
  94. space : string;
  95. verbose : longint;
  96. derefdata : pbyte;
  97. derefdatalen : longint;
  98. {****************************************************************************
  99. Helper Routines
  100. ****************************************************************************}
  101. const has_errors : boolean = false;
  102. Procedure Error(const S : string);
  103. Begin
  104. Writeln(S);
  105. has_errors:=true;
  106. End;
  107. function ToStr(w:longint):String;
  108. begin
  109. Str(w,ToStr);
  110. end;
  111. Function Target2Str(w:longint):string;
  112. type
  113. { taken from systems.pas }
  114. ttarget =
  115. (
  116. target_none, { 0 }
  117. obsolete_target_i386_GO32V1,{ 1 }
  118. target_i386_GO32V2, { 2 }
  119. target_i386_linux, { 3 }
  120. target_i386_OS2, { 4 }
  121. target_i386_Win32, { 5 }
  122. target_i386_freebsd, { 6 }
  123. target_m68k_Amiga, { 7 }
  124. target_m68k_Atari, { 8 }
  125. target_m68k_Mac, { 9 }
  126. target_m68k_linux, { 10 }
  127. target_m68k_PalmOS, { 11 }
  128. target_alpha_linux, { 12 }
  129. target_powerpc_linux, { 13 }
  130. target_powerpc_macos, { 14 }
  131. target_i386_solaris, { 15 }
  132. target_i386_beos, { 16 }
  133. target_i386_netbsd, { 17 }
  134. target_m68k_netbsd, { 18 }
  135. target_i386_Netware, { 19 }
  136. target_i386_qnx, { 20 }
  137. target_i386_wdosx, { 21 }
  138. target_sparc_solaris, { 22 }
  139. target_sparc_linux, { 23 }
  140. target_i386_openbsd, { 24 }
  141. target_m68k_openbsd, { 25 }
  142. target_x86_64_linux, { 26 }
  143. target_powerpc_darwin, { 27 }
  144. target_i386_emx, { 28 }
  145. target_powerpc_netbsd, { 29 }
  146. target_powerpc_openbsd, { 30 }
  147. target_arm_linux, { 31 }
  148. target_i386_watcom, { 32 }
  149. target_powerpc_MorphOS, { 33 }
  150. target_x86_64_freebsd, { 34 }
  151. target_i386_netwlibc, { 35 }
  152. target_powerpc_Amiga, { 36 }
  153. target_x86_64_win64, { 37 }
  154. target_arm_wince, { 38 }
  155. target_ia64_win64, { 39 }
  156. target_i386_wince, { 40 }
  157. target_x86_6432_linux, { 41 }
  158. target_arm_gba, { 42 }
  159. target_powerpc64_linux, { 43 }
  160. target_i386_darwin, { 44 }
  161. target_arm_palmos, { 45 }
  162. target_powerpc64_darwin, { 46 }
  163. target_arm_nds, { 47 }
  164. target_i386_embedded, { 48 }
  165. target_m68k_embedded, { 49 }
  166. target_alpha_embedded, { 50 }
  167. target_powerpc_embedded, { 51 }
  168. target_sparc_embedded, { 52 }
  169. target_vm_embedded, { 53 }
  170. target_iA64_embedded, { 54 }
  171. target_x86_64_embedded, { 55 }
  172. target_mips_embedded, { 56 }
  173. target_arm_embedded, { 57 }
  174. target_powerpc64_embedded, { 58 }
  175. target_i386_symbian, { 59 }
  176. target_arm_symbian, { 60 }
  177. target_x86_64_darwin, { 61 }
  178. target_avr_embedded, { 62 }
  179. target_i386_haiku, { 63 }
  180. target_arm_darwin, { 64 }
  181. target_x86_64_solaris { 65 }
  182. );
  183. const
  184. Targets : array[ttarget] of string[18]=(
  185. { 0 } 'none',
  186. { 1 } 'GO32V1 (obsolete)',
  187. { 2 } 'GO32V2',
  188. { 3 } 'Linux-i386',
  189. { 4 } 'OS/2',
  190. { 5 } 'Win32',
  191. { 6 } 'FreeBSD-i386',
  192. { 7 } 'Amiga',
  193. { 8 } 'Atari',
  194. { 9 } 'MacOS-m68k',
  195. { 10 } 'Linux-m68k',
  196. { 11 } 'PalmOS-m68k',
  197. { 12 } 'Linux-alpha',
  198. { 13 } 'Linux-ppc',
  199. { 14 } 'MacOS-ppc',
  200. { 15 } 'Solaris-i386',
  201. { 16 } 'BeOS-i386',
  202. { 17 } 'NetBSD-i386',
  203. { 18 } 'NetBSD-m68k',
  204. { 19 } 'Netware-i386-clib',
  205. { 20 } 'Qnx-i386',
  206. { 21 } 'WDOSX-i386',
  207. { 22 } 'Solaris-sparc',
  208. { 23 } 'Linux-sparc',
  209. { 24 } 'OpenBSD-i386',
  210. { 25 } 'OpenBSD-m68k',
  211. { 26 } 'Linux-x86-64',
  212. { 27 } 'MacOSX-ppc',
  213. { 28 } 'OS/2 via EMX',
  214. { 29 } 'NetBSD-powerpc',
  215. { 30 } 'OpenBSD-powerpc',
  216. { 31 } 'Linux-arm',
  217. { 32 } 'Watcom-i386',
  218. { 33 } 'MorphOS-powerpc',
  219. { 34 } 'FreeBSD-x86-64',
  220. { 35 } 'Netware-i386-libc',
  221. { 36 } 'Amiga-PowerPC',
  222. { 37 } 'Win64-x64',
  223. { 38 } 'WinCE-ARM',
  224. { 39 } 'Win64-iA64',
  225. { 40 } 'WinCE-i386',
  226. { 41 } 'Linux-x64',
  227. { 42 } 'GBA-arm',
  228. { 43 } 'Linux-powerpc64',
  229. { 44 } 'Darwin-i386',
  230. { 45 } 'PalmOS-arm',
  231. { 46 } 'MacOSX-powerpc64',
  232. { 47 } 'NDS-arm',
  233. { 48 } 'Embedded-i386',
  234. { 49 } 'Embedded-m68k',
  235. { 50 } 'Embedded-alpha',
  236. { 51 } 'Embedded-powerpc',
  237. { 52 } 'Embedded-sparc',
  238. { 53 } 'Embedded-vm',
  239. { 54 } 'Embedded-iA64',
  240. { 55 } 'Embedded-x64',
  241. { 56 } 'Embedded-mips',
  242. { 57 } 'Embedded-arm',
  243. { 58 } 'Embedded-powerpc64',
  244. { 59 } 'Symbian-i386',
  245. { 60 } 'Symbian-arm',
  246. { 61 } 'MacOSX-x64',
  247. { 62 } 'Embedded-avr',
  248. { 63 } 'Haiku-i386',
  249. { 64 } 'Darwin-ARM',
  250. { 65 } 'Solaris-x86-64'
  251. );
  252. begin
  253. if w<=ord(high(ttarget)) then
  254. Target2Str:=Targets[ttarget(w)]
  255. else
  256. Target2Str:='<!! Unknown target value '+tostr(w)+'>';
  257. end;
  258. Function Cpu2Str(w:longint):string;
  259. const
  260. CpuTxt : array[tsystemcpu] of string[9]=
  261. ('none','i386','m68k','alpha','powerpc','sparc','vis','ia64',
  262. 'x86_64','mips','arm','powerpc64','avr');
  263. begin
  264. if w<=ord(high(tsystemcpu)) then
  265. Cpu2Str:=CpuTxt[tsystemcpu(w)]
  266. else
  267. Cpu2Str:='<!! Unknown cpu value '+tostr(w)+'>';
  268. end;
  269. Function Varspez2Str(w:longint):string;
  270. const
  271. varspezstr : array[0..4] of string[6]=('Value','Const','Var','Out','Hidden');
  272. begin
  273. if w<=ord(high(varspezstr)) then
  274. Varspez2Str:=varspezstr[w]
  275. else
  276. Varspez2Str:='<!! Unknown varspez value '+tostr(w)+'>';
  277. end;
  278. Function VarRegable2Str(w:longint):string;
  279. const
  280. varregableStr : array[0..4] of string[6]=('None','IntReg','FPUReg','MMReg','Addr');
  281. begin
  282. if w<=ord(high(varregablestr)) then
  283. Varregable2Str:=varregablestr[w]
  284. else
  285. Varregable2Str:='<!! Unknown regable value '+tostr(w)+'>';
  286. end;
  287. Function Visibility2Str(w:longint):string;
  288. const
  289. visibilityName : array[0..6] of string[16] = (
  290. 'hidden','strict private','private','strict protected','protected',
  291. 'public','published'
  292. );
  293. begin
  294. if w<=ord(high(visibilityName)) then
  295. result:=visibilityName[w]
  296. else
  297. result:='<!! Unknown visibility value '+tostr(w)+'>';
  298. end;
  299. function PPUFlags2Str(flags:longint):string;
  300. type
  301. tflagopt=record
  302. mask : longint;
  303. str : string[30];
  304. end;
  305. const
  306. flagopts=17;
  307. flagopt : array[1..flagopts] of tflagopt=(
  308. (mask: $1 ;str:'init'),
  309. (mask: $2 ;str:'final'),
  310. (mask: $4 ;str:'big_endian'),
  311. (mask: $8 ;str:'dbx'),
  312. // (mask: $10 ;str:'browser'),
  313. (mask: $20 ;str:'in_library'),
  314. (mask: $40 ;str:'smart_linked'),
  315. (mask: $80 ;str:'static_linked'),
  316. (mask: $100 ;str:'shared_linked'),
  317. // (mask: $200 ;str:'local_browser'),
  318. (mask: $400 ;str:'no_link'),
  319. (mask: $800 ;str:'has_resources'),
  320. (mask: $1000 ;str:'little_endian'),
  321. (mask: $2000 ;str:'release'),
  322. (mask: $4000 ;str:'local_threadvars'),
  323. (mask: $8000 ;str:'fpu_emulation_on'),
  324. (mask: $10000 ;str:'has_debug_info'),
  325. (mask: $20000 ;str:'local_symtable'),
  326. (mask: $40000 ;str:'uses_variants')
  327. );
  328. var
  329. i : longint;
  330. first : boolean;
  331. s : string;
  332. begin
  333. s:='';
  334. if flags<>0 then
  335. begin
  336. first:=true;
  337. for i:=1to flagopts do
  338. if (flags and flagopt[i].mask)<>0 then
  339. begin
  340. if first then
  341. first:=false
  342. else
  343. s:=s+', ';
  344. s:=s+flagopt[i].str;
  345. end;
  346. end
  347. else
  348. s:='none';
  349. PPUFlags2Str:=s;
  350. end;
  351. Function L0(l:longint):string;
  352. {
  353. return the string of value l, if l<10 then insert a zero, so
  354. the string is always at least 2 chars '01','02',etc
  355. }
  356. var
  357. s : string;
  358. begin
  359. Str(l,s);
  360. if l<10 then
  361. s:='0'+s;
  362. L0:=s;
  363. end;
  364. function filetimestring( t : longint) : string;
  365. {
  366. convert dos datetime t to a string YY/MM/DD HH:MM:SS
  367. }
  368. var
  369. DT : TDateTime;
  370. hsec : word;
  371. Year,Month,Day: Word;
  372. hour,min,sec : word;
  373. begin
  374. if t=-1 then
  375. begin
  376. Result := 'Not Found';
  377. exit;
  378. end;
  379. DT := FileDateToDateTime(t);
  380. DecodeTime(DT,hour,min,sec,hsec);
  381. DecodeDate(DT,year,month,day);
  382. Result := L0(Year)+'/'+L0(Month)+'/'+L0(Day)+' '+L0(Hour)+':'+L0(min)+':'+L0(sec);
  383. end;
  384. {****************************************************************************
  385. Read Routines
  386. ****************************************************************************}
  387. Procedure ReadLinkContainer(const prefix:string);
  388. {
  389. Read a serie of strings and write to the screen starting every line
  390. with prefix
  391. }
  392. function maskstr(m:longint):string;
  393. const
  394. { link options }
  395. link_none = $0;
  396. link_always = $1;
  397. link_static = $2;
  398. link_smart = $4;
  399. link_shared = $8;
  400. var
  401. s : string;
  402. begin
  403. s:='';
  404. if (m and link_always)<>0 then
  405. s:=s+'always ';
  406. if (m and link_static)<>0 then
  407. s:=s+'static ';
  408. if (m and link_smart)<>0 then
  409. s:=s+'smart ';
  410. if (m and link_shared)<>0 then
  411. s:=s+'shared ';
  412. maskstr:=s;
  413. end;
  414. var
  415. s : string;
  416. m : longint;
  417. begin
  418. while not ppufile.endofentry do
  419. begin
  420. s:=ppufile.getstring;
  421. m:=ppufile.getlongint;
  422. WriteLn(prefix,s,' (',maskstr(m),')');
  423. end;
  424. end;
  425. Procedure ReadContainer(const prefix:string);
  426. {
  427. Read a serie of strings and write to the screen starting every line
  428. with prefix
  429. }
  430. begin
  431. while not ppufile.endofentry do
  432. WriteLn(prefix,ppufile.getstring);
  433. end;
  434. procedure ReadLoadUnit;
  435. var
  436. ucrc,uintfcrc, indcrc : cardinal;
  437. begin
  438. while not ppufile.EndOfEntry do
  439. begin
  440. write('Uses unit: ',ppufile.getstring);
  441. ucrc:=cardinal(ppufile.getlongint);
  442. uintfcrc:=cardinal(ppufile.getlongint);
  443. indcrc:=cardinal(ppufile.getlongint);
  444. writeln(' (Crc: ',hexstr(ucrc,8),', IntfcCrc: ',hexstr(uintfcrc,8),', IndCrc: ',hexstr(indcrc,8),')');
  445. end;
  446. end;
  447. Procedure ReadDerefmap;
  448. var
  449. i,mapsize : longint;
  450. begin
  451. mapsize:=ppufile.getlongint;
  452. writeln('DerefMapsize: ',mapsize);
  453. for i:=0 to mapsize-1 do
  454. writeln('DerefMap[',i,'] = ',ppufile.getstring);
  455. end;
  456. Procedure ReadImportSymbols;
  457. var
  458. extlibname : string;
  459. j,
  460. extsymcnt : longint;
  461. extsymname : string;
  462. extsymordnr : longint;
  463. extsymisvar : boolean;
  464. begin
  465. while not ppufile.endofentry do
  466. begin
  467. extlibname:=ppufile.getstring;
  468. extsymcnt:=ppufile.getlongint;
  469. writeln('External Library: ',extlibname,' (',extsymcnt,' imports)');
  470. for j:=0 to extsymcnt-1 do
  471. begin
  472. extsymname:=ppufile.getstring;
  473. extsymordnr:=ppufile.getlongint;
  474. extsymisvar:=ppufile.getbyte<>0;
  475. writeln(' ',extsymname,' (OrdNr: ',extsymordnr,' IsVar: ',extsymisvar,')');
  476. end;
  477. end;
  478. end;
  479. Procedure ReadDerefdata;
  480. begin
  481. derefdatalen:=ppufile.entrysize;
  482. if derefdatalen=0 then
  483. begin
  484. writeln('!! Error: derefdatalen=0');
  485. exit;
  486. end;
  487. Writeln('Derefdata length: ',derefdatalen);
  488. derefdata:=allocmem(derefdatalen);
  489. ppufile.getdata(derefdata^,derefdatalen);
  490. end;
  491. Procedure ReadWpoFileInfo;
  492. begin
  493. Writeln('Compiled with input whole-program optimisation from ',ppufile.getstring,' ',filetimestring(ppufile.getlongint));
  494. end;
  495. Procedure ReadAsmSymbols;
  496. type
  497. { Copied from aasmbase.pas }
  498. TAsmsymbind=(AB_NONE,AB_EXTERNAL,AB_COMMON,AB_LOCAL,AB_GLOBAL);
  499. TAsmsymtype=(AT_NONE,AT_FUNCTION,AT_DATA,AT_SECTION,AT_LABEL);
  500. var
  501. s,
  502. bindstr,
  503. typestr : string;
  504. i : longint;
  505. begin
  506. writeln(space,'Number of AsmSymbols: ',ppufile.getlongint);
  507. i:=0;
  508. while (not ppufile.endofentry) and (not ppufile.error) do
  509. begin
  510. s:=ppufile.getstring;
  511. case tasmsymbind(ppufile.getbyte) of
  512. AB_EXTERNAL :
  513. bindstr:='External';
  514. AB_COMMON :
  515. bindstr:='Common';
  516. AB_LOCAL :
  517. bindstr:='Local';
  518. AB_GLOBAL :
  519. bindstr:='Global';
  520. else
  521. bindstr:='<Error !!>'
  522. end;
  523. case tasmsymtype(ppufile.getbyte) of
  524. AT_FUNCTION :
  525. typestr:='Function';
  526. AT_DATA :
  527. typestr:='Data';
  528. AT_SECTION :
  529. typestr:='Section';
  530. AT_LABEL :
  531. typestr:='Label';
  532. else
  533. typestr:='<Error !!>'
  534. end;
  535. Writeln(space,' ',i,' : ',s,' [',bindstr,',',typestr,']');
  536. inc(i);
  537. end;
  538. end;
  539. function getexprint:Tconstexprint;
  540. begin
  541. getexprint.overflow:=false;
  542. getexprint.signed:=boolean(ppufile.getbyte);
  543. getexprint.svalue:=ppufile.getint64;
  544. end;
  545. Procedure ReadPosInfo;
  546. var
  547. info : byte;
  548. fileindex,line,column : longint;
  549. begin
  550. with ppufile do
  551. begin
  552. {
  553. info byte layout in bits:
  554. 0-1 - amount of bytes for fileindex
  555. 2-3 - amount of bytes for line
  556. 4-5 - amount of bytes for column
  557. }
  558. info:=getbyte;
  559. case (info and $03) of
  560. 0 : fileindex:=getbyte;
  561. 1 : fileindex:=getword;
  562. 2 : fileindex:=(getbyte shl 16) or getword;
  563. 3 : fileindex:=getlongint;
  564. end;
  565. case ((info shr 2) and $03) of
  566. 0 : line:=getbyte;
  567. 1 : line:=getword;
  568. 2 : line:=(getbyte shl 16) or getword;
  569. 3 : line:=getlongint;
  570. end;
  571. case ((info shr 4) and $03) of
  572. 0 : column:=getbyte;
  573. 1 : column:=getword;
  574. 2 : column:=(getbyte shl 16) or getword;
  575. 3 : column:=getlongint;
  576. end;
  577. Writeln(fileindex,' (',line,',',column,')');
  578. end;
  579. end;
  580. procedure readderef(const derefspace: string);
  581. type
  582. tdereftype = (deref_nil,
  583. deref_unit,
  584. deref_symid,
  585. deref_defid
  586. );
  587. var
  588. b : tdereftype;
  589. first : boolean;
  590. idx : longint;
  591. i,n : byte;
  592. pdata : pbyte;
  593. begin
  594. if not assigned(derefdata) then
  595. exit;
  596. first:=true;
  597. idx:=ppufile.getlongint;
  598. if (idx>derefdatalen) then
  599. begin
  600. writeln('!! Error: Deref idx ',idx,' > ',derefdatalen);
  601. exit;
  602. end;
  603. write(derefspace,'(',idx,') ');
  604. pdata:=@derefdata[idx];
  605. i:=0;
  606. n:=pdata[i];
  607. inc(i);
  608. if n<1 then
  609. begin
  610. writeln('!! Error: Deref len < 1');
  611. exit;
  612. end;
  613. while (i<=n) do
  614. begin
  615. if not first then
  616. write(', ')
  617. else
  618. first:=false;
  619. b:=tdereftype(pdata[i]);
  620. inc(i);
  621. case b of
  622. deref_nil :
  623. write('Nil');
  624. deref_symid :
  625. begin
  626. idx:=pdata[i] shl 24 or pdata[i+1] shl 16 or pdata[i+2] shl 8 or pdata[i+3];
  627. inc(i,4);
  628. write('SymId ',idx);
  629. end;
  630. deref_defid :
  631. begin
  632. idx:=pdata[i] shl 24 or pdata[i+1] shl 16 or pdata[i+2] shl 8 or pdata[i+3];
  633. inc(i,4);
  634. write('DefId ',idx);
  635. end;
  636. deref_unit :
  637. begin
  638. idx:=pdata[i] shl 8 or pdata[i+1];
  639. inc(i,2);
  640. write('Unit ',idx);
  641. end;
  642. else
  643. begin
  644. writeln('!! unsupported dereftyp: ',ord(b));
  645. break;
  646. end;
  647. end;
  648. end;
  649. writeln;
  650. end;
  651. procedure readpropaccesslist(const s:string);
  652. type
  653. tsltype = (sl_none,
  654. sl_load,
  655. sl_call,
  656. sl_subscript,
  657. sl_vec,
  658. sl_typeconv,
  659. sl_absolutetype
  660. );
  661. const
  662. slstr : array[tsltype] of string[12] = ('',
  663. 'load',
  664. 'call',
  665. 'subscript',
  666. 'vec',
  667. 'typeconv',
  668. 'absolutetype'
  669. );
  670. var
  671. sl : tsltype;
  672. begin
  673. readderef('');
  674. repeat
  675. sl:=tsltype(ppufile.getbyte);
  676. if sl=sl_none then
  677. break;
  678. write(s,'(',slstr[sl],') ');
  679. case sl of
  680. sl_call,
  681. sl_load,
  682. sl_subscript :
  683. readderef('');
  684. sl_absolutetype,
  685. sl_typeconv :
  686. readderef('');
  687. sl_vec :
  688. begin
  689. writeln(ppufile.getlongint);
  690. readderef('');
  691. end;
  692. end;
  693. until false;
  694. end;
  695. procedure readsymoptions(space : string);
  696. type
  697. { symbol options }
  698. tsymoption=(sp_none,
  699. sp_static,
  700. sp_hint_deprecated,
  701. sp_hint_platform,
  702. sp_hint_library,
  703. sp_hint_unimplemented,
  704. sp_hint_experimental,
  705. sp_has_overloaded,
  706. sp_internal, { internal symbol, not reported as unused }
  707. sp_implicitrename,
  708. sp_generic_para,
  709. sp_has_deprecated_msg
  710. );
  711. tsymoptions=set of tsymoption;
  712. tsymopt=record
  713. mask : tsymoption;
  714. str : string[30];
  715. end;
  716. const
  717. symopts=11;
  718. symopt : array[1..symopts] of tsymopt=(
  719. (mask:sp_static; str:'Static'),
  720. (mask:sp_hint_deprecated; str:'Hint Deprecated'),
  721. (mask:sp_hint_platform; str:'Hint Platform'),
  722. (mask:sp_hint_library; str:'Hint Library'),
  723. (mask:sp_hint_unimplemented; str:'Hint Unimplemented'),
  724. (mask:sp_hint_experimental; str:'Hint Experimental'),
  725. (mask:sp_has_overloaded; str:'Has overloaded'),
  726. (mask:sp_internal; str:'Internal'),
  727. (mask:sp_implicitrename; str:'Implicit Rename'),
  728. (mask:sp_generic_para; str:'Generic Parameter'),
  729. (mask:sp_has_deprecated_msg; str:'Has Deprecated Message')
  730. );
  731. var
  732. symoptions : tsymoptions;
  733. i : longint;
  734. first : boolean;
  735. begin
  736. ppufile.getsmallset(symoptions);
  737. if symoptions<>[] then
  738. begin
  739. first:=true;
  740. for i:=1to symopts do
  741. if (symopt[i].mask in symoptions) then
  742. begin
  743. if first then
  744. first:=false
  745. else
  746. write(', ');
  747. write(symopt[i].str);
  748. end;
  749. end;
  750. writeln;
  751. if sp_has_deprecated_msg in symoptions then
  752. writeln(space,'Deprecated : ', ppufile.getstring);
  753. end;
  754. procedure readcommonsym(const s:string);
  755. begin
  756. writeln(space,'** Symbol Id ',ppufile.getlongint,' **');
  757. writeln(space,s,ppufile.getstring);
  758. write (space,' File Pos : ');
  759. readposinfo;
  760. writeln(space,' Visibility : ',Visibility2Str(ppufile.getbyte));
  761. write (space,' SymOptions : ');
  762. readsymoptions(space+' ');
  763. end;
  764. type
  765. { flags for a definition }
  766. tdefoption=(df_none,
  767. { type is unique, i.e. declared with type = type <tdef>; }
  768. df_unique,
  769. { type is a generic }
  770. df_generic,
  771. { type is a specialization of a generic type }
  772. df_specialization,
  773. { def has been copied from another def so symtable is not owned }
  774. df_copied_def
  775. );
  776. tdefoptions=set of tdefoption;
  777. var
  778. { needed during tobjectdef parsing... }
  779. current_defoptions : tdefoptions;
  780. procedure readcommondef(const s:string);
  781. type
  782. tdefstate=(ds_none,
  783. ds_vmt_written,
  784. ds_rtti_table_used,
  785. ds_init_table_used,
  786. ds_rtti_table_written,
  787. ds_init_table_written,
  788. ds_dwarf_dbg_info_used,
  789. ds_dwarf_dbg_info_written
  790. );
  791. tdefstates=set of tdefstate;
  792. tdefopt=record
  793. mask : tdefoption;
  794. str : string[30];
  795. end;
  796. tdefstateinfo=record
  797. mask : tdefstate;
  798. str : string[30];
  799. end;
  800. const
  801. defopt : array[1..ord(high(tdefoption))] of tdefopt=(
  802. (mask:df_unique; str:'Unique Type'),
  803. (mask:df_generic; str:'Generic'),
  804. (mask:df_specialization; str:'Specialization'),
  805. (mask:df_copied_def; str:'Copied Typedef')
  806. );
  807. defstate : array[1..ord(high(tdefstate))] of tdefstateinfo=(
  808. (mask:ds_vmt_written; str:'VMT Written'),
  809. (mask:ds_rtti_table_used; str:'RTTITable Used'),
  810. (mask:ds_init_table_used; str:'InitTable Used'),
  811. (mask:ds_rtti_table_written; str:'RTTITable Written'),
  812. (mask:ds_init_table_written; str:'InitTable Written'),
  813. (mask:ds_dwarf_dbg_info_used; str:'Dwarf DbgInfo Used'),
  814. (mask:ds_dwarf_dbg_info_written;str:'Dwarf DbgInfo Written')
  815. );
  816. var
  817. defoptions : tdefoptions;
  818. defstates : tdefstates;
  819. i : longint;
  820. first : boolean;
  821. tokenbufsize : longint;
  822. tokenbuf : pbyte;
  823. len : sizeint;
  824. wstring : widestring;
  825. astring : ansistring;
  826. begin
  827. writeln(space,'** Definition Id ',ppufile.getlongint,' **');
  828. writeln(space,s);
  829. write (space,' Type symbol : ');
  830. readderef('');
  831. write (space,' DefOptions : ');
  832. ppufile.getsmallset(defoptions);
  833. if defoptions<>[] then
  834. begin
  835. first:=true;
  836. for i:=1to high(defopt) do
  837. if (defopt[i].mask in defoptions) then
  838. begin
  839. if first then
  840. first:=false
  841. else
  842. write(', ');
  843. write(defopt[i].str);
  844. end;
  845. end;
  846. writeln;
  847. write (space,' DefStates : ');
  848. ppufile.getsmallset(defstates);
  849. if defstates<>[] then
  850. begin
  851. first:=true;
  852. for i:=1to high(defstate) do
  853. if (defstate[i].mask in defstates) then
  854. begin
  855. if first then
  856. first:=false
  857. else
  858. write(', ');
  859. write(defstate[i].str);
  860. end;
  861. end;
  862. writeln;
  863. if df_generic in defoptions then
  864. begin
  865. tokenbufsize:=ppufile.getlongint;
  866. writeln(space,' Tokenbuffer size : ',tokenbufsize);
  867. tokenbuf:=allocmem(tokenbufsize);
  868. ppufile.getdata(tokenbuf^,tokenbufsize);
  869. i:=0;
  870. write(space,' Tokens: ');
  871. while i<tokenbufsize do
  872. begin
  873. if ttoken(tokenbuf[i])<>_GENERICSPECIALTOKEN then
  874. write(arraytokeninfo[ttoken(tokenbuf[i])].str);
  875. case ttoken(tokenbuf[i]) of
  876. _CWCHAR,
  877. _CWSTRING :
  878. begin
  879. inc(i);
  880. len:=psizeint(@tokenbuf[i])^;
  881. inc(i,sizeof(sizeint));
  882. setlength(wstring,len);
  883. move(tokenbuf[i],wstring[1],len*2);
  884. write(' ',wstring);
  885. inc(i,len*2);
  886. end;
  887. _CSTRING:
  888. begin
  889. inc(i);
  890. len:=psizeint(@tokenbuf[i])^;
  891. inc(i,sizeof(sizeint));
  892. setlength(astring,len);
  893. move(tokenbuf[i],astring[1],len);
  894. write(' ',astring);
  895. inc(i,len);
  896. end;
  897. _CCHAR,
  898. _INTCONST,
  899. _REALNUMBER :
  900. begin
  901. inc(i);
  902. write(' ',pshortstring(@tokenbuf[i])^);
  903. inc(i,tokenbuf[i]+1);
  904. end;
  905. _ID :
  906. begin
  907. inc(i);
  908. inc(i);
  909. write(' ',pshortstring(@tokenbuf[i])^);
  910. inc(i,tokenbuf[i]+1);
  911. {
  912. replaytokenbuf.read(orgpattern[0],1);
  913. replaytokenbuf.read(orgpattern[1],length(orgpattern));
  914. pattern:=upper(orgpattern);
  915. }
  916. end;
  917. _GENERICSPECIALTOKEN:
  918. begin
  919. inc(i);
  920. case tspecialgenerictoken(tokenbuf[i]) of
  921. ST_LOADSETTINGS:
  922. begin
  923. inc(i);
  924. write('Settings');
  925. inc(i,sizeof(tsettings));
  926. end;
  927. ST_LINE:
  928. begin
  929. inc(i);
  930. write('Line: ',pdword(@tokenbuf[i])^);
  931. inc(i,4);
  932. end;
  933. ST_COLUMN:
  934. begin
  935. inc(i);
  936. write('Col: ',pword(@tokenbuf[i])^);
  937. inc(i,2);
  938. end;
  939. ST_FILEINDEX:
  940. begin
  941. inc(i);
  942. write('File: ',pword(@tokenbuf[i])^);
  943. inc(i,2);
  944. end;
  945. end;
  946. {
  947. replaytokenbuf.read(specialtoken,1);
  948. case specialtoken of
  949. ST_LOADSETTINGS:
  950. begin
  951. replaytokenbuf.read(current_settings,sizeof(current_settings));
  952. end
  953. else
  954. internalerror(2006103010);
  955. end;
  956. continue;
  957. }
  958. end;
  959. else
  960. inc(i);
  961. end;
  962. if i<tokenbufsize then
  963. write(',');
  964. end;
  965. writeln;
  966. freemem(tokenbuf);
  967. end;
  968. if df_specialization in defoptions then
  969. begin
  970. write (space,' Orig. GenericDef : ');
  971. readderef('');
  972. end;
  973. current_defoptions:=defoptions;
  974. end;
  975. { Read abstract procdef and return if inline procdef }
  976. type
  977. tproccalloption=(pocall_none,
  978. { procedure uses C styled calling }
  979. pocall_cdecl,
  980. { C++ calling conventions }
  981. pocall_cppdecl,
  982. { Far16 for OS/2 }
  983. pocall_far16,
  984. { Old style FPC default calling }
  985. pocall_oldfpccall,
  986. { Procedure has compiler magic}
  987. pocall_internproc,
  988. { procedure is a system call, applies e.g. to MorphOS and PalmOS }
  989. pocall_syscall,
  990. { pascal standard left to right }
  991. pocall_pascal,
  992. { procedure uses register (fastcall) calling }
  993. pocall_register,
  994. { safe call calling conventions }
  995. pocall_safecall,
  996. { procedure uses stdcall call }
  997. pocall_stdcall,
  998. { Special calling convention for cpus without a floating point
  999. unit. Floating point numbers are passed in integer registers
  1000. instead of floating point registers. Depending on the other
  1001. available calling conventions available for the cpu
  1002. this replaces either pocall_fastcall or pocall_stdcall.
  1003. }
  1004. pocall_softfloat,
  1005. { Metrowerks Pascal. Special case on Mac OS (X): passes all }
  1006. { constant records by reference. }
  1007. pocall_mwpascal
  1008. );
  1009. tproccalloptions = set of tproccalloption;
  1010. tproctypeoption=(potype_none,
  1011. potype_proginit, { Program initialization }
  1012. potype_unitinit, { unit initialization }
  1013. potype_unitfinalize, { unit finalization }
  1014. potype_constructor, { Procedure is a constructor }
  1015. potype_destructor, { Procedure is a destructor }
  1016. potype_operator, { Procedure defines an operator }
  1017. potype_procedure,
  1018. potype_function
  1019. );
  1020. tproctypeoptions=set of tproctypeoption;
  1021. tprocoption=(po_none,
  1022. po_classmethod, { class method }
  1023. po_virtualmethod, { Procedure is a virtual method }
  1024. po_abstractmethod, { Procedure is an abstract method }
  1025. po_finalmethod, { Procedure is a final method }
  1026. po_staticmethod, { static method }
  1027. po_overridingmethod, { method with override directive }
  1028. po_methodpointer, { method pointer, only in procvardef, also used for 'with object do' }
  1029. po_interrupt, { Procedure is an interrupt handler }
  1030. po_iocheck, { IO checking should be done after a call to the procedure }
  1031. po_assembler, { Procedure is written in assembler }
  1032. po_msgstr, { method for string message handling }
  1033. po_msgint, { method for int message handling }
  1034. po_exports, { Procedure has export directive (needed for OS/2) }
  1035. po_external, { Procedure is external (in other object or lib)}
  1036. po_overload, { procedure is declared with overload directive }
  1037. po_varargs, { printf like arguments }
  1038. po_internconst, { procedure has constant evaluator intern }
  1039. { flag that only the address of a method is returned and not a full methodpointer }
  1040. po_addressonly,
  1041. { procedure is exported }
  1042. po_public,
  1043. { calling convention is specified explicitly }
  1044. po_hascallingconvention,
  1045. { reintroduce flag }
  1046. po_reintroduce,
  1047. { location of parameters is given explicitly as it is necessary for some syscall
  1048. conventions like that one of MorphOS }
  1049. po_explicitparaloc,
  1050. { no stackframe will be generated, used by lowlevel assembler like get_frame }
  1051. po_nostackframe,
  1052. po_has_mangledname,
  1053. po_has_public_name,
  1054. po_forward,
  1055. po_global,
  1056. po_has_inlininginfo,
  1057. { The different kind of syscalls on MorphOS }
  1058. po_syscall_legacy,
  1059. po_syscall_sysv,
  1060. po_syscall_basesysv,
  1061. po_syscall_sysvbase,
  1062. po_syscall_r12base,
  1063. po_local,
  1064. { Procedure can be inlined }
  1065. po_inline,
  1066. { Procedure is used for internal compiler calls }
  1067. po_compilerproc,
  1068. { importing }
  1069. po_has_importdll,
  1070. po_has_importname,
  1071. po_kylixlocal,
  1072. po_dispid,
  1073. { weakly linked (i.e., may or may not exist at run time) }
  1074. po_weakexternal,
  1075. { Objective-C method }
  1076. po_objc,
  1077. { enumerator support }
  1078. po_enumerator_movenext,
  1079. { optional Objective-C protocol method }
  1080. po_optional
  1081. );
  1082. tprocoptions=set of tprocoption;
  1083. procedure read_abstract_proc_def(var proccalloption:tproccalloption;var procoptions:tprocoptions);
  1084. type
  1085. tproccallopt=record
  1086. mask : tproccalloption;
  1087. str : string[30];
  1088. end;
  1089. tproctypeopt=record
  1090. mask : tproctypeoption;
  1091. str : string[30];
  1092. end;
  1093. tprocopt=record
  1094. mask : tprocoption;
  1095. str : string[30];
  1096. end;
  1097. const
  1098. proccalloptionStr : array[tproccalloption] of string[14]=('',
  1099. 'CDecl',
  1100. 'CPPDecl',
  1101. 'Far16',
  1102. 'OldFPCCall',
  1103. 'InternProc',
  1104. 'SysCall',
  1105. 'Pascal',
  1106. 'Register',
  1107. 'SafeCall',
  1108. 'StdCall',
  1109. 'SoftFloat',
  1110. 'MWPascal'
  1111. );
  1112. proctypeopt : array[1..ord(high(tproctypeoption))] of tproctypeopt=(
  1113. (mask:potype_proginit; str:'ProgInit'),
  1114. (mask:potype_unitinit; str:'UnitInit'),
  1115. (mask:potype_unitfinalize;str:'UnitFinalize'),
  1116. (mask:potype_constructor; str:'Constructor'),
  1117. (mask:potype_destructor; str:'Destructor'),
  1118. (mask:potype_operator; str:'Operator'),
  1119. (mask:potype_procedure; str:'Procedure'),
  1120. (mask:potype_function; str:'Function')
  1121. );
  1122. procopt : array[1..ord(high(tprocoption))] of tprocopt=(
  1123. (mask:po_classmethod; str:'ClassMethod'),
  1124. (mask:po_virtualmethod; str:'VirtualMethod'),
  1125. (mask:po_abstractmethod; str:'AbstractMethod'),
  1126. (mask:po_finalmethod; str:'FinalMethod'),
  1127. (mask:po_staticmethod; str:'StaticMethod'),
  1128. (mask:po_overridingmethod;str:'OverridingMethod'),
  1129. (mask:po_methodpointer; str:'MethodPointer'),
  1130. (mask:po_interrupt; str:'Interrupt'),
  1131. (mask:po_iocheck; str:'IOCheck'),
  1132. (mask:po_assembler; str:'Assembler'),
  1133. (mask:po_msgstr; str:'MsgStr'),
  1134. (mask:po_msgint; str:'MsgInt'),
  1135. (mask:po_exports; str:'Exports'),
  1136. (mask:po_external; str:'External'),
  1137. (mask:po_overload; str:'Overload'),
  1138. (mask:po_varargs; str:'VarArgs'),
  1139. (mask:po_internconst; str:'InternConst'),
  1140. (mask:po_addressonly; str:'AddressOnly'),
  1141. (mask:po_public; str:'Public'),
  1142. (mask:po_hascallingconvention;str:'HasCallingConvention'),
  1143. (mask:po_reintroduce; str:'ReIntroduce'),
  1144. (mask:po_explicitparaloc; str:'ExplicitParaloc'),
  1145. (mask:po_nostackframe; str:'NoStackFrame'),
  1146. (mask:po_has_mangledname; str:'HasMangledName'),
  1147. (mask:po_has_public_name; str:'HasPublicName'),
  1148. (mask:po_forward; str:'Forward'),
  1149. (mask:po_global; str:'Global'),
  1150. (mask:po_has_inlininginfo;str:'HasInliningInfo'),
  1151. (mask:po_syscall_legacy; str:'SyscallLegacy'),
  1152. (mask:po_syscall_sysv; str:'SyscallSysV'),
  1153. (mask:po_syscall_basesysv;str:'SyscallBaseSysV'),
  1154. (mask:po_syscall_sysvbase;str:'SyscallSysVBase'),
  1155. (mask:po_syscall_r12base; str:'SyscallR12Base'),
  1156. (mask:po_local; str:'Local'),
  1157. (mask:po_inline; str:'Inline'),
  1158. (mask:po_compilerproc; str:'CompilerProc'),
  1159. (mask:po_has_importdll; str:'HasImportDLL'),
  1160. (mask:po_has_importname; str:'HasImportName'),
  1161. (mask:po_kylixlocal; str:'KylixLocal'),
  1162. (mask:po_dispid; str:'DispId'),
  1163. (mask:po_weakexternal; str:'WeakExternal'),
  1164. (mask:po_objc; str:'ObjC'),
  1165. (mask:po_enumerator_movenext; str:'EnumeratorMoveNext'),
  1166. (mask:po_optional; str: 'Optional')
  1167. );
  1168. var
  1169. proctypeoption : tproctypeoption;
  1170. i : longint;
  1171. first : boolean;
  1172. tempbuf : array[0..255] of byte;
  1173. begin
  1174. write(space,' Return type : ');
  1175. readderef('');
  1176. writeln(space,' Fpu used : ',ppufile.getbyte);
  1177. proctypeoption:=tproctypeoption(ppufile.getbyte);
  1178. write(space,' TypeOption : ');
  1179. first:=true;
  1180. for i:=1 to high(proctypeopt) do
  1181. if (proctypeopt[i].mask=proctypeoption) then
  1182. begin
  1183. if first then
  1184. first:=false
  1185. else
  1186. write(', ');
  1187. write(proctypeopt[i].str);
  1188. end;
  1189. writeln;
  1190. proccalloption:=tproccalloption(ppufile.getbyte);
  1191. writeln(space,' CallOption : ',proccalloptionStr[proccalloption]);
  1192. ppufile.getnormalset(procoptions);
  1193. if procoptions<>[] then
  1194. begin
  1195. write(space,' Options : ');
  1196. first:=true;
  1197. for i:=1 to high(procopt) do
  1198. if (procopt[i].mask in procoptions) then
  1199. begin
  1200. if first then
  1201. first:=false
  1202. else
  1203. write(', ');
  1204. write(procopt[i].str);
  1205. end;
  1206. writeln;
  1207. end;
  1208. if (po_explicitparaloc in procoptions) then
  1209. begin
  1210. i:=ppufile.getbyte;
  1211. ppufile.getdata(tempbuf,i);
  1212. end;
  1213. end;
  1214. type
  1215. tvaroption=(vo_none,
  1216. vo_is_external,
  1217. vo_is_dll_var,
  1218. vo_is_thread_var,
  1219. vo_has_local_copy,
  1220. vo_is_const, { variable is declared as const (parameter) and can't be written to }
  1221. vo_is_public,
  1222. vo_is_high_para,
  1223. vo_is_funcret,
  1224. vo_is_self,
  1225. vo_is_vmt,
  1226. vo_is_result, { special result variable }
  1227. vo_is_parentfp,
  1228. vo_is_loop_counter, { used to detect assignments to loop counter }
  1229. vo_is_hidden_para,
  1230. vo_has_explicit_paraloc,
  1231. vo_is_syscall_lib,
  1232. vo_has_mangledname,
  1233. vo_is_typed_const,
  1234. vo_is_range_check,
  1235. vo_is_overflow_check,
  1236. vo_is_typinfo_para,
  1237. vo_is_weak_external,
  1238. vo_is_msgsel,
  1239. vo_is_first_field
  1240. );
  1241. tvaroptions=set of tvaroption;
  1242. { register variable }
  1243. tvarregable=(vr_none,
  1244. vr_intreg,
  1245. vr_fpureg,
  1246. vr_mmreg,
  1247. { does not mean "needs address register", but "if it's a parameter which is }
  1248. { passed by reference, then its address can be put in a register }
  1249. vr_addr
  1250. );
  1251. procedure readabstractvarsym(const s:string;var varoptions:tvaroptions);
  1252. type
  1253. tvaropt=record
  1254. mask : tvaroption;
  1255. str : string[30];
  1256. end;
  1257. const
  1258. varopt : array[1..ord(high(tvaroption))] of tvaropt=(
  1259. (mask:vo_is_external; str:'External'),
  1260. (mask:vo_is_dll_var; str:'DLLVar'),
  1261. (mask:vo_is_thread_var; str:'ThreadVar'),
  1262. (mask:vo_has_local_copy; str:'HasLocalCopy'),
  1263. (mask:vo_is_const; str:'Constant'),
  1264. (mask:vo_is_public; str:'Public'),
  1265. (mask:vo_is_high_para; str:'HighValue'),
  1266. (mask:vo_is_funcret; str:'Funcret'),
  1267. (mask:vo_is_self; str:'Self'),
  1268. (mask:vo_is_vmt; str:'VMT'),
  1269. (mask:vo_is_result; str:'Result'),
  1270. (mask:vo_is_parentfp; str:'ParentFP'),
  1271. (mask:vo_is_loop_counter; str:'LoopCounter'),
  1272. (mask:vo_is_hidden_para; str:'Hidden'),
  1273. (mask:vo_has_explicit_paraloc;str:'ExplicitParaloc'),
  1274. (mask:vo_is_syscall_lib; str:'SysCallLib'),
  1275. (mask:vo_has_mangledname; str:'HasMangledName'),
  1276. (mask:vo_is_typed_const; str:'TypedConst'),
  1277. (mask:vo_is_range_check; str:'RangeCheckSwitch'),
  1278. (mask:vo_is_overflow_check; str:'OverflowCheckSwitch'),
  1279. (mask:vo_is_typinfo_para; str:'TypeInfo'),
  1280. (mask:vo_is_msgsel;str:'MsgSel'),
  1281. (mask:vo_is_weak_external;str:'WeakExternal'),
  1282. (mask:vo_is_first_field;str:'IsFirstField')
  1283. );
  1284. var
  1285. i : longint;
  1286. first : boolean;
  1287. begin
  1288. readcommonsym(s);
  1289. writeln(space,' Spez : ',Varspez2Str(ppufile.getbyte));
  1290. writeln(space,' Regable : ',Varregable2Str(ppufile.getbyte));
  1291. writeln(space,' Addr Taken : ',(ppufile.getbyte<>0));
  1292. write (space,' Var Type : ');
  1293. readderef('');
  1294. ppufile.getsmallset(varoptions);
  1295. if varoptions<>[] then
  1296. begin
  1297. write(space,' Options : ');
  1298. first:=true;
  1299. for i:=1 to high(varopt) do
  1300. if (varopt[i].mask in varoptions) then
  1301. begin
  1302. if first then
  1303. first:=false
  1304. else
  1305. write(', ');
  1306. write(varopt[i].str);
  1307. end;
  1308. writeln;
  1309. end;
  1310. end;
  1311. procedure readobjectdefoptions;
  1312. type
  1313. tobjectoption=(oo_none,
  1314. oo_is_forward, { the class is only a forward declared yet }
  1315. oo_is_abstract, { the class is abstract - only descendants can be used }
  1316. oo_is_sealed, { the class is sealed - can't have descendants }
  1317. oo_has_virtual, { the object/class has virtual methods }
  1318. oo_has_private,
  1319. oo_has_protected,
  1320. oo_has_strictprivate,
  1321. oo_has_strictprotected,
  1322. oo_has_constructor, { the object/class has a constructor }
  1323. oo_has_destructor, { the object/class has a destructor }
  1324. oo_has_vmt, { the object/class has a vmt }
  1325. oo_has_msgstr,
  1326. oo_has_msgint,
  1327. oo_can_have_published,{ the class has rtti, i.e. you can publish properties }
  1328. oo_has_default_property,
  1329. oo_has_valid_guid,
  1330. oo_has_enumerator_movenext,
  1331. oo_has_enumerator_current,
  1332. oo_is_external, { the class is externally implemented (objcclass, cppclass) }
  1333. oo_is_anonymous, { the class is only formally defined in this module (objcclass x = class; external;) }
  1334. oo_is_classhelper { objcclasses that represent categories, and Delpi-style class helpers, are marked like this }
  1335. );
  1336. tobjectoptions=set of tobjectoption;
  1337. tsymopt=record
  1338. mask : tobjectoption;
  1339. str : string[30];
  1340. end;
  1341. const
  1342. symopt : array[1..ord(high(tobjectoption))] of tsymopt=(
  1343. (mask:oo_is_forward; str:'IsForward'),
  1344. (mask:oo_is_abstract; str:'IsAbstract'),
  1345. (mask:oo_is_sealed; str:'IsSealed'),
  1346. (mask:oo_has_virtual; str:'HasVirtual'),
  1347. (mask:oo_has_private; str:'HasPrivate'),
  1348. (mask:oo_has_protected; str:'HasProtected'),
  1349. (mask:oo_has_strictprivate; str:'HasStrictPrivate'),
  1350. (mask:oo_has_strictprotected;str:'HasStrictProtected'),
  1351. (mask:oo_has_constructor; str:'HasConstructor'),
  1352. (mask:oo_has_destructor; str:'HasDestructor'),
  1353. (mask:oo_has_vmt; str:'HasVMT'),
  1354. (mask:oo_has_msgstr; str:'HasMsgStr'),
  1355. (mask:oo_has_msgint; str:'HasMsgInt'),
  1356. (mask:oo_can_have_published; str:'CanHavePublished'),
  1357. (mask:oo_has_default_property;str:'HasDefaultProperty'),
  1358. (mask:oo_has_valid_guid; str:'HasValidGUID'),
  1359. (mask:oo_has_enumerator_movenext; str:'HasEnumeratorMoveNext'),
  1360. (mask:oo_has_enumerator_current; str:'HasEnumeratorCurrent'),
  1361. (mask:oo_is_external; str:'External'),
  1362. (mask:oo_is_anonymous; str:'Anonymous'),
  1363. (mask:oo_is_classhelper; str:'Class Helper/Category'));
  1364. var
  1365. symoptions : tobjectoptions;
  1366. i : longint;
  1367. first : boolean;
  1368. begin
  1369. ppufile.getsmallset(symoptions);
  1370. if symoptions<>[] then
  1371. begin
  1372. first:=true;
  1373. for i:=1 to high(symopt) do
  1374. if (symopt[i].mask in symoptions) then
  1375. begin
  1376. if first then
  1377. first:=false
  1378. else
  1379. write(', ');
  1380. write(symopt[i].str);
  1381. end;
  1382. end;
  1383. writeln;
  1384. end;
  1385. procedure readarraydefoptions;
  1386. type
  1387. tarraydefoption=(ado_none,
  1388. ado_IsConvertedPointer,
  1389. ado_IsDynamicArray,
  1390. ado_IsVariant,
  1391. ado_IsConstructor,
  1392. ado_IsArrayOfConst,
  1393. ado_IsConstString,
  1394. ado_IsBitPacked
  1395. );
  1396. tarraydefoptions=set of tarraydefoption;
  1397. tsymopt=record
  1398. mask : tarraydefoption;
  1399. str : string[30];
  1400. end;
  1401. const
  1402. symopt : array[1..ord(high(tarraydefoption))] of tsymopt=(
  1403. (mask:ado_IsConvertedPointer;str:'ConvertedPointer'),
  1404. (mask:ado_IsDynamicArray; str:'IsDynamicArray'),
  1405. (mask:ado_IsVariant; str:'IsVariant'),
  1406. (mask:ado_IsConstructor; str:'IsConstructor'),
  1407. (mask:ado_IsArrayOfConst; str:'ArrayOfConst'),
  1408. (mask:ado_IsConstString; str:'ConstString'),
  1409. (mask:ado_IsBitPacked; str:'BitPacked')
  1410. );
  1411. var
  1412. symoptions : tarraydefoptions;
  1413. i : longint;
  1414. first : boolean;
  1415. begin
  1416. ppufile.getsmallset(symoptions);
  1417. if symoptions<>[] then
  1418. begin
  1419. first:=true;
  1420. for i:=1 to high(symopt) do
  1421. if (symopt[i].mask in symoptions) then
  1422. begin
  1423. if first then
  1424. first:=false
  1425. else
  1426. write(', ');
  1427. write(symopt[i].str);
  1428. end;
  1429. end;
  1430. writeln;
  1431. end;
  1432. procedure readnodetree;
  1433. var
  1434. l : longint;
  1435. p : pointer;
  1436. begin
  1437. with ppufile do
  1438. begin
  1439. if space<>'' then
  1440. Writeln(space,'------ nodetree ------');
  1441. if readentry=ibnodetree then
  1442. begin
  1443. l:=entrysize;
  1444. Writeln(space,'Tree size : ',l);
  1445. { Read data to prevent error that entry is not completly read }
  1446. getmem(p,l);
  1447. getdata(p^,l);
  1448. freemem(p);
  1449. end
  1450. else
  1451. begin
  1452. Writeln('!! ibnodetree not found');
  1453. end;
  1454. end;
  1455. end;
  1456. procedure ReadCreatedObjTypes;
  1457. var
  1458. i,j,
  1459. len,
  1460. bssize: longint;
  1461. bs: pbyte;
  1462. begin
  1463. if ppufile.readentry<>ibcreatedobjtypes then
  1464. begin
  1465. writeln('!! ibcreatedobjtypes entry not found');
  1466. ppufile.skipdata(ppufile.entrysize);
  1467. exit
  1468. end;
  1469. writeln;
  1470. writeln(space,'WPO info');
  1471. writeln(space,'--------');
  1472. len:=ppufile.getlongint;
  1473. writeln(space,'** Instantiated Object/Class types: ',len,' **');
  1474. space:=space+' ';
  1475. for i:=0 to len-1 do
  1476. readderef(space);
  1477. setlength(space,length(space)-2);
  1478. len:=ppufile.getlongint;
  1479. writeln(space,'** Instantiated ClassRef types: ',len,' **');
  1480. space:=space+' ';
  1481. for i:=0 to len-1 do
  1482. readderef(space);
  1483. setlength(space,length(space)-2);
  1484. len:=ppufile.getlongint;
  1485. writeln(space,'** Possibly instantiated ClassRef types : ',len,' **');
  1486. space:=space+' ';
  1487. for i:=0 to len-1 do
  1488. readderef(space);
  1489. setlength(space,length(space)-2);
  1490. len:=ppufile.getlongint;
  1491. writeln(space,'** Class types with called virtual methods info : ',len,' **');
  1492. space:=space+' ';
  1493. for i:=0 to len-1 do
  1494. begin
  1495. write(space,'Class def : ');
  1496. readderef('');
  1497. write(space+' ','Called vmtentries : ');
  1498. bssize:=ppufile.getlongint;
  1499. getmem(bs,bssize);
  1500. ppufile.readdata(bs^,bssize);
  1501. for j:=0 to bssize*8-1 do
  1502. if (((bs+j shr 3)^ shr (j and 7)) and 1) <> 0 then
  1503. write(j,', ');
  1504. writeln;
  1505. freemem(bs);
  1506. end;
  1507. setlength(space,length(space)-2);
  1508. end;
  1509. {****************************************************************************
  1510. Read Symbols Part
  1511. ****************************************************************************}
  1512. procedure readsymbols(const s:string);
  1513. type
  1514. pguid = ^tguid;
  1515. tguid = packed record
  1516. D1: LongWord;
  1517. D2: Word;
  1518. D3: Word;
  1519. D4: array[0..7] of Byte;
  1520. end;
  1521. absolutetyp = (tovar,toasm,toaddr);
  1522. tconsttyp = (constnone,
  1523. constord,conststring,constreal,
  1524. constset,constpointer,constnil,
  1525. constresourcestring,constwstring,constguid
  1526. );
  1527. var
  1528. b : byte;
  1529. pc : pchar;
  1530. i,j,len : longint;
  1531. guid : tguid;
  1532. tempbuf : array[0..127] of char;
  1533. varoptions : tvaroptions;
  1534. begin
  1535. with ppufile do
  1536. begin
  1537. if space<>'' then
  1538. Writeln(space,'------ ',s,' ------');
  1539. if readentry=ibstartsyms then
  1540. begin
  1541. Writeln(space,'Symtable datasize : ',getlongint);
  1542. Writeln(space,'Symtable alignment: ',getlongint);
  1543. end
  1544. else
  1545. Writeln('!! ibstartsym not found');
  1546. repeat
  1547. b:=readentry;
  1548. case b of
  1549. ibunitsym :
  1550. readcommonsym('Unit symbol ');
  1551. iblabelsym :
  1552. readcommonsym('Label symbol ');
  1553. ibtypesym :
  1554. begin
  1555. readcommonsym('Type symbol ');
  1556. write(space,' Result Type : ');
  1557. readderef('');
  1558. end;
  1559. ibprocsym :
  1560. begin
  1561. readcommonsym('Procedure symbol ');
  1562. len:=ppufile.getword;
  1563. for i:=1 to len do
  1564. begin
  1565. write(space,' Definition : ');
  1566. readderef('');
  1567. end;
  1568. end;
  1569. ibconstsym :
  1570. begin
  1571. readcommonsym('Constant symbol ');
  1572. b:=getbyte;
  1573. case tconsttyp(b) of
  1574. constord :
  1575. begin
  1576. write (space,' OrdinalType : ');
  1577. readderef('');
  1578. writeln(space,' Value : ',constexp.tostr(getexprint));
  1579. end;
  1580. constpointer :
  1581. begin
  1582. write (space,' PointerType : ');
  1583. readderef('');
  1584. writeln(space,' Value : ',getlongint)
  1585. end;
  1586. conststring,
  1587. constresourcestring :
  1588. begin
  1589. len:=getlongint;
  1590. getmem(pc,len+1);
  1591. getdata(pc^,len);
  1592. (pc+len)^:= #0;
  1593. writeln(space,' Length : ',len);
  1594. writeln(space,' Value : "',pc,'"');
  1595. freemem(pc,len+1);
  1596. end;
  1597. constreal :
  1598. writeln(space,' Value : ',getreal);
  1599. constset :
  1600. begin
  1601. write (space,' Set Type : ');
  1602. readderef('');
  1603. for i:=1to 4 do
  1604. begin
  1605. write (space,' Value : ');
  1606. for j:=1to 8 do
  1607. begin
  1608. if j>1 then
  1609. write(',');
  1610. write(hexstr(getbyte,2));
  1611. end;
  1612. writeln;
  1613. end;
  1614. end;
  1615. constwstring:
  1616. begin
  1617. end;
  1618. constguid:
  1619. begin
  1620. getdata(guid,sizeof(guid));
  1621. write (space,' IID String: {',hexstr(guid.d1,8),'-',hexstr(guid.d2,4),'-',hexstr(guid.d3,4),'-');
  1622. for i:=0 to 7 do
  1623. begin
  1624. write(hexstr(guid.d4[i],2));
  1625. if i=1 then write('-');
  1626. end;
  1627. writeln('}');
  1628. end
  1629. else
  1630. Writeln ('!! Invalid unit format : Invalid const type encountered: ',b);
  1631. end;
  1632. end;
  1633. ibabsolutevarsym :
  1634. begin
  1635. readabstractvarsym('Absolute variable symbol ',varoptions);
  1636. Write (space,' Relocated to ');
  1637. b:=getbyte;
  1638. case absolutetyp(b) of
  1639. tovar :
  1640. readpropaccesslist(space+' Sym : ');
  1641. toasm :
  1642. Writeln('Assembler name : ',getstring);
  1643. toaddr :
  1644. begin
  1645. Write('Address : ',getlongint);
  1646. if tsystemcpu(ppufile.header.cpu)=cpu_i386 then
  1647. WriteLn(' (Far: ',getbyte<>0,')');
  1648. end;
  1649. else
  1650. Writeln ('!! Invalid unit format : Invalid absolute type encountered: ',b);
  1651. end;
  1652. end;
  1653. ibfieldvarsym :
  1654. begin
  1655. readabstractvarsym('Field Variable symbol ',varoptions);
  1656. writeln(space,' Address : ',getaint);
  1657. end;
  1658. ibstaticvarsym :
  1659. begin
  1660. readabstractvarsym('Global Variable symbol ',varoptions);
  1661. write (space,' DefaultConst : ');
  1662. readderef('');
  1663. if (vo_has_mangledname in varoptions) then
  1664. writeln(space,' Mangledname : ',getstring);
  1665. end;
  1666. iblocalvarsym :
  1667. begin
  1668. readabstractvarsym('Local Variable symbol ',varoptions);
  1669. write (space,' DefaultConst : ');
  1670. readderef('');
  1671. end;
  1672. ibparavarsym :
  1673. begin
  1674. readabstractvarsym('Parameter Variable symbol ',varoptions);
  1675. write (space,' DefaultConst : ');
  1676. readderef('');
  1677. writeln(space,' ParaNr : ',getword);
  1678. writeln(space,' Univ : ',boolean(getbyte));
  1679. writeln(space,' VarState : ',getbyte);
  1680. if (vo_has_explicit_paraloc in varoptions) then
  1681. begin
  1682. i:=getbyte;
  1683. getdata(tempbuf,i);
  1684. end;
  1685. end;
  1686. ibenumsym :
  1687. begin
  1688. readcommonsym('Enumeration symbol ');
  1689. write (space,' Definition : ');
  1690. readderef('');
  1691. writeln(space,' Value : ',getlongint);
  1692. end;
  1693. ibsyssym :
  1694. begin
  1695. readcommonsym('Internal system symbol ');
  1696. writeln(space,' Internal Nr : ',getlongint);
  1697. end;
  1698. ibmacrosym :
  1699. begin
  1700. readcommonsym('Macro symbol ');
  1701. writeln(space,' Name: ',getstring);
  1702. writeln(space,' Defined: ',getbyte);
  1703. writeln(space,' Compiler var: ',getbyte);
  1704. len:=getlongint;
  1705. writeln(space,' Value length: ',len);
  1706. if len > 0 then
  1707. begin
  1708. getmem(pc,len+1);
  1709. getdata(pc^,len);
  1710. (pc+len)^:= #0;
  1711. writeln(space,' Value: "',pc,'"');
  1712. freemem(pc,len+1);
  1713. end;
  1714. end;
  1715. ibpropertysym :
  1716. begin
  1717. readcommonsym('Property ');
  1718. i:=getlongint;
  1719. writeln(space,' PropOptions : ',i);
  1720. write (space,' OverrideProp : ');
  1721. readderef('');
  1722. write (space,' Prop Type : ');
  1723. readderef('');
  1724. writeln(space,' Index : ',getlongint);
  1725. writeln(space,' Default : ',getlongint);
  1726. write (space,' Index Type : ');
  1727. readderef('');
  1728. write (space,' Readaccess : ');
  1729. readpropaccesslist(space+' Sym: ');
  1730. write (space,' Writeaccess : ');
  1731. readpropaccesslist(space+' Sym: ');
  1732. write (space,' Storedaccess : ');
  1733. readpropaccesslist(space+' Sym: ');
  1734. end;
  1735. iberror :
  1736. begin
  1737. Writeln('!! Error in PPU');
  1738. exit;
  1739. end;
  1740. ibendsyms :
  1741. break;
  1742. else
  1743. WriteLn('!! Skipping unsupported PPU Entry in Symbols: ',b);
  1744. end;
  1745. if not EndOfEntry then
  1746. Writeln('!! Entry has more information stored');
  1747. until false;
  1748. end;
  1749. end;
  1750. {****************************************************************************
  1751. Read defintions Part
  1752. ****************************************************************************}
  1753. procedure readdefinitions(const s:string);
  1754. type
  1755. tordtype = (
  1756. uvoid,
  1757. u8bit,u16bit,u32bit,u64bit,
  1758. s8bit,s16bit,s32bit,s64bit,
  1759. bool8bit,bool16bit,bool32bit,bool64bit,
  1760. uchar,uwidechar,scurrency
  1761. );
  1762. tobjecttyp = (odt_none,
  1763. odt_class,
  1764. odt_object,
  1765. odt_interfacecom,
  1766. odt_interfacecom_property,
  1767. odt_interfacecom_function,
  1768. odt_interfacecorba,
  1769. odt_cppclass,
  1770. odt_dispinterface,
  1771. odt_objcclass,
  1772. odt_objcprotocol
  1773. );
  1774. tvarianttype = (
  1775. vt_normalvariant,vt_olevariant
  1776. );
  1777. var
  1778. b : byte;
  1779. l,j : longint;
  1780. calloption : tproccalloption;
  1781. procoptions : tprocoptions;
  1782. procinfooptions : tprocinfoflag;
  1783. begin
  1784. with ppufile do
  1785. begin
  1786. if space<>'' then
  1787. Writeln(space,'------ ',s,' ------');
  1788. if readentry<>ibstartdefs then
  1789. Writeln('!! ibstartdefs not found');
  1790. repeat
  1791. b:=readentry;
  1792. case b of
  1793. ibpointerdef :
  1794. begin
  1795. readcommondef('Pointer definition');
  1796. write (space,' Pointed Type : ');
  1797. readderef('');
  1798. writeln(space,' Is Far : ',(getbyte<>0));
  1799. end;
  1800. iborddef :
  1801. begin
  1802. readcommondef('Ordinal definition');
  1803. write (space,' Base type : ');
  1804. b:=getbyte;
  1805. case tordtype(b) of
  1806. uvoid : writeln('uvoid');
  1807. u8bit : writeln('u8bit');
  1808. u16bit : writeln('u16bit');
  1809. u32bit : writeln('s32bit');
  1810. u64bit : writeln('u64bit');
  1811. s8bit : writeln('s8bit');
  1812. s16bit : writeln('s16bit');
  1813. s32bit : writeln('s32bit');
  1814. s64bit : writeln('s64bit');
  1815. bool8bit : writeln('bool8bit');
  1816. bool16bit : writeln('bool16bit');
  1817. bool32bit : writeln('bool32bit');
  1818. bool64bit : writeln('bool64bit');
  1819. uchar : writeln('uchar');
  1820. uwidechar : writeln('uwidechar');
  1821. scurrency : writeln('ucurrency');
  1822. else writeln('!! Warning: Invalid base type ',b);
  1823. end;
  1824. writeln(space,' Range : ',constexp.tostr(getexprint),' to ',constexp.tostr(getexprint));
  1825. end;
  1826. ibfloatdef :
  1827. begin
  1828. readcommondef('Float definition');
  1829. writeln(space,' Float type : ',getbyte);
  1830. end;
  1831. ibarraydef :
  1832. begin
  1833. readcommondef('Array definition');
  1834. write (space,' Element type : ');
  1835. readderef('');
  1836. write (space,' Range Type : ');
  1837. readderef('');
  1838. writeln(space,' Range : ',getaint,' to ',getaint);
  1839. write (space,' Options : ');
  1840. readarraydefoptions;
  1841. end;
  1842. ibprocdef :
  1843. begin
  1844. readcommondef('Procedure definition');
  1845. read_abstract_proc_def(calloption,procoptions);
  1846. if (po_has_mangledname in procoptions) then
  1847. writeln(space,' Mangled name : ',getstring);
  1848. writeln(space,' Number : ',getword);
  1849. writeln(space,' Level : ',getbyte);
  1850. write (space,' Class : ');
  1851. readderef('');
  1852. write (space,' Procsym : ');
  1853. readderef('');
  1854. write (space,' File Pos : ');
  1855. readposinfo;
  1856. writeln(space,' Visibility : ',Visibility2Str(ppufile.getbyte));
  1857. write (space,' SymOptions : ');
  1858. readsymoptions(space+' ');
  1859. if tsystemcpu(ppufile.header.cpu)=cpu_powerpc then
  1860. begin
  1861. { library symbol for AmigaOS/MorphOS }
  1862. write (space,' Library symbol : ');
  1863. readderef('');
  1864. end;
  1865. if (po_has_importdll in procoptions) then
  1866. writeln(space,' Import DLL : ',getstring);
  1867. if (po_has_importname in procoptions) then
  1868. writeln(space,' Import Name : ',getstring);
  1869. writeln(space,' Import Nr : ',getword);
  1870. if (po_msgint in procoptions) then
  1871. writeln(space,' MsgInt : ',getlongint);
  1872. if (po_msgstr in procoptions) then
  1873. writeln(space,' MsgStr : ',getstring);
  1874. if (po_dispid in procoptions) then
  1875. writeln(space,' DispID: ',ppufile.getlongint);
  1876. if (po_has_inlininginfo in procoptions) then
  1877. begin
  1878. write (space,' FuncretSym : ');
  1879. readderef('');
  1880. ppufile.getsmallset(procinfooptions);
  1881. writeln(space,' ProcInfoOptions : ',dword(procinfooptions));
  1882. end;
  1883. b:=ppufile.getbyte;
  1884. if b<>0 then
  1885. begin
  1886. write (space,' Alias names : ');
  1887. for j:=1 to b do
  1888. begin
  1889. write(ppufile.getstring);
  1890. if j<b then
  1891. write(', ');
  1892. end;
  1893. writeln;
  1894. end;
  1895. if not EndOfEntry then
  1896. Writeln('!! Entry has more information stored');
  1897. space:=' '+space;
  1898. { parast }
  1899. readdefinitions('parast');
  1900. readsymbols('parast');
  1901. { localst }
  1902. if (po_has_inlininginfo in procoptions) then
  1903. begin
  1904. readdefinitions('localst');
  1905. readsymbols('localst');
  1906. end;
  1907. if (po_has_inlininginfo in procoptions) then
  1908. readnodetree;
  1909. delete(space,1,4);
  1910. end;
  1911. ibprocvardef :
  1912. begin
  1913. readcommondef('Procedural type (ProcVar) definition');
  1914. read_abstract_proc_def(calloption,procoptions);
  1915. if not EndOfEntry then
  1916. Writeln('!! Entry has more information stored');
  1917. space:=' '+space;
  1918. { parast }
  1919. readdefinitions('parast');
  1920. readsymbols('parast');
  1921. delete(space,1,4);
  1922. end;
  1923. ibshortstringdef :
  1924. begin
  1925. readcommondef('ShortString definition');
  1926. writeln(space,' Length : ',getbyte);
  1927. end;
  1928. ibwidestringdef :
  1929. begin
  1930. readcommondef('WideString definition');
  1931. writeln(space,' Length : ',getlongint);
  1932. end;
  1933. ibansistringdef :
  1934. begin
  1935. readcommondef('AnsiString definition');
  1936. writeln(space,' Length : ',getlongint);
  1937. end;
  1938. iblongstringdef :
  1939. begin
  1940. readcommondef('Longstring definition');
  1941. writeln(space,' Length : ',getlongint);
  1942. end;
  1943. ibrecorddef :
  1944. begin
  1945. readcommondef('Record definition');
  1946. writeln(space,' FieldAlign : ',getbyte);
  1947. writeln(space,' RecordAlign : ',getbyte);
  1948. writeln(space,' PadAlign : ',getbyte);
  1949. writeln(space,'UseFieldAlignment : ',getbyte);
  1950. writeln(space,' DataSize : ',getaint);
  1951. if not EndOfEntry then
  1952. Writeln('!! Entry has more information stored');
  1953. {read the record definitions and symbols}
  1954. space:=' '+space;
  1955. readdefinitions('fields');
  1956. readsymbols('fields');
  1957. Delete(space,1,4);
  1958. end;
  1959. ibobjectdef :
  1960. begin
  1961. readcommondef('Object/Class definition');
  1962. b:=getbyte;
  1963. write (space,' Type : ');
  1964. case tobjecttyp(b) of
  1965. odt_class : writeln('class');
  1966. odt_object : writeln('object');
  1967. odt_interfacecom : writeln('interfacecom');
  1968. odt_interfacecorba : writeln('interfacecorba');
  1969. odt_cppclass : writeln('cppclass');
  1970. odt_dispinterface : writeln('dispinterface');
  1971. odt_objcclass : writeln('objcclass');
  1972. odt_objcprotocol : writeln('objcprotocol');
  1973. else writeln('!! Warning: Invalid object type ',b);
  1974. end;
  1975. writeln(space,' Name of Class : ',getstring);
  1976. writeln(space,' External name : ',getstring);
  1977. writeln(space,' Import lib : ',getstring);
  1978. writeln(space,' DataSize : ',getaint);
  1979. writeln(space,' FieldAlign : ',getbyte);
  1980. writeln(space,' RecordAlign : ',getbyte);
  1981. writeln(space,' Vmt offset : ',getlongint);
  1982. write (space, ' Ancestor Class : ');
  1983. readderef('');
  1984. write (space,' Options : ');
  1985. readobjectdefoptions;
  1986. if tobjecttyp(b) in [odt_interfacecom,odt_interfacecorba,odt_dispinterface] then
  1987. begin
  1988. { IIDGUID }
  1989. for j:=1to 16 do
  1990. getbyte;
  1991. writeln(space,' IID String : ',getstring);
  1992. writeln(space,' Last VTable idx : ',getlongint);
  1993. end;
  1994. l:=getlongint;
  1995. writeln(space,' VMT entries: ',l);
  1996. for j:=1 to l do
  1997. begin
  1998. write(space,' ');
  1999. readderef('');
  2000. writeln(space,' Visibility: ',Visibility2Str(getbyte));
  2001. end;
  2002. if tobjecttyp(b) in [odt_class,odt_interfacecorba,odt_objcclass,odt_objcprotocol] then
  2003. begin
  2004. l:=getlongint;
  2005. writeln(space,' Impl Intf Count : ',l);
  2006. for j:=1 to l do
  2007. begin
  2008. write (space,' - Definition : ');
  2009. readderef('');
  2010. writeln(space,' IOffset : ',getlongint);
  2011. end;
  2012. end;
  2013. if df_copied_def in current_defoptions then
  2014. begin
  2015. writeln(' Copy of def: ');
  2016. readderef('');
  2017. end;
  2018. if not EndOfEntry then
  2019. Writeln('!! Entry has more information stored');
  2020. if not(df_copied_def in current_defoptions) then
  2021. begin
  2022. {read the record definitions and symbols}
  2023. space:=' '+space;
  2024. readdefinitions('fields');
  2025. readsymbols('fields');
  2026. Delete(space,1,4);
  2027. end;
  2028. end;
  2029. ibfiledef :
  2030. begin
  2031. ReadCommonDef('File definition');
  2032. write (space,' Type : ');
  2033. case getbyte of
  2034. 0 : writeln('Text');
  2035. 1 : begin
  2036. writeln('Typed');
  2037. write (space,' File of Type : ');
  2038. readderef('');
  2039. end;
  2040. 2 : writeln('Untyped');
  2041. end;
  2042. end;
  2043. ibformaldef :
  2044. begin
  2045. readcommondef('Generic definition (void-typ)');
  2046. writeln(space,' Is Typed : ',(getbyte<>0));
  2047. end;
  2048. ibundefineddef :
  2049. readcommondef('Undefined definition (generic parameter)');
  2050. ibenumdef :
  2051. begin
  2052. readcommondef('Enumeration type definition');
  2053. write(space,'Base enumeration type : ');
  2054. readderef('');
  2055. writeln(space,' Smallest element : ',getaint);
  2056. writeln(space,' Largest element : ',getaint);
  2057. writeln(space,' Size : ',getaint);
  2058. end;
  2059. ibclassrefdef :
  2060. begin
  2061. readcommondef('Class reference definition');
  2062. write (space,' Pointed Type : ');
  2063. readderef('');
  2064. end;
  2065. ibsetdef :
  2066. begin
  2067. readcommondef('Set definition');
  2068. write (space,' Element type : ');
  2069. readderef('');
  2070. writeln(space,' Size : ',getaint);
  2071. writeln(space,' Set Base : ',getaint);
  2072. writeln(space,' Set Max : ',getaint);
  2073. end;
  2074. ibvariantdef :
  2075. begin
  2076. readcommondef('Variant definition');
  2077. write (space,' Varianttype : ');
  2078. b:=getbyte;
  2079. case tvarianttype(b) of
  2080. vt_normalvariant :
  2081. writeln('Normal');
  2082. vt_olevariant :
  2083. writeln('OLE');
  2084. else
  2085. writeln('!! Warning: Invalid varianttype ',b);
  2086. end;
  2087. end;
  2088. iberror :
  2089. begin
  2090. Writeln('!! Error in PPU');
  2091. exit;
  2092. end;
  2093. ibenddefs :
  2094. break;
  2095. else
  2096. WriteLn('!! Skipping unsupported PPU Entry in definitions: ',b);
  2097. end;
  2098. if not EndOfEntry then
  2099. Writeln('!! Entry has more information stored');
  2100. until false;
  2101. end;
  2102. end;
  2103. procedure readmoduleoptions(space : string);
  2104. type
  2105. tmoduleoption = (mo_none,
  2106. mo_hint_deprecated,
  2107. mo_hint_platform,
  2108. mo_hint_library,
  2109. mo_hint_unimplemented,
  2110. mo_hint_experimental,
  2111. mo_has_deprecated_msg
  2112. );
  2113. tmoduleoptions = set of tmoduleoption;
  2114. tmoduleopt=record
  2115. mask : tmoduleoption;
  2116. str : string[30];
  2117. end;
  2118. const
  2119. moduleopts=6;
  2120. moduleopt : array[1..moduleopts] of tmoduleopt=(
  2121. (mask:mo_hint_deprecated; str:'Hint Deprecated'),
  2122. (mask:mo_hint_platform; str:'Hint Platform'),
  2123. (mask:mo_hint_library; str:'Hint Library'),
  2124. (mask:mo_hint_unimplemented; str:'Hint Unimplemented'),
  2125. (mask:mo_hint_experimental; str:'Hint Experimental'),
  2126. (mask:mo_has_deprecated_msg; str:'Has Deprecated Message')
  2127. );
  2128. var
  2129. moduleoptions : tmoduleoptions;
  2130. i : longint;
  2131. first : boolean;
  2132. begin
  2133. ppufile.getsmallset(moduleoptions);
  2134. if moduleoptions<>[] then
  2135. begin
  2136. first:=true;
  2137. for i:=1to moduleopts do
  2138. if (moduleopt[i].mask in moduleoptions) then
  2139. begin
  2140. if first then
  2141. first:=false
  2142. else
  2143. write(', ');
  2144. write(moduleopt[i].str);
  2145. end;
  2146. end;
  2147. writeln;
  2148. if mo_has_deprecated_msg in moduleoptions then
  2149. writeln(space,'Deprecated : ', ppufile.getstring);
  2150. end;
  2151. {****************************************************************************
  2152. Read General Part
  2153. ****************************************************************************}
  2154. procedure readinterface;
  2155. var
  2156. b : byte;
  2157. sourcenumber : longint;
  2158. begin
  2159. with ppufile do
  2160. begin
  2161. repeat
  2162. b:=readentry;
  2163. case b of
  2164. ibmodulename :
  2165. Writeln('Module Name: ',getstring);
  2166. ibmoduleoptions:
  2167. readmoduleoptions(' ');
  2168. ibsourcefiles :
  2169. begin
  2170. sourcenumber:=1;
  2171. while not EndOfEntry do
  2172. begin
  2173. Writeln('Source file ',sourcenumber,' : ',getstring,' ',filetimestring(getlongint));
  2174. inc(sourcenumber);
  2175. end;
  2176. end;
  2177. {$IFDEF MACRO_DIFF_HINT}
  2178. ibusedmacros :
  2179. begin
  2180. while not EndOfEntry do
  2181. begin
  2182. Write('Conditional ',getstring);
  2183. b:=getbyte;
  2184. if boolean(b)=true then
  2185. write(' defined at startup')
  2186. else
  2187. write(' not defined at startup');
  2188. b:=getbyte;
  2189. if boolean(b)=true then
  2190. writeln(' was used')
  2191. else
  2192. writeln;
  2193. end;
  2194. end;
  2195. {$ENDIF}
  2196. ibloadunit :
  2197. ReadLoadUnit;
  2198. iblinkunitofiles :
  2199. ReadLinkContainer('Link unit object file: ');
  2200. iblinkunitstaticlibs :
  2201. ReadLinkContainer('Link unit static lib: ');
  2202. iblinkunitsharedlibs :
  2203. ReadLinkContainer('Link unit shared lib: ');
  2204. iblinkotherofiles :
  2205. ReadLinkContainer('Link other object file: ');
  2206. iblinkotherstaticlibs :
  2207. ReadLinkContainer('Link other static lib: ');
  2208. iblinkothersharedlibs :
  2209. ReadLinkContainer('Link other shared lib: ');
  2210. iblinkotherframeworks:
  2211. ReadLinkContainer('Link framework: ');
  2212. ibmainname:
  2213. Writeln('Specified main program symbol name: ',getstring);
  2214. ibImportSymbols :
  2215. ReadImportSymbols;
  2216. ibderefdata :
  2217. ReadDerefData;
  2218. ibderefmap :
  2219. ReadDerefMap;
  2220. ibwpofile :
  2221. ReadWpoFileInfo;
  2222. ibresources :
  2223. ReadLinkContainer('Resource file: ');
  2224. iberror :
  2225. begin
  2226. Writeln('Error in PPU');
  2227. exit;
  2228. end;
  2229. ibendinterface :
  2230. break;
  2231. else
  2232. WriteLn('!! Skipping unsupported PPU Entry in General Part: ',b);
  2233. end;
  2234. until false;
  2235. end;
  2236. end;
  2237. {****************************************************************************
  2238. Read Implementation Part
  2239. ****************************************************************************}
  2240. procedure readimplementation;
  2241. var
  2242. b : byte;
  2243. begin
  2244. with ppufile do
  2245. begin
  2246. repeat
  2247. b:=readentry;
  2248. case b of
  2249. ibasmsymbols :
  2250. ReadAsmSymbols;
  2251. ibloadunit :
  2252. ReadLoadUnit;
  2253. iberror :
  2254. begin
  2255. Writeln('Error in PPU');
  2256. exit;
  2257. end;
  2258. ibendimplementation :
  2259. break;
  2260. else
  2261. WriteLn('!! Skipping unsupported PPU Entry in Implementation: ',b);
  2262. end;
  2263. until false;
  2264. end;
  2265. end;
  2266. procedure dofile (filename : string);
  2267. begin
  2268. { reset }
  2269. space:='';
  2270. { fix filename }
  2271. if pos('.',filename)=0 then
  2272. filename:=filename+'.ppu';
  2273. ppufile:=tppufile.create(filename);
  2274. if not ppufile.openfile then
  2275. begin
  2276. writeln ('IO-Error when opening : ',filename,', Skipping');
  2277. exit;
  2278. end;
  2279. { PPU File is open, check for PPU Id }
  2280. if not ppufile.CheckPPUID then
  2281. begin
  2282. writeln(Filename,' : Not a valid PPU file, Skipping');
  2283. exit;
  2284. end;
  2285. { Check PPU Version }
  2286. Writeln('Analyzing ',filename,' (v',ppufile.GetPPUVersion,')');
  2287. if ppufile.GetPPUVersion<16 then
  2288. begin
  2289. writeln(Filename,' : Old PPU Formats (<v16) are not supported, Skipping');
  2290. exit;
  2291. end;
  2292. { Write PPU Header Information }
  2293. if (verbose and v_header)<>0 then
  2294. begin
  2295. Writeln;
  2296. Writeln('Header');
  2297. Writeln('-------');
  2298. with ppufile.header do
  2299. begin
  2300. Writeln('Compiler version : ',ppufile.header.compiler shr 14,'.',
  2301. (ppufile.header.compiler shr 7) and $7f,'.',
  2302. ppufile.header.compiler and $7f);
  2303. WriteLn('Target processor : ',Cpu2Str(cpu));
  2304. WriteLn('Target operating system : ',Target2Str(target));
  2305. Writeln('Unit flags : ',PPUFlags2Str(flags));
  2306. Writeln('FileSize (w/o header) : ',size);
  2307. Writeln('Checksum : ',hexstr(checksum,8));
  2308. Writeln('Interface Checksum : ',hexstr(interface_checksum,8));
  2309. Writeln('Indirect Checksum : ',hexstr(indirect_checksum,8));
  2310. Writeln('Definitions stored : ',tostr(deflistsize));
  2311. Writeln('Symbols stored : ',tostr(symlistsize));
  2312. end;
  2313. end;
  2314. {read the general stuff}
  2315. if (verbose and v_interface)<>0 then
  2316. begin
  2317. Writeln;
  2318. Writeln('Interface section');
  2319. Writeln('------------------');
  2320. readinterface;
  2321. end
  2322. else
  2323. ppufile.skipuntilentry(ibendinterface);
  2324. {read the definitions}
  2325. if (verbose and v_defs)<>0 then
  2326. begin
  2327. Writeln;
  2328. Writeln('Interface definitions');
  2329. Writeln('----------------------');
  2330. readdefinitions('interface');
  2331. end
  2332. else
  2333. ppufile.skipuntilentry(ibenddefs);
  2334. {read the symbols}
  2335. if (verbose and v_syms)<>0 then
  2336. begin
  2337. Writeln;
  2338. Writeln('Interface Symbols');
  2339. Writeln('------------------');
  2340. readsymbols('interface');
  2341. end
  2342. else
  2343. ppufile.skipuntilentry(ibendsyms);
  2344. {read the macro symbols}
  2345. if (verbose and v_syms)<>0 then
  2346. begin
  2347. Writeln;
  2348. Writeln('Interface Macro Symbols');
  2349. Writeln('-----------------------');
  2350. end;
  2351. if ppufile.readentry<>ibexportedmacros then
  2352. begin
  2353. Writeln('!! Error in PPU');
  2354. exit;
  2355. end;
  2356. if boolean(ppufile.getbyte) then
  2357. begin
  2358. {skip the definition section for macros (since they are never used) }
  2359. ppufile.skipuntilentry(ibenddefs);
  2360. {read the macro symbols}
  2361. if (verbose and v_syms)<>0 then
  2362. readsymbols('interface macro')
  2363. else
  2364. ppufile.skipuntilentry(ibendsyms);
  2365. end
  2366. else
  2367. Writeln('(no exported macros)');
  2368. {read the implementation stuff}
  2369. if (verbose and v_implementation)<>0 then
  2370. begin
  2371. Writeln;
  2372. Writeln('Implementation section');
  2373. Writeln('-----------------------');
  2374. readimplementation;
  2375. end
  2376. else
  2377. ppufile.skipuntilentry(ibendimplementation);
  2378. {read the static symtable}
  2379. if (ppufile.header.flags and uf_local_symtable)<>0 then
  2380. begin
  2381. if (verbose and v_defs)<>0 then
  2382. begin
  2383. Writeln;
  2384. Writeln('Static definitions');
  2385. Writeln('----------------------');
  2386. readdefinitions('implementation');
  2387. end
  2388. else
  2389. ppufile.skipuntilentry(ibenddefs);
  2390. {read the symbols}
  2391. if (verbose and v_syms)<>0 then
  2392. begin
  2393. Writeln;
  2394. Writeln('Static Symbols');
  2395. Writeln('------------------');
  2396. readsymbols('implementation');
  2397. end
  2398. else
  2399. ppufile.skipuntilentry(ibendsyms);
  2400. end;
  2401. ReadCreatedObjTypes;
  2402. {shutdown ppufile}
  2403. ppufile.closefile;
  2404. ppufile.free;
  2405. Writeln;
  2406. end;
  2407. procedure help;
  2408. begin
  2409. writeln('usage: ppudump [options] <filename1> <filename2>...');
  2410. writeln;
  2411. writeln('[options] can be:');
  2412. writeln(' -V<verbose> Set verbosity to <verbose>');
  2413. writeln(' H - Show header info');
  2414. writeln(' I - Show interface');
  2415. writeln(' M - Show implementation');
  2416. writeln(' S - Show interface symbols');
  2417. writeln(' D - Show interface definitions');
  2418. // writeln(' B - Show browser info');
  2419. writeln(' A - Show all');
  2420. writeln(' -h, -? This helpscreen');
  2421. halt;
  2422. end;
  2423. var
  2424. startpara,
  2425. nrfile,i : longint;
  2426. para : string;
  2427. begin
  2428. writeln(Title+' '+Version);
  2429. writeln(Copyright);
  2430. writeln;
  2431. if paramcount<1 then
  2432. begin
  2433. writeln('usage: dumpppu [options] <filename1> <filename2>...');
  2434. halt(1);
  2435. end;
  2436. { turn verbose on by default }
  2437. verbose:=v_all;
  2438. { read options }
  2439. startpara:=1;
  2440. while copy(paramstr(startpara),1,1)='-' do
  2441. begin
  2442. para:=paramstr(startpara);
  2443. case upcase(para[2]) of
  2444. 'V' : begin
  2445. verbose:=0;
  2446. for i:=3 to length(para) do
  2447. case upcase(para[i]) of
  2448. 'H' : verbose:=verbose or v_header;
  2449. 'I' : verbose:=verbose or v_interface;
  2450. 'M' : verbose:=verbose or v_implementation;
  2451. 'D' : verbose:=verbose or v_defs;
  2452. 'S' : verbose:=verbose or v_syms;
  2453. 'A' : verbose:=verbose or v_all;
  2454. end;
  2455. end;
  2456. 'H' : help;
  2457. '?' : help;
  2458. end;
  2459. inc(startpara);
  2460. end;
  2461. { process files }
  2462. for nrfile:=startpara to paramcount do
  2463. dofile (paramstr(nrfile));
  2464. if has_errors then
  2465. Halt(1);
  2466. end.