This FAQ contains most often asked questions and answers about Clipper-to-C compiler TugBoat
This FAQ available to http://www.geocities.com/cl2cru/FAQ.htm
Q. What is TugBoat ?
A. TugBoat is high optimized compiler from language Clipper to language C.
Q. With which C-compiler do you compile the C-programs?
A. I use compilers Borland (16-bits parts), as from version
3.1. to 5.02
Recommended options at file bcls.bat -- USE IT FOR COMPILATION
Next, same compiler, which were compiled the Clippers
libraries. (I did not test this case. There can be surprises.)
For versions less 5.3 this Microsoft C 5.1 (if you its will be
able to find).
The correct compiler switches are /FPa /Gs /Oals /AL.
For versions >= 5.3 this Microsoft C 8.0.(Also now this variant is not checked up.)
But for Microsoft compilers You should assign
#define _fastcall
at file clc.h and rebuild CLCLIB
Q. What options of command line TugBoat ?
A. Options /W /M /N /L /A -- same as in Clipper
Option /F -- do not load type of argument definition for standard
Clippers function.
Option /O -- do optimization pass
Q. How do i get hold of a evaluation copy?
A. Currently http://www.geocities.com/cl2cru/TugBoat_55.zip
Q. What more features gives TugBoat?
A. You may describe the types of arguments used by you functions and types of returned values. This information is used for:
- The Main! The Automatic calculation of type variables.
The Descriptions standard function language are built right in
compiler. Exactly due to this information a compiler can compute
the types.
- Knowledge of types of arguments helps the compiler to create the faster code.
- Last on order, but not on importance:
Determination of types of arguments allows not only to check them
during compiling statically, but also find collisions of types
far off from place of call to functions.
Q. And how describe the types of parameters, variable and etc. ?
A. Syntax of variables with types:
STATIC [type] name := expr, name := expr, ...
LOCAL [type] name := expr, name := expr, ...
where [type] is one of:
__shortint | (that is to say "short int" at "C") |
__integer | (that is to say "long int" at "C") |
__logical | (that is to say "int" at "C") |
__real | (that is to say "ITEM" at "C") |
__string | (that is to say "ITEM" at "C") |
__array (OBJECTS also describes as __array) |
("ITEM") |
__nil | (that is to say "ITEM" at "C") |
__date | (that is to say "ITEM" at "C") |
Syntax of description to external function:
external function name_function (arg1, arg2,...) returned
where "arg" or "returned" is
[type] | [type] |...
That is to say, example:
external function val (__string) __INTEGER | __REAL
Syntax of description to static function:
__static function name_function (arg1, arg2,...) returned
where "arg" or "returned" similarly
WARNING: all definitions of functions must be at file head
Q. Why __real is compiled in "ITEM", rather then in "double"?
A. Since too on different handled with floating point different versions Clipper and different compilers C
Q. How Do I use TugBoat ?
A. In common:
a) Do Compile to "C" your critical functions
b) Do not compile to "C" your "main" function
c) Do not compile to "C" too many functions in real
mode.
(Since compiled through "C" program occupies in 2 times
more memories)
Q. What about protected mode ?
A. ExoSpace - Ok. Blinker 5.1 not. Go research.
Q. How link with TugBoat
A. For RTLINK & ExoSpace it looks so:
The first file should be the file with the main procedure,
compiled by Clipper.
The second file should be CLCINEXI.OBJ from delivery TugBoat.
Further there can be object files compiled as Clipper, and TugBoat
in a random order.
Then library CLCLIB.LIB.
Further other used libraries.
For others linker simularly