ppudump.pp 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 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. dos,
  23. ppu;
  24. const
  25. Version = 'Version 1.10';
  26. Title = 'PPU-Analyser';
  27. Copyright = 'Copyright (c) 1998-2002 by the Free Pascal Development Team';
  28. { verbosity }
  29. v_none = $0;
  30. v_header = $1;
  31. v_defs = $2;
  32. v_syms = $4;
  33. v_interface = $8;
  34. v_implementation = $10;
  35. v_browser = $20;
  36. v_all = $ff;
  37. type
  38. { Copied from systems.pas }
  39. ttargetcpu=
  40. (
  41. no_cpu, { 0 }
  42. i386, { 1 }
  43. m68k, { 2 }
  44. alpha, { 3 }
  45. powerpc, { 4 }
  46. sparc, { 5 }
  47. vm { 6 }
  48. );
  49. var
  50. ppufile : tppufile;
  51. space : string;
  52. read_member : boolean;
  53. unitindex : longint;
  54. verbose : longint;
  55. {****************************************************************************
  56. Helper Routines
  57. ****************************************************************************}
  58. const has_errors : boolean = false;
  59. Procedure Error(const S : string);
  60. Begin
  61. Writeln(S);
  62. has_errors:=true;
  63. End;
  64. Function Target2Str(w:longint):string;
  65. type
  66. { taken from systems.pas }
  67. ttarget =
  68. (
  69. target_none, { 0 }
  70. target_i386_GO32V1, { 1 }
  71. target_i386_GO32V2, { 2 }
  72. target_i386_linux, { 3 }
  73. target_i386_OS2, { 4 }
  74. target_i386_Win32, { 5 }
  75. target_i386_freebsd, { 6 }
  76. target_m68k_Amiga, { 7 }
  77. target_m68k_Atari, { 8 }
  78. target_m68k_Mac, { 9 }
  79. target_m68k_linux, { 10 }
  80. target_m68k_PalmOS, { 11 }
  81. target_alpha_linux, { 12 }
  82. target_powerpc_linux, { 13 }
  83. target_powerpc_macos, { 14 }
  84. target_i386_sunos, { 15 }
  85. target_i386_beos, { 16 }
  86. target_i386_netbsd, { 17 }
  87. target_m68k_netbsd, { 18 }
  88. target_i386_Netware, { 19 }
  89. target_i386_qnx, { 20 }
  90. target_i386_wdosx, { 21 }
  91. target_sparc_sunos, { 22 }
  92. target_sparc_linux, { 23 }
  93. target_i386_openbsd, { 24 }
  94. target_m68k_openbsd, { 25 }
  95. system_x86_64_linux, { 26 }
  96. system_powerpc_macosx, { 27 }
  97. target_i386_emx { 28 }
  98. );
  99. const
  100. Targets : array[ttarget] of string[16]=(
  101. { 0 } 'none',
  102. { 1 } 'GO32V1',
  103. { 2 } 'GO32V2',
  104. { 3 } 'Linux-i386',
  105. { 4 } 'OS/2',
  106. { 5 } 'Win32',
  107. { 6 } 'FreeBSD-i386',
  108. { 7 } 'Amiga',
  109. { 8 } 'Atari',
  110. { 9 } 'MacOS-m68k',
  111. { 10 } 'Linux-m68k',
  112. { 11 } 'PalmOS-m68k',
  113. { 12 } 'Linux-alpha',
  114. { 13 } 'Linux-ppc',
  115. { 14 } 'MacOS-ppc',
  116. { 15 } 'Solaris-i386',
  117. { 16 } 'BeOS-i386',
  118. { 17 } 'NetBSD-i386',
  119. { 18 } 'NetBSD-m68k',
  120. { 19 } 'Netware',
  121. { 20 } 'Qnx-i386',
  122. { 21 } 'WDOSX-i386',
  123. { 22 } 'Solaris-sparc',
  124. { 23 } 'Linux-sparc',
  125. { 24 } 'OpenBSD-i386',
  126. { 25 } 'OpenBSD-m68k',
  127. { 26 } 'Linux-x86-64',
  128. { 27 } 'MacOSX-ppc',
  129. { 28 } 'OS/2 via EMX'
  130. );
  131. begin
  132. if w<=ord(high(ttarget)) then
  133. Target2Str:=Targets[ttarget(w)]
  134. else
  135. Target2Str:='<Unknown>';
  136. end;
  137. Function Cpu2Str(w:longint):string;
  138. const
  139. CpuTxt : array[ttargetcpu] of string[7]=
  140. ('none','i386','m68k','alpha','powerpc','sparc','vis');
  141. begin
  142. if w<=ord(high(ttargetcpu)) then
  143. Cpu2Str:=CpuTxt[ttargetcpu(w)]
  144. else
  145. Cpu2Str:='<Unknown>';
  146. end;
  147. Function Varspez2Str(w:longint):string;
  148. const
  149. varspezstr : array[0..4] of string[6]=('Value','Const','Var','Out','Hidden');
  150. begin
  151. if w<=ord(high(varspezstr)) then
  152. Varspez2Str:=varspezstr[w]
  153. else
  154. Varspez2Str:='<Unknown>';
  155. end;
  156. function PPUFlags2Str(flags:longint):string;
  157. type
  158. tflagopt=record
  159. mask : longint;
  160. str : string[30];
  161. end;
  162. const
  163. flagopts=16;
  164. flagopt : array[1..flagopts] of tflagopt=(
  165. (mask: $1 ;str:'init'),
  166. (mask: $2 ;str:'final'),
  167. (mask: $4 ;str:'big_endian'),
  168. (mask: $8 ;str:'dbx'),
  169. (mask: $10 ;str:'browser'),
  170. (mask: $20 ;str:'in_library'),
  171. (mask: $40 ;str:'smart_linked'),
  172. (mask: $80 ;str:'static_linked'),
  173. (mask: $100 ;str:'shared_linked'),
  174. (mask: $200 ;str:'local_browser'),
  175. (mask: $400 ;str:'no_link'),
  176. (mask: $800 ;str:'has_resources'),
  177. (mask: $1000 ;str:'little_endian'),
  178. (mask: $2000 ;str:'release'),
  179. (mask: $4000 ;str:'local_threadvars'),
  180. (mask: $8000 ;str:'fpu emulation on')
  181. );
  182. var
  183. i : longint;
  184. first : boolean;
  185. s : string;
  186. begin
  187. s:='';
  188. if flags<>0 then
  189. begin
  190. first:=true;
  191. for i:=1to flagopts do
  192. if (flags and flagopt[i].mask)<>0 then
  193. begin
  194. if first then
  195. first:=false
  196. else
  197. s:=s+', ';
  198. s:=s+flagopt[i].str;
  199. end;
  200. end
  201. else
  202. s:='none';
  203. PPUFlags2Str:=s;
  204. end;
  205. const
  206. HexTbl : array[0..15] of char='0123456789ABCDEF';
  207. function HexB(b:byte):string;
  208. begin
  209. HexB[0]:=#2;
  210. HexB[1]:=HexTbl[b shr 4];
  211. HexB[2]:=HexTbl[b and $f];
  212. end;
  213. function hexstr(val : cardinal;cnt : byte) : string;
  214. const
  215. HexTbl : array[0..15] of char='0123456789ABCDEF';
  216. var
  217. i : longint;
  218. begin
  219. hexstr[0]:=char(cnt);
  220. for i:=cnt downto 1 do
  221. begin
  222. hexstr[i]:=hextbl[val and $f];
  223. val:=val shr 4;
  224. end;
  225. end;
  226. Function L0(l:longint):string;
  227. {
  228. return the string of value l, if l<10 then insert a zero, so
  229. the string is always at least 2 chars '01','02',etc
  230. }
  231. var
  232. s : string;
  233. begin
  234. Str(l,s);
  235. if l<10 then
  236. s:='0'+s;
  237. L0:=s;
  238. end;
  239. function filetimestring( t : longint) : string;
  240. {
  241. convert dos datetime t to a string YY/MM/DD HH:MM:SS
  242. }
  243. var
  244. DT : DateTime;
  245. begin
  246. if t=-1 then
  247. begin
  248. FileTimeString:='Not Found';
  249. exit;
  250. end;
  251. unpacktime(t,DT);
  252. filetimestring:=L0(dt.Year)+'/'+L0(dt.Month)+'/'+L0(dt.Day)+' '+L0(dt.Hour)+':'+L0(dt.min)+':'+L0(dt.sec);
  253. end;
  254. {****************************************************************************
  255. Read Routines
  256. ****************************************************************************}
  257. function getint64:int64;
  258. var
  259. l1,l2 : longint;
  260. begin
  261. l1:=ppufile.getlongint;
  262. l2:=ppufile.getlongint;
  263. getint64:=(int64(l2) shl 32) or qword(l1);
  264. end;
  265. Procedure ReadLinkContainer(const prefix:string);
  266. {
  267. Read a serie of strings and write to the screen starting every line
  268. with prefix
  269. }
  270. function maskstr(m:longint):string;
  271. const
  272. { link options }
  273. link_none = $0;
  274. link_allways = $1;
  275. link_static = $2;
  276. link_smart = $4;
  277. link_shared = $8;
  278. var
  279. s : string;
  280. begin
  281. s:='';
  282. if (m and link_allways)<>0 then
  283. s:=s+'always ';
  284. if (m and link_static)<>0 then
  285. s:=s+'static ';
  286. if (m and link_smart)<>0 then
  287. s:=s+'smart ';
  288. if (m and link_shared)<>0 then
  289. s:=s+'shared ';
  290. maskstr:=s;
  291. end;
  292. var
  293. s : string;
  294. m : longint;
  295. begin
  296. while not ppufile.endofentry do
  297. begin
  298. s:=ppufile.getstring;
  299. m:=ppufile.getlongint;
  300. WriteLn(prefix,s,' (',maskstr(m),')');
  301. end;
  302. end;
  303. Procedure ReadContainer(const prefix:string);
  304. {
  305. Read a serie of strings and write to the screen starting every line
  306. with prefix
  307. }
  308. begin
  309. while not ppufile.endofentry do
  310. WriteLn(prefix,ppufile.getstring);
  311. end;
  312. Procedure ReadRef;
  313. begin
  314. if (verbose and v_browser)=0 then
  315. exit;
  316. while (not ppufile.endofentry) and (not ppufile.error) do
  317. Writeln(space,' - Refered : ',ppufile.getword,', (',ppufile.getlongint,',',ppufile.getword,')');
  318. end;
  319. Procedure ReadAsmSymbols;
  320. type
  321. { Copied from aasmbase.pas }
  322. TAsmsymbind=(AB_NONE,AB_EXTERNAL,AB_COMMON,AB_LOCAL,AB_GLOBAL);
  323. TAsmsymtype=(AT_NONE,AT_FUNCTION,AT_DATA,AT_SECTION);
  324. var
  325. s,
  326. bindstr,
  327. typestr : string;
  328. i : longint;
  329. begin
  330. writeln(space,'Number of AsmSymbols: ',ppufile.getlongint);
  331. i:=0;
  332. while (not ppufile.endofentry) and (not ppufile.error) do
  333. begin
  334. s:=ppufile.getstring;
  335. case tasmsymbind(ppufile.getbyte) of
  336. AB_EXTERNAL :
  337. bindstr:='External';
  338. AB_COMMON :
  339. bindstr:='Common';
  340. AB_LOCAL :
  341. bindstr:='Local';
  342. AB_GLOBAL :
  343. bindstr:='Global';
  344. else
  345. bindstr:='<Error !!>'
  346. end;
  347. case tasmsymtype(ppufile.getbyte) of
  348. AT_FUNCTION :
  349. typestr:='Function';
  350. AT_DATA :
  351. typestr:='Data';
  352. AT_SECTION :
  353. typestr:='Section';
  354. else
  355. typestr:='<Error !!>'
  356. end;
  357. Writeln(space,' ',i,' : ',s,' [',bindstr,',',typestr,']');
  358. inc(i);
  359. end;
  360. end;
  361. Procedure ReadPosInfo;
  362. var
  363. info : byte;
  364. fileindex,line,column : longint;
  365. begin
  366. with ppufile do
  367. begin
  368. {
  369. info byte layout in bits:
  370. 0-1 - amount of bytes for fileindex
  371. 2-3 - amount of bytes for line
  372. 4-5 - amount of bytes for column
  373. }
  374. info:=getbyte;
  375. case (info and $03) of
  376. 0 : fileindex:=getbyte;
  377. 1 : fileindex:=getword;
  378. 2 : fileindex:=(getbyte shl 16) or getword;
  379. 3 : fileindex:=getlongint;
  380. end;
  381. case ((info shr 2) and $03) of
  382. 0 : line:=getbyte;
  383. 1 : line:=getword;
  384. 2 : line:=(getbyte shl 16) or getword;
  385. 3 : line:=getlongint;
  386. end;
  387. case ((info shr 4) and $03) of
  388. 0 : column:=getbyte;
  389. 1 : column:=getword;
  390. 2 : column:=(getbyte shl 16) or getword;
  391. 3 : column:=getlongint;
  392. end;
  393. Writeln(fileindex,' (',line,',',column,')');
  394. end;
  395. end;
  396. function readderef(const s:string;skipnil:boolean):boolean;
  397. type
  398. tdereftype = (derefnil,derefaktrecordindex,derefaktstaticindex,
  399. derefunit,derefrecord,derefindex,
  400. dereflocal,derefpara,derefaktlocalindex);
  401. var
  402. b : tdereftype;
  403. begin
  404. readderef:=true;
  405. repeat
  406. b:=tdereftype(ppufile.getbyte);
  407. case b of
  408. derefnil :
  409. begin
  410. if not skipnil then
  411. writeln('nil');
  412. readderef:=false;
  413. break;
  414. end;
  415. derefaktrecordindex :
  416. begin
  417. writeln('AktRecord ',s,' ',ppufile.getword);
  418. break;
  419. end;
  420. derefaktstaticindex :
  421. begin
  422. writeln('AktStatic ',s,' ',ppufile.getword);
  423. break;
  424. end;
  425. derefaktlocalindex :
  426. begin
  427. writeln('AktLocal ',s,' ',ppufile.getword);
  428. break;
  429. end;
  430. derefunit :
  431. begin
  432. writeln('Unit ',ppufile.getword);
  433. break;
  434. end;
  435. derefrecord :
  436. begin
  437. write('RecordDef ',ppufile.getword,', ');
  438. end;
  439. derefpara :
  440. begin
  441. write('Parameter of procdef ',ppufile.getword,', ');
  442. end;
  443. dereflocal :
  444. begin
  445. write('Local of procdef ',ppufile.getword,', ');
  446. end;
  447. derefindex :
  448. begin
  449. write(s,' ',ppufile.getword,', ');
  450. end;
  451. else
  452. begin
  453. writeln('!! unsupported dereftyp: ',ord(b));
  454. break;
  455. end;
  456. end;
  457. until false;
  458. end;
  459. function readdefref:boolean;
  460. begin
  461. readdefref:=readderef('Definition',false);
  462. end;
  463. function readsymref:boolean;
  464. begin
  465. readsymref:=readderef('Symbol',false);
  466. end;
  467. procedure readtype;
  468. var
  469. b1,b2 : boolean;
  470. begin
  471. b1:=readderef('Definition',true);
  472. b2:=readderef('Symbol',true);
  473. if not(b1 or b2) then
  474. Writeln('nil')
  475. else
  476. if (b1 and b2) then
  477. Writeln('!! Type has both definition and symbol stored');
  478. end;
  479. procedure readsymlist(const s:string);
  480. type
  481. tsltype = (sl_none,
  482. sl_load,
  483. sl_call,
  484. sl_subscript,
  485. sl_vec
  486. );
  487. const
  488. slstr : array[tsltype] of string[9] = ('',
  489. 'load',
  490. 'call',
  491. 'subscript',
  492. 'vec'
  493. );
  494. var
  495. sl : tsltype;
  496. begin
  497. readdefref;
  498. repeat
  499. sl:=tsltype(ppufile.getbyte);
  500. if sl=sl_none then
  501. break;
  502. write(s,'(',slstr[sl],') ');
  503. case sl of
  504. sl_call,
  505. sl_load,
  506. sl_subscript :
  507. readsymref;
  508. sl_vec :
  509. writeln(ppufile.getlongint);
  510. end;
  511. until false;
  512. end;
  513. procedure readsymoptions;
  514. type
  515. tsymoption=(sp_none,
  516. sp_public,
  517. sp_private,
  518. sp_published,
  519. sp_protected,
  520. sp_forwarddef,
  521. sp_static,
  522. sp_primary_typesym { this is for typesym, to know who is the primary symbol of a def }
  523. );
  524. tsymoptions=set of tsymoption;
  525. tsymopt=record
  526. mask : tsymoption;
  527. str : string[30];
  528. end;
  529. const
  530. symopts=7;
  531. symopt : array[1..symopts] of tsymopt=(
  532. (mask:sp_public; str:'Public'),
  533. (mask:sp_private; str:'Private'),
  534. (mask:sp_published; str:'Published'),
  535. (mask:sp_protected; str:'Protected'),
  536. (mask:sp_forwarddef; str:'ForwardDef'),
  537. (mask:sp_static; str:'Static'),
  538. (mask:sp_primary_typesym;str:'PrimaryTypeSym')
  539. );
  540. var
  541. symoptions : tsymoptions;
  542. i : longint;
  543. first : boolean;
  544. begin
  545. ppufile.getsmallset(symoptions);
  546. if symoptions<>[] then
  547. begin
  548. first:=true;
  549. for i:=1to symopts do
  550. if (symopt[i].mask in symoptions) then
  551. begin
  552. if first then
  553. first:=false
  554. else
  555. write(', ');
  556. write(symopt[i].str);
  557. end;
  558. end;
  559. writeln;
  560. end;
  561. { Read abstract procdef and return if inline procdef }
  562. type
  563. tproccalloption=(pocall_none,
  564. pocall_cdecl, { procedure uses C styled calling }
  565. pocall_cppdecl, { C++ calling conventions }
  566. pocall_compilerproc, { Procedure is used for internal compiler calls }
  567. pocall_far16, { Far16 for OS/2 }
  568. pocall_fpccall, { FPC default calling }
  569. pocall_inline, { Procedure is an assembler macro }
  570. pocall_internproc, { Procedure has compiler magic}
  571. pocall_palmossyscall, { procedure is a PalmOS system call }
  572. pocall_pascal, { pascal standard left to right }
  573. pocall_register, { procedure uses register (fastcall) calling }
  574. pocall_safecall, { safe call calling conventions }
  575. pocall_stdcall, { procedure uses stdcall call }
  576. pocall_system { system call }
  577. );
  578. tproccalloptions=set of tproccalloption;
  579. tproctypeoption=(potype_none,
  580. potype_proginit, { Program initialization }
  581. potype_unitinit, { unit initialization }
  582. potype_unitfinalize, { unit finalization }
  583. potype_constructor, { Procedure is a constructor }
  584. potype_destructor, { Procedure is a destructor }
  585. potype_operator { Procedure defines an operator }
  586. );
  587. tproctypeoptions=set of tproctypeoption;
  588. tprocoption=(po_none,
  589. po_classmethod, { class method }
  590. po_virtualmethod, { Procedure is a virtual method }
  591. po_abstractmethod, { Procedure is an abstract method }
  592. po_staticmethod, { static method }
  593. po_overridingmethod, { method with override directive }
  594. po_methodpointer, { method pointer, only in procvardef, also used for 'with object do' }
  595. po_containsself, { self is passed explicit to the compiler }
  596. po_interrupt, { Procedure is an interrupt handler }
  597. po_iocheck, { IO checking should be done after a call to the procedure }
  598. po_assembler, { Procedure is written in assembler }
  599. po_msgstr, { method for string message handling }
  600. po_msgint, { method for int message handling }
  601. po_exports, { Procedure has export directive (needed for OS/2) }
  602. po_external, { Procedure is external (in other object or lib)}
  603. po_savestdregs, { save std regs cdecl and stdcall need that ! }
  604. po_saveregisters, { save all registers }
  605. po_overload, { procedure is declared with overload directive }
  606. po_varargs, { printf like arguments }
  607. po_leftright, { push arguments from left to right }
  608. po_clearstack, { caller clears the stack }
  609. po_internconst { procedure has constant evaluator intern }
  610. );
  611. tprocoptions=set of tprocoption;
  612. function read_abstract_proc_def:tproccalloption;
  613. type
  614. tproccallopt=record
  615. mask : tproccalloption;
  616. str : string[30];
  617. end;
  618. tproctypeopt=record
  619. mask : tproctypeoption;
  620. str : string[30];
  621. end;
  622. tprocopt=record
  623. mask : tprocoption;
  624. str : string[30];
  625. end;
  626. const
  627. proccalloptionStr : array[tproccalloption] of string[14]=('',
  628. 'CDecl',
  629. 'CPPDecl',
  630. 'CompilerProc',
  631. 'Far16',
  632. 'FPCCall',
  633. 'Inline',
  634. 'InternProc',
  635. 'PalmOSSysCall',
  636. 'Pascal',
  637. 'Register',
  638. 'SafeCall',
  639. 'StdCall',
  640. 'System'
  641. );
  642. proctypeopts=6;
  643. proctypeopt : array[1..proctypeopts] of tproctypeopt=(
  644. (mask:potype_proginit; str:'ProgInit'),
  645. (mask:potype_unitinit; str:'UnitInit'),
  646. (mask:potype_unitfinalize;str:'UnitFinalize'),
  647. (mask:potype_constructor; str:'Constructor'),
  648. (mask:potype_destructor; str:'Destructor'),
  649. (mask:potype_operator; str:'Operator')
  650. );
  651. procopts=21;
  652. procopt : array[1..procopts] of tprocopt=(
  653. (mask:po_classmethod; str:'ClassMethod'),
  654. (mask:po_virtualmethod; str:'VirtualMethod'),
  655. (mask:po_abstractmethod; str:'AbstractMethod'),
  656. (mask:po_staticmethod; str:'StaticMethod'),
  657. (mask:po_overridingmethod;str:'OverridingMethod'),
  658. (mask:po_methodpointer; str:'MethodPointer'),
  659. (mask:po_containsself; str:'ContainsSelf'),
  660. (mask:po_interrupt; str:'Interrupt'),
  661. (mask:po_iocheck; str:'IOCheck'),
  662. (mask:po_assembler; str:'Assembler'),
  663. (mask:po_msgstr; str:'MsgStr'),
  664. (mask:po_msgint; str:'MsgInt'),
  665. (mask:po_exports; str:'Exports'),
  666. (mask:po_external; str:'External'),
  667. (mask:po_savestdregs; str:'SaveStdRegs'),
  668. (mask:po_saveregisters; str:'SaveRegisters'),
  669. (mask:po_overload; str:'Overload'),
  670. (mask:po_varargs; str:'VarArgs'),
  671. (mask:po_leftright; str:'LeftRight'),
  672. (mask:po_clearstack; str:'ClearStack'),
  673. (mask:po_internconst; str:'InternConst')
  674. );
  675. var
  676. proctypeoption : tproctypeoption;
  677. proccalloption : tproccalloption;
  678. procoptions : tprocoptions;
  679. i,params : longint;
  680. first : boolean;
  681. paraloc : array[0..15] of byte;
  682. begin
  683. write(space,' Return type : ');
  684. readtype;
  685. writeln(space,' Fpu used : ',ppufile.getbyte);
  686. proctypeoption:=tproctypeoption(ppufile.getbyte);
  687. if proctypeoption<>potype_none then
  688. begin
  689. write(space,' TypeOption : ');
  690. first:=true;
  691. for i:=1 to proctypeopts do
  692. if (proctypeopt[i].mask=proctypeoption) then
  693. begin
  694. if first then
  695. first:=false
  696. else
  697. write(', ');
  698. write(proctypeopt[i].str);
  699. end;
  700. writeln;
  701. end;
  702. proccalloption:=tproccalloption(ppufile.getbyte);
  703. read_abstract_proc_def:=proccalloption;
  704. writeln(space,' CallOption : ',proccalloptionStr[proccalloption]);
  705. ppufile.getsmallset(procoptions);
  706. if procoptions<>[] then
  707. begin
  708. write(space,' Options : ');
  709. first:=true;
  710. for i:=1to procopts do
  711. if (procopt[i].mask in procoptions) then
  712. begin
  713. if first then
  714. first:=false
  715. else
  716. write(', ');
  717. write(procopt[i].str);
  718. end;
  719. writeln;
  720. end;
  721. params:=ppufile.getbyte;
  722. writeln(space,' Nr of parameters : ',params);
  723. for i:=1 to params do
  724. begin
  725. writeln(space,' - Parameter ',i);
  726. writeln(space,' Spez : ',Varspez2Str(ppufile.getbyte));
  727. write (space,' Type : ');
  728. readtype;
  729. write (space,' Default : ');
  730. readsymref;
  731. write (space,' Symbol : ');
  732. readsymref;
  733. write (space,' Location : ');
  734. writeln('<not yet implemented>');
  735. ppufile.getdata(paraloc,sizeof(paraloc));
  736. end;
  737. end;
  738. procedure readcommonsym(const s:string);
  739. begin
  740. writeln(space,'** Symbol Nr. ',ppufile.getword,' **');
  741. writeln(space,s,ppufile.getstring);
  742. write(space,' File Pos: ');
  743. readposinfo;
  744. write(space,' SymOptions: ');
  745. readsymoptions;
  746. end;
  747. procedure readcommondef(const s:string);
  748. type
  749. tdefoption=(df_none,
  750. df_has_inittable, { init data has been generated }
  751. df_has_rttitable, { rtti data has been generated }
  752. df_unique
  753. );
  754. tdefoptions=set of tdefoption;
  755. var
  756. defopts : tdefoptions;
  757. begin
  758. writeln(space,'** Definition Nr. ',ppufile.getword,' **');
  759. writeln(space,s);
  760. write (space,' Type symbol : ');
  761. readsymref;
  762. ppufile.getsmallset(defopts);
  763. if df_unique in defopts then
  764. writeln (space,' Unique type symbol');
  765. if df_has_rttitable in defopts then
  766. begin
  767. write (space,' RTTI symbol : ');
  768. readsymref;
  769. end;
  770. if df_has_inittable in defopts then
  771. begin
  772. write (space,' Init symbol : ');
  773. readsymref;
  774. end;
  775. end;
  776. {****************************************************************************
  777. Read Symbols Part
  778. ****************************************************************************}
  779. procedure readsymbols;
  780. type
  781. { options for variables }
  782. tvaroption=(vo_none,
  783. vo_regable,
  784. vo_is_C_var,
  785. vo_is_external,
  786. vo_is_dll_var,
  787. vo_is_thread_var,
  788. vo_fpuregable,
  789. vo_is_local_copy,
  790. vo_is_const, { variable is declared as const (parameter) and can't be written to }
  791. vo_is_exported,
  792. vo_is_high_value
  793. );
  794. tvaroptions=set of tvaroption;
  795. pguid = ^tguid;
  796. tguid = packed record
  797. D1: LongWord;
  798. D2: Word;
  799. D3: Word;
  800. D4: array[0..7] of Byte;
  801. end;
  802. absolutetyp = (tovar,toasm,toaddr);
  803. tconsttyp = (constnone,
  804. constord,conststring,constreal,constbool,
  805. constint,constchar,constset,constpointer,constnil,
  806. constresourcestring,constwstring,constwchar,constguid
  807. );
  808. var
  809. b : byte;
  810. pc : pchar;
  811. totalsyms,
  812. symcnt,
  813. i,j,len : longint;
  814. guid : tguid;
  815. begin
  816. symcnt:=1;
  817. with ppufile do
  818. begin
  819. if space<>'' then
  820. Writeln(space,'-----------------------------');
  821. if readentry=ibstartsyms then
  822. begin
  823. totalsyms:=getlongint;
  824. Writeln(space,'Number of symbols : ',totalsyms);
  825. Writeln(space,'Symtable datasize : ',getlongint);
  826. Writeln(space,'Symtable alignment: ',getlongint);
  827. end
  828. else
  829. begin
  830. totalsyms:=-1;
  831. Writeln('!! ibstartsym not found');
  832. end;
  833. repeat
  834. b:=readentry;
  835. if not (b in [iberror,ibendsyms]) then
  836. inc(symcnt);
  837. case b of
  838. ibunitsym :
  839. readcommonsym('Unit symbol ');
  840. iblabelsym :
  841. readcommonsym('Label symbol ');
  842. ibtypesym :
  843. begin
  844. readcommonsym('Type symbol ');
  845. write(space,' Result Type: ');
  846. readtype;
  847. end;
  848. ibprocsym :
  849. begin
  850. readcommonsym('Procedure symbol ');
  851. repeat
  852. write(space,' Definition: ');
  853. until not readdefref;
  854. end;
  855. ibconstsym :
  856. begin
  857. readcommonsym('Constant symbol ');
  858. b:=getbyte;
  859. case tconsttyp(b) of
  860. constord :
  861. begin
  862. write (space,'OrdinalType: ');
  863. readtype;
  864. writeln (space,' Value: ',getlongint)
  865. end;
  866. constpointer :
  867. begin
  868. write (space,' Pointer Type: ');
  869. readtype;
  870. writeln (space,' Value: ',getlongint)
  871. end;
  872. conststring,
  873. constresourcestring :
  874. begin
  875. len:=getlongint;
  876. getmem(pc,len+1);
  877. getdata(pc^,len);
  878. writeln(space,' Length: ',len);
  879. writeln(space,' Value: "',pc,'"');
  880. freemem(pc,len+1);
  881. if tconsttyp(b)=constresourcestring then
  882. writeln(space,' Index: ',getlongint);
  883. end;
  884. constreal :
  885. writeln(space,' Value: ',getreal);
  886. constbool :
  887. if getlongint<>0 then
  888. writeln (space,' Value : True')
  889. else
  890. writeln (space,' Value: False');
  891. constint :
  892. writeln(space,' Value: ',getint64);
  893. constchar :
  894. writeln(space,' Value: "'+chr(getlongint)+'"');
  895. constset :
  896. begin
  897. write (space,' Set Type: ');
  898. readtype;
  899. for i:=1to 4 do
  900. begin
  901. write (space,' Value: ');
  902. for j:=1to 8 do
  903. begin
  904. if j>1 then
  905. write(',');
  906. write(hexb(getbyte));
  907. end;
  908. writeln;
  909. end;
  910. end;
  911. constwstring:
  912. begin
  913. end;
  914. constwchar:
  915. writeln(space,' Value: #',getlongint);
  916. constguid:
  917. begin
  918. getdata(guid,sizeof(guid));
  919. write (space,' IID String: {',hexstr(guid.d1,8),'-',hexstr(guid.d2,4),'-',hexstr(guid.d3,4),'-');
  920. for i:=0 to 7 do
  921. begin
  922. write(hexstr(guid.d4[i],2));
  923. if i=1 then write('-');
  924. end;
  925. writeln('}');
  926. end
  927. else
  928. Writeln ('!! Invalid unit format : Invalid const type encountered: ',b);
  929. end;
  930. end;
  931. ibvarsym :
  932. begin
  933. readcommonsym('Variable symbol ');
  934. writeln(space,' Spez: ',Varspez2Str(getbyte));
  935. writeln(space,' Address: ',getlongint);
  936. write (space,' Var Type: ');
  937. readtype;
  938. i:=getlongint;
  939. writeln(space,' Options: ',i);
  940. if (vo_is_C_var in tvaroptions(i)) then
  941. writeln(space,' Mangledname: ',getstring);
  942. end;
  943. ibenumsym :
  944. begin
  945. readcommonsym('Enumeration symbol ');
  946. write (space,' Definition: ');
  947. readdefref;
  948. writeln(space,' Value: ',getlongint);
  949. end;
  950. ibsyssym :
  951. begin
  952. readcommonsym('Internal system symbol ');
  953. writeln(space,' Internal Nr: ',getlongint);
  954. end;
  955. ibrttisym :
  956. begin
  957. readcommonsym('RTTI symbol ');
  958. writeln(space,' RTTI Type: ',getbyte);
  959. end;
  960. ibtypedconstsym :
  961. begin
  962. readcommonsym('Typed constant ');
  963. write (space,' Constant Type: ');
  964. readtype;
  965. writeln(space,' ReallyConst: ',(getbyte<>0));
  966. end;
  967. ibabsolutesym :
  968. begin
  969. readcommonsym('Absolute variable symbol ');
  970. writeln(space,' Type: ',getbyte);
  971. writeln(space,' Address: ',getlongint);
  972. write (space,' Var Type: ');
  973. readtype;
  974. writeln(space,' Options: ',getlongint);
  975. Write (space,' Relocated to ');
  976. b:=getbyte;
  977. case absolutetyp(b) of
  978. tovar :
  979. Writeln('Name : ',getstring);
  980. toasm :
  981. Writeln('Assembler name : ',getstring);
  982. toaddr :
  983. begin
  984. Write('Address : ',getlongint);
  985. WriteLn(' (Far: ',getbyte<>0,')');
  986. end;
  987. else
  988. Writeln ('!! Invalid unit format : Invalid absolute type encountered: ',b);
  989. end;
  990. end;
  991. ibpropertysym :
  992. begin
  993. readcommonsym('Property ');
  994. i:=getlongint;
  995. writeln(space,' PropOptions: ',i);
  996. if (i and 32)>0 then
  997. begin
  998. write (space,'OverrideProp: ');
  999. readsymref;
  1000. end
  1001. else
  1002. begin
  1003. write (space,' Prop Type: ');
  1004. readtype;
  1005. writeln(space,' Index: ',getlongint);
  1006. writeln(space,' Default: ',getlongint);
  1007. write (space,' Index Type: ');
  1008. readtype;
  1009. write (space,' Readaccess: ');
  1010. readsymlist(space+' Sym: ');
  1011. write (space,' Writeaccess: ');
  1012. readsymlist(space+' Sym: ');
  1013. write (space,'Storedaccess: ');
  1014. readsymlist(space+' Sym: ');
  1015. end;
  1016. end;
  1017. ibfuncretsym :
  1018. begin
  1019. readcommonsym('Func return value ');
  1020. write (space,' Return Type: ');
  1021. readtype;
  1022. writeln(space,' Address: ',getlongint);
  1023. end;
  1024. iberror :
  1025. begin
  1026. Writeln('!! Error in PPU');
  1027. exit;
  1028. end;
  1029. ibendsyms :
  1030. break;
  1031. else
  1032. WriteLn('!! Skipping unsupported PPU Entry in Symbols: ',b);
  1033. end;
  1034. if not EndOfEntry then
  1035. Writeln('!! Entry has more information stored');
  1036. until false;
  1037. if (totalsyms<>-1) and (symcnt-1<>totalsyms) then
  1038. Writeln('!! Only read ',symcnt-1,' of ',totalsyms,' symbols');
  1039. end;
  1040. end;
  1041. {****************************************************************************
  1042. Read defintions Part
  1043. ****************************************************************************}
  1044. procedure getusedregisters_i386;
  1045. type
  1046. tregister = (R_NO,
  1047. R_EAX,R_ECX,R_EDX,R_EBX,R_ESP,R_EBP,R_ESI,R_EDI,
  1048. R_AX,R_CX,R_DX,R_BX,R_SP,R_BP,R_SI,R_DI,
  1049. R_AL,R_CL,R_DL,R_BL,R_AH,R_CH,R_BH,R_DH,
  1050. R_CS,R_DS,R_ES,R_SS,R_FS,R_GS,
  1051. R_ST,R_ST0,R_ST1,R_ST2,R_ST3,R_ST4,R_ST5,R_ST6,R_ST7,
  1052. R_DR0,R_DR1,R_DR2,R_DR3,R_DR6,R_DR7,
  1053. R_CR0,R_CR2,R_CR3,R_CR4,
  1054. R_TR3,R_TR4,R_TR5,R_TR6,R_TR7,
  1055. R_MM0,R_MM1,R_MM2,R_MM3,R_MM4,R_MM5,R_MM6,R_MM7,
  1056. R_XMM0,R_XMM1,R_XMM2,R_XMM3,R_XMM4,R_XMM5,R_XMM6,R_XMM7
  1057. );
  1058. tregisterset = set of tregister;
  1059. reg2strtable = array[tregister] of string[6];
  1060. const
  1061. std_reg2str : reg2strtable = ('',
  1062. 'eax','ecx','edx','ebx','esp','ebp','esi','edi',
  1063. 'ax','cx','dx','bx','sp','bp','si','di',
  1064. 'al','cl','dl','bl','ah','ch','bh','dh',
  1065. 'cs','ds','es','ss','fs','gs',
  1066. 'st','st(0)','st(1)','st(2)','st(3)','st(4)','st(5)','st(6)','st(7)',
  1067. 'dr0','dr1','dr2','dr3','dr6','dr7',
  1068. 'cr0','cr2','cr3','cr4',
  1069. 'tr3','tr4','tr5','tr6','tr7',
  1070. 'mm0','mm1','mm2','mm3','mm4','mm5','mm6','mm7',
  1071. 'xmm0','xmm1','xmm2','xmm3','xmm4','xmm5','xmm6','xmm7'
  1072. );
  1073. firstsaveintreg = R_EAX;
  1074. lastsaveintreg = R_EBX;
  1075. firstsavefpureg = R_NO;
  1076. lastsavefpureg = R_NO;
  1077. firstsavemmreg = R_MM0;
  1078. lastsavemmreg = R_MM7;
  1079. var
  1080. regs: tregisterset;
  1081. r: tregister;
  1082. first: boolean;
  1083. begin
  1084. first := true;
  1085. ppufile.getnormalset(regs);
  1086. for r := firstsaveintreg to lastsaveintreg do
  1087. if r in regs then
  1088. begin
  1089. if not first then
  1090. write(', ')
  1091. else
  1092. first := false;
  1093. write(std_reg2str[r])
  1094. end;
  1095. if (firstsavefpureg <> R_NO) then
  1096. for r := firstsavefpureg to lastsavefpureg do
  1097. if r in regs then
  1098. begin
  1099. if not first then
  1100. write(', ')
  1101. else
  1102. first := false;
  1103. write(std_reg2str[r])
  1104. end;
  1105. if (firstsavemmreg <> R_NO) then
  1106. for r := firstsavemmreg to lastsavemmreg do
  1107. if r in regs then
  1108. begin
  1109. if not first then
  1110. write(', ')
  1111. else
  1112. first := false;
  1113. write(std_reg2str[r])
  1114. end;
  1115. writeln;
  1116. end;
  1117. procedure readdefinitions(start_read : boolean);
  1118. type
  1119. tsettype = (normset,smallset,varset);
  1120. tbasetype = (
  1121. uvoid,
  1122. u8bit,u16bit,u32bit,u64bit,
  1123. s8bit,s16bit,s32bit,s64bit,
  1124. bool8bit,bool16bit,bool32bit,
  1125. uchar,uwidechar
  1126. );
  1127. tobjectdeftype = (odt_none,
  1128. odt_class,
  1129. odt_object,
  1130. odt_interfacecom,
  1131. odt_interfacecorba,
  1132. odt_cppclass
  1133. );
  1134. var
  1135. b : byte;
  1136. oldread_member : boolean;
  1137. totaldefs,l,j,
  1138. defcnt : longint;
  1139. calloption : tproccalloption;
  1140. regs : set of char;
  1141. begin
  1142. defcnt:=0;
  1143. with ppufile do
  1144. begin
  1145. if space<>'' then
  1146. Writeln(space,'-----------------------------');
  1147. if not start_read then
  1148. if readentry=ibstartdefs then
  1149. begin
  1150. totaldefs:=getlongint;
  1151. Writeln(space,'Number of definitions: ',totaldefs);
  1152. end
  1153. else
  1154. begin
  1155. totaldefs:=-1;
  1156. Writeln('!! ibstartdef not found');
  1157. end;
  1158. repeat
  1159. b:=readentry;
  1160. if not (b in [iberror,ibenddefs]) then
  1161. inc(defcnt);
  1162. case b of
  1163. ibpointerdef :
  1164. begin
  1165. readcommondef('Pointer definition');
  1166. write (space,' Pointed Type : ');
  1167. readtype;
  1168. writeln(space,' Is Far : ',(getbyte<>0));
  1169. end;
  1170. iborddef :
  1171. begin
  1172. readcommondef('Ordinal definition');
  1173. write (space,' Base type : ');
  1174. b:=getbyte;
  1175. case tbasetype(b) of
  1176. uvoid : writeln('uvoid');
  1177. u8bit : writeln('u8bit');
  1178. u16bit : writeln('u16bit');
  1179. u32bit : writeln('s32bit');
  1180. u64bit : writeln('u64bit');
  1181. s8bit : writeln('s8bit');
  1182. s16bit : writeln('s16bit');
  1183. s32bit : writeln('s32bit');
  1184. s64bit : writeln('s64bit');
  1185. bool8bit : writeln('bool8bit');
  1186. bool16bit : writeln('bool16bit');
  1187. bool32bit : writeln('bool32bit');
  1188. uchar : writeln('uchar');
  1189. uwidechar : writeln('uwidechar');
  1190. else writeln('!! Warning: Invalid base type ',b);
  1191. end;
  1192. writeln(space,' Range : ',getint64,' to ',getint64);
  1193. end;
  1194. ibfloatdef :
  1195. begin
  1196. readcommondef('Float definition');
  1197. writeln(space,' Float type : ',getbyte);
  1198. end;
  1199. ibarraydef :
  1200. begin
  1201. readcommondef('Array definition');
  1202. write (space,' Element type : ');
  1203. readtype;
  1204. write (space,' Range Type : ');
  1205. readtype;
  1206. writeln(space,' Range : ',getlongint,' to ',getlongint);
  1207. writeln(space,' Is Constructor : ',(getbyte<>0));
  1208. writeln(space,' Is Dynamic : ',(getbyte<>0));
  1209. end;
  1210. ibprocdef :
  1211. begin
  1212. readcommondef('Procedure definition');
  1213. calloption:=read_abstract_proc_def;
  1214. write (space,' Used IntRegs : ');
  1215. getnormalset(regs);
  1216. writeln('<not yet implemented>');
  1217. write (space,' Used OtherRegs : ');
  1218. getnormalset(regs);
  1219. writeln('<not yet implemented>');
  1220. {$ifdef OLDRA}
  1221. case ttargetcpu(header.cpu) of
  1222. i386 :
  1223. getusedregisters_i386
  1224. else
  1225. begin
  1226. getnormalset(regs);
  1227. writeln('<not yet implemented>');
  1228. end;
  1229. end;
  1230. {$endif OLDRA}
  1231. if (getbyte<>0) then
  1232. writeln(space,' Mangled name : ',getstring);
  1233. writeln(space,' Overload Number : ',getword);
  1234. writeln(space,' Number : ',getword);
  1235. write (space,' Class : ');
  1236. readdefref;
  1237. write (space,' Procsym : ');
  1238. readsymref;
  1239. write (space,' File Pos : ');
  1240. readposinfo;
  1241. write (space,' SymOptions : ');
  1242. readsymoptions;
  1243. if (calloption=pocall_inline) then
  1244. begin
  1245. write (space,' FuncretSym : ');
  1246. readdefref;
  1247. end;
  1248. space:=' '+space;
  1249. { parast }
  1250. readdefinitions(false);
  1251. readsymbols;
  1252. { localst }
  1253. if (calloption=pocall_inline) or
  1254. ((ppufile.header.flags and uf_local_browser) <> 0) then
  1255. begin
  1256. readdefinitions(false);
  1257. readsymbols;
  1258. end;
  1259. delete(space,1,4);
  1260. end;
  1261. ibprocvardef :
  1262. begin
  1263. readcommondef('Procedural type (ProcVar) definition');
  1264. read_abstract_proc_def;
  1265. end;
  1266. ibshortstringdef :
  1267. begin
  1268. readcommondef('ShortString definition');
  1269. writeln(space,' Length : ',getbyte);
  1270. end;
  1271. ibwidestringdef :
  1272. begin
  1273. readcommondef('WideString definition');
  1274. writeln(space,' Length : ',getlongint);
  1275. end;
  1276. ibansistringdef :
  1277. begin
  1278. readcommondef('AnsiString definition');
  1279. writeln(space,' Length : ',getlongint);
  1280. end;
  1281. iblongstringdef :
  1282. begin
  1283. readcommondef('Longstring definition');
  1284. writeln(space,' Length : ',getlongint);
  1285. end;
  1286. ibrecorddef :
  1287. begin
  1288. readcommondef('Record definition');
  1289. writeln(space,' Size : ',getlongint);
  1290. {read the record definitions and symbols}
  1291. space:=' '+space;
  1292. oldread_member:=read_member;
  1293. read_member:=true;
  1294. readdefinitions(false);
  1295. readsymbols;
  1296. read_member:=oldread_member;
  1297. Delete(space,1,4);
  1298. end;
  1299. ibobjectdef :
  1300. begin
  1301. readcommondef('Object/Class definition');
  1302. b:=getbyte;
  1303. write (space,' Type : ');
  1304. case tobjectdeftype(b) of
  1305. odt_class : writeln('class');
  1306. odt_object : writeln('object');
  1307. odt_interfacecom : writeln('interfacecom');
  1308. odt_interfacecorba : writeln('interfacecorba');
  1309. odt_cppclass : writeln('cppclass');
  1310. else writeln('!! Warning: Invalid object type ',b);
  1311. end;
  1312. writeln(space,' Size : ',getlongint);
  1313. writeln(space,' Vmt offset : ',getlongint);
  1314. writeln(space,' Name of Class : ',getstring);
  1315. write(space, ' Ancestor Class : ');
  1316. readdefref;
  1317. writeln(space,' Options : ',getlongint);
  1318. if tobjectdeftype(b) in [odt_interfacecom,odt_interfacecorba] then
  1319. begin
  1320. { IIDGUID }
  1321. for j:=1to 16 do
  1322. getbyte;
  1323. writeln(space,' IID String : ',getstring);
  1324. writeln(space,' Last VTable idx : ',getlongint);
  1325. end;
  1326. if tobjectdeftype(b) in [odt_class,odt_interfacecorba] then
  1327. begin
  1328. l:=getlongint;
  1329. writeln(space,' Impl Intf Count : ',l);
  1330. for j:=1 to l do
  1331. begin
  1332. write (space,' - Definition : ');
  1333. readdefref;
  1334. writeln(space,' IOffset : ',getlongint);
  1335. end;
  1336. end;
  1337. {read the record definitions and symbols}
  1338. space:=' '+space;
  1339. oldread_member:=read_member;
  1340. read_member:=true;
  1341. readdefinitions(false);
  1342. readsymbols;
  1343. read_member:=oldread_member;
  1344. Delete(space,1,4);
  1345. end;
  1346. ibfiledef :
  1347. begin
  1348. ReadCommonDef('File definition');
  1349. write (space,' Type : ');
  1350. case getbyte of
  1351. 0 : writeln('Text');
  1352. 1 : begin
  1353. writeln('Typed');
  1354. write (space,' File of Type : ');
  1355. Readtype;
  1356. end;
  1357. 2 : writeln('Untyped');
  1358. end;
  1359. end;
  1360. ibformaldef :
  1361. readcommondef('Generic Definition (void-typ)');
  1362. ibenumdef :
  1363. begin
  1364. readcommondef('Enumeration type definition');
  1365. write(space,'Base enumeration type : ');
  1366. readdefref;
  1367. writeln(space,' Smallest element : ',getlongint);
  1368. writeln(space,' Largest element : ',getlongint);
  1369. writeln(space,' Size : ',getlongint);
  1370. end;
  1371. ibclassrefdef :
  1372. begin
  1373. readcommondef('Class reference definition');
  1374. write (space,' Pointed Type : ');
  1375. readtype;
  1376. end;
  1377. ibsetdef :
  1378. begin
  1379. readcommondef('Set definition');
  1380. write (space,' Element type : ');
  1381. readtype;
  1382. b:=getbyte;
  1383. case tsettype(b) of
  1384. smallset : writeln(space,' Set with 32 Elements');
  1385. normset : writeln(space,' Set with 256 Elements');
  1386. varset : writeln(space,' Set with ',getlongint,' Elements');
  1387. else writeln('!! Warning: Invalid set type ',b);
  1388. end;
  1389. end;
  1390. ibvariantdef :
  1391. begin
  1392. readcommondef('Variant definition');
  1393. end;
  1394. iberror :
  1395. begin
  1396. Writeln('!! Error in PPU');
  1397. exit;
  1398. end;
  1399. ibenddefs :
  1400. break;
  1401. else
  1402. WriteLn('!! Skipping unsupported PPU Entry in definitions: ',b);
  1403. end;
  1404. if not EndOfEntry then
  1405. Writeln('!! Entry has more information stored');
  1406. until false;
  1407. if (totaldefs<>-1) and (defcnt<>totaldefs) then
  1408. Writeln('!! Only read ',defcnt,' of ',totaldefs,' definitions');
  1409. end;
  1410. end;
  1411. {****************************************************************************
  1412. Read General Part
  1413. ****************************************************************************}
  1414. procedure readinterface;
  1415. var
  1416. b : byte;
  1417. sourcenumber,
  1418. unitnumber : word;
  1419. ucrc,uintfcrc : longint;
  1420. begin
  1421. with ppufile do
  1422. begin
  1423. repeat
  1424. b:=readentry;
  1425. case b of
  1426. ibmodulename :
  1427. Writeln('Module Name: ',getstring);
  1428. ibsourcefiles :
  1429. begin
  1430. sourcenumber:=1;
  1431. while not EndOfEntry do
  1432. begin
  1433. Writeln('Source file ',sourcenumber,' : ',getstring,' ',filetimestring(getlongint));
  1434. inc(sourcenumber);
  1435. end;
  1436. end;
  1437. ibusedmacros :
  1438. begin
  1439. while not EndOfEntry do
  1440. begin
  1441. Write('Conditional ',getstring);
  1442. b:=getbyte;
  1443. if boolean(b)=true then
  1444. write(' defined at startup')
  1445. else
  1446. write(' not defined at startup');
  1447. b:=getbyte;
  1448. if boolean(b)=true then
  1449. writeln(' was used')
  1450. else
  1451. writeln;
  1452. end;
  1453. end;
  1454. ibloadunit :
  1455. begin
  1456. unitnumber:=1;
  1457. while not EndOfEntry do
  1458. begin
  1459. write('Uses unit: ',getstring,' (Number: ',unitnumber,')');
  1460. ucrc:=getlongint;
  1461. uintfcrc:=getlongint;
  1462. write(' (Crc: ',hexstr(ucrc,8),', IntfcCrc: ',hexstr(uintfcrc,8),')');
  1463. if getbyte<>0 then
  1464. writeln(' (interface)')
  1465. else
  1466. writeln(' (implementation)');
  1467. inc(unitnumber);
  1468. end;
  1469. end;
  1470. iblinkunitofiles :
  1471. ReadLinkContainer('Link unit object file: ');
  1472. iblinkunitstaticlibs :
  1473. ReadLinkContainer('Link unit static lib: ');
  1474. iblinkunitsharedlibs :
  1475. ReadLinkContainer('Link unit shared lib: ');
  1476. iblinkotherofiles :
  1477. ReadLinkContainer('Link other object file: ');
  1478. iblinkotherstaticlibs :
  1479. ReadLinkContainer('Link other static lib: ');
  1480. iblinkothersharedlibs :
  1481. ReadLinkContainer('Link other shared lib: ');
  1482. iberror :
  1483. begin
  1484. Writeln('Error in PPU');
  1485. exit;
  1486. end;
  1487. ibendinterface :
  1488. break;
  1489. else
  1490. WriteLn('!! Skipping unsupported PPU Entry in General Part: ',b);
  1491. end;
  1492. until false;
  1493. end;
  1494. end;
  1495. {****************************************************************************
  1496. Read Implementation Part
  1497. ****************************************************************************}
  1498. procedure readimplementation;
  1499. var
  1500. b : byte;
  1501. begin
  1502. with ppufile do
  1503. begin
  1504. repeat
  1505. b:=readentry;
  1506. case b of
  1507. ibasmsymbols :
  1508. ReadAsmSymbols;
  1509. iberror :
  1510. begin
  1511. Writeln('Error in PPU');
  1512. exit;
  1513. end;
  1514. ibendimplementation :
  1515. break;
  1516. else
  1517. WriteLn('!! Skipping unsupported PPU Entry in Implementation: ',b);
  1518. end;
  1519. until false;
  1520. end;
  1521. end;
  1522. {****************************************************************************
  1523. Read Browser Part
  1524. ****************************************************************************}
  1525. procedure readbrowser;
  1526. var
  1527. b : byte;
  1528. const indent : string = '';
  1529. begin
  1530. Writeln(indent,'Start of symtable browser');
  1531. indent:=indent+'**';
  1532. with ppufile do
  1533. begin
  1534. repeat
  1535. b:=readentry;
  1536. case b of
  1537. ibbeginsymtablebrowser :
  1538. begin
  1539. { here we must read object and record symtables !! }
  1540. indent:=indent+' ';
  1541. Writeln(indent,'Record/Object symtable');
  1542. readbrowser;
  1543. Indent:=Copy(Indent,1,Length(Indent)-2);
  1544. end;
  1545. ibsymref :
  1546. begin
  1547. readsymref;
  1548. readref;
  1549. end;
  1550. ibdefref :
  1551. begin
  1552. readdefref;
  1553. readref;
  1554. if ((ppufile.header.flags and uf_local_browser)<>0) and
  1555. (UnitIndex=0) then
  1556. begin
  1557. { parast and localst }
  1558. indent:=indent+' ';
  1559. b:=ppufile.readentry;
  1560. if b=ibbeginsymtablebrowser then
  1561. readbrowser;
  1562. b:=ppufile.readentry;
  1563. if b=ibbeginsymtablebrowser then
  1564. readbrowser;
  1565. Indent:=Copy(Indent,1,Length(Indent)-2);
  1566. end;
  1567. end;
  1568. iberror :
  1569. begin
  1570. Writeln('Error in PPU');
  1571. exit;
  1572. end;
  1573. ibendsymtablebrowser :
  1574. break;
  1575. else
  1576. begin
  1577. WriteLn('!! Skipping unsupported PPU Entry in Browser: ',b);
  1578. Halt;
  1579. end;
  1580. end;
  1581. until false;
  1582. end;
  1583. Indent:=Copy(Indent,1,Length(Indent)-2);
  1584. Writeln(Indent,'End of symtable browser');
  1585. end;
  1586. procedure dofile (filename : string);
  1587. var
  1588. b : byte;
  1589. begin
  1590. { reset }
  1591. space:='';
  1592. { fix filename }
  1593. if pos('.',filename)=0 then
  1594. filename:=filename+'.ppu';
  1595. ppufile:=tppufile.create(filename);
  1596. if not ppufile.openfile then
  1597. begin
  1598. writeln ('IO-Error when opening : ',filename,', Skipping');
  1599. exit;
  1600. end;
  1601. { PPU File is open, check for PPU Id }
  1602. if not ppufile.CheckPPUID then
  1603. begin
  1604. writeln(Filename,' : Not a valid PPU file, Skipping');
  1605. exit;
  1606. end;
  1607. { Check PPU Version }
  1608. Writeln('Analyzing ',filename,' (v',ppufile.GetPPUVersion,')');
  1609. if ppufile.GetPPUVersion<16 then
  1610. begin
  1611. writeln(Filename,' : Old PPU Formats (<v16) are not supported, Skipping');
  1612. exit;
  1613. end;
  1614. { Write PPU Header Information }
  1615. if (verbose and v_header)<>0 then
  1616. begin
  1617. Writeln;
  1618. Writeln('Header');
  1619. Writeln('-------');
  1620. with ppufile.header do
  1621. begin
  1622. Writeln('Compiler version : ',ppufile.header.compiler shr 14,'.',
  1623. (ppufile.header.compiler shr 7) and $7f,'.',
  1624. ppufile.header.compiler and $7f);
  1625. WriteLn('Target processor : ',Cpu2Str(cpu));
  1626. WriteLn('Target operating system : ',Target2Str(target));
  1627. Writeln('Unit flags : ',PPUFlags2Str(flags));
  1628. Writeln('FileSize (w/o header) : ',size);
  1629. Writeln('Checksum : ',hexstr(checksum,8));
  1630. Writeln('Interface Checksum : ',hexstr(interface_checksum,8));
  1631. end;
  1632. end;
  1633. {read the general stuff}
  1634. if (verbose and v_interface)<>0 then
  1635. begin
  1636. Writeln;
  1637. Writeln('Interface section');
  1638. Writeln('------------------');
  1639. readinterface;
  1640. end
  1641. else
  1642. ppufile.skipuntilentry(ibendinterface);
  1643. {read the definitions}
  1644. if (verbose and v_defs)<>0 then
  1645. begin
  1646. Writeln;
  1647. Writeln('Interface definitions');
  1648. Writeln('----------------------');
  1649. readdefinitions(false);
  1650. end
  1651. else
  1652. ppufile.skipuntilentry(ibenddefs);
  1653. {read the symbols}
  1654. if (verbose and v_syms)<>0 then
  1655. begin
  1656. Writeln;
  1657. Writeln('Interface Symbols');
  1658. Writeln('------------------');
  1659. readsymbols;
  1660. end
  1661. else
  1662. ppufile.skipuntilentry(ibendsyms);
  1663. {read the implementation stuff}
  1664. if (verbose and v_implementation)<>0 then
  1665. begin
  1666. Writeln;
  1667. Writeln('Implementation section');
  1668. Writeln('-----------------------');
  1669. readimplementation;
  1670. end
  1671. else
  1672. ppufile.skipuntilentry(ibendimplementation);
  1673. {read the static browser units stuff}
  1674. if (ppufile.header.flags and uf_local_browser)<>0 then
  1675. begin
  1676. if (verbose and v_defs)<>0 then
  1677. begin
  1678. Writeln;
  1679. Writeln('Static definitions');
  1680. Writeln('----------------------');
  1681. readdefinitions(false);
  1682. end
  1683. else
  1684. ppufile.skipuntilentry(ibenddefs);
  1685. {read the symbols}
  1686. if (verbose and v_syms)<>0 then
  1687. begin
  1688. Writeln;
  1689. Writeln('Static Symbols');
  1690. Writeln('------------------');
  1691. readsymbols;
  1692. end;
  1693. end;
  1694. {read the browser units stuff}
  1695. if (ppufile.header.flags and uf_has_browser)<>0 then
  1696. begin
  1697. if (verbose and v_browser)<>0 then
  1698. begin
  1699. Writeln;
  1700. Writeln('Browser section');
  1701. Writeln('---------------');
  1702. UnitIndex:=0;
  1703. repeat
  1704. b:=ppufile.readentry;
  1705. if b = ibendbrowser then break;
  1706. if b=ibbeginsymtablebrowser then
  1707. begin
  1708. Writeln('Unit ',UnitIndex);
  1709. readbrowser;
  1710. Inc(UnitIndex);
  1711. end
  1712. else
  1713. Writeln('Wrong end browser entry ',b,' should be ',ibendbrowser);
  1714. until false;
  1715. end;
  1716. end;
  1717. {read the static browser units stuff}
  1718. if (ppufile.header.flags and uf_local_browser)<>0 then
  1719. begin
  1720. if (verbose and v_browser)<>0 then
  1721. begin
  1722. Writeln;
  1723. Writeln('Static browser section');
  1724. Writeln('---------------');
  1725. UnitIndex:=0;
  1726. b:=ppufile.readentry;
  1727. if b=ibbeginsymtablebrowser then
  1728. readbrowser
  1729. else
  1730. Writeln('Wrong end browser entry ',b,' should be ',ibendbrowser);
  1731. end;
  1732. end;
  1733. {shutdown ppufile}
  1734. ppufile.closefile;
  1735. ppufile.free;
  1736. Writeln;
  1737. end;
  1738. procedure help;
  1739. begin
  1740. writeln('usage: ppudump [options] <filename1> <filename2>...');
  1741. writeln;
  1742. writeln('[options] can be:');
  1743. writeln(' -V<verbose> Set verbosity to <verbose>');
  1744. writeln(' H - Show header info');
  1745. writeln(' I - Show interface');
  1746. writeln(' M - Show implementation');
  1747. writeln(' S - Show interface symbols');
  1748. writeln(' D - Show interface definitions');
  1749. writeln(' B - Show browser info');
  1750. writeln(' A - Show all');
  1751. writeln(' -? This helpscreen');
  1752. halt;
  1753. end;
  1754. var
  1755. startpara,
  1756. nrfile,i : longint;
  1757. para : string;
  1758. begin
  1759. writeln(Title+' '+Version);
  1760. writeln(Copyright);
  1761. writeln;
  1762. if paramcount<1 then
  1763. begin
  1764. writeln('usage: dumpppu [options] <filename1> <filename2>...');
  1765. halt(1);
  1766. end;
  1767. { turn verbose on by default }
  1768. verbose:=v_all;
  1769. { read options }
  1770. startpara:=1;
  1771. while copy(paramstr(startpara),1,1)='-' do
  1772. begin
  1773. para:=paramstr(startpara);
  1774. case upcase(para[2]) of
  1775. 'V' : begin
  1776. verbose:=0;
  1777. for i:=3to length(para) do
  1778. case upcase(para[i]) of
  1779. 'H' : verbose:=verbose or v_header;
  1780. 'I' : verbose:=verbose or v_interface;
  1781. 'M' : verbose:=verbose or v_implementation;
  1782. 'D' : verbose:=verbose or v_defs;
  1783. 'S' : verbose:=verbose or v_syms;
  1784. 'B' : verbose:=verbose or v_browser;
  1785. 'A' : verbose:=verbose or v_all;
  1786. end;
  1787. end;
  1788. '?' : help;
  1789. end;
  1790. inc(startpara);
  1791. end;
  1792. { process files }
  1793. for nrfile:=startpara to paramcount do
  1794. dofile (paramstr(nrfile));
  1795. if has_errors then
  1796. Halt(1);
  1797. end.
  1798. {
  1799. $Log$
  1800. Revision 1.38 2003-04-10 17:57:53 peter
  1801. * vs_hidden released
  1802. Revision 1.37 2003/03/24 19:57:54 hajny
  1803. + emx target added
  1804. Revision 1.36 2003/03/17 15:54:22 peter
  1805. * store symoptions also for procdef
  1806. * check symoptions (private,public) when calculating possible
  1807. overload candidates
  1808. Revision 1.35 2003/01/03 22:16:29 peter
  1809. * updated for absolutesym and varsym
  1810. Revision 1.34 2002/11/17 16:32:04 carl
  1811. * memory optimization (3-4%) : cleanup of tai fields,
  1812. cleanup of tdef and tsym fields.
  1813. * make it work for m68k
  1814. Revision 1.33 2002/10/20 14:49:31 peter
  1815. * store original source time in ppu so it can be compared instead of
  1816. comparing with the ppu time
  1817. Revision 1.32 2002/10/06 12:25:53 florian
  1818. + dump of tdefoptions.df_unique
  1819. Revision 1.31 2002/09/27 21:22:04 carl
  1820. * update system information
  1821. Revision 1.30 2002/09/26 12:03:54 florian
  1822. + support of constguid and constwchar const symbols added
  1823. Revision 1.29 2002/08/20 16:54:40 peter
  1824. * write address of varsym always
  1825. Revision 1.28 2002/08/19 19:36:44 peter
  1826. * More fixes for cross unit inlining, all tnodes are now implemented
  1827. * Moved pocall_internconst to po_internconst because it is not a
  1828. calling type at all and it conflicted when inlining of these small
  1829. functions was requested
  1830. Revision 1.27 2002/08/15 15:15:56 carl
  1831. * jmpbuf size allocation for exceptions is now cpu specific (as it should)
  1832. * more generic nodes for maths
  1833. * several fixes for better m68k support
  1834. Revision 1.26 2002/08/11 13:24:20 peter
  1835. * saving of asmsymbols in ppu supported
  1836. * asmsymbollist global is removed and moved into a new class
  1837. tasmlibrarydata that will hold the info of a .a file which
  1838. corresponds with a single module. Added librarydata to tmodule
  1839. to keep the library info stored for the module. In the future the
  1840. objectfiles will also be stored to the tasmlibrarydata class
  1841. * all getlabel/newasmsymbol and friends are moved to the new class
  1842. Revision 1.25 2002/05/18 13:34:27 peter
  1843. * readded missing revisions
  1844. Revision 1.24 2002/05/16 19:46:54 carl
  1845. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  1846. + try to fix temp allocation (still in ifdef)
  1847. + generic constructor calls
  1848. + start of tassembler / tmodulebase class cleanup
  1849. Revision 1.22 2002/05/12 16:53:18 peter
  1850. * moved entry and exitcode to ncgutil and cgobj
  1851. * foreach gets extra argument for passing local data to the
  1852. iterator function
  1853. * -CR checks also class typecasts at runtime by changing them
  1854. into as
  1855. * fixed compiler to cycle with the -CR option
  1856. * fixed stabs with elf writer, finally the global variables can
  1857. be watched
  1858. * removed a lot of routines from cga unit and replaced them by
  1859. calls to cgobj
  1860. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  1861. u32bit then the other is typecasted also to u32bit without giving
  1862. a rangecheck warning/error.
  1863. * fixed pascal calling method with reversing also the high tree in
  1864. the parast, detected by tcalcst3 test
  1865. Revision 1.21 2002/04/23 13:12:58 peter
  1866. * updated for posinfo change
  1867. * updated for mangledname change
  1868. * include i386 registers, removed reference to cpubase unit that would
  1869. make ppudump dependent on the source processor
  1870. Revision 1.20 2002/04/15 19:15:09 carl
  1871. + write std_reg2str instead of gas registers
  1872. Revision 1.19 2002/04/14 17:02:19 carl
  1873. + att_reg2str -> gas_reg2str
  1874. Revision 1.18 2002/04/07 10:23:36 carl
  1875. + added vm / sparc targets
  1876. Revision 1.17 2002/04/04 19:06:14 peter
  1877. * removed unused units
  1878. * use tlocation.size in cg.a_*loc*() routines
  1879. Revision 1.16 2002/04/04 18:50:27 carl
  1880. + added wdosx support (patch from Pavel)
  1881. Revision 1.15 2002/03/31 20:26:42 jonas
  1882. + a_loadfpu_* and a_loadmm_* methods in tcg
  1883. * register allocation is now handled by a class and is mostly processor
  1884. independent (+rgobj.pas and i386/rgcpu.pas)
  1885. * temp allocation is now handled by a class (+tgobj.pas, -i386\tgcpu.pas)
  1886. * some small improvements and fixes to the optimizer
  1887. * some register allocation fixes
  1888. * some fpuvaroffset fixes in the unary minus node
  1889. * push/popusedregisters is now called rg.save/restoreusedregisters and
  1890. (for i386) uses temps instead of push/pop's when using -Op3 (that code is
  1891. also better optimizable)
  1892. * fixed and optimized register saving/restoring for new/dispose nodes
  1893. * LOC_FPU locations now also require their "register" field to be set to
  1894. R_ST, not R_ST0 (the latter is used for LOC_CFPUREGISTER locations only)
  1895. - list field removed of the tnode class because it's not used currently
  1896. and can cause hard-to-find bugs
  1897. Revision 1.14 2002/03/28 20:48:52 carl
  1898. - remove go32v1 support
  1899. Revision 1.13 2002/03/28 16:44:59 armin
  1900. + new flag if unit has local threadvars
  1901. Revision 1.12 2002/03/01 14:08:47 peter
  1902. * parasym added
  1903. Revision 1.11 2002/01/06 12:08:16 peter
  1904. * removed uauto from orddef, use new range_to_basetype generating
  1905. the correct ordinal type for a range
  1906. }