1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

143 Commits

Author SHA1 Message Date
28ceb29a20 This commit was manufactured by cvs2svn to create tag 'V1_195'.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/tags/V1_195@15027 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-09-03 14:45:15 +00:00
7a57c4d499 - Fixed a typo in the new tag item list.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15026 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-09-03 14:45:14 +00:00
cef75752d9 - Getting ready for release...
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15025 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-09-03 14:09:56 +00:00
d31a351d6c - DoTimer() did not allocate the local MsgPort correctly. Fixed.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15024 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-08-31 07:26:13 +00:00
2e56caa3fb - The 68020/030/040/060 versions of the library now include the
64 bit integer conversion code. The plain 68000 version does not.

- The 64 bit integer conversion code used in by the scanf() family
  was broken due to a misplaced overflow check, which had the cruel
  effect of triggering for 32 bit integers as well. Fixed.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15023 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-08-27 12:57:26 +00:00
4cde124d5d - Added the sscanf_64 test program.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15022 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-08-27 12:52:26 +00:00
1d1d340ae1 - The 68020/030/040/060 library version now supports 64 bit integers
in the printf(), scanf(), atoll(), strtoll() and strtoull() functions.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15021 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-08-27 12:12:50 +00:00
6612118e97 - log(+/-0), logb(+/-0), log10(+/-0) now return -infinity.
- getcwd() now considers a buffer size of 0 an error, and it sets
  the errno code to ERANGE if the buffer is too small.

- With Unix path semantics enabled, rename() now fails if either
  the old or the new name are empty strings. Same thing for
  opendir(), utime(), unlink(), chown(), link(), readlink(),
  realpath(), chdir(), access(), stat(), rmdir(), lstat(),
  chmod(), statfs() and open()/fopen().

- Fixed several issues with the formatted output of strftime()
  for the "C" locale: "%p" could return " PM", "%c" is now
  equivalent to "%a %b %e %T %Y", "%x" is equivalent to "%m/%d/%y"
  and "%X" is now equivalent to "%T".


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15020 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-08-26 12:39:33 +00:00
5acfef419b - Added the "date_test" program.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15019 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-08-26 12:21:51 +00:00
eb10d40332 - The startup code now references the linker symbol generated for
the user-supplied main() function.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15018 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-08-20 14:25:20 +00:00
6aaa439593 - Fixed to built properly.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15017 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-08-15 11:31:39 +00:00
b76ec2c143 - We now check if the file refers to a pipe before we make assumptions.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15016 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-08-15 10:43:54 +00:00
773035a695 - Modified select() to support plain files, too. The new code now
compares the current file position against the current file size,
  if that file is on a file system, or simply checks if there is
  any data in the file (which works for the default PIPE: device).

- The raw file descriptor structure member fd_Position is now
  always updated, regardless of whether the file supports random
  access or not.

- The wildcard escape character used in __wildcard_expand_init() was
  wrong. It should have been "'" but it was "`". Fixed.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15015 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-08-15 10:17:48 +00:00
79be2279ec - In __time_delay() the CheckIO() test was wrong and should have
tested for a request still in progress. Fixed.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15014 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-08-02 10:18:50 +00:00
b1f08e4123 - Getting ready for a new release...
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15013 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-07-15 14:45:01 +00:00
872c9bc39c - <sys/types.h> now also includes <time.h> and <stddef.h>.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15012 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-07-15 14:31:37 +00:00
132aaa8293 - The socket/usergroup API function and data type definitions that used to
be defined in <unistd.h> have been moved into a separate header file
  <sys/clib2_net.h> which, for backwards compatibility, can be include
  from within <unistd.h> if the preprocessor symbol __USE_CLIB2_NETLIB
  is defined early on. Eventually, <sys/clib2_net.h> should be removed
  from the general header files and become a local library build header
  file altogether. Note that in this case you would have to build your
  own software using common TCP/IP SDK header files.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15011 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-07-12 13:35:58 +00:00
882875d79a - The thread-safe version of isatty() should now work for stdio
file descriptors, too.

- Retrofitted thread-safety into the termios code.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15010 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-07-06 18:48:53 +00:00
cd7b02f4d7 - Added some documentation on the skeleton library code.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15009 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-07-04 13:24:35 +00:00
2ed463f8e3 - Added a complete shared library skeleton example to demonstrate how the
clib2 shared library initialization/cleanup functions should be used.
  This is a dual-build library which will both work with the plain 68k
  AmigaOS and the PowerPC native AmigaOS4. The example source code can be
  found in the "skeleton_library" subdirectory.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15008 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-07-04 11:25:34 +00:00
acaf12ee7c - Fixed an important error in the documentation...
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15007 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-07-04 11:22:23 +00:00
fdb188da1a - Added the clib2 shared library initialization/cleanup code.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15006 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-07-04 11:21:14 +00:00
9d2ab96b56 - Modified to build with the thread-safe library on OS4.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15005 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-07-04 11:14:27 +00:00
6ba2f7a178 - Updated to use the proper OS4 build environment.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15004 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-07-04 11:06:23 +00:00
525bdde6d5 - Updated for dual PowerPC/68k build.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15002 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-07-04 10:25:33 +00:00
38818e6502 - Added shared library skeleton code (68k-only for now).
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15000 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-07-04 09:39:00 +00:00
ebf5d63bc6 - Moved all the constructor code out of "stdlib_init_exit.c" and into the
files which initialize global data, such as the new "stdlib_program_name.c"
  and "stdlib_malloc.c".

- Until I can find a way to invoke it from within the library, the
  __machine_test() function is no longer invoked.

- Tagged global data with NOCOMMON attributes.

- Added the __lib_init() and __lib_exit() functions, which are part of the
  thread-safe library and which can be used to hook up clib2 with standard
  Amiga shared library/device code. Some documentation on how to use them
  can be found in the <dos.h> header file.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14999 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-07-03 10:36:48 +00:00
2421ffcbb9 Removed unneeded baserel stuff
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14998 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-26 12:02:56 +00:00
2bdd055f4b Fixed a bug in getopt_long
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14997 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-26 12:01:50 +00:00
039c805161 *** empty log message ***
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14996 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-26 12:01:00 +00:00
e19974fe47 Added file system names
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14995 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-26 11:59:37 +00:00
bb41d5e549 *** empty log message ***
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14994 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-26 11:58:26 +00:00
fd163c7105 output_buffer wasn't set correctly when the buffer was allocated
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14993 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-26 11:57:26 +00:00
a3d61a67c8 - Corrected a typo in the object build list (math_exp2f.c rather than
math_expf2.c).


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14992 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-26 11:46:21 +00:00
459d57da9c - Dropped stdlib_wildcard_expand.c, which is no longer necessary.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14991 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-26 11:34:44 +00:00
3d58795d0f - Repaired the pattern matching code which expands command line arguments:
it no longer requires that any parameters are quoted and it is automatically
  enabled if you link against libunix.a, without libc.a standing a chance to
  accidentally override it.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14990 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-26 10:23:05 +00:00
e293873dc7 - The pattern matching code which expands command line arguments, as part
of libunix.a, now translates the "*" wildcard into "#?" unless you prefix
  it with a backtick ("`"), which is the wildcard pattern escape character
  used on AmigaOS.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14989 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-26 09:57:52 +00:00
17e3b3b0e2 - Implemented exp2()/exp2f() and log2()/log2f() as suggested by
Henning Nielsen Lund. Thank you very much!


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14988 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-26 09:06:12 +00:00
ae1ac21c71 *** empty log message ***
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14987 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-21 15:03:14 +00:00
2025e39014 lstat would overwrite the passed-in name in lstat_lock with ReadLink
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14986 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-21 15:01:08 +00:00
ea09fc96db - libunix.a now also holds stdlib_main.o, which should fix the issue with
the wildcard pattern expansion functions not getting included.

- Replacing "int" with "socklen_t" in the header files caused compilation
  errors with the source code which wasn't using the new typedef yet. Fixed.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14985 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-20 07:43:59 +00:00
bf0a6e0c43 - statfs() never stated that a disk was mounted for read-only access
because the wrong InfoData structure member was tested. Fixed.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14984 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-19 13:06:25 +00:00
cf74717ead - Added ftello() and fseeko() which both merely call the equivalent (at
least for clib2) ftell() and fseek() functions, respectively.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14983 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-18 07:23:17 +00:00
f81dfdfca7 Added section about profiling
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14982 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-15 15:23:29 +00:00
196ce6e140 *** empty log message ***
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14981 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-15 15:00:57 +00:00
629e40475f Added profil prototype
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14980 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-15 15:00:28 +00:00
85e421feb8 Removed compiler warnings
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14979 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-15 14:59:51 +00:00
3be260b746 Added profiling support to makefile (PowerPC specific)
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14978 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-15 14:59:15 +00:00
b78a86774c Added getopt_long
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14977 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-14 15:56:57 +00:00
9aba55afba Added getopt_long
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14976 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-14 15:26:29 +00:00
426fe0cc61 New file
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14975 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-14 15:22:56 +00:00
6a13b08f40 - Header files don't belong into the list of object files...
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14973 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-04 14:16:58 +00:00
59807dbff1 - Added an error/EOF check in the input drain loop.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14972 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-04 13:57:08 +00:00
414e07aa20 - Integrated Peter Bengtsson's termios code. Thank you very much! I chose
to add it to libunix.a rather than keeping it in a separate libtermios.a
  library.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14971 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-04 10:46:23 +00:00
