home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 December / simtel1292_SIMTEL_1292_Walnut_Creek.iso / msdos / turbopas / bonus507.arc / CRTPATCH.ARC / CRTPATCH.DOC next >
Text File  |  1988-11-28  |  7KB  |  172 lines

  1.  
  2.                                 CRTPATCH 5.0
  3.  
  4. CRTPATCH is a utility that patches units compiled with Borland's CRT unit,
  5. allowing them to use the TPCRT unit in Turbo Professional 5.0 instead. In most
  6. situations, use of CRTPATCH isn't necessary. If you have the source code for
  7. the unit in question, you can simply change "USES CRT" to "USES TPCRT" and
  8. recompile the unit. CRTPATCH is for cases where the source code isn't
  9. available: the GRAPH3 and TURBO3 units in the Turbo Pascal runtime library,
  10. various third-party units such as those in The Research Group's Topaz, and so
  11. on. If you aren't using any such units, then you don't need CRTPATCH and you
  12. shouldn't use it.
  13.  
  14. We must warn you right up front that, although using CRTPATCH itself is quite
  15. simple, the process of conversion that goes with it is cumbersome. Please be
  16. sure to read this entire document before deciding whether or not the effort
  17. will be worth it. We at TurboPower Software wish that the process could be
  18. made easier, but it just can't.
  19.  
  20. We should also warn you that CRTPATCH has received comparatively minimal
  21. testing, mainly for lack of suitable test cases. We have, however, tested it
  22. on both GRAPH3 and TURBO3, and on a few concocted test cases. Although we
  23. don't anticipate that you'll have any problems with it, please be careful with
  24. it (meaning, keep backup copies of all the units you use it on). And if you do
  25. have problems, let us know as soon as possible.
  26.  
  27. Converting from CRT to TPCRT
  28. ----------------------------
  29. The following is a list of the steps you need to follow in order to make the
  30. conversion:
  31.  
  32. 1. Using TPUMOVER, remove the CRT unit from TURBO.TPL and rename it to
  33.    something appropriate like ORIGCRT.TPU:
  34.  
  35.       TPUMOVER turbo.tpl /* crt
  36.       REN crt.tpu origcrt.tpu
  37.  
  38. 2. Rename TPCRT.PAS to CRT.PAS.
  39. 3. Edit CRT.PAS, changing the unit name at the top of the file from TPCRT to
  40.    CRT.
  41. 4. Recompile CRT.PAS to create CRT.TPU. (Renaming TPCRT.TPU to CRT.TPU is not
  42.    sufficient!)
  43. 5. Using TPUMOVER or TPULIB, add the new CRT unit to TURBO.TPL:
  44.  
  45.       TPUMOVER turbo.tpl /+ crt
  46.  
  47. 6. If you use TURBO3 and/or GRAPH3, run CRTPATCH on them:
  48.  
  49.       CRTPATCH origcrt crt turbo3
  50.       CRTPATCH origcrt crt graph3
  51.  
  52. 7. Run CRTPATCH on the unit(s) causing the problems. For example:
  53.  
  54.       CRTPATCH origcrt crt myunit
  55.  
  56. 8. Change the source code for all units that use TPCRT (including the Turbo
  57.    Professional units!) to use CRT instead and recompile them.
  58.  
  59. Running CRTPATCH
  60. ----------------
  61. As you probably noticed, the syntax for CRTPATCH is simple:
  62.  
  63.     CRTPATCH OldCrt NewCrt TpuToPatch
  64.  
  65. OldCrt is the full pathname for the original CRT unit. NewCrt is the full
  66. pathname for the new CRT unit (formerly TPCRT). TpuToPatch is the full
  67. pathname for the TPU file to be patched. Note that an extension of 'TPU' is
  68. assumed in each case, so you don't need to specify it.
  69.  
  70. If all goes well, you should see something like the following:
  71.  
  72.   C> CRTPATCH origcrt crt myunit
  73.   CRTPATCH. Copyright (c) 1988 by TurboPower Software. Version 5.0.
  74.  
  75.   Reading symbol tables...
  76.   Patching MYUNIT...
  77.   MYUNIT patched successfully
  78.  
  79. The whole process should take only a few seconds.
  80.  
  81. Aside from a few self-explanatory error messages having to do with things
  82. like disk read/write errors, there only a few error messages you might see:
  83.  
  84.   "xxxxxxxx.xxx is not a version 5.0 TPU file"
  85.   Probably indicates that xxxxxxxx.xxx is a version 4.0 TPU file.
  86.  
  87.   "CRT not being used by this unit."
  88.   This simply means that TpuToPatch does not use CRT, so no patching is
  89.   required.
  90.  
  91.   "Cannot patch CRT itself"
  92.   This means that you specified CRT or ORIGCRT as the TPU file to patch.
  93.  
  94.   "CRT version mismatch. Can't patch unit."
  95.   This means that TpuToPatch was not compiled with OldCrt. It may indicate
  96.   that you've reversed the order of OldCrt and NewCrt on the command line.
  97.  
  98.   "Old and new CRT units match. No changes required."
  99.   This means that the checksums for OldCrt and NewCrt are identical, in which
  100.   case NewCrt can simply be used in place of OldCrt without patching any other
  101.   units. It doesn't mean that the two units are identical, just that the
  102.   compiler will perceive them to be interchangeable.
  103.  
  104.   "Unit name for XXXXX is not CRT"
  105.   This means that the unit name contained in XXXXX.TPU is not CRT. You would
  106.   see this message if, for example, you tried to use TPCRT without changing
  107.   its name and recompiling (see steps 3 and 4, above).
  108.  
  109.   "Fixup offset not found: $xxxx"
  110.   This indicates a serious problem, probably a bug in CRTPATCH. If such an
  111.   error occurs, please report it immediately.
  112.  
  113.   "Unexpected fixup type: $xx"
  114.   This error would indicate that TpuToPatch contains either a fixup type used
  115.   by the compiler's built-in linker that we've never encountered before, or a
  116.   fixup type that we had thought could occur only in reference to the current
  117.   unit. Again, if such an error occurs, please report it immediately.
  118.  
  119.   "Absolute variable not found. Offset = $xxxx"
  120.   This error would indicate that TpuToPatch contains a variable declared to be
  121.   absolute on top of a variable in OldCrt, and CRTPATCH was unable to locate
  122.   the data needed to patch the TPU file. If such an error occurs, please
  123.   report it immediately.
  124.  
  125. What to do if you get a new version of...
  126. -----------------------------------------
  127. Unfortunately, the chances are good that you will have to go through all or
  128. part of this bloody process again. There are two situations where doing so
  129. would be necessary:
  130.  
  131.   (1) You get a new version of the unit(s) that prompted you to use CRTPATCH
  132.   in the first place. This case is simple. All you need to do is repeat step
  133.   7--run CRTPATCH on the unit(s).
  134.  
  135.   (2) You get a new version of Turbo Professional. This is the nasty one: you
  136.   have to repeat all 8 of the steps described above. Note, however, that in
  137.   this case "OldCrt" would be the renamed copy of TPCRT that you were using
  138.   before you got the new version of Turbo Professional, *not* ORIGCRT.TPU.
  139.  
  140. Using CRTPATCH for other purposes
  141. ---------------------------------
  142. CRTPATCH can also be used in other, similar situations. For example, if you
  143. wrote a replacement for the PRINTER unit and wanted to use it with units you
  144. didn't have source for, CRTPATCH could do the same thing for it that it does
  145. for CRT/TPCRT. The trick is to pass the unitname as the (optional) fourth
  146. parameter to CRTPATCH. For example:
  147.  
  148.   CRTPATCH origprn printer myunit printer
  149.  
  150. Note that case (upper or lower) is not important.
  151.  
  152. Although we haven't tested CRTPATCH with any units other than CRT, there's no
  153. obvious reason why it shouldn't work equally well with other units. If you run
  154. into any problems when using it on other units, it probably indicates an
  155. inherent bug that could occur just as easily with CRT/TPCRT.
  156.  
  157.  
  158. ------------------------------------------------------------------------------
  159.  
  160. CRTPATCH is copyright (c) 1988 by TurboPower Software. It may be freely used
  161. and distributed.
  162.  
  163. If you have any problems with CRTPATCH, please contact:
  164.  
  165.    Brian Foley
  166.    TurboPower Software
  167.    PO Box 66747
  168.    Scotts Valley, CA
  169.    95066
  170.    408-438-8608
  171.    CompuServe 76317,3247
  172.