home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / utility / unittool / turbo5 / intrfac5 / intrfc.doc < prev    next >
Encoding:
Text File  |  1991-02-04  |  5.7 KB  |  134 lines

  1. See the READ.ME file!  This .DOC is out of date.
  2.  
  3. INTRFC - Program to print interface information for TPU files. (May, 1988)
  4.  
  5. Written for the public domain by D.J. Murdoch (CIS 71631,122 or
  6. Fidonet 1:221/177.40)
  7.  
  8. INTRODUCTION
  9.  
  10.      I started INTRFC because I got a library of Turbo Pascal 4.0
  11. subroutines from a bulletin board which had some errors in the
  12. documentation.  One of the functions wanted its arguments to be a
  13. special type, but the doc's didn't tell me which one.  TP gave me
  14. an error message saying I wasn't using the right type, but
  15. wouldn't tell me which one to use either.  I decided to decode
  16. the TPU file and figure out what TP wanted.  Once I got started,
  17. it was hard to stop.  So, I ended up writing INTRFC, which prints
  18. out almost all the information you'll ever need about the
  19. interface to a TPU unit.  (You can also get information about
  20. units in TPL's; see below.)
  21.  
  22.      Because of the way it was written, i.e. entirely by
  23. guesswork, I'm sure there are numerous special cases that it
  24. doesn't handle properly.  That's one reason the source code is
  25. there - so other people can fix up my mistakes.
  26.  
  27.      The other reason I included source code is because it will
  28. serve as a bit of documentation for the TPU file format while we
  29. all wait for Borland to publish it.  (I imagine they want to be
  30. free to change the format before they publish it, making INTRFC
  31. obsolete when TP 4.1 arrives.)  Others who want to do completely
  32. different things to a TPU file may benefit from reading it.  (The
  33. other difficulty with a program written the way this one was is
  34. that comments are almost non-existent.  If you have any short
  35. questions about it that you can't figure out, send them to me at
  36. one of the addresses above.)
  37.  
  38. USAGE:  INTRFC [unit path]
  39.  
  40.      The user interface (sorry!) to INTRFC is really primitive.
  41. Just run it without any arguments, and answer the prompt for a
  42. unit.  Don't type the ".TPU".  It expects to find any referenced
  43. units in the current directory.  Or, if you like, specify a path
  44. on the command line where it can find the other units.  (It needs
  45. to look in them for names and types sometimes).  This path should
  46. also contain the TURBO.TPL file containing the system units.
  47.  
  48.     After it prints the interface to the unit you specify, it
  49. will ask for another one.  To quit, you'll have to hit break or
  50. Ctrl-C. (F6 or Ctrl-Z might also work, by crashing it.)  Both
  51. input and output can be redirected using "<" and ">".  (Watch out
  52. though, the prompts get redirected too.  I warned you it was
  53. primitive.)
  54.  
  55. TPU STRUCTURE
  56.  
  57.     Below are some notes on the general structure of a TPU file.
  58. For more detail, see the source code.  When I named something
  59. there with a totally obscure name (like i1, or ofs1) it generally
  60. meant that I don't have any idea what it was for.
  61.  
  62.     There are three parts to a TPU file - the symbol area, the
  63. code area, and the data area.  (TPUMOVER will tell you how big
  64. each is.)  INTRFC only looks at the symbol area.
  65.  
  66.     At the start of it, there's a table giving sizes and offsets
  67. of important parts of the file.  Most important is the hash table
  68. - it gives the addresses (16 bit pointers) of many of the objects
  69. that are defined in the interface block.  (The hash function
  70. seems to be a simple one.  Letters A-Z and a-z get mapped to 0-
  71. 25, underscores and digits get their ascii codes, and longer
  72. strings get the sum of the codes of their characters, modulo the
  73. table size).  In case of a collision (i.e. hash(object 1) =
  74. hash(object 2) ), there's a pointer at the beginning of each
  75. object to the next one with the same hash value.
  76.  
  77.     Things being defined are stored in variations on 2 or 3
  78. kinds of record.  The main storage is as what I call an Object.
  79. This gives a pointer to the next object with the same hash
  80. number, the name of the object, and is followed by the
  81. Information.  The Information defines what "kind" of object this
  82. is, i.e. a variable, type, constant, etc.  It also gives some
  83. information about the object, often including references to the
  84. third kind of record, the Type Definitions.  These are like
  85. Information records, subdividing the various types, e.g. array,
  86. string, set, etc.
  87.  
  88.     All variables have an offset.  If they are part of a record,
  89. this is the offset within the record.  If not, then I assume
  90. these are the offsets in the data segment (but haven't checked).
  91.  
  92. TPL STRUCTURE
  93.  
  94.     TPL files have a very simple structure.  They seem to be just
  95. a collection of TPU files strung together.  (The header might be
  96. slightly varied; I'm not sure.)
  97.  
  98.     Borland provides the TPUMOVER program which can extract TPU
  99. files from TPL files.  Either use the command line /* option or
  100. mark the unit you want in full-screen mode and use INS to extract
  101. it.
  102.  
  103. LIMITATIONS
  104.  
  105.     There are tons of limitations to INTRFC.  It doesn't know how
  106. to print any but the simplest types of constants.  It won't print
  107. the values of typed constants.  It won't read files bigger than
  108. 64K.  Etc. Etc. Etc.  If you want it to do something differently
  109. just go ahead and change it!  I recommend compiling with all
  110. possible checks turned on, since it's pretty easy to get lost in
  111. all those pointers.
  112.  
  113. FILES
  114.  
  115. The following files should be included in this package.
  116.  
  117. INTRFC.DOC      - This file.
  118. INTRFC.EXE      - The executable program.
  119. GLOBALS.PAS     - The global declarations.
  120. HASH.PAS        - The routines to walk through the hash table, and
  121.                   to get units
  122. INTRFC.PAS      - The main program.
  123. OBJSTUFF.PAS    - The various routines for printing objects.
  124. TEST1.PAS       - A test unit.
  125. UTIL.PAS        - Various utility routines.
  126.  
  127. THAT'S IT!
  128.  
  129.      Have fun with INTRFC and Turbo Pascal.  I'd like to hear of
  130. any novel uses.
  131.  
  132. D.J. Murdoch
  133.  
  134.