2a22c4ff0d - The scanf() family now supports character ranges for the %[
conversion. Note that this is a non-standard feature!


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14970 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-06-03 11:12:12 +00:00
576660ca0a - Added more casts for the powf() function parameters.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14969 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-30 18:28:45 +00:00
5451d3a694 - Made ACrypt() compile again.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14968 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-30 14:01:20 +00:00
c26da2c5e8 - Updated the smakefile, so that it includes the new math object files.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14967 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-30 11:42:38 +00:00
c3975b1e6e - Replaced the (float) casts in strtof() with calls to powf().
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14966 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-30 09:50:43 +00:00
a79b05194d - Ported acosh(), acoshf(), asinh(), asinhf(), lgamma(), lgammaf(),
remainder() and remainderf() for C99.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14965 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-30 08:47:41 +00:00
3975d234bd - Ported cosf(), coshf(), sinf(), sinhf(), tanf(), tanhf()
and hypotf() for C99.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14964 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-30 08:10:41 +00:00
3c220c3939 - Implemented fmin()/fminf(), fmax()/fmaxf(), fdim()/fdimf() for C99.
- Ported acosf(), asinf(), atan2f(), atanf(), ceilf(), expf(), floorf(),
  fmodf(), frexpf(), ldexpf(), log10f(), logbf(), logf(), modff(), powf(), sqrtf(),
  scalbn() and scalbnf() for C99.

- Ported cbrt(), cbrtf(), erf(), erff(), erfc(), erfcf(), expm1(),
  expm1f(), ilogb(), ilogbf(), log1p() and log1pf() for C99.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14963 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-29 14:45:33 +00:00
49e98713d4 - Implemented fmin()/fminf(), fmax()/fmaxf(), fdim()/fdimf() (C99).
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14962 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-29 12:41:04 +00:00
505c23237a - Added skeleton code for acosf(), acosh(), acoshf(), asinf(), asinh(),
asinhf(), atan2f(), atanf(), atanh(), atanhf(), cbrt(), cbrtf(),
  ceilf(), cosf(), coshf(), erf(), erfc(), erfcf(), erff(),
  exp2(), exp2f(), expf(), expm1(), expm1f(), fdim(), fdimf(),
  floorf(), fma(), fmaf(), fmax(), fmaxf(), fmin(), fminf(),
  fmodf(), frexpf(), hypotf(), ilogb(), ilogbf(), ldexpf(), lgamma(),
  lgammaf(), log10f(), log1p(), log1pf(), log2(), log2f(), logbf(),
  logf(), lrint(), lrintf(), lround(), lroundf(), modff(), nearbyint(),
  nearbyintf(), powf(), remainder(), remainderf(), remquo(), remquof(), round(),
  roundf(), scalbn(), scalbnf(), sinf(), sinhf(), sqrtf(), tanf(),
  tanhf(), tgamma(), tgammaf(), trunc() and truncf(), to be filled in
  later...


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14961 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-29 11:19:01 +00:00
ffeb475873 - Added a TODO-list which at this time only covers the missing floating
point arithmetic functions.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14960 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-29 10:44:23 +00:00
c3a10b88b5 - Added NAN, INFINITY, FLT_EVAL_METHOD, float_t and double_t to
<math.h>.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14959 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-29 10:09:55 +00:00
2ced1d3293 - Modified the locale-aware isalnum(), isalpha(), iscntrl(),
isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(),
  isupper(), isxdigit(), tolower() and toupper() functions
  to clamp the input parameter to the "unsigned char" range before
  it is submitted to the respective locale.library function. This
  should be in sync with what the specs demand, which state that
  if the input parameter is neither EOF nor in the range of an
  "unsigned char" variable, then the results are undefined.

- ungetc() now returns the input character, clamped to an unsigned
  char value, upon success. Previously, if the input parameter was
  negative and not EOF, the result was identical to the input, which
  could have had negative side-effects.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14958 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-29 09:56:09 +00:00
fb4dae84aa - Added a couple of (float) casts.
- Fixed isblank() to compile properly.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14957 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-29 08:19:36 +00:00
a03ced93b0 - The record locking code in fcntl() is no longer part of the
regular libc.a, but only of libunix.a.

- Changed the definition of the D_S() macro to cast the pointer
  address to an unsigned 32 bit integer.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14956 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-27 13:19:30 +00:00
a19d60f524 - For %C strtime() should return the century number, not the
year number mod 100.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14955 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-19 13:57:53 +00:00
f6d20fee01 - Moved the IExec initialization in "simple_sprintf.c".
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14954 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-18 07:22:52 +00:00
d4aa0b04af - Forgot to update the .cvsignore file to ignore the simple_sprintf test
program.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14953 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-17 19:16:43 +00:00
df05c80c57 - Added a simple test for sprintf() which does not use any of the
normal library startup code.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14952 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-17 19:15:32 +00:00
a1ffc20864 - Documented __strip_double_slash() and plugged in a memmove()
in place of the copying loop.

- Modified __translate_unix_to_amiga_path_name() and
  __translate_amiga_to_unix_path_name() to not to call strlen()
  on the results of __strip_double_slash().


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14951 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-15 12:32:59 +00:00
13c857ba0a - Added %D, %e, %F, %g, %G and %h for strftime(); repaired %I.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14950 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-14 14:47:46 +00:00
5ecfdf33c6 - Added tests for inf/nan.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14949 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-14 10:57:43 +00:00
fa31c468dc - fpclassify() now returns FP_ZERO both for 0 and -0.
- nan() and nanf() now return quiet NaNs.

- Added internal __inf() and __inff() functions.

- strtof() now calls nanf() and __inff(), respectively, to produce
  the special floating point values for nan/inf/infinity.

- strtod() now calls nan() and __inf(), respectively, to produce
  the special floating point values for nan/inf/infinity.

- The scanf() family now calls nan() and __inf(), respectively, to
  produce the special floating point values for nan/inf/infinity.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14948 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-14 10:52:31 +00:00
feb29fa334 - Enabled the C99 language option.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14947 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-12 15:07:22 +00:00
d0a4e057bc - Added C99 checks to "complex_headers.h".
- No longer uses a local copysign() function in "math_kernel_scalbn.c".

- Fixed an assignment which actually came out as a comparison in "stdio_vfscanf.c".


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14946 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-12 14:50:06 +00:00
c5087c78ce - Getting ready for the 1.192 release.
- Floating point output in hexadecimal notation can now show a sign
  in front of the hex prefix string.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14945 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-12 14:42:32 +00:00
c5c6492868 - fflush() no longer calls flockfile()/funlockfile() with a NULL parameter.
- Removed the old isinf() and isnan() functions.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14944 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-12 14:00:54 +00:00
539cc3553d - Added isunordered(), isgreater(), isgreaterequal(), isless(),
islessequal() and islessgreater() to <math.h> for C99.

- The wchar_t type is now an 'unsigned short' integer (16 bits wide).

- Added PTRDIFF_MIN/PTRDIFF_MAX, WCHAR_MIN/WCHAR_MAX and
  WINT_MIN/WINT_MAX to <stdint.h> for C99.

- Added imaxdiv() and imaxabs() for C99.

- Added strtoimax() and strtoumax() for C99.

- Added nextafter() and nextafterf() for C99.

- Added copysign() and copysignf() for C99.

- Unless I missed something, clib2 should now be functionally complete
  with regard to C99, except for the floating point operations covered.
  These are a major challenge all by themselves, and I wonder both
  whether they are worth the effort and how one could implement them
  correctly.

- fflush() now consistently supports a NULL parameter, causing all
  streams to be flushed for which this behaviour is defined.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14943 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-12 13:21:47 +00:00
bc65dd2877 - Added isblank().
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14942 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-11 20:15:28 +00:00
ec027fa510 - The strftime() %z conversion now prints the time zone difference as a
"decimal" number. That is, if the difference is 5 hours and 30 minutes,
  then %z will now print "530" rather than "330".

- mktime() now handles one leap second gracefully.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14941 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-09 13:47:24 +00:00
65484eac3c - Corrected the thread-safe clearerr() macro.
- Fixed math_headers.h so that fabsf.c compiles correctly with SAS/C.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14940 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-08 17:02:16 +00:00
2be60de3e7 - Added "fstat_stdout_test".
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14939 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-08 16:27:25 +00:00
89b568bcb8 - Small fixes to the scanf() family.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14938 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-08 11:27:26 +00:00
2548af2b4b - Hid two more program files.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14937 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-08 11:20:49 +00:00
a1b39c4d01 - Added test cases for C99 format conversions.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14936 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-08 11:20:03 +00:00
9e32991a6d - For the printf() "%a" conversion the exponent now comes out as a binary
number rather than a decimal one. Now how odd is that?

- strtod() and strtof() now support "inf"/"infinity"/"nan"/"nan(..)" and
  hexadecimal floating point numbers, for C99.

- Added the fpclassify(), isfinite(), isnormal() and signbit() macros for C99.

- Reimplemented isnan() and isinf() as macros for C99. The corresponding
  functions will be dropped from the library. Note that the isinf() macro
  does not return -1, 0 or 1 like the old function did, but only 0 or 1
  depending upon whether the parameter represents +/- infinity or not.

- Added fabsf() for C99.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14935 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-08 08:51:30 +00:00
c8d29ea9c1 - Added HUGE_VALF to <math.h>.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14934 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-07 17:04:07 +00:00
28f561c61b - The printf() family now supports the %hh, %j, %t and %z modifiers and the
%a/%A conversions for C99. The %j is treated like %ll, %t and %z are treated
  like %l.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14933 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-07 16:39:27 +00:00
07056f3e26 - Plugged in the proper ISO 8601 week number calculation function.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14932 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-07 14:03:08 +00:00
3bd6766484 - strftime() now ignores the E and O modifiers.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14931 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-07 13:40:19 +00:00
e01d58319d - Added strtof(), llabs(), lldiv(), vsscanf() and vscanf() for C99.
- strftime() now supports %C, %n, %r, %R, %t, %T, %u, %V, and %z for C99.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14930 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-05-07 13:21:49 +00:00
ec4fd3c2cb - The libunix.a flavour of system() no longer attempts to translate the name
of a command unless it contains path separator characters.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14929 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-28 15:38:47 +00:00
df89c636db - Fixed a typo in the semaphore creation code. Ouch.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14928 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-25 15:39:56 +00:00
90a192134e - If fread()/fwrite() fail to read/write any data because either the number
of records or the size of each record is zero, both now call clearerr() to
  avoid giving the caller the wrong impression that an EOF or error occured.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14927 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-24 19:38:59 +00:00
3660b26c9f - Fixed two linker errors which were caused by duplicate symbol definitions.
- Added code to the startup routine which allows you to monitor where command
  was started from and which parameters it was invoked with.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14926 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-24 15:27:13 +00:00
9f3d5e50b4 - Fixed two linker errors which were caused by duplicate symbol definitions.
- Added code to the startup routine which allows you to monitor where command
  was started from and which parameters it was invoked with.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14925 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-24 14:04:36 +00:00
876039440f - The record locking semaphore could wind up getting added to the public
list twice. Fixed.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14924 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-24 12:19:06 +00:00
0c553faff1 - Changed how errors are detected, as returned by Write(), Read() and
Seek(). Seek() is particularly challenging because the value it
  returns might be a valid file position and not an error.

- Replaced numeric function return codes of 0 and -1 with macros OK,
  SEEK_ERROR/ERROR to clarify the respective purposes.

- Changed how ftell() and fseek() are used, double-checking the return
  value and the errno code.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14923 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-24 09:53:12 +00:00
1d611fefbe - Changed how error conditions raised by dos.library file I/O functions
are detected.

- Modified function return values of 0 and -1 to use macros like OK,
  ERROR/SEEK_ERROR instead, to better convey what the purpose of these
  values is.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14922 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-24 08:46:37 +00:00
a50aba0b64 - Reversed the change in rename() which enforced deletion of the target file.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14921 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-21 10:23:17 +00:00
2e9ac7d003 - The Unix-like rename() now removes the target file even if that
file has been protected from deletion.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14920 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-20 12:06:00 +00:00
0a440c8405 - Added the two release archive build scripts.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14919 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-16 10:35:12 +00:00
f63a0788d5 - Fixed the startup build target directory names.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14918 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-16 10:11:26 +00:00
431dd488a1 - Changed how the startup code is built for the different library flavours,
and which files this involves.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14917 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-13 14:35:06 +00:00
15c16efd07 - Final version bump before release.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14916 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-09 09:30:29 +00:00
6e39efe7d7 - Added a hopefully enlightening comment on the subtleties of semaphore
locking in the stdio_fflush.c file.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14915 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-04 11:56:26 +00:00
92cc3e9a79 - The stdio locking in fcntl() wasn't working correctly. Fixed.
- Made the clearerr(), feof() and ferror() macros thread-safe.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14914 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-04 10:10:02 +00:00
a18f415374 - Small tweaks to fix GCC 68k compiler warnings.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14913 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-03 10:53:24 +00:00
3096691d75 - Added more code and changes contributed by Peter Bengtsson, thank you
very much! This includes the following:

  - Added SSIZE_MAX to <limits.h>.

  - Added <sys/uio.h>, readv() and writev().

  - Cut back the soft link resolution code in lstat().

  - In <fcntl.h> O_NDELAY is now an alias for O_NONBLOCK.

  - Added <complex.h>, carg(), cargf(), cargl(), cimag(), cimagf(),
    cimagl(), conj(), conjf(), conjl(), creal(), crealf() and creall().

  Note that the C99 support for the complex floating point data
  types is limited to GCC 3.x for now.

- Added va_copy() to <stdarg.h>.

- Added _Exit() to <stdlib.h>.

- Added <stdbool.h>.

- Added vfscanf() to <stdio.h>.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14912 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-03 10:22:48 +00:00
d5c36d66e4 - We now call IsInteractive() rather than send a type ACTION_DISK_INFO
to a likely console handler file's MsgPort.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14911 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-02 18:02:54 +00:00
7f9fbc453b - Invoking fstat() on what maps to a con-handler stream now produces
information identifying it as a character special file. Side-effect:
  if the input/output went to a CON:/AUTO window, that window will
  pop open and stay open.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14910 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-02 13:25:55 +00:00
6f010ddf87 - File descriptors produced by dup() or dup2() now work exactly like
the original file descriptors they are duplicates of. I modified the
  function which maps file descriptor numbers to file descriptor
  table entries to return the table entries of the original files.

- In the thread-safe library, duplicated stdin/stdout/stderr
  descriptors now work like the "real" ones. This is true even if
  the "real" ones were closed and only their former aliases remain.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14909 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-04-01 18:46:37 +00:00
09b52e077f - Moved the __UtilityBase/__IUtility variable declarations into
a separate file.

- Simplified the library/open close code in "stdlib_main.c".


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14908 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-30 19:37:47 +00:00
9c2c44b008 - raise() no longer resets the signal handler before it invokes the one
currently configured. It merely blocks the delivery of the respective
  signal to prevent recursion.

- raise() now drops into abort() if a signal handler is set to
  SIG_DFL. The exception is in SIGINT delivery, which has the
  effect of printing a different termination message but otherwise
  program flow takes the same path as abort().


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14907 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-27 10:02:50 +00:00
df01f27551 - Moved the signal block mask and the signal function table out of
signal_data.c and into signal_raise.c where they are actually used.
  This makes it possible to override the default definition of the
  __check_abort_enabled variable in your own programs.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14906 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-26 11:01:13 +00:00
58d26ce8cb - The name of the public record locking semaphore has to be preallocated
for OS4 if the AllocSysObject() function is used to create it.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14905 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-26 10:53:35 +00:00
b1ac45a0b9 - Updated the specs file not to reference the main.o files any more.
- Clarified the caveats of the libm.a use.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14904 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-26 09:15:07 +00:00
aafda37c84 - Ready for release...
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14903 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-25 09:14:38 +00:00
3eb15a612f - Oops, nearly broke fcntl() again for sockets.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14902 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-25 08:59:22 +00:00
590d1b8eec - Small fixes to fcntl() and select() to cover the thread-safe
fd->fd_DefaultFile == ZERO case.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14901 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-25 08:50:59 +00:00
1fbe4bd0a5 - Added a description of the thread-safe stdin/stdout/stderr behaviour.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14900 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-25 08:50:10 +00:00
8edfcc3f86 - Activated the dormant thread-safe standard input/output/error
handling code.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14899 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-24 16:40:16 +00:00
a6daababe7 - The thread-safe system() call now blocks all standard I/O operations
until the function has returned. Which is harsh, but there is no
  elegant solution to the issue of keeping the same dos.library
  file handles from concurrent use which SystemTagList() might just
  end up using.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14898 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-24 15:31:16 +00:00
5695784272 - Moved stdlib_main.o into the regular lib.c, at least for
the 68k build. The PowerPC build may follow later, provided
  I manage to get the specs file fixed.

- Moved the check for the presence of an FPU into the
  math_init.c code.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14897 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-20 17:14:58 +00:00
5eefcf4555 - Fixed the constructor/destructor invocation sequence for the SAS/C and
GCC 68k library builds.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14896 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-20 12:14:09 +00:00
d85d6648ea - Modified the SAS/C constructor/destructor invocation sequence, now that
the names of the functions assigned through the new macros are different.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14895 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-20 11:57:11 +00:00
c471c50784 - Turns out that the constructor/destructor calling sequence
was still wrongish for the OS4 library. So I had to change
  it *again*. Which probably means that the 68k library will
  need further changes...


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14894 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-20 11:18:06 +00:00
cd10dc9a1a - assertion failures early on during program initialization
should no longer spell big trouble on account of the stdio
  data structures possibly not being in a well-defined and
  initialized state.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14893 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-19 11:06:57 +00:00
7d3ea7fae6 - Moved the call chain printing out of stdlib_main.c and into
separate files.

- Removed some more redundant data from stdlib_main.c.

- Added the first real C99 function: _Exit().


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14892 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-19 10:15:56 +00:00
ead29c1850 - Reorganized the local header files, removing redundancies.
- Dropped unused stub code which is now redundant because of
  the constructor/destructor mechanism.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14891 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-18 12:38:25 +00:00
f492e6a6c0 - fcntl() did not work for sockets. Fixed.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14890 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-16 09:28:37 +00:00
dc80018239 - Re-added the long word alignment check for MC68020 I didn't commit
at home.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14889 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-15 11:18:32 +00:00
966851e8bd - ftruncate() ended up changing the current file position, contrary
to what it is supposed to do. Fixed.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14888 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-14 10:03:06 +00:00
a60623bbc6 - Turns out that the 68k GCC port does not sort constructor and
destructor functions in any way at all. I reimplemented the
  entire library constructor/destructor functionality to use the
  same approach as libnix.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14887 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-12 14:10:09 +00:00
d8bf652ae6 - Added a table size check to guard against accesses beyond the last
file descriptor.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14886 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-12 09:49:47 +00:00
b048323196 - Aliases of file descriptors are now using the signal semaphore
of the original file descriptor.

- close() did not return 0 if the file descriptor in question
  was really just an alias. Fixed.

- Added a feature which makes it possible to have several clients
  use the standard I/O streams (stdin/stdout/stderr) and have these
  referring to their process' Input()/Output()/ErrorOutput()
  streams. This is intended to support the upcoming shared
  library feature.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14885 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-12 09:43:48 +00:00
08cc54d3fa - Fixed the SAS/C destructor function prototypes and verified
that the constructors/destructors are called in the proper
  order, too.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14884 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-11 18:27:27 +00:00
419172fb0e - The destructor function invocation code no longer calls
setjmp(). This is now done within stdlib_main.c prior to
  calling the destructor function invocation code.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14883 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-11 16:04:51 +00:00
f289140266 - Switched over the startup code and the library itself to use
constructor/destructor functions for initialization and cleanup
  purposes.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14882 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-11 13:23:18 +00:00
513 changed files with 24348 additions and 5404 deletions

View File

@ -1,13 +0,0 @@
# The "checkoutlist" file is used to support additional version controlled
# administrative files in $CVSROOT/CVSROOT, such as template files.
#
# The first entry on a line is a filename which will be checked out from
# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
# The remainder of the line is an error message to use if the file cannot
# be checked out.
#
# File format:
#
# [<whitespace>]<filename>[<whitespace><error message>]<end-of-line>
#
# comment lines begin with '#'

View File

@ -1,15 +0,0 @@
# The "commitinfo" file is used to control pre-commit checks.
# The filter on the right is invoked with the repository and a list
# of files to check. A non-zero exit of the filter program will
# cause the commit to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT. For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

View File

@ -1,21 +0,0 @@
# Set this to "no" if pserver shouldn't check system users/passwords
#SystemAuth=no
# Put CVS lock files in this directory rather than directly in the repository.
#LockDir=/var/lock/cvs
# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top
# level of the new working directory when using the `cvs checkout'
# command.
#TopLevelAdmin=no
# Set `LogHistory' to `all' or `TOEFWUPCGMAR' to log all transactions to the
# history file, or a subset as needed (ie `TMAR' logs all write operations)
#LogHistory=TOEFWUPCGMAR
# Set `RereadLogAfterVerify' to `always' (the default) to allow the verifymsg
# script to change the log message. Set it to `stat' to force CVS to verify# that the file has changed before reading it (this can take up to an extra
# second per directory being committed, so it is not recommended for large
# repositories. Set it to `never' (the previous CVS behavior) to prevent
# verifymsg scripts from changing the log message.
#RereadLogAfterVerify=always

View File

@ -1,19 +0,0 @@
# This file affects handling of files based on their names.
#
# The -m option specifies whether CVS attempts to merge files.
#
# The -k option specifies keyword expansion (e.g. -kb for binary).
#
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
#
# wildcard [option value][option value]...
#
# where option is one of
# -f from cvs filter value: path to filter
# -t to cvs filter value: path to filter
# -m update methodology value: MERGE or COPY
# -k expansion mode value: b, o, kkv, &c
#
# and value is a single-quote delimited value.
# For example:
#*.gif -k 'b'

View File

@ -1,21 +0,0 @@
# The "editinfo" file is used to allow verification of logging
# information. It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure. Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
# Making sure that the entered bug-id number is correct.
# Validating that the code that was reviewed is indeed the code being
# checked in (using the bug-id number or a seperate review
# number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported. There can be only one entry that matches a given
# repository.

View File

@ -1,27 +0,0 @@
# The "loginfo" file controls where "cvs commit" log information
# is sent. The first entry on a line is a regular expression which must match
# the directory that the change is being made to, relative to the
# $CVSROOT. If a match is found, then the remainder of the line is a filter
# program that should expect log information on its standard input.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name ALL appears as a regular expression it is always used
# in addition to the first matching regex or DEFAULT.
#
# You may specify a format string as part of the
# filter. The string is composed of a `%' followed
# by a single format character, or followed by a set of format
# characters surrounded by `{' and `}' as separators. The format
# characters are:
#
# s = file name
# V = old version number (pre-checkin)
# v = new version number (post-checkin)
# t = tag or branch name
#
# For example:
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
# or
#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog

View File

@ -1,26 +0,0 @@
# Three different line formats are valid:
# key -a aliases...
# key [options] directory
# key [options] directory files...
#
# Where "options" are composed of:
# -i prog Run "prog" on "cvs commit" from top-level of module.
# -o prog Run "prog" on "cvs checkout" of module.
# -e prog Run "prog" on "cvs export" of module.
# -t prog Run "prog" on "cvs rtag" of module.
# -u prog Run "prog" on "cvs update" of module.
# -d dir Place module in directory "dir" instead of module name.
# -l Top-level directory only -- do not recurse.
#
# NOTE: If you change any of the "Run" options above, you'll have to
# release and re-checkout any working directories of these modules.
#
# And "directory" is a path to a directory relative to $CVSROOT.
#
# The "-a" option specifies an alias. An alias is interpreted as if
# everything on the right of the "-a" had been typed on the command line.
#
# You can encode a module within a module by using the special '&'
# character to interpose another module into the current module. This
# can be useful for creating a module that consists of many directories
# spread out over the entire source repository.

View File

@ -1,12 +0,0 @@
# The "notify" file controls where notifications from watches set by
# "cvs watch add" or "cvs edit" are sent. The first entry on a line is
# a regular expression which is tested against the directory that the
# change is being made to, relative to the $CVSROOT. If it matches,
# then the remainder of the line is a filter program that should contain
# one occurrence of %s for the user to notify, and information on its
# standard input.
#
# "ALL" or "DEFAULT" can be used in place of the regular expression.
#
# For example:
#ALL mail -s "CVS notification" %s

View File

@ -1,13 +0,0 @@
# The "rcsinfo" file is used to control templates with which the editor
# is invoked on commit and import.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being made to, relative to the
# $CVSROOT. For the first match that is found, then the remainder of the
# line is the name of the file that contains the template.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

View File

@ -1,20 +0,0 @@
# The "taginfo" file is used to control pre-tag checks.
# The filter on the right is invoked with the following arguments:
#
# $1 -- tagname
# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
# $3 -- repository
# $4-> file revision [file revision ...]
#
# A non-zero exit of the filter program will cause the tag to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT. For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

View File

@ -1,21 +0,0 @@
# The "verifymsg" file is used to allow verification of logging
# information. It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure. Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
# Making sure that the entered bug-id number is correct.
# Validating that the code that was reviewed is indeed the code being
# checked in (using the bug-id number or a seperate review
# number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported. There can be only one entry that matches a given
# repository.

View File

@ -1,30 +0,0 @@
<!DOCTYPE html public "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>Notes on building the library</title>
<body>
<h1>Notes on building the library</h1>
<p>In order to build the library, you need a 'C' compiler (obvious, isn't it?) and
a set of header files for the networking API definitions. The networking header
files go into a directory <tt>netinclude</tt> which has to sit in the same directory as
the source code and the <tt>include</tt> directory you find in there. I'm not currently
supplying these header files here. Drop me a line, and I'll take care of that.</p>
<p>The SAS/C flavour (<tt>smakefile</tt>) should get the library built using the "large data"
model. This rules out the use of residentable programs as the startup code I'm
using is very primitive (<tt>startup.o</tt>) and doesn't tinker with A4 relative data
addressing (and how this may be set up).</p>
<p>There are two makefiles for GCC, each a different flavour. There is <tt>GNUmakefile.68k</tt>,
which will build the library for GCC on the 68k platform ("classic" Amiga). This
builds all variants of the library, for large data, small data, resident, whatever
model. It's a lot of work and I don't recommend you do this on a plain 68k machine.
It will literally (!) take hours. The other makefile flavour is for AmigaOS4 using
the PowerPC hosted GCC system (<tt>GNUmakefile.os4</tt>). This builds only the large data
version of the library, but this is usually all you need. Small data support is
currently not implemented but might follow in the future.</p>
</body>
</html>

View File

@ -1,67 +0,0 @@
<!DOCTYPE html public "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>Notes on using the library with Amiga GCC (68k)</title>
<body>
<h1>Notes on using the library with Amiga GCC (68k)</h1>
<p>You can use the 68k build of clib2 with the existing Amiga 68k ports of the
GNU 'C' compiler. In order to do so, you need to modify the <tt>specs</tt> file which
controls how the compiler(s) and the linker interact, and where the linker
will look for the program startup code and library files. Also, you will need
to copy the header files, startup code and library files to the locations
where the 'C' compiler and linker expects them.</p>
<p>Please read the following description before you follow the instructions. The
changes suggested may have unexpected side-effects!</p>
<p>I have provided a working <tt>specs</tt> file with this documentation file. To switch
over an existing Amiga 68k port of GCC to use clib2, you would proceed as
follows:</p>
<ul>
<li> Locate the directory within which GCC is installed. For example, this
could be within a directory to which the name <tt>ADE:</tt>, <tt>GG:</tt> or <tt>GCC:</tt>
is assigned. For the sake of simplicity, the following notes assume
that the assignment name is <tt>GCC:</tt>
<li> Make backup copies of the following directories and files:
<ol>
<li> <tt>GCC:lib/gcc-lib/amigaos/2.95.3/specs</tt><br>
<p>(NOTE: Check the directory called <tt>GCC:lib/gcc-lib/amigaos</tt>
first; the "2.95.3" quoted above refers to the version,
revision and patch number of the GCC installed and your
version number may differ!)</p>
<li> <tt>GCC:include</tt>
<li> <tt>GCC:lib</tt>
</ol>
<li> Now you can proceed to install clib2; just copy the <tt>include</tt> and <tt>lib</tt>
directories over, like this:
<ol>
<li><kbd>Copy include GCC:include all quiet</kbd>
<li><kbd>Copy lib GCC:lib all quiet</kbd>
</ol>
<li> Finally, replace the <tt>specs</tt> file with the one provided:
<ol>
<li> <kbd>Copy specs GCC:lib/gcc-lib/amigaos/2.95.3/specs</kbd><br>
<p>(NOTE: Check the directory called <tt>GCC:lib/gcc-lib/amigaos</tt>
first; the "2.95.3" quoted above refers to the version,
revision and patch number of the GCC installed and your
version number may differ!)</p>
</ol>
</ul>
<p>Once you have completed these steps you should be able to build programs using
the 68k build of clib2 and you currently installed GCC. Note that these
changes may have the effect of rendering your C++ compiler unusable, so make
sure that you've made backup copies of all files and directories first!</p>
</body>
</html>

View File

@ -1,250 +0,0 @@
<!DOCTYPE html public "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>An ISO 'C' (1994) compliant runtime library for the Amiga</title>
<body>
<h1>An ISO 'C' (1994) compliant runtime library for the Amiga</h1>
<h2>1. What is this?</h2>
<p>This is my attempt to get Samba 2.2.x ported to the Amiga. My first Amiga
port required SAS/C and a number of strange tricks had to be pulled to get
it to support the kind of environment Samba needed. But with the
introduction of Samba 2.2.x many of those tricks did not work any more,
which is why I decided to attack the problem at the root, namely the
runtime library.</p>
<p>Because it was no longer possible to build Samba with SAS/C on the new
Amiga platform, the idea came up to move development to the GNU 'C'
compiler. This turned out to be a challenge due to its somewhat
underdeveloped runtime library and header files. Eventually, I decided to
rewrite that library from scratch.</p>
<h2>2. What does it do?</h2>
<p>Using <i>'C' - A reference manual</i> (4th edition) as a reference I wrote a set of
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.</p>
<p>Because Samba needs a few POSIX-like routines to be supported, the library
functionality is complemented by a set of routines described in <i>Advanced
programming in the Unix environent</i>.</p>
<p>This is not a portable implementation of the library in the sense that you
could move it from one 'C' compiler on one operating system to another.
This is an Amiga specific implementation.</p>
<p>The library supports floating point math, which, for the 68k platform, is
limited to IEEE single and double precision or M68881 inline math. There is no
support for the fast floating point (FFP) format or exclusive IEEE single
precision. You either get double precision (IEEE math) or extended precision
(M68881 inline math). What it is that you get is determined at compile time.
Use the <tt>IEEE_FLOATING_POINT_SUPPORT</tt> preprocessor symbol to activate IEEE math
code and the <tt>M68881_FLOATING_POINT_SUPPORT</tt> symbol for M68881 inline math.</p>
<p>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.</p>
<p>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 <tt>__stack_size</tt> variable (see
<tt>stdlib_main.c</tt>).</p>
<p>I added some <tt>amiga.lib</tt> and <tt>debug.lib</tt> functionality to the library, but don't
count on it to be complete.</p>
<p>The library code is supposed to be thread-safe if built with the <tt>__THREAD_SAFE</tt>
preprocesssor symbold defined. Note that 'thread-safe' does <em>not</em> mean
'reentrant'. Multiple callers for certain library functions are permitted, but
not for all of them. For example, <tt>mkdtemp()</tt> is not thread-safe, and neither is
<tt>rand()</tt> or <tt>localtime()</tt>. But as per POSIX 1003.1c-1995 there are thread-safe
variants of <tt>rand()</tt> and <tt>localtime()</tt> called <tt>rand_r()</tt>, <tt>localtime_r()</tt>, and others.
The use of the socket I/O functions is still problematic because the
underlying <tt>bsdsocket.library</tt> API is not supposed to be used by any process
other than the one that opened it. Also yet unsolved is the issue of reading
error codes from the <tt>errno</tt> variable which currently always contains the
error code left by the last caller.</p>
<p>Take care: thread-safety does not imply that you can have multiple callers
access and close the same file. There is no resource tracking to that degree
yet. All the thread-safety tries to afford you is not to get into big trouble
if simultaneous and overlapping accesses to files, memory allocation and other
resources are taking place.</p>
<h2>3. What does it not do?</h2>
<p>This library is a departure from the typical 'C' runtime environments of the
past which had to run on all AmigaOS releases, down to Kickstart 1.1. This
very library was designed to take advantage of the routines available since
Kickstart 2.04 was introduced and virtually nobody ever put to use. This helps
to cut the code size, and it also helps to keep bugs out of the library by
falling back onto well-tested implementations. However, the catch is that the
code won't run under Kickstart 1.3 and below. But then these operating system
releases have been obsolete for more than a decade, and you can always go back
to a compiler environment which supports them.</p>
<p>There is very little support for <tt>amiga.lib</tt> functionality. There is <tt>NewList()</tt>,
<tt>HookEntry()</tt>, <tt>CallHook()</tt>, <tt>CallHookA()</tt>, the <tt>DoMethod()</tt> 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 <tt>amiga.lib</tt>, you really shouldn't need in in the first place.</p>
<h2>4. Where does the source code come from?</h2>
<p>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
'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 <tt>bcopy()</tt> as an alias for <tt>memcpy()</tt>, and
unlike <tt>memcpy()</tt> is documented to, <tt>bcopy()</tt> supports overlapping copies.</p>
<p>Eventually, I wrote virtually all the code myself, borrowing algorithmic ideas
from the BSD libc and the Manx Aztec 'C' runtime library. Because I don't know
much about the environment GCC expects, I borrowed code snippets from libnix,
which was written by Matthias Fleischer and Gunther Nikl. This in particular
concerns the integer and floating point math support, the <tt>setjmp</tt>/<tt>longjmp</tt>
routines and the startup code. The M68881 inline math code comes from the
<tt>&lt;math-68881.h&gt;</tt> file written by Matthew Self <tt>(self@bayes.arc.nasa.gov)</tt>.</p>
<h2>5. Limitations and caveats</h2>
<p>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
autodocs for this library.</p>
<p>The code is currently plastered with assertions and debug code. It is
therefore much larger than it ought to be and runs much slower than it ought
to be. For example, the <tt>malloc()</tt> routine will set the contents of the memory
allocated to a 'dirty' bit pattern which is likely to break software which
makes assumptions about its contents. Likewise, the <tt>free()</tt> routine will trash
the memory to deallocate with a different 'dirty' bit pattern to turn up reuse
of memory after deallocation. All these debugging features can be disabled by
defining the <tt>NDEBUG</tt> preprocessor symbol at compile time (see <tt>&lt;assert.h&gt;</tt>).</p>
<p>The exception handling in the math code is not particularly effective. For one
part this is due to the fact that there is no exception handler installed by
the runtime library when it starts up which could catch and process the error
conditions the CPU or FPU generates. The idea was to provide for a portable
runtime library with little to no assembly language involved. To make the
exception handling complete, such code would be necessary.</p>
<p>The library currently builds under SAS/C, but because the 'normal' program
startup code is not utilized, the base relative (A4) addressing does not work.
If you are going to test it, use the <tt>data=faronly</tt> option to compile the
library and the programs.</p>
<p>Different build makefiles are supplied for use with GCC. There is
<tt>GNUmakefile.68k</tt> for the 68k platform and <tt>GNUmakefile.os4</tt> for the AmigaOS4
PowerPC version.</p>
<h2>6. Conventions and design issues</h2>
<p>You will have noticed the 330+ files in this directory. This is not the best
way to organize a runtime library, but at least all the bits and pieces are in
plain sight. Each file stands for the one or two routines it contains. The
name indicates what routine(s) that might be. Each file name is prefixed by
the name of the header file in which the corresponding routine is defined. So,
for example, you will find that <tt>unistd_lchown.c</tt> contains the definition of
the <tt>lchown()</tt> routine, which has its prototype defined in the <tt>&lt;unistd.h&gt;</tt> header
file.</p>
<p>Internal function and variables which need to be visible across several
modules have names prefixed with two underscores, as in <tt>__stdio_init()</tt>.</p>
<p>All routines attempt to do error checking on their parameters. They will
either drop into an <tt>assert()</tt> or set an errno value and refuse to go any
further. This cuts performance but should help to catch the simple bugs quite
easily (<tt>NULL</tt> pointers).</p>
<p>Just like any halfway sane Amiga 'C' runtime library, this one performs its <tt>^C</tt>
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 <tt>^C</tt> signal and drop into
<tt>raise(SIGINT)</tt> 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.</p>
<p>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, <tt>unlink()</tt> will by default operate like <tt>DeleteFile()</tt> and <tt>rename()</tt>
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 <tt>__unix_semantics</tt> 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.</p>
<h2>7. The startup code</h2>
<p>There are three program startup files provided. The most simplistic is in
<tt>startup.c</tt> which I use for SAS/C. It just invokes the setup routine which
eventually calls <tt>main()</tt> and drops straight into <tt>exit()</tt>.</p>
<p>The <tt>ncrt0.S</tt> file was adapted from the libnix startup code which sets up the
base relative data area, if necessary (the <tt>SMALL_DATA</tt> preprocessor symbol must
be defined).</p>
<p>The <tt>nrcrt0.S</tt> file was adapted from libnix startup code, too, and sets up the
base relative data area for programs to be made resident. Note that the
<tt>geta4()</tt> stub is missing here; it wouldn't work in a resident program anyway.</p>
<p>The <tt>ncrt0.S</tt> and <tt>nrcrt0.S</tt> files are considerably smaller and less complex than
the libnix code they are based on. This is because in this library design all
the more complex tasks are performed in the <tt>stdlib_main.c</tt> file rather than in
assembly language.</p>
<h2>8. Documentation</h2>
<p>Well, you're reading it. There isn't anything much yet. You can consult the book
<i>'C' - A reference manual</i> and you could look at the
<a href="http://www.opengroup.org/onlinepubs/007904975">Open Group's Single Unix
Specification</a>.</p>
<h2>9. Legal status</h2>
<p>Because this library is in part based upon free software it would be
uncourteous not to make it free software itself. The BSD license would
probably be appropriate here.</p>
<p>The PowerPC math library is based in part on work by Sun Microsystems:</p>
<pre>
====================================================
Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
Developed at SunPro, a Sun Microsystems, Inc. business.
Permission to use, copy, modify, and distribute this
software is freely granted, provided that this notice
is preserved.
====================================================
</pre>
<h2>10. Contacting the author</h2>
<p>The basic work was done by Olaf Barthel during two weeks in July 2002. You
can reach me at:</p>
<p>Olaf Barthel<br>
Gneisenaustr. 43<br>
D-31275 Lehrte<br></p>
<p>Or via e-mail:</p>
<p>olsen@sourcery.han.de</p>
</body>
</html>

View File

@ -1,64 +0,0 @@
*asm:
%{m68000:-mc68010} %{mc68000:-mc68010} %{m68020:-mc68020} %{mc68020:-mc68020} %{m68030:-mc68030} %{m68040:-mc68040} %{m68060:-mc68060} %{m68020-40:-mc68020} %{m68020-60:-mc68020} %{!mc68000:%{!m68000:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68060:%{!m68020-40:%{!m68020-60:-mc68010}}}}}}}}} %{msmall-code:-sc}
*asm_final:
*cpp:
%{m68881:-D__HAVE_68881__} %{!ansi:%{m68020:-Dmc68020} %{mc68020:-Dmc68020} %{m68020-40:-Dmc68020} %{m68020-60:-Dmc68020} %{m68030:-Dmc68030} %{m68040:-Dmc68040} %{m68060:-Dmc68060}} %{m68020:-D__mc68020__ -D__mc68020} %{mc68020:-D__mc68020__ -D__mc68020} %{m68020-40:-D__mc68020__ -D__mc68020} %{m68020-60:-D__mc68020__ -D__mc68020} %{m68030:-D__mc68030__ -D__mc68030} %{m68040:-D__mc68040__ -D__mc68040} %{m68060:-D__mc68060__ -D__mc68060}
*cc1:
%{resident:-fbaserel} %{resident32:-fbaserel32} %{msmall-code:-fno-function-cse}
*cc1plus:
*endfile:
*link:
%{fbaserel:%{!resident:-m amiga_bss -fl libb}} %{resident:-m amiga_bss -amiga-datadata-reloc -fl libb} %{fbaserel32:%{!resident32:-m amiga_bss -fl libb32}} %{resident32:-m amiga_bss -amiga-datadata-reloc -fl libb32} %{g:-amiga-debug-hunk} %{m68020:-fl libm020} %{mc68020:-fl libm020} %{m68030:-fl libm020} %{m68040:-fl libm020} %{m68060:-fl libm020} %{m68020-40:-fl libm020} %{m68020-60:-fl libm020} %{m68881:-fl libm881}
*lib:
%{mstackextend:-lstack} -lc -lamiga -ldebug -lgcc -lc
*libgcc:
*startfile:
%{resident32:nr32crt0.o%s mainb32.o%s}%{!resident32:%{fbaserel32:nb32crt0.o%s mainb32.o%s}%{!fbaserel32:%{resident:nrcrt0.o%s mainb.o%s}%{!resident:%{fbaserel:nbcrt0.o%s mainb.o%s}%{!fbaserel:ncrt0.o%s mainnb.o%s}}}}
*switches_need_spaces:
*signed_char:
%{funsigned-char:-D__CHAR_UNSIGNED__}
*predefines:
-Dmc68000 -Damiga -Damigaos -DMCH_AMIGA -DAMIGA -D__chip=__attribute__((__chip__)) -D__saveds=__attribute__((__saveds__)) -D__interrupt=__attribute__((__interrupt__)) -D__stackext=__attribute__((__stackext__)) -D__regargs=__attribute__((__regparm__)) -D__stdargs=__attribute__((__stkparm__)) -D__aligned=__attribute__((__aligned__(4))) -Asystem(amigaos) -Acpu(m68k) -Amachine(m68k)
*cross_compile:
0
*version:
2.95.3
*multilib:
. ;
*multilib_defaults:
*multilib_extra:
*multilib_matches:
*linker:
collect2
*link_command:
%{!fsyntax-only: %{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}} %{static:} %{L*} %D %o %{!nostdlib:%{!nodefaultlibs:%G %L %G}} %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*}
}}}}}}

View File

