Tue Oct 26 23:28:50 1993 GM:

libg++ v2.4 for gerlib-package (amiga)
--------------------------------------

Here is a minimal implemention of gnu's libg++-2.4.

Some (minor) changes were necessary to compile all we need without
too much overhead. Not all files of the original distribution are
provided, only the ones which were necessary or easily to compile.

Some notes on the implemantation:

Unix uses an int to store the "file-descriptor" returned by open(),
close etc. Predefined ints are 0 for stdin, 1 for stdout and 2 for
stderr.

As I did'nt want to write an overlay that converts the ints returned
by open() I changed the libraray and the functions to store the
BPTR from our AmigaDos-Open(). So no extra overhead layer is created.

The int values 0/1/2, however, are supported for compatiliby reasons
in the functions open and close. (You won't need them, tough)

Some things that are not supported by this implemementation of
libg++: (look at the ger_changes-File for exact diffs (sorry, german))

	- procbuf (A procbuf can read from or write to a Unix process)
    - class stdiobuf (yet)

In the src/-directory some changes had to be done, look at the
provided ger_changes-file. Sorry, it is in german...

Not supported is : Curses
                   the provided malloc
                   DLLs

If you want to compile unix-prgs, please use the gcc-Package of m.wild!

Functions like fopen/fclose/printf/sprintf etc. are supported through
the iostreams/stdio-directory. To use them you have to use

	#include <stdio.h>

. But be careful, stdio.h redefines sprintf and printf to sprintf_gcc
and printf_gcc, so if you want to use sprintf and printf from amiga.lib,
#define sprintf and printf to something different BEFORE you include
stdio.h, e.g.:

#define sprintf _sprintf
#define printf _printf

#include <stdio.h>

#undef printf
#undef sprintf

Now you can use (s)printf (from amiga.lib) and (s)printf_gcc (from
iostreams-package). This difference is important if you are using
e.g. floating point numbers, only (s)printf_gcc is able to handle them!

If you use c++-cout/cerr, use printf_gcc to get syncronized output!

Normally there is no need to use (s)printf of amiga.lib if you are
using the iostream-Package. (s)printf of iostream-Package is MUCH
better than the one in amiga.lib ;-)

stdio.h also defines stdin and stdout, you can't use them as BPTRs
any more. You can use Input() and Output() for them instead (stdin
is nomally defined as Input() and stdout=Output()).

If you want to compile programs that require standard argc and argv, or,
are not amiga-Programs (that means open icon.library, commodities.library,
mathtrans.library, mathieeedoubtrans.library and mathieeedoubbas.library)
you can use the include-file "use_standard_argc_argv.h".
This include-file has to be included in front of all the other include-files.

So a minimal program "minimal.cc" that uses cin/cout looks like:
(examples/test/startup/minimal.cc)

#define NEED_STDOUT
#include <use_standard_argc_argv.h>
#include <iostream.h>

int main(int argc, char *argv[])
{
	cout << "Hello, World, ";

	if(argv[0])
		cout << "our name is " << argv[0];
	else
		cout <<"nice that you started me from workbench";

	cout << ", we have " << argc << " arguments !" << endl;

	return 0;
}

compile with:

gccv minimal.cc -lgpp -lger -lamiga

If the program needs a standard window (even if startet from workbench),
define NEED_STDOUT, and a standard window is opened. The user can change
the Window specifications via a tooltype-entry "WINDOW=...". All other
tooltype options will get options as the would have been entered as options
behind the command in the shell.

If the program is started from WB, the name of the program will be ZERO,
so be sure you check the name. If you access argv[1], and no option is
entered, you will get an enforcer-hit.

Look for the examples in examples/test/startup to get further informations.
