INTRFC - Program to dump TPU files. (June, 1991)
Version 6.3: Dumps TP 6.0 and TPW 1.5 format files.
Written for the public domain by D.J. Murdoch (CIS 71631,122,
Fidonet 1:249/1.5, or Internet dmurdoch@mast.queensu.ca.)
INTRODUCTION
I started INTRFC because I got a library of Turbo Pascal 4.0
subroutines which had some errors in the documentation. One of the
functions wanted its arguments to be a special type, but the doc's
didn't tell me which one. TP gave me an error message saying I
wasn't using the right type, but wouldn't tell me which one to use
either. I decided to decode the TPU file and figure out what TP wanted.
Once I got started, it was hard to stop. So, I ended up writing INTRFC,
which printed out almost all the information you'll ever need about
the interface to a TPU unit.
When I upgraded INTRFC to TP 5.5 files, I got carried away again.
Version 1.2 dumped the complete file, not just the interface section.
The release of TP 6.0 made it necessary to upgrade again. This one
was easy: there aren't very many differences between version 5.5 and
6.0 .TPU files. I decided to fill in a couple of gaps in version 1.2,
and the current one dumps everything in the file. However, I made a few
mistakes in release 1.3; version 1.31 fixed those.
When TP for Windows, version 1.0, came out, I was amazed that
version 1.31 almost worked; it turns out that the file format for TP6
and TPW1 is identical. There were a few errors in INTRFC 1.31 because
some of the Windows features had never showed up; version 1.32, filled
in those areas. I also cleaned up the display a bit.
In June '92, TPW 1.5 came out with completely compatible .TPU
files. No need for an upgrade. However, William Peavy pointed out the
omission of the flag for "interrupt" procedures, so I added that in.
I also got tired of the terrible numbering scheme I'd stuck to for so
long, and decided that instead of 1.33, I'd call the new one 6.3.
That's what you've got now.
Because of the way INTRFC has been written, i.e. entirely by
guesswork, there are probably special cases that it doesn't handle
properly. That's one reason the source code is there - so other people
can fix up my mistakes. (And if you do, please tell me - reports from
users are how I found the bugs that version 1.31 fixed.)
The other reason I included source code is because it will serve
as a bit of documentation for the TPU file format: Borland will never
publish it. They want to be free to change the format, tweaking
performance when they can. (As you'll see if you study the .TPU
design, the famous "obsolete .TPU" problem doesn't come from the
frequent format changes; it's basic to the .TPU design itself.
References to old SYSTEM and other units just can't be updated.)
This reason has become a little obsolete now: William Peavy has
written a very complete description of the TP 6.0/TPW 1.x .TPU format;
I highly recommend picking up a copy.
I hope others who may want to do completely different things to a
TPU file will benefit from reading the source. One difficulty they're
likely to have with a program written the way this one was is that
comments are almost non-existent. If you have any short questions
about it that you can't figure out, send them to me at one of the
addresses above.
USAGE:
INTRFC /options unit
where options are letters from the following:
B - emitted code Bytes
C - initialized Constant blocks
D - coDe blocks
E - routine Entry records
G - emitted Global const bytes
H - TPU Header
I - Implementation section (if $D was used in compilation)
L - proc/fn Locals (if $L was used in compilation)
M - source line number map
N - Names in interface
O - Object VMT records
R - Relocation records
S - Source file records
U - Unit list
V - Var blocks
W - Windows DLL list
A - turn All options on
Tpath - set the Turbo directory, where the TURBO.TPL and
referenced units are kept
Options are processed sequentially and toggle the display.
E.G. To see all but the relocation records in the system unit, use
INTRFC /AR /T\turbo SYSTEM
The default is just the names in the interface section.
LIMITATIONS
There are tons of limitations to INTRFC. It doesn't know how
to print any but the simplest types of constants. It won't print the
values of typed constants. Etc. Etc. Etc. If you want it to do
something differently just go ahead and change it! I recommend
compiling with all possible checks turned on, since it's pretty easy
to get lost in all those pointers.
FILES
The following files should be included in this package.
INTRFC DOC This file
TPU9 DOC TPU structure outline
INTRFC EXE The executable
INTRFC PAS Main program
GLOBALS PAS Program globals
HEAD PAS TPU header dumper
NAMELIST PAS Prints interface section
NAMETYPE PAS Type definitions for NAMELIST
BLOCKS PAS Routines for code blocks, etc.
SRCFILES PAS Prints source files & line numbers
RELOC PAS Prints relocation records
CODE PAS Code and const dumper
DUMP PAS Various dump routines
LOADER PAS Reads in .TPU and .TPL files
UTIL PAS Various utility routines
TEST1 PAS Test file
TEST1 INC Test include file
PARAMS PAS Parses parameters
THAT'S IT!
Have fun with INTRFC and Turbo Pascal. I'd like to hear of
any novel uses.
D.J. Murdoch
|