home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari FTP
/
ATARI_FTP_0693.zip
/
ATARI_FTP_0693
/
Mint
/
mntlib25.zoo
/
purec
/
orig
/
readme
Wrap
Text File
|
1992-09-30
|
12KB
|
271 lines
MiNT Library for Turbo C / Pure C
ported by: Ulf Moeller (Ulf_Moeller@hh2.maus.de)
Michael Hohmuth (hohmuth@freia.inf.tu-dresden.de)
============================================================================
This Michael Hohmuth's version of Ulf Moeller's port. The description of
the installation follows after Ulf's opening words:
----------------------------------------------------------------------------
This is a port of Eric Smith's MiNT library for Turbo C and Pure C.
The assembler files are partly based on Dave Gymer's Sozobon port. The
MiNT library replaces the functions of PCSTDLIB. For floating point support,
you must still use the Pure C libraries.
I have not fully tested the library, and of course there is no warranty
for whatsoever. Since there is a number of major differences between GNU C
and Pure C, bugs are not really improbable. What is true for the Sozobon
version, applies to this one even more: "is very experimental and quite
probably needs more work; caveat emptor."
----------------------------------------------------------------------------
INSTALLATION.
-------------
[Parts of the following description are derived from Ulf's README.]
Create Your Environment.
0) Don't delete the Sozobon C support directory. A few C sources of this
directory are used.
1) Create a copy of the file PC.CNF resp. TC.CNF in the Pure/Turbo C
directoy, named MINTLIB.CNF
2) Copy the files math.h and float.h from the Pure/Turbo C include directory
to the MiNT library include directory, naming them tcmath.h resp.
tcfloat.h
3) Only for Turbo C:
=================
o Delete the assembler options for setjmp.s and alloca.s in the files
mintlib.prj and test.prj; remove the semicolon in front of the
symbol definitions in the corresponding source files.
o Comment out the line
"falloca.s [-O=falloca -DSTACK_CHECKING=1 -DFPU=1]"
in test.prj.
o Comment out pclong.s in mintlib.prj. (You'll have to link the standard
library tcstdlib.lib for long int arithmetics support in your project
files.)
o For the GEMDOS/MiNT bindings that have to be linked to the MiNT
library, you have two choices:
a) I'd strongly suggest you to get the osbind library by Ole Arndt and
Ulf Moeller. It replaces all functions of the tctoslib.lib, with a few
slight enhancements, and contains all MiNT bindings.
List osbind.prj in mintlib.prj, and comment out pctoslib.lib and
mintbind.s.
b) If you don't have the osbind library, you can do the following:
In mintlib.prj, change the file name pctoslib.lib to tctoslib.lib.
Look over mintbind.s. Delete all instances of the strings ".MODULE"
and ".ENDMOD". (MAS, the assembler that comes with Turbo C, doesn't
understand them.)
Disadvantage: All MiNT bindings in mintbind.s get linked to your
programs in their entirety if you (or other library functions) use
any MiNT binding at all.
o In mintflt.prj, change the file name pcfltlib.lib to tcfltlib.lib.
4) Start C, load mintlib.cnf and set the include directory to the the
directory where the MiNT library's include files reside. In the
Options/Shell dialog, turn off "Make breaks on compiler warnings".
With Pure C, turning on the compiler caches speeds up the Make procedure
dramatically.
If you want debug information in the libraries, set the compiler switch
-Y (Options/Compiler, Options/Assembler and Options/Linker).
Make The Floating Point Library.
This library contains the float/double support for the compiler as well as
versions of printf/scanf that support floating point numbers.
5) Select the project file MINTFLT.PRJ. Make all.
5a) You have to delete the files main.o, doprnt.o, scanf.o, difftime.o and
purec/setjmp.o now. These files have to be recompiled with the Line-F
support (step 6) and the main part of the MiNT library (step 7).
Make The Line-F Support Library. (Pure C only)
This library contains actually the same as the floating point library, plus
support for programs that use a FPU directly via Line-F.
6) Only for Pure C:
================
Repeat steps 5 and 5a with MINT881.PRJ.
Make The MiNT Library.
7) Select the project file MINTLIB.PRJ. Make all.
This step takes a while (around 15 minutes with Pure C and an 8MHz ST).
(But compared to the time GNU C needs to make the library -- you'll
love it! :-)
Compile The Startup Code And The Assembler Version Of alloca();
Test The Libraries.
8) Select the project file TEST.PRJ. Make all.
This compiles the startup code and the assembler versions of alloca(),
and links a test program.
(Pure C: You get a linker warning "Doubly defined symbol: 'alloca'"
because alloca.s and falloca.s both define a symbol `alloca'. Ignore it.)
9) Run. You should get a "Hello, world." message.
Install The Libraries.
10) Copy the files crt0.o, alloca.o, mintlib.lib, mintflt.lib, falloca.o and
mint881.lib (the last two are Pure C only) to the directory you want them
to reside.
USAGE.
------
If you want to use the MiNT library for your project, consider the following:
General Usage.
o Make sure that the include directory (Options/Compiler) is set to the
directory where the include files of the MiNT library reside, and that
the libraries directory is set to the directory you copied the objects
to (step 10).
o Use crt0.o as your startup code.
o List mintlib.lib in your project file. This replaces the library
pctoslib.lib (resp. tctoslib.lib). You can still use pcextlib.lib
(tcextlib.lib) for backward compatibelity, but you probably don't want
to. The pcstdlib.lib library you only need if you want to use floating
point arithmetics in your program (see below). For GEM and BGI graphics,
you can still use pcgemlib.lib and pcbgilib.lib. (Be careful with the GEM
library; I have not yet checked whether the header files of the MiNT
library are conform with the library.)
o Two simple project files are delivered with the library. You can use
them as a reference when creating your own project files:
default.prj - compiles the topmost window with float support
tc-deflt.prj - dito, for Turbo C
idefault.prj - compiles the topmost window without float support
tc-idflt.prj - dito, for Turbo C
Float Support.
o The library file mintlib.lib does not contain float support for
Pure/Turbo C. If you want to use floating point numbers in your program,
you'll have to link mintflt.lib and pcstdlib.lib (which also contains
some float support). List mintflt.lib BEFORE mintlib.lib and pcstdlib.lib
AFTER mintlib.lib in your project file (tc* versions respectively).
Turbo C Caveats.
o When used with Turbo C, you'll always have to link tcstdlib.lib. It
contains the long arithmetics support for the compiler. List tcstdlib.lib
AFTER mintlib.lib in your project file.
FPU Support.
o Pure C: For real (i.e. Line-F) FPU support, replace mintflt.lib by
mint881.lib and use the appropriate compiler flag (-8) to compile your
project.
If you want to use the assembler version of alloca() in your program (see
below), replace alloca.o by falloca.o in your project file.
o Turbo C: The Turbo C libraries don't support FPUs via Line-F. You might
want to try Peter Fiebelkorn's FPUPATCH: Apply the patch to your original
Turbo C libraries and use the resulting tcflt.lib instead of tcfltlib.lib
in the library's mintflt.prj, and use tcstd.lib instead of tcstdlib.lib
in your project file.
The Stack.
o The Pure/Turbo Linker usually reserves stack space in the BSS. If you
set stack size 0 for the linker, the MiNT library will use the usual
convention of setting the stack by _stksize (default: 8k); see crtinit.c
for details.
o The stack checking option does not work with threads, or with malloc
from heap.
o Implementation Note: crtinit.c and the parts of the MiNT library that
are executed during abnormal program termination must not be compiled
with stack checking set. With the assembler option -DSTACK_CHECKING=0 or
1, you can control if alloca checks whether there is enough stack space
for it.
Using alloca().
o The alloca() function is a certain problem for Pure/Turbo C. The library
contains a slow-but-secure version of alloca(). You can also link the
the (fast) assembler version of alloca() (by listing alloca.o [resp.
falloca.o, see "FPU Support" above] BEFORE mintlib.lib in your project
file). This version only works if the caller was compiled with option -S
(Options/Compiler/Standard Stack Frames). Otherwise, it will destroy the
stack and the program will crash.
Use Prototypes!
o Giving prototypes is important for Pure C. They are absolutely necessary
for functions with a variable argument list (e. g. error() in the GNU
file utilities).
How To Include Files From Subdirectories?
o Pure/Turbo C does not understand e.g. #include <sys/dir.h>. It tries to
open a file 'sys/dir.h' in the current directory instead of the file
'dir.h' in the subdirectory 'sys'. Therefore you either have to use
#include <sys\dir.h>, or you use the program unixname.prg by Michael
Schwingen that is shipped with this library: Simply move it to your AUTO
folder, or run it from the desktop before you start C. When installed,
it converts all slashes to backslashes automagically when accessing disk
files.
I have no docs for unixname.prg, so here's a short description:
When used with MiNT, unixname.prg works best when run after MiNT. Note
that it only converts file names that are passed as parameters to a
standard GEMDOS calls; it does not convert file names passed to a MiNT
system call. (However, MiNT aware programs should be aware of slashes in
any case.) WARNING: This program modifies the file name in the caller's
address space. With this program installed you cannot any longer use
files that contain slashes in their base name.
To make the library you don't nessecarily have to install unixname.prg.
Before...
...you try the PS from the MiNT utilities, change this:
178c178
< printf("%03d %03d %3d %3d %s %8ld %02d:%02d.%02d %s%s\n",
---
> printf("%03d %03d %3d %3d %s %8ld %02ld:%02ld.%02ld %s%s\n",
LEGAL NOTICE.
-------------
The library binaries mintlib.lib, mintflt.lib and mint881.lib, when built
with the setup as shipped, will contain Turbo/Pure C's library binaries.
Don't make these binaries available to the public, always ship this library
in source form.
----------------------------------------------------------------------------
If you want to contact me, here are my addresses:
--
Email:
Internet: hohmuth@freia.inf.tu-dresden.de [preferred]
mh1@irz301.inf.tu-dresden.de [if the other one
doesn't work]
IRC:
Nickname: Spell
You can drop me a note at NoteServ.