ppudump.pp 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by the FPC Development Team
  4. Dumps the contents of a FPC unit file (PPU File)
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************}
  17. {$ifdef TP}
  18. {$N+,E+}
  19. {$endif}
  20. program pppdump;
  21. uses
  22. {$ifdef go32v2}
  23. dpmiexcp,
  24. {$endif go32v2}
  25. ppu;
  26. const
  27. Version = 'Version 1.10';
  28. Title = 'PPU-Analyser';
  29. Copyright = 'Copyright (c) 1998-2000 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. var
  40. ppufile : pppufile;
  41. space : string;
  42. read_member : boolean;
  43. verbose : longint;
  44. {****************************************************************************
  45. Helper Routines
  46. ****************************************************************************}
  47. const has_errors : boolean = false;
  48. Procedure Error(const S : string);
  49. Begin
  50. Writeln(S);
  51. has_errors:=true;
  52. End;
  53. Function Target2Str(w:longint):string;
  54. type
  55. ttarget = (target_none
  56. ,target_i386_GO32V1,target_i386_GO32V2,target_i386_linux,
  57. target_i386_OS2,target_i386_Win32
  58. ,target_m68k_Amiga,target_m68k_Atari,target_m68k_Mac,
  59. target_m68k_linux,target_m68k_PalmOS
  60. );
  61. const
  62. Targets : array[ttarget] of string[10]=('none',
  63. 'GO32V1','GO32V2','Linux-i386','OS/2','Win32',
  64. 'Amiga','Mac68k','Atari','Linux-m68k','PalmOs');
  65. begin
  66. if w<=ord(high(ttarget)) then
  67. Target2Str:=Targets[ttarget(w)]
  68. else
  69. Target2Str:='<Unknown>';
  70. end;
  71. Function Cpu2Str(w:longint):string;
  72. type
  73. ttargetcpu=(no_cpu
  74. ,i386,m68k,alpha
  75. );
  76. const
  77. CpuTxt : array[ttargetcpu] of string[5]=
  78. ('none','i386','m68k','alpha');
  79. begin
  80. if w<=ord(high(ttargetcpu)) then
  81. Cpu2Str:=CpuTxt[ttargetcpu(w)]
  82. else
  83. Cpu2Str:='<Unknown>';
  84. end;
  85. function PPUFlags2Str(flags:longint):string;
  86. type
  87. tflagopt=record
  88. mask : longint;
  89. str : string[30];
  90. end;
  91. const
  92. flagopts=11;
  93. flagopt : array[1..flagopts] of tflagopt=(
  94. (mask: $1 ;str:'init'),
  95. (mask: $2 ;str:'final'),
  96. (mask: $4 ;str:'big_endian'),
  97. (mask: $8 ;str:'dbx'),
  98. (mask: $10 ;str:'browser'),
  99. (mask: $20 ;str:'in_library'),
  100. (mask: $40 ;str:'smart_linked'),
  101. (mask: $80 ;str:'static_linked'),
  102. (mask: $100 ;str:'shared_linked'),
  103. (mask: $200 ;str:'local_browser'),
  104. (mask: $400 ;str:'no_link')
  105. );
  106. var
  107. i : longint;
  108. first : boolean;
  109. s : string;
  110. begin
  111. s:='';
  112. if flags<>0 then
  113. begin
  114. first:=true;
  115. for i:=1to flagopts do
  116. if (flags and flagopt[i].mask)<>0 then
  117. begin
  118. if first then
  119. first:=false
  120. else
  121. s:=s+', ';
  122. s:=s+flagopt[i].str;
  123. end;
  124. end
  125. else
  126. s:='none';
  127. PPUFlags2Str:=s;
  128. end;
  129. const
  130. HexTbl : array[0..15] of char='0123456789ABCDEF';
  131. function HexB(b:byte):string;
  132. begin
  133. HexB[0]:=#2;
  134. HexB[1]:=HexTbl[b shr 4];
  135. HexB[2]:=HexTbl[b and $f];
  136. end;
  137. {****************************************************************************
  138. Read Routines
  139. ****************************************************************************}
  140. Procedure ReadLinkContainer(const prefix:string);
  141. {
  142. Read a serie of strings and write to the screen starting every line
  143. with prefix
  144. }
  145. function maskstr(m:longint):string;
  146. const
  147. { link options }
  148. link_none = $0;
  149. link_allways = $1;
  150. link_static = $2;
  151. link_smart = $4;
  152. link_shared = $8;
  153. var
  154. s : string;
  155. begin
  156. s:='';
  157. if (m and link_allways)<>0 then
  158. s:=s+'always ';
  159. if (m and link_static)<>0 then
  160. s:=s+'static ';
  161. if (m and link_smart)<>0 then
  162. s:=s+'smart ';
  163. if (m and link_shared)<>0 then
  164. s:=s+'shared ';
  165. maskstr:=s;
  166. end;
  167. var
  168. s : string;
  169. m : longint;
  170. begin
  171. while not ppufile^.endofentry do
  172. begin
  173. s:=ppufile^.getstring;
  174. m:=ppufile^.getlongint;
  175. WriteLn(prefix,s,' (',maskstr(m),')');
  176. end;
  177. end;
  178. Procedure ReadContainer(const prefix:string);
  179. {
  180. Read a serie of strings and write to the screen starting every line
  181. with prefix
  182. }
  183. begin
  184. while not ppufile^.endofentry do
  185. WriteLn(prefix,ppufile^.getstring);
  186. end;
  187. Procedure ReadRef;
  188. begin
  189. if (verbose and v_browser)=0 then
  190. exit;
  191. while (not ppufile^.endofentry) and (not ppufile^.error) do
  192. Writeln(space,' - Refered : ',ppufile^.getword,', (',ppufile^.getlongint,',',ppufile^.getword,')');
  193. end;
  194. Procedure ReadPosInfo;
  195. begin
  196. Writeln(ppufile^.getword,' (',ppufile^.getlongint,',',ppufile^.getword,')');
  197. end;
  198. function readderef(const s:string;skipnil:boolean):boolean;
  199. type
  200. tdereftype = (derefnil,derefaktrecordindex,derefaktstaticindex,
  201. derefunit,derefrecord,derefindex,
  202. dereflocal,derefpara,derefaktlocalindex);
  203. var
  204. b : tdereftype;
  205. begin
  206. readderef:=true;
  207. repeat
  208. b:=tdereftype(ppufile^.getbyte);
  209. case b of
  210. derefnil :
  211. begin
  212. if not skipnil then
  213. writeln('nil');
  214. readderef:=false;
  215. break;
  216. end;
  217. derefaktrecordindex :
  218. begin
  219. writeln('AktRecord ',s,' ',ppufile^.getword);
  220. break;
  221. end;
  222. derefaktstaticindex :
  223. begin
  224. writeln('AktStatic ',s,' ',ppufile^.getword);
  225. break;
  226. end;
  227. derefaktlocalindex :
  228. begin
  229. writeln('AktLocal ',s,' ',ppufile^.getword);
  230. break;
  231. end;
  232. derefunit :
  233. begin
  234. writeln('Unit ',ppufile^.getword);
  235. break;
  236. end;
  237. derefrecord :
  238. begin
  239. write('RecordDef ',ppufile^.getword,', ');
  240. end;
  241. derefpara :
  242. begin
  243. write('Parameter of procdef ',ppufile^.getword,', ');
  244. end;
  245. dereflocal :
  246. begin
  247. write('Local of procdef ',ppufile^.getword,', ');
  248. end;
  249. derefindex :
  250. begin
  251. write(s,' ',ppufile^.getword,', ');
  252. end;
  253. else
  254. begin
  255. writeln('!! unsupported dereftyp: ',ord(b));
  256. break;
  257. end;
  258. end;
  259. until false;
  260. end;
  261. function readdefref:boolean;
  262. begin
  263. readdefref:=readderef('Definition',false);
  264. end;
  265. function readsymref:boolean;
  266. begin
  267. readsymref:=readderef('Symbol',false);
  268. end;
  269. procedure readtype;
  270. var
  271. b1,b2 : boolean;
  272. begin
  273. b1:=readderef('Definition',true);
  274. b2:=readderef('Symbol',true);
  275. if not(b1 or b2) then
  276. Writeln('nil')
  277. else
  278. if (b1 and b2) then
  279. Writeln('!! Type has both definition and symbol stored');
  280. end;
  281. procedure readsymlist(const s:string);
  282. begin
  283. readdefref;
  284. repeat
  285. write(s);
  286. if not readsymref then
  287. break;
  288. until false;
  289. end;
  290. procedure read_abstract_proc_def;
  291. type
  292. tproccalloption=(pocall_none,
  293. pocall_clearstack, { Use IBM flat calling convention. (Used by GCC.) }
  294. pocall_leftright, { Push parameters from left to right }
  295. pocall_cdecl, { procedure uses C styled calling }
  296. pocall_register, { procedure uses register (fastcall) calling }
  297. pocall_stdcall, { procedure uses stdcall call }
  298. pocall_safecall, { safe call calling conventions }
  299. pocall_palmossyscall, { procedure is a PalmOS system call }
  300. pocall_system,
  301. pocall_inline, { Procedure is an assembler macro }
  302. pocall_internproc, { Procedure has compiler magic}
  303. pocall_internconst { procedure has constant evaluator intern }
  304. );
  305. tproccalloptions=set of tproccalloption;
  306. tproctypeoption=(potype_none,
  307. potype_proginit, { Program initialization }
  308. potype_unitinit, { unit initialization }
  309. potype_unitfinalize, { unit finalization }
  310. potype_constructor, { Procedure is a constructor }
  311. potype_destructor, { Procedure is a destructor }
  312. potype_operator { Procedure defines an operator }
  313. );
  314. tproctypeoptions=set of tproctypeoption;
  315. tprocoption=(po_none,
  316. po_classmethod, { class method }
  317. po_virtualmethod, { Procedure is a virtual method }
  318. po_abstractmethod, { Procedure is an abstract method }
  319. po_staticmethod, { static method }
  320. po_overridingmethod, { method with override directive }
  321. po_methodpointer, { method pointer, only in procvardef, also used for 'with object do' }
  322. po_containsself, { self is passed explicit to the compiler }
  323. po_interrupt, { Procedure is an interrupt handler }
  324. po_iocheck, { IO checking should be done after a call to the procedure }
  325. po_assembler, { Procedure is written in assembler }
  326. po_msgstr, { method for string message handling }
  327. po_msgint, { method for int message handling }
  328. po_exports, { Procedure has export directive (needed for OS/2) }
  329. po_external, { Procedure is external (in other object or lib)}
  330. po_savestdregs, { save std regs cdecl and stdcall need that ! }
  331. po_saveregisters { save all registers }
  332. );
  333. tprocoptions=set of tprocoption;
  334. type
  335. tproccallopt=record
  336. mask : tproccalloption;
  337. str : string[30];
  338. end;
  339. tproctypeopt=record
  340. mask : tproctypeoption;
  341. str : string[30];
  342. end;
  343. tprocopt=record
  344. mask : tprocoption;
  345. str : string[30];
  346. end;
  347. const
  348. proccallopts=12;
  349. proccallopt : array[1..proccallopts] of tproccallopt=(
  350. (mask:pocall_none; str:''),
  351. (mask:pocall_clearstack; str:'ClearStack'),
  352. (mask:pocall_leftright; str:'LeftRight'),
  353. (mask:pocall_cdecl; str:'Cdecl'),
  354. (mask:pocall_register; str:'Register'),
  355. (mask:pocall_stdcall; str:'StdCall'),
  356. (mask:pocall_safecall; str:'SafeCall'),
  357. (mask:pocall_palmossyscall;str:'PalmOSSysCall'),
  358. (mask:pocall_system; str:'System'),
  359. (mask:pocall_inline; str:'Inline'),
  360. (mask:pocall_internproc; str:'InternProc'),
  361. (mask:pocall_internconst; str:'InternConst')
  362. );
  363. proctypeopts=6;
  364. proctypeopt : array[1..proctypeopts] of tproctypeopt=(
  365. (mask:potype_proginit; str:'ProgInit'),
  366. (mask:potype_unitinit; str:'UnitInit'),
  367. (mask:potype_unitfinalize;str:'UnitFinalize'),
  368. (mask:potype_constructor; str:'Constructor'),
  369. (mask:potype_destructor; str:'Destructor'),
  370. (mask:potype_operator; str:'Operator')
  371. );
  372. procopts=16;
  373. procopt : array[1..procopts] of tprocopt=(
  374. (mask:po_classmethod; str:'ClassMethod'),
  375. (mask:po_virtualmethod; str:'VirtualMethod'),
  376. (mask:po_abstractmethod; str:'AbstractMethod'),
  377. (mask:po_staticmethod; str:'StaticMethod'),
  378. (mask:po_overridingmethod;str:'OverridingMethod'),
  379. (mask:po_methodpointer; str:'MethodPointer'),
  380. (mask:po_containsself; str:'ContainsSelf'),
  381. (mask:po_interrupt; str:'Interrupt'),
  382. (mask:po_iocheck; str:'IOCheck'),
  383. (mask:po_assembler; str:'Assembler'),
  384. (mask:po_msgstr; str:'MsgStr'),
  385. (mask:po_msgint; str:'MsgInt'),
  386. (mask:po_exports; str:'Exports'),
  387. (mask:po_external; str:'External'),
  388. (mask:po_savestdregs; str:'SaveStdRegs'),
  389. (mask:po_saveregisters; str:'SaveRegisters')
  390. );
  391. tvarspez : array[0..2] of string[5]=('Value','Const','Var ');
  392. var
  393. proctypeoption : tproctypeoption;
  394. proccalloptions : tproccalloptions;
  395. procoptions : tprocoptions;
  396. i,params : longint;
  397. first : boolean;
  398. begin
  399. write(space,' Return type : ');
  400. readtype;
  401. writeln(space,' Fpu used : ',ppufile^.getbyte);
  402. proctypeoption:=tproctypeoption(ppufile^.getlongint);
  403. if proctypeoption<>potype_none then
  404. begin
  405. write(space,' TypeOption : ');
  406. first:=true;
  407. for i:=1to proctypeopts do
  408. if (proctypeopt[i].mask=proctypeoption) then
  409. begin
  410. if first then
  411. first:=false
  412. else
  413. write(', ');
  414. write(proctypeopt[i].str);
  415. end;
  416. writeln;
  417. end;
  418. ppufile^.getsmallset(proccalloptions);
  419. if proccalloptions<>[] then
  420. begin
  421. write(space,' CallOptions : ');
  422. first:=true;
  423. for i:=1to proccallopts do
  424. if (proccallopt[i].mask in proccalloptions) then
  425. begin
  426. if first then
  427. first:=false
  428. else
  429. write(', ');
  430. write(proccallopt[i].str);
  431. end;
  432. writeln;
  433. end;
  434. ppufile^.getsmallset(procoptions);
  435. if procoptions<>[] then
  436. begin
  437. write(space,' Options : ');
  438. first:=true;
  439. for i:=1to procopts do
  440. if (procopt[i].mask in procoptions) then
  441. begin
  442. if first then
  443. first:=false
  444. else
  445. write(', ');
  446. write(procopt[i].str);
  447. end;
  448. writeln;
  449. end;
  450. params:=ppufile^.getword;
  451. writeln(space,' Nr of parameters : ',params);
  452. if params>0 then
  453. begin
  454. repeat
  455. write(space,' - ',tvarspez[ppufile^.getbyte],' : ');
  456. readtype;
  457. write(space,' Default : ');
  458. readsymref;
  459. dec(params);
  460. until params=0;
  461. end;
  462. end;
  463. procedure readcommonsym(const s:string);
  464. type
  465. tsymoption=(sp_none,
  466. sp_public,
  467. sp_private,
  468. sp_published,
  469. sp_protected,
  470. sp_forwarddef,
  471. sp_static,
  472. sp_primary_typesym { this is for typesym, to know who is the primary symbol of a def }
  473. );
  474. tsymoptions=set of tsymoption;
  475. tsymopt=record
  476. mask : tsymoption;
  477. str : string[30];
  478. end;
  479. const
  480. symopts=7;
  481. symopt : array[1..symopts] of tsymopt=(
  482. (mask:sp_public; str:'Public'),
  483. (mask:sp_private; str:'Private'),
  484. (mask:sp_published; str:'Published'),
  485. (mask:sp_protected; str:'Protected'),
  486. (mask:sp_forwarddef; str:'ForwardDef'),
  487. (mask:sp_static; str:'Static'),
  488. (mask:sp_primary_typesym;str:'PrimaryTypeSym')
  489. );
  490. var
  491. symoptions : tsymoptions;
  492. i : longint;
  493. first : boolean;
  494. begin
  495. writeln(space,'** Symbol Nr. ',ppufile^.getword,' **');
  496. writeln(space,s,ppufile^.getstring);
  497. ppufile^.getsmallset(symoptions);
  498. if symoptions<>[] then
  499. begin
  500. write(space,' File Pos: ');
  501. readposinfo;
  502. write(space,' Options: ');
  503. first:=true;
  504. for i:=1to symopts do
  505. if (symopt[i].mask in symoptions) then
  506. begin
  507. if first then
  508. first:=false
  509. else
  510. write(', ');
  511. write(symopt[i].str);
  512. end;
  513. writeln;
  514. end;
  515. end;
  516. procedure readcommondef(const s:string);
  517. begin
  518. writeln(space,'** Definition Nr. ',ppufile^.getword,' **');
  519. writeln(space,s);
  520. write (space,' Type symbol : ');
  521. readsymref;
  522. end;
  523. {****************************************************************************
  524. Read Symbols Part
  525. ****************************************************************************}
  526. procedure readsymbols;
  527. Const
  528. vo_is_C_var = 2;
  529. Type
  530. absolutetyp = (tovar,toasm,toaddr);
  531. tconsttyp = (constnone,
  532. constord,conststring,constreal,constbool,
  533. constint,constchar,constset,constpointer,constnil,
  534. constresourcestring
  535. );
  536. var
  537. b : byte;
  538. pc : pchar;
  539. totalsyms,
  540. symcnt,
  541. i,j,len : longint;
  542. begin
  543. symcnt:=1;
  544. with ppufile^ do
  545. begin
  546. if space<>'' then
  547. Writeln(space,'-----------------------------');
  548. if readentry=ibstartsyms then
  549. begin
  550. totalsyms:=getlongint;
  551. Writeln(space,'Number of symbols : ',totalsyms);
  552. Writeln(space,'Symtable datasize : ',getlongint);
  553. Writeln(space,'Symtable alignment: ',getlongint);
  554. end
  555. else
  556. begin
  557. totalsyms:=-1;
  558. Writeln('!! ibstartsym not found');
  559. end;
  560. repeat
  561. b:=readentry;
  562. if not (b in [iberror,ibendsyms]) then
  563. inc(symcnt);
  564. case b of
  565. ibunitsym :
  566. readcommonsym('Unit symbol ');
  567. iblabelsym :
  568. readcommonsym('Label symbol ');
  569. ibtypesym :
  570. begin
  571. readcommonsym('Type symbol ');
  572. write(space,' Result Type: ');
  573. readtype;
  574. end;
  575. ibprocsym :
  576. begin
  577. readcommonsym('Procedure symbol ');
  578. write(space,' Definition: ');
  579. readdefref;
  580. end;
  581. ibconstsym :
  582. begin
  583. readcommonsym('Constant symbol ');
  584. b:=getbyte;
  585. case tconsttyp(b) of
  586. constord :
  587. begin
  588. write (space,' Ordinal Type : ');
  589. readtype;
  590. writeln (space,' Value : ',getlongint)
  591. end;
  592. constpointer :
  593. begin
  594. write (space,' Pointer Type : ');
  595. readtype;
  596. writeln (space,' Value : ',getlongint)
  597. end;
  598. conststring,
  599. constresourcestring :
  600. begin
  601. len:=getlongint;
  602. getmem(pc,len+1);
  603. getdata(pc^,len);
  604. writeln(space,' Length : ',len);
  605. writeln(space,' Value : "',pc,'"');
  606. freemem(pc,len+1);
  607. if tconsttyp(b)=constresourcestring then
  608. writeln(space,' Index : ',getlongint);
  609. end;
  610. constreal :
  611. writeln(space,' Value : ',getreal);
  612. constbool :
  613. if getlongint<>0 then
  614. writeln (space,' Value : True')
  615. else
  616. writeln (space,' Value : False');
  617. constint :
  618. writeln(space,' Value : ',getlongint);
  619. constchar :
  620. writeln(space,' Value : "'+chr(getlongint)+'"');
  621. constset :
  622. begin
  623. write (space,' Set Type : ');
  624. readtype;
  625. for i:=1to 4 do
  626. begin
  627. write (space,' Value : ');
  628. for j:=1to 8 do
  629. begin
  630. if j>1 then
  631. write(',');
  632. write(hexb(getbyte));
  633. end;
  634. writeln;
  635. end;
  636. end;
  637. else
  638. Writeln ('!! Invalid unit format : Invalid const type encountered: ',b);
  639. end;
  640. end;
  641. ibvarsym :
  642. begin
  643. readcommonsym('Variable symbol ');
  644. writeln(space,' Type: ',getbyte);
  645. if read_member then
  646. writeln(space,' Address: ',getlongint);
  647. write (space,' Var Type: ');
  648. readtype;
  649. i:=getlongint;
  650. writeln(space,' Options: ',i);
  651. if (i and vo_is_C_var)<>0 then
  652. writeln(space,' Mangledname: ',getstring);
  653. end;
  654. ibenumsym :
  655. begin
  656. readcommonsym('Enumeration symbol ');
  657. write (space,' Definition: ');
  658. readdefref;
  659. writeln(space,' Value: ',getlongint);
  660. end;
  661. ibsyssym :
  662. begin
  663. readcommonsym('Internal system symbol ');
  664. writeln(space,' Internal Nr: ',getlongint);
  665. end;
  666. ibtypedconstsym :
  667. begin
  668. readcommonsym('Typed constant ');
  669. write (space,' Constant Type: ');
  670. readtype;
  671. writeln(space,' Label: ',getstring);
  672. writeln(space,' ReallyConst: ',(getbyte<>0));
  673. end;
  674. ibabsolutesym :
  675. begin
  676. readcommonsym('Absolute variable symbol ');
  677. writeln(space,' Type: ',getbyte);
  678. if read_member then
  679. writeln(space,' Address: ',getlongint);
  680. write (space,' Var Type: ');
  681. readtype;
  682. writeln(space,' Options: ',getlongint);
  683. Write (space,' Relocated to ');
  684. b:=getbyte;
  685. case absolutetyp(b) of
  686. tovar :
  687. Writeln('Name : ',getstring);
  688. toasm :
  689. Writeln('Assembler name : ',getstring);
  690. toaddr :
  691. begin
  692. Write('Address : ',getlongint);
  693. WriteLn(' (Far: ',getbyte<>0,')');
  694. end;
  695. else
  696. Writeln ('!! Invalid unit format : Invalid absolute type encountered: ',b);
  697. end;
  698. end;
  699. ibpropertysym :
  700. begin
  701. readcommonsym('Property ');
  702. write (space,' Prop Type: ');
  703. readtype;
  704. writeln(space,' Options: ',getlongint);
  705. writeln(space,' Index: ',getlongint);
  706. writeln(space,' Default: ',getlongint);
  707. write (space,' Index Type: ');
  708. readtype;
  709. write (space,' Read access: ');
  710. readsymlist(space+' Sym: ');
  711. write (space,' Write access: ');
  712. readsymlist(space+' Sym: ');
  713. write (space,' Stored access: ');
  714. readsymlist(space+' Sym: ');
  715. end;
  716. ibfuncretsym :
  717. begin
  718. readcommonsym('Func return value ');
  719. write (space,' Return Type: ');
  720. readtype;
  721. writeln(space,' Address: ',getlongint);
  722. end;
  723. iberror :
  724. begin
  725. Writeln('!! Error in PPU');
  726. exit;
  727. end;
  728. ibendsyms :
  729. break;
  730. else
  731. WriteLn('!! Skipping unsupported PPU Entry in Symbols: ',b);
  732. end;
  733. if not EndOfEntry then
  734. Writeln('!! Entry has more information stored');
  735. until false;
  736. if (totalsyms<>-1) and (symcnt-1<>totalsyms) then
  737. Writeln('!! Only read ',symcnt-1,' of ',totalsyms,' symbols');
  738. end;
  739. end;
  740. {****************************************************************************
  741. Read defintions Part
  742. ****************************************************************************}
  743. procedure readdefinitions(start_read : boolean);
  744. type
  745. tsettype = (normset,smallset,varset);
  746. tbasetype = (
  747. uauto,uvoid,uchar,
  748. u8bit,u16bit,u32bit,
  749. s8bit,s16bit,s32bit,
  750. bool8bit,bool16bit,bool32bit,
  751. u64bit,s64bit,uwidechar
  752. );
  753. tobjectdeftype = (odt_none,
  754. odt_class,
  755. odt_object,
  756. odt_interfacecom,
  757. odt_interfacecorba,
  758. odt_cppclass
  759. );
  760. var
  761. b : byte;
  762. oldread_member : boolean;
  763. totaldefs,l,j,
  764. defcnt : longint;
  765. begin
  766. defcnt:=0;
  767. with ppufile^ do
  768. begin
  769. if space<>'' then
  770. Writeln(space,'-----------------------------');
  771. if not start_read then
  772. if readentry=ibstartdefs then
  773. begin
  774. totaldefs:=getlongint;
  775. Writeln(space,'Number of definitions: ',totaldefs);
  776. end
  777. else
  778. begin
  779. totaldefs:=-1;
  780. Writeln('!! ibstartdef not found');
  781. end;
  782. repeat
  783. b:=readentry;
  784. if not (b in [iberror,ibenddefs]) then
  785. inc(defcnt);
  786. case b of
  787. ibpointerdef :
  788. begin
  789. readcommondef('Pointer definition');
  790. write (space,' Pointed Type : ');
  791. readtype;
  792. writeln(space,' Is Far : ',(getbyte<>0));
  793. end;
  794. iborddef :
  795. begin
  796. readcommondef('Ordinal definition');
  797. write (space,' Base type : ');
  798. b:=getbyte;
  799. case tbasetype(b) of
  800. uauto : writeln('uauto');
  801. uvoid : writeln('uvoid');
  802. uchar : writeln('uchar');
  803. u8bit : writeln('u8bit');
  804. u16bit : writeln('u16bit');
  805. u32bit : writeln('s32bit');
  806. s8bit : writeln('s8bit');
  807. s16bit : writeln('s16bit');
  808. s32bit : writeln('s32bit');
  809. bool8bit : writeln('bool8bit');
  810. bool16bit : writeln('bool16bit');
  811. bool32bit : writeln('bool32bit');
  812. u64bit : writeln('u64bit');
  813. s64bit : writeln('s64bit');
  814. uwidechar : writeln('uwidechar');
  815. else writeln('!! Warning: Invalid base type ',b);
  816. end;
  817. writeln(space,' Range : ',getlongint,' to ',getlongint);
  818. end;
  819. ibfloatdef :
  820. begin
  821. readcommondef('Float definition');
  822. writeln(space,' Float type : ',getbyte);
  823. end;
  824. ibarraydef :
  825. begin
  826. readcommondef('Array definition');
  827. write (space,' Element type : ');
  828. readtype;
  829. write (space,' Range Type : ');
  830. readtype;
  831. writeln(space,' Range : ',getlongint,' to ',getlongint);
  832. writeln(space,' Is Constructor : ',(getbyte<>0));
  833. end;
  834. ibprocdef :
  835. begin
  836. readcommondef('Procedure definition');
  837. read_abstract_proc_def;
  838. writeln(space,' Used Register : ',getbyte);
  839. writeln(space,' Mangled name : ',getstring);
  840. writeln(space,' Number : ',getlongint);
  841. write (space,' Next : ');
  842. readdefref;
  843. write (space,' Class : ');
  844. readdefref;
  845. write (space,' File Pos : ');
  846. readposinfo;
  847. space:=' '+space;
  848. { parast }
  849. readdefinitions(false);
  850. readsymbols;
  851. { localst }
  852. {readdefinitions(false);
  853. readsymbols;}
  854. delete(space,1,4);
  855. end;
  856. ibprocvardef :
  857. begin
  858. readcommondef('Procedural type (ProcVar) definition');
  859. read_abstract_proc_def;
  860. end;
  861. ibshortstringdef :
  862. begin
  863. readcommondef('ShortString definition');
  864. writeln(space,' Length : ',getbyte);
  865. end;
  866. ibwidestringdef :
  867. begin
  868. readcommondef('WideString definition');
  869. writeln(space,' Length : ',getlongint);
  870. end;
  871. ibansistringdef :
  872. begin
  873. readcommondef('AnsiString definition');
  874. writeln(space,' Length : ',getlongint);
  875. end;
  876. iblongstringdef :
  877. begin
  878. readcommondef('Longstring definition');
  879. writeln(space,' Length : ',getlongint);
  880. end;
  881. ibrecorddef :
  882. begin
  883. readcommondef('Record definition');
  884. writeln(space,' Size : ',getlongint);
  885. {read the record definitions and symbols}
  886. space:=' '+space;
  887. oldread_member:=read_member;
  888. read_member:=true;
  889. readdefinitions(false);
  890. readsymbols;
  891. read_member:=oldread_member;
  892. Delete(space,1,4);
  893. end;
  894. ibobjectdef :
  895. begin
  896. readcommondef('Object/Class definition');
  897. b:=getbyte;
  898. write (space,' Type : ');
  899. case tobjectdeftype(b) of
  900. odt_class : writeln('class');
  901. odt_object : writeln('object');
  902. odt_interfacecom : writeln('interfacecom');
  903. odt_interfacecorba : writeln('interfacecorba');
  904. odt_cppclass : writeln('cppclass');
  905. else writeln('!! Warning: Invalid object type ',b);
  906. end;
  907. writeln(space,' Size : ',getlongint);
  908. writeln(space,' Vmt offset : ',getlongint);
  909. writeln(space,' Name of Class : ',getstring);
  910. write(space, ' Ancestor Class : ');
  911. readdefref;
  912. writeln(space,' Options : ',getlongint);
  913. writeln(space,' Has RTTI : ',(getbyte<>0));
  914. if tobjectdeftype(b) in [odt_interfacecom,odt_interfacecorba] then
  915. begin
  916. writeln(space,' GUID Valid : ',(getbyte<>0));
  917. { IIDGUID }
  918. for j:=1to 16 do
  919. getbyte;
  920. writeln(space,' IID String : ',getstring);
  921. writeln(space,' Last VTable idx : ',getlongint);
  922. end;
  923. if tobjectdeftype(b) in [odt_class,odt_interfacecorba] then
  924. begin
  925. l:=getlongint;
  926. writeln(space,' Impl Intf Count : ',l);
  927. for j:=1 to l do
  928. begin
  929. write (space,' - Definition : ');
  930. readdefref;
  931. writeln(space,' IOffset : ',getlongint);
  932. end;
  933. end;
  934. {read the record definitions and symbols}
  935. space:=' '+space;
  936. oldread_member:=read_member;
  937. read_member:=true;
  938. readdefinitions(false);
  939. readsymbols;
  940. read_member:=oldread_member;
  941. Delete(space,1,4);
  942. end;
  943. ibfiledef :
  944. begin
  945. ReadCommonDef('File definition');
  946. write (space,' Type : ');
  947. case getbyte of
  948. 0 : writeln('Text');
  949. 1 : begin
  950. writeln('Typed');
  951. write (space,' File of Type : ');
  952. Readtype;
  953. end;
  954. 2 : writeln('Untyped');
  955. end;
  956. end;
  957. ibformaldef :
  958. readcommondef('Generic Definition (void-typ)');
  959. ibenumdef :
  960. begin
  961. readcommondef('Enumeration type definition');
  962. write(space,'Base enumeration type : ');
  963. readdefref;
  964. writeln(space,' Smallest element : ',getlongint);
  965. writeln(space,' Largest element : ',getlongint);
  966. writeln(space,' Size : ',getlongint);
  967. end;
  968. ibclassrefdef :
  969. begin
  970. readcommondef('Class reference definition');
  971. write (space,' Pointed Type : ');
  972. readtype;
  973. end;
  974. ibsetdef :
  975. begin
  976. readcommondef('Set definition');
  977. write (space,' Element type : ');
  978. readtype;
  979. b:=getbyte;
  980. case tsettype(b) of
  981. smallset : writeln(space,' Set with 32 Elements');
  982. normset : writeln(space,' Set with 256 Elements');
  983. varset : writeln(space,' Set with ',getlongint,' Elements');
  984. else writeln('!! Warning: Invalid set type ',b);
  985. end;
  986. end;
  987. iberror :
  988. begin
  989. Writeln('!! Error in PPU');
  990. exit;
  991. end;
  992. ibenddefs :
  993. break;
  994. else
  995. WriteLn('!! Skipping unsupported PPU Entry in definitions: ',b);
  996. end;
  997. if not EndOfEntry then
  998. Writeln('!! Entry has more information stored');
  999. until false;
  1000. if (totaldefs<>-1) and (defcnt<>totaldefs) then
  1001. Writeln('!! Only read ',defcnt,' of ',totaldefs,' definitions');
  1002. end;
  1003. end;
  1004. {****************************************************************************
  1005. Read General Part
  1006. ****************************************************************************}
  1007. procedure readinterface;
  1008. var
  1009. b : byte;
  1010. sourcenumber,
  1011. unitnumber : word;
  1012. ucrc,uintfcrc : longint;
  1013. begin
  1014. with ppufile^ do
  1015. begin
  1016. repeat
  1017. b:=readentry;
  1018. case b of
  1019. ibmodulename :
  1020. Writeln('Module Name: ',getstring);
  1021. ibsourcefiles :
  1022. begin
  1023. sourcenumber:=1;
  1024. while not EndOfEntry do
  1025. begin
  1026. Writeln('Source file ',sourcenumber,' : ',getstring);
  1027. inc(sourcenumber);
  1028. end;
  1029. end;
  1030. ibusedmacros :
  1031. begin
  1032. while not EndOfEntry do
  1033. begin
  1034. Write('Conditional ',getstring);
  1035. b:=getbyte;
  1036. if boolean(b)=true then
  1037. write(' defined at startup')
  1038. else
  1039. write(' not defined at startup');
  1040. b:=getbyte;
  1041. if boolean(b)=true then
  1042. writeln(' was used')
  1043. else
  1044. writeln;
  1045. end;
  1046. end;
  1047. ibloadunit :
  1048. begin
  1049. unitnumber:=1;
  1050. while not EndOfEntry do
  1051. begin
  1052. write('Uses unit: ',getstring,' (Number: ',unitnumber,')');
  1053. ucrc:=getlongint;
  1054. uintfcrc:=getlongint;
  1055. write(' (Crc: ',ucrc,', IntfcCrc: ',uintfcrc,')');
  1056. if getbyte<>0 then
  1057. writeln(' (interface)')
  1058. else
  1059. writeln(' (implementation)');
  1060. inc(unitnumber);
  1061. end;
  1062. end;
  1063. iblinkunitofiles :
  1064. ReadLinkContainer('Link unit object file: ');
  1065. iblinkunitstaticlibs :
  1066. ReadLinkContainer('Link unit static lib: ');
  1067. iblinkunitsharedlibs :
  1068. ReadLinkContainer('Link unit shared lib: ');
  1069. iblinkotherofiles :
  1070. ReadLinkContainer('Link other object file: ');
  1071. iblinkotherstaticlibs :
  1072. ReadLinkContainer('Link other static lib: ');
  1073. iblinkothersharedlibs :
  1074. ReadLinkContainer('Link other shared lib: ');
  1075. iberror :
  1076. begin
  1077. Writeln('Error in PPU');
  1078. exit;
  1079. end;
  1080. ibendinterface :
  1081. break;
  1082. else
  1083. WriteLn('!! Skipping unsupported PPU Entry in General Part: ',b);
  1084. end;
  1085. until false;
  1086. end;
  1087. end;
  1088. {****************************************************************************
  1089. Read Implementation Part
  1090. ****************************************************************************}
  1091. procedure readimplementation;
  1092. var
  1093. b : byte;
  1094. begin
  1095. with ppufile^ do
  1096. begin
  1097. repeat
  1098. b:=readentry;
  1099. case b of
  1100. iberror :
  1101. begin
  1102. Writeln('Error in PPU');
  1103. exit;
  1104. end;
  1105. ibendimplementation :
  1106. break;
  1107. else
  1108. WriteLn('!! Skipping unsupported PPU Entry in Implementation: ',b);
  1109. end;
  1110. until false;
  1111. end;
  1112. end;
  1113. {****************************************************************************
  1114. Read Browser Part
  1115. ****************************************************************************}
  1116. procedure readbrowser;
  1117. var
  1118. b : byte;
  1119. const indent : string = '';
  1120. begin
  1121. Writeln(indent,'Start of symtable browser');
  1122. indent:=indent+'**';
  1123. with ppufile^ do
  1124. begin
  1125. repeat
  1126. b:=readentry;
  1127. case b of
  1128. ibbeginsymtablebrowser :
  1129. { here we must read object and record symtables !! }
  1130. begin
  1131. indent:=indent+' ';
  1132. Writeln(indent,'Record/Object symtable');
  1133. readbrowser;
  1134. Indent:=Copy(Indent,1,Length(Indent)-2);
  1135. end;
  1136. ibsymref : begin
  1137. readsymref;
  1138. readref;
  1139. end;
  1140. ibdefref : begin
  1141. readdefref;
  1142. readref;
  1143. if (ppufile^.header.flags and uf_local_browser)<>0 then
  1144. begin
  1145. { parast and localst }
  1146. indent:=indent+' ';
  1147. Writeln(indent,'Parasymtable for function');
  1148. readdefinitions(false);
  1149. readsymbols;
  1150. b:=ppufile^.readentry;
  1151. if b=ibbeginsymtablebrowser then
  1152. readbrowser;
  1153. Writeln(indent,'Localsymtable for function');
  1154. readdefinitions(false);
  1155. readsymbols;
  1156. b:=ppufile^.readentry;
  1157. if b=ibbeginsymtablebrowser then
  1158. readbrowser;
  1159. Indent:=Copy(Indent,1,Length(Indent)-2);
  1160. end;
  1161. end;
  1162. iberror : begin
  1163. Writeln('Error in PPU');
  1164. exit;
  1165. end;
  1166. ibendsymtablebrowser : break;
  1167. else
  1168. begin
  1169. WriteLn('!! Skipping unsupported PPU Entry in Browser: ',b);
  1170. Halt;
  1171. end;
  1172. end;
  1173. until false;
  1174. end;
  1175. Indent:=Copy(Indent,1,Length(Indent)-2);
  1176. Writeln(Indent,'End of symtable browser');
  1177. end;
  1178. procedure dofile (filename : string);
  1179. var
  1180. b,unitindex : byte;
  1181. begin
  1182. { reset }
  1183. space:='';
  1184. { fix filename }
  1185. if pos('.',filename)=0 then
  1186. filename:=filename+'.ppu';
  1187. ppufile:=new(pppufile,Init(filename));
  1188. if not ppufile^.open then
  1189. begin
  1190. writeln ('IO-Error when opening : ',filename,', Skipping');
  1191. exit;
  1192. end;
  1193. { PPU File is open, check for PPU Id }
  1194. if not ppufile^.CheckPPUID then
  1195. begin
  1196. writeln(Filename,' : Not a valid PPU file, Skipping');
  1197. exit;
  1198. end;
  1199. { Check PPU Version }
  1200. Writeln('Analyzing ',filename,' (v',ppufile^.GetPPUVersion,')');
  1201. if ppufile^.GetPPUVersion<16 then
  1202. begin
  1203. writeln(Filename,' : Old PPU Formats (<v16) are not supported, Skipping');
  1204. exit;
  1205. end;
  1206. { Write PPU Header Information }
  1207. if (verbose and v_header)<>0 then
  1208. begin
  1209. Writeln;
  1210. Writeln('Header');
  1211. Writeln('-------');
  1212. with ppufile^.header do
  1213. begin
  1214. Writeln('Compiler version : ',hi(ppufile^.header.compiler and $ff),'.',lo(ppufile^.header.compiler));
  1215. WriteLn('Target processor : ',Cpu2Str(cpu));
  1216. WriteLn('Target operating system : ',Target2Str(target));
  1217. Writeln('Unit flags : ',PPUFlags2Str(flags));
  1218. Writeln('FileSize (w/o header) : ',size);
  1219. Writeln('Checksum : ',checksum);
  1220. Writeln('Interface Checksum : ',interface_checksum);
  1221. end;
  1222. end;
  1223. {read the general stuff}
  1224. if (verbose and v_interface)<>0 then
  1225. begin
  1226. Writeln;
  1227. Writeln('Interface section');
  1228. Writeln('------------------');
  1229. readinterface;
  1230. end
  1231. else
  1232. ppufile^.skipuntilentry(ibendinterface);
  1233. {read the definitions}
  1234. if (verbose and v_defs)<>0 then
  1235. begin
  1236. Writeln;
  1237. Writeln('Interface definitions');
  1238. Writeln('----------------------');
  1239. readdefinitions(false);
  1240. end
  1241. else
  1242. ppufile^.skipuntilentry(ibenddefs);
  1243. {read the symbols}
  1244. if (verbose and v_syms)<>0 then
  1245. begin
  1246. Writeln;
  1247. Writeln('Interface Symbols');
  1248. Writeln('------------------');
  1249. readsymbols;
  1250. end
  1251. else
  1252. ppufile^.skipuntilentry(ibendsyms);
  1253. {read the implementation stuff}
  1254. { Not used at the moment (PFV)
  1255. if (verbose and v_implementation)<>0 then
  1256. begin
  1257. Writeln;
  1258. Writeln('Implementation section');
  1259. Writeln('-----------------------');
  1260. readimplementation;
  1261. end
  1262. else}
  1263. ppufile^.skipuntilentry(ibendimplementation);
  1264. {read the static browser units stuff}
  1265. if (ppufile^.header.flags and uf_local_browser)<>0 then
  1266. begin
  1267. if (verbose and v_defs)<>0 then
  1268. begin
  1269. Writeln;
  1270. Writeln('Static definitions');
  1271. Writeln('----------------------');
  1272. readdefinitions(false);
  1273. end
  1274. else
  1275. ppufile^.skipuntilentry(ibenddefs);
  1276. {read the symbols}
  1277. if (verbose and v_syms)<>0 then
  1278. begin
  1279. Writeln;
  1280. Writeln('Static Symbols');
  1281. Writeln('------------------');
  1282. readsymbols;
  1283. end;
  1284. end;
  1285. {read the browser units stuff}
  1286. if (ppufile^.header.flags and uf_has_browser)<>0 then
  1287. begin
  1288. if (verbose and v_browser)<>0 then
  1289. begin
  1290. Writeln;
  1291. Writeln('Browser section');
  1292. Writeln('---------------');
  1293. UnitIndex:=0;
  1294. repeat
  1295. b:=ppufile^.readentry;
  1296. if b = ibendbrowser then break;
  1297. if b=ibbeginsymtablebrowser then
  1298. begin
  1299. Writeln('Unit ',UnitIndex);
  1300. readbrowser;
  1301. Inc(UnitIndex);
  1302. end
  1303. else
  1304. Writeln('Wrong end browser entry ',b,' should be ',ibendbrowser);
  1305. until false;
  1306. end;
  1307. end;
  1308. {read the static browser units stuff}
  1309. if (ppufile^.header.flags and uf_local_browser)<>0 then
  1310. begin
  1311. if (verbose and v_browser)<>0 then
  1312. begin
  1313. Writeln;
  1314. Writeln('Static browser section');
  1315. Writeln('---------------');
  1316. b:=ppufile^.readentry;
  1317. if b=ibbeginsymtablebrowser then
  1318. begin
  1319. Writeln('Unit ',UnitIndex);
  1320. readbrowser;
  1321. Inc(UnitIndex);
  1322. end
  1323. else
  1324. Writeln('Wrong end browser entry ',b,' should be ',ibendbrowser);
  1325. end;
  1326. end;
  1327. {shutdown ppufile}
  1328. ppufile^.close;
  1329. dispose(ppufile,done);
  1330. Writeln;
  1331. end;
  1332. procedure help;
  1333. begin
  1334. writeln('usage: ppudump [options] <filename1> <filename2>...');
  1335. writeln;
  1336. writeln('[options] can be:');
  1337. writeln(' -V<verbose> Set verbosity to <verbose>');
  1338. writeln(' H - Show header info');
  1339. writeln(' I - Show interface');
  1340. writeln(' M - Show implementation');
  1341. writeln(' S - Show interface symbols');
  1342. writeln(' D - Show interface definitions');
  1343. writeln(' B - Show browser info');
  1344. writeln(' A - Show all');
  1345. writeln(' -? This helpscreen');
  1346. halt;
  1347. end;
  1348. var
  1349. startpara,
  1350. nrfile,i : longint;
  1351. para : string;
  1352. begin
  1353. writeln(Title+' '+Version);
  1354. writeln(Copyright);
  1355. writeln;
  1356. if paramcount<1 then
  1357. begin
  1358. writeln('usage: dumpppu [options] <filename1> <filename2>...');
  1359. halt(1);
  1360. end;
  1361. { turn verbose on by default }
  1362. verbose:=v_all;
  1363. { read options }
  1364. startpara:=1;
  1365. while copy(paramstr(startpara),1,1)='-' do
  1366. begin
  1367. para:=paramstr(startpara);
  1368. case upcase(para[2]) of
  1369. 'V' : begin
  1370. verbose:=0;
  1371. for i:=3to length(para) do
  1372. case upcase(para[i]) of
  1373. 'H' : verbose:=verbose or v_header;
  1374. 'I' : verbose:=verbose or v_interface;
  1375. 'M' : verbose:=verbose or v_implementation;
  1376. 'D' : verbose:=verbose or v_defs;
  1377. 'S' : verbose:=verbose or v_syms;
  1378. 'B' : verbose:=verbose or v_browser;
  1379. 'A' : verbose:=verbose or v_all;
  1380. end;
  1381. end;
  1382. '?' : help;
  1383. end;
  1384. inc(startpara);
  1385. end;
  1386. { process files }
  1387. for nrfile:=startpara to paramcount do
  1388. dofile (paramstr(nrfile));
  1389. if has_errors then
  1390. Halt(1);
  1391. end.
  1392. {
  1393. $Log$
  1394. Revision 1.4 2001-04-04 22:42:59 peter
  1395. * updated for new objectdef with interfaces
  1396. Revision 1.3 2000/09/09 19:46:40 peter
  1397. * show dataalignment
  1398. Revision 1.2 2000/08/13 12:58:06 peter
  1399. * updated for ppu additions
  1400. Revision 1.1 2000/07/13 10:16:22 michael
  1401. + Initial import
  1402. Revision 1.15 2000/07/04 19:05:54 peter
  1403. * be optimistic: version 1.00 for some utils
  1404. Revision 1.14 2000/02/09 16:44:14 peter
  1405. * log truncated
  1406. Revision 1.13 2000/01/23 16:34:36 peter
  1407. * updated for new aktlocalindex
  1408. Revision 1.12 2000/01/07 16:46:03 daniel
  1409. * copyright 2000
  1410. Revision 1.11 1999/11/30 10:35:37 peter
  1411. * support new readtype
  1412. Revision 1.10 1999/11/08 14:06:45 florian
  1413. + indexref of propertysym is handle too now
  1414. Revision 1.9 1999/08/31 16:07:37 pierre
  1415. + support for writeusedmacros
  1416. Revision 1.8 1999/08/15 10:47:14 peter
  1417. * updates for new options
  1418. Revision 1.7 1999/08/13 21:25:35 peter
  1419. * updated flags
  1420. Revision 1.6 1999/07/27 23:45:29 peter
  1421. * updated for typesym writing
  1422. }