home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 6
/
FreshFish_September1994.bin
/
new
/
dev
/
c
/
hce
/
docs
/
lib.doc
< prev
next >
Wrap
Text File
|
1992-09-02
|
62KB
|
1,442 lines
The C libraries provided with HCE are the original Sozobon-C libraries
by Dale Schumacher, which were partially ported from the ATARI ST by
Jeff Lydiatt on the 17th june 1989 (ZC distribution). The only changes
I have made to these libraries since, are bug fixes to 'stdio.lib',
the addition of 'environment.c' to 'Misc.lib', and also changed
parts of the maths library for math routines from Detlef Wuerkner`s
'HCC.lib' (HCC distribution).
Note about this document.
-------------------------
This document is based on the 'zc.lib.doc' by Jeff Lydiatt, which was based
on the original 'dlibs.libs' document by Dale Schumacher for the ATARI ST.
I have rewritten many parts, added some new stuff and also taken out
the parts which were only meant for the ATARI ST.
Note about error return values.
-------------------------------
On the ATARI ST functions return negative values on error.
On the AMIGA functions may generate a positive value on error.
If the global variable 'errno' contains a positve value, consider it to be
an error returned from AmigaDos, via IoErr().
Note about 'Math.lib'.
----------------------
The maths library uses the motorola fast floating point routines exclusively.
The keyword 'float' acts the same as 'double'.
The 'mathffp.library' and the 'mathtrans.library' are opened and closed
each time you use one of there functions. If you open these libraries
yourself then you most also close them yourself.
Note about all libs.
---------------------
The standard C libraries comprise of the following:
Maths.lib
Misc.lib
Stdio.lib
String.lib
Normally all of the above files (except Maths.lib) would be joined to
make a single C library. I have kept them seperate to try and make
bug fixing and updating a bit easier.
TABLE OF CONTENTS
Header files .................................. L64
Process control ............................... L151
Memory management ............................. L271
File handling ................................. L301
Input & Output ................................ L538
Formatting & Type conversion .................. L688
String manipulation ........................... L891
Charater functions ............................ L1102
Date & Time functions ......................... L1172
Searching & Sorting ........................... L1215
Error handling ................................ L1288
Variable argument lists ....................... L1310
Miscellaneous ................................. L1335
Revision record ............................... L1418
Final note .................................... L1427
**********************************************************************
* HEADER FILES: *
**********************************************************************
ar.h
This header defines the library archive header used by 'ar'.
assert.h
This header defines the assert() run-time condition checking macro.
basepage.h
The BASEPAGE struct and the _base variable, which is initialized
to point to the current process basepage, are defined in this file.
ctype.h
Character classification and conversion.
The isxxxx() macros and toxxxx() macros are defined in this file.
errno.h
This file defines the error code constants, the errno variable
and related error handling functions.
fcntl.h
This file defines the O_xxxx constants used by open().
limits.h
Various maximum and minimum values are defined by this file.
Among these are PATHSIZE and MAXINT.
macros.h
This file contains a few useful macros including min(), max(),
abs() and swap().
math.h
This file contains difines such as MAXDOUBLE and MAXFLOAT
and also contains function return values for all math functions.
setjmp.h
This file defines the buffer needed to save your context when
using setjmp()/longjmp() or catch()/throw().
stat.h
The struct stat and the file mode flag constants are defined
in this file.
stdarg.h
This header defines the type and macros needed for variable
argument list processing.
stddef.h
This is the root header file which should be included in all
programs. It defines NULL, size_t, ptrdiff_t and the
offsetof() macro. (this file is included in stdio.h)
stdio.h
This header file should be present in nearly all C programs.
It defines the 'FILE' struct, EOF and contains extern
declarations for standard i/o (Stdio.lib) and other commonly
used functions. For convenience, the constants TRUE, FALSE and
ERROR are also defined in this file, although this is
somewhat non-standard. Also this header file includes
the <stddef.h> and the <stdlib.h> as these files are
needed in most C programs anyway.
stdlib.h
Function prototypes and defines for Misc.lib.
This file defines the return values for the dynamic memory
managment functions, malloc(),calloc(),lalloc(),free() etc.
It also defines the return values for rand(),time(),mkdir() and
chk_abort().It also contains the defines for exit(), such as
EXIT_SUCCESS and EXIT_FAILURE.(this file is included by stdio.h)
string.h
This file defines aliases for string function names (since some
string functions have various names on different systems) and
extern declarations for all string functions.
time.h
This file defines time related constants and structures, and
extern declarations for the time functions.(Misc.lib)
types.h
Thie file contains typedefs for many special and/or non-standard
type names. Many of the typedefs in this file define type names
which are ANSI and/or System V standard. This file is included
by several other header files, and includes <stddef.h>.
***********************************************************************
* PROCESS CONTROL: (misc.lib) *
***********************************************************************
You should include <stdlib.h> in your program if you use functions
from this section.(contains prototypes)
int _main()
This function defines the standard streams, checks to see which
of them are devices, and calls the user's main() function.
The startup module calls this function to start the C program.
The following standard streams are initialized by _main():
stdin - Standard input, may be redirected
stdout - Standard output, may be redirected
stderr - Usually the system console
The global variables '_argc', and '_argv' are used to
store the values to be passed to the user's main(). If main()
returns then exit() is called with an EXIT_SUCCESS status.
int main(int argc, char *argv[])
This function is not actually in the standard libraries,
but must be present somewhere in the user's code.
The parameters passed to it by '_main()' are the number of
arguments in the command line and a pointer to the arguments.
The return value from 'main()' is passed, by '_main()', to 'exit()'.
Therefore, you should always 'return()' from 'main()', or call
'exit()' directly.
void exit(int status)
Flushes and closes all open streams.
Returns <status> to the computers operating system.
void abort()
Prints the message "^C" to stderr and calls exit() with a
status code of 3.
char *getenv(char *v)
Search for environment variable *v.
If *v is found, a pointer to the string contained in the env variable
is returned. A NULL return value indicates, not found.
int setenv(char *v, *s)
Sets environment variable *v to string *s.
Returns success/failure indicator.(0=failure,1=success)
note: To embed a space in a file name, precede it with
the escape delimiter.(usually a backslash).
This applies to all env functions.
int putenv(char *s)
The form is:
<VARIABLE>=<value>
Set an envirenment varible to <value>.
Returns success/failure indicator.(0=failure,1=success)
char *ParseEnv(char *s)
ParseEnv(