ppudump.pp 76 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639
  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,' VarState : ',getbyte);
  1679. if (vo_has_explicit_paraloc in varoptions) then
  1680. begin
  1681. i:=getbyte;
  1682. getdata(tempbuf,i);
  1683. end;
  1684. end;
  1685. ibenumsym :
  1686. begin
  1687. readcommonsym('Enumeration symbol ');
  1688. write (space,' Definition : ');
  1689. readderef('');
  1690. writeln(space,' Value : ',getlongint);
  1691. end;
  1692. ibsyssym :
  1693. begin
  1694. readcommonsym('Internal system symbol ');
  1695. writeln(space,' Internal Nr : ',getlongint);
  1696. end;
  1697. ibmacrosym :
  1698. begin
  1699. readcommonsym('Macro symbol ');
  1700. writeln(space,' Name: ',getstring);
  1701. writeln(space,' Defined: ',getbyte);
  1702. writeln(space,' Compiler var: ',getbyte);
  1703. len:=getlongint;
  1704. writeln(space,' Value length: ',len);
  1705. if len > 0 then
  1706. begin
  1707. getmem(pc,len+1);
  1708. getdata(pc^,len);
  1709. (pc+len)^:= #0;
  1710. writeln(space,' Value: "',pc,'"');
  1711. freemem(pc,len+1);
  1712. end;
  1713. end;
  1714. ibpropertysym :
  1715. begin
  1716. readcommonsym('Property ');
  1717. i:=getlongint;
  1718. writeln(space,' PropOptions : ',i);
  1719. write (space,' OverrideProp : ');
  1720. readderef('');
  1721. write (space,' Prop Type : ');
  1722. readderef('');
  1723. writeln(space,' Index : ',getlongint);
  1724. writeln(space,' Default : ',getlongint);
  1725. write (space,' Index Type : ');
  1726. readderef('');
  1727. write (space,' Readaccess : ');
  1728. readpropaccesslist(space+' Sym: ');
  1729. write (space,' Writeaccess : ');
  1730. readpropaccesslist(space+' Sym: ');
  1731. write (space,' Storedaccess : ');
  1732. readpropaccesslist(space+' Sym: ');
  1733. end;
  1734. iberror :
  1735. begin
  1736. Writeln('!! Error in PPU');
  1737. exit;
  1738. end;
  1739. ibendsyms :
  1740. break;
  1741. else
  1742. WriteLn('!! Skipping unsupported PPU Entry in Symbols: ',b);
  1743. end;
  1744. if not EndOfEntry then
  1745. Writeln('!! Entry has more information stored');
  1746. until false;
  1747. end;
  1748. end;
  1749. {****************************************************************************
  1750. Read defintions Part
  1751. ****************************************************************************}
  1752. procedure readdefinitions(const s:string);
  1753. type
  1754. tordtype = (
  1755. uvoid,
  1756. u8bit,u16bit,u32bit,u64bit,
  1757. s8bit,s16bit,s32bit,s64bit,
  1758. bool8bit,bool16bit,bool32bit,bool64bit,
  1759. uchar,uwidechar,scurrency
  1760. );
  1761. tobjecttyp = (odt_none,
  1762. odt_class,
  1763. odt_object,
  1764. odt_interfacecom,
  1765. odt_interfacecom_property,
  1766. odt_interfacecom_function,
  1767. odt_interfacecorba,
  1768. odt_cppclass,
  1769. odt_dispinterface,
  1770. odt_objcclass,
  1771. odt_objcprotocol
  1772. );
  1773. tvarianttype = (
  1774. vt_normalvariant,vt_olevariant
  1775. );
  1776. var
  1777. b : byte;
  1778. l,j : longint;
  1779. calloption : tproccalloption;
  1780. procoptions : tprocoptions;
  1781. procinfooptions : tprocinfoflag;
  1782. begin
  1783. with ppufile do
  1784. begin
  1785. if space<>'' then
  1786. Writeln(space,'------ ',s,' ------');
  1787. if readentry<>ibstartdefs then
  1788. Writeln('!! ibstartdefs not found');
  1789. repeat
  1790. b:=readentry;
  1791. case b of
  1792. ibpointerdef :
  1793. begin
  1794. readcommondef('Pointer definition');
  1795. write (space,' Pointed Type : ');
  1796. readderef('');
  1797. writeln(space,' Is Far : ',(getbyte<>0));
  1798. end;
  1799. iborddef :
  1800. begin
  1801. readcommondef('Ordinal definition');
  1802. write (space,' Base type : ');
  1803. b:=getbyte;
  1804. case tordtype(b) of
  1805. uvoid : writeln('uvoid');
  1806. u8bit : writeln('u8bit');
  1807. u16bit : writeln('u16bit');
  1808. u32bit : writeln('s32bit');
  1809. u64bit : writeln('u64bit');
  1810. s8bit : writeln('s8bit');
  1811. s16bit : writeln('s16bit');
  1812. s32bit : writeln('s32bit');
  1813. s64bit : writeln('s64bit');
  1814. bool8bit : writeln('bool8bit');
  1815. bool16bit : writeln('bool16bit');
  1816. bool32bit : writeln('bool32bit');
  1817. bool64bit : writeln('bool64bit');
  1818. uchar : writeln('uchar');
  1819. uwidechar : writeln('uwidechar');
  1820. scurrency : writeln('ucurrency');
  1821. else writeln('!! Warning: Invalid base type ',b);
  1822. end;
  1823. writeln(space,' Range : ',constexp.tostr(getexprint),' to ',constexp.tostr(getexprint));
  1824. end;
  1825. ibfloatdef :
  1826. begin
  1827. readcommondef('Float definition');
  1828. writeln(space,' Float type : ',getbyte);
  1829. end;
  1830. ibarraydef :
  1831. begin
  1832. readcommondef('Array definition');
  1833. write (space,' Element type : ');
  1834. readderef('');
  1835. write (space,' Range Type : ');
  1836. readderef('');
  1837. writeln(space,' Range : ',getaint,' to ',getaint);
  1838. write (space,' Options : ');
  1839. readarraydefoptions;
  1840. end;
  1841. ibprocdef :
  1842. begin
  1843. readcommondef('Procedure definition');
  1844. read_abstract_proc_def(calloption,procoptions);
  1845. if (po_has_mangledname in procoptions) then
  1846. writeln(space,' Mangled name : ',getstring);
  1847. writeln(space,' Number : ',getword);
  1848. writeln(space,' Level : ',getbyte);
  1849. write (space,' Class : ');
  1850. readderef('');
  1851. write (space,' Procsym : ');
  1852. readderef('');
  1853. write (space,' File Pos : ');
  1854. readposinfo;
  1855. writeln(space,' Visibility : ',Visibility2Str(ppufile.getbyte));
  1856. write (space,' SymOptions : ');
  1857. readsymoptions(space+' ');
  1858. if tsystemcpu(ppufile.header.cpu)=cpu_powerpc then
  1859. begin
  1860. { library symbol for AmigaOS/MorphOS }
  1861. write (space,' Library symbol : ');
  1862. readderef('');
  1863. end;
  1864. if (po_has_importdll in procoptions) then
  1865. writeln(space,' Import DLL : ',getstring);
  1866. if (po_has_importname in procoptions) then
  1867. writeln(space,' Import Name : ',getstring);
  1868. writeln(space,' Import Nr : ',getword);
  1869. if (po_msgint in procoptions) then
  1870. writeln(space,' MsgInt : ',getlongint);
  1871. if (po_msgstr in procoptions) then
  1872. writeln(space,' MsgStr : ',getstring);
  1873. if (po_dispid in procoptions) then
  1874. writeln(space,' DispID: ',ppufile.getlongint);
  1875. if (po_has_inlininginfo in procoptions) then
  1876. begin
  1877. write (space,' FuncretSym : ');
  1878. readderef('');
  1879. ppufile.getsmallset(procinfooptions);
  1880. writeln(space,' ProcInfoOptions : ',dword(procinfooptions));
  1881. end;
  1882. b:=ppufile.getbyte;
  1883. if b<>0 then
  1884. begin
  1885. write (space,' Alias names : ');
  1886. for j:=1 to b do
  1887. begin
  1888. write(ppufile.getstring);
  1889. if j<b then
  1890. write(', ');
  1891. end;
  1892. writeln;
  1893. end;
  1894. if not EndOfEntry then
  1895. Writeln('!! Entry has more information stored');
  1896. space:=' '+space;
  1897. { parast }
  1898. readdefinitions('parast');
  1899. readsymbols('parast');
  1900. { localst }
  1901. if (po_has_inlininginfo in procoptions) then
  1902. begin
  1903. readdefinitions('localst');
  1904. readsymbols('localst');
  1905. end;
  1906. if (po_has_inlininginfo in procoptions) then
  1907. readnodetree;
  1908. delete(space,1,4);
  1909. end;
  1910. ibprocvardef :
  1911. begin
  1912. readcommondef('Procedural type (ProcVar) definition');
  1913. read_abstract_proc_def(calloption,procoptions);
  1914. if not EndOfEntry then
  1915. Writeln('!! Entry has more information stored');
  1916. space:=' '+space;
  1917. { parast }
  1918. readdefinitions('parast');
  1919. readsymbols('parast');
  1920. delete(space,1,4);
  1921. end;
  1922. ibshortstringdef :
  1923. begin
  1924. readcommondef('ShortString definition');
  1925. writeln(space,' Length : ',getbyte);
  1926. end;
  1927. ibwidestringdef :
  1928. begin
  1929. readcommondef('WideString definition');
  1930. writeln(space,' Length : ',getlongint);
  1931. end;
  1932. ibansistringdef :
  1933. begin
  1934. readcommondef('AnsiString definition');
  1935. writeln(space,' Length : ',getlongint);
  1936. end;
  1937. iblongstringdef :
  1938. begin
  1939. readcommondef('Longstring definition');
  1940. writeln(space,' Length : ',getlongint);
  1941. end;
  1942. ibrecorddef :
  1943. begin
  1944. readcommondef('Record definition');
  1945. writeln(space,' FieldAlign : ',getbyte);
  1946. writeln(space,' RecordAlign : ',getbyte);
  1947. writeln(space,' PadAlign : ',getbyte);
  1948. writeln(space,'UseFieldAlignment : ',getbyte);
  1949. writeln(space,' DataSize : ',getaint);
  1950. if not EndOfEntry then
  1951. Writeln('!! Entry has more information stored');
  1952. {read the record definitions and symbols}
  1953. space:=' '+space;
  1954. readdefinitions('fields');
  1955. readsymbols('fields');
  1956. Delete(space,1,4);
  1957. end;
  1958. ibobjectdef :
  1959. begin
  1960. readcommondef('Object/Class definition');
  1961. b:=getbyte;
  1962. write (space,' Type : ');
  1963. case tobjecttyp(b) of
  1964. odt_class : writeln('class');
  1965. odt_object : writeln('object');
  1966. odt_interfacecom : writeln('interfacecom');
  1967. odt_interfacecorba : writeln('interfacecorba');
  1968. odt_cppclass : writeln('cppclass');
  1969. odt_dispinterface : writeln('dispinterface');
  1970. odt_objcclass : writeln('objcclass');
  1971. odt_objcprotocol : writeln('objcprotocol');
  1972. else writeln('!! Warning: Invalid object type ',b);
  1973. end;
  1974. writeln(space,' Name of Class : ',getstring);
  1975. writeln(space,' External name : ',getstring);
  1976. writeln(space,' Import lib : ',getstring);
  1977. writeln(space,' DataSize : ',getaint);
  1978. writeln(space,' FieldAlign : ',getbyte);
  1979. writeln(space,' RecordAlign : ',getbyte);
  1980. writeln(space,' Vmt offset : ',getlongint);
  1981. write (space, ' Ancestor Class : ');
  1982. readderef('');
  1983. write (space,' Options : ');
  1984. readobjectdefoptions;
  1985. if tobjecttyp(b) in [odt_interfacecom,odt_interfacecorba,odt_dispinterface] then
  1986. begin
  1987. { IIDGUID }
  1988. for j:=1to 16 do
  1989. getbyte;
  1990. writeln(space,' IID String : ',getstring);
  1991. writeln(space,' Last VTable idx : ',getlongint);
  1992. end;
  1993. l:=getlongint;
  1994. writeln(space,' VMT entries: ',l);
  1995. for j:=1 to l do
  1996. begin
  1997. write(space,' ');
  1998. readderef('');
  1999. writeln(space,' Visibility: ',Visibility2Str(getbyte));
  2000. end;
  2001. if tobjecttyp(b) in [odt_class,odt_interfacecorba,odt_objcclass,odt_objcprotocol] then
  2002. begin
  2003. l:=getlongint;
  2004. writeln(space,' Impl Intf Count : ',l);
  2005. for j:=1 to l do
  2006. begin
  2007. write (space,' - Definition : ');
  2008. readderef('');
  2009. writeln(space,' IOffset : ',getlongint);
  2010. end;
  2011. end;
  2012. if df_copied_def in current_defoptions then
  2013. begin
  2014. writeln(' Copy of def: ');
  2015. readderef('');
  2016. end;
  2017. if not EndOfEntry then
  2018. Writeln('!! Entry has more information stored');
  2019. if not(df_copied_def in current_defoptions) then
  2020. begin
  2021. {read the record definitions and symbols}
  2022. space:=' '+space;
  2023. readdefinitions('fields');
  2024. readsymbols('fields');
  2025. Delete(space,1,4);
  2026. end;
  2027. end;
  2028. ibfiledef :
  2029. begin
  2030. ReadCommonDef('File definition');
  2031. write (space,' Type : ');
  2032. case getbyte of
  2033. 0 : writeln('Text');
  2034. 1 : begin
  2035. writeln('Typed');
  2036. write (space,' File of Type : ');
  2037. readderef('');
  2038. end;
  2039. 2 : writeln('Untyped');
  2040. end;
  2041. end;
  2042. ibformaldef :
  2043. begin
  2044. readcommondef('Generic definition (void-typ)');
  2045. writeln(space,' Is Typed : ',(getbyte<>0));
  2046. end;
  2047. ibundefineddef :
  2048. readcommondef('Undefined definition (generic parameter)');
  2049. ibenumdef :
  2050. begin
  2051. readcommondef('Enumeration type definition');
  2052. write(space,'Base enumeration type : ');
  2053. readderef('');
  2054. writeln(space,' Smallest element : ',getaint);
  2055. writeln(space,' Largest element : ',getaint);
  2056. writeln(space,' Size : ',getaint);
  2057. end;
  2058. ibclassrefdef :
  2059. begin
  2060. readcommondef('Class reference definition');
  2061. write (space,' Pointed Type : ');
  2062. readderef('');
  2063. end;
  2064. ibsetdef :
  2065. begin
  2066. readcommondef('Set definition');
  2067. write (space,' Element type : ');
  2068. readderef('');
  2069. writeln(space,' Size : ',getaint);
  2070. writeln(space,' Set Base : ',getaint);
  2071. writeln(space,' Set Max : ',getaint);
  2072. end;
  2073. ibvariantdef :
  2074. begin
  2075. readcommondef('Variant definition');
  2076. write (space,' Varianttype : ');
  2077. b:=getbyte;
  2078. case tvarianttype(b) of
  2079. vt_normalvariant :
  2080. writeln('Normal');
  2081. vt_olevariant :
  2082. writeln('OLE');
  2083. else
  2084. writeln('!! Warning: Invalid varianttype ',b);
  2085. end;
  2086. end;
  2087. iberror :
  2088. begin
  2089. Writeln('!! Error in PPU');
  2090. exit;
  2091. end;
  2092. ibenddefs :
  2093. break;
  2094. else
  2095. WriteLn('!! Skipping unsupported PPU Entry in definitions: ',b);
  2096. end;
  2097. if not EndOfEntry then
  2098. Writeln('!! Entry has more information stored');
  2099. until false;
  2100. end;
  2101. end;
  2102. procedure readmoduleoptions(space : string);
  2103. type
  2104. tmoduleoption = (mo_none,
  2105. mo_hint_deprecated,
  2106. mo_hint_platform,
  2107. mo_hint_library,
  2108. mo_hint_unimplemented,
  2109. mo_hint_experimental,
  2110. mo_has_deprecated_msg
  2111. );
  2112. tmoduleoptions = set of tmoduleoption;
  2113. tmoduleopt=record
  2114. mask : tmoduleoption;
  2115. str : string[30];
  2116. end;
  2117. const
  2118. moduleopts=6;
  2119. moduleopt : array[1..moduleopts] of tmoduleopt=(
  2120. (mask:mo_hint_deprecated; str:'Hint Deprecated'),
  2121. (mask:mo_hint_platform; str:'Hint Platform'),
  2122. (mask:mo_hint_library; str:'Hint Library'),
  2123. (mask:mo_hint_unimplemented; str:'Hint Unimplemented'),
  2124. (mask:mo_hint_experimental; str:'Hint Experimental'),
  2125. (mask:mo_has_deprecated_msg; str:'Has Deprecated Message')
  2126. );
  2127. var
  2128. moduleoptions : tmoduleoptions;
  2129. i : longint;
  2130. first : boolean;
  2131. begin
  2132. ppufile.getsmallset(moduleoptions);
  2133. if moduleoptions<>[] then
  2134. begin
  2135. first:=true;
  2136. for i:=1to moduleopts do
  2137. if (moduleopt[i].mask in moduleoptions) then
  2138. begin
  2139. if first then
  2140. first:=false
  2141. else
  2142. write(', ');
  2143. write(moduleopt[i].str);
  2144. end;
  2145. end;
  2146. writeln;
  2147. if mo_has_deprecated_msg in moduleoptions then
  2148. writeln(space,'Deprecated : ', ppufile.getstring);
  2149. end;
  2150. {****************************************************************************
  2151. Read General Part
  2152. ****************************************************************************}
  2153. procedure readinterface;
  2154. var
  2155. b : byte;
  2156. sourcenumber : longint;
  2157. begin
  2158. with ppufile do
  2159. begin
  2160. repeat
  2161. b:=readentry;
  2162. case b of
  2163. ibmodulename :
  2164. Writeln('Module Name: ',getstring);
  2165. ibmoduleoptions:
  2166. readmoduleoptions(' ');
  2167. ibsourcefiles :
  2168. begin
  2169. sourcenumber:=1;
  2170. while not EndOfEntry do
  2171. begin
  2172. Writeln('Source file ',sourcenumber,' : ',getstring,' ',filetimestring(getlongint));
  2173. inc(sourcenumber);
  2174. end;
  2175. end;
  2176. {$IFDEF MACRO_DIFF_HINT}
  2177. ibusedmacros :
  2178. begin
  2179. while not EndOfEntry do
  2180. begin
  2181. Write('Conditional ',getstring);
  2182. b:=getbyte;
  2183. if boolean(b)=true then
  2184. write(' defined at startup')
  2185. else
  2186. write(' not defined at startup');
  2187. b:=getbyte;
  2188. if boolean(b)=true then
  2189. writeln(' was used')
  2190. else
  2191. writeln;
  2192. end;
  2193. end;
  2194. {$ENDIF}
  2195. ibloadunit :
  2196. ReadLoadUnit;
  2197. iblinkunitofiles :
  2198. ReadLinkContainer('Link unit object file: ');
  2199. iblinkunitstaticlibs :
  2200. ReadLinkContainer('Link unit static lib: ');
  2201. iblinkunitsharedlibs :
  2202. ReadLinkContainer('Link unit shared lib: ');
  2203. iblinkotherofiles :
  2204. ReadLinkContainer('Link other object file: ');
  2205. iblinkotherstaticlibs :
  2206. ReadLinkContainer('Link other static lib: ');
  2207. iblinkothersharedlibs :
  2208. ReadLinkContainer('Link other shared lib: ');
  2209. iblinkotherframeworks:
  2210. ReadLinkContainer('Link framework: ');
  2211. ibmainname:
  2212. Writeln('Specified main program symbol name: ',getstring);
  2213. ibImportSymbols :
  2214. ReadImportSymbols;
  2215. ibderefdata :
  2216. ReadDerefData;
  2217. ibderefmap :
  2218. ReadDerefMap;
  2219. ibwpofile :
  2220. ReadWpoFileInfo;
  2221. ibresources :
  2222. ReadLinkContainer('Resource file: ');
  2223. iberror :
  2224. begin
  2225. Writeln('Error in PPU');
  2226. exit;
  2227. end;
  2228. ibendinterface :
  2229. break;
  2230. else
  2231. WriteLn('!! Skipping unsupported PPU Entry in General Part: ',b);
  2232. end;
  2233. until false;
  2234. end;
  2235. end;
  2236. {****************************************************************************
  2237. Read Implementation Part
  2238. ****************************************************************************}
  2239. procedure readimplementation;
  2240. var
  2241. b : byte;
  2242. begin
  2243. with ppufile do
  2244. begin
  2245. repeat
  2246. b:=readentry;
  2247. case b of
  2248. ibasmsymbols :
  2249. ReadAsmSymbols;
  2250. ibloadunit :
  2251. ReadLoadUnit;
  2252. iberror :
  2253. begin
  2254. Writeln('Error in PPU');
  2255. exit;
  2256. end;
  2257. ibendimplementation :
  2258. break;
  2259. else
  2260. WriteLn('!! Skipping unsupported PPU Entry in Implementation: ',b);
  2261. end;
  2262. until false;
  2263. end;
  2264. end;
  2265. procedure dofile (filename : string);
  2266. begin
  2267. { reset }
  2268. space:='';
  2269. { fix filename }
  2270. if pos('.',filename)=0 then
  2271. filename:=filename+'.ppu';
  2272. ppufile:=tppufile.create(filename);
  2273. if not ppufile.openfile then
  2274. begin
  2275. writeln ('IO-Error when opening : ',filename,', Skipping');
  2276. exit;
  2277. end;
  2278. { PPU File is open, check for PPU Id }
  2279. if not ppufile.CheckPPUID then
  2280. begin
  2281. writeln(Filename,' : Not a valid PPU file, Skipping');
  2282. exit;
  2283. end;
  2284. { Check PPU Version }
  2285. Writeln('Analyzing ',filename,' (v',ppufile.GetPPUVersion,')');
  2286. if ppufile.GetPPUVersion<16 then
  2287. begin
  2288. writeln(Filename,' : Old PPU Formats (<v16) are not supported, Skipping');
  2289. exit;
  2290. end;
  2291. { Write PPU Header Information }
  2292. if (verbose and v_header)<>0 then
  2293. begin
  2294. Writeln;
  2295. Writeln('Header');
  2296. Writeln('-------');
  2297. with ppufile.header do
  2298. begin
  2299. Writeln('Compiler version : ',ppufile.header.compiler shr 14,'.',
  2300. (ppufile.header.compiler shr 7) and $7f,'.',
  2301. ppufile.header.compiler and $7f);
  2302. WriteLn('Target processor : ',Cpu2Str(cpu));
  2303. WriteLn('Target operating system : ',Target2Str(target));
  2304. Writeln('Unit flags : ',PPUFlags2Str(flags));
  2305. Writeln('FileSize (w/o header) : ',size);
  2306. Writeln('Checksum : ',hexstr(checksum,8));
  2307. Writeln('Interface Checksum : ',hexstr(interface_checksum,8));
  2308. Writeln('Indirect Checksum : ',hexstr(indirect_checksum,8));
  2309. Writeln('Definitions stored : ',tostr(deflistsize));
  2310. Writeln('Symbols stored : ',tostr(symlistsize));
  2311. end;
  2312. end;
  2313. {read the general stuff}
  2314. if (verbose and v_interface)<>0 then
  2315. begin
  2316. Writeln;
  2317. Writeln('Interface section');
  2318. Writeln('------------------');
  2319. readinterface;
  2320. end
  2321. else
  2322. ppufile.skipuntilentry(ibendinterface);
  2323. {read the definitions}
  2324. if (verbose and v_defs)<>0 then
  2325. begin
  2326. Writeln;
  2327. Writeln('Interface definitions');
  2328. Writeln('----------------------');
  2329. readdefinitions('interface');
  2330. end
  2331. else
  2332. ppufile.skipuntilentry(ibenddefs);
  2333. {read the symbols}
  2334. if (verbose and v_syms)<>0 then
  2335. begin
  2336. Writeln;
  2337. Writeln('Interface Symbols');
  2338. Writeln('------------------');
  2339. readsymbols('interface');
  2340. end
  2341. else
  2342. ppufile.skipuntilentry(ibendsyms);
  2343. {read the macro symbols}
  2344. if (verbose and v_syms)<>0 then
  2345. begin
  2346. Writeln;
  2347. Writeln('Interface Macro Symbols');
  2348. Writeln('-----------------------');
  2349. end;
  2350. if ppufile.readentry<>ibexportedmacros then
  2351. begin
  2352. Writeln('!! Error in PPU');
  2353. exit;
  2354. end;
  2355. if boolean(ppufile.getbyte) then
  2356. begin
  2357. {skip the definition section for macros (since they are never used) }
  2358. ppufile.skipuntilentry(ibenddefs);
  2359. {read the macro symbols}
  2360. if (verbose and v_syms)<>0 then
  2361. readsymbols('interface macro')
  2362. else
  2363. ppufile.skipuntilentry(ibendsyms);
  2364. end
  2365. else
  2366. Writeln('(no exported macros)');
  2367. {read the implementation stuff}
  2368. if (verbose and v_implementation)<>0 then
  2369. begin
  2370. Writeln;
  2371. Writeln('Implementation section');
  2372. Writeln('-----------------------');
  2373. readimplementation;
  2374. end
  2375. else
  2376. ppufile.skipuntilentry(ibendimplementation);
  2377. {read the static symtable}
  2378. if (ppufile.header.flags and uf_local_symtable)<>0 then
  2379. begin
  2380. if (verbose and v_defs)<>0 then
  2381. begin
  2382. Writeln;
  2383. Writeln('Static definitions');
  2384. Writeln('----------------------');
  2385. readdefinitions('implementation');
  2386. end
  2387. else
  2388. ppufile.skipuntilentry(ibenddefs);
  2389. {read the symbols}
  2390. if (verbose and v_syms)<>0 then
  2391. begin
  2392. Writeln;
  2393. Writeln('Static Symbols');
  2394. Writeln('------------------');
  2395. readsymbols('implementation');
  2396. end
  2397. else
  2398. ppufile.skipuntilentry(ibendsyms);
  2399. end;
  2400. ReadCreatedObjTypes;
  2401. {shutdown ppufile}
  2402. ppufile.closefile;
  2403. ppufile.free;
  2404. Writeln;
  2405. end;
  2406. procedure help;
  2407. begin
  2408. writeln('usage: ppudump [options] <filename1> <filename2>...');
  2409. writeln;
  2410. writeln('[options] can be:');
  2411. writeln(' -V<verbose> Set verbosity to <verbose>');
  2412. writeln(' H - Show header info');
  2413. writeln(' I - Show interface');
  2414. writeln(' M - Show implementation');
  2415. writeln(' S - Show interface symbols');
  2416. writeln(' D - Show interface definitions');
  2417. // writeln(' B - Show browser info');
  2418. writeln(' A - Show all');
  2419. writeln(' -h, -? This helpscreen');
  2420. halt;
  2421. end;
  2422. var
  2423. startpara,
  2424. nrfile,i : longint;
  2425. para : string;
  2426. begin
  2427. writeln(Title+' '+Version);
  2428. writeln(Copyright);
  2429. writeln;
  2430. if paramcount<1 then
  2431. begin
  2432. writeln('usage: dumpppu [options] <filename1> <filename2>...');
  2433. halt(1);
  2434. end;
  2435. { turn verbose on by default }
  2436. verbose:=v_all;
  2437. { read options }
  2438. startpara:=1;
  2439. while copy(paramstr(startpara),1,1)='-' do
  2440. begin
  2441. para:=paramstr(startpara);
  2442. case upcase(para[2]) of
  2443. 'V' : begin
  2444. verbose:=0;
  2445. for i:=3 to length(para) do
  2446. case upcase(para[i]) of
  2447. 'H' : verbose:=verbose or v_header;
  2448. 'I' : verbose:=verbose or v_interface;
  2449. 'M' : verbose:=verbose or v_implementation;
  2450. 'D' : verbose:=verbose or v_defs;
  2451. 'S' : verbose:=verbose or v_syms;
  2452. 'A' : verbose:=verbose or v_all;
  2453. end;
  2454. end;
  2455. 'H' : help;
  2456. '?' : help;
  2457. end;
  2458. inc(startpara);
  2459. end;
  2460. { process files }
  2461. for nrfile:=startpara to paramcount do
  2462. dofile (paramstr(nrfile));
  2463. if has_errors then
  2464. Halt(1);
  2465. end.