@ -1,5 +1,5 @@
#
# $Id: GNUmakefile.68k,v 1.40 2005-03-11 09:37:27 obarthel Exp $
# $Id: GNUmakefile.68k,v 1.67 2005-08-27 12:12:50 obarthel Exp $
#
# :ts=8
#
@ -12,7 +12,7 @@ RANLIB = ranlib
COPY = copy clone buf=0
DELETE = delete all quiet
MAKEDIR = makedir
MAKE = make -f GNUmakefile.68k
MAKE = $(MAKE_COMMAND) -f GNUmakefile.68k
##############################################################################
@ -78,7 +78,7 @@ $(LIBAMIGA_OBJS)/%.o : %.c
ifeq (small_data_020,$(TYPE))
CODE_TYPE := -m68020-60
CODE_FLAGS := -fbaserel -DSMALL_DATA -DM68020
CODE_FLAGS := -fbaserel -DSMALL_DATA -DM68020 -DUSE_64_BIT_INTS
endif
ifeq (small_data,$(TYPE))
@ -88,12 +88,12 @@ endif
ifeq (small_data32,$(TYPE))
CODE_TYPE := -m68020-60
CODE_FLAGS := -fbaserel32 -DSMALL_DATA32 -DM68020
CODE_FLAGS := -fbaserel32 -DSMALL_DATA32 -DM68020 -DUSE_64_BIT_INTS
endif
ifeq (large_data_020,$(TYPE))
CODE_TYPE := -m68020-60
CODE_FLAGS := -DM68020
CODE_FLAGS := -DM68020 -DUSE_64_BIT_INTS
endif
ifeq (large_data,$(TYPE))
@ -110,14 +110,17 @@ WARNINGS = \
# -Wconversion -Wshadow
INCLUDES = -Iinclude -I. -Inetinclude
OPTIONS = -DNDEBUG -fno-builtin
#OPTIONS = -D__MEM_DEBUG -fno-builtin
#OPTIONS = -DDEBUG -D__MEM_DEBUG -DNO_INLINE_STDARG -fno-builtin
#OPTIONS = -fno-builtin -fno-common -D__USE_CLIB2_NETLIB -DDEBUG
OPTIONS = -fno-builtin -fno-common -D__USE_CLIB2_NETLIB -DNDEBUG
#OPTIONS = -fno-builtin -fno-common -D__USE_CLIB2_NETLIB -D__MEM_DEBUG
#OPTIONS = -fno-builtin -fno-common -D__USE_CLIB2_NETLIB -DDEBUG -D__MEM_DEBUG -DNO_INLINE_STDARG
OPTIMIZE = -O -fomit-frame-pointer -fstrength-reduce -finline-functions
#OPTIMIZE = -O2 -fomit-frame-pointer
#DEBUG = -g2
#DEBUG = -g
CFLAGS = $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(CODE_FLAGS) $(CODE_TYPE) $(INCLUDES)
CFLAGS = \
$(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) \
$(CODE_FLAGS) $(CODE_TYPE) $(INCLUDES)
##############################################################################
@ -126,6 +129,7 @@ C_LIB = \
ctype_isalnum.o \
ctype_isalpha.o \
ctype_isascii.o \
ctype_isblank.o \
ctype_iscntrl.o \
ctype_isdigit.o \
ctype_isgraph.o \
@ -154,6 +158,10 @@ C_LIB = \
fcntl_write.o \
ftw_ftw.o \
ftw_nftw.o \
inttypes_imaxdiv.o \
inttypes_imaxabs.o \
inttypes_strtoimax.o \
inttypes_strtoumax.o \
libgen_basename.o \
libgen_dirname.o \
locale_init_exit.o \
@ -201,6 +209,7 @@ C_LIB = \
stdio_findvacantiobentry.o \
stdio_flockfile.o \
stdio_flush.o \
stdio_flush_all_files.o \
stdio_flushiobwritebuffer.o \
stdio_fopen.o \
stdio_fprintf.o \
@ -210,8 +219,10 @@ C_LIB = \
stdio_freopen.o \
stdio_fscanf.o \
stdio_fseek.o \
stdio_fseeko.o \
stdio_fsetpos.o \
stdio_ftell.o \
stdio_ftello.o \
stdio_ftrylockfile.o \
stdio_funlockfile.o \
stdio_fwrite.o \
@ -267,6 +278,8 @@ C_LIB = \
stdio_vsnprintf_hook_entry.o \
stdio_vsprintf.o \
stdio_vsprintf_hook_entry.o \
stdio_vsscanf.o \
stdio_vscanf.o \
stdlib_abort.o \
stdlib_abs.o \
stdlib_alloca.o \
@ -295,11 +308,15 @@ C_LIB = \
stdlib_getenv.o \
stdlib_getsp.o \
stdlib_get_errno.o \
stdlib_init_exit.o \
stdlib_isresident.o \
stdlib_labs.o \
stdlib_llabs.o \
stdlib_ldiv.o \
stdlib_lldiv.o \
stdlib_lib_main.o \
stdlib_lib_startup.o \
stdlib_machine_test.o \
stdlib_main.o \
stdlib_malloc.o \
stdlib_math.o \
stdlib_mkdtemp.o \
@ -312,6 +329,7 @@ C_LIB = \
stdlib_oslibversion.o \
stdlib_priority.o \
stdlib_process_name.o \
stdlib_program_name.o \
stdlib_putenv.o \
stdlib_qsort.o \
stdlib_rand.o \
@ -325,7 +343,6 @@ C_LIB = \
stdlib_set_process_window.o \
stdlib_shell_escape.o \
stdlib_showerror.o \
stdlib_socket.o \
stdlib_srand.o \
stdlib_stackargbytes.o \
stdlib_stackcheck.o \
@ -344,11 +361,11 @@ C_LIB = \
stdlib_system.o \
stdlib_termination_message.o \
stdlib_threshold.o \
stdlib_utilitybase.o \
stdlib_udivsi3.o \
stdlib_udivsi4.o \
stdlib_umodsi3.o \
stdlib_unsetenv.o \
stdlib_wildcard_expand.o \
strings_ffs.o \
strings_strcasecmp.o \
strings_strncasecmp.o \
@ -403,6 +420,8 @@ C_LIB = \
time_strftime.o \
time_time.o \
time_weekday.o \
uio_readv.o \
uio_writev.o \
unistd_access.o \
unistd_chdir.o \
unistd_chdir_exit.o \
@ -446,6 +465,7 @@ UNIX_LIB = \
fcntl_fcntl.o \
fcntl_open.o \
fcntl_get_default_file.o \
getopt_getopt_long.o \
mount_convertinfo.o \
mount_statfs.o \
stat_chmod.o \
@ -454,6 +474,7 @@ UNIX_LIB = \
stat_mkdir.o \
stat_rmdir.o \
stat_stat.o \
stdio_ctermid.o \
stdio_fdhookentry.o \
stdio_fflush.o \
stdio_fopen.o \
@ -465,10 +486,26 @@ UNIX_LIB = \
stdio_record_locking.o \
stdio_remove.o \
stdio_rename.o \
stdlib_arg.o \
stdlib_main.o \
stdlib_mkdtemp.o \
stdlib_mkstemp.o \
stdlib_mktemp.o \
stdlib_system.o \
termios_cfgetispeed.o \
termios_cfgetospeed.o \
termios_cfmakeraw.o \
termios_cfsetispeed.o \
termios_cfsetospeed.o \
termios_console_fdhookentry.o \
termios_tcdrain.o \
termios_tcflow.o \
termios_tcflush.o \
termios_tcgetattr.o \
termios_tcsendbreak.o \
termios_tcsetattr.o \
uio_readv.o \
uio_writev.o \
unistd_access.o \
unistd_chdir.o \
unistd_chdir_exit.o \
@ -485,44 +522,124 @@ UNIX_LIB = \
unistd_translaterel.o \
unistd_translateu2a.o \
unistd_truncate.o \
unistd_ttyname.o \
unistd_ttyname_r.o \
unistd_unix_path_semantics.o \
unistd_unlink.o \
unistd_wildcard_expand.o \
utime_utime.o
MATH_LIB = \
complex_carg.o \
complex_cargf.o \
complex_cargl.o \
complex_cimag.o \
complex_cimagf.o \
complex_cimagl.o \
complex_conj.o \
complex_conjf.o \
complex_conjl.o \
complex_creal.o \
complex_crealf.o \
complex_creall.o \
math_acos.o \
math_acosf.o \
math_acosh.o \
math_acoshf.o \
math_asin.o \
math_asinf.o \
math_asinh.o \
math_asinhf.o \
math_atan.o \
math_atan2.o \
math_atan2f.o \
math_atanf.o \
math_cbrt.o \
math_cbrtf.o \
math_ceil.o \
math_ceilf.o \
math_copysign.o \
math_copysignf.o \
math_cos.o \
math_cosf.o \
math_cosh.o \
math_coshf.o \
math_erf.o \
math_erfc.o \
math_erfcf.o \
math_erff.o \
math_exp.o \
math_expf.o \
math_exp2.o \
math_exp2f.o \
math_expm1.o \
math_expm1f.o \
math_fabs.o \
math_fabsf.o \
math_floor.o \
math_floorf.o \
math_fmod.o \
math_fmodf.o \
math_fpclassify.o \
math_frexp.o \
math_frexpf.o \
math_huge_val.o \
math_huge_valf.o \
math_hypot.o \
math_hypotf.o \
math_ilogb.o \
math_ilogbf.o \
math_inf.o \
math_inff.o \
math_init_exit.o \
math_isinf.o \
math_isnan.o \
math_isfinite.o \
math_isunordered.o \
math_kernel_cosf.o \
math_kernel_sinf.o \
math_kernel_tanf.o \
math_ldexp.o \
math_ldexpf.o \
math_lgamma.o \
math_lgammaf.o \
math_log.o \
math_log2.o \
math_log2f.o \
math_log10.o \
math_log10f.o \
math_log1p.o \
math_log1pf.o \
math_logb.o \
math_logbf.o \
math_logf.o \
math_modf.o \
math_modff.o \
math_nan.o \
math_nanf.o \
math_nextafter.o \
math_nextafterf.o \
math_pow.o \
math_powf.o \
math_remainder.o \
math_remainderf.o \
math_rem_pio2f.o \
math_rint.o \
math_rintf.o \
math_scalbn.o \
math_scalbnf.o \
math_signbit.o \
math_sin.o \
math_sinf.o \
math_sinh.o \
math_sinhf.o \
math_sqrt.o \
math_sqrtf.o \
math_tan.o \
math_tanf.o \
math_tanh.o \
math_tanhf.o \
stdio_asprintf.o \
stdio_flush.o \
stdio_flush_all_files.o \
stdio_fprintf.o \
stdio_fscanf.o \
stdio_printf.o \
@ -533,16 +650,18 @@ MATH_LIB = \
stdio_vasprintf.o \
stdio_vfprintf.o \
stdio_vfscanf.o \
stdio_vsscanf.o \
stdio_vscanf.o \
stdio_vprintf.o \
stdio_vsnprintf.o \
stdio_vsprintf.o \
stdlib_atof.o \
stdlib_strtod.o \
stdlib_strtof.o \
time_difftime.o
MATH_LIB_881 = \
m881.lib_rev.o \
stdlib_machine_test.o \
$(MATH_LIB)
MATH_LIB_IEEE = \
@ -757,7 +876,7 @@ endif
##############################################################################
STARTUPS := nrcrt0.o nbcrt0.o nr32crt0.o nb32crt0.o ncrt0.o mainnb.o mainb.o mainb32.o
STARTUPS := nrcrt0.o nbcrt0.o nr32crt0.o nb32crt0.o ncrt0.o
##############################################################################
@ -767,9 +886,6 @@ all: \
lib/ncrt0.o \
lib/n32bcrt0.o \
lib/n32rcrt0.o \
lib/mainnb.o \
lib/mainb.o \
lib/mainb32.o \
lib/libm020/libm.a \
lib/libm.a \
lib/libb/libm.a \
@ -879,15 +995,6 @@ lib/n32bcrt0.o : lib nb32crt0.o
lib/n32rcrt0.o : lib nr32crt0.o
@$(COPY) nr32crt0.o lib
lib/mainnb.o : lib mainnb.o
@$(COPY) mainnb.o lib
lib/mainb.o : lib mainb.o
@$(COPY) mainb.o lib
lib/mainb32.o : lib mainb32.o
@$(COPY) mainb32.o lib
##############################################################################
$(LIBAMIGA_OBJS)/amiga_hookentry.o : amiga_hookentry.c
@ -922,43 +1029,47 @@ $(LIBAMIGA_OBJS)/amiga.lib_rev.o : amiga.lib_rev.c amiga.lib_rev.h
$(LIBC_OBJS)/stdlib_stacksize.o : stdlib_stacksize.c stdlib_gcc_help.h
$(LIBC_OBJS)/stdlib_getdefstacksize.o : stdlib_getdefstacksize.c stdlib_gcc_help.h
$(LIBC_OBJS)/stdlib_shell_escape.o : stdlib_shell_escape.c stdlib_gcc_help.h
$(LIBC_OBJS)/stdlib_alloca.o : stdlib_alloca.c stdlib_mem_debug.h
$(LIBC_OBJS)/stdlib_alloca.o : stdlib_alloca.c stdlib_memory.h
$(LIBC_OBJS)/stdlib_calloc.o : stdlib_calloc.c stdlib_mem_debug.h
$(LIBC_OBJS)/stdlib_calloc.o : stdlib_calloc.c stdlib_memory.h
$(LIBC_OBJS)/stdlib_free.o : stdlib_free.c stdlib_mem_debug.h
$(LIBC_OBJS)/stdlib_free.o : stdlib_free.c stdlib_memory.h
$(LIBC_OBJS)/stdlib_init_exit.o : stdlib_init_exit.c stdlib_mem_debug.h
$(LIBC_OBJS)/stdlib_malloc.o : stdlib_malloc.c stdlib_memory.h
$(LIBC_OBJS)/stdlib_malloc.o : stdlib_malloc.c stdlib_mem_debug.h
$(LIBC_OBJS)/stdlib_realloc.o : stdlib_realloc.c stdlib_memory.h
$(LIBC_OBJS)/stdlib_realloc.o : stdlib_realloc.c stdlib_mem_debug.h
$(LIBC_OBJS)/stdlib_red_black.o : stdlib_red_black.c stdlib_mem_debug.h
$(LIBC_OBJS)/stdlib_red_black.o : stdlib_red_black.c stdlib_memory.h
##############################################################################
# The -fbaserel32 option requires the CPU type to be 68010/68020, too.
# The -fbaserel32 option requires the CPU type to be 68020, too.
ifneq (,$(findstring fbaserel32,$(CODE_FLAGS)))
LOCAL_CODE_FLAGS := $(CODE_FLAGS) $(CODE_TYPE)
else
LOCAL_CODE_FLAGS := $(CODE_FLAGS)
endif
$(LIBM881_OBJS)/math_init_exit.o : math_init_exit.c
@echo "Compiling $< [$(TYPE):m881]"
@$(CC) -o $(LIBM881_OBJS)/math_init_exit.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(LOCAL_CODE_FLAGS) -DM68881_FLOATING_POINT_SUPPORT $(INCLUDES) $<
$(LIBC_OBJS)/stdlib_machine_test.o : stdlib_machine_test.c
@echo "Compiling $< [$(TYPE):c]"
@$(CC) -o $(LIBC_OBJS)/stdlib_machine_test.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(LOCAL_CODE_FLAGS) $(INCLUDES) $<
$(LIBM881_OBJS)/stdlib_machine_test.o : stdlib_machine_test.c
@echo "Compiling $< [$(TYPE):c]"
@$(CC) -o $(LIBM881_OBJS)/stdlib_machine_test.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(LOCAL_CODE_FLAGS) $(INCLUDES) -DM68881_FLOATING_POINT_SUPPORT $<
$(LIBC_OBJS)/stdlib_showerror.o : stdlib_showerror.c
@echo "Compiling $< [$(TYPE):c]"
@$(CC) -o $(LIBC_OBJS)/stdlib_showerror.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(LOCAL_CODE_FLAGS) $(INCLUDES) $<
$(LIBC_OBJS)/stdlib_main.o : stdlib_main.c
@echo "Compiling $< [$(TYPE):c]"
@$(CC) -o $(LIBC_OBJS)/stdlib_main.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(LOCAL_CODE_FLAGS) $(INCLUDES) stdlib_main.c
##############################################################################
$(LIBC_OBJS)/stdlib_alloca_debug.o : stdlib_alloca.c
@ -1107,30 +1218,23 @@ ncrt0.o : ncrt0.S
@echo "Assembling $< [large_data]"
@$(CC) -traditional -o $@ -c ncrt0.S
mainb32.o : stdlib_main.c
@echo "Compiling $< [small_data32]"
@$(CC) -o mainb32.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -fbaserel32 -DSMALL_DATA32 -m68020-60 -DM68020 stdlib_main.c
mainb.o : stdlib_main.c
@echo "Compiling $< [small_data]"
@$(CC) -o mainb.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -fbaserel -DSMALL_DATA -m68000 stdlib_main.c
mainnb.o : stdlib_main.c
@echo "Compiling $< [large_data]"
@$(CC) -o mainnb.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -m68000 stdlib_main.c
##############################################################################
CONSTRUCTOR_FILES = \
amiga_rexxvars.c \
amiga_rexxvars.c \
dirent_closedir.c \
locale_init_exit.c \
math_init_exit.c \
sas_profile.c \
socket_init_exit.c \
stdio_file_init.c \
stdio_init_exit.c \
stdlib_alloca.c \
stdlib_arg.c \
stdlib_malloc.c \
stdlib_program_name.c \
stdlib_setenv.c \
stdlib_stackcheck.c \
stdlib_stackextension.c \
time_clock.c \
unistd_chdir_exit.c \

View File

