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

33 Commits

Author SHA1 Message Date
Olaf Barthel
6f19f5b951 This commit was manufactured by cvs2svn to create tag 'V1_197'.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/tags/V1_197@15060 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-11-04 10:10:58 +00:00
Olaf Barthel
0f5e6747e0 - Fixed the Amiga archive build script to delete the remains of the
CVS directory structure.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15059 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-11-04 10:10:57 +00:00
Olaf Barthel
a0a46206d1 - Updated the Unix archive build script to clean up the
CVS subdirectories in the "include" directory.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15058 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-11-04 09:39:40 +00:00
Olaf Barthel
c7fbdf27e1 - Added Steven Solie's new OS4 build makefile.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15057 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-11-04 09:35:02 +00:00
Olaf Barthel
010d4c1c06 - Preparations for clib2 1.197 release.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15056 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-11-04 09:21:44 +00:00
Olaf Barthel
81958fd44b - Tried to reduce the number of compiler warnings generated.
- The cross compiler GNUmakefile.os4 variant now also logs all warnings
  and errors to a compiler.log file.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15055 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-27 08:58:41 +00:00
Olaf Barthel
937169c0ba - Updated the OS4 build makefile to allow for a parallel build to work
better. Note that this is not yet entirely succesful.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15054 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-27 08:26:17 +00:00
Olaf Barthel
dda36eb609 - IsServerProcess() should have read ProcessIsServer().
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15053 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-23 11:58:12 +00:00
Olaf Barthel
867e6d500a - Updated the new __obtain_daemon_message() function to call a
bsdsocket.library API function to determine if what appears to be
  a valid daemon startup message is sound.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15052 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-23 09:53:39 +00:00
Olaf Barthel
99e9ebfc15 - Moved the code which rebinds the standard I/O streams to the server
socket into a separate function which can be overridden by user code.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15051 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-20 07:19:16 +00:00
Olaf Barthel
63c08cfe0e - The network startup code no longer checks for the presence of a possible
daemon startup message by default. You now have to enable this feature
  by declaring a global variable called "__check_daemon_startup" which is
  described in <dos.h>.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15050 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-20 06:50:32 +00:00
Olaf Barthel
b6de3e4c48 - In <stdbool.h> the preprocessor definition should read
"__bool_true_false_are_defined" rather than "__bool_true_and_false_are_defined".
  Thanks go to Peter Bengtsson for finding and fixing it.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15049 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-19 08:11:44 +00:00
Olaf Barthel
090753282b - Added __set_h_errno() and __get_h_errno() functions.
- The thread-safe library now tries to enable bsdsocket.library base
  sharing and attempts to make the TCP/IP stack call the local
  __set_errno() and __set_h_errno(), so that any Process calling
  the library functions will get a chance to see proper error
  codes. Whether any of these features could be enabled can be tested
  through two global variables __can_share_socket_library_base and
  __thread_safe_errno_h_errno which are defined in <dos.h>. Note that
  for both features to work you will need the Roadshow bsdsocket.library
  version 4.275 or higher.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15048 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-17 13:54:25 +00:00
Olaf Barthel
d45da0acd4 - Corrected a variable name.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15047 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-16 09:17:11 +00:00
Olaf Barthel
3480ec40b3 - Updated the build files so that atanh() and atanhf() are built for the
respective math libraries.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15046 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-16 09:14:28 +00:00
Olaf Barthel
f9e782d358 - Implemented atanh() and atanhf() which were not listed in the TODO
file but were still unimplemented up until now.

- Replaced ldexp() and modf().


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15045 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-16 09:05:03 +00:00
Olaf Barthel
44bcf889e5 - Corrected a typo.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15044 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-16 08:34:52 +00:00
Olaf Barthel
257dd6af88 - Updated math_hypot.c to a newer (e_hypot.c 1.3 95/01/18) version from
fdlibm which uses macros for manipulating the high and low words of a
  double, like the rest of fdlibm functions in clib2. The previous version
  would give bogus results when compiled with -O3 in clib2 which lead to
  "interesting" results (and lots of fun while searching for the problem)
  in Ghostscript. Wish I managed to track this down yesterday for 1.196
  release... <aantonijevic>


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15043 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-11 19:05:18 +00:00
Olaf Barthel
acafd14bc2 - Removed <sys/clib2_net.h> and every reference to it.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15042 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-11 11:24:53 +00:00
Olaf Barthel
b63587ed80 - Removed the compiler log file generation.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15041 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-11 09:37:27 +00:00
Olaf Barthel
b861ed19c4 - Removed a couple of compiler warnings; fishing for more...
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15040 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-11 09:28:29 +00:00
Olaf Barthel
ccfea73fc5 - Updated the thread-safe library documentation section.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15039 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-11 08:28:32 +00:00
Olaf Barthel
d74640b15b - Getting ready to make a new release.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15038 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-11 07:37:58 +00:00
Olaf Barthel
db9a1c69e5 - Resolved the vulnerability by caching the socket descriptor while the
stdio data is still locked.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15037 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-09 14:48:19 +00:00
Olaf Barthel
cb1f1a4a10 - Removed the various workarounds associated with <unistd.h>, required
for building code that references the networking API. It is now possible,
  provided you build your code with an existing TCP/IP API header file
  set (such as from the "Roadshow" SDK) without running into data type
  or function prototype declaration conflicts. I have added local versions
  of <arpa/inet.h>, <netinet/in.h>, <netdb.h>, <sys/filio.h>, <sys/ioccom.h>,
  <sys/ioctl.h>, <sys/select.h> and <sys/socket.h> and updated <unistd.h>,
  <pwd.h> and <grp.h> accordingly. Note that some of the function prototypes
  will conflict with the bsdsocket.library/usergroup.library API, which is
  why you can disable the declarations through the __NO_NET_API preprocessor
  symbol: if defined, none of the function prototypes will be defined.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15036 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-09 12:32:18 +00:00
Olaf Barthel
bb2376a6ed - Implemented lrintf(), lrint(), lroundf(), lround(), nearbyintf(),
nearbyint(), remquof(), remquo(), roundf(), round(), tgammaf(),
  tgamma(), truncf(), trunc(). Sort of implemented fmaf() and fma(),
  which really ought to be done in "SIMD" fashion.

  This completes the "real" floating point math library (ignoring
  for a moment that the floating point environment code is still
  not implemented).


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15035 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-09 10:38:56 +00:00
Olaf Barthel
159e55f1e6 - Fixed the locking and the NULL pointer reference.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15034 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-09 09:05:27 +00:00
Olaf Barthel
4e30f5604d - accept() now calls the bsdsocket.library accept() function first
and then hooks up the socket with the clib2 data structures. This
  makes it possible to have several Processes calling the accept()
  stub at the same time.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15033 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-08 15:59:56 +00:00
Olaf Barthel
095a14bf1f - When the main() function returns directly or indirectly by way of
calling exit(), the IoErr() value set at this time will now be
  preserved until the program really returns control to the shell.
  This turned out to be easier to implement than I had originally
  thought, thanks to the fact that the atexit() functions are all
  invoked straight after the exit() call.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15032 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-09-28 10:28:38 +00:00
Olaf Barthel
f84fbc32cb - The ERANGE initialization is not necessary.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15031 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-09-28 09:51:16 +00:00
Olaf Barthel
3099f6210a - strtoimax(), strtoumax(), strtod(), strtof(), strtol(), strtoll(),
strtoul() and strtoull() now count how many digits were converted.
  If that number is zero, then the conversion is considered to have
  failed: 0 is returned, errno is set to ERANGE and the 'ptr' parameter
  reference is initialized with a pointer to the string to be converted.
  This has two consequences:

     1) A floating point number that has no digits in the significand
        is no longer converted to zero. For example ".e10" can no longer
        result in a successful conversion.

     2) You can detect if a conversion is successful by comparing pointers
        after the conversion function has returned:

           char * str;
           char * ptr;
           long n;

           n = strtol(str,&ptr,10);
           if(n == 0 && str == ptr)
              printf("conversion has failed");


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15030 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-09-28 09:28:39 +00:00
Olaf Barthel
378e50d2ab - tmpnam() wrote more than L_tmpnam bytes to the name buffer. Also, the
TMP_MAX value was off by one.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15029 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-09-04 11:28:00 +00:00
Olaf Barthel
0d85b41a2d - Following detection of a stack overflow, the startup code eventually
called _exit(). It should have called exit() instead.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15028 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-09-04 07:38:51 +00:00
146 changed files with 3524 additions and 1249 deletions

View File

@@ -1,5 +1,5 @@
# #
# $Id: GNUmakefile.68k,v 1.67 2005-08-27 12:12:50 obarthel Exp $ # $Id: GNUmakefile.68k,v 1.73 2005-10-20 07:19:15 obarthel Exp $
# #
# :ts=8 # :ts=8
# #
@@ -110,10 +110,10 @@ WARNINGS = \
# -Wconversion -Wshadow # -Wconversion -Wshadow
INCLUDES = -Iinclude -I. -Inetinclude INCLUDES = -Iinclude -I. -Inetinclude
#OPTIONS = -fno-builtin -fno-common -D__USE_CLIB2_NETLIB -DDEBUG #OPTIONS = -fno-builtin -fno-common -DDEBUG
OPTIONS = -fno-builtin -fno-common -D__USE_CLIB2_NETLIB -DNDEBUG OPTIONS = -fno-builtin -fno-common -DNDEBUG
#OPTIONS = -fno-builtin -fno-common -D__USE_CLIB2_NETLIB -D__MEM_DEBUG #OPTIONS = -fno-builtin -fno-common -D__MEM_DEBUG
#OPTIONS = -fno-builtin -fno-common -D__USE_CLIB2_NETLIB -DDEBUG -D__MEM_DEBUG -DNO_INLINE_STDARG #OPTIONS = -fno-builtin -fno-common -DDEBUG -D__MEM_DEBUG -DNO_INLINE_STDARG
OPTIMIZE = -O -fomit-frame-pointer -fstrength-reduce -finline-functions OPTIMIZE = -O -fomit-frame-pointer -fstrength-reduce -finline-functions
#OPTIMIZE = -O2 -fomit-frame-pointer #OPTIMIZE = -O2 -fomit-frame-pointer
#DEBUG = -g #DEBUG = -g
@@ -554,6 +554,8 @@ MATH_LIB = \
math_atan2.o \ math_atan2.o \
math_atan2f.o \ math_atan2f.o \
math_atanf.o \ math_atanf.o \
math_atanh.o \
math_atanhf.o \
math_cbrt.o \ math_cbrt.o \
math_cbrtf.o \ math_cbrtf.o \
math_ceil.o \ math_ceil.o \
@@ -569,15 +571,17 @@ MATH_LIB = \
math_erfcf.o \ math_erfcf.o \
math_erff.o \ math_erff.o \
math_exp.o \ math_exp.o \
math_expf.o \
math_exp2.o \ math_exp2.o \
math_exp2f.o \ math_exp2f.o \
math_expf.o \
math_expm1.o \ math_expm1.o \
math_expm1f.o \ math_expm1f.o \
math_fabs.o \ math_fabs.o \
math_fabsf.o \ math_fabsf.o \
math_floor.o \ math_floor.o \
math_floorf.o \ math_floorf.o \
math_fma.o \
math_fmaf.o \
math_fmod.o \ math_fmod.o \
math_fmodf.o \ math_fmodf.o \
math_fpclassify.o \ math_fpclassify.o \
@@ -602,28 +606,38 @@ MATH_LIB = \
math_lgamma.o \ math_lgamma.o \
math_lgammaf.o \ math_lgammaf.o \
math_log.o \ math_log.o \
math_log2.o \
math_log2f.o \
math_log10.o \ math_log10.o \
math_log10f.o \ math_log10f.o \
math_log1p.o \ math_log1p.o \
math_log1pf.o \ math_log1pf.o \
math_log2.o \
math_log2f.o \
math_logb.o \ math_logb.o \
math_logbf.o \ math_logbf.o \
math_logf.o \ math_logf.o \
math_lrint.o \
math_lrintf.o \
math_lround.o \
math_lroundf.o \
math_modf.o \ math_modf.o \
math_modff.o \ math_modff.o \
math_nan.o \ math_nan.o \
math_nanf.o \ math_nanf.o \
math_nearbyint.o \
math_nearbyintf.o \
math_nextafter.o \ math_nextafter.o \
math_nextafterf.o \ math_nextafterf.o \
math_pow.o \ math_pow.o \
math_powf.o \ math_powf.o \
math_remainder.o \ math_remainder.o \
math_remainderf.o \ math_remainderf.o \
math_remquo.o \
math_remquof.o \
math_rem_pio2f.o \ math_rem_pio2f.o \
math_rint.o \ math_rint.o \
math_rintf.o \ math_rintf.o \
math_round.o \
math_roundf.o \
math_scalbn.o \ math_scalbn.o \
math_scalbnf.o \ math_scalbnf.o \
math_signbit.o \ math_signbit.o \
@@ -637,6 +651,10 @@ MATH_LIB = \
math_tanf.o \ math_tanf.o \
math_tanh.o \ math_tanh.o \
math_tanhf.o \ math_tanhf.o \
math_tgamma.o \
math_tgammaf.o \
math_trunc.o \
math_truncf.o \
stdio_asprintf.o \ stdio_asprintf.o \
stdio_flush.o \ stdio_flush.o \
stdio_flush_all_files.o \ stdio_flush_all_files.o \
@@ -710,6 +728,7 @@ NET_LIB = \
net.lib_rev.o \ net.lib_rev.o \
socket_accept.o \ socket_accept.o \
socket_bind.o \ socket_bind.o \
socket_check_daemon.o \
socket_connect.o \ socket_connect.o \
socket_gethostbyaddr.o \ socket_gethostbyaddr.o \
socket_gethostbyname.o \ socket_gethostbyname.o \
@@ -736,6 +755,7 @@ NET_LIB = \
socket_ioctl.o \ socket_ioctl.o \
socket_isdaemon.o \ socket_isdaemon.o \
socket_listen.o \ socket_listen.o \
socket_obtain_daemon.o \
socket_recv.o \ socket_recv.o \
socket_recvfrom.o \ socket_recvfrom.o \
socket_recvmsg.o \ socket_recvmsg.o \
@@ -748,6 +768,8 @@ NET_LIB = \
socket_socket.o \ socket_socket.o \
socket_hook_entry.o \ socket_hook_entry.o \
socket_hstrerror.o \ socket_hstrerror.o \
socket_get_h_errno.o \
socket_set_h_errno.o \
stat_umask.o \ stat_umask.o \
usergroup_crypt.o \ usergroup_crypt.o \
usergroup_data.o \ usergroup_data.o \

View File

