Dec 232017
 
Patch TPU files that use the CRT units so that they will work with programs written using Turbo Powers TPCRT unit.
File CRTPATCH.ZIP from The Programmer’s Corner in
Category Pascal Source Code
Patch TPU files that use the CRT units so that they will work with programs written using Turbo Powers TPCRT unit.
File Name File Size Zip Size Zip Type
CRTPATCH.DOC 7292 2904 deflated
CRTPATCH.EXE 11264 6528 deflated

Download File CRTPATCH.ZIP Here

Contents of the CRTPATCH.DOC file



CRTPATCH 5.0

CRTPATCH is a utility that patches units compiled with Borland's CRT unit,
allowing them to use the TPCRT unit in Turbo Professional 5.0 instead. In most
situations, use of CRTPATCH isn't necessary. If you have the source code for
the unit in question, you can simply change "USES CRT" to "USES TPCRT" and
recompile the unit. CRTPATCH is for cases where the source code isn't
available: the GRAPH3 and TURBO3 units in the Turbo Pascal runtime library,
various third-party units such as those in The Research Group's Topaz, and so
on. If you aren't using any such units, then you don't need CRTPATCH and you
shouldn't use it.

We must warn you right up front that, although using CRTPATCH itself is quite
simple, the process of conversion that goes with it is cumbersome. Please be
sure to read this entire document before deciding whether or not the effort
will be worth it. We at TurboPower Software wish that the process could be
made easier, but it just can't.

We should also warn you that CRTPATCH has received comparatively minimal
testing, mainly for lack of suitable test cases. We have, however, tested it
on both GRAPH3 and TURBO3, and on a few concocted test cases. Although we
don't anticipate that you'll have any problems with it, please be careful with
it (meaning, keep backup copies of all the units you use it on). And if you do
have problems, let us know as soon as possible.

Converting from CRT to TPCRT
----------------------------
The following is a list of the steps you need to follow in order to make the
conversion:

1. Using TPUMOVER, remove the CRT unit from TURBO.TPL and rename it to
something appropriate like ORIGCRT.TPU:

TPUMOVER turbo.tpl /* crt
REN crt.tpu origcrt.tpu

2. Rename TPCRT.PAS to CRT.PAS.
3. Edit CRT.PAS, changing the unit name at the top of the file from TPCRT to
CRT.
4. Recompile CRT.PAS to create CRT.TPU. (Renaming TPCRT.TPU to CRT.TPU is not
sufficient!)
5. Using TPUMOVER or TPULIB, add the new CRT unit to TURBO.TPL:

TPUMOVER turbo.tpl /+ crt

6. If you use TURBO3 and/or GRAPH3, run CRTPATCH on them:

CRTPATCH origcrt crt turbo3
CRTPATCH origcrt crt graph3

7. Run CRTPATCH on the unit(s) causing the problems. For example:

CRTPATCH origcrt crt myunit

8. Change the source code for all units that use TPCRT (including the Turbo
Professional units!) to use CRT instead and recompile them.

Running CRTPATCH
----------------
As you probably noticed, the syntax for CRTPATCH is simple:

CRTPATCH OldCrt NewCrt TpuToPatch

OldCrt is the full pathname for the original CRT unit. NewCrt is the full
pathname for the new CRT unit (formerly TPCRT). TpuToPatch is the full
pathname for the TPU file to be patched. Note that an extension of 'TPU' is
assumed in each case, so you don't need to specify it.

If all goes well, you should see something like the following:

C> CRTPATCH origcrt crt myunit
CRTPATCH. Copyright (c) 1988 by TurboPower Software. Version 5.0.

Reading symbol tables...
Patching MYUNIT...
MYUNIT patched successfully

The whole process should take only a few seconds.

Aside from a few self-explanatory error messages having to do with things
like disk read/write errors, there only a few error messages you might see:

"xxxxxxxx.xxx is not a version 5.0 TPU file"
Probably indicates that xxxxxxxx.xxx is a version 4.0 TPU file.

"CRT not being used by this unit."
This simply means that TpuToPatch does not use CRT, so no patching is
required.

"Cannot patch CRT itself"
This means that you specified CRT or ORIGCRT as the TPU file to patch.

"CRT version mismatch. Can't patch unit."
This means that TpuToPatch was not compiled with OldCrt. It may indicate
that you've reversed the order of OldCrt and NewCrt on the command line.

"Old and new CRT units match. No changes required."
This means that the checksums for OldCrt and NewCrt are identical, in which
case NewCrt can simply be used in place of OldCrt without patching any other
units. It doesn't mean that the two units are identical, just that the
compiler will perceive them to be interchangeable.

"Unit name for XXXXX is not CRT"
This means that the unit name contained in XXXXX.TPU is not CRT. You would
see this message if, for example, you tried to use TPCRT without changing
its name and recompiling (see steps 3 and 4, above).

"Fixup offset not found: $xxxx"
This indicates a serious problem, probably a bug in CRTPATCH. If such an
error occurs, please report it immediately.

"Unexpected fixup type: $xx"
This error would indicate that TpuToPatch contains either a fixup type used
by the compiler's built-in linker that we've never encountered before, or a
fixup type that we had thought could occur only in reference to the current
unit. Again, if such an error occurs, please report it immediately.

"Absolute variable not found. Offset = $xxxx"
This error would indicate that TpuToPatch contains a variable declared to be
absolute on top of a variable in OldCrt, and CRTPATCH was unable to locate
the data needed to patch the TPU file. If such an error occurs, please
report it immediately.

What to do if you get a new version of...
-----------------------------------------
Unfortunately, the chances are good that you will have to go through all or
part of this bloody process again. There are two situations where doing so
would be necessary:

(1) You get a new version of the unit(s) that prompted you to use CRTPATCH
in the first place. This case is simple. All you need to do is repeat step
7--run CRTPATCH on the unit(s).

(2) You get a new version of Turbo Professional. This is the nasty one: you
have to repeat all 8 of the steps described above. Note, however, that in
this case "OldCrt" would be the renamed copy of TPCRT that you were using
before you got the new version of Turbo Professional, *not* ORIGCRT.TPU.

Using CRTPATCH for other purposes
---------------------------------
CRTPATCH can also be used in other, similar situations. For example, if you
wrote a replacement for the PRINTER unit and wanted to use it with units you
didn't have source for, CRTPATCH could do the same thing for it that it does
for CRT/TPCRT. The trick is to pass the unitname as the (optional) fourth
parameter to CRTPATCH. For example:

CRTPATCH origprn printer myunit printer

Note that case (upper or lower) is not important.

Although we haven't tested CRTPATCH with any units other than CRT, there's no
obvious reason why it shouldn't work equally well with other units. If you run
into any problems when using it on other units, it probably indicates an
inherent bug that could occur just as easily with CRT/TPCRT.


------------------------------------------------------------------------------

CRTPATCH is copyright (c) 1988 by TurboPower Software. It may be freely used
and distributed.

If you have any problems with CRTPATCH, please contact:

Brian Foley
TurboPower Software
PO Box 66747
Scotts Valley, CA
95066
408-438-8608
CompuServe 76317,3247


 December 23, 2017  Add comments

Leave a Reply