@ -1,5 +1,5 @@
#
# $Id: GNUmakefile.os4,v 1.41 2005-03-11 09:37:28 obarthel Exp $
# $Id: GNUmakefile.os4,v 1.74 2005-09-03 14:45:14 obarthel Exp $
#
# :ts=8
#
@ -16,7 +16,7 @@ CC = ppc-amigaos-gcc
AR = ppc-amigaos-ar -q
RANLIB = ppc-amigaos-ranlib
COPY = cp -a
DELETE = rm -r
DELETE = rm -rf
MAKEDIR = mkdir
# The following are for the native OS4 compiler
@ -27,7 +27,7 @@ MAKEDIR = mkdir
# DELETE = delete all quiet
# MAKEDIR = makedir
MAKE = make -f GNUmakefile.os4
MAKE = $(MAKE_COMMAND) -f GNUmakefile.os4
##############################################################################
@ -38,6 +38,7 @@ LIBM_OBJS = libm_objs
LIBNET_OBJS = libnet_objs
LIBDEBUG_OBJS = libdebug_objs
LIBAMIGA_OBJS = libamiga_objs
LIBPROFILE_OBJS = libprofile_objs
else
LIBC_OBJS = $(TYPE)/libc_objs
LIBUNIX_OBJS = $(TYPE)/libunix_objs
@ -45,6 +46,7 @@ LIBM_OBJS = $(TYPE)/libm_objs
LIBNET_OBJS = $(TYPE)/libnet_objs
LIBDEBUG_OBJS = $(TYPE)/libdebug_objs
LIBAMIGA_OBJS = $(TYPE)/libamiga_objs
LIBPROFILE_OBJS = $(TYPE)/libprofile_objs
endif
##############################################################################
@ -78,6 +80,16 @@ $(LIBAMIGA_OBJS)/%.o : %.c
@echo "Compiling $< [$(TYPE):amiga]"
@$(CC) -o $(LIBAMIGA_OBJS)/$*.o -c $(CFLAGS) $<
$(LIBPROFILE_OBJS)/%.o : %.c
@echo "Compiling $< [$(TYPE):profile]"
@$(CC) -o $(LIBPROFILE_OBJS)/$*.o -c $(CFLAGS) $<
$(LIBPROFILE_OBJS)/%.o : %.S
@echo "Assembling $< [$(TYPE):profile]"
@$(CC) -o $(LIBPROFILE_OBJS)/$*.o -Wa,-mregnames -c $(CFLAGS) $<
##############################################################################
# Build options for the individual libraries
@ -101,7 +113,6 @@ CODE_TYPE := -mbaserel -DBASEREL_DATA
FLOAT_TYPE := -DPPC_FLOATING_POINT_SUPPORT
endif
##############################################################################
WARNINGS = \
@ -111,9 +122,10 @@ WARNINGS = \
# -Wconversion -Wshadow
INCLUDES = -Iinclude -I. -I$(SDK_INCLUDE)
OPTIONS = -D__THREAD_SAFE -DNDEBUG -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames
OPTIMIZE = -O -fomit-frame-pointer -funroll-loops
#DEBUG = -g
OPTIONS = -D__THREAD_SAFE -D__USE_CLIB2_NETLIB -DNDEBUG -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames -fno-common -std=gnu99
#OPTIONS = -D__USE_CLIB2_NETLIB -DNDEBUG -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames -fno-common -std=gnu99
OPTIMIZE = -O3
#DEBUG = -ggdb
CFLAGS = $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(CODE_TYPE) $(INCLUDES)
@ -125,6 +137,7 @@ C_LIB = \
ctype_isalnum.o \
ctype_isalpha.o \
ctype_isascii.o \
ctype_isblank.o \
ctype_iscntrl.o \
ctype_isdigit.o \
ctype_isgraph.o \
@ -153,6 +166,10 @@ C_LIB = \
fcntl_write.o \
ftw_ftw.o \
ftw_nftw.o \
inttypes_imaxdiv.o \
inttypes_imaxabs.o \
inttypes_strtoimax.o \
inttypes_strtoumax.o \
libgen_basename.o \
libgen_dirname.o \
locale_init_exit.o \
@ -162,6 +179,7 @@ C_LIB = \
mount_convertinfo.o \
mount_fstatfs.o \
mount_statfs.o \
profile_profil.o \
signal_checkabort.o \
signal_data.o \
signal_kill.o \
@ -200,6 +218,7 @@ C_LIB = \
stdio_findvacantiobentry.o \
stdio_flockfile.o \
stdio_flush.o \
stdio_flush_all_files.o \
stdio_flushiobwritebuffer.o \
stdio_fopen.o \
stdio_fprintf.o \
@ -209,8 +228,10 @@ C_LIB = \
stdio_freopen.o \
stdio_fscanf.o \
stdio_fseek.o \
stdio_fseeko.o \
stdio_fsetpos.o \
stdio_ftell.o \
stdio_ftello.o \
stdio_ftrylockfile.o \
stdio_funlockfile.o \
stdio_fwrite.o \
@ -261,6 +282,8 @@ C_LIB = \
stdio_vasprintf_hook_entry.o \
stdio_vfprintf.o \
stdio_vfscanf.o \
stdio_vsscanf.o \
stdio_vscanf.o \
stdio_vprintf.o \
stdio_vsnprintf.o \
stdio_vsnprintf_hook_entry.o \
@ -294,11 +317,15 @@ C_LIB = \
stdlib_getenv.o \
stdlib_getsp.o \
stdlib_get_errno.o \
stdlib_init_exit.o \
stdlib_isresident.o \
stdlib_labs.o \
stdlib_llabs.o \
stdlib_ldiv.o \
stdlib_lldiv.o \
stdlib_lib_main.o \
stdlib_lib_startup.o \
stdlib_machine_test.o \
stdlib_main.o \
stdlib_malloc.o \
stdlib_math.o \
stdlib_mkdtemp.o \
@ -311,6 +338,7 @@ C_LIB = \
stdlib_oslibversion.o \
stdlib_priority.o \
stdlib_process_name.o \
stdlib_program_name.o \
stdlib_putenv.o \
stdlib_qsort.o \
stdlib_rand.o \
@ -324,7 +352,6 @@ C_LIB = \
stdlib_set_process_window.o \
stdlib_shell_escape.o \
stdlib_showerror.o \
stdlib_socket.o \
stdlib_srand.o \
stdlib_stackargbytes.o \
stdlib_stackcheck.o \
@ -343,11 +370,11 @@ C_LIB = \
stdlib_system.o \
stdlib_termination_message.o \
stdlib_threshold.o \
stdlib_utilitybase.o \
stdlib_udivsi3.o \
stdlib_udivsi4.o \
stdlib_umodsi3.o \
stdlib_unsetenv.o \
stdlib_wildcard_expand.o \
strings_ffs.o \
strings_strcasecmp.o \
strings_strncasecmp.o \
@ -402,6 +429,8 @@ C_LIB = \
time_strftime.o \
time_time.o \
time_weekday.o \
uio_readv.o \
uio_writev.o \
unistd_access.o \
unistd_chdir.o \
unistd_chdir_exit.o \
@ -446,6 +475,7 @@ UNIX_LIB = \
fcntl_fcntl.o \
fcntl_open.o \
fcntl_get_default_file.o \
getopt_getopt_long.o \
mount_convertinfo.o \
mount_statfs.o \
stat_chmod.o \
@ -454,6 +484,7 @@ UNIX_LIB = \
stat_mkdir.o \
stat_rmdir.o \
stat_stat.o \
stdio_ctermid.o \
stdio_fdhookentry.o \
stdio_fflush.o \
stdio_fopen.o \
@ -465,10 +496,27 @@ UNIX_LIB = \
stdio_record_locking.o \
stdio_remove.o \
stdio_rename.o \
stdlib_arg.o \
stdlib_main.o \
stdlib_mkdtemp.o \
stdlib_mkstemp.o \
stdlib_mktemp.o \
stdlib_system.o \
termios_cfgetispeed.o \
termios_cfgetospeed.o \
termios_cfmakeraw.o \
termios_cfsetispeed.o \
termios_cfsetospeed.o \
termios_console_fdhookentry.o \
termios_openserial.o \
termios_tcdrain.o \
termios_tcflow.o \
termios_tcflush.o \
termios_tcgetattr.o \
termios_tcsendbreak.o \
termios_tcsetattr.o \
uio_readv.o \
uio_writev.o \
unistd_access.o \
unistd_chdir.o \
unistd_chdir_exit.o \
@ -485,6 +533,8 @@ UNIX_LIB = \
unistd_translaterel.o \
unistd_translateu2a.o \
unistd_truncate.o \
unistd_ttyname.o \
unistd_ttyname_r.o \
unistd_unix_path_semantics.o \
unistd_unlink.o \
unistd_wildcard_expand.o \
@ -492,44 +542,122 @@ UNIX_LIB = \
# All objects files which make up libm.a
MATH_LIB = \
complex_carg.o \
complex_cargf.o \
complex_cargl.o \
complex_cimag.o \
complex_cimagf.o \
complex_cimagl.o \
complex_conj.o \
complex_conjf.o \
complex_conjl.o \
complex_creal.o \
complex_crealf.o \
complex_creall.o \
math_acos.o \
math_acosf.o \
math_acosh.o \
math_acoshf.o \
math_asin.o \
math_asinf.o \
math_asinh.o \
math_asinhf.o \
math_atan.o \
math_atan2.o \
math_atan2f.o \
math_atanf.o \
math_cbrt.o \
math_cbrtf.o \
math_ceil.o \
math_ceilf.o \
math_copysign.o \
math_copysignf.o \
math_cos.o \
math_cosf.o \
math_cosh.o \
math_coshf.o \
math_erf.o \
math_erfc.o \
math_erfcf.o \
math_erff.o \
math_exp.o \
math_expf.o \
math_exp2.o \
math_exp2f.o \
math_expm1.o \
math_expm1f.o \
math_fabs.o \
math_fabsf.o \
math_floor.o \
math_floorf.o \
math_fmod.o \
math_fmodf.o \
math_fpclassify.o \
math_frexp.o \
math_frexpf.o \
math_huge_val.o \
math_huge_valf.o \
math_hypot.o \
math_hypotf.o \
math_ilogb.o \
math_ilogbf.o \
math_inf.o \
math_inff.o \
math_init_exit.o \
math_isnan.o \
math_isinf.o \
math_isfinite.o \
math_isunordered.o \
math_kernel_cos.o \
math_kernel_cosf.o \
math_kernel_expm1.o \
math_kernel_rem_pio2.o \
math_kernel_scalbn.o \
math_kernel_sin.o \
math_kernel_sinf.o \
math_kernel_tan.o \
math_kernel_tanf.o \
math_ldexp.o \
math_ldexpf.o \
math_lgamma.o \
math_lgammaf.o \
math_log.o \
math_log2.o \
math_log2f.o \
math_log10.o \
math_log10f.o \
math_log1p.o \
math_log1pf.o \
math_logb.o \
math_logbf.o \
math_logf.o \
math_modf.o \
math_modff.o \
math_nan.o \
math_nanf.o \
math_nextafter.o \
math_nextafterf.o \
math_pow.o \
math_powf.o \
math_remainder.o \
math_remainderf.o \
math_rem_pio2f.o \
math_rint.o \
math_rintf.o \
math_scalbn.o \
math_scalbnf.o \
math_signbit.o \
math_sin.o \
math_sinf.o \
math_sinh.o \
math_sinhf.o \
math_sqrt.o \
math_sqrtf.o \
math_tan.o \
math_tanf.o \
math_tanh.o \
math_kernel_expm1.o \
math_kernel_scalbn.o \
math_kernel_tan.o \
math_kernel_cos.o \
math_kernel_rem_pio2.o \
math_kernel_sin.o \
math_tanhf.o \
stdio_asprintf.o \
stdio_flush.o \
stdio_flush_all_files.o \
stdio_fprintf.o \
stdio_fscanf.o \
stdio_printf.o \
@ -540,12 +668,14 @@ MATH_LIB = \
stdio_vasprintf.o \
stdio_vfprintf.o \
stdio_vfscanf.o \
stdio_vsscanf.o \
stdio_vscanf.o \
stdio_vprintf.o \
stdio_vsnprintf.o \
stdio_vsprintf.o \
stdlib_atof.o \
stdlib_machine_test.o \
stdlib_strtod.o \
stdlib_strtof.o \
time_difftime.o
# All objects files which make up libnet.a
@ -700,6 +830,11 @@ MEMDEBUG_LIB = \
string_strdup_debug.o \
unistd_getcwd_debug.o
PROFILE_LIB = \
profile__mcount.o \
profile_gmon.o \
profile_mcount.o
##############################################################################
# The libraries to be built, prefixed by the respective path names
@ -709,12 +844,13 @@ LIBS := \
$(LIBDEBUG_OBJS)/libdebug.a \
$(LIBAMIGA_OBJS)/libamiga.a \
$(LIBM_OBJS)/libm.a \
$(LIBNET_OBJS)/libnet.a
$(LIBNET_OBJS)/libnet.a \
$(LIBPROFILE_OBJS)/libprofile.a
##############################################################################
# The startup object files to be built
STARTUPS := bcrt0.o bcrtbegin.o bcrtend.o crt0.o crtbegin.o crtend.o mainb.o mainnb.o
STARTUPS := crt0.o crtbegin.o crtend.o
##############################################################################
@ -729,22 +865,18 @@ all: \
large_data \
large_data_softfloat \
baserel \
lib/bcrt0.o \
lib/bcrtbegin.o \
lib/bcrtend.o \
lib/crt0.o \
lib/crtbegin.o \
lib/crtend.o \
lib/mainb.o \
lib/mainnb.o \
lib/libm.a \
lib/small-data/crt0.o \
lib/small-data/crtbegin.o \
lib/small-data/crtend.o \
lib/small-data/libm.a \
lib/soft-float/libm.a \
lib/baserel/crt0.o \
lib/baserel/crtbegin.o \
lib/baserel/crtend.o \
lib/baserel/mainb.o \
lib/baserel/mainnb.o \
lib/baserel/libm.a
##############################################################################
@ -764,6 +896,7 @@ version:
cp c.lib_rev.rev net.lib_rev.rev
cp c.lib_rev.rev stack.lib_rev.rev
cp c.lib_rev.rev unix.lib_rev.rev
cp c.lib_rev.rev profile.lib_rev.rev
bumprev 1 amiga.lib
bumprev 1 c.lib
bumprev 1 debug.lib
@ -772,6 +905,7 @@ version:
bumprev 1 net.lib
bumprev 1 stack.lib
bumprev 1 unix.lib
bumprev 1 profile.lib
##############################################################################
@ -868,20 +1002,14 @@ lib/crtbegin.o : lib crtbegin.o
lib/crtend.o : lib crtend.o
$(COPY) crtend.o lib
lib/mainnb.o : lib mainnb.o
$(COPY) mainnb.o lib
lib/small-data/crt0.o : lib small_data/crt0.o
$(COPY) small_data/crt0.o lib/small-data
lib/mainb.o : lib mainb.o
$(COPY) mainb.o lib
lib/small-data/crtbegin.o : lib small_data/crtbegin.o
$(COPY) small_data/crtbegin.o lib/small-data
lib/bcrt0.o : lib bcrt0.o
$(COPY) bcrt0.o lib
lib/bcrtbegin.o : lib bcrtbegin.o
$(COPY) bcrtbegin.o lib
lib/bcrtend.o : lib bcrtend.o
$(COPY) bcrtend.o lib
lib/small-data/crtend.o : lib small_data/crtend.o
$(COPY) small_data/crtend.o lib/small-data
lib/baserel/crt0.o : lib baserel/crt0.o
$(COPY) baserel/crt0.o lib/baserel
@ -892,13 +1020,6 @@ lib/baserel/crtbegin.o : lib baserel/crtbegin.o
lib/baserel/crtend.o : lib baserel/crtend.o
$(COPY) baserel/crtend.o lib/baserel
lib/baserel/mainnb.o : lib baserel/mainnb.o
$(COPY) baserel/mainnb.o lib/baserel
lib/baserel/mainb.o : lib baserel/mainb.o
$(COPY) baserel/mainb.o lib/baserel
##############################################################################
# Individual dependencies which tell make to build the object files from
@ -925,24 +1046,24 @@ $(LIBDEBUG_OBJS)/debug.lib_rev.o : debug.lib_rev.c debug.lib_rev.h
$(LIBAMIGA_OBJS)/amiga.lib_rev.o : amiga.lib_rev.c amiga.lib_rev.h
$(LIBPROFILE_OBJS)/profile.lib_rev.o : profile.lib_rev.c profile.lib_rev.h
##############################################################################
# Build rules for the debug version of the library which has special
# memory allocation debugging code, controlled by the contents of
# the stdlib_mem_debug.h file.
$(LIBC_OBJS)/stdlib_alloca.o : stdlib_alloca.c stdlib_mem_debug.h
# the stdlib_memory.h file.
$(LIBC_OBJS)/stdlib_alloca.o : stdlib_alloca.c stdlib_memory.h
$(LIBC_OBJS)/stdlib_calloc.o : stdlib_calloc.c stdlib_mem_debug.h
$(LIBC_OBJS)/stdlib_calloc.o : stdlib_calloc.c stdlib_memory.h
$(LIBC_OBJS)/stdlib_free.o : stdlib_free.c stdlib_mem_debug.h
$(LIBC_OBJS)/stdlib_free.o : stdlib_free.c stdlib_memory.h
$(LIBC_OBJS)/stdlib_init_exit.o : stdlib_init_exit.c stdlib_mem_debug.h
$(LIBC_OBJS)/stdlib_malloc.o : stdlib_malloc.c stdlib_memory.h
$(LIBC_OBJS)/stdlib_malloc.o : stdlib_malloc.c stdlib_mem_debug.h
$(LIBC_OBJS)/stdlib_realloc.o : stdlib_realloc.c stdlib_memory.h
$(LIBC_OBJS)/stdlib_realloc.o : stdlib_realloc.c stdlib_mem_debug.h
$(LIBC_OBJS)/stdlib_red_black.o : stdlib_red_black.c stdlib_mem_debug.h
$(LIBC_OBJS)/stdlib_red_black.o : stdlib_red_black.c stdlib_memory.h
##############################################################################
@ -1060,43 +1181,43 @@ $(LIBAMIGA_OBJS)/libamiga.a : $(LIBAMIGA_OBJS) $(foreach file,$(AMIGA_LIB),$(LIB
##############################################################################
# Individual build rules for libprofile.a
$(LIBPROFILE_OBJS) :
$(MAKEDIR) $@
$(LIBPROFILE_OBJS)/libprofile.a : $(LIBPROFILE_OBJS) $(foreach file,$(PROFILE_LIB),$(LIBPROFILE_OBJS)/$(file))
-$(DELETE) $@
@$(AR) $@ $(foreach file,$(PROFILE_LIB),$(LIBPROFILE_OBJS)/$(file))
$(RANLIB) $@
##############################################################################
# Individual build rules for the startup code.
crt0.o : crt0.S
@echo "Assembling $<"
@$(CC) -Wa,-mregnames -o crt0.o -c crt0.S
bcrt0.o : crt0.S
small_data/crt0.o : crt0.S
@echo "Assembling $<"
@$(CC) -DSMALL_DATA -Wa,-mregnames -o bcrt0.o -c crt0.S
@$(CC) -DSMALL_DATA -Wa,-mregnames -o small_data/crt0.o -c crt0.S
mainnb.o : stdlib_main.c
@echo "Compiling $<"
@$(CC) -o mainnb.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -msdata=data stdlib_main.c
small_data/crtbegin.o : crtbegin.c
@echo "Assembling $<"
@$(CC) -o small_data/crtbegin.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -msdata=sysv -DSMALL_DATA crtbegin.c
mainb.o : stdlib_main.c
@echo "Compiling $<"
@$(CC) -o mainb.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -msdata=sysv -DSMALL_DATA stdlib_main.c
bcrtbegin.o : crtbegin.c
$(CC) -o bcrtbegin.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -msdata=sysv -DSMALL_DATA crtbegin.c
bcrtend.o : crtend.c
$(CC) -o bcrtend.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -msdata=sysv -DSMALL_DATA crtend.c
small_data/crtend.o : crtend.c
@echo "Assembling $<"
@$(CC) -o small_data/crtend.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -msdata=sysv -DSMALL_DATA crtend.c
baserel/crt0.o : crt0.S
@echo "Assembling $<"
@$(CC) -Wa,-mregnames -o baserel/crt0.o -mbaserel -DBASEREL_DATA -c crt0.S
baserel/mainnb.o : stdlib_main.c
@echo "Compiling $<"
@$(CC) -o baserel/mainnb.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -mbaserel -DBASEREL_DATA stdlib_main.c
baserel/mainb.o : stdlib_main.c
@echo "Compiling $<"
@$(CC) -o baserel/mainb.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -mbaserel -DBASEREL_DATA stdlib_main.c
baserel/crtbegin.o : crtbegin.c
$(CC) -o baserel/crtbegin.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -mbaserel -DBASEREL_DATA crtbegin.c
@echo "Assembling $<"
@$(CC) -o baserel/crtbegin.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -mbaserel -DBASEREL_DATA crtbegin.c
baserel/crtend.o : crtend.c
$(CC) -o baserel/crtend.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -mbaserel -DBASEREL_DATA crtend.c
@echo "Assembling $<"
@$(CC) -o baserel/crtend.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -mbaserel -DBASEREL_DATA crtend.c

19
library/TODO Executable file
View File

@ -0,0 +1,19 @@
C99 math functions:
(functions generally missing, including their "float" counterparts)
fma
fmaf
lrint
lrintf
lround
lroundf
nearbyint
nearbyintf
remquo
remquof
round
roundf
tgamma
tgammaf
trunc
truncf

View File

@ -1,6 +1,6 @@
#define VERSION 1
#define REVISION 189
#define DATE "5.3.2005"
#define VERS "amiga.lib 1.189"
#define VSTRING "amiga.lib 1.189 (5.3.2005)\r\n"
#define VERSTAG "\0$VER: amiga.lib 1.189 (5.3.2005)"
#define REVISION 195
#define DATE "3.9.2005"
#define VERS "amiga.lib 1.195"
#define VSTRING "amiga.lib 1.195 (3.9.2005)\r\n"
#define VERSTAG "\0$VER: amiga.lib 1.195 (3.9.2005)"

View File

@ -1 +1 @@
189
195

View File

@ -1,5 +1,5 @@
/*
* $Id: amiga_acrypt.c,v 1.2 2005-01-02 09:07:06 obarthel Exp $
* $Id: amiga_acrypt.c,v 1.3 2005-05-30 14:01:20 obarthel Exp $
*
* :ts=4
*
@ -31,10 +31,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#define ACrypt __ACrypt
#include <exec/types.h>
#include <string.h>
#include <clib/alib_protos.h>
#undef ACrypt
/****************************************************************************/
#include "debug.h"

View File

@ -1,5 +1,5 @@
/*
* $Id: amiga_createtask.c,v 1.3 2005-01-02 09:07:07 obarthel Exp $
* $Id: amiga_createtask.c,v 1.4 2005-03-18 12:38:21 obarthel Exp $
*
* :ts=4
*
@ -46,6 +46,12 @@
/****************************************************************************/
#ifndef _STDLIB_PROFILE_H
#include "stdlib_profile.h"
#endif /* _STDLIB_PROFILE_H */
/****************************************************************************/
#include "macros.h"
#include "debug.h"

View File

@ -1,5 +1,5 @@
/*
* $Id: amiga_dotimer.c,v 1.3 2005-03-06 09:00:16 obarthel Exp $
* $Id: amiga_dotimer.c,v 1.6 2005-09-03 14:45:14 obarthel Exp $
*
* :ts=4
*
@ -44,6 +44,12 @@
/****************************************************************************/
#ifndef _STDLIB_PROFILE_H
#include "stdlib_profile.h"
#endif /* _STDLIB_PROFILE_H */
/****************************************************************************/
#include "macros.h"
#include "debug.h"
@ -61,9 +67,10 @@ DoTimer(struct timeval *tv,LONG unit,LONG command)
#if defined(__amigaos4__)
{
mp = AllocSysObjectTags(ASOT_PORT,
ASOPORT_Action, PA_SIGNAL,
ASOPORT_Signal, SIGB_SINGLE,
ASOPORT_Target, FindTask(NULL),
ASOPORT_Action, PA_SIGNAL,
ASOPORT_AllocSig, FALSE,
ASOPORT_Signal, SIGB_SINGLE,
ASOPORT_Target, FindTask(NULL),
TAG_DONE);
if(mp == NULL)
@ -107,7 +114,7 @@ DoTimer(struct timeval *tv,LONG unit,LONG command)
PROFILE_OFF();
SetSignal(0,SIGF_SINGLE);
SetSignal(0,(1UL << mp->mp_SigBit));
error = DoIO((struct IORequest *)tr);

View File

@ -1,5 +1,5 @@
/*
* $Id: amiga_rexxvars.c,v 1.3 2005-01-09 10:10:40 obarthel Exp $
* $Id: amiga_rexxvars.c,v 1.6 2005-03-18 12:38:21 obarthel Exp $
*
* :ts=4
*
@ -34,12 +34,20 @@
/* We don't want to pull in <clib/alib_protos.h> */
#define CLIB_ALIB_PROTOS_H
/****************************************************************************/
#ifndef _STDLIB_HEADERS_H
#include "stdlib_headers.h"
#endif /* _STDLIB_HEADERS_H */
/****************************************************************************/
#ifndef _STDLIB_CONSTRUCTOR_H
#include "stdlib_constructor.h"
#endif /* _STDLIB_CONSTRUCTOR_H */
/****************************************************************************/
#include <rexx/rxslib.h>
#include <rexx/errors.h>
@ -60,7 +68,7 @@ static struct RexxSysIFace * IRexxSys;
/****************************************************************************/
CLIB_CONSTRUCTOR(__rexxvars_init)
CLIB_CONSTRUCTOR(rexxvars_init)
{
ENTER();
@ -80,12 +88,14 @@ CLIB_CONSTRUCTOR(__rexxvars_init)
}
#endif /* __amigaos4__ */
LEAVE();
CONSTRUCTOR_SUCCEED();
}
/****************************************************************************/
CLIB_DESTRUCTOR(__rexxvars_exit)
CLIB_DESTRUCTOR(rexxvars_exit)
{
ENTER();

31
library/build_archive_amiga Executable file
View File

@ -0,0 +1,31 @@
; Simple release archive build script for Amiga systems.
; Set the name of the archive and the directory the
; files go into
set dir_name clib2-1.`type c.lib_rev.rev`
; Start with a clean slate
delete all quiet ram:$dir_name
; Create the directory, copy all the libraries, header files
; and release note files inside.
makedir ram:$dir_name
copy lib ram:${dir_name}/lib all clone quiet
copy include ram:${dir_name}/include all clone quiet
copy changes ram:$dir_name clone
; Delete the CVS data from the include directory
delete ram:${dir_name}/include/CVS ram:${dir_name}/include/sys/CVS all quiet
; Finally, create an lha archive in RAM:
pushcd ram:
lha -r -x -a a ${dir_name}-gcc-68k.lha ${dir_name}
popcd
; Move the archive back to this directory
copy ram:${dir_name}-gcc-68k.lha "" clone
; Clean up...
delete ram:$dir_name all quiet
unset dir_name

27
library/build_archive_unix.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
# Simple release archive build script for Unix systems.
# I typically build the library with a cross compiler.
# Set the name of the archive and the directory the
# files go into
export dir_name=clib2-1.`cat c.lib_rev.rev`
# Start with a clean slate
rm -rf $dir_name
# Create the directory, copy all the libraries, header files
# and release note files inside.
mkdir $dir_name
cp -a lib $dir_name
cp -a lib.threadsafe $dir_name
cp -a include $dir_name
cp changes $dir_name
# Delete the CVS data from the include directory
rm -rf ${dir_name}/include/CVS ${dir_name}/include/sys/CVS
# Finally, create an lha type 5 archive; the Amiga LhA port
# can unpack it.
lha ao5q ${dir_name}-gcc-os4.lha ${dir_name}

View File

@ -1,6 +1,6 @@
#define VERSION 1
#define REVISION 189
#define DATE "5.3.2005"
#define VERS "c.lib 1.189"
#define VSTRING "c.lib 1.189 (5.3.2005)\r\n"
#define VERSTAG "\0$VER: c.lib 1.189 (5.3.2005)"
#define REVISION 195
#define DATE "3.9.2005"
#define VERS "c.lib 1.195"
#define VSTRING "c.lib 1.195 (3.9.2005)\r\n"
#define VERSTAG "\0$VER: c.lib 1.195 (3.9.2005)"

View File

@ -1 +1 @@
189
195

View File

@ -1,3 +1,374 @@
c.lib 1.195 (3.9.2005)
- In __time_delay() the CheckIO() test was wrong and should have
tested for a request still in progress. Fixed.
- Modified select() to support plain files, too. The new code now
compares the current file position against the current file size,
if that file is on a file system, or simply checks if there is
any data in the file (which works for the default PIPE: device).
- The raw file descriptor structure member fd_Position is now
always updated, regardless of whether the file supports random
access or not.
- The wildcard escape character used in __wildcard_expand_init() was
wrong. It should have been "'" but it was "`". Fixed.
- The startup code now references the linker symbol generated for
the user-supplied main() function.
- log(+/-0), logb(+/-0), log10(+/-0) now return -infinity.
- getcwd() now considers a buffer size of 0 an error, and it sets
the errno code to ERANGE if the buffer is too small.
- With Unix path semantics enabled, rename() now fails if either
the old or the new name are empty strings. Same thing for
opendir(), utime(), unlink(), chown(), link(), readlink(),
realpath(), chdir(), access(), stat(), rmdir(), lstat(),
chmod(), statfs() and open()/fopen().
- Fixed several issues with the formatted output of strftime()
for the "C" locale: "%p" could return " PM", "%c" is now
equivalent to "%a %b %e %T %Y", "%x" is equivalent to "%m/%d/%y"
and "%X" is now equivalent to "%T".
- The 68020/030/040/060 versions of the library now include the
64 bit integer conversion code. The plain 68000 version does not.
- The 64 bit integer conversion code used in by the scanf() family
was broken due to a misplaced overflow check, which had the cruel
effect of triggering for 32 bit integers as well. Fixed.
- DoTimer() did not allocate the local MsgPort correctly. Fixed.
c.lib 1.194 (15.7.2005)
- Added getopt_long to libunix.a <tfrieden>
- Added new libprofile.a which implements gprof gmon.out output <tfrieden>
- Added the function profil() to libc.a <tfrieden>
- Added ftello() and fseeko() which both merely call the equivalent (at
least for clib2) ftell() and fseek() functions, respectively.
- statfs() never stated that a disk was mounted for read-only access
because the wrong InfoData structure member was tested. Fixed.
- lstat would overwrite the name parameter via ReadLink(..., name, ...)
instead of ReadLink(..., new_name, ...) <tfrieden>
- Implemented exp2()/exp2f() and log2()/log2f() as suggested by
Henning Nielsen Lund. Thank you very much!
- The pattern matching code which expands command line arguments, as part
of libunix.a, now translates the "*" wildcard into "#?" unless you prefix
it with a backtick ("'"), which is the wildcard pattern escape character
used on AmigaOS.
- Repaired the pattern matching code which expands command line arguments:
it no longer requires that any parameters are quoted and it is automatically
enabled if you link against libunix.a, without libc.a standing a chance to
accidentally override it.
- Fixed a bug in vfprintf that would surface when the buffer was enlarged
if the pattern was too large to fit the static internal buffer <tfrieden>
- Added file system names to statfs <tfrieden>
- Moved all the constructor code out of "stdlib_init_exit.c" and into the
files which initialize global data, such as the new "stdlib_program_name.c"
and "stdlib_malloc.c".
- Until I can find a way to invoke it from within the library, the
__machine_test() function is no longer invoked.
- Tagged global data with NOCOMMON attributes.
- Added the __lib_init() and __lib_exit() functions, which are part of the
thread-safe library and which can be used to hook up clib2 with standard
Amiga shared library/device code. Some documentation on how to use them
can be found in the <dos.h> header file.
- Added a complete shared library skeleton example to demonstrate how the
clib2 shared library initialization/cleanup functions should be used.
This is a dual-build library which will both work with the plain 68k
AmigaOS and the PowerPC native AmigaOS4. The example source code can be
found in the "skeleton_library" subdirectory.
- The thread-safe version of isatty() should now work for stdio
file descriptors, too.
- Retrofitted thread-safety into the termios code.
- The socket/usergroup API function and data type definitions that used to
be defined in <unistd.h> have been moved into a separate header file
<sys/clib2_net.h> which, for backwards compatibility, can be include
from within <unistd.h> if the preprocessor symbol __USE_CLIB2_NETLIB
is defined early on. Eventually, <sys/clib2_net.h> should be removed
from the general header files and become a local library build header
file altogether. Note that in this case you would have to build your
own software using common TCP/IP SDK header files.
- <sys/types.h> now also includes <time.h> and <stddef.h>.
c.lib 1.193 (4.6.2005)
- fpclassify() now returns FP_ZERO both for 0 and -0.
- nan() and nanf() now return quiet NaNs.
- Added internal __inf() and __inff() functions.
- strtof() now calls nanf() and __inff(), respectively, to produce
the special floating point values for nan/inf/infinity.
- strtod() now calls nan() and __inf(), respectively, to produce
the special floating point values for nan/inf/infinity.
- The scanf() family now calls nan() and __inf(), respectively, to
produce the special floating point values for nan/inf/infinity.
- Added %D, %e, %F, %g, %G and %h for strftime(); repaired %I.
- Documented __strip_double_slash() and plugged in a memmove()
in place of the copying loop.
- Modified __translate_unix_to_amiga_path_name() and
__translate_amiga_to_unix_path_name() to not to call strlen()
on the results of __strip_double_slash().
- For %C strtime() should return the century number, not the
year number mod 100.
- The record locking code in fcntl() is no longer part of the
regular libc.a, but only of libunix.a.
- Changed the definition of the D_S() macro to cast the pointer
address to an unsigned 32 bit integer.
- Modified the locale-aware isalnum(), isalpha(), iscntrl(),
isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(),
isupper(), isxdigit(), tolower() and toupper() functions
to clamp the input parameter to the "unsigned char" range before
it is submitted to the respective locale.library function. This
should be in sync with what the specs demand, which state that
if the input parameter is neither EOF nor in the range of an
"unsigned char" variable, then the results are undefined.
- ungetc() now returns the input character, clamped to an unsigned
char value, upon success. Previously, if the input parameter was
negative and not EOF, the result was identical to the input, which
could have had negative side-effects.
-<2D>Added NAN, INFINITY, FLT_EVAL_METHOD, float_t and double_t to
<math.h> (C99).
- Added skeleton code for acosf(), acosh(), acoshf(), asinf(), asinh(),
asinhf(), atan2f(), atanf(), atanh(), atanhf(), cbrt(), cbrtf(),
ceilf(), cosf(), coshf(), erf(), erfc(), erfcf(), erff(),
exp2(), exp2f(), expf(), expm1(), expm1f(), fdim(), fdimf(),
floorf(), fma(), fmaf(), fmax(), fmaxf(), fmin(), fminf(),
fmodf(), frexpf(), hypotf(), ilogb(), ilogbf(), ldexpf(), lgamma(),
lgammaf(), log10f(), log1p(), log1pf(), log2(), log2f(), logbf(),
logf(), lrint(), lrintf(), lround(), lroundf(), modff(), nearbyint(),
nearbyintf(), powf(), remainder(), remainderf(), remquo(), remquof(), round(),
roundf(), scalbn(), scalbnf(), sinf(), sinhf(), sqrtf(), tanf(),
tanhf(), tgamma(), tgammaf(), trunc() and truncf(), to be filled in
later...
- Implemented fmin()/fminf(), fmax()/fmaxf(), fdim()/fdimf() for C99.
- Ported acosf(), asinf(), atan2f(), atanf(), ceilf(), expf(), floorf(),
fmodf(), frexpf(), ldexpf(), log10f(), logbf(), logf(), modff(), powf(), sqrtf(),
scalbn() and scalbnf() for C99.
- Ported cbrt(), cbrtf(), erf(), erff(), erfc(), erfcf(), expm1(),
expm1f(), ilogb(), ilogbf(), log1p() and log1pf() for C99.
- Ported cosf(), coshf(), sinf(), sinhf(), tanf(), tanhf()
and hypotf() for C99.
- Ported acosh(), acoshf(), asinh(), asinhf(), lgamma(), lgammaf(),
remainder() and remainderf() for C99.
- The scanf() family now supports character ranges for the %[
conversion. Note that this is a non-standard feature!
- Integrated Peter Bengtsson's termios code. Thank you very much! I chose
to add it to libunix.a rather than keeping it in a separate libtermios.a
library.
c.lib 1.192 (12.5.2005)
- Changed how errors are detected, as returned by Write(), Read() and
Seek(). Seek() is particularly challenging because the value it
returns might be a valid file position and not an error.
- Replaced numeric function return codes of 0 and -1 with macros OK,
SEEK_ERROR/ERROR to clarify the respective purposes.
- Changed how ftell() and fseek() are used, double-checking the return
value and the errno code.
- The record locking semaphore could wind up getting added to the public
list twice. Fixed.
- Fixed two linker errors which were caused by duplicate symbol definitions.
- Added code to the startup routine which allows you to monitor where a command
was started from and which parameters it was invoked with.
- If fread()/fwrite() fail to read/write any data because either the number
of records or the size of each record is zero, both now call clearerr() to
avoid giving the caller the wrong impression that an EOF or error occured.
- The libunix.a flavour of system() no longer attempts to translate the name
of a command unless it contains path separator characters.
- Added strtof(), llabs(), lldiv(), vsscanf() and vscanf() for C99.
- strftime() now supports %C, %n, %r, %R, %t, %T, %u, %V, and %z for C99.
And it ignores the E and O modifiers.
- The printf() family now supports the %hh, %j, %t and %z modifiers and the
%a/%A conversions for C99. The %j is treated like %ll; %t and %z are treated
like %l. Also, the "infinity"/"not a number" signals now come out as the
strings "inf" and "nan".
- Added HUGE_VALF to <math.h>.
- For the printf() "%a" conversion the exponent now comes out as a binary
number rather than a decimal one. Now how odd is that?
- strtod() and strtof() now support "inf"/"infinity"/"nan"/"nan(..)" and
hexadecimal floating point numbers, for C99.
- Added the fpclassify(), isfinite(), isnormal() and signbit() macros for C99.
- Reimplemented isnan() and isinf() as macros for C99. The corresponding
functions will be dropped from the library. Note that the isinf() macro
does not return -1, 0 or 1 like the old function did, but only 0 or 1
depending upon whether the parameter represents +/- infinity or not.
- Added fabsf() for C99.
- The scanf() family now supports the %hh, %j, %t and %z modifiers and the
%a/%A conversions for C99. The %j is treated like %ll; %t and %z are treated
like %l. Also, the "inf"/"infinity"/"nan"/"nan()" keywords are processed.
- The strftime() %z conversion now prints the time zone difference as a
"decimal" number. That is, if the difference is 5 hours and 30 minutes,
then %z will now print "530" rather than "330".
- mktime() now handles one leap second gracefully.
- Added isblank().
- Added isunordered(), isgreater(), isgreaterequal(), isless(),
islessequal() and islessgreater() to <math.h> for C99.
- The wchar_t type is now an 'unsigned short' integer (16 bits wide).
- Added PTRDIFF_MIN/PTRDIFF_MAX, WCHAR_MIN/WCHAR_MAX and
WINT_MIN/WINT_MAX to <stdint.h> for C99.
- Added imaxdiv() and imaxabs() for C99.
- Added strtoimax() and strtoumax() for C99.
- Added nextafter() and nextafterf() for C99.
- Added copysign() and copysignf() for C99.
- Unless I missed something, clib2 should now be functionally complete
with regard to C99, except for the floating point operations covered.
These are a major challenge all by themselves, and I wonder both
whether they are worth the effort and how one could implement them
correctly.
- fflush() now consistently supports a NULL parameter, causing all
streams to be flushed for which this behaviour is defined.
- The printf() family can now produce output for floating point
numbers with more than about 77 characters, provided sufficient
memory is available. C99 calls for a minimum of 4095 characters,
but we're trying to allocate the space required dynamically.
c.lib 1.191 (9.4.2005)
- The name of the public record locking semaphore has to be preallocated
for OS4 if the AllocSysObject() function is used to create it.
- Moved the signal block mask and the signal function table out of
signal_data.c and into signal_raise.c where they are actually used.
This makes it possible to override the default definition of the
__check_abort_enabled variable in your own programs.
- raise() no longer resets the signal handler before it invokes the one
currently configured. It merely blocks the delivery of the respective
signal to prevent recursion.
- raise() now drops into abort() if a signal handler is set to
SIG_DFL. The exception is in SIGINT delivery, which has the
effect of printing a different termination message but otherwise
program flow takes the same path as abort().
- Moved the __UtilityBase/__IUtility variable declarations into
a separate file.
- Simplified the library/open close code in "stdlib_main.c".
- File descriptors produced by dup() or dup2() now work exactly like
the original file descriptors they are duplicates of. I modified the
function which maps file descriptor numbers to file descriptor
table entries to return the table entries of the original files.
- In the thread-safe library, duplicated stdin/stdout/stderr
descriptors now work like the "real" ones. This is true even if
the "real" ones were closed and only their former aliases remain.
- Invoking fstat() on what maps to a con-handler stream now produces
information identifying it as a character special file.
- Added more code and changes contributed by Peter Bengtsson, thank you
very much! This includes the following:
- Added SSIZE_MAX to <limits.h>.
- Added <sys/uio.h>, readv() and writev().
- Cut back the soft link resolution code in lstat().
- In <fcntl.h> O_NDELAY is now an alias for O_NONBLOCK.
- Added <complex.h>, carg(), cargf(), cargl(), cimag(), cimagf(),
cimagl(), conj(), conjf(), conjl(), creal(), crealf() and creall().
Note that the C99 support for the complex floating point data
types is limited to GCC 3.x for now.
- Added va_copy() to <stdarg.h>.
- Added _Exit() to <stdlib.h>.
- Added <stdbool.h>.
- Added vfscanf() to <stdio.h>.
- The stdio locking in fcntl() wasn't working correctly. Fixed.
- Made the clearerr(), feof() and ferror() macros thread-safe.
c.lib 1.190 (25.3.2005)
- DoTimer() now calls AllocSysObject() rather than making up
a MsgPort locally.
@ -62,6 +433,80 @@
- Introduced new constructor types and changed the overall priority
order.
- Switched over the startup code and the library itself to use
constructor/destructor functions for initialization and cleanup
purposes.
- The destructor function invocation code no longer calls
setjmp(). This is now done within stdlib_main.c prior to
calling the destructor function invocation code.
- Fixed the SAS/C destructor function prototypes and verified
that the constructors/destructors are called in the proper
order, too.
- Aliases of file descriptors are now using the signal semaphore
of the original file descriptor.
- close() did not return 0 if the file descriptor in question
was really just an alias. Fixed.
- Added a feature which makes it possible to have several clients
use the standard I/O streams (stdin/stdout/stderr) and have these
referring to their process' Input()/Output()/ErrorOutput()
streams. This is intended to support the upcoming shared
library feature.
- Turns out that the 68k GCC port does not sort constructor and
destructor functions in any way at all. I reimplemented the
entire library constructor/destructor functionality to use the
same approach as libnix.
- ftruncate() ended up changing the current file position, contrary
to what it is supposed to do. Fixed.
- fcntl() did not work for sockets. Fixed.
- Reorganized the local header files, removing redundancies.
- Dropped unused stub code which is now redundant because of
the constructor/destructor mechanism.
- Moved the call chain printing out of stdlib_main.c and into
separate files.
- Removed some more redundant data from stdlib_main.c.
- Added the first "real" C99 function: _Exit() ;-)
- assertion failures early on during program initialization
should no longer spell big trouble on account of the stdio
data structures possibly not being in a well-defined and
initialized state.
- Turns out that the constructor/destructor calling sequence
was still wrongish for the OS4 library. So I had to change
it *again*. Which probably means that the 68k library will
need further changes...
- Moved stdlib_main.o into the regular libc.a, at least for
the 68k build. The PowerPC build may follow later, provided
I manage to get the specs file fixed. Actually, stdlib_main.o
is in the libc.a library already. Now about that specs file...
- Moved the check for the presence of an FPU into the
math_init.c code. I am far from certain whether this will
have the desired effect, though. Due to how the GNU ld linker
works, libraries are scanned once only. And the FPU check will
be pulled in only if something references the HUGE_VAL
constant.
- Activated the dormant thread-safe standard input/output/error
handling code.
- Small fixes to fcntl() and select() to cover the thread-safe
fd->fd_DefaultFile == ZERO case.
c.lib 1.189 (5.3.2005)
@ -344,7 +789,7 @@ c.lib 1.185 (2.1.2005)
normal versions. Let's see how well this works out in the GCC
version. SAS/C does not seem to like it...
- Changed the definition of alloca() for GCC, which now defaults
- Changed the definition of alloca() for GCC, which now defaults
to the built-in function.
- Updated the stdio.h, stdlib.h, string.h and unistd.h header files
@ -1430,7 +1875,7 @@ c.lib 1.117 (26.5.2004)
- The size of the physical memory allocation chunks is now taken into
account when making memory allocations. This means that allocations
are rounded up to multiples of 8 bytes each.
c.lib 1.116 (26.5.2004)
@ -1519,7 +1964,7 @@ c.lib 1.110 (10.4.2004)
c.lib 1.109 (9.4.2004)
- Fixed a bug in the PPC version of setjmp that would trash floating
- Fixed a bug in the PPC version of setjmp that would trash floating
point registers.
- Fixed a bug in dup2: If the second fd didn't exist, it would return -1,
@ -2117,7 +2562,7 @@ c.lib 1.60 (5.10.2003)
- Renamed the source code files which implement the strtod(), strtol(),
strtoul(), atof(), atoi() and atol() functions.
- Moved main() out of libc.a and made it into a startup object file
- Moved main() out of libc.a and made it into a startup object file
which needs to be added to the GCC specs file in the "*startfile"
section, right at the end of the list. This solves practically all
linking problems I encountered so far. Which means that -lunix
@ -2277,7 +2722,7 @@ c.lib 1.47 (31.7.2003)
- Fixed vfscanf() and strtol() again to accept very small negative
integers (-2147483648). The previous check to avoid overflows
was too strict.
c.lib 1.46 (31.7.2003)

52
library/complex_carg.c Normal file
View File

@ -0,0 +1,52 @@
/*
* $Id: complex_carg.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _COMPLEX_HEADERS_H
#include "complex_headers.h"
#endif /* _COMPLEX_HEADERS_H */
/****************************************************************************/
#if defined(COMPLEX_SUPPORT)
/****************************************************************************/
double
carg(double complex z)
{
return(atan2(IMAG(z),REAL(z)));
}
/****************************************************************************/
#endif /* COMPLEX_SUPPORT */

52
library/complex_cargf.c Normal file
View File

@ -0,0 +1,52 @@
/*
* $Id: complex_cargf.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _COMPLEX_HEADERS_H
#include "complex_headers.h"
#endif /* _COMPLEX_HEADERS_H */
/****************************************************************************/
#if defined(COMPLEX_SUPPORT)
/****************************************************************************/
float
cargf(float complex z)
{
return(atan2(IMAG(z),REAL(z))); /* ZZZ this really needs to call ata2f(). */
}
/****************************************************************************/
#endif /* COMPLEX_SUPPORT */

52
library/complex_cargl.c Normal file
View File

@ -0,0 +1,52 @@
/*
* $Id: complex_cargl.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _COMPLEX_HEADERS_H
#include "complex_headers.h"
#endif /* _COMPLEX_HEADERS_H */
/****************************************************************************/
#if defined(COMPLEX_SUPPORT)
/****************************************************************************/
long double
cargl(long double complex z)
{
return(atan2(IMAG(z),REAL(z))); /* ZZZ this really needs to call atan2l(). */
}
/****************************************************************************/
#endif /* COMPLEX_SUPPORT */

52
library/complex_cimag.c Normal file
View File

@ -0,0 +1,52 @@
/*
* $Id: complex_cimag.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _COMPLEX_HEADERS_H
#include "complex_headers.h"
#endif /* _COMPLEX_HEADERS_H */
/****************************************************************************/
#if defined(COMPLEX_SUPPORT)
/****************************************************************************/
double
cimag(double complex z)
{
return(IMAG(z));
}
/****************************************************************************/
#endif /* COMPLEX_SUPPORT */

52
library/complex_cimagf.c Normal file
View File

@ -0,0 +1,52 @@
/*
* $Id: complex_cimagf.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _COMPLEX_HEADERS_H
#include "complex_headers.h"
#endif /* _COMPLEX_HEADERS_H */
/****************************************************************************/
#if defined(COMPLEX_SUPPORT)
/****************************************************************************/
float
cimagf(float complex z)
{
return(IMAG(z));
}
/****************************************************************************/
#endif /* COMPLEX_SUPPORT */

52
library/complex_cimagl.c Normal file
View File

@ -0,0 +1,52 @@
/*
* $Id: complex_cimagl.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _COMPLEX_HEADERS_H
#include "complex_headers.h"
#endif /* _COMPLEX_HEADERS_H */
/****************************************************************************/
#if defined(COMPLEX_SUPPORT)
/****************************************************************************/
long double
cimagl(long double complex z)
{
return(IMAG(z));
}
/****************************************************************************/
#endif /* COMPLEX_SUPPORT */

52
library/complex_conj.c Normal file
View File

@ -0,0 +1,52 @@
/*
* $Id: complex_conj.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _COMPLEX_HEADERS_H
#include "complex_headers.h"
#endif /* _COMPLEX_HEADERS_H */
/****************************************************************************/
#if defined(COMPLEX_SUPPORT)
/****************************************************************************/
double complex
conj(double complex z)
{
return(CONJ(z));
}
/****************************************************************************/
#endif /* COMPLEX_SUPPORT */

52
library/complex_conjf.c Normal file
View File

@ -0,0 +1,52 @@
/*
* $Id: complex_conjf.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _COMPLEX_HEADERS_H
#include "complex_headers.h"
#endif /* _COMPLEX_HEADERS_H */
/****************************************************************************/
#if defined(COMPLEX_SUPPORT)
/****************************************************************************/
float complex
conjf(float complex z)
{
return(CONJ(z));
}
/****************************************************************************/
#endif /* COMPLEX_SUPPORT */

52
library/complex_conjl.c Normal file
View File

@ -0,0 +1,52 @@
/*
* $Id: complex_conjl.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _COMPLEX_HEADERS_H
#include "complex_headers.h"
#endif /* _COMPLEX_HEADERS_H */
/****************************************************************************/
#if defined(COMPLEX_SUPPORT)
/****************************************************************************/
long double complex
conjl(long double complex z)
{
return(CONJ(z));
}
/****************************************************************************/
#endif /* COMPLEX_SUPPORT */

52
library/complex_creal.c Normal file
View File

@ -0,0 +1,52 @@
/*
* $Id: complex_creal.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _COMPLEX_HEADERS_H
#include "complex_headers.h"
#endif /* _COMPLEX_HEADERS_H */
/****************************************************************************/
#if defined(COMPLEX_SUPPORT)
/****************************************************************************/
double
creal(double complex z)
{
return(REAL(z));
}
/****************************************************************************/
#endif /* COMPLEX_SUPPORT */

52
library/complex_crealf.c Normal file
View File

@ -0,0 +1,52 @@
/*
* $Id: complex_crealf.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _COMPLEX_HEADERS_H
#include "complex_headers.h"
#endif /* _COMPLEX_HEADERS_H */
/****************************************************************************/
#if defined(COMPLEX_SUPPORT)
/****************************************************************************/
float
crealf(float complex z)
{
return(REAL(z));
}
/****************************************************************************/
#endif /* COMPLEX_SUPPORT */

52
library/complex_creall.c Normal file
View File

@ -0,0 +1,52 @@
/*
* $Id: complex_creall.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _COMPLEX_HEADERS_H
#include "complex_headers.h"
#endif /* _COMPLEX_HEADERS_H */
/****************************************************************************/
#if defined(COMPLEX_SUPPORT)
/****************************************************************************/
long double
creall(long double complex z)
{
return(REAL(z));
}
/****************************************************************************/
#endif /* COMPLEX_SUPPORT */

68
library/complex_headers.h Executable file
View File

@ -0,0 +1,68 @@
/*
* $Id: complex_headers.h,v 1.3 2005-05-12 14:50:06 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _COMPLEX_HEADERS_H
#define _COMPLEX_HEADERS_H
/****************************************************************************/
#ifndef _MATH_FP_SUPPORT_H
#include "math_fp_support.h"
#endif /* _MATH_FP_SUPPORT_H */
/****************************************************************************/
#if defined(FLOATING_POINT_SUPPORT) && defined(__GNUC__) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
/****************************************************************************/
#include <complex.h>
#include <math.h>
/****************************************************************************/
#define COMPLEX_SUPPORT
/****************************************************************************/
#define REAL(z) (__real__ (z))
#define IMAG(z) (__imag__ (z))
#define CONJ(z) (~(z))
/****************************************************************************/
#endif /* FLOATING_POINT_SUPPORT && __GNUC__ && __STDC_VERSION__ */
/****************************************************************************/
#endif /* _COMPLEX_HEADERS_H */

View File

@ -1,11 +1,12 @@
//
// $Id: crt0.S,v 1.2 2004-11-28 12:31:27 tfrieden Exp $
// $Id: crt0.S,v 1.5 2005-08-26 12:39:33 obarthel Exp $
//
// :ts=4
//
.text
.globl main | This enforces linkage against the main() function
.globl _main
.globl _start
@ -25,16 +26,3 @@ _start:
#endif
b _main
#if defined(BASEREL_DATA)
.section .rodata
.globl __data_segment_descriptor
__data_segment_descriptor:
.long __data_start
.long __data_end
.long _DATA_BASE_
.section .dend, "wa", @nobits
.space 4
#endif

View File

@ -1,5 +1,5 @@
/*
* $Id: crtbegin.c,v 1.8 2005-03-10 13:30:11 obarthel Exp $
* $Id: crtbegin.c,v 1.10 2005-03-18 12:38:22 obarthel Exp $
*
* :ts=4
*
@ -10,12 +10,9 @@
/****************************************************************************/
#ifndef EXEC_TYPES_H
#include <exec/types.h>
/****************************************************************************/
#include <stdlib.h>
#include <setjmp.h>
#endif /* EXEC_TYPES_H */
/****************************************************************************/
@ -48,16 +45,9 @@ _init(void)
void
_fini(void)
{
extern jmp_buf __exit_jmp_buf;
int num_dtors,i;
static int j;
/* If one of the destructors drops into
exit(), processing will continue with
the next following destructor. */
(void)setjmp(__exit_jmp_buf);
for(i = 1, num_dtors = 0 ; __DTOR_LIST__[i] != NULL ; i++)
num_dtors++;

View File

@ -1,5 +1,5 @@
/*
* $Id: ctype_headers.h,v 1.2 2005-01-02 09:07:07 obarthel Exp $
* $Id: ctype_headers.h,v 1.5 2005-05-29 09:56:09 obarthel Exp $
*
* :ts=4
*
@ -42,18 +42,25 @@
/****************************************************************************/
#ifndef _STDLIB_LOCALE_UTILITY_H
#include "stdlib_locale_utility.h"
#endif /* _STDLIB_LOCALE_UTILITY_H */
#ifndef _STDLIB_LOCALEBASE_H
#include "stdlib_localebase.h"
#endif /* _STDLIB_LOCALEBASE_H */
#ifndef _STDLIB_UTILITYBASE_H
#include "stdlib_utilitybase.h"
#endif /* _STDLIB_UTILITYBASE_H */
/****************************************************************************/
#ifndef _MACROS_H
#include "macros.h"
#endif /* _MACROS_H */
/****************************************************************************/
#include <locale.h>
#include <assert.h>
#include <limits.h>
#include <ctype.h>
/****************************************************************************/

View File

@ -1,5 +1,5 @@
/*
* $Id: ctype_isalnum.c,v 1.3 2005-02-27 21:58:21 obarthel Exp $
* $Id: ctype_isalnum.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $
*
* :ts=4
*
@ -55,7 +55,13 @@ isalnum(int c)
{
assert( LocaleBase != NULL );
result = IsAlNum(__locale_table[LC_CTYPE],(ULONG)c);
/* The parameter must be either EOF or in the range of an
'unsigned char'. If it's not, then the behaviour is
undefined. */
if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX)))
result = IsAlNum(__locale_table[LC_CTYPE],(ULONG)(c & 255));
else
result = FALSE;
}
else
{

View File

@ -1,5 +1,5 @@
/*
* $Id: ctype_isalpha.c,v 1.3 2005-02-27 21:58:21 obarthel Exp $
* $Id: ctype_isalpha.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $
*
* :ts=4
*
@ -53,7 +53,13 @@ isalpha(int c)
{
assert( LocaleBase != NULL );
result = IsAlpha(__locale_table[LC_CTYPE],(ULONG)c);
/* The parameter must be either EOF or in the range of an
'unsigned char'. If it's not, then the behaviour is
undefined. */
if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX)))
result = IsAlpha(__locale_table[LC_CTYPE],(ULONG)(c & 255));
else
result = FALSE;
}
else
{

52
library/ctype_isblank.c Normal file
View File

@ -0,0 +1,52 @@
/*
* $Id: ctype_isblank.c,v 1.2 2005-05-29 08:19:36 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _CTYPE_HEADERS_H
#include "ctype_headers.h"
#endif /* _CTYPE_HEADERS_H */
/****************************************************************************/
#undef isblank
/****************************************************************************/
int
isblank(int c)
{
int result;
result = (c == '\t' || c == ' ');
return(result);
}

View File

@ -1,5 +1,5 @@
/*
* $Id: ctype_iscntrl.c,v 1.3 2005-02-27 21:58:21 obarthel Exp $
* $Id: ctype_iscntrl.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $
*
* :ts=4
*
@ -53,7 +53,13 @@ iscntrl(int c)
{
assert( LocaleBase != NULL );
result = IsCntrl(__locale_table[LC_CTYPE],(ULONG)c);
/* The parameter must be either EOF or in the range of an
'unsigned char'. If it's not, then the behaviour is
undefined. */
if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX)))
result = IsCntrl(__locale_table[LC_CTYPE],(ULONG)(c & 255));
else
result = FALSE;
}
else
{

View File

@ -1,5 +1,5 @@
/*
* $Id: ctype_isdigit.c,v 1.3 2005-02-27 21:58:21 obarthel Exp $
* $Id: ctype_isdigit.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $
*
* :ts=4
*
@ -53,7 +53,13 @@ isdigit(int c)
{
assert( LocaleBase != NULL );
result = IsDigit(__locale_table[LC_CTYPE],(ULONG)c);
/* The parameter must be either EOF or in the range of an
'unsigned char'. If it's not, then the behaviour is
undefined. */
if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX)))
result = IsDigit(__locale_table[LC_CTYPE],(ULONG)(c & 255));
else
result = FALSE;
}
else
{

View File

@ -1,5 +1,5 @@
/*
* $Id: ctype_isgraph.c,v 1.3 2005-02-27 21:58:21 obarthel Exp $
* $Id: ctype_isgraph.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $
*
* :ts=4
*
@ -53,7 +53,13 @@ isgraph(int c)
{
assert( LocaleBase != NULL );
result = IsGraph(__locale_table[LC_CTYPE],(ULONG)c);
/* The parameter must be either EOF or in the range of an
'unsigned char'. If it's not, then the behaviour is
undefined. */
if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX)))
result = IsGraph(__locale_table[LC_CTYPE],(ULONG)(c & 255));
else
result = FALSE;
}
else
{

View File

@ -1,5 +1,5 @@
/*
* $Id: ctype_islower.c,v 1.3 2005-02-27 21:58:21 obarthel Exp $
* $Id: ctype_islower.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $
*
* :ts=4
*
@ -53,7 +53,13 @@ islower(int c)
{
assert( LocaleBase != NULL );
result = IsLower(__locale_table[LC_CTYPE],(ULONG)c);
/* The parameter must be either EOF or in the range of an
'unsigned char'. If it's not, then the behaviour is
undefined. */
if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX)))
result = IsLower(__locale_table[LC_CTYPE],(ULONG)(c & 255));
else
result = FALSE;
}
else
{

View File

@ -1,5 +1,5 @@
/*
* $Id: ctype_isprint.c,v 1.3 2005-02-27 21:58:21 obarthel Exp $
* $Id: ctype_isprint.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $
*
* :ts=4
*
@ -53,7 +53,13 @@ isprint(int c)
{
assert( LocaleBase != NULL );
result = IsPrint(__locale_table[LC_CTYPE],(ULONG)c);
/* The parameter must be either EOF or in the range of an
'unsigned char'. If it's not, then the behaviour is
undefined. */
if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX)))
result = IsPrint(__locale_table[LC_CTYPE],(ULONG)(c & 255));
else
result = FALSE;
}
else
{

View File

@ -1,5 +1,5 @@
/*
* $Id: ctype_ispunct.c,v 1.3 2005-02-27 21:58:21 obarthel Exp $
* $Id: ctype_ispunct.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $
*
* :ts=4
*
@ -53,7 +53,13 @@ ispunct(int c)
{
assert( LocaleBase != NULL );
result = IsPunct(__locale_table[LC_CTYPE],(ULONG)c);
/* The parameter must be either EOF or in the range of an
'unsigned char'. If it's not, then the behaviour is
undefined. */
if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX)))
result = IsPunct(__locale_table[LC_CTYPE],(ULONG)(c & 255));
else
result = FALSE;
}
else
{

View File

@ -1,5 +1,5 @@
/*
* $Id: ctype_isspace.c,v 1.3 2005-02-27 21:58:21 obarthel Exp $
* $Id: ctype_isspace.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $
*
* :ts=4
*
@ -53,7 +53,13 @@ isspace(int c)
{
assert( LocaleBase != NULL );
result = IsSpace(__locale_table[LC_CTYPE],(ULONG)c);
/* The parameter must be either EOF or in the range of an
'unsigned char'. If it's not, then the behaviour is
undefined. */
if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX)))
result = IsSpace(__locale_table[LC_CTYPE],(ULONG)(c & 255));
else
result = FALSE;
}
else
{

View File

@ -1,5 +1,5 @@
/*
* $Id: ctype_isupper.c,v 1.3 2005-02-27 21:58:21 obarthel Exp $
* $Id: ctype_isupper.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $
*
* :ts=4
*
@ -53,7 +53,13 @@ isupper(int c)
{
assert( LocaleBase != NULL );
result = IsUpper(__locale_table[LC_CTYPE],(ULONG)c);
/* The parameter must be either EOF or in the range of an
'unsigned char'. If it's not, then the behaviour is
undefined. */
if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX)))
result = IsUpper(__locale_table[LC_CTYPE],(ULONG)(c & 255));
else
result = FALSE;
}
else
{

View File

@ -1,5 +1,5 @@
/*
* $Id: ctype_isxdigit.c,v 1.3 2005-02-27 21:58:21 obarthel Exp $
* $Id: ctype_isxdigit.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $
*
* :ts=4
*
@ -53,7 +53,13 @@ isxdigit(int c)
{
assert( LocaleBase != NULL );
result = IsXDigit(__locale_table[LC_CTYPE],(ULONG)c);
/* The parameter must be either EOF or in the range of an
'unsigned char'. If it's not, then the behaviour is
undefined. */
if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX)))
result = IsXDigit(__locale_table[LC_CTYPE],(ULONG)(c & 255));
else
result = FALSE;
}
else
{

View File

@ -1,5 +1,5 @@
/*
* $Id: ctype_tolower.c,v 1.3 2005-02-27 21:58:21 obarthel Exp $
* $Id: ctype_tolower.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $
*
* :ts=4
*
@ -49,7 +49,13 @@ tolower(int c)
{
assert( LocaleBase != NULL );
result = ConvToLower(__locale_table[LC_CTYPE],(ULONG)c);
/* The parameter must be either EOF or in the range of an
'unsigned char'. If it's not, then the behaviour is
undefined. */
if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX)))
result = ConvToLower(__locale_table[LC_CTYPE],(ULONG)(c & 255));
else
result = c;
}
else
{

View File

@ -1,5 +1,5 @@
/*
* $Id: ctype_toupper.c,v 1.3 2005-02-27 21:58:21 obarthel Exp $
* $Id: ctype_toupper.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $
*
* :ts=4
*
@ -49,7 +49,13 @@ toupper(int c)
{
assert( LocaleBase != NULL );
result = ConvToUpper(__locale_table[LC_CTYPE],(ULONG)c);
/* The parameter must be either EOF or in the range of an
'unsigned char'. If it's not, then the behaviour is
undefined. */
if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX)))
result = ConvToUpper(__locale_table[LC_CTYPE],(ULONG)(c & 255));
else
result = c;
}
else
{

View File

@ -1,6 +1,6 @@
#define VERSION 1
#define REVISION 189
#define DATE "5.3.2005"
#define VERS "debug.lib 1.189"
#define VSTRING "debug.lib 1.189 (5.3.2005)\r\n"
#define VERSTAG "\0$VER: debug.lib 1.189 (5.3.2005)"
#define REVISION 195
#define DATE "3.9.2005"
#define VERS "debug.lib 1.195"
#define VSTRING "debug.lib 1.195 (3.9.2005)\r\n"
#define VERSTAG "\0$VER: debug.lib 1.195 (3.9.2005)"

View File

@ -1 +1 @@
189
195

View File

@ -1,5 +1,5 @@
/*
* $Id: debug_headers.h,v 1.2 2005-01-02 09:07:07 obarthel Exp $
* $Id: debug_headers.h,v 1.3 2005-03-18 12:38:22 obarthel Exp $
*
* :ts=4
*
@ -36,14 +36,15 @@
/****************************************************************************/
#ifndef EXEC_LIBRARIES_H
#include <exec/libraries.h>
#endif /* EXEC_LIBRARIES_H */
/****************************************************************************/
#if defined(__SASC)
#include <clib/exec_protos.h>
/*#include <pragmas/exec_sysbase_pragmas.h>*/
#include <pragmas/exec_pragmas.h>
LONG RawMayGetChar(VOID);
@ -57,7 +58,11 @@ VOID RawPutChar(UBYTE c);
/****************************************************************************/
#if defined(__amigaos4__)
#ifndef EXEC_EMULATION_H
#include <exec/emulation.h>
#endif /* EXEC_EMULATION_H */
#endif /* __amigaos4__ */
/****************************************************************************/
@ -106,11 +111,13 @@ VOID RawPutChar(UBYTE c);
/****************************************************************************/
#include "debug.h"
/****************************************************************************/
#ifndef _MACROS_H
#include "macros.h"
#endif /* _MACROS_H */
#ifndef _DEBUG_H
#include "debug.h"
#endif /* _DEBUG_H */
/****************************************************************************/

View File

@ -1,5 +1,5 @@
/*
* $Id: dirent_closedir.c,v 1.8 2005-03-09 10:48:59 obarthel Exp $
* $Id: dirent_closedir.c,v 1.14 2005-07-03 10:36:46 obarthel Exp $
*
* :ts=4
*
@ -31,18 +31,24 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _STDLIB_MEM_DEBUG_H
#include "stdlib_mem_debug.h"
#endif /* _STDLIB_MEM_DEBUG_H */
/****************************************************************************/
#ifndef _DIRENT_HEADERS_H
#include "dirent_headers.h"
#endif /* _DIRENT_HEADERS_H */
/****************************************************************************/
#ifndef _STDLIB_MEMORY_H
#include "stdlib_memory.h"
#endif /* _STDLIB_MEMORY_H */
/****************************************************************************/
#ifndef _STDLIB_CONSTRUCTOR_H
#include "stdlib_constructor.h"
#endif /* _STDLIB_CONSTRUCTOR_H */
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
@ -82,7 +88,7 @@ __dirent_unlock(void)
/****************************************************************************/
CLIB_CONSTRUCTOR(__dirent_init)
CLIB_CONSTRUCTOR(dirent_init)
{
BOOL success = FALSE;
@ -102,7 +108,8 @@ CLIB_CONSTRUCTOR(__dirent_init)
out:
RETURN(success);
SHOWVALUE(success);
LEAVE();
if(success)
CONSTRUCTOR_SUCCEED();
@ -112,7 +119,7 @@ CLIB_CONSTRUCTOR(__dirent_init)
/****************************************************************************/
CLIB_DESTRUCTOR(__dirent_exit)
CLIB_DESTRUCTOR(dirent_exit)
{
ENTER();
@ -138,7 +145,7 @@ int
closedir(DIR * directory_pointer)
{
struct DirectoryHandle * dh;
int result = -1;
int result = ERROR;
ENTER();
@ -197,7 +204,7 @@ closedir(DIR * directory_pointer)
free(dh);
result = 0;
result = OK;
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: dirent_headers.h,v 1.7 2005-02-28 10:07:30 obarthel Exp $
* $Id: dirent_headers.h,v 1.8 2005-03-18 12:38:22 obarthel Exp $
*
* :ts=4
*
@ -48,6 +48,12 @@
/****************************************************************************/
#ifndef _STDLIB_PROFILE_H
#include "stdlib_profile.h"
#endif /* _STDLIB_PROFILE_H */
/****************************************************************************/
#ifndef _MACROS_H
#include "macros.h"
#endif /* _MACROS_H */

View File

@ -1,5 +1,5 @@
/*
* $Id: dirent_opendir.c,v 1.8 2005-02-27 21:58:21 obarthel Exp $
* $Id: dirent_opendir.c,v 1.10 2005-08-26 12:39:33 obarthel Exp $
*
* :ts=4
*
@ -37,18 +37,18 @@
/****************************************************************************/
#ifndef _STDLIB_MEM_DEBUG_H
#include "stdlib_mem_debug.h"
#endif /* _STDLIB_MEM_DEBUG_H */
/****************************************************************************/
#ifndef _DIRENT_HEADERS_H
#include "dirent_headers.h"
#endif /* _DIRENT_HEADERS_H */
/****************************************************************************/
#ifndef _STDLIB_MEMORY_H
#include "stdlib_memory.h"
#endif /* _STDLIB_MEMORY_H */
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
@ -128,6 +128,14 @@ opendir(const char * path_name)
if(__unix_path_semantics)
{
if(path_name[0] == '\0')
{
SHOWMSG("no name given");
__set_errno(ENOENT);
goto out;
}
if(__translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0)
goto out;

View File

@ -1,5 +1,5 @@
/*
* $Id: fcntl_close.c,v 1.10 2005-02-20 15:46:52 obarthel Exp $
* $Id: fcntl_close.c,v 1.12 2005-04-24 08:46:37 obarthel Exp $
*
* :ts=4
*
@ -46,7 +46,7 @@ close(int file_descriptor)
{
struct file_action_message fam;
struct fd * fd;
int result = -1;
int result = ERROR;
ENTER();
@ -59,7 +59,9 @@ close(int file_descriptor)
if(__check_abort_enabled)
__check_abort();
fd = __get_file_descriptor(file_descriptor);
/* We want to affect this very file descriptor and not the
original one associated with an alias of it. */
fd = __get_file_descriptor_dont_resolve(file_descriptor);
if(fd == NULL)
{
__set_errno(EBADF);
@ -76,7 +78,7 @@ close(int file_descriptor)
goto out;
}
result = 0;
result = OK;
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: fcntl_creat.c,v 1.4 2005-02-03 16:56:15 obarthel Exp $
* $Id: fcntl_creat.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $
*
* :ts=4
*
@ -50,7 +50,7 @@
int
creat(const char * path_name, mode_t mode)
{
int result = -1;
int result = ERROR;
ENTER();

View File

@ -1,5 +1,5 @@
/*
* $Id: fcntl_fcntl.c,v 1.12 2005-03-04 09:07:09 obarthel Exp $
* $Id: fcntl_fcntl.c,v 1.18 2005-05-27 13:19:30 obarthel Exp $
*
* :ts=4
*
@ -47,7 +47,7 @@ fcntl(int file_descriptor, int cmd, ... /* int arg */ )
struct file_action_message fam;
struct flock * l;
int vacant_slot;
int result = -1;
int result = ERROR;
struct fd * fd = NULL;
va_list arg;
int error;
@ -67,6 +67,12 @@ fcntl(int file_descriptor, int cmd, ... /* int arg */ )
if(__check_abort_enabled)
__check_abort();
/* F_DUPFD will need to modify the file descriptor table, which is why
the stdio lock needs to be obtained here, before the individual
file descriptor lock is held. */
if(cmd == F_DUPFD)
__stdio_lock();
fd = __get_file_descriptor(file_descriptor);
if(fd == NULL)
{
@ -78,6 +84,7 @@ fcntl(int file_descriptor, int cmd, ... /* int arg */ )
switch(cmd)
{
#if defined(UNIX_PATH_SEMANTICS)
case F_GETLK:
case F_SETLK:
case F_SETLKW:
@ -90,6 +97,12 @@ fcntl(int file_descriptor, int cmd, ... /* int arg */ )
goto out;
}
if(fd->fd_DefaultFile == ZERO)
{
__set_errno(EBADF);
goto out;
}
va_start(arg,cmd);
l = va_arg(arg,struct flock *);
va_end(arg);
@ -118,27 +131,22 @@ fcntl(int file_descriptor, int cmd, ... /* int arg */ )
goto out;
}
result = 0;
result = OK;
break;
#endif /* UNIX_PATH_SEMANTICS */
case F_GETFL:
SHOWMSG("cmd=F_GETFL");
if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET))
{
__set_errno(EINVAL);
goto out;
}
if(FLAG_IS_SET(fd->fd_Flags,FDF_NON_BLOCKING))
SET_FLAG(result,O_NONBLOCK);
if(FLAG_IS_SET(fd->fd_Flags,FDF_ASYNC_IO))
SET_FLAG(result,O_ASYNC);
result = 0;
result = OK;
break;
@ -146,9 +154,10 @@ fcntl(int file_descriptor, int cmd, ... /* int arg */ )
SHOWMSG("cmd=F_SETFL");
if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET))
/* If this is a file, make sure that we don't hit a zero file handle. */
if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_IS_SOCKET) && fd->fd_DefaultFile == ZERO)
{
__set_errno(EINVAL);
__set_errno(EBADF);
goto out;
}
@ -198,7 +207,7 @@ fcntl(int file_descriptor, int cmd, ... /* int arg */ )
CLEAR_FLAG(fd->fd_Flags,FDF_ASYNC_IO);
}
result = 0;
result = OK;
break;
@ -267,6 +276,9 @@ fcntl(int file_descriptor, int cmd, ... /* int arg */ )
__fd_unlock(fd);
if(cmd == F_DUPFD)
__stdio_unlock();
RETURN(result);
return(result);
}