@@ -1,5 +1,5 @@
# #
# $Id: GNUmakefile.os4,v 1.74 2005-09-03 14:45:14 obarthel Exp $ # $Id: GNUmakefile.os4,v 1.85 2005-11-04 09:35:02 obarthel Exp $
# #
# :ts=8 # :ts=8
# #
@@ -7,27 +7,50 @@
############################################################################## ##############################################################################
# You may have to tweak this for the native OS4 compiler .PHONY : all clean version cvs-tag all_libraries directories
SDK_INCLUDE = $(V)/include .PHONY : large_data_libs
NET_INCLUDE = netinclude .PHONY : large_data_softfloat_libs
.PHONY : small_data_libs
.PHONY : baserel_libs
# These are for the cross compiler # You may have to change the following sets of macro definitions which will
# be used throughout the build makefile. These definitions cover the paths
# to look into for the operating system and networking header files, and
# the names and parameters passed to the program which actually do the
# compilation, library building and cleanup work.
#
# Note that for either set you still need the GNU make utility to build the
# library!
# These are for the cross compiler, with the operating system header files
# stored in "/V/include" and the network header files in a local directory
# called "netinclude".
SDK_INCLUDE = /V/include
NET_INCLUDE = netinclude
CC = ppc-amigaos-gcc CC = ppc-amigaos-gcc
AR = ppc-amigaos-ar -q AR = ppc-amigaos-ar -q
RANLIB = ppc-amigaos-ranlib RANLIB = ppc-amigaos-ranlib
COPY = cp -a COPY = cp -a
DELETE = rm -rf DELETE = rm -rf
MAKEDIR = mkdir MAKEDIR = mkdir -p
MAKE_OPTS =
LOG_COMMAND = 2>&1 | tee -a compiler.log
# The following are for the native OS4 compiler # The following are for the native OS4 compiler; note that the
# CC = gcc # LOG_COMMAND should not be enabled unless you have a shell
# AR = ar -q # installed which supports it.
# RANLIB = ranlib #SDK_INCLUDE = /SDK/Include/include_h
# COPY = copy #NET_INCLUDE = /SDK/Include/netinclude
# DELETE = delete all quiet #CC = gcc
# MAKEDIR = makedir #AR = ar -q
#RANLIB = ranlib
#COPY = copy
#DELETE = delete all quiet
#MAKEDIR = makedir all force
#MAKE_OPTS = --jobs=1
#LOG_COMMAND = *>< | tee >>compiler.log
MAKE = $(MAKE_COMMAND) -f GNUmakefile.os4 BUILD = $(MAKE_COMMAND) -f GNUmakefile.os4 $(MAKE_OPTS)
############################################################################## ##############################################################################
@@ -54,63 +77,65 @@ endif
# General build rules for all object files and the individual libraries # General build rules for all object files and the individual libraries
%.o : %.c %.o : %.c
@echo "Compiling $<" @echo "Compiling $<"
@$(CC) -c $(CFLAGS) $< @$(CC) -c $(CFLAGS) $< $(LOG_COMMAND)
$(LIBC_OBJS)/%.o : %.c $(LIBC_OBJS)/%.o : %.c
@echo "Compiling $< [$(TYPE):c]" @echo "Compiling $< [$(TYPE):c]"
@$(CC) -o $(LIBC_OBJS)/$*.o -c $(CFLAGS) $< @$(CC) -o $(LIBC_OBJS)/$*.o -c $(CFLAGS) $< $(LOG_COMMAND)
$(LIBUNIX_OBJS)/%.o : %.c $(LIBUNIX_OBJS)/%.o : %.c
@echo "Compiling $< [$(TYPE):unix]" @echo "Compiling $< [$(TYPE):unix]"
@$(CC) -o $(LIBUNIX_OBJS)/$*.o -c $(CFLAGS) -DUNIX_PATH_SEMANTICS $< @$(CC) -o $(LIBUNIX_OBJS)/$*.o -c $(CFLAGS) -DUNIX_PATH_SEMANTICS $< $(LOG_COMMAND)
$(LIBM_OBJS)/%.o : %.c $(LIBM_OBJS)/%.o : %.c
@echo "Compiling $< [$(TYPE):m]" @echo "Compiling $< [$(TYPE):m]"
@$(CC) -o $(LIBM_OBJS)/$*.o -c $(CFLAGS) $(FLOAT_TYPE) $< @$(CC) -o $(LIBM_OBJS)/$*.o -c $(CFLAGS) $(FLOAT_TYPE) $< $(LOG_COMMAND)
$(LIBNET_OBJS)/%.o : %.c $(LIBNET_OBJS)/%.o : %.c
@echo "Compiling $< [$(TYPE):net]" @echo "Compiling $< [$(TYPE):net]"
@$(CC) -o $(LIBNET_OBJS)/$*.o -c $(CFLAGS) -I$(NET_INCLUDE) -DSOCKET_SUPPORT -DUSERGROUP_SUPPORT $< @$(CC) -o $(LIBNET_OBJS)/$*.o -c $(CFLAGS) -I$(NET_INCLUDE) -DSOCKET_SUPPORT -DUSERGROUP_SUPPORT $< $(LOG_COMMAND)
$(LIBDEBUG_OBJS)/%.o : %.c $(LIBDEBUG_OBJS)/%.o : %.c
@echo "Compiling $< [$(TYPE):debug]" @echo "Compiling $< [$(TYPE):debug]"
@$(CC) -o $(LIBDEBUG_OBJS)/$*.o -c $(CFLAGS) $< @$(CC) -o $(LIBDEBUG_OBJS)/$*.o -c $(CFLAGS) $< $(LOG_COMMAND)
$(LIBAMIGA_OBJS)/%.o : %.c $(LIBAMIGA_OBJS)/%.o : %.c
@echo "Compiling $< [$(TYPE):amiga]" @echo "Compiling $< [$(TYPE):amiga]"
@$(CC) -o $(LIBAMIGA_OBJS)/$*.o -c $(CFLAGS) $< @$(CC) -o $(LIBAMIGA_OBJS)/$*.o -c $(CFLAGS) $< $(LOG_COMMAND)
$(LIBPROFILE_OBJS)/%.o : %.c $(LIBPROFILE_OBJS)/%.o : %.c
@echo "Compiling $< [$(TYPE):profile]" @echo "Compiling $< [$(TYPE):profile]"
@$(CC) -o $(LIBPROFILE_OBJS)/$*.o -c $(CFLAGS) $< @$(CC) -o $(LIBPROFILE_OBJS)/$*.o -c $(CFLAGS) $< $(LOG_COMMAND)
$(LIBPROFILE_OBJS)/%.o : %.S $(LIBPROFILE_OBJS)/%.o : %.S
@echo "Assembling $< [$(TYPE):profile]" @echo "Assembling $< [$(TYPE):profile]"
@$(CC) -o $(LIBPROFILE_OBJS)/$*.o -Wa,-mregnames -c $(CFLAGS) $< @$(CC) -o $(LIBPROFILE_OBJS)/$*.o -Wa,-mregnames -c $(CFLAGS) $< $(LOG_COMMAND)
############################################################################## ##############################################################################
# Build options for the individual libraries # Build options and destination directory for the individual libraries
ifeq (small_data,$(TYPE)) ifeq (small_data,$(TYPE))
CODE_TYPE := -msdata=sysv -DSMALL_DATA CODE_TYPE := -msdata=sysv -DSMALL_DATA
FLOAT_TYPE := -DPPC_FLOATING_POINT_SUPPORT FLOAT_TYPE := -DPPC_FLOATING_POINT_SUPPORT
DEST_DIR := lib/small-data
endif endif
ifeq (large_data,$(TYPE)) ifeq (large_data,$(TYPE))
CODE_TYPE := -msdata=data CODE_TYPE := -msdata=data
FLOAT_TYPE := -DPPC_FLOATING_POINT_SUPPORT FLOAT_TYPE := -DPPC_FLOATING_POINT_SUPPORT
DEST_DIR := lib
endif endif
ifeq (large_data_softfloat,$(TYPE)) ifeq (large_data_softfloat,$(TYPE))
CODE_TYPE := -msdata=data -msoft-float CODE_TYPE := -msdata=data -msoft-float
FLOAT_TYPE := FLOAT_TYPE :=
DEST_DIR := lib/soft-float
endif endif
ifeq (baserel,$(TYPE)) ifeq (baserel,$(TYPE))
CODE_TYPE := -mbaserel -DBASEREL_DATA CODE_TYPE := -mbaserel -DBASEREL_DATA
FLOAT_TYPE := -DPPC_FLOATING_POINT_SUPPORT FLOAT_TYPE := -DPPC_FLOATING_POINT_SUPPORT
DEST_DIR := lib/baserel
endif endif
############################################################################## ##############################################################################
@@ -122,8 +147,8 @@ WARNINGS = \
# -Wconversion -Wshadow # -Wconversion -Wshadow
INCLUDES = -Iinclude -I. -I$(SDK_INCLUDE) INCLUDES = -Iinclude -I. -I$(SDK_INCLUDE)
OPTIONS = -D__THREAD_SAFE -D__USE_CLIB2_NETLIB -DNDEBUG -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames -fno-common -std=gnu99 #OPTIONS = -D__THREAD_SAFE -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 OPTIONS = -DNDEBUG -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames -fno-common -std=gnu99
OPTIMIZE = -O3 OPTIMIZE = -O3
#DEBUG = -ggdb #DEBUG = -ggdb
@@ -566,6 +591,8 @@ MATH_LIB = \
math_atan2.o \ math_atan2.o \
math_atan2f.o \ math_atan2f.o \
math_atanf.o \ math_atanf.o \
math_atanh.o \
math_atanhf.o \
math_cbrt.o \ math_cbrt.o \
math_cbrtf.o \ math_cbrtf.o \
math_ceil.o \ math_ceil.o \
@@ -581,15 +608,17 @@ MATH_LIB = \
math_erfcf.o \ math_erfcf.o \
math_erff.o \ math_erff.o \
math_exp.o \ math_exp.o \
math_expf.o \
math_exp2.o \ math_exp2.o \
math_exp2f.o \ math_exp2f.o \
math_expf.o \
math_expm1.o \ math_expm1.o \
math_expm1f.o \ math_expm1f.o \
math_fabs.o \ math_fabs.o \
math_fabsf.o \ math_fabsf.o \
math_floor.o \ math_floor.o \
math_floorf.o \ math_floorf.o \
math_fma.o \
math_fmaf.o \
math_fmod.o \ math_fmod.o \
math_fmodf.o \ math_fmodf.o \
math_fpclassify.o \ math_fpclassify.o \
@@ -620,28 +649,36 @@ MATH_LIB = \
math_lgamma.o \ math_lgamma.o \
math_lgammaf.o \ math_lgammaf.o \
math_log.o \ math_log.o \
math_log2.o \
math_log2f.o \
math_log10.o \ math_log10.o \
math_log10f.o \ math_log10f.o \
math_log1p.o \ math_log1p.o \
math_log1pf.o \ math_log1pf.o \
math_log2.o \
math_log2f.o \
math_logb.o \ math_logb.o \
math_logbf.o \ math_logbf.o \
math_logf.o \ math_logf.o \
math_lround.o \
math_lroundf.o \
math_modf.o \ math_modf.o \
math_modff.o \ math_modff.o \
math_nan.o \ math_nan.o \
math_nanf.o \ math_nanf.o \
math_nearbyint.o \
math_nearbyintf.o \
math_nextafter.o \ math_nextafter.o \
math_nextafterf.o \ math_nextafterf.o \
math_pow.o \ math_pow.o \
math_powf.o \ math_powf.o \
math_remainder.o \ math_remainder.o \
math_remainderf.o \ math_remainderf.o \
math_remquo.o \
math_remquof.o \
math_rem_pio2f.o \ math_rem_pio2f.o \
math_rint.o \ math_rint.o \
math_rintf.o \ math_rintf.o \
math_round.o \
math_roundf.o \
math_scalbn.o \ math_scalbn.o \
math_scalbnf.o \ math_scalbnf.o \
math_signbit.o \ math_signbit.o \
@@ -655,6 +692,10 @@ MATH_LIB = \
math_tanf.o \ math_tanf.o \
math_tanh.o \ math_tanh.o \
math_tanhf.o \ math_tanhf.o \
math_tgamma.o \
math_tgammaf.o \
math_trunc.o \
math_truncf.o \
stdio_asprintf.o \ stdio_asprintf.o \
stdio_flush.o \ stdio_flush.o \
stdio_flush_all_files.o \ stdio_flush_all_files.o \
@@ -683,6 +724,7 @@ NET_LIB = \
net.lib_rev.o \ net.lib_rev.o \
socket_accept.o \ socket_accept.o \
socket_bind.o \ socket_bind.o \
socket_check_daemon.o \
socket_connect.o \ socket_connect.o \
socket_gethostbyaddr.o \ socket_gethostbyaddr.o \
socket_gethostbyname.o \ socket_gethostbyname.o \
@@ -709,6 +751,7 @@ NET_LIB = \
socket_ioctl.o \ socket_ioctl.o \
socket_isdaemon.o \ socket_isdaemon.o \
socket_listen.o \ socket_listen.o \
socket_obtain_daemon.o \
socket_recv.o \ socket_recv.o \
socket_recvfrom.o \ socket_recvfrom.o \
socket_recvmsg.o \ socket_recvmsg.o \
@@ -721,6 +764,8 @@ NET_LIB = \
socket_socket.o \ socket_socket.o \
socket_hook_entry.o \ socket_hook_entry.o \
socket_hstrerror.o \ socket_hstrerror.o \
socket_get_h_errno.o \
socket_set_h_errno.o \
stat_umask.o \ stat_umask.o \
usergroup_crypt.o \ usergroup_crypt.o \
usergroup_data.o \ usergroup_data.o \
@@ -855,48 +900,47 @@ STARTUPS := crt0.o crtbegin.o crtend.o
############################################################################## ##############################################################################
# This is the first target: it creates the necessary directories, then proceeds # This is the first target: it creates the necessary directories, then proceeds
# to build the startup object files and finally the libraries # to build the startup object files and libraries
all: \ all: \
lib \ directories \
lib/soft-float \ large_data_libs \
lib/small-data \ large_data_softfloat_libs \
lib/baserel \ small_data_libs \
small_data \ baserel_libs
large_data \
large_data_softfloat \ ##############################################################################
baserel \
lib/crt0.o \ # Create all the directories
lib/crtbegin.o \ directories:
lib/crtend.o \ @-$(MAKEDIR) lib
lib/libm.a \ @-$(MAKEDIR) lib/small-data
lib/small-data/crt0.o \ @-$(MAKEDIR) lib/soft-float
lib/small-data/crtbegin.o \ @-$(MAKEDIR) lib/baserel
lib/small-data/crtend.o \ @-$(MAKEDIR) small_data
lib/small-data/libm.a \ @-$(MAKEDIR) large_data
lib/soft-float/libm.a \ @-$(MAKEDIR) large_data_softfloat
lib/baserel/crt0.o \ @-$(MAKEDIR) baserel
lib/baserel/crtbegin.o \
lib/baserel/crtend.o \
lib/baserel/libm.a
############################################################################## ##############################################################################
# Delete all object files and libraries # Delete all object files and libraries
clean: clean:
-$(DELETE) $(STARTUPS) lib small_data large_data large_data_softfloat baserel -$(DELETE) $(STARTUPS) lib \
small_data large_data large_data_softfloat baserel \
compiler.log
############################################################################## ##############################################################################
# Update the version numbers bound to the individual libraries # Update the version numbers bound to the individual libraries
version: version:
cp c.lib_rev.rev amiga.lib_rev.rev $(COPY) c.lib_rev.rev amiga.lib_rev.rev
cp c.lib_rev.rev debug.lib_rev.rev $(COPY) c.lib_rev.rev debug.lib_rev.rev
cp c.lib_rev.rev m.lib_rev.rev $(COPY) c.lib_rev.rev m.lib_rev.rev
cp c.lib_rev.rev m881.lib_rev.rev $(COPY) c.lib_rev.rev m881.lib_rev.rev
cp c.lib_rev.rev net.lib_rev.rev $(COPY) c.lib_rev.rev net.lib_rev.rev
cp c.lib_rev.rev stack.lib_rev.rev $(COPY) c.lib_rev.rev stack.lib_rev.rev
cp c.lib_rev.rev unix.lib_rev.rev $(COPY) c.lib_rev.rev unix.lib_rev.rev
cp c.lib_rev.rev profile.lib_rev.rev $(COPY) c.lib_rev.rev profile.lib_rev.rev
bumprev 1 amiga.lib bumprev 1 amiga.lib
bumprev 1 c.lib bumprev 1 c.lib
bumprev 1 debug.lib bumprev 1 debug.lib
@@ -918,107 +962,67 @@ cvs-tag:
# This target first creates a directory to store the object files in, then # This target first creates a directory to store the object files in, then
# proceeds to build the libraries from the code. It is invoked by the # proceeds to build the libraries from the code. It is invoked by the
# individual library build targets below. # individual library build targets below.
all_libraries: $(TYPE) $(LIBS) all_libraries: $(LIBS)
############################################################################## ##############################################################################
# These create the required subdirectories to store object files and # Dependencies for large data variant with hardware floating point code
# libraries in # support.
lib: large_data_libs: $(addprefix lib/,$(STARTUPS))
-$(MAKEDIR) $@ @-$(MAKEDIR) $(addprefix large_data/,$(dir $(LIBS)))
$(BUILD) TYPE=large_data all_libraries
lib/small-data: lib
-$(MAKEDIR) $@
lib/soft-float: lib
-$(MAKEDIR) $@
lib/baserel: lib
-$(MAKEDIR) $@
small_data:
-$(MAKEDIR) $@
large_data:
-$(MAKEDIR) $@
large_data_softfloat:
-$(MAKEDIR) $@
baserel:
-$(MAKEDIR) $@
############################################################################## ##############################################################################
# Dependencies for libm.a (large data variant with hardware floating point code # Dependencies for large data variant with software floating point code
# support): this actually ends up building all the libraries rather than just # support.
# libm.a large_data_softfloat_libs: $(addprefix lib/,$(STARTUPS))
lib/libm.a: large_data large_data/libm.a @-$(MAKEDIR) $(addprefix large_data_softfloat/,$(dir $(LIBS)))
$(BUILD) TYPE=large_data_softfloat all_libraries
large_data/libm.a:
$(MAKE) TYPE=large_data all_libraries
$(COPY) $(foreach file,$(LIBS),large_data/$(file)) lib
############################################################################## ##############################################################################
# Dependencies for libm.a (large data variant with software floating point code # Dependencies for small data variant.
# support): this actually ends up building all the libraries rather than just small_data_libs: $(addprefix lib/small-data/,$(STARTUPS))
# libm.a @-$(MAKEDIR) $(addprefix small_data/,$(dir $(LIBS)))
lib/soft-float/libm.a: large_data_softfloat large_data_softfloat/libm.a $(BUILD) TYPE=small_data all_libraries
large_data_softfloat/libm.a:
$(MAKE) TYPE=large_data_softfloat all_libraries
$(COPY) $(foreach file,$(LIBS),large_data_softfloat/$(file)) lib/soft-float
############################################################################## ##############################################################################
# Dependencies for libm.a (small data variant): this actually ends up building all # Dependencies for baserel variant.
# the libraries rather than just libm.a baserel_libs: $(addprefix lib/baserel/,$(STARTUPS))
lib/small-data/libm.a: small_data small_data/libm.a @-$(MAKEDIR) $(addprefix baserel/,$(dir $(LIBS)))
$(BUILD) TYPE=baserel all_libraries
small_data/libm.a:
$(MAKE) TYPE=small_data all_libraries
$(COPY) $(foreach file,$(LIBS),small_data/$(file)) lib/small-data
##############################################################################
# Dependencies for libm.a (baserel variant)
lib/baserel/libm.a: baserel baserel/libm.a
baserel/libm.a:
$(MAKE) TYPE=baserel all_libraries
$(COPY) $(foreach file,$(LIBS),baserel/$(file)) lib/baserel
############################################################################## ##############################################################################
# Rules to build and move the startup code # Rules to build and move the startup code
lib/crt0.o : lib crt0.o lib/crt0.o : crt0.o
$(COPY) crt0.o lib $(COPY) $< $(dir $@)
lib/crtbegin.o : lib crtbegin.o lib/crtbegin.o : crtbegin.o
$(COPY) crtbegin.o lib $(COPY) $< $(dir $@)
lib/crtend.o : lib crtend.o lib/crtend.o : crtend.o
$(COPY) crtend.o lib $(COPY) $< $(dir $@)
lib/small-data/crt0.o : lib small_data/crt0.o lib/small-data/crt0.o : small_data/crt0.o
$(COPY) small_data/crt0.o lib/small-data $(COPY) $< $(dir $@)
lib/small-data/crtbegin.o : lib small_data/crtbegin.o lib/small-data/crtbegin.o : small_data/crtbegin.o
$(COPY) small_data/crtbegin.o lib/small-data $(COPY) $< $(dir $@)
lib/small-data/crtend.o : lib small_data/crtend.o lib/small-data/crtend.o : small_data/crtend.o
$(COPY) small_data/crtend.o lib/small-data $(COPY) $< $(dir $@)
lib/baserel/crt0.o : lib baserel/crt0.o lib/baserel/crt0.o : baserel/crt0.o
$(COPY) baserel/crt0.o lib/baserel $(COPY) $< $(dir $@)
lib/baserel/crtbegin.o : lib baserel/crtbegin.o lib/baserel/crtbegin.o : baserel/crtbegin.o
$(COPY) baserel/crtbegin.o lib/baserel $(COPY) $< $(dir $@)
lib/baserel/crtend.o : lib baserel/crtend.o lib/baserel/crtend.o : baserel/crtend.o
$(COPY) baserel/crtend.o lib/baserel $(COPY) $< $(dir $@)
############################################################################## ##############################################################################
@@ -1071,153 +1075,138 @@ $(LIBC_OBJS)/stdlib_red_black.o : stdlib_red_black.c stdlib_memory.h
# or at least those which use memory allocation functionality. # or at least those which use memory allocation functionality.
$(LIBC_OBJS)/stdlib_alloca_debug.o : stdlib_alloca.c $(LIBC_OBJS)/stdlib_alloca_debug.o : stdlib_alloca.c
@echo "Compiling $< [$(TYPE):c debug]" @echo "Compiling $< [$(TYPE):c debug]"
@$(CC) -o $(LIBC_OBJS)/stdlib_alloca_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_alloca.c @$(CC) -o $(LIBC_OBJS)/stdlib_alloca_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_alloca.c $(LOG_COMMAND)
$(LIBC_OBJS)/stdlib_calloc_debug.o : stdlib_calloc.c $(LIBC_OBJS)/stdlib_calloc_debug.o : stdlib_calloc.c
@echo "Compiling $< [$(TYPE):c debug]" @echo "Compiling $< [$(TYPE):c debug]"
@$(CC) -o $(LIBC_OBJS)/stdlib_calloc_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_calloc.c @$(CC) -o $(LIBC_OBJS)/stdlib_calloc_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_calloc.c $(LOG_COMMAND)
$(LIBC_OBJS)/stdlib_free_debug.o : stdlib_free.c $(LIBC_OBJS)/stdlib_free_debug.o : stdlib_free.c
@echo "Compiling $< [$(TYPE):c debug]" @echo "Compiling $< [$(TYPE):c debug]"
@$(CC) -o $(LIBC_OBJS)/stdlib_free_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_free.c @$(CC) -o $(LIBC_OBJS)/stdlib_free_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_free.c $(LOG_COMMAND)
$(LIBC_OBJS)/stdlib_malloc_debug.o : stdlib_malloc.c $(LIBC_OBJS)/stdlib_malloc_debug.o : stdlib_malloc.c
@echo "Compiling $< [$(TYPE):c debug]" @echo "Compiling $< [$(TYPE):c debug]"
@$(CC) -o $(LIBC_OBJS)/stdlib_malloc_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_malloc.c @$(CC) -o $(LIBC_OBJS)/stdlib_malloc_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_malloc.c $(LOG_COMMAND)
$(LIBC_OBJS)/stdlib_realloc_debug.o : stdlib_realloc.c $(LIBC_OBJS)/stdlib_realloc_debug.o : stdlib_realloc.c
@echo "Compiling $< [$(TYPE):c debug]" @echo "Compiling $< [$(TYPE):c debug]"
@$(CC) -o $(LIBC_OBJS)/stdlib_realloc_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_realloc.c @$(CC) -o $(LIBC_OBJS)/stdlib_realloc_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_realloc.c $(LOG_COMMAND)
$(LIBC_OBJS)/stdio_vasprintf_hook_entry_debug.o : stdio_vasprintf_hook_entry.c $(LIBC_OBJS)/stdio_vasprintf_hook_entry_debug.o : stdio_vasprintf_hook_entry.c
@echo "Compiling $< [$(TYPE):c debug]" @echo "Compiling $< [$(TYPE):c debug]"
@$(CC) -o $(LIBC_OBJS)/stdio_vasprintf_hook_entry_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdio_vasprintf_hook_entry.c @$(CC) -o $(LIBC_OBJS)/stdio_vasprintf_hook_entry_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdio_vasprintf_hook_entry.c $(LOG_COMMAND)
$(LIBC_OBJS)/stdio_vasprintf_debug.o : stdio_vasprintf.c $(LIBC_OBJS)/stdio_vasprintf_debug.o : stdio_vasprintf.c
@echo "Compiling $< [$(TYPE):c debug]" @echo "Compiling $< [$(TYPE):c debug]"
@$(CC) -o $(LIBC_OBJS)/stdio_vasprintf_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdio_vasprintf.c @$(CC) -o $(LIBC_OBJS)/stdio_vasprintf_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdio_vasprintf.c $(LOG_COMMAND)
$(LIBM_OBJS)/stdio_vasprintf_debug.o : stdio_vasprintf.c $(LIBM_OBJS)/stdio_vasprintf_debug.o : stdio_vasprintf.c
@echo "Compiling $< [$(TYPE):m debug]" @echo "Compiling $< [$(TYPE):m debug]"
@$(CC) -o $(LIBM_OBJS)/stdio_vasprintf_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG $(FLOAT_TYPE) stdio_vasprintf.c @$(CC) -o $(LIBM_OBJS)/stdio_vasprintf_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG $(FLOAT_TYPE) stdio_vasprintf.c $(LOG_COMMAND)
$(LIBC_OBJS)/string_strdup_debug.o : string_strdup.c $(LIBC_OBJS)/string_strdup_debug.o : string_strdup.c
@echo "Compiling $< [$(TYPE):c debug]" @echo "Compiling $< [$(TYPE):c debug]"
@$(CC) -o $(LIBC_OBJS)/string_strdup_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG string_strdup.c @$(CC) -o $(LIBC_OBJS)/string_strdup_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG string_strdup.c $(LOG_COMMAND)
$(LIBC_OBJS)/unistd_getcwd_debug.o : unistd_getcwd.c $(LIBC_OBJS)/unistd_getcwd_debug.o : unistd_getcwd.c
@echo "Compiling $< [$(TYPE):c debug]" @echo "Compiling $< [$(TYPE):c debug]"
@$(CC) -o $(LIBC_OBJS)/unistd_getcwd_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG unistd_getcwd.c @$(CC) -o $(LIBC_OBJS)/unistd_getcwd_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG unistd_getcwd.c $(LOG_COMMAND)
$(LIBUNIX_OBJS)/unistd_getcwd_debug.o : unistd_getcwd.c $(LIBUNIX_OBJS)/unistd_getcwd_debug.o : unistd_getcwd.c
@echo "Compiling $< [$(TYPE):unix debug]" @echo "Compiling $< [$(TYPE):unix debug]"
@$(CC) -o $(LIBUNIX_OBJS)/unistd_getcwd_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG -DUNIX_PATH_SEMANTICS unistd_getcwd.c @$(CC) -o $(LIBUNIX_OBJS)/unistd_getcwd_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG -DUNIX_PATH_SEMANTICS unistd_getcwd.c $(LOG_COMMAND)
############################################################################## ##############################################################################
# Individual build rules for libc.a # Individual build rules for libc.a
$(LIBC_OBJS) : $(LIBC_OBJS)/libc.a : $(foreach file,$(C_LIB),$(LIBC_OBJS)/$(file))
$(MAKEDIR) $@
$(LIBC_OBJS)/libc.a : $(LIBC_OBJS) $(foreach file,$(C_LIB),$(LIBC_OBJS)/$(file))
-$(DELETE) $@ -$(DELETE) $@
@$(AR) $@ $(foreach file,$(C_LIB),$(LIBC_OBJS)/$(file)) @$(AR) $@ $(foreach file,$(C_LIB),$(LIBC_OBJS)/$(file))
$(RANLIB) $@ $(RANLIB) $@
$(COPY) $@ $(DEST_DIR)
############################################################################## ##############################################################################
# Individual build rules for libunix.a # Individual build rules for libunix.a
$(LIBUNIX_OBJS) : $(LIBUNIX_OBJS)/libunix.a : $(foreach file,$(UNIX_LIB),$(LIBUNIX_OBJS)/$(file))
$(MAKEDIR) $@
$(LIBUNIX_OBJS)/libunix.a : $(LIBUNIX_OBJS) $(foreach file,$(UNIX_LIB),$(LIBUNIX_OBJS)/$(file))
-$(DELETE) $@ -$(DELETE) $@
@$(AR) $@ $(foreach file,$(UNIX_LIB),$(LIBUNIX_OBJS)/$(file)) @$(AR) $@ $(foreach file,$(UNIX_LIB),$(LIBUNIX_OBJS)/$(file))
$(RANLIB) $@ $(RANLIB) $@
$(COPY) $@ $(DEST_DIR)
############################################################################## ##############################################################################
# Individual build rules for libm.a # Individual build rules for libm.a
$(LIBM_OBJS) : $(LIBM_OBJS)/libm.a : $(foreach file,$(MATH_LIB),$(LIBM_OBJS)/$(file))
$(MAKEDIR) $@
$(LIBM_OBJS)/libm.a : $(LIBM_OBJS) $(foreach file,$(MATH_LIB),$(LIBM_OBJS)/$(file))
-$(DELETE) $@ -$(DELETE) $@
@$(AR) $@ $(foreach file,$(MATH_LIB),$(LIBM_OBJS)/$(file)) @$(AR) $@ $(foreach file,$(MATH_LIB),$(LIBM_OBJS)/$(file))
$(RANLIB) $@ $(RANLIB) $@
$(COPY) $@ $(DEST_DIR)
############################################################################## ##############################################################################
# Individual build rules for libnet.a # Individual build rules for libnet.a
$(LIBNET_OBJS) : $(LIBNET_OBJS)/libnet.a : $(foreach file,$(NET_LIB),$(LIBNET_OBJS)/$(file))
$(MAKEDIR) $@
$(LIBNET_OBJS)/libnet.a : $(LIBNET_OBJS) $(foreach file,$(NET_LIB),$(LIBNET_OBJS)/$(file))
-$(DELETE) $@ -$(DELETE) $@
@$(AR) $@ $(foreach file,$(NET_LIB),$(LIBNET_OBJS)/$(file)) @$(AR) $@ $(foreach file,$(NET_LIB),$(LIBNET_OBJS)/$(file))
$(RANLIB) $@ $(RANLIB) $@
$(COPY) $@ $(DEST_DIR)
############################################################################## ##############################################################################
# Individual build rules for libdebug.a # Individual build rules for libdebug.a
$(LIBDEBUG_OBJS) : $(LIBDEBUG_OBJS)/libdebug.a : $(foreach file,$(DEBUG_LIB),$(LIBDEBUG_OBJS)/$(file))
$(MAKEDIR) $@
$(LIBDEBUG_OBJS)/libdebug.a : $(LIBDEBUG_OBJS) $(foreach file,$(DEBUG_LIB),$(LIBDEBUG_OBJS)/$(file))
-$(DELETE) $@ -$(DELETE) $@
@$(AR) $@ $(foreach file,$(DEBUG_LIB),$(LIBDEBUG_OBJS)/$(file)) @$(AR) $@ $(foreach file,$(DEBUG_LIB),$(LIBDEBUG_OBJS)/$(file))
$(RANLIB) $@ $(RANLIB) $@
$(COPY) $@ $(DEST_DIR)
############################################################################## ##############################################################################
# Individual build rules for libamiga.a # Individual build rules for libamiga.a
$(LIBAMIGA_OBJS) : $(LIBAMIGA_OBJS)/libamiga.a : $(foreach file,$(AMIGA_LIB),$(LIBAMIGA_OBJS)/$(file))
$(MAKEDIR) $@
$(LIBAMIGA_OBJS)/libamiga.a : $(LIBAMIGA_OBJS) $(foreach file,$(AMIGA_LIB),$(LIBAMIGA_OBJS)/$(file))
-$(DELETE) $@ -$(DELETE) $@
@$(AR) $@ $(foreach file,$(AMIGA_LIB),$(LIBAMIGA_OBJS)/$(file)) @$(AR) $@ $(foreach file,$(AMIGA_LIB),$(LIBAMIGA_OBJS)/$(file))
$(RANLIB) $@ $(RANLIB) $@
$(COPY) $@ $(DEST_DIR)
############################################################################## ##############################################################################
# Individual build rules for libprofile.a # Individual build rules for libprofile.a
$(LIBPROFILE_OBJS) : $(LIBPROFILE_OBJS)/libprofile.a : $(foreach file,$(PROFILE_LIB),$(LIBPROFILE_OBJS)/$(file))
$(MAKEDIR) $@
$(LIBPROFILE_OBJS)/libprofile.a : $(LIBPROFILE_OBJS) $(foreach file,$(PROFILE_LIB),$(LIBPROFILE_OBJS)/$(file))
-$(DELETE) $@ -$(DELETE) $@
@$(AR) $@ $(foreach file,$(PROFILE_LIB),$(LIBPROFILE_OBJS)/$(file)) @$(AR) $@ $(foreach file,$(PROFILE_LIB),$(LIBPROFILE_OBJS)/$(file))
$(RANLIB) $@ $(RANLIB) $@
$(COPY) $@ $(DEST_DIR)
############################################################################## ##############################################################################
# Individual build rules for the startup code. # Individual build rules for the startup code.
crt0.o : crt0.S crt0.o : crt0.S
@echo "Assembling $<" @echo "Assembling $<"
@$(CC) -Wa,-mregnames -o crt0.o -c crt0.S @$(CC) -Wa,-mregnames -o crt0.o -c crt0.S $(LOG_COMMAND)
small_data/crt0.o : crt0.S small_data/crt0.o : crt0.S
@echo "Assembling $<" @echo "Assembling $<"
@$(CC) -DSMALL_DATA -Wa,-mregnames -o small_data/crt0.o -c crt0.S @$(CC) -DSMALL_DATA -Wa,-mregnames -o small_data/crt0.o -c crt0.S $(LOG_COMMAND)
small_data/crtbegin.o : crtbegin.c small_data/crtbegin.o : crtbegin.c
@echo "Assembling $<" @echo "Assembling $<"
@$(CC) -o small_data/crtbegin.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -msdata=sysv -DSMALL_DATA crtbegin.c @$(CC) -o small_data/crtbegin.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -msdata=sysv -DSMALL_DATA crtbegin.c $(LOG_COMMAND)
small_data/crtend.o : crtend.c small_data/crtend.o : crtend.c
@echo "Assembling $<" @echo "Assembling $<"
@$(CC) -o small_data/crtend.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -msdata=sysv -DSMALL_DATA crtend.c @$(CC) -o small_data/crtend.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -msdata=sysv -DSMALL_DATA crtend.c $(LOG_COMMAND)
baserel/crt0.o : crt0.S baserel/crt0.o : crt0.S
@echo "Assembling $<" @echo "Assembling $<"
@$(CC) -Wa,-mregnames -o baserel/crt0.o -mbaserel -DBASEREL_DATA -c crt0.S @$(CC) -Wa,-mregnames -o baserel/crt0.o -mbaserel -DBASEREL_DATA -c crt0.S $(LOG_COMMAND)
baserel/crtbegin.o : crtbegin.c baserel/crtbegin.o : crtbegin.c
@echo "Assembling $<" @echo "Assembling $<"
@$(CC) -o baserel/crtbegin.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -mbaserel -DBASEREL_DATA crtbegin.c @$(CC) -o baserel/crtbegin.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -mbaserel -DBASEREL_DATA crtbegin.c $(LOG_COMMAND)
baserel/crtend.o : crtend.c baserel/crtend.o : crtend.c
@echo "Assembling $<" @echo "Assembling $<"
@$(CC) -o baserel/crtend.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -mbaserel -DBASEREL_DATA crtend.c @$(CC) -o baserel/crtend.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -mbaserel -DBASEREL_DATA crtend.c $(LOG_COMMAND)

