diff --git a/documentation/README.html b/documentation/README.html index 3bbad8d..0654597 100644 --- a/documentation/README.html +++ b/documentation/README.html @@ -28,7 +28,8 @@ rewrite that library from scratch.
header files, then proceeded to implement each single function referenced in them. With few exceptions in the area of wide character support, the result should be a feature complete implementation of the ISO 'C' (1994) runtime -library. +library. The library was subsequently updated to offer functionality defined in +ISO/IEC 9899:1999, also known as C99.Because Samba needs a few POSIX-like routines to be supported, the library functionality is complemented by a set of routines described in Advanced @@ -46,17 +47,10 @@ precision. You either get double precision (IEEE math) or extended precision Use the IEEE_FLOATING_POINT_SUPPORT preprocessor symbol to activate IEEE math code and the M68881_FLOATING_POINT_SUPPORT symbol for M68881 inline math.
-For the PowerPC platform, the library uses code borrowed from fdlibm 5.3, +
For the PowerPC platform, the library uses code borrowed from fdlibm 5.3, which is a portable library of arithmetic functions developed by Sun Microsystems which, for example, is also used within the Java platform.
-Not unlike SAS/C, you can configure a minimum stack size the program is to use -when it starts up. This is controlled via the __stack_size variable (see -stdlib_main.c).
- -I added some amiga.lib and debug.lib functionality to the library, but don't -count on it to be complete.
-This library is a departure from the typical 'C' runtime environments of the @@ -73,13 +67,13 @@ to a compiler environment which supports them.
HookEntry(), CallHook(), CallHookA(), the DoMethod() family, the RexxVars family, but that's all. If you need more, you would have to implement it yourself. Put another way, if you absolutely need functionality that is only -found in amiga.lib, you really shouldn't need in in the first place. +found in amiga.lib, you really shouldn't need it in the first place.I originally thought that it might be helpful to piece this library together -from various sources, such as the BSD libc. Turned out that this code was so +from various sources, such as the BSD libc. It turned out that this code was so 'portable' that it became much more complex than it ought to be. Also, some side-effects were present which considerably changed the behaviour of the library. For example, the BSD libc uses bcopy() as an alias for memcpy(), and @@ -99,7 +93,7 @@ routines and the startup code. The M68881 inline math code comes from the
There is hardly any documentation on the code I wrote. In part this is due to the fact that the code itself is very simple in design. It should speak for itself. However, to make a usable runtime library you have to have a user -documentation as in man pages or autodocs. We will eventually have to have +documentation as in man pages or AutoDocs. We will eventually have to have autodocs for this library.
The exception handling in the math code is not particularly effective. For one @@ -114,8 +108,8 @@ startup code is not utilized, the base relative (A4) addressing does not work. If you are going to test it, use the data=faronly option to compile the library and the programs.
-Different build makefiles are supplied for use with GCC. There is -GNUmakefile.68k for the 68k platform and GNUmakefile.os4 for the AmigaOS4 +
Different build makefiles are supplied for use with GCC. There is a +GNUmakefile.68k for the 68k platform and a GNUmakefile.os4 for the AmigaOS4 PowerPC version.
To link the floating point support code with your software, use the -lm compiler option. Careful! +
To link the floating point support code with your software, use the -lm compiler option. Careful! The order in which you specify the libraries to link against is important here. Thus, gcc -o test test.c -lm -lc would correctly link the program test against the proper floating point math library, but gcc -o test test.c -lc -lm would not.
@@ -140,15 +134,15 @@ if simultaneous and overlapping accesses to files, memory allocation and other resources are taking place.The library code is supposed to be thread-safe if built with the __THREAD_SAFE -preprocesssor symbold defined. Note that 'thread-safe' does not mean +preprocesssor symbol defined. Note that 'thread-safe' does not mean 'reentrant'. Multiple callers for certain library functions are permitted, but not for all of them. For example, mkdtemp() is not thread-safe, and neither is -rand() or localtime(). But as per POSIX 1003.1c-1995 there are thread-safe +rand() or localtime(). But as per POSIX 1003.1c-1995 there are thread-safe variants of rand() and localtime() called rand_r(), localtime_r(), and others.
-The use of the socket I/O functions is still problematic because the +
The use of the socket I/O functions is problematic because the underlying bsdsocket.library API is not supposed to be used by any process -other than the one that opened it. While one TCP/IP stack (my own "Roadshow") allows you +other than the one which opened it. While one TCP/IP stack (my own "Roadshow") allows you to share the library base among different processes, if so configured, it is the exception. No other TCP/IP stack available for the Amiga robustly supports a similar feature. If the TCP/IP stack supports this feature, then the global variable @@ -156,11 +150,11 @@ feature. If the TCP/IP stack supports this feature, then the global variable
Errors reported by the socket I/O functions which modify the global variables errno and h_errno may be directed to call the __set_errno() -and __set_h_errno() functions instead if the TCP/IP stack supports this feature. The global +and __set_h_errno() functions instead, if the TCP/IP stack supports this feature. The global variable __thread_safe_errno_h_errno will be set to a non-zero value if it does.
A much more serious problem resides with the exit(), abort(), -assert() and raise() functions, and the how SIGINT signal is +assert() and raise() functions, and how the SIGINT signal is processed. In the thread-safe library only the main() function may directly or indirectly call the exit() function. No child process may do so, since this would wreck its stack context, crashing it instantly; the main program would be very @@ -210,36 +204,39 @@ is available on all PowerPC models supported by AmigaOS 4 except for the 603 embedded versions of the PowerPC like the 405 and 440 series. Consult the manual of the appropriate chip for more information.
-The main(int argc,char **argv); function may be called with an argc value of 0, in which case the argv variable will contain a pointer to the Amiga Workbench startup message, which is of type struct WBStartup *, and is defined in the Amiga system header file <workbench/startup.h>.
-The current locale is derived from the current Amiga operating system locale settings. The setlocale("") function call will choose the current Amiga operating system locale settings. -Any other name passed to the setlocale() function, with the except of "C", +Any other name passed to the setlocale() function, with the exception of "C", which selects the 'C' locale, must be a locale name, as used by the Amiga operating system function OpenLocale() in locale.library.
-The 68k version of clib2 supports single and double precision floating point numbers, -according to the IEEE 754 standard. The software floating point number support is built upon the Amiga +according to the IEEE 754 standard. The software floating point number support is built upon the Amiga operating system libraries mathieeesingbas.library, mathieeedoubbas.library and mathieeedoubtrans.library. The hardware floating point number support uses the M68881/M68882/M68040/M68060 floating point unit intead.
The PowerPC version of clib2 supports only double precision floating point numbers, according to -the IEEE 754 standard, because that is exactly what the PowerPC CPU supports. Single precision -numbers may be implicitly converted to double precision numbers.
+the IEEE 754 standard, because that is exactly what the PowerPC CPU supports. Single precision +numbers may be implicitly converted to double precision numbers. This also means that the C99 +data type long double is identical to the double data type. Because there is no +difference between these two, the library omits support for C99 functions specifically designed +to operate on long double data types, such as rintl().Both the 68k and the PowerPC versions of clib2 may call software floating point support routines in order to perform double and single precision operations that go beyond @@ -256,15 +253,15 @@ and solely subject to the rules imposed by the operating system itself.
The fmod() function returns the value of the x parameter and sets errno to EDOM if the y parameter value is 0.
-The NULL pointer constant is defined in the <stddef.h> header and will expand to ((void *)0L) if the 'C' compiler is used. For a C++ compiler the constant will expand to 0L instead.
-The diagnostic messages printed by the assert() function take the following form:
@@ -289,22 +286,23 @@ in a requester window. The diagnostic message shown in this window will take theThe name of the program, if it is know at that time, will be displayed in the requester window title.
-Only the minimum of required signals are supported by this library. These are SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV and SIGTERM.
As of this writing SIGFPE is never called by the floating point library functions.
-The Ctrl+C event is translated into SIGINT. Signal delivery may delayed +
The Ctrl+C event is translated into SIGINT. Signal delivery may be delayed until a library function which polls for the signal examines it. This means, for example, that -a runaway program called in an infinite loop cannot be aborted by sending it a Ctrl+C event.
+a runaway program caught in an infinite loop cannot be aborted by sending it a Ctrl+C event unless special code +is added which tests for the presence of the signal and calls the __check_abort() all on its own.Processing of the Ctrl+C event involves the internal __check_abort() function which polls for the presence of the event and which will call raise(SIGINT);. The __check_abort() function may be replaced by user code.
-No new line characters are written unless specifically requested.
@@ -322,7 +320,7 @@ the letter w.The file position indicator is initially set to the end of an append mode stream.
-The %p conversion is the hexadecimal representation of the pointer, and it is preceded by the string 0x.
@@ -331,7 +329,7 @@ it is preceded by the string 0x. %E, %F and %G specifiers will produce the string inf for infinity. -The input for the %p conversion must be a hexadecimal number, preceded by either the string 0x or 0X.
@@ -343,7 +341,7 @@ characters should be used. Thus %[a-d] is equivalent to %[abcd]The period (.) is the decimal-point character. The locale specific decimal-point character is accepted as an alternative to the period (.). -In the standard libc.a implementation any request to allocate 0 (zero) bytes will fail. A result value of NULL will be returned and @@ -354,7 +352,7 @@ the global errno variable will be set to EINVAL.
be set to zero. Each zero length allocation will return a different memory address. -In the standard libc.a implementation the rename() function will fail if there already is a file or directory by the new name to be used.
@@ -362,7 +360,7 @@ will fail if there already is a file or directory by the new name to be used.In the libunix.a implementation the rename() function will delete any existing file or directory by the new name. -In the standard libc.a implementation the remove() function will fail if the file is protected by deletion or currently in use.
@@ -370,12 +368,12 @@ will fail if the file is protected by deletion or currently in use.In the libunix.a implementation the remove() function will remove the file when the program exits or the file is closed.
-The abort() function will flush all buffered files, close all the files currently open and delete temporary files.
-The value passed to the exit() function will be passed to the Amiga operating system. The value of EXIT_FAILURE is equivalent @@ -388,13 +386,13 @@ the number 0.
The _Exit() function will flush all buffered files, close all the files currently open and delete temporary files.
-Environment data is retrieved from the global Amiga operating system environment storage area through the dos.library/GetEnv() function. Global variables are stored in files in the ENV: directory.
-If the command parameter is not NULL and the system() function returns, then the result will be equivalent to the exit code of the program invoked, or -1 if the program could not be started. @@ -402,7 +400,7 @@ This follows the behaviour of the Amiga operating system function dos.librar A return value of 0 typically indicates successful execution and a value > 0 typically indicates failure.
-The default time zone is derived from the Amiga operating system locale settings and takes the form GMT+hh or GMT-hh, @@ -417,7 +415,7 @@ The time_t epoch starts with midnight January 1st, 1970.
The reference point used by the clock() function is the time when the program was started.
-The direction of printing is from left to right.
@@ -443,30 +441,11 @@ file.Internal function and variables which need to be visible across several modules have names prefixed with two underscores, as in __stdio_init().
-All routines attempt to do error checking on their parameters. They will -either drop into an assert() or set an errno value and refuse to go any -further. This cuts performance but should help to catch the simple bugs quite -easily (NULL pointers).
- -Just like any halfway sane Amiga 'C' runtime library, this one performs its ^C -checking in the I/O routines. Typically once upon entry and in every iteration -of the loop there might be it will quickly poll the ^C signal and drop into -raise(SIGINT) in case the signal is set. This is just about the safest method -to solve the problem and should be much more robust than the ixemul approach -of 'interrupt anywhere - crash anywhere' using the task switch/launch hooks to -test for signals.
-By default all library routines follow the ISO 'C' conventions in that where implementation defined behaviour is permitted, the AmigaOS rules are followed. For example, unlink() will by default operate like DeleteFile() and rename() will return with an error code set if the name of the file/directory to be -renamed would collide with an existing directory entry. However, your program -can set a global variable __unix_semantics which will cause some routines to -perform like their Unix counterparts. This is necessary for Samba to work but -not a generally desirable feature. You have some Unix-like behaviour, but the -environment itself is not completely Unix- or POSIX-compliant. And it -shouldn't be. Don't make the mistake of trying to mold the environment into a -POSIX emulation. It doesn't work; AmigaOS is not Unix.
+renamed would collide with an existing directory entry.It is recommended to browse the contents of the include directory. The +header files contain information on library behaviour and not just data type and +function prototype definitions. Specifically, the <dos.h> header file +contains documentation about special libraries and global variables which may be +used or replaced by user code.
+