View File

@ -1,5 +1,5 @@
/*
* $Id: fcntl_get_default_file.c,v 1.3 2005-02-03 16:56:15 obarthel Exp $
* $Id: fcntl_get_default_file.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $
*
* :ts=4
*
@ -45,7 +45,7 @@ int
__get_default_file(int file_descriptor,long * file_ptr)
{
struct fd * fd;
int result = -1;
int result = ERROR;
assert( file_descriptor >= 0 && file_descriptor < __num_fd );
assert( __fd[file_descriptor] != NULL );

View File

@ -1,5 +1,5 @@
/*
* $Id: fcntl_headers.h,v 1.3 2005-02-03 16:56:15 obarthel Exp $
* $Id: fcntl_headers.h,v 1.4 2005-03-18 12:38:22 obarthel Exp $
*
* :ts=4
*
@ -48,4 +48,10 @@
/****************************************************************************/
#ifndef _STDLIB_PROFILE_H
#include "stdlib_profile.h"
#endif /* _STDLIB_PROFILE_H */
/****************************************************************************/
#endif /* _FCNTL_HEADERS_H */

View File

@ -1,5 +1,5 @@
/*
* $Id: fcntl_lock.c,v 1.1 2005-02-28 13:22:53 obarthel Exp $
* $Id: fcntl_lock.c,v 1.3 2005-04-01 18:46:37 obarthel Exp $
*
* :ts=4
*

View File

@ -1,5 +1,5 @@
/*
* $Id: fcntl_lseek.c,v 1.7 2005-02-20 15:46:52 obarthel Exp $
* $Id: fcntl_lseek.c,v 1.10 2005-07-06 18:48:53 obarthel Exp $
*
* :ts=4
*
@ -45,9 +45,9 @@ off_t
lseek(int file_descriptor, off_t offset, int mode)
{
struct file_action_message fam;
off_t result = -1;
off_t result = SEEK_ERROR;
struct fd * fd = NULL;
off_t position;
struct fd * fd;
ENTER();
@ -62,6 +62,8 @@ lseek(int file_descriptor, off_t offset, int mode)
if(__check_abort_enabled)
__check_abort();
__stdio_lock();
fd = __get_file_descriptor(file_descriptor);
if(fd == NULL)
{
@ -69,6 +71,8 @@ lseek(int file_descriptor, off_t offset, int mode)
goto out;
}
__fd_lock(fd);
if(mode < SEEK_SET || mode > SEEK_END)
{
SHOWMSG("seek mode is invalid");
@ -83,17 +87,31 @@ lseek(int file_descriptor, off_t offset, int mode)
assert( fd->fd_Action != NULL );
/* Note that a return value of -1 (= SEEK_ERROR) may be a
valid file position in files larger than 2 GBytes. Just
to be sure, we therefore also check the secondary error
to verify that what could be a file position is really
an error indication. */
position = (*fd->fd_Action)(fd,&fam);
if(position < 0)
if(position == SEEK_ERROR && fam.fam_Error != OK)
{
__set_errno(fam.fam_Error);
goto out;
}
/* If this is a valid file position, clear 'errno' so that
it cannot be mistaken for an error. */
if(position < 0)
__set_errno(OK);
result = position;
out:
__fd_unlock(fd);
__stdio_unlock();
RETURN(result);
return(result);
}