View File

@@ -1,19 +1,5 @@
C99 math functions: C99 math functions:
(functions generally missing, including their "float" counterparts) fma() and fmaf() should be implemented as a true "fused" multiply
fma and add function rather than the sequential operation implied in the
fmaf current implementation.
lrint
lrintf
lround
lroundf
nearbyint
nearbyintf
remquo
remquof
round
roundf
tgamma
tgammaf
trunc
truncf

View File

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

View File

@@ -1 +1 @@
195 197

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: amiga_argarrayinit.c,v 1.2 2005-01-02 09:07:06 obarthel Exp $ * $Id: amiga_argarrayinit.c,v 1.3 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -61,11 +61,11 @@ struct DiskObject * CXLIB_disko;
STRPTR * STRPTR *
ArgArrayInit(LONG argc, CONST_STRPTR * argv) ArgArrayInit(LONG argc, CONST_STRPTR * argv)
{ {
unsigned char ** result = NULL; STRPTR * result = NULL;
if(argc != 0) /* run from CLI */ if(argc != 0) /* run from CLI */
{ {
int i; LONG i;
if(argc == 1) if(argc == 1)
goto out; /* skip command name */ goto out; /* skip command name */

View File

@@ -15,7 +15,7 @@ copy include ram:${dir_name}/include all clone quiet
copy changes ram:$dir_name clone copy changes ram:$dir_name clone
; Delete the CVS data from the include directory ; Delete the CVS data from the include directory
delete ram:${dir_name}/include/CVS ram:${dir_name}/include/sys/CVS all quiet delete ram:${dir_name}/include/CVS ram:${dir_name}/include/sys/CVS ram:${dir_name}/include/arpa/CVS ram:${dir_name}/include/netinet/CVS all quiet
; Finally, create an lha archive in RAM: ; Finally, create an lha archive in RAM:
pushcd ram: pushcd ram:

View File

@@ -19,7 +19,7 @@ cp -a include $dir_name
cp changes $dir_name cp changes $dir_name
# Delete the CVS data from the include directory # Delete the CVS data from the include directory
rm -rf ${dir_name}/include/CVS ${dir_name}/include/sys/CVS rm -rf ${dir_name}/include/CVS ${dir_name}/include/sys/CVS ${dir_name}/include/arpa/CVS ${dir_name}/include/netinet/CVS
# Finally, create an lha type 5 archive; the Amiga LhA port # Finally, create an lha type 5 archive; the Amiga LhA port
# can unpack it. # can unpack it.

View File

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

View File

@@ -1 +1 @@
195 197

View File

@@ -1,3 +1,113 @@
c.lib 1.197 (4.11.2005)
- Updated math_hypot.c to a newer (e_hypot.c 1.3 95/01/18) version from
fdlibm which uses macros for manipulating the high and low words of a
double, like the rest of fdlibm functions in clib2. The previous version
would give bogus results when compiled with -O3 in clib2 which lead to
"interesting" results (and lots of fun while searching for the problem)
in Ghostscript. Wish I managed to track this down yesterday for 1.196
release... <aantonijevic>
- Implemented atanh() and atanhf() which were not listed in the TODO
file but were still unimplemented up until now.
- Replaced ldexp() and modf().
- Added __set_h_errno() and __get_h_errno() functions.
- The thread-safe library now tries to enable bsdsocket.library base
sharing and attempts to make the TCP/IP stack call the local
__set_errno() and __set_h_errno(), so that any Process calling
the library functions will get a chance to see proper error
codes. Whether any of these features could be enabled can be tested
through two global variables __can_share_socket_library_base and
__thread_safe_errno_h_errno which are defined in <dos.h>. Note that
for both features to work you will need the Roadshow bsdsocket.library
version 4.275 or higher.
- In <stdbool.h> the preprocessor definition should read
"__bool_true_false_are_defined" rather than "__bool_true_and_false_are_defined".
Thanks go to Peter Bengtsson for finding and fixing it.
- The network startup code no longer checks for the presence of a possible
daemon startup message by default. You now have to enable this feature
by declaring a global variable called "__check_daemon_startup" which is
described in <dos.h>.
- Moved the code which rebinds the standard I/O streams to the server
socket into a separate function which can be overridden by user code.
- Updated the new __obtain_daemon_message() function to call a
bsdsocket.library API function to determine if what appears to be
a valid daemon startup message is sound.
- Replaced the OS4 specific build makefile with an updated version
prepared by Steven Solie. Thank you very much!
c.lib 1.196 (11.10.2005)
- Removed the various workarounds associated with <unistd.h>, required
for building code that references the networking API. It is now possible,
provided you build your code with an existing TCP/IP API header file
set (such as from the "Roadshow" SDK) without running into data type
or function prototype declaration conflicts. I have added local versions
of <arpa/inet.h>, <netinet/in.h>, <netdb.h>, <sys/filio.h>, <sys/ioccom.h>,
<sys/ioctl.h>, <sys/select.h> and <sys/socket.h> and updated <unistd.h>,
<pwd.h> and <grp.h> accordingly. Note that some of the function prototypes
will conflict with the bsdsocket.library/usergroup.library API, which is
why you can disable the declarations through the __NO_NET_API preprocessor
symbol: if defined, none of the function prototypes will be defined.
- Implemented lrintf(), lrint(), lroundf(), lround(), nearbyintf(),
nearbyint(), remquof(), remquo(), roundf(), round(), tgammaf(),
tgamma(), truncf(), trunc(). Sort of implemented fmaf() and fma(),
which really ought to be done in "SIMD" fashion.
This completes the "real" floating point math library (ignoring
for a moment that the floating point environment code is still
not implemented).
- accept() now calls the bsdsocket.library accept() function first
and then hooks up the socket with the clib2 data structures. This
makes it possible to have several Processes calling the accept()
stub at the same time.
- When the main() function returns directly or indirectly by way of
calling exit(), the IoErr() value set at this time will now be
preserved until the program really returns control to the shell.
This turned out to be easier to implement than I had originally
thought, thanks to the fact that the atexit() functions are all
invoked straight after the exit() call.
- strtoimax(), strtoumax(), strtod(), strtof(), strtol(), strtoll(),
strtoul() and strtoull() now count how many digits were converted.
If that number is zero, then the conversion is considered to have
failed: 0 is returned and the 'ptr' parameter reference is initialized
with a pointer to the string to be converted. This has two consequences:
1) A floating point number that has no digits in the significand
is no longer converted to zero. For example ".e10" can no longer
result in a successful conversion.
2) You can detect if a conversion is successful by comparing pointers
after the conversion function has returned:
char * str;
char * ptr;
long n;
n = strtol(str,&ptr,10);
if(n == 0 && str == ptr)
printf("conversion has failed");
- Following detection of a stack overflow, the startup code eventually
called _exit(). It should have called exit() instead.
- tmpnam() wrote more than L_tmpnam bytes to the name buffer. Also, the
TMP_MAX value was off by one.
c.lib 1.195 (3.9.2005) c.lib 1.195 (3.9.2005)
- In __time_delay() the CheckIO() test was wrong and should have - In __time_delay() the CheckIO() test was wrong and should have

View File

@@ -1,12 +1,12 @@
// //
// $Id: crt0.S,v 1.5 2005-08-26 12:39:33 obarthel Exp $ // $Id: crt0.S,v 1.6 2005-10-11 09:28:29 obarthel Exp $
// //
// :ts=4 // :ts=4
// //
.text .text
.globl main | This enforces linkage against the main() function .globl main /* This enforces linkage against the main() function */
.globl _main .globl _main
.globl _start .globl _start

View File

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

View File

@@ -1 +1 @@
195 197

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: dirent_readdir.c,v 1.7 2005-02-03 16:56:15 obarthel Exp $ * $Id: dirent_readdir.c,v 1.8 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -96,7 +96,7 @@ readdir(DIR * directory_pointer)
if(dh->dh_VolumeNode == NULL && NOT IsListEmpty((struct List *)&dh->dh_VolumeList)) if(dh->dh_VolumeNode == NULL && NOT IsListEmpty((struct List *)&dh->dh_VolumeList))
dh->dh_VolumeNode = (struct Node *)dh->dh_VolumeList.mlh_Head; dh->dh_VolumeNode = (struct Node *)dh->dh_VolumeList.mlh_Head;
strcpy(name,"\1:"); /* BSTR for ":" */ strcpy((char *)name,"\1:"); /* BSTR for ":" */
while(result == NULL && dh->dh_VolumeNode != NULL && dh->dh_VolumeNode->ln_Succ != NULL) while(result == NULL && dh->dh_VolumeNode != NULL && dh->dh_VolumeNode->ln_Succ != NULL)
{ {

View File

@@ -0,0 +1,80 @@
/*
* $Id: inet.h,v 1.1 2005-10-09 12:32:18 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 _ARPA_INET_H
#define _ARPA_INET_H
/****************************************************************************/
#ifndef _NETINET_IN_H
#include <netinet/in.h>
#endif /* _NETINET_IN_H */
/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
/*
* The following prototypes may clash with the bsdsocket.library or
* usergroup.library API definitions.
*/
#ifndef __NO_NET_API
extern in_addr_t inet_addr(const char *cp);
extern int inet_aton(const char *cp, struct in_addr *pin);
extern in_addr_t inet_lnaof(struct in_addr in);
extern struct in_addr inet_makeaddr(in_addr_t net, in_addr_t lna);
extern in_addr_t inet_netof(struct in_addr in);
extern in_addr_t inet_network(const char *cp);
extern char *inet_ntoa(struct in_addr in);
#endif /* __NO_NET_API */
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/****************************************************************************/
#endif /* _ARPA_INET_H */

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: ctype.h,v 1.6 2005-05-11 20:15:28 obarthel Exp $ * $Id: ctype.h,v 1.7 2005-10-16 08:34:52 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -31,8 +31,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef _CYTPE_H #ifndef _CTYPE_H
#define _CYTPE_H #define _CTYPE_H
/****************************************************************************/ /****************************************************************************/
@@ -120,4 +120,4 @@ extern const unsigned char __ctype_table[];
/****************************************************************************/ /****************************************************************************/
#endif /* _CYTPE_H */ #endif /* _CTYPE_H */

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: dirent.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ * $Id: dirent.h,v 1.4 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -40,12 +40,6 @@
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifndef _SYS_TYPES_H #ifndef _SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif /* _SYS_TYPES_H */ #endif /* _SYS_TYPES_H */
@@ -56,6 +50,12 @@ extern "C" {
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#define NAME_MAX FILENAME_MAX #define NAME_MAX FILENAME_MAX
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: dos.h,v 1.10 2005-07-03 10:36:48 obarthel Exp $ * $Id: dos.h,v 1.13 2005-10-20 06:50:32 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -40,12 +40,6 @@
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifndef _STDIO_H #ifndef _STDIO_H
#include <stdio.h> #include <stdio.h>
#endif /* _STDIO_H */ #endif /* _STDIO_H */
@@ -62,6 +56,12 @@ extern "C" {
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
/* /*
* The Workbench startup message passed to this program; this may be NULL * The Workbench startup message passed to this program; this may be NULL
* if the program was started from shell instead. * if the program was started from shell instead.
@@ -148,9 +148,24 @@ extern int __get_default_file(int file_descriptor,long * file_ptr);
/****************************************************************************/ /****************************************************************************/
/*
* If your program is intended to be launched by the Internet superserver
* (inetd) to run as a daemon, receiving and sending data through a network
* connection set up for it, declare the following variable in your program
* and set it to TRUE. This will make the program's network startup code
* link the stdin/stdout/stderr streams with the daemon socket passed to it.
* Whether or not your program is running as a daemon can be tested by
* checking the global __is_daemon variable described below.
*/
extern BOOL __check_daemon_startup;
/****************************************************************************/
/* /*
* This will be set to TRUE if the current program was launched from * This will be set to TRUE if the current program was launched from
* the internet superserver ('inetd') or an equivalent facility. * the internet superserver ('inetd') or an equivalent facility. Note
* that you need to have set __check_daemon_startup to TRUE before
* you can rely upon __is_daemon to be initialized correctly.
*/ */
extern BOOL __is_daemon; extern BOOL __is_daemon;
@@ -364,6 +379,32 @@ extern BOOL __lib_init(struct Library * SysBase);
/****************************************************************************/ /****************************************************************************/
/*
* The following variables are part of libnet.a, which provides for
* a BSD-Unix-like socket networking API. Traditionally, only one process
* at a time may use the underlying bsdsocket.library base, but with a
* multithreaded application you may want all of them to share the same
* library base. As of this writing there is one single TCP/IP stack which
* supports this feature (Roadshow) and it must be enabled early on. If
* this worked out well you can test through the following variable which
* will be set to TRUE:
*/
extern BOOL __can_share_socket_library_base;
/*
* The next global variable is also part of the thread-safe libnet.a and
* indicates that the TCP/IP stack will call the functions __set_errno()
* and __set_h_errno() when it modifies the global errno and h_errno
* variables, respectively. If you want to save the error codes for each
* of the Processes in your multithreaded application then you should
* override these functions with your. The following variable will be
* set to TRUE if the __set_errno() and __set_h_errno() functions will
* be used to change the corresponding variables:
*/
extern BOOL __thread_safe_errno_h_errno;
/****************************************************************************/
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: fcntl.h,v 1.5 2005-04-03 10:22:48 obarthel Exp $ * $Id: fcntl.h,v 1.6 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -40,12 +40,6 @@
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifndef _SYS_TYPES_H #ifndef _SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif /* _SYS_TYPES_H */ #endif /* _SYS_TYPES_H */
@@ -56,6 +50,12 @@ extern "C" {
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#define O_RDONLY 0 #define O_RDONLY 0
#define O_WRONLY 1 #define O_WRONLY 1
#define O_RDWR 2 #define O_RDWR 2

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: ftw.h,v 1.1 2005-03-02 12:57:56 obarthel Exp $ * $Id: ftw.h,v 1.2 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -36,12 +36,6 @@
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */ /* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/ /****************************************************************************/
@@ -50,6 +44,12 @@ extern "C" {
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
/* Values passed to the user function (argument #3). */ /* Values passed to the user function (argument #3). */
enum enum
{ {

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: grp.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ * $Id: grp.h,v 1.4 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -40,15 +40,25 @@
/****************************************************************************/ /****************************************************************************/
#ifndef _SYS_TYPES_H
#include <sys/types.h>
#endif /* _SYS_TYPES_H */
/****************************************************************************/
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
/****************************************************************************/ /****************************************************************************/
#ifndef _SYS_TYPES_H #ifdef __GNUC__
#include <sys/types.h> #ifdef __PPC__
#endif /* _SYS_TYPES_H */ #pragma pack(2)
#endif
#elif defined(__VBCC__)
#pragma amiga-align
#endif
/****************************************************************************/ /****************************************************************************/
@@ -62,6 +72,33 @@ struct group
/****************************************************************************/ /****************************************************************************/
/*
* The following prototypes may clash with the bsdsocket.library or
* usergroup.library API definitions.
*/
#ifndef __NO_NET_API
extern void endgrent(void);
extern struct group *getgrent(void);
extern struct group *getgrgid(gid_t gid);
extern struct group *getgrnam(const char *name);
extern void setgrent(void);
#endif /* __NO_NET_API */
/****************************************************************************/
#ifdef __GNUC__
#ifdef __PPC__
#pragma pack()
#endif
#elif defined(__VBCC__)
#pragma default-align
#endif
/****************************************************************************/
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: inttypes.h,v 1.2 2005-05-12 13:21:47 obarthel Exp $ * $Id: inttypes.h,v 1.3 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -56,6 +56,12 @@
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
/* printf() format specifications for different types. */ /* printf() format specifications for different types. */
/* "Decimal" */ /* "Decimal" */
@@ -315,4 +321,10 @@ extern uintmax_t wcstoumax(const wchar_t *str, char **ptr, int base);
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/****************************************************************************/
#endif /* _INTTYPES_H */ #endif /* _INTTYPES_H */

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math.h,v 1.16 2005-06-26 09:06:12 obarthel Exp $ * $Id: math.h,v 1.18 2005-10-16 09:05:03 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -244,46 +244,64 @@ extern float tanhf(float x);
extern float acoshf(float x); extern float acoshf(float x);
extern float asinhf(float x); extern float asinhf(float x);
extern float atanhf(float x);
extern float cbrtf(float x); extern float cbrtf(float x);
extern float copysignf(float x, float y); extern float copysignf(float x, float y);
extern float erfcf(float x); extern float erfcf(float x);
extern float erff(float x); extern float erff(float x);
extern float expm1f(float x); extern float expm1f(float x);
extern float fdimf(float x,float y); extern float fdimf(float x,float y);
extern float fmaf(float x,float y,float z);
extern float fmaxf(float x,float y); extern float fmaxf(float x,float y);
extern float fminf(float x,float y); extern float fminf(float x,float y);
extern float hypotf(float x, float y); extern float hypotf(float x, float y);
extern float lgammaf(float x); extern float lgammaf(float x);
extern float log1pf(float x); extern float log1pf(float x);
extern float logbf(float x); extern float logbf(float x);
extern long int lrintf(float x);
extern long int lroundf(float x);
extern float nanf(const char *tagp); extern float nanf(const char *tagp);
extern float nearbyintf(float x);
extern float nextafterf(float x,float y); extern float nextafterf(float x,float y);
extern float remainderf(float x, float p); extern float remainderf(float x, float p);
extern float remquof(float x,float y,int * quo);
extern float rintf(float x); extern float rintf(float x);
extern float roundf(float x);
extern float scalbnf (float x, int n); extern float scalbnf (float x, int n);
extern float tgammaf(float x);
extern float truncf(float x);
extern int ilogbf(float x); extern int ilogbf(float x);
/****************************************************************************/ /****************************************************************************/
extern double acosh(double x); extern double acosh(double x);
extern double asinh(double x); extern double asinh(double x);
extern double atanh(double x);
extern double cbrt(double x); extern double cbrt(double x);
extern double copysign(double x, double y); extern double copysign(double x, double y);
extern double erf(double x); extern double erf(double x);
extern double erfc(double x); extern double erfc(double x);
extern double expm1(double x); extern double expm1(double x);
extern double fdim(double x,double y); extern double fdim(double x,double y);
extern double fma(double x,double y,double z);
extern double fmax(double x,double y); extern double fmax(double x,double y);
extern double fmin(double x,double y); extern double fmin(double x,double y);
extern double hypot(double x,double y); extern double hypot(double x,double y);
extern double lgamma(double x); extern double lgamma(double x);
extern double log1p(double x); extern double log1p(double x);
extern double logb(double x); extern double logb(double x);
extern long int lrint(double x);
extern long int lround(double x);
extern double nan(const char *tagp); extern double nan(const char *tagp);
extern double nearbyint(double x);
extern double nextafter(double x,double y); extern double nextafter(double x,double y);
extern double remainder(double x, double p); extern double remainder(double x, double p);
extern double remquo(double x,double y,int * quo);
extern double rint(double x); extern double rint(double x);
extern double round(double x);
extern double scalbn (double x, int n); extern double scalbn (double x, int n);
extern double tgamma(double x);
extern double trunc(double x);
extern int ilogb(double x); extern int ilogb(double x);
/****************************************************************************/ /****************************************************************************/

174
library/include/netdb.h Normal file
View File

@@ -0,0 +1,174 @@
/*
* $Id: netdb.h,v 1.1 2005-10-09 12:32:18 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 _NETDB_H
#define _NETDB_H
/****************************************************************************/
#ifndef _SYS_SOCKET_H
#include <sys/socket.h>
#endif /* _SYS_SOCKET_H */
#ifndef _NETINET_IN_H
#include <netinet/in.h>
#endif /* _NETINET_IN_H */
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifdef __GNUC__
#ifdef __PPC__
#pragma pack(2)
#endif
#elif defined(__VBCC__)
#pragma amiga-align
#endif
/****************************************************************************/
#define MAXHOSTNAMELEN 256 /* max hostname size */
/****************************************************************************/
/*
* Structures returned by network data base library. All addresses are
* supplied in host order, and returned in network order (suitable for
* use in system calls).
*/
struct hostent
{
char * h_name; /* official name of host */
char ** h_aliases; /* alias list */
int h_addrtype; /* host address type */
int h_length; /* length of address */
char ** h_addr_list; /* list of addresses from name server */
};
#define h_addr h_addr_list[0] /* address, for backward compatiblity */
/*
* Assumption here is that a network number
* fits in an unsigned long -- probably a poor one.
*/
struct netent
{
char * n_name; /* official name of net */
char ** n_aliases; /* alias list */
int n_addrtype; /* net address type */
in_addr_t n_net; /* network # */
};
struct servent
{
char * s_name; /* official service name */
char ** s_aliases; /* alias list */
int s_port; /* port # */
char * s_proto; /* protocol to use */
};
struct protoent
{
char * p_name; /* official protocol name */
char ** p_aliases; /* alias list */
int p_proto; /* protocol # */
};
/****************************************************************************/
/*
* Error return codes from gethostbyname() and gethostbyaddr()
* (left in extern int h_errno).
*/
#define NETDB_INTERNAL -1 /* see errno */
#define NETDB_SUCCESS 0 /* no problem */
#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
#define NO_DATA 4 /* Valid name, no data record of requested type */
#define NO_ADDRESS NO_DATA /* no address, look for MX record */
/****************************************************************************/
extern int h_errno;
/****************************************************************************/
/*
* The following prototypes may clash with the bsdsocket.library or
* usergroup.library API definitions.
*/
#ifndef __NO_NET_API
extern struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type);
extern struct hostent *gethostbyname(const char *name);
extern struct netent *getnetbyaddr(in_addr_t net, int type);
extern struct netent *getnetbyname(const char *name);
extern struct protoent *getprotobyname(const char *name);
extern struct protoent *getprotobynumber(int proto);
extern struct servent *getservbyname(const char *name, const char *proto);
extern struct servent *getservbyport(int port, const char *proto);
extern const char *hstrerror(int err);
#endif /* __NO_NET_API */
/****************************************************************************/
#ifdef __GNUC__
#ifdef __PPC__
#pragma pack()
#endif
#elif defined(__VBCC__)
#pragma default-align
#endif
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/****************************************************************************/
#endif /* _NETDB_H */

View File

@@ -0,0 +1,260 @@
/*
* $Id: in.h,v 1.1 2005-10-09 12:32:18 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 _NETINET_IN_H
#define _NETINET_IN_H
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifdef __GNUC__
#ifdef __PPC__
#pragma pack(2)
#endif
#elif defined(__VBCC__)
#pragma amiga-align
#endif
/****************************************************************************/
/*
* Constants and structures defined by the internet system,
* Per RFC 790, September 1981, and numerous additions.
*/
/*
* Data types.
*/
typedef unsigned long in_addr_t;
typedef unsigned short in_port_t;
/*
* Protocols
*/
#define IPPROTO_IP 0 /* dummy for IP */
#define IPPROTO_ICMP 1 /* control message protocol */
#define IPPROTO_IGMP 2 /* group mgmt protocol */
#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
#define IPPROTO_TCP 6 /* tcp */
#define IPPROTO_EGP 8 /* exterior gateway protocol */
#define IPPROTO_PUP 12 /* pup */
#define IPPROTO_UDP 17 /* user datagram protocol */
#define IPPROTO_IDP 22 /* xns idp */
#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */
#define IPPROTO_EON 80 /* ISO cnlp */
#define IPPROTO_ENCAP 98 /* encapsulation header */
#define IPPROTO_RAW 255 /* raw IP packet */
#define IPPROTO_MAX 256
/*
* Local port number conventions:
* Ports < IPPORT_RESERVED are reserved for
* privileged processes (e.g. root).
* Ports > IPPORT_USERRESERVED are reserved
* for servers, not necessarily privileged.
*/
#define IPPORT_RESERVED 1024
#define IPPORT_USERRESERVED 5000
/*
* Internet address (a structure for historical reasons)
*/
struct in_addr
{
unsigned long s_addr;
};
/*
* Definitions of bits in internet address integers.
* On subnets, the decomposition of addresses to host and net parts
* is done according to subnet mask, not the masks here.
*/
#define IN_CLASSA(i) (((unsigned long)(i) & 0x80000000) == 0)
#define IN_CLASSA_NET 0xff000000
#define IN_CLASSA_NSHIFT 24
#define IN_CLASSA_HOST 0x00ffffff
#define IN_CLASSA_MAX 128
#define IN_CLASSB(i) (((unsigned long)(i) & 0xc0000000) == 0x80000000)
#define IN_CLASSB_NET 0xffff0000
#define IN_CLASSB_NSHIFT 16
#define IN_CLASSB_HOST 0x0000ffff
#define IN_CLASSB_MAX 65536
#define IN_CLASSC(i) (((unsigned long)(i) & 0xe0000000) == 0xc0000000)
#define IN_CLASSC_NET 0xffffff00
#define IN_CLASSC_NSHIFT 8
#define IN_CLASSC_HOST 0x000000ff
#define IN_CLASSD(i) (((unsigned long)(i) & 0xf0000000) == 0xe0000000)
#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */
#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */
#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */
#define IN_MULTICAST(i) IN_CLASSD(i)
#define IN_EXPERIMENTAL(i) (((unsigned long)(i) & 0xf0000000) == 0xf0000000)
#define IN_BADCLASS(i) (((unsigned long)(i) & 0xf0000000) == 0xf0000000)
#define INADDR_ANY 0x00000000UL
#define INADDR_BROADCAST 0xffffffffUL /* must be masked */
#define INADDR_NONE 0xffffffff /* -1 return */
#define INADDR_UNSPEC_GROUP 0xe0000000UL /* 224.0.0.0 */
#define INADDR_ALLHOSTS_GROUP 0xe0000001UL /* 224.0.0.1 */
#define INADDR_MAX_LOCAL_GROUP 0xe00000ffUL /* 224.0.0.255 */
#define IN_LOOPBACKNET 127 /* official! */
/*
* Socket address, internet style.
*/
struct sockaddr_in
{
unsigned char sin_len;
unsigned char sin_family;
unsigned short sin_port;
struct in_addr sin_addr;
unsigned char sin_zero[8];
};
/*
* Structure used to describe IP options.
* Used to store options internally, to pass them to a process,
* or to restore options retrieved earlier.
* The ip_dst is used for the first-hop gateway when using a source route
* (this gets put into the header proper).
*/
struct ip_opts
{
struct in_addr ip_dst; /* first hop, 0 w/o src rt */
unsigned char ip_options[40]; /* actually variable in size */
};
/*
* Options for use with [gs]etsockopt at the IP level.
* First word of comment is data type; bool is stored in int.
*/
#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */
#define IP_HDRINCL 2 /* int; header is included with data */
#define IP_TOS 3 /* int; IP type of service and preced. */
#define IP_TTL 4 /* int; IP time to live */
#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */
#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */
#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */
#define IP_RETOPTS 8 /* ip_opts; set/get IP options */
#define IP_MULTICAST_IF 9 /* unsigned char; set/get IP multicast i/f */
#define IP_MULTICAST_TTL 10 /* unsigned char; set/get IP multicast ttl */
#define IP_MULTICAST_LOOP 11 /* unsigned char; set/get IP multicast loopback */
#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
/*
* Defaults and limits for options
*/
#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */
#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
#define IP_MAX_MEMBERSHIPS 20 /* per socket; must fit in one mbuf */
/*
* Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
*/
struct ip_mreq
{
struct in_addr imr_multiaddr; /* IP multicast address of group */
struct in_addr imr_interface; /* local IP address of interface */
};
/*
* Definitions for inet sysctl operations.
*
* Third level is protocol number.
* Fourth level is desired variable within that protocol.
*/
#define IPPROTO_MAXID (IPPROTO_IDP + 1) /* don't list to IPPROTO_MAX */
/*
* Names for IP sysctl objects
*/
#define IPCTL_FORWARDING 1 /* act as router */
#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */
#define IPCTL_DEFTTL 3 /* default TTL */
#ifdef notyet
#define IPCTL_DEFMTU 4 /* default MTU */
#endif
#define IPCTL_MAXID 5
/****************************************************************************/
/*
* Macros for network/external number representation conversion.
*/
#define ntohl(x) (x)
#define ntohs(x) (x)
#define htonl(x) (x)
#define htons(x) (x)
#define NTOHL(x) (x)
#define NTOHS(x) (x)
#define HTONL(x) (x)
#define HTONS(x) (x)
/****************************************************************************/
#ifdef __GNUC__
#ifdef __PPC__
#pragma pack()
#endif
#elif defined(__VBCC__)
#p #pragma default-al
#endif
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/****************************************************************************/
#endif /* _NETINET_IN_H */

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: pwd.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ * $Id: pwd.h,v 1.4 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -40,15 +40,25 @@
/****************************************************************************/ /****************************************************************************/
#ifndef _SYS_TYPES_H
#include <sys/types.h>
#endif /* _SYS_TYPES_H */
/****************************************************************************/
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
/****************************************************************************/ /****************************************************************************/
#ifndef _SYS_TYPES_H #ifdef __GNUC__
#include <sys/types.h> #ifdef __PPC__
#endif /* _SYS_TYPES_H */ #pragma pack(2)
#endif
#elif defined(__VBCC__)
#pragma amiga-align
#endif
/****************************************************************************/ /****************************************************************************/
@@ -65,6 +75,33 @@ struct passwd
/****************************************************************************/ /****************************************************************************/
/*
* The following prototypes may clash with the bsdsocket.library or
* usergroup.library API definitions.
*/
#ifndef __NO_NET_API
extern void endpwent(void);
extern struct passwd *getpwent(void);
extern struct passwd *getpwnam(const char *name);
extern struct passwd *getpwuid(uid_t uid);
extern void setpwent(void);
#endif /* __NO_NET_API */
/****************************************************************************/
#ifdef __GNUC__
#ifdef __PPC__
#pragma pack()
#endif
#elif defined(__VBCC__)
#pragma default-align
#endif
/****************************************************************************/
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: stdbool.h,v 1.2 2005-05-12 13:21:47 obarthel Exp $ * $Id: stdbool.h,v 1.3 2005-10-19 08:11:44 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -68,7 +68,7 @@ extern "C" {
/****************************************************************************/ /****************************************************************************/
#define __bool_true_and_false_are_defined 1 #define __bool_true_false_are_defined 1
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: stdio.h,v 1.16 2005-06-18 07:23:17 obarthel Exp $ * $Id: stdio.h,v 1.18 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -36,12 +36,6 @@
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifndef _STDDEF_H #ifndef _STDDEF_H
#include <stddef.h> #include <stddef.h>
#endif /* _STDDEF_H */ #endif /* _STDDEF_H */
@@ -56,6 +50,12 @@ extern "C" {
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
/* 'End of file' indicator returned by, for example, fgetc() */ /* 'End of file' indicator returned by, for example, fgetc() */
#define EOF (-1) #define EOF (-1)
@@ -154,7 +154,7 @@ typedef struct
#define L_tmpnam 10 #define L_tmpnam 10
/* Maximum number of unique file names tmpnam() can generate */ /* Maximum number of unique file names tmpnam() can generate */
#define TMP_MAX 0x3ffff #define TMP_MAX 0x40000
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: stdlib.h,v 1.11 2005-05-12 13:21:47 obarthel Exp $ * $Id: stdlib.h,v 1.12 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -36,18 +36,18 @@
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifndef _STDDEF_H #ifndef _STDDEF_H
#include <stddef.h> #include <stddef.h>
#endif /* _STDDEF_H */ #endif /* _STDDEF_H */
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
/* Maximum number of bytes in a multibyte character */ /* Maximum number of bytes in a multibyte character */
#define MB_CUR_MAX 2 #define MB_CUR_MAX 2

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: string.h,v 1.7 2005-01-02 09:07:21 obarthel Exp $ * $Id: string.h,v 1.8 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -36,18 +36,18 @@
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifndef _STDDEF_H #ifndef _STDDEF_H
#include <stddef.h> #include <stddef.h>
#endif /* _STDDEF_H */ #endif /* _STDDEF_H */
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
extern char *strerror(int error_number); extern char *strerror(int error_number);
extern char *strcat(char *dest, const char *src); extern char *strcat(char *dest, const char *src);
extern char *strncat(char *dest, const char *src, size_t n); extern char *strncat(char *dest, const char *src, size_t n);

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: strings.h,v 1.4 2005-03-02 12:57:56 obarthel Exp $ * $Id: strings.h,v 1.5 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -40,18 +40,18 @@
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifndef _STDDEF_H #ifndef _STDDEF_H
#include <stddef.h> #include <stddef.h>
#endif /* _STDDEF_H */ #endif /* _STDDEF_H */
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
/* These come from 4.4BSD. */ /* These come from 4.4BSD. */
extern int strcasecmp(const char *s1, const char *s2); extern int strcasecmp(const char *s1, const char *s2);
extern int strncasecmp(const char *s1, const char *s2, size_t len); extern int strncasecmp(const char *s1, const char *s2, size_t len);

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: amigaos-va.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ * $Id: amigaos-va.h,v 1.4 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -40,18 +40,18 @@
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifndef _STDARG_H #ifndef _STDARG_H
#include <stdarg.h> #include <stdarg.h>
#endif /* _STDARG_H */ #endif /* _STDARG_H */
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
/* Define the AmigaOS specific varargs macros, /* Define the AmigaOS specific varargs macros,
if <stdarg.h> didn't already define them. */ if <stdarg.h> didn't already define them. */

View File

@@ -1,230 +0,0 @@
/*
* $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,72 @@
/*
* $Id: filio.h,v 1.1 2005-10-09 12:32:18 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_FILIO_H
#define _SYS_FILIO_H
/****************************************************************************/
#ifndef _SYS_IOCCOM_H
#include <sys/ioccom.h>
#endif /* _SYS_IOCCOM_H */
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
/* Generic file-descriptor ioctl's. */
#define FIOCLEX _IO('f', 1) /* set close on exec on fd */
#define FIONCLEX _IO('f', 2) /* remove close on exec */
#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */
#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */
#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */
#define FIOSETOWN _IOW('f', 124, int) /* set owner */
#define FIOGETOWN _IOR('f', 123, int) /* get owner */
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/****************************************************************************/
#endif /* _SYS_FILIO_H */

View File

@@ -0,0 +1,78 @@
/*
* $Id: ioccom.h,v 1.1 2005-10-09 12:32:18 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_IOCCOM_H
#define _SYS_IOCCOM_H
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */
#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK)
#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16))
#define IOCGROUP(x) (((x) >> 8) & 0xff)
#define IOCPARM_MAX NBPG /* max size of ioctl args, mult. of NBPG */
#define IOC_VOID (0x20000000UL) /* no parameters */
#define IOC_OUT (0x40000000UL) /* copy parameters out */
#define IOC_IN (0x80000000UL) /* copy parameters in */
#define IOC_INOUT (IOC_IN|IOC_OUT) /* copy paramters in and out */
#define IOC_DIRMASK (0xe0000000UL) /* mask for IN/OUT/VOID */
#define _IOC(inout,group,num,len) \
(inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0)
#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t))
#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t))
#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t))
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/****************************************************************************/
#endif /* _SYS_IOCCOM_H */

View File

@@ -0,0 +1,68 @@
/*
* $Id: ioctl.h,v 1.1 2005-10-09 12:32:18 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_IOTCL_H
#define _SYS_IOTCL_H
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
/*
* The following prototypes may clash with the bsdsocket.library or
* usergroup.library API definitions.
*/
#ifndef __NO_NET_API
extern int ioctl(int fildes, int request, ... /* arg */);
#endif /* __NO_NET_API */
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/****************************************************************************/
#endif /* _SYS_IOTCL_H */

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: mount.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ * $Id: mount.h,v 1.4 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -40,18 +40,18 @@
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifndef _SYS_TYPES_H #ifndef _SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif /* _SYS_TYPES_H */ #endif /* _SYS_TYPES_H */
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
typedef struct { long val[2]; } fsid_t; /* file system id type */ typedef struct { long val[2]; } fsid_t; /* file system id type */
/****************************************************************************/ /****************************************************************************/

View File

@@ -0,0 +1,102 @@
/*
* $Id: select.h,v 1.1 2005-10-09 12:32:18 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_SELECT_H
#define _SYS_SELECT_H
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
#ifndef _STRING_H
#include <string.h>
#endif /* _STRING_H */
#ifndef _SYS_TIME_H
#include <sys/time.h>
#endif /* _SYS_TIME_H */
/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
/*
* 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)((n) < FD_SETSIZE ? (p)->bits[((unsigned long)n) >> 5] |= (1UL << (((unsigned long)n) & 31)) : 0))
#define FD_CLR(n,p) ((void)((n) < FD_SETSIZE ? (p)->bits[((unsigned long)n) >> 5] &= ~(1UL << (((unsigned long)n) & 31)) : 0))
#define FD_ISSET(n,p) ((n) < FD_SETSIZE && ((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))))
/****************************************************************************/
/*
* The following prototypes may clash with the bsdsocket.library or
* usergroup.library API definitions.
*/
#ifndef __NO_NET_API
extern int select(int nfds, fd_set *readfds,fd_set *writefds, fd_set *errorfds,struct timeval *timeout);
#endif /* __NO_NET_API */
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/****************************************************************************/
#endif /* _SYS_SELECT_H */

View File

@@ -0,0 +1,346 @@
/*
* $Id: socket.h,v 1.2 2005-10-11 09:28:29 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_SOCKET_H
#define _SYS_SOCKET_H
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
#ifndef _STDDEF_H
#include <stddef.h>
#endif /* _STDDEF_H */
#ifndef _SYS_UIO_H_
#include <sys/uio.h>
#endif /* _SYS_UIO_H_ */
/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifdef __GNUC__
#ifdef __PPC__
#pragma pack(2)
#endif
#elif defined(__VBCC__)
#pragma amiga-align
#endif
/****************************************************************************/
/*
* Definitions related to sockets: types, address families, options.
*/
typedef unsigned long socklen_t;
/*
* Types
*/
#define SOCK_STREAM 1 /* stream socket */
#define SOCK_DGRAM 2 /* datagram socket */
#define SOCK_RAW 3 /* raw-protocol interface */
#define SOCK_RDM 4 /* reliably-delivered message */
#define SOCK_SEQPACKET 5 /* sequenced packet stream */
/*
* Option flags per-socket.
*/
#define SO_DEBUG 0x0001 /* turn on debugging info recording */
#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
#define SO_REUSEADDR 0x0004 /* allow local address reuse */
#define SO_KEEPALIVE 0x0008 /* keep connections alive */
#define SO_DONTROUTE 0x0010 /* just use interface addresses */
#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
#define SO_LINGER 0x0080 /* linger on close if data present */
#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */
#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */
/*
* Additional options, not kept in so_options.
*/
#define SO_SNDBUF 0x1001 /* send buffer size */
#define SO_RCVBUF 0x1002 /* receive buffer size */
#define SO_SNDLOWAT 0x1003 /* send low-water mark */
#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
#define SO_SNDTIMEO 0x1005 /* send timeout */
#define SO_RCVTIMEO 0x1006 /* receive timeout */
#define SO_ERROR 0x1007 /* get error status and clear */
#define SO_TYPE 0x1008 /* get socket type */
/* This is a private option which is used exclusively
* by this Amiga TCP/IP stack implementation and should not
* be used by user code.
*/
#define SO_EVENTMASK 0x2001
/*
* Structure used for manipulating linger optio *
*/
struct linger
{
int l_onoff; /* option on/off */
int l_linger; /* linger time in seconds */
};
/*
* Level number for (get/set)sockopt() to apply to socket itself.
*/
#define SOL_SOCKET 0xffff /* options for socket level */
/*
* Address families.
*/
#define AF_UNSPEC 0 /* unspecified */
#define AF_LOCAL 1 /* local to host (pipes, portals) */
#define AF_UNIX AF_LOCAL /* backward compatibility */
#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
#define AF_IMPLINK 3 /* arpanet imp addresses */
#define AF_PUP 4 /* pup protocols: e.g. BSP */
#define AF_CHAOS 5 /* mit CHAOS protocols */
#define AF_NS 6 /* XEROX NS protocols */
#define AF_ISO 7 /* ISO protocols */
#define AF_OSI AF_ISO
#define AF_ECMA 8 /* european computer manufacturers */
#define AF_DATAKIT 9 /* datakit protocols */
#define AF_CCITT 10 /* CCITT protocols, X.25 etc */
#define AF_SNA 11 /* IBM SNA */
#define AF_DECnet 12 /* DECnet */
#define AF_DLI 13 /* DEC Direct data link interface */
#define AF_LAT 14 /* LAT */
#define AF_HYLINK 15 /* NSC Hyperchannel */
#define AF_APPLETALK 16 /* Apple Talk */
#define AF_ROUTE 17 /* Internal Routing Protocol */
#define AF_LINK 18 /* Link layer interface */
#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */
#define AF_COIP 20 /* connection-oriented IP, aka ST II */
#define AF_CNT 21 /* Computer Network Technology */
#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */
#define AF_IPX 23 /* Novell Internet Protocol */
#define AF_SIP 24 /* Simple Internet Protocol */
#define pseudo_AF_PIP 25 /* Help Identify PIP packets */
#define AF_MAX 26
/*
* Structure used by kernel to store most
* addresses.
*/
struct sockaddr
{
unsigned char sa_len; /* total length */
unsigned char sa_family; /* address family */
unsigned char sa_data[14]; /* actually longer; address value */
};
/*
* Structure used by kernel to pass protocol
* inf * inf * inf * informati
*/
struct sockproto
{
unsigned short sp_family; /* address family */
unsigned short sp_protocol; /* protocol */
};
/*
* Protocol families, same as address families for now.
*/
#define PF_UNSPEC AF_UNSPEC
#define PF_LOCAL AF_LOCAL
#define PF_UNIX PF_LOCAL /* backward compatibility */
#define PF_INET AF_INET
#define PF_IMPLINK AF_IMPLINK
#define PF_PUP AF_PUP
#define PF_CHAOS AF_CHAOS
#define PF_NS AF_NS
#define PF_ISO AF_ISO
#define PF_OSI AF_ISO
#define PF_ECMA AF_ECMA
#define PF_DATAKIT AF_DATAKIT
#define PF_CCITT AF_CCITT
#define PF_SNA AF_SNA
#define PF_DECnet AF_DECnet
#define PF_DLI AF_DLI
#define PF_LAT AF_LAT
#define PF_HYLINK AF_HYLINK
#define PF_APPLETALK AF_APPLETALK
#define PF_ROUTE AF_ROUTE
#define PF_LINK AF_LINK
#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */
#define PF_COIP AF_COIP
#define PF_CNT AF_CNT
#define PF_SIP AF_SIP
#define PF_IPX AF_IPX /* same format as AF_NS */
#define PF_RTIP pseudo_AF_FTIP /* same format as AF_INET */
#define PF_PIP pseudo_AF_PIP
#define PF_MAX AF_MAX
/*
* Definitions for network related sysctl, CTL_NET.
*
* Second level is protocol family.
* Third level is protocol number.
*
* Further levels are defined by the individual families below.
*/
#define NET_MAXID AF_MAX
/*
* PF_ROUTE - Routing table
*
* Three additional levels are defined:
* Fourth: address family, 0 is wildcard
* Fifth: type of info, defined below
* Sixth: flag(s) to mask with for NET_RT_FLAGS
*/
#define NET_RT_DUMP 1 /* dump; may limit to a.f. */
#define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */
#define NET_RT_IFLIST 3 /* survey interface list */
#define NET_RT_MAXID 4
/*
* Maximum queue length specifiable by listen.
*/
#define SOMAXCONN 5
/*
* Message header for recvmsg and sendmsg calls.
* Used value-result for recvmsg, value only for sendmsg.
*/
struct msghdr
{
void * msg_name; /* optional address */
unsigned long msg_namelen; /* size of address */
struct iovec * msg_iov; /* scatter/gather array */
unsigned long msg_iovlen; /* # elements in msg_iov */
void * msg_control; /* ancillary data, see below */
unsigned long msg_controllen; /* ancillary data buffer len */
int msg_flags; /* flags on received message */
};
#define MSG_OOB 0x1 /* process out-of-band data */
#define MSG_PEEK 0x2 /* peek at incoming message */
#define MSG_DONTROUTE 0x4 /* send without using routing tables */
#define MSG_EOR 0x8 /* data completes record */
#define MSG_TRUNC 0x10 /* data discarded before delivery */
#define MSG_CTRUNC 0x20 /* control data lost before delivery */
#define MSG_WAITALL 0x40 /* wait for full request or error */
#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */
/*
* Header for ancillary data objects in msg_control buffer.
* Used for additional information with/about a datagram
* not expressible by flags. The format is a sequence
* of message elements headed by cmsghdr structures.
*/
struct cmsghdr
{
unsigned long cmsg_len; /* data byte count, including hdr */
int cmsg_level; /* originating protocol */
int cmsg_type; /* protocol-specific type */
/* followed by unsigned char cmsg_data[]; */
};
/* given pointer to struct cmsghdr, return pointer to data */
#define CMSG_DATA(cmsg) ((unsigned char *)((cmsg) + 1))
/* given pointer to struct cmsghdr, return pointer to next cmsghdr */
#define CMSG_NXTHDR(mhdr, cmsg) \
(((void *)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \
(mhdr)->msg_control + (mhdr)->msg_controllen) ? \
(struct cmsghdr *)NULL : \
(struct cmsghdr *)((void *)(cmsg) + ALIGN((cmsg)->cmsg_len)))
#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control)
/* "Socket"-level control message types: */
#define SCM_RIGHTS 0x01 /* access rights (array of LONG) */
/****************************************************************************/
/*
* The following prototypes may clash with the bsdsocket.library or
* usergroup.library API definitions.
*/
#ifndef __NO_NET_API
extern int accept(int sockfd,struct sockaddr *cliaddr,socklen_t *addrlen);
extern int bind(int socket, const struct sockaddr *address, socklen_t address_len);
extern int connect(int socket, const struct sockaddr *address, socklen_t address_len);
extern int getpeername(int socket, struct sockaddr *address, socklen_t *address_len);
extern int getsockname(int socket, struct sockaddr *address, socklen_t *address_len);
extern int getsockopt(int socket, int level, int option_name, void *option_value, socklen_t *option_len);
extern int listen(int socket, int backlog);
extern ssize_t recv(int socket, void *buffer, size_t length, int flags);
extern ssize_t recvfrom(int socket, void *buffer, size_t length,int flags, struct sockaddr *address,socklen_t *address_len);
extern ssize_t recvmsg(int socket, struct msghdr *message, int flags);
extern ssize_t send(int socket, const void *buffer, size_t length, int flags);
extern ssize_t sendmsg(int socket, const struct msghdr *message, int flags);
extern ssize_t sendto(int socket, const void *message, size_t length,int flags, const struct sockaddr *dest_addr,socklen_t dest_len);
extern int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len);
extern int shutdown(int socket, int how);
extern int socket(int domain, int type, int protocol);
#endif /* __NO_NET_API */
/****************************************************************************/
#ifdef __GNUC__
#ifdef __PPC__
#pragma pack()
#endif
#elif defined(__VBCC__)
#pragma default-align
#endif
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/****************************************************************************/
#endif /* _SYS_SOCKET_H */

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: stat.h,v 1.5 2005-04-02 13:25:55 obarthel Exp $ * $Id: stat.h,v 1.6 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -40,12 +40,6 @@
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifndef _SYS_TYPES_H #ifndef _SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif /* _SYS_TYPES_H */ #endif /* _SYS_TYPES_H */
@@ -60,6 +54,12 @@ extern "C" {
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#define S_ISUID 0004000 /* set user id on execution */ #define S_ISUID 0004000 /* set user id on execution */
#define S_ISGID 0002000 /* set group id on execution */ #define S_ISGID 0002000 /* set group id on execution */
#define S_ISVTX 0001000 /* save swapped text even after use */ #define S_ISVTX 0001000 /* save swapped text even after use */
@@ -134,8 +134,18 @@ extern int chmod(const char * path_name, mode_t mode);
extern int fchmod(int file_descriptor, mode_t mode); extern int fchmod(int file_descriptor, mode_t mode);
extern int mkdir(const char * path_name, mode_t mode); extern int mkdir(const char * path_name, mode_t mode);
extern int rmdir(const char * path_name); extern int rmdir(const char * path_name);
/*
* The following prototypes may clash with the bsdsocket.library or
* usergroup.library API definitions.
*/
#ifndef __NO_NET_API
extern mode_t umask(mode_t new_mask); extern mode_t umask(mode_t new_mask);
#endif /* __NO_NET_API */
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: types.h,v 1.5 2005-07-15 14:31:37 obarthel Exp $ * $Id: types.h,v 1.6 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -40,6 +40,18 @@
/****************************************************************************/ /****************************************************************************/
#ifndef _TIME_H
#include <time.h>
#endif /* _TIME_H */
/****************************************************************************/
#ifndef _STDDEF_H
#include <stddef.h>
#endif /* _STDDEF_H */
/****************************************************************************/
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
@@ -61,18 +73,6 @@ 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 #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: uio.h,v 1.1 2005-04-03 10:22:48 obarthel Exp $ * $Id: uio.h,v 1.2 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -40,12 +40,6 @@
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifndef _SYS_TYPES_H #ifndef _SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif /* _SYS_TYPES_H */ #endif /* _SYS_TYPES_H */
@@ -56,6 +50,12 @@ extern "C" {
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
/* /*
* The size of MAX_IOVEC is rather arbitrary since there is no kernel support * 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. * for vectored I/O and even a single struct iovec can overflow a ssize_t.

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: termios.h,v 1.1 2005-06-04 10:46:23 obarthel Exp $ * $Id: termios.h,v 1.2 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -31,14 +31,25 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef _TERMIOS_H
#define _TERMIOS_H
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
/* /*
* Almost-but-not-quite termios. * Almost-but-not-quite termios.
*/ */
#ifndef _TERMIOS_H
#define _TERMIOS_H
typedef unsigned int tcflag_t; typedef unsigned int tcflag_t;
typedef unsigned char cc_t; typedef unsigned char cc_t;
typedef unsigned int speed_t; typedef unsigned int speed_t;
@@ -186,4 +197,11 @@ extern speed_t cfgetospeed(struct termios *tios_p);
extern int cfsetispeed(struct termios *tios_p,speed_t input_speed); extern int cfsetispeed(struct termios *tios_p,speed_t input_speed);
extern int cfsetospeed(struct termios *tios_p,speed_t output_speed); extern int cfsetospeed(struct termios *tios_p,speed_t output_speed);
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/****************************************************************************/
#endif /* _TERMIOS_H */ #endif /* _TERMIOS_H */

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: time.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ * $Id: time.h,v 1.4 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -36,18 +36,18 @@
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifndef _STDDEF_H #ifndef _STDDEF_H
#include <stddef.h> #include <stddef.h>
#endif /* _STDDEF_H */ #endif /* _STDDEF_H */
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
/* /*
* Divide the number returned by clock() by CLOCKS_PER_SEC to obtain * Divide the number returned by clock() by CLOCKS_PER_SEC to obtain
* the elapsed time in seconds * the elapsed time in seconds

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: unistd.h,v 1.13 2005-07-12 13:35:58 obarthel Exp $ * $Id: unistd.h,v 1.14 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -40,16 +40,20 @@
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifndef _FCNTL_H #ifndef _FCNTL_H
#include <fcntl.h> #include <fcntl.h>
#endif /* _FCNTL_H */ #endif /* _FCNTL_H */
#if !defined(__NO_NET_API) && !defined(_SYS_SELECT_H)
#include <sys/select.h>
#endif /* __NO_NET_API && _SYS_SELECT_H */
/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/ /****************************************************************************/
/* Endianness: we assume a big endian memory layout (for 68k and PowerPC). */ /* Endianness: we assume a big endian memory layout (for 68k and PowerPC). */
@@ -118,11 +122,33 @@ extern char * __getcwd(char * buffer,size_t buffer_size,const char *file,int lin
/****************************************************************************/ /****************************************************************************/
/* If desired, also include the networking API, as integrated into /*
the clib2 libnet.a library. */ * The following prototypes may clash with the bsdsocket.library or
#if defined(__USE_CLIB2_NETLIB) && !defined(_SYS_CLIB2_NET_H) * usergroup.library API definitions.
#include <sys/clib2_net.h> */
#endif /* __USE_CLIB2_NETLIB && !_SYS_CLIB2_NET_H */
#ifndef __NO_NET_API
extern long gethostid(void);
extern int gethostname(const char *name, size_t namelen);
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 int getgroups(int gidsetsize, gid_t grouplist[]);
extern char * getpass(const char *prompt);
extern uid_t getuid(void);
extern int initgroups(const char *name, gid_t basegid);
extern int setegid(gid_t gid);
extern int seteuid(uid_t uid);
extern int setgid(gid_t gid);
extern int setgroups(int ngroups, const gid_t *gidset);
extern int setregid(gid_t rgid, gid_t egid);
extern int setreuid(uid_t ruid, uid_t euid);
extern pid_t setsid(void);
extern int setuid(uid_t uid);
#endif /* __NO_NET_API */
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: utime.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ * $Id: utime.h,v 1.4 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -40,18 +40,18 @@
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifndef _TIME_H #ifndef _TIME_H
#include <time.h> #include <time.h>
#endif /* _TIME_H */ #endif /* _TIME_H */
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
struct utimbuf struct utimbuf
{ {
time_t actime; /* Access time */ time_t actime; /* Access time */

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: wchar.h,v 1.3 2005-05-12 13:21:47 obarthel Exp $ * $Id: wchar.h,v 1.4 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -36,12 +36,6 @@
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifndef _STDDEF_H #ifndef _STDDEF_H
#include <stddef.h> #include <stddef.h>
#endif /* _STDDEF_H */ #endif /* _STDDEF_H */
@@ -60,6 +54,12 @@ extern "C" {
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#define WEOF (-1) #define WEOF (-1)
#define WCHAR_MAX 65535 #define WCHAR_MAX 65535
#define WCHAR_MIN 0 #define WCHAR_MIN 0

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: wctype.h,v 1.3 2005-05-12 13:21:47 obarthel Exp $ * $Id: wctype.h,v 1.4 2005-10-09 12:32:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -36,18 +36,18 @@
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
#ifndef _WCHAR_H #ifndef _WCHAR_H
#include <wchar.h> #include <wchar.h>
#endif /* _WCHAR_H */ #endif /* _WCHAR_H */
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************/
typedef long wctype_t; /* ZZZ */ typedef long wctype_t; /* ZZZ */
typedef long wctrans_t; /* ZZZ */ typedef long wctrans_t; /* ZZZ */

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: inttypes_strtoimax.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $ * $Id: inttypes_strtoimax.c,v 1.3 2005-09-28 09:51:16 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -46,6 +46,8 @@
intmax_t intmax_t
strtoimax(const char *str, char **ptr, int base) strtoimax(const char *str, char **ptr, int base)
{ {
const char * stop = str;
size_t num_digits_converted = 0;
BOOL is_negative; BOOL is_negative;
intmax_t result = 0; intmax_t result = 0;
intmax_t new_sum; intmax_t new_sum;
@@ -172,20 +174,28 @@ strtoimax(const char *str, char **ptr, int base)
str++; str++;
c = (*str); c = (*str);
num_digits_converted++;
} }
} }
/* Did we convert anything? */
if(num_digits_converted == 0)
goto out;
if(is_negative) if(is_negative)
result = (-sum); result = (-sum);
else else
result = sum; result = sum;
stop = str;
out: out:
/* If desired, remember where we stopped reading the /* If desired, remember where we stopped reading the
number from the buffer. */ number from the buffer. */
if(ptr != NULL) if(ptr != NULL)
(*ptr) = (char *)str; (*ptr) = (char *)stop;
RETURN(result); RETURN(result);
return(result); return(result);

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: inttypes_strtoumax.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $ * $Id: inttypes_strtoumax.c,v 1.3 2005-09-28 09:51:16 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -46,6 +46,8 @@
uintmax_t uintmax_t
strtoumax(const char *str, char **ptr, int base) strtoumax(const char *str, char **ptr, int base)
{ {
const char * stop = str;
size_t num_digits_converted = 0;
BOOL is_negative; BOOL is_negative;
uintmax_t result = 0; uintmax_t result = 0;
uintmax_t new_sum; uintmax_t new_sum;
@@ -169,9 +171,19 @@ strtoumax(const char *str, char **ptr, int base)
str++; str++;
c = (*str); c = (*str);
/* Remember where the conversion stopped and
that we converted something. */
stop = str;
num_digits_converted++;
} }
} }
/* Did we convert anything? */
if(num_digits_converted == 0)
goto out;
if(is_negative) if(is_negative)
result = (-sum); result = (-sum);
else else
@@ -182,7 +194,7 @@ strtoumax(const char *str, char **ptr, int base)
/* If desired, remember where we stopped reading the /* If desired, remember where we stopped reading the
number from the buffer. */ number from the buffer. */
if(ptr != NULL) if(ptr != NULL)
(*ptr) = (char *)str; (*ptr) = (char *)stop;
RETURN(result); RETURN(result);
return(result); return(result);

View File

@@ -1,6 +1,6 @@
#define VERSION 1 #define VERSION 1
#define REVISION 195 #define REVISION 197
#define DATE "3.9.2005" #define DATE "4.11.2005"
#define VERS "m.lib 1.195" #define VERS "m.lib 1.197"
#define VSTRING "m.lib 1.195 (3.9.2005)\r\n" #define VSTRING "m.lib 1.197 (4.11.2005)\r\n"
#define VERSTAG "\0$VER: m.lib 1.195 (3.9.2005)" #define VERSTAG "\0$VER: m.lib 1.197 (4.11.2005)"

View File

@@ -1 +1 @@
195 197

View File

@@ -1,6 +1,6 @@
#define VERSION 1 #define VERSION 1
#define REVISION 195 #define REVISION 197
#define DATE "3.9.2005" #define DATE "4.11.2005"
#define VERS "m881.lib 1.195" #define VERS "m881.lib 1.197"
#define VSTRING "m881.lib 1.195 (3.9.2005)\r\n" #define VSTRING "m881.lib 1.197 (4.11.2005)\r\n"
#define VERSTAG "\0$VER: m881.lib 1.195 (3.9.2005)" #define VERSTAG "\0$VER: m881.lib 1.197 (4.11.2005)"

View File

@@ -1 +1 @@
195 197

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_acos.c,v 1.5 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_acos.c,v 1.6 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -153,7 +153,7 @@ qS2 = 2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */
qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */ qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */
qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
INLINE STATIC const double INLINE STATIC double
__acos(double x) __acos(double x)
{ {
double z,p,q,r,w,s,c,df; double z,p,q,r,w,s,c,df;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_asin.c,v 1.5 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_asin.c,v 1.6 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -156,7 +156,7 @@ qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */
qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
INLINE STATIC const double INLINE STATIC double
__asin(double x) __asin(double x)
{ {
double t,w,p,q,c,r,s; double t,w,p,q,c,r,s;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_atan.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_atan.c,v 1.4 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -169,7 +169,7 @@ static const double
one = 1.0, one = 1.0,
huge = 1.0e300; huge = 1.0e300;
INLINE STATIC const double INLINE STATIC double
__atan(double x) __atan(double x)
{ {
double w,s1,s2,z; double w,s1,s2,z;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_atan2.c,v 1.6 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_atan2.c,v 1.7 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -209,7 +209,7 @@ pi_o_2 = 1.5707963267948965580E+00, /* 0x3FF921FB, 0x54442D18 */
pi = 3.1415926535897931160E+00, /* 0x400921FB, 0x54442D18 */ pi = 3.1415926535897931160E+00, /* 0x400921FB, 0x54442D18 */
pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
INLINE STATIC const double INLINE STATIC double
__atan2(double y,double x) __atan2(double y,double x)
{ {
double z; double z;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_atanh.c,v 1.1 2005-05-29 11:19:00 obarthel Exp $ * $Id: math_atanh.c,v 1.2 2005-10-16 09:05:02 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -29,6 +29,15 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * 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 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*
*
* PowerPC math library based in part on work by Sun Microsystems
* 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.
*/ */
#ifndef _MATH_HEADERS_H #ifndef _MATH_HEADERS_H
@@ -41,11 +50,31 @@
/****************************************************************************/ /****************************************************************************/
static const double zero = 0.0;
static const double one = 1.0, huge = 1e300;
/****************************************************************************/
double double
atanh(double x) atanh(double x)
{ {
/* ZZZ unimplemented */ double t;
return(0); LONG hx,ix;
ULONG lx;
EXTRACT_WORDS(hx,lx,x);
ix = hx&0x7fffffff;
if ((ix|((lx|(-lx))>>31))>0x3ff00000) /* |x|>1 */
return (x-x)/(x-x);
if(ix==0x3ff00000)
return x/zero;
if(ix<0x3e300000&&(huge+x)>zero) return x; /* x<2**-28 */
SET_HIGH_WORD(x,ix);
if(ix<0x3fe00000) { /* x < 0.5 */
t = x+x;
t = 0.5*log1p(t+t*x/(one-x));
} else
t = 0.5*log1p((x+x)/(one-x));
if(hx>=0) return t; else return -t;
} }
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_atanhf.c,v 1.1 2005-05-29 11:19:00 obarthel Exp $ * $Id: math_atanhf.c,v 1.2 2005-10-16 09:05:02 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -29,6 +29,17 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * 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 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*
*
* PowerPC math library based in part on work by Sun Microsystems
* 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.
*
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
*/ */
#ifndef _MATH_HEADERS_H #ifndef _MATH_HEADERS_H
@@ -41,11 +52,29 @@
/****************************************************************************/ /****************************************************************************/
float static const float zero = 0.0;
atanhf(float x) static const float one = 1.0, huge = 1e30;
/****************************************************************************/
float atanhf(float x)
{ {
/* ZZZ unimplemented */ float t;
return(0); LONG hx,ix;
GET_FLOAT_WORD(hx,x);
ix = hx&0x7fffffff;
if (ix>0x3f800000) /* |x|>1 */
return (x-x)/(x-x);
if(ix==0x3f800000)
return x/zero;
if(ix<0x31800000&&(huge+x)>zero) return x; /* x<2**-28 */
SET_FLOAT_WORD(x,ix);
if(ix<0x3f000000) { /* x < 0.5 */
t = x+x;
t = (float)0.5*log1pf(t+t*x/(one-x));
} else
t = (float)0.5*log1pf((x+x)/(one-x));
if(hx>=0) return t; else return -t;
} }
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_ceil.c,v 1.4 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_ceil.c,v 1.5 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -152,7 +152,7 @@ __ceil(double x)
static const double huge = 1.0e300; static const double huge = 1.0e300;
INLINE STATIC const double INLINE STATIC double
__ceil(double x) __ceil(double x)
{ {
int i0,i1,j0; int i0,i1,j0;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_cos.c,v 1.4 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_cos.c,v 1.5 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -137,7 +137,7 @@ __cos(double x)
#if defined(PPC_FLOATING_POINT_SUPPORT) #if defined(PPC_FLOATING_POINT_SUPPORT)
INLINE STATIC const double INLINE STATIC double
__cos(double x) __cos(double x)
{ {
double y[2],z=0.0; double y[2],z=0.0;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_cosh.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_cosh.c,v 1.4 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -139,7 +139,7 @@ __cosh(double x)
static const double one = 1.0, half=0.5, huge = 1.0e300; static const double one = 1.0, half=0.5, huge = 1.0e300;
INLINE STATIC const double INLINE STATIC double
__cosh(double x) __cosh(double x)
{ {
double t,w; double t,w;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_exp.c,v 1.4 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_exp.c,v 1.5 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -155,7 +155,7 @@ P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */
P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */ P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */
P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
INLINE STATIC const double INLINE STATIC double
__exp(double x) __exp(double x)
{ {
double y,hi,lo,c,t; double y,hi,lo,c,t;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_fabs.c,v 1.6 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_fabs.c,v 1.7 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -134,7 +134,7 @@ __fabs(double x)
/****************************************************************************/ /****************************************************************************/
INLINE STATIC const double INLINE STATIC double
__fabs(double x) __fabs(double x)
{ {
double res; double res;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_fabsf.c,v 1.1 2005-05-08 08:51:29 obarthel Exp $ * $Id: math_fabsf.c,v 1.2 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -108,7 +108,7 @@ __fabsf(float x)
/****************************************************************************/ /****************************************************************************/
INLINE STATIC const float INLINE STATIC float
__fabsf(float number) __fabsf(float number)
{ {
union ieee_single x; union ieee_single x;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_floor.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_floor.c,v 1.4 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -153,7 +153,8 @@ __floor(double x)
#if defined(PPC_FLOATING_POINT_SUPPORT) #if defined(PPC_FLOATING_POINT_SUPPORT)
static const double huge = 1.0e300; static const double huge = 1.0e300;
INLINE STATIC const double
INLINE STATIC double
__floor(double x) __floor(double x)
{ {
int i0,i1,j0; int i0,i1,j0;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_fma.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ * $Id: math_fma.c,v 1.2 2005-10-09 10:38:55 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -44,8 +44,9 @@
double double
fma(double x,double y,double z) fma(double x,double y,double z)
{ {
/* ZZZ unimplemented */ /* ZZZ this should be a *fused* multiply & add, and
return(0); not a sequential operation as declared below! */
return((x * y) + z);
} }
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_fmaf.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ * $Id: math_fmaf.c,v 1.2 2005-10-09 10:38:55 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -44,8 +44,9 @@
float float
fmaf(float x,float y,float z) fmaf(float x,float y,float z)
{ {
/* ZZZ unimplemented */ /* ZZZ this should be a *fused* multiply & add, and
return(0); not a sequential operation as declared below! */
return((x * y) + z);
} }
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_fmod.c,v 1.5 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_fmod.c,v 1.6 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -102,7 +102,7 @@ static const double
one = 1.0, one = 1.0,
Zero[] = {0.0, -0.0,}; Zero[] = {0.0, -0.0,};
INLINE STATIC const double INLINE STATIC double
__fmod(double x,double y) __fmod(double x,double y)
{ {
int n,hx,hy,hz,ix,iy,sx,i; int n,hx,hy,hz,ix,iy,sx,i;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_frexp.c,v 1.4 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_frexp.c,v 1.5 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -146,7 +146,7 @@ __frexp(double x,int * nptr)
static const double static const double
two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */ two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */
INLINE STATIC const double INLINE STATIC double
__frexp(double x,int * eptr) __frexp(double x,int * eptr)
{ {
int hx, ix, lx; int hx, ix, lx;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_headers.h,v 1.11 2005-05-30 08:10:37 obarthel Exp $ * $Id: math_headers.h,v 1.12 2005-10-09 10:38:55 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -220,6 +220,8 @@ extern float __kernel_cosf(float x, float y);
extern float __kernel_sinf(float x, float y, int iy); extern float __kernel_sinf(float x, float y, int iy);
extern LONG __rem_pio2f(float x, float *y); extern LONG __rem_pio2f(float x, float *y);
extern float __kernel_tanf(float x, float y, int iy); extern float __kernel_tanf(float x, float y, int iy);
extern double __lgamma(double x,int * gamma_sign_ptr);
extern float __lgammaf(float x,int * gamma_sign_ptr);
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_hypot.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_hypot.c,v 1.5 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -85,38 +85,43 @@ __hypot(double x,double y)
static const double one = 1.0; static const double one = 1.0;
INLINE STATIC const double INLINE STATIC double
__hypot(double x,double y) __hypot(double x,double y)
{ {
int n0;
double a=x,b=y,t1,t2,y1,y2,w; double a=x,b=y,t1,t2,y1,y2,w;
int j,k,ha,hb; int j,k,ha,hb;
n0 = ((*(int*)&one)>>29)^1; /* high word index */ GET_HIGH_WORD(ha,x);
ha = *(n0+(int*)&x)&0x7fffffff; /* high word of x */ ha &= 0x7fffffff;
hb = *(n0+(int*)&y)&0x7fffffff; /* high word of y */ GET_HIGH_WORD(hb,y);
hb &= 0x7fffffff;
if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;} if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;}
*(n0+(int*)&a) = ha; /* a <- |a| */ SET_HIGH_WORD(a,ha); /* a <- |a| */
*(n0+(int*)&b) = hb; /* b <- |b| */ SET_HIGH_WORD(b,hb); /* b <- |b| */
if((ha-hb)>0x3c00000) {return a+b;} /* x/y > 2**60 */ if((ha-hb)>0x3c00000) {return a+b;} /* x/y > 2**60 */
k=0; k=0;
if(ha > 0x5f300000) { /* a>2**500 */ if(ha > 0x5f300000) { /* a>2**500 */
if(ha >= 0x7ff00000) { /* Inf or NaN */ if(ha >= 0x7ff00000) { /* Inf or NaN */
unsigned int low;
w = a+b; /* for sNaN */ w = a+b; /* for sNaN */
if(((ha&0xfffff)|*(1-n0+(int*)&a))==0) w = a; GET_LOW_WORD(low,a);
if(((hb^0x7ff00000)|*(1-n0+(int*)&b))==0) w = b; if(((ha&0xfffff)|low)==0) w = a;
GET_LOW_WORD(low,b);
if(((hb^0x7ff00000)|low)==0) w = b;
return w; return w;
} }
/* scale a and b by 2**-600 */ /* scale a and b by 2**-600 */
ha -= 0x25800000; hb -= 0x25800000; k += 600; ha -= 0x25800000; hb -= 0x25800000; k += 600;
*(n0+(int*)&a) = ha; SET_HIGH_WORD(a,ha);
*(n0+(int*)&b) = hb; SET_HIGH_WORD(b,hb);
} }
if(hb < 0x20b00000) { /* b < 2**-500 */ if(hb < 0x20b00000) { /* b < 2**-500 */
if(hb <= 0x000fffff) { /* subnormal b or 0 */ if(hb <= 0x000fffff) { /* subnormal b or 0 */
if((hb|(*(1-n0+(int*)&b)))==0) return a; unsigned int low;
GET_LOW_WORD(low,b);
if((hb|low)==0) return a;
t1=0; t1=0;
*(n0+(int*)&t1) = 0x7fd00000; /* t1=2^1022 */ SET_HIGH_WORD(t1,0x7fd00000); /* t1=2^1022 */
b *= t1; b *= t1;
a *= t1; a *= t1;
k -= 1022; k -= 1022;
@@ -124,30 +129,32 @@ __hypot(double x,double y)
ha += 0x25800000; /* a *= 2^600 */ ha += 0x25800000; /* a *= 2^600 */
hb += 0x25800000; /* b *= 2^600 */ hb += 0x25800000; /* b *= 2^600 */
k -= 600; k -= 600;
*(n0+(int*)&a) = ha; SET_HIGH_WORD(a,ha);
*(n0+(int*)&b) = hb; SET_HIGH_WORD(b,hb);
} }
} }
/* medium size a and b */ /* medium size a and b */
w = a-b; w = a-b;
if (w>b) { if (w>b) {
t1 = 0; t1 = 0;
*(n0+(int*)&t1) = ha; SET_HIGH_WORD(t1,ha);
t2 = a-t1; t2 = a-t1;
w = sqrt(t1*t1-(b*(-b)-t2*(a+t1))); w = sqrt(t1*t1-(b*(-b)-t2*(a+t1)));
} else { } else {
a = a+a; a = a+a;
y1 = 0; y1 = 0;
*(n0+(int*)&y1) = hb; SET_HIGH_WORD(y1,hb);
y2 = b - y1; y2 = b - y1;
t1 = 0; t1 = 0;
*(n0+(int*)&t1) = ha+0x00100000; SET_HIGH_WORD(t1,ha+0x00100000);
t2 = a - t1; t2 = a - t1;
w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b)));
} }
if(k!=0) { if(k!=0) {
unsigned int high;
t1 = 1.0; t1 = 1.0;
*(n0+(int*)&t1) += (k<<20); GET_HIGH_WORD(high,t1);
SET_HIGH_WORD(t1,high+(k<<20));
return t1*w; return t1*w;
} else return w; } else return w;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_kernel_rem_pio2.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_kernel_rem_pio2.c,v 1.4 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -329,6 +329,8 @@ int __rem_pio2(double x, double *y)
if(ix>=0x7ff00000) { /* x is inf or NaN */ if(ix>=0x7ff00000) { /* x is inf or NaN */
y[0]=y[1]=x-x; return 0; y[0]=y[1]=x-x; return 0;
} }
/* keep the compiler happy */
z = 0;
/* set z = __scalbn(|x|,ilogb(x)-23) */ /* set z = __scalbn(|x|,ilogb(x)-23) */
GET_LOW_WORD(low,x); GET_LOW_WORD(low,x);
SET_LOW_WORD(z,low); SET_LOW_WORD(z,low);

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_ldexp.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_ldexp.c,v 1.5 2005-10-16 09:17:11 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -50,122 +50,22 @@
/****************************************************************************/ /****************************************************************************/
#if defined(IEEE_FLOATING_POINT_SUPPORT)
#define MANT_MASK 0x800FFFFF /* Mantissa extraction mask */
#define ZPOS_MASK 0x3FF00000 /* Positive # mask for exp = 0 */
#define ZNEG_MASK 0x3FF00000 /* Negative # mask for exp = 0 */
#define EXP_MASK 0x7FF00000 /* Mask for exponent */
#define EXP_SHIFTS 20 /* Shifts to get into LSB's */
#define EXP_BIAS 1023 /* Exponent bias */
union dtol
{
double dval;
long ival[2];
};
INLINE STATIC const double
__ldexp(double x,int n)
{
union dtol number;
long *iptr, cn;
number.dval = x;
iptr = &number.ival[0];
cn = (((*iptr) & EXP_MASK) >> EXP_SHIFTS) - EXP_BIAS;
(*iptr) &= ~EXP_MASK;
n += EXP_BIAS;
/* ZZZ we can't just muck with the exponent, we
* have to check for underflow and overflow, too!
*/
(*iptr) |= ((n + cn) << EXP_SHIFTS) & EXP_MASK;
return(number.dval);
}
#endif /* IEEE_FLOATING_POINT_SUPPORT */
/****************************************************************************/
#if defined(M68881_FLOATING_POINT_SUPPORT)
INLINE STATIC const double
__ldexp(double x,int n)
{
double result;
__asm ("fscale%.l %2,%0"
: "=f" (result)
: "0" (x),
"dmi" (n));
return(result);
}
#endif /* M68881_FLOATING_POINT_SUPPORT */
/****************************************************************************/
#if defined(PPC_FLOATING_POINT_SUPPORT)
#define MANT_MASK 0x800FFFFF /* Mantissa extraction mask */
#define ZPOS_MASK 0x3FF00000 /* Positive # mask for exp = 0 */
#define ZNEG_MASK 0x3FF00000 /* Negative # mask for exp = 0 */
#define EXP_MASK 0x7FF00000 /* Mask for exponent */
#define EXP_SHIFTS 20 /* Shifts to get into LSB's */
#define EXP_BIAS 1023 /* Exponent bias */
union dtol
{
double dval;
long ival[2];
};
INLINE STATIC const double
__ldexp(double x,int n)
{
union dtol number;
long *iptr, cn;
number.dval = x;
iptr = &number.ival[0];
cn = (((*iptr) & EXP_MASK) >> EXP_SHIFTS) - EXP_BIAS;
(*iptr) &= ~EXP_MASK;
n += EXP_BIAS;
/* ZZZ we can't just muck with the exponent, we
* have to check for underflow and overflow, too!
*/
(*iptr) |= ((n + cn) << EXP_SHIFTS) & EXP_MASK;
return(number.dval);
}
#endif /* PPC_FLOATING_POINT_SUPPORT */
/****************************************************************************/
double double
ldexp(double x,int n) ldexp(double x, int exp)
{ {
double result; double result;
if(x != 0.0) if(isinf(x) || fpclassify(x) == FP_ZERO)
result = __ldexp(x,n); {
result = x;
}
else else
result = 0.0; {
result = scalbn(x,exp);
if(isinf(result) || (result < DBL_MIN || result > -DBL_MIN))
__set_errno(ERANGE);
}
return(result); return(result);
} }

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_lgamma.c,v 1.2 2005-05-30 08:47:26 obarthel Exp $ * $Id: math_lgamma.c,v 1.3 2005-10-09 10:38:55 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -157,7 +157,7 @@ sin_pi(double x)
} }
double double
lgamma(double x) __lgamma(double x,int * gamma_sign_ptr)
{ {
double t,y,z,nadj=0.0,p,p1,p2,p3,q,r,w; double t,y,z,nadj=0.0,p,p1,p2,p3,q,r,w;
LONG i,hx,lx,ix; LONG i,hx,lx,ix;
@@ -165,11 +165,13 @@ lgamma(double x)
EXTRACT_WORDS(hx,lx,x); EXTRACT_WORDS(hx,lx,x);
/* purge off +-inf, NaN, +-0, and negative arguments */ /* purge off +-inf, NaN, +-0, and negative arguments */
(*gamma_sign_ptr) = 1;
ix = hx&0x7fffffff; ix = hx&0x7fffffff;
if(ix>=0x7ff00000) return x*x; if(ix>=0x7ff00000) return x*x;
if((ix|lx)==0) return one/zero; if((ix|lx)==0) return one/zero;
if(ix<0x3b900000) { /* |x|<2**-70, return -log(|x|) */ if(ix<0x3b900000) { /* |x|<2**-70, return -log(|x|) */
if(hx<0) { if(hx<0) {
(*gamma_sign_ptr) = -1;
return -log(-x); return -log(-x);
} else return -log(x); } else return -log(x);
} }
@@ -179,6 +181,8 @@ lgamma(double x)
t = sin_pi(x); t = sin_pi(x);
if(t==zero) return one/zero; /* -integer */ if(t==zero) return one/zero; /* -integer */
nadj = log(pi/fabs(t*x)); nadj = log(pi/fabs(t*x));
if(t<zero)
(*gamma_sign_ptr) = -1;
x = -x; x = -x;
} }
@@ -250,4 +254,17 @@ lgamma(double x)
/****************************************************************************/ /****************************************************************************/
double
lgamma(double x)
{
double result;
int gamma_sign;
result = __lgamma(x,&gamma_sign);
return(result);
}
/****************************************************************************/
#endif /* FLOATING_POINT_SUPPORT */ #endif /* FLOATING_POINT_SUPPORT */

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_lgammaf.c,v 1.2 2005-05-30 08:47:26 obarthel Exp $ * $Id: math_lgammaf.c,v 1.3 2005-10-09 10:38:55 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -170,7 +170,7 @@ sin_pif(float x)
float float
lgammaf(float x) __lgammaf(float x,int * gamma_sign_ptr)
{ {
float t,y,z,nadj=0.0,p,p1,p2,p3,q,r,w; float t,y,z,nadj=0.0,p,p1,p2,p3,q,r,w;
LONG i,hx,ix; LONG i,hx,ix;
@@ -178,11 +178,13 @@ lgammaf(float x)
GET_FLOAT_WORD(hx,x); GET_FLOAT_WORD(hx,x);
/* purge off +-inf, NaN, +-0, and negative arguments */ /* purge off +-inf, NaN, +-0, and negative arguments */
(*gamma_sign_ptr) = 1;
ix = hx&0x7fffffff; ix = hx&0x7fffffff;
if(ix>=0x7f800000) return x*x; if(ix>=0x7f800000) return x*x;
if(ix==0) return one/zero; if(ix==0) return one/zero;
if(ix<0x1c800000) { /* |x|<2**-70, return -log(|x|) */ if(ix<0x1c800000) { /* |x|<2**-70, return -log(|x|) */
if(hx<0) { if(hx<0) {
(*gamma_sign_ptr) = -1;
return -logf(-x); return -logf(-x);
} else return -logf(x); } else return -logf(x);
} }
@@ -192,6 +194,8 @@ lgammaf(float x)
t = sin_pif(x); t = sin_pif(x);
if(t==zero) return one/zero; /* -integer */ if(t==zero) return one/zero; /* -integer */
nadj = logf(pi/fabsf(t*x)); nadj = logf(pi/fabsf(t*x));
if(t<zero)
(*gamma_sign_ptr) = -1;
x = -x; x = -x;
} }
@@ -263,4 +267,17 @@ lgammaf(float x)
/****************************************************************************/ /****************************************************************************/
float
lgammaf(float x)
{
int gamma_sign;
float result;
result = __lgammaf(x,&gamma_sign);
return(result);
}
/****************************************************************************/
#endif /* FLOATING_POINT_SUPPORT */ #endif /* FLOATING_POINT_SUPPORT */

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_log.c,v 1.7 2005-08-26 12:39:33 obarthel Exp $ * $Id: math_log.c,v 1.8 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -150,7 +150,7 @@ Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */
Lg7 = 1.479819860511658591e-01, /* 3FC2F112 DF3E5244 */ Lg7 = 1.479819860511658591e-01, /* 3FC2F112 DF3E5244 */
zero = 0.0; zero = 0.0;
INLINE STATIC const double INLINE STATIC double
__log(double x) __log(double x)
{ {
double hfsq,f,s,z,R,w,t1,t2,dk; double hfsq,f,s,z,R,w,t1,t2,dk;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_log10.c,v 1.6 2005-08-26 12:39:33 obarthel Exp $ * $Id: math_log10.c,v 1.7 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -144,7 +144,7 @@ log10_2hi = 3.01029995663611771306e-01, /* 0x3FD34413, 0x509F6000 */
log10_2lo = 3.69423907715893078616e-13, /* 0x3D59FEF3, 0x11F12B36 */ log10_2lo = 3.69423907715893078616e-13, /* 0x3D59FEF3, 0x11F12B36 */
zero = 0.0; zero = 0.0;
INLINE STATIC const double INLINE STATIC double
__log10(double x) __log10(double x)
{ {
double y,z; double y,z;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_logb.c,v 1.7 2005-08-26 12:39:33 obarthel Exp $ * $Id: math_logb.c,v 1.8 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -70,7 +70,7 @@ __logb(double x)
#if defined(PPC_FLOATING_POINT_SUPPORT) #if defined(PPC_FLOATING_POINT_SUPPORT)
INLINE STATIC const double INLINE STATIC double
__logb(double x) __logb(double x)
{ {
unsigned int lx,ix; unsigned int lx,ix;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_lrint.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ * $Id: math_lrint.c,v 1.2 2005-10-09 10:38:55 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -29,6 +29,15 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * 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 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*
*
* PowerPC math library based in part on work by Sun Microsystems
* 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.
*/ */
#ifndef _MATH_HEADERS_H #ifndef _MATH_HEADERS_H
@@ -41,11 +50,75 @@
/****************************************************************************/ /****************************************************************************/
/* Adding a double, x, to 2^52 will cause the result to be rounded based on
the fractional part of x, according to the implementation's current rounding
mode. 2^52 is the smallest double that can be represented using all 52 significant
digits. */
static const double TWO52[2]={
4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
-4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
};
/****************************************************************************/
long int long int
lrint(double x) lrint(double x)
{ {
/* ZZZ unimplemented */ LONG i0,j0,sx;
return(0); ULONG i1;
double t;
volatile double w;
long int result;
EXTRACT_WORDS(i0,i1,x);
/* Extract sign bit. */
sx = (i0>>31)&1;
/* Extract exponent field. */
j0 = ((i0 & 0x7ff00000) >> 20) - 1023;
if(j0 < 20)
{
if(j0 < -1)
return 0;
else
{
w = TWO52[sx] + x;
t = w - TWO52[sx];
GET_HIGH_WORD(i0, t);
/* Detect the all-zeros representation of plus and
minus zero, which fails the calculation below. */
if ((i0 & ~(1 << 31)) == 0)
return 0;
j0 = ((i0 & 0x7ff00000) >> 20) - 1023;
i0 &= 0x000fffff;
i0 |= 0x00100000;
result = i0 >> (20 - j0);
}
}
else if (j0 < (int)(8 * sizeof (long int)) - 1)
{
if (j0 >= 52)
result = ((long int) ((i0 & 0x000fffff) | 0x0010000) << (j0 - 20)) |
(i1 << (j0 - 52));
else
{
w = TWO52[sx] + x;
t = w - TWO52[sx];
EXTRACT_WORDS (i0, i1, t);
j0 = ((i0 & 0x7ff00000) >> 20) - 1023;
i0 &= 0x000fffff;
i0 |= 0x00100000;
result = ((long int) i0 << (j0 - 20)) | (i1 >> (52 - j0));
}
}
else
{
return (long int) x;
}
return sx ? -result : result;
} }
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_lrintf.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ * $Id: math_lrintf.c,v 1.2 2005-10-09 10:38:55 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -29,6 +29,15 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * 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 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*
*
* PowerPC math library based in part on work by Sun Microsystems
* 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.
*/ */
#ifndef _MATH_HEADERS_H #ifndef _MATH_HEADERS_H
@@ -41,11 +50,60 @@
/****************************************************************************/ /****************************************************************************/
/* Adding a float, x, to 2^23 will cause the result to be rounded based on
the fractional part of x, according to the implementation's current rounding
mode. 2^23 is the smallest float that can be represented using all 23 significant
digits. */
static const float TWO23[2]={
8.3886080000e+06, /* 0x4b000000 */
-8.3886080000e+06, /* 0xcb000000 */
};
/****************************************************************************/
long int long int
lrintf(float x) lrintf(float x)
{ {
/* ZZZ unimplemented */ LONG j0,sx;
return(0); ULONG i0;
float t;
volatile float w;
long int result;
GET_FLOAT_WORD(i0,x);
/* Extract sign bit. */
sx = (i0 >> 31);
/* Extract exponent field. */
j0 = ((i0 & 0x7f800000) >> 23) - 127;
if (j0 < (int)(sizeof (long int) * 8) - 1)
{
if (j0 < -1)
return 0;
else if (j0 >= 23)
result = (long int) ((i0 & 0x7fffff) | 0x800000) << (j0 - 23);
else
{
w = TWO23[sx] + x;
t = w - TWO23[sx];
GET_FLOAT_WORD (i0, t);
/* Detect the all-zeros representation of plus and
minus zero, which fails the calculation below. */
if ((i0 & ~(1 << 31)) == 0)
return 0;
j0 = ((i0 >> 23) & 0xff) - 0x7f;
i0 &= 0x7fffff;
i0 |= 0x800000;
result = i0 >> (23 - j0);
}
}
else
{
return (long int) x;
}
return sx ? -result : result;
} }
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_lround.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ * $Id: math_lround.c,v 1.3 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -29,6 +29,15 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * 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 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*
*
* PowerPC math library based in part on work by Sun Microsystems
* 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.
*/ */
#ifndef _MATH_HEADERS_H #ifndef _MATH_HEADERS_H
@@ -44,8 +53,52 @@
long int long int
lround(double x) lround(double x)
{ {
/* ZZZ unimplemented */ LONG sign, exponent_less_1023;
return(0); /* Most significant word, least significant word. */
ULONG msw, lsw;
long int result;
EXTRACT_WORDS(msw, lsw, x);
/* Extract sign. */
sign = ((msw & 0x80000000) ? -1 : 1);
/* Extract exponent field. */
exponent_less_1023 = ((msw & 0x7ff00000) >> 20) - 1023;
msw &= 0x000fffff;
msw |= 0x00100000;
if (exponent_less_1023 < 20)
{
if (exponent_less_1023 < 0)
{
if (exponent_less_1023 < -1)
return 0;
else
return sign;
}
else
{
msw += 0x80000 >> exponent_less_1023;
result = msw >> (20 - exponent_less_1023);
}
}
else if (exponent_less_1023 < (LONG)(8 * sizeof (long int)) - 1)
{
if (exponent_less_1023 >= 52)
result = ((long int) msw << (exponent_less_1023 - 20)) | (lsw << (exponent_less_1023 - 52));
else
{
unsigned int tmp = lsw + (0x80000000 >> (exponent_less_1023 - 20));
if (tmp < lsw)
++msw;
result = ((long int) msw << (exponent_less_1023 - 20)) | (tmp >> (52 - exponent_less_1023));
}
}
else
/* Result is too large to be represented by a long int. */
return (long int)x;
return sign * result;
} }
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_lroundf.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ * $Id: math_lroundf.c,v 1.3 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -29,6 +29,15 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * 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 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*
*
* PowerPC math library based in part on work by Sun Microsystems
* 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.
*/ */
#ifndef _MATH_HEADERS_H #ifndef _MATH_HEADERS_H
@@ -44,8 +53,33 @@
long int long int
lroundf(float x) lroundf(float x)
{ {
/* ZZZ unimplemented */ LONG exponent_less_127;
return(0); ULONG w;
long int result;
LONG sign;
GET_FLOAT_WORD (w, x);
exponent_less_127 = ((w & 0x7f800000) >> 23) - 127;
sign = (w & 0x80000000) != 0 ? -1 : 1;
w &= 0x7fffff;
w |= 0x800000;
if (exponent_less_127 < (LONG)(8 * sizeof (long int)) - 1)
{
if (exponent_less_127 < 0)
return exponent_less_127 < -1 ? 0 : sign;
else if (exponent_less_127 >= 23)
result = (long int) w << (exponent_less_127 - 23);
else
{
w += 0x400000 >> exponent_less_127;
result = w >> (23 - exponent_less_127);
}
}
else
return (long int) x;
return sign * result;
} }
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_modf.c,v 1.5 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_modf.c,v 1.6 2005-10-16 09:05:02 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -56,38 +56,10 @@
/****************************************************************************/ /****************************************************************************/
#if defined(IEEE_FLOATING_POINT_SUPPORT) #if defined(M68881_FLOATING_POINT_SUPPORT)
INLINE STATIC const double
__modf(double x,double *nptr)
{
double int_n;
double result;
if(x < 0.0)
{
int_n = ceil(x);
result = int_n - x;
}
else
{
int_n = floor(x);
result = x - int_n;
}
(*nptr) = int_n;
return(result);
}
#endif /* IEEE_FLOATING_POINT_SUPPORT */
/****************************************************************************/ /****************************************************************************/
#if defined(M68881_FLOATING_POINT_SUPPORT)
INLINE STATIC const double INLINE STATIC const double
__modf(double x,double *nptr) __modf(double x,double *nptr)
{ {
@@ -105,37 +77,62 @@ __modf(double x,double *nptr)
return(result); return(result);
} }
#endif /* M68881_FLOATING_POINT_SUPPORT */ /****************************************************************************/
#else
/****************************************************************************/ /****************************************************************************/
#if defined(__PPC__) static const double one = 1.0;
INLINE STATIC const double INLINE STATIC double
__modf(double x,double *nptr) __modf(double x, double *iptr)
{ {
double int_n; LONG i0,i1,j0;
double result; ULONG i;
EXTRACT_WORDS(i0,i1,x);
if(x < 0.0) j0 = ((i0>>20)&0x7ff)-0x3ff; /* exponent of x */
{ if(j0<20) { /* integer part in high x */
int_n = ceil(x); if(j0<0) { /* |x|<1 */
INSERT_WORDS(*iptr,i0&0x80000000,0); /* *iptr = +-0 */
result = int_n - x; return x;
} else {
i = (0x000fffff)>>j0;
if(((i0&i)|i1)==0) { /* x is integral */
ULONG high;
*iptr = x;
GET_HIGH_WORD(high,x);
INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */
return x;
} else {
INSERT_WORDS(*iptr,i0&(~i),0);
return x - *iptr;
}
}
} else if (j0>51) { /* no fraction part */
ULONG high;
*iptr = x*one;
GET_HIGH_WORD(high,x);
INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */
return x;
} else { /* fraction part in low x */
i = ((ULONG)(0xffffffff))>>(j0-20);
if((i1&i)==0) { /* x is integral */
ULONG high;
*iptr = x;
GET_HIGH_WORD(high,x);
INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */
return x;
} else {
INSERT_WORDS(*iptr,i0,i1&(~i));
return x - *iptr;
}
} }
else
{
int_n = floor(x);
result = x - int_n;
}
(*nptr) = int_n;
return(result);
} }
#endif /* PPC_FLOATING_POINT_SUPPORT */ /****************************************************************************/
#endif /* M68881_FLOATING_POINT_SUPPORT */
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_nan.c,v 1.2 2005-05-14 10:52:31 obarthel Exp $ * $Id: math_nan.c,v 1.3 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -47,7 +47,7 @@
/****************************************************************************/ /****************************************************************************/
double double
nan(const char * UNUSED tagp) nan(const char * UNUSED unused_tagp)
{ {
union ieee_double x; union ieee_double x;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_nanf.c,v 1.2 2005-05-14 10:52:31 obarthel Exp $ * $Id: math_nanf.c,v 1.3 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -47,7 +47,7 @@
/****************************************************************************/ /****************************************************************************/
float float
nanf(const char * UNUSED tagp) nanf(const char * UNUSED unused_tagp)
{ {
union ieee_single x; union ieee_single x;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_nearbyint.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ * $Id: math_nearbyint.c,v 1.2 2005-10-09 10:38:55 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -44,8 +44,8 @@
double double
nearbyint(double x) nearbyint(double x)
{ {
/* ZZZ unimplemented */ /* ZZZ is this such a good idea? */
return(0); return(rint(x));
} }
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_nearbyintf.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ * $Id: math_nearbyintf.c,v 1.2 2005-10-09 10:38:55 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -44,8 +44,8 @@
float float
nearbyintf(float x) nearbyintf(float x)
{ {
/* ZZZ unimplemented */ /* ZZZ is this such a good idea? */
return(0); return(rintf(x));
} }
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_pow.c,v 1.6 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_pow.c,v 1.7 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -208,7 +208,7 @@ ivln2 = 1.44269504088896338700e+00, /* 0x3FF71547, 0x652B82FE =1/ln2 */
ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2*/ ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2*/
ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
INLINE STATIC const double INLINE STATIC double
__pow(double x,double y) __pow(double x,double y)
{ {
double z,ax,z_h,z_l,p_h,p_l; double z,ax,z_h,z_l,p_h,p_l;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_remquo.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ * $Id: math_remquo.c,v 1.2 2005-10-09 10:38:55 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -29,6 +29,12 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * 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 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*
*
* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/ */
#ifndef _MATH_HEADERS_H #ifndef _MATH_HEADERS_H
@@ -44,8 +50,24 @@
double double
remquo(double x,double y,int * quo) remquo(double x,double y,int * quo)
{ {
/* ZZZ unimplemented */ int signx, signy, signres;
return(0); int mswx;
int mswy;
double x_over_y;
GET_HIGH_WORD(mswx, x);
GET_HIGH_WORD(mswy, y);
signx = (mswx & 0x80000000) >> 31;
signy = (mswy & 0x80000000) >> 31;
signres = (signx ^ signy) ? -1 : 1;
x_over_y = fabs(x / y);
*quo = signres * (lrint(x_over_y) & 0x7f);
return remainder(x,y);
} }
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_remquof.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ * $Id: math_remquof.c,v 1.2 2005-10-09 10:38:55 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -29,6 +29,12 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * 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 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*
*
* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/ */
#ifndef _MATH_HEADERS_H #ifndef _MATH_HEADERS_H
@@ -44,8 +50,24 @@
float float
remquof(float x,float y,int * quo) remquof(float x,float y,int * quo)
{ {
/* ZZZ unimplemented */ int signx, signy, signres;
return(0); int wx;
int wy;
float x_over_y;
GET_FLOAT_WORD(wx, x);
GET_FLOAT_WORD(wy, y);
signx = (wx & 0x80000000) >> 31;
signy = (wy & 0x80000000) >> 31;
signres = (signx ^ signy) ? -1 : 1;
x_over_y = fabsf(x / y);
*quo = signres * (lrintf(x_over_y) & 0x7f);
return remainderf(x,y);
} }
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_round.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ * $Id: math_round.c,v 1.2 2005-10-09 10:38:55 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -29,6 +29,15 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * 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 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*
*
* PowerPC math library based in part on work by Sun Microsystems
* 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.
*/ */
#ifndef _MATH_HEADERS_H #ifndef _MATH_HEADERS_H
@@ -44,8 +53,64 @@
double double
round(double x) round(double x)
{ {
/* ZZZ unimplemented */ /* Most significant word, least significant word. */
return(0); LONG msw, exponent_less_1023;
ULONG lsw;
EXTRACT_WORDS(msw, lsw, x);
/* Extract exponent field. */
exponent_less_1023 = ((msw & 0x7ff00000) >> 20) - 1023;
if (exponent_less_1023 < 20)
{
if (exponent_less_1023 < 0)
{
msw &= 0x80000000;
if (exponent_less_1023 == -1)
/* Result is +1.0 or -1.0. */
msw |= (1023 << 20);
lsw = 0;
}
else
{
ULONG exponent_mask = 0x000fffff >> exponent_less_1023;
if ((msw & exponent_mask) == 0 && lsw == 0)
/* x in an integral value. */
return x;
msw += 0x00080000 >> exponent_less_1023;
msw &= ~exponent_mask;
lsw = 0;
}
}
else if (exponent_less_1023 > 51)
{
if (exponent_less_1023 == 1024)
/* x is NaN or infinite. */
return x + x;
else
return x;
}
else
{
ULONG exponent_mask = 0xffffffff >> (exponent_less_1023 - 20);
ULONG tmp;
if ((lsw & exponent_mask) == 0)
/* x is an integral value. */
return x;
tmp = lsw + (1 << (51 - exponent_less_1023));
if (tmp < lsw)
msw += 1;
lsw = tmp;
lsw &= ~exponent_mask;
}
INSERT_WORDS(x, msw, lsw);
return x;
} }
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_roundf.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ * $Id: math_roundf.c,v 1.2 2005-10-09 10:38:55 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -29,6 +29,15 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * 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 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*
*
* PowerPC math library based in part on work by Sun Microsystems
* 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.
*/ */
#ifndef _MATH_HEADERS_H #ifndef _MATH_HEADERS_H
@@ -44,8 +53,49 @@
float float
roundf(float x) roundf(float x)
{ {
/* ZZZ unimplemented */ int signbit;
return(0); ULONG w;
/* Most significant word, least significant word. */
int exponent_less_127;
GET_FLOAT_WORD(w, x);
/* Extract sign bit. */
signbit = w & 0x80000000;
/* Extract exponent field. */
exponent_less_127 = (int)((w & 0x7f800000) >> 23) - 127;
if (exponent_less_127 < 23)
{
if (exponent_less_127 < 0)
{
w &= 0x80000000;
if (exponent_less_127 == -1)
/* Result is +1.0 or -1.0. */
w |= (127 << 23);
}
else
{
unsigned int exponent_mask = 0x007fffff >> exponent_less_127;
if ((w & exponent_mask) == 0)
/* x has an integral value. */
return x;
w += 0x00400000 >> exponent_less_127;
w &= ~exponent_mask;
}
}
else
{
if (exponent_less_127 == 128)
/* x is NaN or infinite. */
return x + x;
else
return x;
}
SET_FLOAT_WORD(x, w);
return x;
} }
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_sin.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_sin.c,v 1.4 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -137,7 +137,7 @@ __sin(double x)
#if defined(PPC_FLOATING_POINT_SUPPORT) #if defined(PPC_FLOATING_POINT_SUPPORT)
INLINE STATIC const double INLINE STATIC double
__sin(double x) __sin(double x)
{ {
double y[2],z=0.0; double y[2],z=0.0;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_sinh.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_sinh.c,v 1.4 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -139,7 +139,7 @@ __sinh(double x)
static const double one = 1.0, shuge = 1.0e307; static const double one = 1.0, shuge = 1.0e307;
INLINE STATIC const double INLINE STATIC double
__sinh(double x) __sinh(double x)
{ {
double t,w,h; double t,w,h;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_sqrt.c,v 1.6 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_sqrt.c,v 1.7 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -139,7 +139,7 @@ __sqrt(double x)
static const double one = 1.0, tiny=1.0e-300; static const double one = 1.0, tiny=1.0e-300;
INLINE STATIC const double INLINE STATIC double
__sqrt(double x) __sqrt(double x)
{ {
double z; double z;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_tan.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_tan.c,v 1.4 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -137,7 +137,7 @@ __tan(double x)
#if defined(PPC_FLOATING_POINT_SUPPORT) #if defined(PPC_FLOATING_POINT_SUPPORT)
INLINE STATIC const double INLINE STATIC double
__tan(double x) __tan(double x)
{ {
double y[2],z=0.0; double y[2],z=0.0;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: math_tanh.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ * $Id: math_tanh.c,v 1.4 2005-10-27 08:58:41 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -139,7 +139,7 @@ __tanh(double x)
static const double one=1.0, two=2.0, tiny = 1.0e-300; static const double one=1.0, two=2.0, tiny = 1.0e-300;
INLINE STATIC const double INLINE STATIC double
__tanh(double x) __tanh(double x)
{ {
double t,z; double t,z;

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