View File

@ -1,5 +1,5 @@
/*
* $Id: fcntl_open.c,v 1.14 2005-03-04 09:07:09 obarthel Exp $
* $Id: fcntl_open.c,v 1.17 2005-08-26 12:39:33 obarthel Exp $
*
* :ts=4
*
@ -37,18 +37,18 @@
/****************************************************************************/
#ifndef _STDLIB_MEM_DEBUG_H
#include "stdlib_mem_debug.h"
#endif /* _STDLIB_MEM_DEBUG_H */
/****************************************************************************/
#ifndef _FCNTL_HEADERS_H
#include "fcntl_headers.h"
#endif /* _FCNTL_HEADERS_H */
/****************************************************************************/
#ifndef _STDLIB_MEMORY_H
#include "stdlib_memory.h"
#endif /* _STDLIB_MEMORY_H */
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
@ -104,7 +104,7 @@ open(const char *path_name, int open_flag, ... /* mode_t mode */ )
int fd_slot_number;
struct fd * fd;
int access_mode;
int result = -1;
int result = ERROR;
int i;
ENTER();
@ -158,6 +158,14 @@ open(const char *path_name, int open_flag, ... /* mode_t mode */ )
{
if(__unix_path_semantics)
{
if(path_name[0] == '\0')
{
SHOWMSG("no name given");
__set_errno(ENOENT);
goto out;
}
if(__translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0)
goto out;
@ -456,7 +464,7 @@ open(const char *path_name, int open_flag, ... /* mode_t mode */ )
handle = ZERO;
assert( result != -1 );
assert( result != ERROR );
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: fcntl_read.c,v 1.7 2005-02-28 10:07:30 obarthel Exp $
* $Id: fcntl_read.c,v 1.9 2005-07-06 18:48:53 obarthel Exp $
*
* :ts=4
*
@ -51,8 +51,8 @@ ssize_t
read(int file_descriptor, void * buffer, size_t num_bytes)
{
ssize_t num_bytes_read;
ssize_t result = -1;
struct fd * fd;
struct fd * fd = NULL;
ssize_t result = EOF;
ENTER();
@ -66,6 +66,8 @@ read(int file_descriptor, void * buffer, size_t num_bytes)
if(__check_abort_enabled)
__check_abort();
__stdio_lock();
#if defined(CHECK_FOR_NULL_POINTERS)
{
if(buffer == NULL)
@ -89,6 +91,8 @@ read(int file_descriptor, void * buffer, size_t num_bytes)
goto out;
}
__fd_lock(fd);
if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_READ))
{
SHOWMSG("this descriptor is not read-enabled");
@ -110,7 +114,7 @@ read(int file_descriptor, void * buffer, size_t num_bytes)
assert( fd->fd_Action != NULL );
num_bytes_read = (*fd->fd_Action)(fd,&fam);
if(num_bytes_read < 0)
if(num_bytes_read == EOF)
{
__set_errno(fam.fam_Error);
goto out;
@ -125,6 +129,10 @@ read(int file_descriptor, void * buffer, size_t num_bytes)
out:
__fd_unlock(fd);
__stdio_unlock();
RETURN(result);
return(result);
}

View File

@ -1,5 +1,5 @@
/*
* $Id: fcntl_write.c,v 1.7 2005-02-28 10:07:30 obarthel Exp $
* $Id: fcntl_write.c,v 1.9 2005-07-06 18:48:53 obarthel Exp $
*
* :ts=4
*
@ -51,8 +51,8 @@ ssize_t
write(int file_descriptor, const void * buffer, size_t num_bytes)
{
ssize_t num_bytes_written;
ssize_t result = -1;
struct fd * fd;
struct fd * fd = NULL;
ssize_t result = EOF;
ENTER();
@ -66,6 +66,8 @@ write(int file_descriptor, const void * buffer, size_t num_bytes)
if(__check_abort_enabled)
__check_abort();
__stdio_lock();
#if defined(CHECK_FOR_NULL_POINTERS)
{
if(buffer == NULL)
@ -89,6 +91,8 @@ write(int file_descriptor, const void * buffer, size_t num_bytes)
goto out;
}
__fd_lock(fd);
if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_WRITE))
{
SHOWMSG("file descriptor is not write-enabled");
@ -110,7 +114,7 @@ write(int file_descriptor, const void * buffer, size_t num_bytes)
assert( fd->fd_Action != NULL );
num_bytes_written = (*fd->fd_Action)(fd,&fam);
if(num_bytes_written < 0)
if(num_bytes_written == EOF)
{
__set_errno(fam.fam_Error);
goto out;
@ -125,6 +129,10 @@ write(int file_descriptor, const void * buffer, size_t num_bytes)
out:
__fd_unlock(fd);
__stdio_unlock();
RETURN(result);
return(result);
}

View File

@ -1,5 +1,5 @@
/*
* $Id: ftw_ftw.c,v 1.2 2005-03-03 10:59:17 obarthel Exp $
* $Id: ftw_ftw.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $
*
* :ts=4
*
@ -45,34 +45,16 @@
/****************************************************************************/
#include <dirent.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <ftw.h>
#include <errno.h>
#include <dos.h>
/****************************************************************************/
#ifndef _DEBUG_H
#include "debug.h"
#endif /* _DEBUG_H */
#ifndef _FTW_HEADERS_H
#include "ftw_headers.h"
#endif /* _FTW_HEADERS_H */
#ifndef _STDLIB_PROTOS_H
#include "stdlib_protos.h" /* get/set errno. */
#endif /* _STDLIB_PROTOS_H */
/****************************************************************************/
static int
walk(const char *path,int (*func)(const char *,const struct stat *,int),int depth,int level)
{
int result = 0;
int result = OK;
DIR *dp;
struct dirent *de;
struct stat st;
@ -127,7 +109,7 @@ walk(const char *path,int (*func)(const char *,const struct stat *,int),int dept
dp = opendir(path); /* Also takes care of Unix->Amiga pathname conversion. */
if(dp == NULL)
{
result = -1; /* Pass errno from opendir() */
result = ERROR; /* Pass errno from opendir() */
goto out;
}
@ -138,7 +120,7 @@ walk(const char *path,int (*func)(const char *,const struct stat *,int),int dept
{
__set_errno(ENOMEM);
result = -1;
result = ERROR;
goto out;
}
@ -171,7 +153,7 @@ walk(const char *path,int (*func)(const char *,const struct stat *,int),int dept
int
ftw(const char *path,int (*func)(const char *,const struct stat *,int),int depth)
{
int result = -1;
int result = ERROR;
char *base;
int len;

View File

@ -1,5 +1,5 @@
/*
* $Id: ftw_headers.h,v 1.1 2005-03-02 12:57:53 obarthel Exp $
* $Id: ftw_headers.h,v 1.2 2005-03-18 12:38:22 obarthel Exp $
*
* :ts=4
*
@ -36,11 +36,30 @@
/****************************************************************************/
#include <sys/stat.h>
#ifndef _STDLIB_HEADERS_H
#include "stdlib_headers.h"
#endif /* _STDLIB_HEADERS_H */
/****************************************************************************/
#include <unistd.h>
#include <dirent.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <ftw.h>
#include <errno.h>
#include <dos.h>
/****************************************************************************/
#ifndef _MACROS_H
#include "macros.h"
#endif /* _MACROS_H */
#ifndef _DEBUG_H
#include "debug.h"
#endif /* _DEBUG_H */
/****************************************************************************/

View File

@ -1,5 +1,5 @@
/*
* $Id: ftw_nftw.c,v 1.2 2005-03-03 10:59:17 obarthel Exp $
* $Id: ftw_nftw.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $
*
* :ts=4
*
@ -44,35 +44,16 @@
/****************************************************************************/
#include <dirent.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <ftw.h>
#include <errno.h>
#include <dos.h>
/****************************************************************************/
#ifndef _DEBUG_H
#include "debug.h"
#endif /* _DEBUG_H */
#ifndef _FTW_HEADERS_H
#include "ftw_headers.h"
#endif /* _FTW_HEADERS_H */
#ifndef _STDLIB_PROTOS_H
#include "stdlib_protos.h" /* get/set errno. */
#endif /* _STDLIB_PROTOS_H */
/****************************************************************************/
static int
walk(const char *path,int (*func)(const char *,const struct stat *,int,struct FTW *),const int depth,int level,const int flags,const int base,int * const prune)
{
int result = 0;
int result = OK;
DIR *dp;
struct dirent *de;
struct stat st;
@ -150,7 +131,7 @@ walk(const char *path,int (*func)(const char *,const struct stat *,int,struct FT
dp = opendir(path); /* Also takes care of Unix->Amiga pathname conversion. */
if(dp == NULL)
{
result = -1;
result = ERROR;
goto out;
}
@ -161,7 +142,7 @@ walk(const char *path,int (*func)(const char *,const struct stat *,int,struct FT
{
__set_errno(ENOMEM);
result = -1;
result = ERROR;
goto out;
}
@ -174,7 +155,7 @@ walk(const char *path,int (*func)(const char *,const struct stat *,int,struct FT
{
__set_errno(ENOMEM);
result = -1;
result = ERROR;
goto out;
}
@ -235,7 +216,7 @@ walk(const char *path,int (*func)(const char *,const struct stat *,int,struct FT
static int
index_of_end_part(const char *path)
{
int result = 0;
int result = OK;
int i;
i = strlen(path) - 1;
@ -260,7 +241,7 @@ nftw(const char *path,int (*func)(const char *,const struct stat *,int,struct FT
int len;
int base_index;
int prune = 0;
int result = -1;
int result = ERROR;
ENTER();

View File

@ -0,0 +1,408 @@
/*
* $Id: getopt_getopt_long.c,v 1.3 2005-06-26 12:01:50 tfrieden Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _STDLIB_NULL_POINTER_CHECK_H
#include "stdlib_null_pointer_check.h"
#endif /* _STDLIB_NULL_POINTER_CHECK_H */
/****************************************************************************/
#ifndef _UNISTD_HEADERS_H
#include "unistd_headers.h"
#endif /* _UNISTD_HEADERS_H */
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
#include <getopt.h>
extern int opterr;
extern int optind;
extern int optopt;
extern char * optarg;
int optreset = 0;
#define GETOPTF_LONG_ONLY (1L << 0) /* Operate in getopt_long_only more */
#define GETOPTF_GNUEXT (1L << 1) /* Allow -W extension */
#define GETOPTF_POSIX (1L << 2) /* Will disallow permutation */
#define GETOPTF_ONE_ARG (1L << 3) /* Non-option argv will be handled as -\1 */
static int getopt_long_internal(int argc, const char **argv, const char *optstring,
const struct option *longopts, int *longindex, int flags);
int getopt_long(int argc, const char **argv, const char *optstring,
const struct option *longopts, int *longindex)
{
return getopt_long_internal(argc, argv, optstring, longopts, longindex, 0);
}
#if 0
int getopt_long_only(int argc, const char **argv, const char *optstring,
const struct option *longopts, int *longindex)
{
return getopt_long_internal(argc, argv, optstring, longopts, longindex,
GETOPTF_LONG_ONLY);
}
#endif
static int parse_long_option(int argc, char **argv, const struct option *longopts,
int *longindex, int flags)
{
char *current = argv[optind] + 2; /* Skip the '--' */
char *argument;
int keylen = 0;
int i;
int idx = -1;
int result = '?';
(void)flags;
optind ++;
/* If there's an equals sign in the option, the actual word to check is
* between the -- and = characters. Otherwise, it's the length of the
* remainder (without --)
*/
argument = strchr(current, '=');
if (argument)
{
keylen = (int)(argument - current);
/* Skip the '=' sign */
argument++;
}
else
keylen = strlen(current);
for (i = 0; longopts[i].name; i++)
{
if (strncmp(longopts[i].name, current, keylen))
continue;
if (strlen(longopts[i].name) == (size_t)keylen)
{
/* Exact match */
idx = i;
break;
}
/* Partial match. Check if we already found another partial match, in
* which case the match is ambigous.
*/
if (idx == -1)
{
idx = i;
}
else
{
*longindex = -1;
return '?';
}
}
*longindex = idx;
if (idx != -1)
{
/* Found a match. Check if it needs an argument */
if (longopts[idx].has_arg == optional_argument)
{
/* Optional arguments must be given as --foo=bar, it will not
* advance to the next argv element
*/
if (argument)
optarg = argument;
else
optarg = 0;
}
else if (longopts[idx].has_arg == required_argument)
{
/* Either argument was given as --foo=bar, or the next argv element
* (if present) will be returned
*/
if (argument)
optarg = argument;
else
{
if (optind < argc)
{
optarg = argv[optind];
optind++;
}
else
{
if (opterr)
fprintf(stderr, "%s: option requires an argument -- %s\n",
argv[0], longopts[idx].name);
optarg = 0;
return '?';
}
}
}
else
{
/* No argument */
optarg = 0;
if (argument)
{
if (opterr)
fprintf(stderr, "%s: option does not take an argument -- %s\n",
argv[0], longopts[idx].name);
return '?';
}
}
if (longopts[idx].flag)
{
*longopts[idx].flag = longopts[idx].val;
optopt = 0;
result = 0;
}
else
{
result = optopt = longopts[idx].val;
}
return result;
}
optopt = 0;
return '?';
}
/* Note: This implementation currently does not permute argv vectors, and will
* stop parsing input on the first non-option argument
*/
static int getopt_long_internal(int argc, const char **argv, const char *optstring,
const struct option *longopts, int *longindex, int flags)
{
static char *nextchar = 0;
int result = EOF;
int c;
char *optp;
int longidx_subst;
ENTER();
SHOWVALUE(argc);
SHOWPOINTER(argv);
SHOWSTRING(optstring);
SHOWPOINTER(longopts);
SHOWPOINTER(longindex);
SHOWVALUE(flags);
if(__check_abort_enabled)
__check_abort();
if (NULL == optstring)
goto out;
if (!longindex)
longindex = &longidx_subst;
/* Check options */
/* FIXME: Should probably also check environment variable */
if (*optstring == '+')
{
flags |= GETOPTF_POSIX;
optstring++;
}
if (*optstring == '-')
{
flags |= GETOPTF_ONE_ARG;
optstring++;
}
/* Check for reset */
if (optreset || optind == 0)
{
optind = 1;
optreset = 0;
nextchar = 0;
}
if (optind >= argc)
goto out;
/* Begin or continue scanning
* First off, check for a short option and set nextchar, if present.
* if nextchar is not 0, there's a compound option waiting or just begun.
*/
if (!nextchar
&& argv[optind][0] == '-'
&& argv[optind][1] != '\0'
&& argv[optind][1] != '-')
{
/* It's a short option. */
nextchar = (char *)&argv[optind][1];
}
if (nextchar)
{
c = *nextchar ++;
/* Advancing nextchar. If it points to a 0 character now, it's reached
* the end of the current argv string, so set it to 0 and advance optind
* to the next argv element.
*/
if (0 == *nextchar)
{
nextchar = 0;
optind ++;
}
optp = strchr(optstring, c);
/* We never find a long option in a compound option */
*longindex = 0;
/* Check if it's legal */
if (c == ':' || (optp == NULL))
{
/* Illegal option */
if (opterr)
fprintf(stderr, "%s: illegal option -- %c\n", argv[0], c);
result = '?';
goto out;
}
else
{
/* It is legal. Three possibilities here:
* 1. It doesn't have arguments. Return the character.
* 2. It has an argument. Return the character, and point optarg
* to the rest of the argv entry.
* 3. It has an optional argument. If there are non-0 characters
* following, point optarg there, otherwise, clear optarg.
*/
if (optp[1] != ':')
{
/* Case 1 (no argument). */
result = c;
goto out;
}
else
{
/* Argument may follow */
if (optp[2] == ':')
{
/* Optional argument. nextchar is 0 if there's no further
* stuff following, which means the option is without
* argument
*/
if (nextchar)
{
optarg = nextchar;
nextchar = 0;
optind++;
}
else
optarg = 0;
}
else
{
/* Mandatory argument. Either nextchar points to the rest
* of this argv element, or we use the next argv element
*/
if (nextchar)
{
optarg = nextchar;
nextchar = 0;
optind++;
}
else
{
if (optind >= argc)
{
if (opterr)
fprintf(stderr, "%s: option requires an argument -- %c\n",
argv[0], c);
result = '?';
goto out;
}
optarg = (char *)argv[optind++];
}
}
result = c;
goto out;
}
}
} /* if (nextchar) */
/* Start checking an argv element for an option.
* There are different possibilities here:
* 1. We ran out of argv elements
* 2. We have an argv element that's just "-" or not an option
* 3. We have an argv element that's just "--"
* 4. we habe a long option (--xxx pr -W xxx)
*/
/* Check case 3 and 1*/
if ((strcmp(argv[optind], "--") == 0) || optind >= argc)
{
result = EOF;
goto out;
}
/* Check case 4 */
if (argv[optind][0] == '-' && argv[optind][1] == '-' && longopts)
{
/* It is a long option */
result = parse_long_option(argc, (char **)argv, longopts, longindex, flags);
goto out;
}
/* Case 2 */
out:
RETURN(result);
return result;
}

185
library/include/complex.h Normal file
View File

@ -0,0 +1,185 @@
/*
* $Id: complex.h,v 1.3 2005-05-12 13:21:47 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _COMPLEX_H
#define _COMPLEX_H
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard, but it should
be part of ISO/IEC 9899:1999, also known as "C99". */
/****************************************************************************/
#ifndef __GNUC__
#error Unsupported compiler.
#endif /* __GNUC__ */
/****************************************************************************/
#if defined(__cplusplus)
#warning C99 header file used in C++.
#endif /* __cplusplus */
/****************************************************************************/
#if !defined(__STDC_VERSION__) || (__GNUC__ < 3 && __STDC_VERSION__ < 199901L)
#error Complex numbers are not supported by/for this compiler.
#endif /* __GNUC__ && __STDC_VERSION__ */
/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
/* Basic types; imaginary is assumed not to be implemented yet. */
#define complex _Complex
/****************************************************************************/
/* Constants */
#define _Complex_I (__extension__ 0.0+1.0fi)
#define I _Complex_I
/****************************************************************************/
extern double creal(double complex z);
extern float crealf(float complex z);
extern long double creall(long double complex z);
extern double cimag(double complex z);
extern float cimagf(float complex z);
extern long double cimagl(long double complex z);
extern double complex conj(double complex z);
extern float complex conjf(float complex z);
extern long double complex conjl(long double complex z);
extern double carg(double complex z);
extern float cargf(float complex z);
extern long double cargl(long double complex z);
/****************************************************************************/
/* Unimplemented functions (so far)... */
/****************************************************************************/
#if 0
extern double complex cacos(double complex z);
extern float complex cacosf(float complex z);
extern long double complex cacosl(long double complex z);
extern double complex casin(double complex z);
extern float complex casinf(float complex z);
extern long double complex casinl(long double complex z);
extern double complex catan(double complex z);
extern float complex catanf(float complex z);
extern long double complex catanl(long double complex z);
extern double complex ccos(double complex z);
extern float complex ccosf(float complex z);
extern long double complex ccosl(long double complex z);
extern double complex csin(double complex z);
extern float complex csinf(float complex z);
extern long double complex csinl(long double complex z);
extern double complex ctan(double complex z);
extern float complex ctanf(float complex z);
extern long double complex ctanl(long double complex z);
extern double complex cacosh(double complex z);
extern float complex cacoshf(float complex z);
extern long double complex cacoshl(long double complex z);
extern double complex casinh(double complex z);
extern float complex casinhf(float complex z);
extern long double complex casinhl(long double complex z);
extern double complex catanh(double complex z);
extern float complex catanhf(float complex z);
extern long double complex catanhl(long double complex z);
extern double complex ccosh(double complex z);
extern float complex ccoshf(float complex z);
extern long double complex ccoshl(long double complex z);
extern double complex csinh(double complex z);
extern float complex csinhf(float complex z);
extern long double complex csinhl(long double complex z);
extern double complex ctanh(double complex z);
extern float complex ctanhf(float complex z);
extern long double complex ctanhl(long double complex z);
extern double complex cexp(double complex z);
extern float complex cexpf(float complex z);
extern long double complex cexpl(long double complex z);
extern double complex clog(double complex z);
extern float complex clogf(float complex z);
extern long double complex clogl(long double complex z);
extern double cabs(double complex z);
extern float cabsf(float complex z);
extern long double cabsl(long double complex z);
extern double complex cpow(double complex z);
extern float complex cpowf(float complex z);
extern long double complex cpowl(long double complex z);
extern double complex csqrt(double complex z);
extern float complex csqrtf(float complex z);
extern long double complex csqrtl(long double complex z);
extern double complex cproj(double complex z);
extern float complex cprojf(float complex z);
extern long double complex cprojl(long double complex z);
#endif
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/****************************************************************************/
#endif /* _COMPLEX_H */

View File

@ -1,5 +1,5 @@
/*
* $Id: ctype.h,v 1.5 2005-01-09 15:20:33 obarthel Exp $
* $Id: ctype.h,v 1.6 2005-05-11 20:15:28 obarthel Exp $
*
* :ts=4
*
@ -57,6 +57,7 @@ extern int islower(int c);
extern int isupper(int c);
extern int isspace(int c);
extern int isblank(int c);
extern int tolower(int c);
extern int toupper(int c);
@ -99,6 +100,7 @@ extern const unsigned char __ctype_table[];
#define islower(c) ((__ctype_table[(c) & 255] & __CTYPE_LOWER_CASE) != 0)
#define isupper(c) ((__ctype_table[(c) & 255] & __CTYPE_UPPER_CASE) != 0)
#define isspace(c) ((__ctype_table[(c) & 255] & __CTYPE_WHITE_SPACE) != 0)
#define isblank(c) ((c) == ' ' || (c) == '\t')
/****************************************************************************/

View File

@ -1,5 +1,5 @@
/*
* $Id: dos.h,v 1.9 2005-03-06 09:04:44 obarthel Exp $
* $Id: dos.h,v 1.10 2005-07-03 10:36:48 obarthel Exp $
*
* :ts=4
*
@ -52,6 +52,10 @@ extern "C" {
/****************************************************************************/
#ifndef EXEC_LIBRARIES_H
#include <exec/libraries.h>
#endif /* EXEC_LIBRARIES_H */
#ifndef WORKBENCH_STARTUP_H
#include <workbench/startup.h>
#endif /* WORKBENCH_STARTUP_H */
@ -328,6 +332,38 @@ extern int __translate_io_error_to_errno(LONG io_error);
/****************************************************************************/
/*
* Routines for use with shared libraries: invoke __lib_init() in your own
* shared library initialization function and __lib_exit() in your shared
* library cleanup function.
*
* __lib_init() will initialize the global SysBase/DOSBase variables
* (and the IExec/IDOS variables for OS4) and invoke the constructor
* functions required by your library code. It returns FALSE upon
* failure and TRUE otherwise. Make this the very first function you
* call in your shared library initialization function. The __lib_init()
* function expects to be called with a pointer to the exec.library
* base, which is normally passed to your shared library as part of the
* library startup code initialization performed by the operating
* system.
*
* __lib_exit() will undo all the initializations performed by the
* __lib_init() function, but leave the global SysBase variable
* (and the IExec variable for OS4) intact. Make this the very last
* function you call in your shared library cleanup function.
*
* Note that neither __lib_init() nor __lib_exit() are reentrant. You must
* make sure that while you are calling them no other library user can
* call them by accident.
*
* Both functions are only available as part of the thread-safe clib2
* linker library.
*/
extern VOID __lib_exit(VOID);
extern BOOL __lib_init(struct Library * SysBase);
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -1,5 +1,5 @@
/*
* $Id: fcntl.h,v 1.4 2005-01-02 09:07:21 obarthel Exp $
* $Id: fcntl.h,v 1.5 2005-04-03 10:22:48 obarthel Exp $
*
* :ts=4
*
@ -65,6 +65,7 @@ extern "C" {
#define O_EXCL (1<<4)
#define O_TRUNC (1<<5)
#define O_NONBLOCK (1<<6)
#define O_NDELAY O_NONBLOCK
#define O_SYNC (0)
#define O_NOCTTY (0)
#define O_ASYNC (1<<7)

83
library/include/getopt.h Normal file
View File

@ -0,0 +1,83 @@
/*
* $Id: getopt.h,v 1.2 2005-06-26 09:06:12 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _GETOPT_H
#define _GETOPT_H
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
#include <unistd.h>
/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#define no_argument 0
#define required_argument 1
#define optional_argument 2
struct option
{
const char * name;
int has_arg;
int * flag;
int val;
};
/****************************************************************************/
extern int getopt_long(int argc, const char **argv, const char *optstring,
const struct option *longopts, int *longindex);
/*extern int getopt_long_only(int argc, const char **argv, const char *optstring,
const struct option *longopts, int *longindex);
*/
extern int optreset;
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/****************************************************************************/
#endif /* _GETOPT_H */

View File

@ -1,5 +1,5 @@
/*
* $Id: inttypes.h,v 1.1 2005-02-04 15:03:13 obarthel Exp $
* $Id: inttypes.h,v 1.2 2005-05-12 13:21:47 obarthel Exp $
*
* :ts=4
*
@ -50,6 +50,12 @@
/****************************************************************************/
#ifndef _STDDEF_H
#include <stddef.h>
#endif /* _STDDEF_H */
/****************************************************************************/
/* printf() format specifications for different types. */
/* "Decimal" */
@ -162,7 +168,7 @@
/* intmax_t is 32 bits for SAS/C, 64-bits for GCC or if using a conforming C99 compiler. */
#if defined(__GNUC__) || ((__STDC_VERSION__ +0) >= 199901L)
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
#define PRIdMAX "lld"
#define PRIiMAX "lli"
#define PRIuMAX "llu"
@ -176,22 +182,22 @@
#define PRIxMAX "lx"
#define PRIXMAX "lX"
#define PRIoMAX "lo"
#endif
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
/* scanf() format specifiers. */
/* "Decimal" */
/* #define SCNd8 "hhd" */ /* Missing. TODO: Add support for char conversions in scanf() */
#define SCNd8 "hhd"
#define SCNd16 "hd"
#define SCNd32 "d"
#define SCNd64 "lld"
/* #define SCNdLEAST8 "hhd" */ /* Missing. TODO: Add support for char conversions in scanf() */
#define SCNdLEAST8 "hhd"
#define SCNdLEAST16 "hd"
#define SCNdLEAST32 "d"
#define SCNdLEAST64 "lld"
/* #define SCNdFAST8 "hhd" */ /* Missing. TODO: Add support for char conversions in scanf() */
#define SCNdFAST8 "hhd"
#define SCNdFAST16 "d"
#define SCNdFAST32 "d"
#define SCNdFAST64 "lld"
@ -199,17 +205,17 @@
#define SCNdPTR "d"
/* "Integer" */
/* #define SCNi8 "hhi" */ /* Missing. TODO: Add support for char conversions in scanf() */
#define SCNi8 "hhi"
#define SCNi16 "hi"
#define SCNi32 "i"
#define SCNi64 "lli"
/* #define SCNiLEAST8 "hhi" */ /* Missing. TODO: Add support for char conversions in scanf() */
#define SCNiLEAST8 "hhi"
#define SCNiLEAST16 "hi"
#define SCNiLEAST32 "i"
#define SCNiLEAST64 "lli"
/* #define SCNiFAST8 "hhi" */ /* Missing. TODO: Add support for char conversions in scanf() */
#define SCNiFAST8 "hhi"
#define SCNiFAST16 "i"
#define SCNiFAST32 "i"
#define SCNiFAST64 "lli"
@ -217,17 +223,17 @@
#define SCNiPTR "i"
/* "Unsigned" */
/* #define SCNu8 "hhu" */ /* Missing. TODO: Add support for char conversions in scanf() */
#define SCNu8 "hhu"
#define SCNu16 "hu"
#define SCNu32 "u"
#define SCNu64 "llu"
/* #define SCNuLEAST8 "hhu" */ /* Missing. TODO: Add support for char conversions in scanf() */
#define SCNuLEAST8 "hhu"
#define SCNuLEAST16 "hu"
#define SCNuLEAST32 "u"
#define SCNuLEAST64 "llu"
/* #define SCNuFAST8 "hhu" */ /* Missing. TODO: Add support for char conversions in scanf() */
#define SCNuFAST8 "hhu"
#define SCNuFAST16 "u"
#define SCNuFAST32 "u"
#define SCNuFAST64 "llu"
@ -235,17 +241,17 @@
#define SCNuPTR "u"
/* "Hexadecimal" */
/* #define SCNx8 "hhx" */ /* Missing. TODO: Add support for char conversions in scanf() */
#define SCNx8 "hhx"
#define SCNx16 "hx"
#define SCNx32 "x"
#define SCNx64 "llx"
/* #define SCNxLEAST8 "hhx" */ /* Missing. TODO: Add support for char conversions in scanf() */
#define SCNxLEAST8 "hhx"
#define SCNxLEAST16 "hx"
#define SCNxLEAST32 "x"
#define SCNxLEAST64 "llx"
/* #define SCNxFAST8 "hhx" */ /* Missing. TODO: Add support for char conversions in scanf() */
#define SCNxFAST8 "hhx"
#define SCNxFAST16 "x"
#define SCNxFAST32 "x"
#define SCNxFAST64 "llx"
@ -253,24 +259,24 @@
#define SCNxPTR "x"
/* "Octal" */
/* #define SCNo8 "hho" */ /* Missing. TODO: Add support for char conversions in scanf() */
#define SCNo8 "hho"
#define SCNo16 "ho"
#define SCNo32 "o"
#define SCNo64 "llo"
/* #define SCNoLEAST8 "hho" */ /* Missing. TODO: Add support for char conversions in scanf() */
#define SCNoLEAST8 "hho"
#define SCNoLEAST16 "ho"
#define SCNoLEAST32 "o"
#define SCNoLEAST64 "llo"
/* #define SCNoFAST8 "hho" */ /* Missing. TODO: Add support for char conversions in scanf() */
#define SCNoFAST8 "hho"
#define SCNoFAST16 "o"
#define SCNoFAST32 "o"
#define SCNoFAST64 "llo"
#define SCNoPTR "o"
#if defined(__GNUC__) || ((__STDC_VERSION__ +0) >= 199901L)
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
#define SCNdMAX "lld"
#define SCNiMAX "lli"
#define SCNuMAX "llu"
@ -282,14 +288,30 @@
#define SCNuMAX "lu"
#define SCNxMAX "lx"
#define SCNoMAX "lo"
#endif
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
/* TODO: Add the rest of inttypes.h here + in the library. */
/****************************************************************************/
/*
* Missing stuff is among other things atoll(), strtoll(), ...
* Then there is the matter of wchar support - Zzzz.
*/
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
typedef struct { long long quot; long long rem; } imaxdiv_t;
#else
typedef struct { long quot; long rem; } imaxdiv_t;
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
/****************************************************************************/
extern intmax_t imaxabs(intmax_t x);
extern imaxdiv_t imaxdiv(intmax_t n,intmax_t d);
/****************************************************************************/
extern intmax_t strtoimax(const char *str, char **ptr, int base);
extern uintmax_t strtoumax(const char *str, char **ptr, int base);
/****************************************************************************/
extern intmax_t wcstoimax(const wchar_t *str, char **ptr, int base);
extern uintmax_t wcstoumax(const wchar_t *str, char **ptr, int base);
/****************************************************************************/

View File

@ -1,5 +1,5 @@
/*
* $Id: limits.h,v 1.5 2005-01-09 09:40:33 obarthel Exp $
* $Id: limits.h,v 1.8 2005-06-04 10:46:23 obarthel Exp $
*
* :ts=4
*
@ -83,13 +83,26 @@
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard, but it should
be part of ISO/IEC 9899:1999, also known as "C99". */
/****************************************************************************/
#define LLONG_MIN (-0x7fffffffffffffffLL-1)
#define LLONG_MAX 0x7fffffffffffffffLL
#define ULLONG_MAX 0xffffffffffffffffULL
/****************************************************************************/
#define MB_LEN_MAX 1
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
#define LLONG_MIN (-0x7fffffffffffffffLL-1)
#define LLONG_MAX 0x7fffffffffffffffLL
#define ULLONG_MAX 0xffffffffffffffffULL
#define SSIZE_MAX 2147483647L
/****************************************************************************/
@ -97,4 +110,63 @@
/****************************************************************************/
#define WORD_BIT 32
#define LONG_BIT 32 /* For now, at least. */
/****************************************************************************/
/*
* POSIX, POSIX... These are minimum maximum values. I.e. the maximum must be
* at least this large. I am not sure all of these make much sense on the Amiga
* (yet), but here they are anyway.
*
* Actually, these symbols should be defined only if the preprocessor symbol
* _POSIX_SOURCE is defined. Other symbols which should be defined, too, are
* ARG_MAX, CHILD_MAX, LINK_MAX, MAX_CANON, MAX_INPUT, NAME_MAX, NGROUPS_MAX,
* OPEN_MAX, PATH_MAX, PIPE_BUF, SSIZE_MAX, STREAM_MAX and TZNAME_MAX.
*/
#define _POSIX_AIO_LISTIO_MAX 2
#define _POSIX_AIO_MAX 1
#define _POSIX_ARG_MAX 4096
#define _POSIX_CHILD_MAX 6
#define _POSIX_DELAYTIMER_MAX 32
#define _POSIX_LINK_MAX 8
#define _POSIX_LOGIN_NAME_MAX 9
#define _POSIX_MAX_CANON 255
#define _POSIX_MAX_INPUT 255
#define _POSIX_MQ_OPEN_MAX 8
#define _POSIX_MQ_PRIO_MAX 32
#define _POSIX_NAME_MAX 14
#define _POSIX_NGROUPS_MAX 0
#define _POSIX_OPEN_MAX 16
#define _POSIX_PATH_MAX 255
#define _POSIX_PIPE_BUF 512
#define _POSIX_RTSIG_MAX 8
#define _POSIX_SEM_NSEMS_MAX 256
#define _POSIX_SEM_VALUE_MAX 32767
#define _POSIX_SIGQUEUE_MAX 32
#define _POSIX_SSIZE_MAX 32767
#define _POSIX_STREAM_MAX 8
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
#define _POSIX_THREAD_KEYS_MAX 128
#define _POSIX_THREADS_MAX 64
#define _POSIX_TIMER_MAX 32
#define _POSIX_TTY_NAME_MAX 9
#define _POSIX_TZNAME_MAX 3
#define _POSIX2_BC_BASE_MAX 99
#define _POSIX2_BC_DIM_MAX 2048
#define _POSIX2_BC_SCALE_MAX 99
#define _POSIX2_BC_STRING_MAX 1000
#define _POSIX2_COLL_WEIGHTS_MAX 2
#define _POSIX2_EXPR_NEST_MAX 32
#define _POSIX2_LINE_MAX 2048
#define _POSIX2_RE_DUP_MAX 255
#define _XOPEN_IOV_MAX 16
/* And a maximum minimum value. */
#define _POSIX_CLOCKRES_MIN 20000000 /* Nanoseconds */
/****************************************************************************/
#endif /* _LIMITS_H */

View File

@ -1,5 +1,5 @@
/*
* $Id: math.h,v 1.6 2005-02-25 10:14:22 obarthel Exp $
* $Id: math.h,v 1.16 2005-06-26 09:06:12 obarthel Exp $
*
* :ts=4
*
@ -101,12 +101,207 @@ extern double tanh(double x);
/****************************************************************************/
extern double rint(double x);
/* The following is not part of the ISO 'C' (1994) standard, but it should
be part of ISO/IEC 9899:1999, also known as "C99". */
/****************************************************************************/
/* Note that the comparison operations performed on the floating point
data types ought to include float, double and long double. However,
because the current (2005-06-12) compiler technology available on the
Amiga does not support the long double type yet, this library is
restricted to operations on float and double. */
/****************************************************************************/
extern float __huge_val_float;
/****************************************************************************/
#define HUGE_VALF ((const float)__huge_val_float)
/****************************************************************************/
extern float __infinity;
extern float __nan;
/****************************************************************************/
#define INFINITY ((const float)__infinity)
#define NAN ((const float)__nan)
/****************************************************************************/
#define FP_INFINITE 0 /* -/+ infinity */
#define FP_NAN 1 /* not a number */
#define FP_NORMAL 2 /* normalized floating point number */
#define FP_SUBNORMAL 3 /* very small floating point number; special
case of IEEE 754 */
#define FP_ZERO 4 /* exponent/fraction are zero */
/****************************************************************************/
extern int __fpclassify_float(float x);
extern int __fpclassify_double(double x);
extern int __isfinite_float(float x);
extern int __isfinite_double(double x);
extern int __signbit_float(float x);
extern int __signbit_double(double x);
/****************************************************************************/
#define fpclassify(x) \
(sizeof(x) == sizeof(float) ? \
__fpclassify_float(x) : \
__fpclassify_double(x))
#define isfinite(x) \
(sizeof(x) == sizeof(float) ? \
__isfinite_float(x) : \
__isfinite_double(x))
#define isinf(x) \
((sizeof(x) == sizeof(float) ? \
__fpclassify_float(x) : \
__fpclassify_double(x)) \
== FP_INFINITE)
#define isnan(x) \
((sizeof(x) == sizeof(float) ? \
__fpclassify_float(x) : \
__fpclassify_double(x)) \
== FP_NAN)
#define isnormal(x) \
((sizeof(x) == sizeof(float) ? \
__fpclassify_float(x) : \
__fpclassify_double(x)) \
== FP_NORMAL)
#define signbit(x) \
(sizeof(x) == sizeof(float) ? \
__signbit_float(x) : \
__signbit_double(x))
/****************************************************************************/
extern int __isunordered_float(float x,float y);
extern int __isunordered_float_double(float x,double y);
extern int __isunordered_double(double x,double y);
/****************************************************************************/
#define isunordered(x,y) \
(sizeof(x) == sizeof(float) ? \
(sizeof(y) == sizeof(float) ? \
__isunordered_float((x),y) : \
__isunordered_float_double((x),(y))) : \
(sizeof(y) == sizeof(float) ? \
__isunordered_float_double((y),(x)) : \
__isunordered_double((x),(y))))
#define isgreater(x,y) \
(isunordered(x,y) ? 0 : (x) > (y))
#define isgreaterequal(x,y) \
(isunordered(x,y) ? 0 : (x) >= (y))
#define isless(x,y) \
(isunordered(x,y) ? 0 : (x) < (y))
#define islessequal(x,y) \
(isunordered(x,y) ? 0 : (x) <= (y))
#define islessgreater(x,y) \
(isunordered(x,y) ? 0 : (x) < (y) || (x) > (y)) /* ZZZ don't evaluate twice! */
/****************************************************************************/
extern float acosf(float x);
extern float asinf(float x);
extern float atanf(float x);
extern float atan2f(float y, float x);
extern float ceilf(float x);
extern float cosf(float x);
extern float coshf(float x);
extern float expf(float x);
extern float fabsf(float x);
extern float floorf(float x);
extern float fmodf(float x, float y);
extern float frexpf(float x, int *eptr);
extern float ldexpf(float x,int exp);
extern float logf(float x);
extern float log10f(float x);
extern float modff(float x, float *iptr);
extern float powf(float x, float y);
extern float sinf(float x);
extern float sinhf(float x);
extern float sqrtf(float x);
extern float tanf(float x);
extern float tanhf(float x);
/****************************************************************************/
extern float acoshf(float x);
extern float asinhf(float x);
extern float cbrtf(float x);
extern float copysignf(float x, float y);
extern float erfcf(float x);
extern float erff(float x);
extern float expm1f(float x);
extern float fdimf(float x,float y);
extern float fmaxf(float x,float y);
extern float fminf(float x,float y);
extern float hypotf(float x, float y);
extern float lgammaf(float x);
extern float log1pf(float x);
extern float logbf(float x);
extern float nanf(const char *tagp);
extern float nextafterf(float x,float y);
extern float remainderf(float x, float p);
extern float rintf(float x);
extern int isinf(double x);
extern int isnan(double x);
extern double logb(double x);
extern float scalbnf (float x, int n);
extern int ilogbf(float x);
/****************************************************************************/
extern double acosh(double x);
extern double asinh(double x);
extern double cbrt(double x);
extern double copysign(double x, double y);
extern double erf(double x);
extern double erfc(double x);
extern double expm1(double x);
extern double fdim(double x,double y);
extern double fmax(double x,double y);
extern double fmin(double x,double y);
extern double hypot(double x,double y);
extern double lgamma(double x);
extern double log1p(double x);
extern double logb(double x);
extern double nan(const char *tagp);
extern double nextafter(double x,double y);
extern double remainder(double x, double p);
extern double rint(double x);
extern double scalbn (double x, int n);
extern int ilogb(double x);
/****************************************************************************/
extern float exp2f(float x);
extern double exp2(double x);
extern double log2(double x);
extern float log2f(float x);
/****************************************************************************/
#define FLT_EVAL_METHOD 0
/****************************************************************************/
typedef float float_t;
typedef double double_t;
/****************************************************************************/

View File

@ -1,5 +1,5 @@
/*
* $Id: signal.h,v 1.4 2005-01-02 09:07:21 obarthel Exp $
* $Id: signal.h,v 1.5 2005-05-12 13:21:47 obarthel Exp $
*
* :ts=4
*
@ -62,6 +62,15 @@ extern int raise(int sig);
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard, but it should
be part of ISO/IEC 9899:1999, also known as "C99". */
/****************************************************************************/
typedef int sig_atomic_t;
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
@ -76,10 +85,6 @@ typedef void (*sig_t)(int);
/****************************************************************************/
typedef int sig_atomic_t;
/****************************************************************************/
typedef int sigset_t;
/****************************************************************************/

View File

@ -1,5 +1,5 @@
/*
* $Id: stdarg.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $
* $Id: stdarg.h,v 1.4 2005-04-03 10:22:48 obarthel Exp $
*
* :ts=4
*
@ -56,6 +56,15 @@ typedef char * va_list;
/****************************************************************************/
/* The following macro is not part of the ISO 'C' (1994) standard, but it should
be part of ISO/IEC 9899:1999, also known as "C99". */
/****************************************************************************/
#define va_copy(dst,src) ((void)((dst) = (src)))
/****************************************************************************/
#else
/****************************************************************************/

81
library/include/stdbool.h Normal file
View File

@ -0,0 +1,81 @@
/*
* $Id: stdbool.h,v 1.2 2005-05-12 13:21:47 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _STDBOOL_H
#define _STDBOOL_H
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard, but it should
be part of ISO/IEC 9899:1999, also known as "C99". */
/****************************************************************************/
#if defined(__cplusplus) && defined(__GNUC__)
#warning C99 header used in C++.
#endif /* __GNUC__ */
/****************************************************************************/
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
#warning C99 header file used by non-C99 compliant compiler.
#endif /* !__STDC_VERSION__ || __STDC_VERSION__ < 199901L */
/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#define bool _Bool
/****************************************************************************/
#define false 0
#define true 1
/****************************************************************************/
#define __bool_true_and_false_are_defined 1
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/****************************************************************************/
#endif /* _STDBOOL_H */

View File

@ -1,5 +1,5 @@
/*
* $Id: stddef.h,v 1.3 2005-01-08 10:21:28 obarthel Exp $
* $Id: stddef.h,v 1.4 2005-05-12 13:21:47 obarthel Exp $
*
* :ts=4
*
@ -54,7 +54,7 @@ extern "C" {
typedef int ptrdiff_t;
typedef unsigned int size_t;
typedef unsigned int wchar_t;
typedef unsigned short wchar_t;
/****************************************************************************/

View File

@ -1,5 +1,5 @@
/*
* $Id: stdint.h,v 1.1 2005-02-04 15:03:14 obarthel Exp $
* $Id: stdint.h,v 1.2 2005-05-12 13:21:47 obarthel Exp $
*
* :ts=4
*
@ -77,8 +77,7 @@ typedef unsigned int uint_fast32_t;
typedef signed long intptr_t;
typedef unsigned long uintptr_t;
#if defined(__GNUC__) || ((__STDC_VERSION__ +0) >= 199901L)
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
typedef signed long long int_least64_t;
@ -87,10 +86,10 @@ typedef signed long long int_fast64_t;
typedef unsigned long long uint_fast64_t;
typedef signed long long intmax_t;
typedef unsigned long long uintmax_t;
#else /* No 64-bit types for SAS/C */
#else
typedef signed long intmax_t;
typedef unsigned long uintmax_t;
#endif
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
#define INT8_MIN SCHAR_MIN
#define INT8_MAX SCHAR_MAX
@ -101,11 +100,11 @@ typedef unsigned long uintmax_t;
#define INT32_MIN INT_MIN
#define INT32_MAX INT_MAX
#define UINT32_MAX UINT_MAX
#if defined(__GNUC__) || ((__STDC_VERSION__ +0) >= 199901L)
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
#define INT64_MIN LLONG_MIN
#define INT64_MAX LLONG_MAX
#define UINT64_MAX ULLONG_MAX
#endif
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
#define INT_LEAST8_MIN SCHAR_MIN
#define INT_LEAST8_MAX SCHAR_MAX
@ -116,11 +115,11 @@ typedef unsigned long uintmax_t;
#define INT_LEAST32_MIN INT_MIN
#define INT_LEAST32_MAX INT_MAX
#define UINT_LEAST32_MAX UINT_MAX
#if defined(__GNUC__) || ((__STDC_VERSION__ +0) >= 199901L)
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
#define INT_LEAST64_MIN LLONG_MIN
#define INT_LEAST64_MAX LLONG_MAX
#define UINT_LEAST64_MAX ULLONG_MAX
#endif
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
#define INT_FAST8_MIN SCHAR_MIN
#define INT_FAST8_MAX SCHAR_MAX
@ -131,17 +130,17 @@ typedef unsigned long uintmax_t;
#define INT_FAST32_MIN INT_MIN
#define INT_FAST32_MAX INT_MAX
#define UINT_FAST32_MAX UINT_MAX
#if defined(__GNUC__) || ((__STDC_VERSION__ +0) >= 199901L)
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
#define INT_FAST64_MIN LLONG_MIN
#define INT_FAST64_MAX LLONG_MAX
#define UINT_FAST64_MAX ULLONG_MAX
#endif
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
#define INTPTR_MIN LONG_MIN
#define INTPTR_MAX LONG_MAX
#define UINTPTR_MAX ULONG_MAX
#if defined(__GNUC__) || ((__STDC_VERSION__ +0) >= 199901L)
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
#define INTMAX_MIN LLONG_MIN
#define INTMAX_MAX LLONG_MAX
#define UINTMAX_MAX ULLONG_MAX
@ -149,9 +148,9 @@ typedef unsigned long uintmax_t;
#define INTMAX_MIN LONG_MIN
#define INTMAX_MAX LONG_MAX
#define UINTMAX_MAX ULONG_MAX
#endif
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
#if !defined(__cpluspluis) || defined(__STDC_LIMIT_MACROS)
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
/* sigatomic_t is an int. */
#define SIG_ATOMIC_MIN INT_MIN
#define SIG_ATOMIC_MAX INT_MAX
@ -171,16 +170,27 @@ typedef unsigned long uintmax_t;
#define UINT32_C(x) x ## U
#define UINT64_C(x) x ## ULL
#if defined(__GNUC__) || ((__STDC_VERSION__ +0) >= 199901L)
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
#define INTMAX_C(x) x ## LL
#define UINTMAX_C(x) x ## ULL
#else
#define INTMAX_C(x) x ## L
#define UINTMAX_C(x) x ## UL
#endif
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
#endif /* not C++ or CONSTANT_MACROS */
/****************************************************************************/
#define PTRDIFF_MIN INT_MIN
#define PTRDIFF_MAX INT_MAX
#define WCHAR_MIN 0
#define WCHAR_MAX USHRT_MAX
#define WINT_MIN INT_MIN
#define WINT_MAX INT_MAX
/****************************************************************************/
#endif /* _STDINT_H */

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio.h,v 1.9 2005-03-06 09:04:44 obarthel Exp $
* $Id: stdio.h,v 1.16 2005-06-18 07:23:17 obarthel Exp $
*
* :ts=4
*
@ -50,6 +50,10 @@ extern "C" {
#include <stdarg.h>
#endif /* _STDARG_H */
#ifndef _SYS_TYPES_H
#include <sys/types.h>
#endif /* _SYS_TYPES_H */
/****************************************************************************/
/* 'End of file' indicator returned by, for example, fgetc() */
@ -306,12 +310,30 @@ extern char *tmpnam(char *buf);
/****************************************************************************/
#if defined(__THREAD_SAFE)
/****************************************************************************/
#define clearerr(file) ((void)(flockfile(file), (file)->flags &= ~(__FILE_EOF|__FILE_ERROR), funlockfile(file)))
#define feof(file) (flockfile(file), __unlockfile((file),((file)->flags & __FILE_EOF) != 0))
#define ferror(file) (flockfile(file), __unlockfile((file),((file)->flags & __FILE_ERROR) != 0))
/****************************************************************************/
#else
/****************************************************************************/
#define clearerr(file) ((void)((file)->flags &= ~(__FILE_EOF|__FILE_ERROR)))
#define feof(file) (((file)->flags & __FILE_EOF) != 0)
#define ferror(file) (((file)->flags & __FILE_ERROR) != 0)
/****************************************************************************/
#endif /* __THREAD_SAFE */
/****************************************************************************/
#endif /* __C_MACROS__ */
/****************************************************************************/
@ -324,6 +346,14 @@ extern char *tmpnam(char *buf);
/****************************************************************************/
#define L_ctermid 32
/****************************************************************************/
extern char *ctermid(char *);
/****************************************************************************/
/*
* A special buffer flush routine which returns the last character written
* in case of success and EOF in case of failure. This is used by the
@ -359,10 +389,11 @@ extern int putchar_unlocked(int c);
extern FILE * fdopen(int file_descriptor, const char * type);
extern int fileno(FILE * file);
extern int asprintf(char **ret, const char *format, ...);
extern int snprintf(char *s,size_t size,const char *format,...);
extern int vsnprintf(char *s,size_t size,const char *format,va_list arg);
extern int pclose(FILE *stream);
extern FILE * popen(const char *command, const char *type);
extern int fseeko(FILE *stream, off_t offset, int wherefrom);
extern off_t ftello(FILE *stream);
/****************************************************************************/
@ -400,6 +431,18 @@ extern int __vasprintf(const char *file,int line,char **ret,const char *format,v
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard, but it should
be part of ISO/IEC 9899:1999, also known as "C99". */
/****************************************************************************/
extern int vfscanf(FILE *stream, const char *format, va_list arg);
extern int vsscanf(const char *s, const char *format, va_list arg);
extern int vscanf(const char *format,va_list arg);
extern int snprintf(char *s,size_t size,const char *format,...);
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -1,5 +1,5 @@
/*
* $Id: stdlib.h,v 1.8 2005-03-02 12:57:56 obarthel Exp $
* $Id: stdlib.h,v 1.11 2005-05-12 13:21:47 obarthel Exp $
*
* :ts=4
*
@ -49,7 +49,7 @@ extern "C" {
/****************************************************************************/
/* Maximum number of bytes in a multibyte character */
#define MB_CUR_MAX 4
#define MB_CUR_MAX 2
/****************************************************************************/
@ -153,16 +153,6 @@ extern int rand_r(unsigned int * seed);
/****************************************************************************/
/* These functions are unavailable under SAS/C for lack of a
"long long" data type. */
#if ! defined(__SASC)
extern long long strtoll(const char *str, char **ptr, int base);
extern unsigned long long strtoull(const char *str, char **ptr, int base);
extern long long atoll(const char *str);
#endif /* __SASC */
/****************************************************************************/
#if defined(__GNUC__)
#undef alloca
#define alloca(size) __builtin_alloca(size)
@ -187,6 +177,42 @@ extern char * mkdtemp(char *name_template);
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard, but it should
be part of ISO/IEC 9899:1999, also known as "C99". */
/****************************************************************************/
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
/****************************************************************************/
extern long long strtoll(const char *str, char **ptr, int base);
extern unsigned long long strtoull(const char *str, char **ptr, int base);
extern long long atoll(const char *str);
/****************************************************************************/
typedef struct { long long quot; long long rem; } lldiv_t;
/****************************************************************************/
extern long long llabs(long long x);
extern lldiv_t lldiv(long long n,long long d);
/****************************************************************************/
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
/****************************************************************************/
extern float strtof(const char *str, char ** ptr);
/****************************************************************************/
extern void _Exit(int status);
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -0,0 +1,230 @@
/*
* $Id: clib2_net.h,v 1.1 2005-07-12 13:35:58 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SYS_CLIB2_NET_H
#define _SYS_CLIB2_NET_H
/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
/*
* The following may have been predefined by local TCP/IP header files. We
* don't want to be any trouble...
*/
#if !defined(FD_SET) && !defined(__NO_NET_API)
/****************************************************************************/
#ifndef _UNISTD_H
#include <unistd.h>
#endif /* _UNISTD_H */
#ifndef _STRING_H
#include <string.h>
#endif /* _STRING_H */
#ifndef _STDLIB_H
#include <stdlib.h>
#endif /* _STDLIB_H */
#ifndef _SYS_TIME_H
#include <sys/time.h>
#endif /* _SYS_TIME_H */
#ifndef _SYS_TYPES_H
#include <sys/types.h>
#endif /* _SYS_TYPES_H */
/****************************************************************************/
/*
* select() uses bit masks of file descriptors in longs. These macros
* manipulate such bit fields.
*
* FD_SETSIZE may be defined by the user, but the default here should
* be enough for most uses.
*/
#ifndef FD_SETSIZE
#define FD_SETSIZE 256
#endif
typedef struct fd_set
{
unsigned long bits[(FD_SETSIZE + 31) / 32];
} fd_set;
#define FD_SET(n,p) ((void)((p)->bits[((unsigned long)n) >> 5] |= (1UL << (((unsigned long)n) & 31))))
#define FD_CLR(n,p) ((void)((p)->bits[((unsigned long)n) >> 5] &= ~(1UL << (((unsigned long)n) & 31))))
#define FD_ISSET(n,p) (((p)->bits[((unsigned long)n) >> 5] & (1UL << (((unsigned long)n) & 31))) != 0)
#define FD_COPY(f,t) ((void)memmove(t,f,sizeof(*(f))))
#define FD_ZERO(p) ((void)memset(p,0,sizeof(*(p))))
/****************************************************************************/
/* Forward declarations for below... */
struct hostent;
struct netent;
struct protoent;
struct servent;
struct passwd;
struct msghdr;
struct sockaddr;
/****************************************************************************/
/*
* You might want to have <netinet/in.h> included in place of
* this local definition.
*/
#if defined(__USE_NETINET_IN_H)
#include <netinet/in.h>
#else
/*
* These two symbols are typically defined by <netinet/in.h>, which also
* happens to define 'struct in_addr'. We don't want to redefine it.
*/
#if !defined(_NETINET_IN_H) && !defined(IPPROTO_IP)
/* Internet address (a structure for historical reasons) */
struct in_addr
{
unsigned long s_addr;
};
#endif /* !_NETINET_IN_H && !IPPROTO_IP */
#endif /* __USE_NETINET_IN_H */
/****************************************************************************/
/* Error codes set by the name<->address resolution functions. */
extern int h_errno;
/****************************************************************************/
typedef unsigned long socklen_t;
/****************************************************************************/
extern int accept(int sockfd,struct sockaddr *cliaddr,socklen_t *addrlen);
extern int bind(int sockfd,struct sockaddr *name,int namelen);
extern int connect(int sockfd,struct sockaddr *name,socklen_t namelen);
extern struct hostent * gethostbyaddr(const char *addr, socklen_t len, int type);
extern struct hostent * gethostbyname(const char *name);
extern int gethostname(const char *name, int namelen);
extern struct netent * getnetbyname(const char *name);
extern int getpeername(int sockfd,struct sockaddr *name,socklen_t *namelen);
extern int getsockname(int sockfd,struct sockaddr *name,socklen_t *namelen);
extern int getsockopt(int sockfd,int level,int optname,void *optval,socklen_t *optlen);
extern unsigned long inet_addr(const char *addr);
extern char * inet_ntoa(struct in_addr in);
extern int ioctl(int fd,unsigned long request, ... /* char *arg */);
extern int listen(int sockfd,int backlog);
extern int recv(int fd,void *buff,size_t nbytes,int flags);
extern int recvfrom(int sockfd,void *buff,int len,int flags,struct sockaddr *from,socklen_t *fromlen);
extern int recvmsg(int socket,struct msghdr *msg,int flags);
extern int select(int num_fds,fd_set *read_fds,fd_set *write_fds,fd_set *except_fds,struct timeval *timeout);
extern int send(int fd,const void *buff,size_t nbytes,int flags);
extern int sendmsg(int socket,struct msghdr *msg,int flags);
extern int sendto(int sockfd,const void *buff,int len,int flags,struct sockaddr *to,socklen_t tolen);
extern int setsockopt(int sockfd,int level,int optname,const void *optval,socklen_t optlen);
extern int shutdown(int socket, int how);
extern int socket(int domain,int type,int protocol);
extern long gethostid(void);
extern struct netent * getnetbyaddr(long net,int type);
extern struct servent * getservbyname(const char *name, const char *proto);
extern struct servent * getservbyport(int port, const char *proto);
extern struct protoent * getprotobyname(const char *name);
extern struct protoent * getprotobynumber(int proto);
extern int inet_aton(const char *cp, struct in_addr *addr);
extern unsigned long inet_lnaof(struct in_addr in);
extern struct in_addr inet_makeaddr(int net,int host);
extern unsigned long inet_netof(struct in_addr in);
extern unsigned long inet_network(const char *cp);
extern const char * hstrerror(int error_number);
/****************************************************************************/
extern char *crypt(const char *key, const char *salt);
extern gid_t getegid(void);
extern uid_t geteuid(void);
extern gid_t getgid(void);
extern struct group *getgrgid(gid_t gid);
extern struct group *getgrnam(const char *name);
extern int getgroups(int ngroups, gid_t *groups);
extern char *getpass(const char *prompt);
extern struct passwd *getpwnam(const char *name);
extern struct passwd *getpwuid(uid_t uid);
extern uid_t getuid(void);
extern int initgroups(const char *name, gid_t basegroup);
extern int setegid(gid_t g);
extern int seteuid(uid_t u);
extern int setgid(gid_t id);
extern int setgroups(int ngroups, const gid_t *groups);
extern int setregid(gid_t real, gid_t eff);
extern int setreuid(uid_t real, uid_t eff);
extern long setsid(void);
extern int setuid(uid_t id);
extern void endgrent(void);
extern void endpwent(void);
extern struct group *getgrent(void);
extern struct passwd *getpwent(void);
extern void setgrent(void);
extern void setpwent(void);
/****************************************************************************/
#endif /* !FD_SET && !__NO_NET_API */
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/****************************************************************************/
#endif /* _SYS_CLIB2_NET_H */

View File

@ -0,0 +1,63 @@
/*
* $Id: clib2_stdc.h,v 1.1 2005-05-12 13:21:47 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SYS_CLIB2_STDC_H
#define _SYS_CLIB2_STDC_H
/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
/* Make the "restrict" qualifier work well with 'C' compilers that do
not support it. We do assume that __STDC__ is defined, though. */
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
#define restrict
#endif /* !__STDC_VERSION__ || __STDC_VERSION__ < 199901L */
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/****************************************************************************/
#endif /* _SYS_CLIB2_STDC_H */

View File

@ -1,5 +1,5 @@
/*
* $Id: stat.h,v 1.4 2005-03-10 11:40:57 obarthel Exp $
* $Id: stat.h,v 1.5 2005-04-02 13:25:55 obarthel Exp $
*
* :ts=4
*
@ -88,22 +88,23 @@ extern "C" {
/****************************************************************************/
#define S_IFMT 0170000 /* type of file */
#define S_IFIFO 0010000 /* named pipe (fifo) */
#define S_IFDIR 0040000 /* directory */
#define S_IFBLK 0060000 /* block special */
#define S_IFREG 0100000 /* regular */
#define S_IFLNK 0120000 /* symbolic link */
#define S_IFSOCK 0140000 /* socket */
#define S_IFMT 0170000 /* type of file */
#define S_IFIFO 0010000 /* named pipe (fifo) */
#define S_IFCHR 0020000 /* character special */
#define S_IFDIR 0040000 /* directory */
#define S_IFBLK 0060000 /* block special */
#define S_IFREG 0100000 /* regular */
#define S_IFLNK 0120000 /* symbolic link */
#define S_IFSOCK 0140000 /* socket */
/****************************************************************************/
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* directory */
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) /* char special */
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* regular file */
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) /* symbolic link */
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* fifo */
#define S_ISBLK(m) (0) /* block special */
#define S_ISCHR(m) (0) /* character special */
/****************************************************************************/

View File

@ -1,5 +1,5 @@
/*
* $Id: types.h,v 1.4 2005-02-20 15:46:57 obarthel Exp $
* $Id: types.h,v 1.5 2005-07-15 14:31:37 obarthel Exp $
*
* :ts=4
*
@ -61,6 +61,18 @@ typedef unsigned int uid_t;
/****************************************************************************/
#ifndef _TIME_H
#include <time.h>
#endif /* _TIME_H */
/****************************************************************************/
#ifndef _STDDEF_H
#include <stddef.h>
#endif /* _STDDEF_H */
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */

84
library/include/sys/uio.h Normal file
View File

@ -0,0 +1,84 @@
/*
* $Id: uio.h,v 1.1 2005-04-03 10:22:48 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SYS_UIO_H
#define _SYS_UIO_H
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifndef _SYS_TYPES_H
#include <sys/types.h>
#endif /* _SYS_TYPES_H */
#ifndef _STDDEF_H
#include <stddef.h>
#endif /* _STDDEF_H */
/****************************************************************************/
/*
* The size of MAX_IOVEC is rather arbitrary since there is no kernel support
* for vectored I/O and even a single struct iovec can overflow a ssize_t.
*/
#define MAX_IOVEC 1024
typedef struct iovec
{
void * iov_base;
size_t iov_len;
} iovec_t;
/****************************************************************************/
extern ssize_t readv(int file_descriptor,const struct iovec *iov,int vec_count);
extern ssize_t writev(int file_descriptor,const struct iovec *iov,int vec_count);
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/****************************************************************************/
#endif /* _SYS_UIO_H */

189
library/include/termios.h Normal file
View File

@ -0,0 +1,189 @@
/*
* $Id: termios.h,v 1.1 2005-06-04 10:46:23 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Almost-but-not-quite termios.
*/
#ifndef _TERMIOS_H
#define _TERMIOS_H
typedef unsigned int tcflag_t;
typedef unsigned char cc_t;
typedef unsigned int speed_t;
#define NCCS 16 /* Number of Control Characters = Length of the c_cc array. */
enum { /* All the control characters in c_cc[] in a struct termios (below) */
VINTR=0, /* ^C (break) */
VQUIT, /* ^\ (quit) */
VERASE, /* ^H (eraase) */
VKILL, /* ^X (erase-line) */
VEOF, /* ^D (end-of-file) */
VMIN, /* Minimum number of characters to read. Interacts with VTIME. */
VEOL, /* NUL */
VTIME, /* Timeout in 1/10:ths of a second. Interacts with VMIN. */
VSTART, /* ^Q (continue) */
VSTOP, /* ^S (stop) */
VSUSP, /* ^Z (suspend) */
VWERASE, /* ^W (word-erase) */
};
struct termios {
tcflag_t c_iflag;
tcflag_t c_oflag;
tcflag_t c_cflag;
tcflag_t c_lflag;
cc_t c_cc[NCCS];
/* Private */
speed_t c_ispeed;
speed_t c_ospeed;
int type;
unsigned int flags;
};
/* c_iflag */
#define IGNBRK (1<<0L) /* Ignore VINTR */
#define BRKINT (1<<1L) /* Unimpl. */
#define IGNPAR (1<<2L) /* Unimpl. */
#define PARMRK (1<<3L) /* Unimpl. */
#define INPCK (1<<4L) /* Unimpl. */
#define ISTRIP (1<<5L) /* 7-bit data (strip high bit) */
#define INLCR (1<<6L) /* Map NL->CR */
#define IGNCR (1<<7L) /* Map CR->nothing */
#define ICRNL (1<<8L) /* Map CR->NL */
#define IXON (1<<9L) /* Unimpl. Enable XON/XOFF for output. */
#define IXOFF (1<<10L) /* Unimpl. Enable XON/XOFF for input. */
/* c_oflag */
#define OPOST (1<<0L) /* Enable output processing. */
#define ONLCR (1<<1L) /* Map NL->CR+NL */
#define OCRNL (1<<2L) /* Map CR->NL */
#define ONOCR (1<<3L) /* Map CR->nothing, but only in column 0. */
#define ONLRET (1<<4L) /* Map CR->nothing */
/* c_cflag */
#define CSIZE (0x07) /* Bit-width mask. */
#define CS5 (0x01) /* 5-bits */
#define CS6 (0x02) /* 6-bits */
#define CS7 (0x03) /* 7-bits */
#define CS8 (0x04) /* 8-bits */
#define CSTOPB (1<<3L) /* Use 2 stop bits. */
#define CREAD (1<<4L) /* Enable reading/receiving. */
#define PARENB (1<<5L) /* Enable parity generation/checking. */
#define PARODD (1<<6L) /* Parity is odd. */
#define HUPCL (1<<7L) /* Hangup on close (when the device is closed). */
#define CLOCAL (1<<8L) /* Ignore modem control lines (i.e. a null-modem) */
/* c_lflag */
#define ISIG (1<<0L) /* Send SIGINT for ^C, SIGQUIT for ^\ etc. */
#define ICANON (1<<1L) /* Canonical mode. Line buffered with EOF, EOL etc. enabled. */
#define ECHO (1<<2L) /* Echo input characters. */
#define ECHONL (1<<3L) /* Echo newline characters even if ECHO is not set. */
#define IEXTEN (1<<4L) /* Enable implementation defined input processing. (none) */
/* Speeds */
enum {
B0=0, /* 0 baud => disconnect. */
B50=50,
B75=75,
B110=110,
B134=134,
B150=150,
B200=200,
B300=300,
B600=600,
B1200=1200,
B1800=1800,
B2400=2400,
B4800=4800,
B9600=9600,
B19200=19200,
B31250=31250,
B38400=38400,
B57600=57600,
B115200=115200,
B230400=230400,
B460800=460800,
B576000=576000,
B1152000=1152000
};
#define EXTA 1 /* Tell applications we have speeds > 9600 baud. */
/* Action types for tcsetattr() */
enum {
TCSANOW,
TCSADRAIN,
TCSAFLUSH
};
/* Action types for tcflush() */
enum {
TCIFLUSH,
TCOFLUSH,
TCIOFLUSH
};
/* Action types for tcflow() */
enum {
TCOOFF,
TCOON,
TCIOFF,
TCION
};
/* Prototypes. */
extern int tcgetattr(int file_descriptor,struct termios *tios_p);
extern int tcsetattr(int file_descriptor,int action,struct termios *tios_p);
extern int tcsendbreak(int file_descriptor,int duration);
extern int tcdrain(int file_descriptor);
extern int tcflush(int file_descriptor,int what);
extern int tcflow(int file_descriptor,int action);
extern int cfmakeraw(struct termios *tios_p);
extern speed_t cfgetispeed(struct termios *tios_p);
extern speed_t cfgetospeed(struct termios *tios_p);
extern int cfsetispeed(struct termios *tios_p,speed_t input_speed);
extern int cfsetospeed(struct termios *tios_p,speed_t output_speed);
#endif /* _TERMIOS_H */

Some files were not shown because too many files have changed in this diff Show More