mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
Compare commits
57 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f19f5b951 | |||
| 0f5e6747e0 | |||
| a0a46206d1 | |||
| c7fbdf27e1 | |||
| 010d4c1c06 | |||
| 81958fd44b | |||
| 937169c0ba | |||
| dda36eb609 | |||
| 867e6d500a | |||
| 99e9ebfc15 | |||
| 63c08cfe0e | |||
| b6de3e4c48 | |||
| 090753282b | |||
| d45da0acd4 | |||
| 3480ec40b3 | |||
| f9e782d358 | |||
| 44bcf889e5 | |||
| 257dd6af88 | |||
| acafd14bc2 | |||
| b63587ed80 | |||
| b861ed19c4 | |||
| ccfea73fc5 | |||
| d74640b15b | |||
| db9a1c69e5 | |||
| cb1f1a4a10 | |||
| bb2376a6ed | |||
| 159e55f1e6 | |||
| 4e30f5604d | |||
| 095a14bf1f | |||
| f84fbc32cb | |||
| 3099f6210a | |||
| 378e50d2ab | |||
| 0d85b41a2d | |||
| 7a57c4d499 | |||
| cef75752d9 | |||
| d31a351d6c | |||
| 2e56caa3fb | |||
| 4cde124d5d | |||
| 1d1d340ae1 | |||
| 6612118e97 | |||
| 5acfef419b | |||
| eb10d40332 | |||
| 6aaa439593 | |||
| b76ec2c143 | |||
| 773035a695 | |||
| 79be2279ec | |||
| b1f08e4123 | |||
| 872c9bc39c | |||
| 132aaa8293 | |||
| 882875d79a | |||
| cd7b02f4d7 | |||
| 2ed463f8e3 | |||
| acaf12ee7c | |||
| fdb188da1a | |||
| 9d2ab96b56 | |||
| 6ba2f7a178 | |||
| 525bdde6d5 |
@ -1,13 +0,0 @@
|
||||
# The "checkoutlist" file is used to support additional version controlled
|
||||
# administrative files in $CVSROOT/CVSROOT, such as template files.
|
||||
#
|
||||
# The first entry on a line is a filename which will be checked out from
|
||||
# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
|
||||
# The remainder of the line is an error message to use if the file cannot
|
||||
# be checked out.
|
||||
#
|
||||
# File format:
|
||||
#
|
||||
# [<whitespace>]<filename>[<whitespace><error message>]<end-of-line>
|
||||
#
|
||||
# comment lines begin with '#'
|
||||
@ -1,15 +0,0 @@
|
||||
# The "commitinfo" file is used to control pre-commit checks.
|
||||
# The filter on the right is invoked with the repository and a list
|
||||
# of files to check. A non-zero exit of the filter program will
|
||||
# cause the commit to be aborted.
|
||||
#
|
||||
# The first entry on a line is a regular expression which is tested
|
||||
# against the directory that the change is being committed to, relative
|
||||
# to the $CVSROOT. For the first match that is found, then the remainder
|
||||
# of the line is the name of the filter to run.
|
||||
#
|
||||
# If the repository name does not match any of the regular expressions in this
|
||||
# file, the "DEFAULT" line is used, if it is specified.
|
||||
#
|
||||
# If the name "ALL" appears as a regular expression it is always used
|
||||
# in addition to the first matching regex or "DEFAULT".
|
||||
@ -1,21 +0,0 @@
|
||||
# Set this to "no" if pserver shouldn't check system users/passwords
|
||||
#SystemAuth=no
|
||||
|
||||
# Put CVS lock files in this directory rather than directly in the repository.
|
||||
#LockDir=/var/lock/cvs
|
||||
|
||||
# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top
|
||||
# level of the new working directory when using the `cvs checkout'
|
||||
# command.
|
||||
#TopLevelAdmin=no
|
||||
|
||||
# Set `LogHistory' to `all' or `TOEFWUPCGMAR' to log all transactions to the
|
||||
# history file, or a subset as needed (ie `TMAR' logs all write operations)
|
||||
#LogHistory=TOEFWUPCGMAR
|
||||
|
||||
# Set `RereadLogAfterVerify' to `always' (the default) to allow the verifymsg
|
||||
# script to change the log message. Set it to `stat' to force CVS to verify# that the file has changed before reading it (this can take up to an extra
|
||||
# second per directory being committed, so it is not recommended for large
|
||||
# repositories. Set it to `never' (the previous CVS behavior) to prevent
|
||||
# verifymsg scripts from changing the log message.
|
||||
#RereadLogAfterVerify=always
|
||||
@ -1,19 +0,0 @@
|
||||
# This file affects handling of files based on their names.
|
||||
#
|
||||
# The -m option specifies whether CVS attempts to merge files.
|
||||
#
|
||||
# The -k option specifies keyword expansion (e.g. -kb for binary).
|
||||
#
|
||||
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
|
||||
#
|
||||
# wildcard [option value][option value]...
|
||||
#
|
||||
# where option is one of
|
||||
# -f from cvs filter value: path to filter
|
||||
# -t to cvs filter value: path to filter
|
||||
# -m update methodology value: MERGE or COPY
|
||||
# -k expansion mode value: b, o, kkv, &c
|
||||
#
|
||||
# and value is a single-quote delimited value.
|
||||
# For example:
|
||||
#*.gif -k 'b'
|
||||
@ -1,21 +0,0 @@
|
||||
# The "editinfo" file is used to allow verification of logging
|
||||
# information. It works best when a template (as specified in the
|
||||
# rcsinfo file) is provided for the logging procedure. Given a
|
||||
# template with locations for, a bug-id number, a list of people who
|
||||
# reviewed the code before it can be checked in, and an external
|
||||
# process to catalog the differences that were code reviewed, the
|
||||
# following test can be applied to the code:
|
||||
#
|
||||
# Making sure that the entered bug-id number is correct.
|
||||
# Validating that the code that was reviewed is indeed the code being
|
||||
# checked in (using the bug-id number or a seperate review
|
||||
# number to identify this particular code set.).
|
||||
#
|
||||
# If any of the above test failed, then the commit would be aborted.
|
||||
#
|
||||
# Actions such as mailing a copy of the report to each reviewer are
|
||||
# better handled by an entry in the loginfo file.
|
||||
#
|
||||
# One thing that should be noted is the the ALL keyword is not
|
||||
# supported. There can be only one entry that matches a given
|
||||
# repository.
|
||||
@ -1,27 +0,0 @@
|
||||
# The "loginfo" file controls where "cvs commit" log information
|
||||
# is sent. The first entry on a line is a regular expression which must match
|
||||
# the directory that the change is being made to, relative to the
|
||||
# $CVSROOT. If a match is found, then the remainder of the line is a filter
|
||||
# program that should expect log information on its standard input.
|
||||
#
|
||||
# If the repository name does not match any of the regular expressions in this
|
||||
# file, the "DEFAULT" line is used, if it is specified.
|
||||
#
|
||||
# If the name ALL appears as a regular expression it is always used
|
||||
# in addition to the first matching regex or DEFAULT.
|
||||
#
|
||||
# You may specify a format string as part of the
|
||||
# filter. The string is composed of a `%' followed
|
||||
# by a single format character, or followed by a set of format
|
||||
# characters surrounded by `{' and `}' as separators. The format
|
||||
# characters are:
|
||||
#
|
||||
# s = file name
|
||||
# V = old version number (pre-checkin)
|
||||
# v = new version number (post-checkin)
|
||||
# t = tag or branch name
|
||||
#
|
||||
# For example:
|
||||
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
|
||||
# or
|
||||
#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog
|
||||
@ -1,26 +0,0 @@
|
||||
# Three different line formats are valid:
|
||||
# key -a aliases...
|
||||
# key [options] directory
|
||||
# key [options] directory files...
|
||||
#
|
||||
# Where "options" are composed of:
|
||||
# -i prog Run "prog" on "cvs commit" from top-level of module.
|
||||
# -o prog Run "prog" on "cvs checkout" of module.
|
||||
# -e prog Run "prog" on "cvs export" of module.
|
||||
# -t prog Run "prog" on "cvs rtag" of module.
|
||||
# -u prog Run "prog" on "cvs update" of module.
|
||||
# -d dir Place module in directory "dir" instead of module name.
|
||||
# -l Top-level directory only -- do not recurse.
|
||||
#
|
||||
# NOTE: If you change any of the "Run" options above, you'll have to
|
||||
# release and re-checkout any working directories of these modules.
|
||||
#
|
||||
# And "directory" is a path to a directory relative to $CVSROOT.
|
||||
#
|
||||
# The "-a" option specifies an alias. An alias is interpreted as if
|
||||
# everything on the right of the "-a" had been typed on the command line.
|
||||
#
|
||||
# You can encode a module within a module by using the special '&'
|
||||
# character to interpose another module into the current module. This
|
||||
# can be useful for creating a module that consists of many directories
|
||||
# spread out over the entire source repository.
|
||||
@ -1,12 +0,0 @@
|
||||
# The "notify" file controls where notifications from watches set by
|
||||
# "cvs watch add" or "cvs edit" are sent. The first entry on a line is
|
||||
# a regular expression which is tested against the directory that the
|
||||
# change is being made to, relative to the $CVSROOT. If it matches,
|
||||
# then the remainder of the line is a filter program that should contain
|
||||
# one occurrence of %s for the user to notify, and information on its
|
||||
# standard input.
|
||||
#
|
||||
# "ALL" or "DEFAULT" can be used in place of the regular expression.
|
||||
#
|
||||
# For example:
|
||||
#ALL mail -s "CVS notification" %s
|
||||
@ -1,13 +0,0 @@
|
||||
# The "rcsinfo" file is used to control templates with which the editor
|
||||
# is invoked on commit and import.
|
||||
#
|
||||
# The first entry on a line is a regular expression which is tested
|
||||
# against the directory that the change is being made to, relative to the
|
||||
# $CVSROOT. For the first match that is found, then the remainder of the
|
||||
# line is the name of the file that contains the template.
|
||||
#
|
||||
# If the repository name does not match any of the regular expressions in this
|
||||
# file, the "DEFAULT" line is used, if it is specified.
|
||||
#
|
||||
# If the name "ALL" appears as a regular expression it is always used
|
||||
# in addition to the first matching regex or "DEFAULT".
|
||||
@ -1,20 +0,0 @@
|
||||
# The "taginfo" file is used to control pre-tag checks.
|
||||
# The filter on the right is invoked with the following arguments:
|
||||
#
|
||||
# $1 -- tagname
|
||||
# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
|
||||
# $3 -- repository
|
||||
# $4-> file revision [file revision ...]
|
||||
#
|
||||
# A non-zero exit of the filter program will cause the tag to be aborted.
|
||||
#
|
||||
# The first entry on a line is a regular expression which is tested
|
||||
# against the directory that the change is being committed to, relative
|
||||
# to the $CVSROOT. For the first match that is found, then the remainder
|
||||
# of the line is the name of the filter to run.
|
||||
#
|
||||
# If the repository name does not match any of the regular expressions in this
|
||||
# file, the "DEFAULT" line is used, if it is specified.
|
||||
#
|
||||
# If the name "ALL" appears as a regular expression it is always used
|
||||
# in addition to the first matching regex or "DEFAULT".
|
||||
@ -1,21 +0,0 @@
|
||||
# The "verifymsg" file is used to allow verification of logging
|
||||
# information. It works best when a template (as specified in the
|
||||
# rcsinfo file) is provided for the logging procedure. Given a
|
||||
# template with locations for, a bug-id number, a list of people who
|
||||
# reviewed the code before it can be checked in, and an external
|
||||
# process to catalog the differences that were code reviewed, the
|
||||
# following test can be applied to the code:
|
||||
#
|
||||
# Making sure that the entered bug-id number is correct.
|
||||
# Validating that the code that was reviewed is indeed the code being
|
||||
# checked in (using the bug-id number or a seperate review
|
||||
# number to identify this particular code set.).
|
||||
#
|
||||
# If any of the above test failed, then the commit would be aborted.
|
||||
#
|
||||
# Actions such as mailing a copy of the report to each reviewer are
|
||||
# better handled by an entry in the loginfo file.
|
||||
#
|
||||
# One thing that should be noted is the the ALL keyword is not
|
||||
# supported. There can be only one entry that matches a given
|
||||
# repository.
|
||||
@ -1,30 +0,0 @@
|
||||
<!DOCTYPE html public "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Notes on building the library</title>
|
||||
<body>
|
||||
|
||||
<h1>Notes on building the library</h1>
|
||||
|
||||
<p>In order to build the library, you need a 'C' compiler (obvious, isn't it?) and
|
||||
a set of header files for the networking API definitions. The networking header
|
||||
files go into a directory <tt>netinclude</tt> which has to sit in the same directory as
|
||||
the source code and the <tt>include</tt> directory you find in there. I'm not currently
|
||||
supplying these header files here. Drop me a line, and I'll take care of that.</p>
|
||||
|
||||
<p>The SAS/C flavour (<tt>smakefile</tt>) should get the library built using the "large data"
|
||||
model. This rules out the use of residentable programs as the startup code I'm
|
||||
using is very primitive (<tt>startup.o</tt>) and doesn't tinker with A4 relative data
|
||||
addressing (and how this may be set up).</p>
|
||||
|
||||
<p>There are two makefiles for GCC, each a different flavour. There is <tt>GNUmakefile.68k</tt>,
|
||||
which will build the library for GCC on the 68k platform ("classic" Amiga). This
|
||||
builds all variants of the library, for large data, small data, resident, whatever
|
||||
model. It's a lot of work and I don't recommend you do this on a plain 68k machine.
|
||||
It will literally (!) take hours. The other makefile flavour is for AmigaOS4 using
|
||||
the PowerPC hosted GCC system (<tt>GNUmakefile.os4</tt>). This builds only the large data
|
||||
version of the library, but this is usually all you need. Small data support is
|
||||
currently not implemented but might follow in the future.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -1,67 +0,0 @@
|
||||
<!DOCTYPE html public "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Notes on using the library with Amiga GCC (68k)</title>
|
||||
<body>
|
||||
|
||||
<h1>Notes on using the library with Amiga GCC (68k)</h1>
|
||||
|
||||
<p>You can use the 68k build of clib2 with the existing Amiga 68k ports of the
|
||||
GNU 'C' compiler. In order to do so, you need to modify the <tt>specs</tt> file which
|
||||
controls how the compiler(s) and the linker interact, and where the linker
|
||||
will look for the program startup code and library files. Also, you will need
|
||||
to copy the header files, startup code and library files to the locations
|
||||
where the 'C' compiler and linker expects them.</p>
|
||||
|
||||
<p>Please read the following description before you follow the instructions. The
|
||||
changes suggested may have unexpected side-effects!</p>
|
||||
|
||||
<p>I have provided a working <tt>specs</tt> file with this documentation file. To switch
|
||||
over an existing Amiga 68k port of GCC to use clib2, you would proceed as
|
||||
follows:</p>
|
||||
|
||||
<ul>
|
||||
<li> Locate the directory within which GCC is installed. For example, this
|
||||
could be within a directory to which the name <tt>ADE:</tt>, <tt>GG:</tt> or <tt>GCC:</tt>
|
||||
is assigned. For the sake of simplicity, the following notes assume
|
||||
that the assignment name is <tt>GCC:</tt>
|
||||
|
||||
<li> Make backup copies of the following directories and files:
|
||||
<ol>
|
||||
<li> <tt>GCC:lib/gcc-lib/amigaos/2.95.3/specs</tt><br>
|
||||
|
||||
<p>(NOTE: Check the directory called <tt>GCC:lib/gcc-lib/amigaos</tt>
|
||||
first; the "2.95.3" quoted above refers to the version,
|
||||
revision and patch number of the GCC installed and your
|
||||
version number may differ!)</p>
|
||||
|
||||
<li> <tt>GCC:include</tt>
|
||||
<li> <tt>GCC:lib</tt>
|
||||
|
||||
</ol>
|
||||
|
||||
<li> Now you can proceed to install clib2; just copy the <tt>include</tt> and <tt>lib</tt>
|
||||
directories over, like this:
|
||||
<ol>
|
||||
<li><kbd>Copy include GCC:include all quiet</kbd>
|
||||
<li><kbd>Copy lib GCC:lib all quiet</kbd>
|
||||
</ol>
|
||||
|
||||
<li> Finally, replace the <tt>specs</tt> file with the one provided:
|
||||
<ol>
|
||||
|
||||
<li> <kbd>Copy specs GCC:lib/gcc-lib/amigaos/2.95.3/specs</kbd><br>
|
||||
|
||||
<p>(NOTE: Check the directory called <tt>GCC:lib/gcc-lib/amigaos</tt>
|
||||
first; the "2.95.3" quoted above refers to the version,
|
||||
revision and patch number of the GCC installed and your
|
||||
version number may differ!)</p>
|
||||
</ol>
|
||||
</ul>
|
||||
|
||||
<p>Once you have completed these steps you should be able to build programs using
|
||||
the 68k build of clib2 and you currently installed GCC. Note that these
|
||||
changes may have the effect of rendering your C++ compiler unusable, so make
|
||||
sure that you've made backup copies of all files and directories first!</p>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,304 +0,0 @@
|
||||
<!DOCTYPE html public "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>An ISO 'C' (1994) compliant runtime library for the Amiga</title>
|
||||
<body>
|
||||
|
||||
<h1>An ISO 'C' (1994) compliant runtime library for the Amiga</h1>
|
||||
|
||||
<h2>1. What is this?</h2>
|
||||
|
||||
<p>This is my attempt to get Samba 2.2.x ported to the Amiga. My first Amiga
|
||||
port required SAS/C and a number of strange tricks had to be pulled to get
|
||||
it to support the kind of environment Samba needed. But with the
|
||||
introduction of Samba 2.2.x many of those tricks did not work any more,
|
||||
which is why I decided to attack the problem at the root, namely the
|
||||
runtime library.</p>
|
||||
|
||||
<p>Because it was no longer possible to build Samba with SAS/C on the new
|
||||
Amiga platform, the idea came up to move development to the GNU 'C'
|
||||
compiler. This turned out to be a challenge due to its somewhat
|
||||
underdeveloped runtime library and header files. Eventually, I decided to
|
||||
rewrite that library from scratch.</p>
|
||||
|
||||
|
||||
<h2>2. What does it do?</h2>
|
||||
|
||||
<p>Using <i>'C' - A reference manual</i> (4th edition) as a reference I wrote a set of
|
||||
header files, then proceeded to implement each single function referenced in
|
||||
them. With few exceptions in the area of wide character support, the result
|
||||
should be a feature complete implementation of the ISO 'C' (1994) runtime
|
||||
library.</p>
|
||||
|
||||
<p>Because Samba needs a few POSIX-like routines to be supported, the library
|
||||
functionality is complemented by a set of routines described in <i>Advanced
|
||||
programming in the Unix environent</i>.</p>
|
||||
|
||||
<p>This is not a portable implementation of the library in the sense that you
|
||||
could move it from one 'C' compiler on one operating system to another.
|
||||
This is an Amiga specific implementation.</p>
|
||||
|
||||
<p>The library supports floating point math, which, for the 68k platform, is
|
||||
limited to IEEE single and double precision or M68881 inline math. There is no
|
||||
support for the fast floating point (FFP) format or exclusive IEEE single
|
||||
precision. You either get double precision (IEEE math) or extended precision
|
||||
(M68881 inline math). What it is that you get is determined at compile time.
|
||||
Use the <tt>IEEE_FLOATING_POINT_SUPPORT</tt> preprocessor symbol to activate IEEE math
|
||||
code and the <tt>M68881_FLOATING_POINT_SUPPORT</tt> symbol for M68881 inline math.</p>
|
||||
|
||||
<p>For the PowerPC platform, the library uses code borrowed from fdlibm 5.3,
|
||||
which is a portable library of arithmetic functions developed by Sun
|
||||
Microsystems which, for example, is also used within the Java platform.</p>
|
||||
|
||||
<p>Not unlike SAS/C, you can configure a minimum stack size the program is to use
|
||||
when it starts up. This is controlled via the <tt>__stack_size</tt> variable (see
|
||||
<tt>stdlib_main.c</tt>).</p>
|
||||
|
||||
<p>I added some <tt>amiga.lib</tt> and <tt>debug.lib</tt> functionality to the library, but don't
|
||||
count on it to be complete.</p>
|
||||
|
||||
<h3>2.1 Thread-safety</h3>
|
||||
|
||||
<p>The library code is supposed to be thread-safe if built with the <tt>__THREAD_SAFE</tt>
|
||||
preprocesssor symbold defined. Note that 'thread-safe' does <em>not</em> mean
|
||||
'reentrant'. Multiple callers for certain library functions are permitted, but
|
||||
not for all of them. For example, <tt>mkdtemp()</tt> is not thread-safe, and neither is
|
||||
<tt>rand()</tt> or <tt>localtime()</tt>. But as per <b>POSIX 1003.1c-1995</b> there are thread-safe
|
||||
variants of <tt>rand()</tt> and <tt>localtime()</tt> called <tt>rand_r()</tt>, <tt>localtime_r()</tt>, and others.
|
||||
The use of the socket I/O functions is still problematic because the
|
||||
underlying <tt>bsdsocket.library</tt> API is not supposed to be used by any process
|
||||
other than the one that opened it. Also yet unsolved is the issue of reading
|
||||
error codes from the <tt>errno</tt> variable which currently always contains the
|
||||
error code left by the last caller.</p>
|
||||
|
||||
|
||||
<h2>3. What does it not do?</h2>
|
||||
|
||||
<p>This library is a departure from the typical 'C' runtime environments of the
|
||||
past which had to run on all AmigaOS releases, down to Kickstart 1.1. This
|
||||
very library was designed to take advantage of the routines available since
|
||||
Kickstart 2.04 was introduced and virtually nobody ever put to use. This helps
|
||||
to cut the code size, and it also helps to keep bugs out of the library by
|
||||
falling back onto well-tested implementations. However, the catch is that the
|
||||
code won't run under Kickstart 1.3 and below. But then these operating system
|
||||
releases have been obsolete for more than a decade, and you can always go back
|
||||
to a compiler environment which supports them.</p>
|
||||
|
||||
<p>There is very little support for <tt>amiga.lib</tt> functionality. There is <tt>NewList()</tt>,
|
||||
<tt>HookEntry()</tt>, <tt>CallHook()</tt>, <tt>CallHookA()</tt>, the <tt>DoMethod()</tt> family, the RexxVars
|
||||
family, but that's all. If you need more, you would have to implement it
|
||||
yourself. Put another way, if you absolutely need functionality that is only
|
||||
found in <tt>amiga.lib</tt>, you really shouldn't need in in the first place.</p>
|
||||
|
||||
|
||||
<h2>4. Where does the source code come from?</h2>
|
||||
|
||||
<p>I originally thought that it might be helpful to piece this library together
|
||||
from various sources, such as the BSD libc. Turned out that this code was so
|
||||
'portable' that it became much more complex than it ought to be. Also, some
|
||||
side-effects were present which considerably changed the behaviour of the
|
||||
library. For example, the BSD libc uses <tt>bcopy()</tt> as an alias for <tt>memcpy()</tt>, and
|
||||
unlike <tt>memcpy()</tt> is documented to, <tt>bcopy()</tt> supports overlapping copies.</p>
|
||||
|
||||
<p>Eventually, I wrote virtually all the code myself, borrowing algorithmic ideas
|
||||
from the BSD libc and the Manx Aztec 'C' runtime library. Because I don't know
|
||||
much about the environment GCC expects, I borrowed code snippets from libnix,
|
||||
which was written by Matthias Fleischer and Gunther Nikl. This in particular
|
||||
concerns the integer and floating point math support, the <tt>setjmp</tt>/<tt>longjmp</tt>
|
||||
routines and the startup code. The M68881 inline math code comes from the
|
||||
<tt><math-68881.h></tt> file written by Matthew Self <tt>(self@bayes.arc.nasa.gov)</tt>.</p>
|
||||
|
||||
|
||||
<h2>5. Limitations and caveats</h2>
|
||||
|
||||
<p>There is hardly any documentation on the code I wrote. In part this is due to
|
||||
the fact that the code itself is very simple in design. It should speak for
|
||||
itself. However, to make a usable runtime library you have to have a user
|
||||
documentation as in man pages or autodocs. We will eventually have to have
|
||||
autodocs for this library.</p>
|
||||
|
||||
<p>The code is currently plastered with assertions and debug code. It is
|
||||
therefore much larger than it ought to be and runs much slower than it ought
|
||||
to be. For example, the <tt>malloc()</tt> routine will set the contents of the memory
|
||||
allocated to a 'dirty' bit pattern which is likely to break software which
|
||||
makes assumptions about its contents. Likewise, the <tt>free()</tt> routine will trash
|
||||
the memory to deallocate with a different 'dirty' bit pattern to turn up reuse
|
||||
of memory after deallocation. All these debugging features can be disabled by
|
||||
defining the <tt>NDEBUG</tt> preprocessor symbol at compile time (see <tt><assert.h></tt>).</p>
|
||||
|
||||
<p>The exception handling in the math code is not particularly effective. For one
|
||||
part this is due to the fact that there is no exception handler installed by
|
||||
the runtime library when it starts up which could catch and process the error
|
||||
conditions the CPU or FPU generates. The idea was to provide for a portable
|
||||
runtime library with little to no assembly language involved. To make the
|
||||
exception handling complete, such code would be necessary.</p>
|
||||
|
||||
<p>The library currently builds under SAS/C, but because the 'normal' program
|
||||
startup code is not utilized, the base relative (A4) addressing does not work.
|
||||
If you are going to test it, use the <tt>data=faronly</tt> option to compile the
|
||||
library and the programs.</p>
|
||||
|
||||
<p>Different build makefiles are supplied for use with GCC. There is
|
||||
<tt>GNUmakefile.68k</tt> for the 68k platform and <tt>GNUmakefile.os4</tt> for the AmigaOS4
|
||||
PowerPC version.</p>
|
||||
|
||||
<h3>5.1 Floating point math and functions (<tt>scanf()</tt>, <tt>printf()</tt>, etc.) </h3>
|
||||
|
||||
<p>The plain <tt>libc.a</tt>, which your software would be linked against by default, does not contain
|
||||
any floating point support code. This means, for example, that <tt>printf("%f",...)</tt> will not produce
|
||||
the desired output and that <tt>scanf("%f",...)</tt> may not read any data at all. If your
|
||||
program needs functions such as these or <tt>atod()</tt> then you must link against <tt>libm.a</tt> or
|
||||
the equivalent.</p>
|
||||
|
||||
<p>To link the floating point support code with your software, use the <tt>-lm</tt> compiler option. Careful!
|
||||
The order in which you specify the libraries to link against is important here. Thus, <tt>gcc -o test test.c -lm -lc</tt>
|
||||
would correctly link the program <tt>test</tt> against the proper floating point math library, but
|
||||
<tt>gcc -o test test.c -lc -lm</tt> would not.</p>
|
||||
|
||||
<h3>5.2 The thread-safe library</h3>
|
||||
|
||||
<p>Thread-safety does not imply that you can have multiple callers
|
||||
access and close the same file. There is no resource tracking to that degree
|
||||
yet. All that the thread-safety tries to afford you is not to get into big trouble
|
||||
if simultaneous and overlapping accesses to files, memory allocation and other
|
||||
resources are taking place.</p>
|
||||
|
||||
<p> Also take care with file I/O involving the <tt>stdin</tt>/<tt>stdout</tt>/<tt>stderr</tt>
|
||||
streams; read/write operations on these streams will be mapped to the <tt>Input()</tt>/</tt>Output()</tt>/<tt>ErrorOutput()</tt>
|
||||
file handles of the process performing these operations. Since only this small set of
|
||||
operations is mapped, functions such as <tt>fcntl()</tt> or <tt>select()</tt> will not
|
||||
work on the <tt>stdin</tt>/<tt>stdout</tt>/<tt>stderr</tt> streams and the corresponding
|
||||
file descriptors <tt>STDIN_FILENO</tt>/<tt>STDOUT_FILENO</tt>/<tt>STDERR_FILENO</tt>.
|
||||
It is therefore strongly recommended to use the thread-safe library only for applications
|
||||
which can cope with the limitations described above.</p>
|
||||
|
||||
<h3>5.3 Using gmon (PowerPC only)</h3>
|
||||
|
||||
<p>To use profiling, two steps are required. First of all, your program must be compiled with
|
||||
the gcc command line option <tt>-pg</tt>. This instructs the compiler to generate special
|
||||
profiling code in the prologue and epilogue of each function. Additionally, the program
|
||||
must be linked with <tt>libprofile.a</tt>. To do this, either manually add
|
||||
<tt>-lprofile</tt> to the linker command line, or modify the specs file as follows.
|
||||
Find the lines that look like this (it may actually differ silghtily from your specs file,
|
||||
but the important thing is that the line before the line to be modified reads <tt>lib:</tt>):
|
||||
<pre>
|
||||
lib:
|
||||
--start-group -lc --end-group
|
||||
</pre>
|
||||
You will have to modify this to look like this:
|
||||
<pre>
|
||||
lib:
|
||||
%{pg: -lprofile} --start-group -lc --end-group
|
||||
</pre>
|
||||
Normally, the specs file is located at the compilers installation directory. For cross-compilers,
|
||||
this is <tt>/usr/local/amiga/lib/gcc/ppc-amigaos/<i>compiler-version</i>/specs</tt>. For a native compiler,
|
||||
it's in <tt>gcc:lib/gcc/ppc-amigaos/<i>compiler-version</i>/specs</tt>. Most likely, your compiler will already have this added to it's specs file.</p>
|
||||
|
||||
<p>Profiling makes use of a special PowerPC facility called the Performance Monitor. It
|
||||
allows to "mark" tasks and count only during while a marked task is running. This allows
|
||||
performance analysis to be made independant of the actual system load. The Performace Monitor
|
||||
is available on all PowerPC models supported by AmigaOS 4 except for the <tt>603e</tt>, and
|
||||
embedded versions of the PowerPC like the <tt>405</tt> and <tt>440</tt> series. Consult the manual
|
||||
of the appropriate chip for more information.</p>
|
||||
|
||||
<h2>6. Conventions and design issues</h2>
|
||||
|
||||
<p>You will have noticed the 330+ files in this directory. This is not the best
|
||||
way to organize a runtime library, but at least all the bits and pieces are in
|
||||
plain sight. Each file stands for the one or two routines it contains. The
|
||||
name indicates what routine(s) that might be. Each file name is prefixed by
|
||||
the name of the header file in which the corresponding routine is defined. So,
|
||||
for example, you will find that <tt>unistd_lchown.c</tt> contains the definition of
|
||||
the <tt>lchown()</tt> routine, which has its prototype defined in the <tt><unistd.h></tt> header
|
||||
file.</p>
|
||||
|
||||
<p>Internal function and variables which need to be visible across several
|
||||
modules have names prefixed with two underscores, as in <tt>__stdio_init()</tt>.</p>
|
||||
|
||||
<p>All routines attempt to do error checking on their parameters. They will
|
||||
either drop into an <tt>assert()</tt> or set an errno value and refuse to go any
|
||||
further. This cuts performance but should help to catch the simple bugs quite
|
||||
easily (<tt>NULL</tt> pointers).</p>
|
||||
|
||||
<p>Just like any halfway sane Amiga 'C' runtime library, this one performs its <tt>^C</tt>
|
||||
checking in the I/O routines. Typically once upon entry and in every iteration
|
||||
of the loop there might be it will quickly poll the <tt>^C</tt> signal and drop into
|
||||
<tt>raise(SIGINT)</tt> in case the signal is set. This is just about the safest method
|
||||
to solve the problem and should be much more robust than the ixemul approach
|
||||
of 'interrupt anywhere - crash anywhere' using the task switch/launch hooks to
|
||||
test for signals.</p>
|
||||
|
||||
<p>By default all library routines follow the ISO 'C' conventions in that where
|
||||
implementation defined behaviour is permitted, the AmigaOS rules are followed.
|
||||
For example, <tt>unlink()</tt> will by default operate like <tt>DeleteFile()</tt> and <tt>rename()</tt>
|
||||
will return with an error code set if the name of the file/directory to be
|
||||
renamed would collide with an existing directory entry. However, your program
|
||||
can set a global variable <tt>__unix_semantics</tt> which will cause some routines to
|
||||
perform like their Unix counterparts. This is necessary for Samba to work but
|
||||
not a generally desirable feature. You have some Unix-like behaviour, but the
|
||||
environment itself is not completely Unix- or POSIX-compliant. And it
|
||||
shouldn't be. Don't make the mistake of trying to mold the environment into a
|
||||
POSIX emulation. It doesn't work; AmigaOS is not Unix.</p>
|
||||
|
||||
|
||||
<h2>7. The startup code</h2>
|
||||
|
||||
<p>There are three program startup files provided. The most simplistic is in
|
||||
<tt>startup.c</tt> which I use for SAS/C. It just invokes the setup routine which
|
||||
eventually calls <tt>main()</tt> and drops straight into <tt>exit()</tt>.</p>
|
||||
|
||||
<p>The <tt>ncrt0.S</tt> file was adapted from the libnix startup code which sets up the
|
||||
base relative data area, if necessary (the <tt>SMALL_DATA</tt> preprocessor symbol must
|
||||
be defined).</p>
|
||||
|
||||
<p>The <tt>nrcrt0.S</tt> file was adapted from libnix startup code, too, and sets up the
|
||||
base relative data area for programs to be made resident. Note that the
|
||||
<tt>geta4()</tt> stub is missing here; it wouldn't work in a resident program anyway.</p>
|
||||
|
||||
<p>The <tt>ncrt0.S</tt> and <tt>nrcrt0.S</tt> files are considerably smaller and less complex than
|
||||
the libnix code they are based on. This is because in this library design all
|
||||
the more complex tasks are performed in the <tt>stdlib_main.c</tt> file rather than in
|
||||
assembly language.</p>
|
||||
|
||||
|
||||
<h2>8. Documentation</h2>
|
||||
|
||||
<p>Well, you're reading it. There isn't anything much yet. You can consult the book
|
||||
<i>'C' - A reference manual</i> and you could look at the
|
||||
<a href="http://www.opengroup.org/onlinepubs/007904975">Open Group's Single Unix
|
||||
Specification</a>.</p>
|
||||
|
||||
|
||||
<h2>9. Legal status</h2>
|
||||
|
||||
<p>Because this library is in part based upon free software it would be
|
||||
uncourteous not to make it free software itself. The BSD license would
|
||||
probably be appropriate here.</p>
|
||||
|
||||
<p>The PowerPC math library is based in part on work by Sun Microsystems:</p>
|
||||
|
||||
<pre>
|
||||
====================================================
|
||||
Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
|
||||
Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software is freely granted, provided that this notice
|
||||
is preserved.
|
||||
====================================================
|
||||
</pre>
|
||||
|
||||
<h2>10. Contacting the author</h2>
|
||||
|
||||
<p>The basic work was done by Olaf Barthel during two weeks in July 2002. You
|
||||
can reach me at:</p>
|
||||
|
||||
<p>Olaf Barthel<br>
|
||||
Gneisenaustr. 43<br>
|
||||
D-31275 Lehrte<br></p>
|
||||
|
||||
<p>Or via e-mail:</p>
|
||||
|
||||
<p>olsen@sourcery.han.de</p>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,64 +0,0 @@
|
||||
*asm:
|
||||
%{m68000:-mc68010} %{mc68000:-mc68010} %{m68020:-mc68020} %{mc68020:-mc68020} %{m68030:-mc68030} %{m68040:-mc68040} %{m68060:-mc68060} %{m68020-40:-mc68020} %{m68020-60:-mc68020} %{!mc68000:%{!m68000:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68060:%{!m68020-40:%{!m68020-60:-mc68010}}}}}}}}} %{msmall-code:-sc}
|
||||
|
||||
*asm_final:
|
||||
|
||||
|
||||
*cpp:
|
||||
%{m68881:-D__HAVE_68881__} %{!ansi:%{m68020:-Dmc68020} %{mc68020:-Dmc68020} %{m68020-40:-Dmc68020} %{m68020-60:-Dmc68020} %{m68030:-Dmc68030} %{m68040:-Dmc68040} %{m68060:-Dmc68060}} %{m68020:-D__mc68020__ -D__mc68020} %{mc68020:-D__mc68020__ -D__mc68020} %{m68020-40:-D__mc68020__ -D__mc68020} %{m68020-60:-D__mc68020__ -D__mc68020} %{m68030:-D__mc68030__ -D__mc68030} %{m68040:-D__mc68040__ -D__mc68040} %{m68060:-D__mc68060__ -D__mc68060}
|
||||
|
||||
*cc1:
|
||||
%{resident:-fbaserel} %{resident32:-fbaserel32} %{msmall-code:-fno-function-cse}
|
||||
|
||||
*cc1plus:
|
||||
|
||||
|
||||
*endfile:
|
||||
|
||||
|
||||
*link:
|
||||
%{fbaserel:%{!resident:-m amiga_bss -fl libb}} %{resident:-m amiga_bss -amiga-datadata-reloc -fl libb} %{fbaserel32:%{!resident32:-m amiga_bss -fl libb32}} %{resident32:-m amiga_bss -amiga-datadata-reloc -fl libb32} %{g:-amiga-debug-hunk} %{m68020:-fl libm020} %{mc68020:-fl libm020} %{m68030:-fl libm020} %{m68040:-fl libm020} %{m68060:-fl libm020} %{m68020-40:-fl libm020} %{m68020-60:-fl libm020}
|
||||
|
||||
*lib:
|
||||
%{mstackextend:-lstack} -lc -lamiga -ldebug -lgcc -lc
|
||||
|
||||
*libgcc:
|
||||
|
||||
|
||||
*startfile:
|
||||
%{resident32:nr32crt0.o%s}%{!resident32:%{fbaserel32:nb32crt0.o%s}%{!fbaserel32:%{resident:nrcrt0.o%s}%{!resident:%{fbaserel:nbcrt0.o%s}%{!fbaserel:ncrt0.o%s}}}}
|
||||
|
||||
*switches_need_spaces:
|
||||
|
||||
|
||||
*signed_char:
|
||||
%{funsigned-char:-D__CHAR_UNSIGNED__}
|
||||
|
||||
*predefines:
|
||||
-Dmc68000 -Damiga -Damigaos -DMCH_AMIGA -DAMIGA -D__chip=__attribute__((__chip__)) -D__saveds=__attribute__((__saveds__)) -D__interrupt=__attribute__((__interrupt__)) -D__stackext=__attribute__((__stackext__)) -D__regargs=__attribute__((__regparm__)) -D__stdargs=__attribute__((__stkparm__)) -D__aligned=__attribute__((__aligned__(4))) -Asystem(amigaos) -Acpu(m68k) -Amachine(m68k)
|
||||
|
||||
*cross_compile:
|
||||
0
|
||||
|
||||
*version:
|
||||
2.95.3
|
||||
|
||||
*multilib:
|
||||
. ;
|
||||
|
||||
*multilib_defaults:
|
||||
|
||||
|
||||
*multilib_extra:
|
||||
|
||||
|
||||
*multilib_matches:
|
||||
|
||||
|
||||
*linker:
|
||||
collect2
|
||||
|
||||
*link_command:
|
||||
%{!fsyntax-only: %{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}} %{static:} %{L*} %D %o %{!nostdlib:%{!nodefaultlibs:%G %L %G}} %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*}
|
||||
}}}}}}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: GNUmakefile.68k,v 1.65 2005-07-03 10:36:46 obarthel Exp $
|
||||
# $Id: GNUmakefile.68k,v 1.73 2005-10-20 07:19:15 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@ -78,7 +78,7 @@ $(LIBAMIGA_OBJS)/%.o : %.c
|
||||
|
||||
ifeq (small_data_020,$(TYPE))
|
||||
CODE_TYPE := -m68020-60
|
||||
CODE_FLAGS := -fbaserel -DSMALL_DATA -DM68020
|
||||
CODE_FLAGS := -fbaserel -DSMALL_DATA -DM68020 -DUSE_64_BIT_INTS
|
||||
endif
|
||||
|
||||
ifeq (small_data,$(TYPE))
|
||||
@ -88,12 +88,12 @@ endif
|
||||
|
||||
ifeq (small_data32,$(TYPE))
|
||||
CODE_TYPE := -m68020-60
|
||||
CODE_FLAGS := -fbaserel32 -DSMALL_DATA32 -DM68020
|
||||
CODE_FLAGS := -fbaserel32 -DSMALL_DATA32 -DM68020 -DUSE_64_BIT_INTS
|
||||
endif
|
||||
|
||||
ifeq (large_data_020,$(TYPE))
|
||||
CODE_TYPE := -m68020-60
|
||||
CODE_FLAGS := -DM68020
|
||||
CODE_FLAGS := -DM68020 -DUSE_64_BIT_INTS
|
||||
endif
|
||||
|
||||
ifeq (large_data,$(TYPE))
|
||||
@ -118,7 +118,9 @@ INCLUDES = -Iinclude -I. -Inetinclude
|
||||
#OPTIMIZE = -O2 -fomit-frame-pointer
|
||||
#DEBUG = -g
|
||||
|
||||
CFLAGS = $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(CODE_FLAGS) $(CODE_TYPE) $(INCLUDES)
|
||||
CFLAGS = \
|
||||
$(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) \
|
||||
$(CODE_FLAGS) $(CODE_TYPE) $(INCLUDES)
|
||||
|
||||
##############################################################################
|
||||
|
||||
@ -552,6 +554,8 @@ MATH_LIB = \
|
||||
math_atan2.o \
|
||||
math_atan2f.o \
|
||||
math_atanf.o \
|
||||
math_atanh.o \
|
||||
math_atanhf.o \
|
||||
math_cbrt.o \
|
||||
math_cbrtf.o \
|
||||
math_ceil.o \
|
||||
@ -567,15 +571,17 @@ MATH_LIB = \
|
||||
math_erfcf.o \
|
||||
math_erff.o \
|
||||
math_exp.o \
|
||||
math_expf.o \
|
||||
math_exp2.o \
|
||||
math_exp2f.o \
|
||||
math_expf.o \
|
||||
math_expm1.o \
|
||||
math_expm1f.o \
|
||||
math_fabs.o \
|
||||
math_fabsf.o \
|
||||
math_floor.o \
|
||||
math_floorf.o \
|
||||
math_fma.o \
|
||||
math_fmaf.o \
|
||||
math_fmod.o \
|
||||
math_fmodf.o \
|
||||
math_fpclassify.o \
|
||||
@ -600,28 +606,38 @@ MATH_LIB = \
|
||||
math_lgamma.o \
|
||||
math_lgammaf.o \
|
||||
math_log.o \
|
||||
math_log2.o \
|
||||
math_log2f.o \
|
||||
math_log10.o \
|
||||
math_log10f.o \
|
||||
math_log1p.o \
|
||||
math_log1pf.o \
|
||||
math_log2.o \
|
||||
math_log2f.o \
|
||||
math_logb.o \
|
||||
math_logbf.o \
|
||||
math_logf.o \
|
||||
math_lrint.o \
|
||||
math_lrintf.o \
|
||||
math_lround.o \
|
||||
math_lroundf.o \
|
||||
math_modf.o \
|
||||
math_modff.o \
|
||||
math_nan.o \
|
||||
math_nanf.o \
|
||||
math_nearbyint.o \
|
||||
math_nearbyintf.o \
|
||||
math_nextafter.o \
|
||||
math_nextafterf.o \
|
||||
math_pow.o \
|
||||
math_powf.o \
|
||||
math_remainder.o \
|
||||
math_remainderf.o \
|
||||
math_remquo.o \
|
||||
math_remquof.o \
|
||||
math_rem_pio2f.o \
|
||||
math_rint.o \
|
||||
math_rintf.o \
|
||||
math_round.o \
|
||||
math_roundf.o \
|
||||
math_scalbn.o \
|
||||
math_scalbnf.o \
|
||||
math_signbit.o \
|
||||
@ -635,6 +651,10 @@ MATH_LIB = \
|
||||
math_tanf.o \
|
||||
math_tanh.o \
|
||||
math_tanhf.o \
|
||||
math_tgamma.o \
|
||||
math_tgammaf.o \
|
||||
math_trunc.o \
|
||||
math_truncf.o \
|
||||
stdio_asprintf.o \
|
||||
stdio_flush.o \
|
||||
stdio_flush_all_files.o \
|
||||
@ -708,6 +728,7 @@ NET_LIB = \
|
||||
net.lib_rev.o \
|
||||
socket_accept.o \
|
||||
socket_bind.o \
|
||||
socket_check_daemon.o \
|
||||
socket_connect.o \
|
||||
socket_gethostbyaddr.o \
|
||||
socket_gethostbyname.o \
|
||||
@ -734,6 +755,7 @@ NET_LIB = \
|
||||
socket_ioctl.o \
|
||||
socket_isdaemon.o \
|
||||
socket_listen.o \
|
||||
socket_obtain_daemon.o \
|
||||
socket_recv.o \
|
||||
socket_recvfrom.o \
|
||||
socket_recvmsg.o \
|
||||
@ -746,6 +768,8 @@ NET_LIB = \
|
||||
socket_socket.o \
|
||||
socket_hook_entry.o \
|
||||
socket_hstrerror.o \
|
||||
socket_get_h_errno.o \
|
||||
socket_set_h_errno.o \
|
||||
stat_umask.o \
|
||||
usergroup_crypt.o \
|
||||
usergroup_data.o \
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: GNUmakefile.os4,v 1.72 2005-07-03 10:36:46 obarthel Exp $
|
||||
# $Id: GNUmakefile.os4,v 1.85 2005-11-04 09:35:02 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@ -7,27 +7,50 @@
|
||||
|
||||
##############################################################################
|
||||
|
||||
# You may have to tweak this for the native OS4 compiler
|
||||
SDK_INCLUDE = $(V)/include
|
||||
NET_INCLUDE = netinclude
|
||||
.PHONY : all clean version cvs-tag all_libraries directories
|
||||
.PHONY : large_data_libs
|
||||
.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
|
||||
AR = ppc-amigaos-ar -q
|
||||
RANLIB = ppc-amigaos-ranlib
|
||||
COPY = cp -a
|
||||
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
|
||||
# CC = gcc
|
||||
# AR = ar -q
|
||||
# RANLIB = ranlib
|
||||
# COPY = copy
|
||||
# DELETE = delete all quiet
|
||||
# MAKEDIR = makedir
|
||||
# The following are for the native OS4 compiler; note that the
|
||||
# LOG_COMMAND should not be enabled unless you have a shell
|
||||
# installed which supports it.
|
||||
#SDK_INCLUDE = /SDK/Include/include_h
|
||||
#NET_INCLUDE = /SDK/Include/netinclude
|
||||
#CC = gcc
|
||||
#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
|
||||
%.o : %.c
|
||||
@echo "Compiling $<"
|
||||
@$(CC) -c $(CFLAGS) $<
|
||||
@$(CC) -c $(CFLAGS) $< $(LOG_COMMAND)
|
||||
|
||||
$(LIBC_OBJS)/%.o : %.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
|
||||
@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
|
||||
@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
|
||||
@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
|
||||
@echo "Compiling $< [$(TYPE):debug]"
|
||||
@$(CC) -o $(LIBDEBUG_OBJS)/$*.o -c $(CFLAGS) $<
|
||||
@$(CC) -o $(LIBDEBUG_OBJS)/$*.o -c $(CFLAGS) $< $(LOG_COMMAND)
|
||||
|
||||
$(LIBAMIGA_OBJS)/%.o : %.c
|
||||
@echo "Compiling $< [$(TYPE):amiga]"
|
||||
@$(CC) -o $(LIBAMIGA_OBJS)/$*.o -c $(CFLAGS) $<
|
||||
@$(CC) -o $(LIBAMIGA_OBJS)/$*.o -c $(CFLAGS) $< $(LOG_COMMAND)
|
||||
|
||||
$(LIBPROFILE_OBJS)/%.o : %.c
|
||||
@echo "Compiling $< [$(TYPE):profile]"
|
||||
@$(CC) -o $(LIBPROFILE_OBJS)/$*.o -c $(CFLAGS) $<
|
||||
@$(CC) -o $(LIBPROFILE_OBJS)/$*.o -c $(CFLAGS) $< $(LOG_COMMAND)
|
||||
|
||||
$(LIBPROFILE_OBJS)/%.o : %.S
|
||||
@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))
|
||||
CODE_TYPE := -msdata=sysv -DSMALL_DATA
|
||||
FLOAT_TYPE := -DPPC_FLOATING_POINT_SUPPORT
|
||||
DEST_DIR := lib/small-data
|
||||
endif
|
||||
|
||||
ifeq (large_data,$(TYPE))
|
||||
CODE_TYPE := -msdata=data
|
||||
FLOAT_TYPE := -DPPC_FLOATING_POINT_SUPPORT
|
||||
DEST_DIR := lib
|
||||
endif
|
||||
|
||||
ifeq (large_data_softfloat,$(TYPE))
|
||||
CODE_TYPE := -msdata=data -msoft-float
|
||||
FLOAT_TYPE :=
|
||||
DEST_DIR := lib/soft-float
|
||||
endif
|
||||
|
||||
ifeq (baserel,$(TYPE))
|
||||
CODE_TYPE := -mbaserel -DBASEREL_DATA
|
||||
FLOAT_TYPE := -DPPC_FLOATING_POINT_SUPPORT
|
||||
DEST_DIR := lib/baserel
|
||||
endif
|
||||
|
||||
##############################################################################
|
||||
@ -566,6 +591,8 @@ MATH_LIB = \
|
||||
math_atan2.o \
|
||||
math_atan2f.o \
|
||||
math_atanf.o \
|
||||
math_atanh.o \
|
||||
math_atanhf.o \
|
||||
math_cbrt.o \
|
||||
math_cbrtf.o \
|
||||
math_ceil.o \
|
||||
@ -581,15 +608,17 @@ MATH_LIB = \
|
||||
math_erfcf.o \
|
||||
math_erff.o \
|
||||
math_exp.o \
|
||||
math_expf.o \
|
||||
math_exp2.o \
|
||||
math_exp2f.o \
|
||||
math_expf.o \
|
||||
math_expm1.o \
|
||||
math_expm1f.o \
|
||||
math_fabs.o \
|
||||
math_fabsf.o \
|
||||
math_floor.o \
|
||||
math_floorf.o \
|
||||
math_fma.o \
|
||||
math_fmaf.o \
|
||||
math_fmod.o \
|
||||
math_fmodf.o \
|
||||
math_fpclassify.o \
|
||||
@ -620,28 +649,36 @@ MATH_LIB = \
|
||||
math_lgamma.o \
|
||||
math_lgammaf.o \
|
||||
math_log.o \
|
||||
math_log2.o \
|
||||
math_log2f.o \
|
||||
math_log10.o \
|
||||
math_log10f.o \
|
||||
math_log1p.o \
|
||||
math_log1pf.o \
|
||||
math_log2.o \
|
||||
math_log2f.o \
|
||||
math_logb.o \
|
||||
math_logbf.o \
|
||||
math_logf.o \
|
||||
math_lround.o \
|
||||
math_lroundf.o \
|
||||
math_modf.o \
|
||||
math_modff.o \
|
||||
math_nan.o \
|
||||
math_nanf.o \
|
||||
math_nearbyint.o \
|
||||
math_nearbyintf.o \
|
||||
math_nextafter.o \
|
||||
math_nextafterf.o \
|
||||
math_pow.o \
|
||||
math_powf.o \
|
||||
math_remainder.o \
|
||||
math_remainderf.o \
|
||||
math_remquo.o \
|
||||
math_remquof.o \
|
||||
math_rem_pio2f.o \
|
||||
math_rint.o \
|
||||
math_rintf.o \
|
||||
math_round.o \
|
||||
math_roundf.o \
|
||||
math_scalbn.o \
|
||||
math_scalbnf.o \
|
||||
math_signbit.o \
|
||||
@ -655,6 +692,10 @@ MATH_LIB = \
|
||||
math_tanf.o \
|
||||
math_tanh.o \
|
||||
math_tanhf.o \
|
||||
math_tgamma.o \
|
||||
math_tgammaf.o \
|
||||
math_trunc.o \
|
||||
math_truncf.o \
|
||||
stdio_asprintf.o \
|
||||
stdio_flush.o \
|
||||
stdio_flush_all_files.o \
|
||||
@ -683,6 +724,7 @@ NET_LIB = \
|
||||
net.lib_rev.o \
|
||||
socket_accept.o \
|
||||
socket_bind.o \
|
||||
socket_check_daemon.o \
|
||||
socket_connect.o \
|
||||
socket_gethostbyaddr.o \
|
||||
socket_gethostbyname.o \
|
||||
@ -709,6 +751,7 @@ NET_LIB = \
|
||||
socket_ioctl.o \
|
||||
socket_isdaemon.o \
|
||||
socket_listen.o \
|
||||
socket_obtain_daemon.o \
|
||||
socket_recv.o \
|
||||
socket_recvfrom.o \
|
||||
socket_recvmsg.o \
|
||||
@ -721,6 +764,8 @@ NET_LIB = \
|
||||
socket_socket.o \
|
||||
socket_hook_entry.o \
|
||||
socket_hstrerror.o \
|
||||
socket_get_h_errno.o \
|
||||
socket_set_h_errno.o \
|
||||
stat_umask.o \
|
||||
usergroup_crypt.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
|
||||
# to build the startup object files and finally the libraries
|
||||
# to build the startup object files and libraries
|
||||
all: \
|
||||
lib \
|
||||
lib/soft-float \
|
||||
lib/small-data \
|
||||
lib/baserel \
|
||||
small_data \
|
||||
large_data \
|
||||
large_data_softfloat \
|
||||
baserel \
|
||||
lib/crt0.o \
|
||||
lib/crtbegin.o \
|
||||
lib/crtend.o \
|
||||
lib/libm.a \
|
||||
lib/small-data/crt0.o \
|
||||
lib/small-data/crtbegin.o \
|
||||
lib/small-data/crtend.o \
|
||||
lib/small-data/libm.a \
|
||||
lib/soft-float/libm.a \
|
||||
lib/baserel/crt0.o \
|
||||
lib/baserel/crtbegin.o \
|
||||
lib/baserel/crtend.o \
|
||||
lib/baserel/libm.a
|
||||
directories \
|
||||
large_data_libs \
|
||||
large_data_softfloat_libs \
|
||||
small_data_libs \
|
||||
baserel_libs
|
||||
|
||||
##############################################################################
|
||||
|
||||
# Create all the directories
|
||||
directories:
|
||||
@-$(MAKEDIR) lib
|
||||
@-$(MAKEDIR) lib/small-data
|
||||
@-$(MAKEDIR) lib/soft-float
|
||||
@-$(MAKEDIR) lib/baserel
|
||||
@-$(MAKEDIR) small_data
|
||||
@-$(MAKEDIR) large_data
|
||||
@-$(MAKEDIR) large_data_softfloat
|
||||
@-$(MAKEDIR) baserel
|
||||
|
||||
##############################################################################
|
||||
|
||||
# Delete all object files and libraries
|
||||
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
|
||||
version:
|
||||
cp c.lib_rev.rev amiga.lib_rev.rev
|
||||
cp c.lib_rev.rev debug.lib_rev.rev
|
||||
cp c.lib_rev.rev m.lib_rev.rev
|
||||
cp c.lib_rev.rev m881.lib_rev.rev
|
||||
cp c.lib_rev.rev net.lib_rev.rev
|
||||
cp c.lib_rev.rev stack.lib_rev.rev
|
||||
cp c.lib_rev.rev unix.lib_rev.rev
|
||||
cp c.lib_rev.rev profile.lib_rev.rev
|
||||
$(COPY) c.lib_rev.rev amiga.lib_rev.rev
|
||||
$(COPY) c.lib_rev.rev debug.lib_rev.rev
|
||||
$(COPY) c.lib_rev.rev m.lib_rev.rev
|
||||
$(COPY) c.lib_rev.rev m881.lib_rev.rev
|
||||
$(COPY) c.lib_rev.rev net.lib_rev.rev
|
||||
$(COPY) c.lib_rev.rev stack.lib_rev.rev
|
||||
$(COPY) c.lib_rev.rev unix.lib_rev.rev
|
||||
$(COPY) c.lib_rev.rev profile.lib_rev.rev
|
||||
bumprev 1 amiga.lib
|
||||
bumprev 1 c.lib
|
||||
bumprev 1 debug.lib
|
||||
@ -918,107 +962,67 @@ cvs-tag:
|
||||
# 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
|
||||
# individual library build targets below.
|
||||
all_libraries: $(TYPE) $(LIBS)
|
||||
all_libraries: $(LIBS)
|
||||
|
||||
##############################################################################
|
||||
|
||||
# These create the required subdirectories to store object files and
|
||||
# libraries in
|
||||
lib:
|
||||
-$(MAKEDIR) $@
|
||||
|
||||
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 large data variant with hardware floating point code
|
||||
# support.
|
||||
large_data_libs: $(addprefix lib/,$(STARTUPS))
|
||||
@-$(MAKEDIR) $(addprefix large_data/,$(dir $(LIBS)))
|
||||
$(BUILD) TYPE=large_data all_libraries
|
||||
|
||||
##############################################################################
|
||||
|
||||
# Dependencies for libm.a (large data variant with hardware floating point code
|
||||
# support): this actually ends up building all the libraries rather than just
|
||||
# libm.a
|
||||
lib/libm.a: large_data large_data/libm.a
|
||||
|
||||
large_data/libm.a:
|
||||
$(MAKE) TYPE=large_data all_libraries
|
||||
$(COPY) $(foreach file,$(LIBS),large_data/$(file)) lib
|
||||
# Dependencies for large data variant with software floating point code
|
||||
# support.
|
||||
large_data_softfloat_libs: $(addprefix lib/,$(STARTUPS))
|
||||
@-$(MAKEDIR) $(addprefix large_data_softfloat/,$(dir $(LIBS)))
|
||||
$(BUILD) TYPE=large_data_softfloat all_libraries
|
||||
|
||||
##############################################################################
|
||||
|
||||
# Dependencies for libm.a (large data variant with software floating point code
|
||||
# support): this actually ends up building all the libraries rather than just
|
||||
# libm.a
|
||||
lib/soft-float/libm.a: large_data_softfloat large_data_softfloat/libm.a
|
||||
|
||||
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 small data variant.
|
||||
small_data_libs: $(addprefix lib/small-data/,$(STARTUPS))
|
||||
@-$(MAKEDIR) $(addprefix small_data/,$(dir $(LIBS)))
|
||||
$(BUILD) TYPE=small_data all_libraries
|
||||
|
||||
##############################################################################
|
||||
|
||||
# Dependencies for libm.a (small data variant): this actually ends up building all
|
||||
# the libraries rather than just libm.a
|
||||
lib/small-data/libm.a: small_data small_data/libm.a
|
||||
|
||||
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
|
||||
# Dependencies for baserel variant.
|
||||
baserel_libs: $(addprefix lib/baserel/,$(STARTUPS))
|
||||
@-$(MAKEDIR) $(addprefix baserel/,$(dir $(LIBS)))
|
||||
$(BUILD) TYPE=baserel all_libraries
|
||||
|
||||
##############################################################################
|
||||
|
||||
# Rules to build and move the startup code
|
||||
lib/crt0.o : lib crt0.o
|
||||
$(COPY) crt0.o lib
|
||||
lib/crt0.o : crt0.o
|
||||
$(COPY) $< $(dir $@)
|
||||
|
||||
lib/crtbegin.o : lib crtbegin.o
|
||||
$(COPY) crtbegin.o lib
|
||||
lib/crtbegin.o : crtbegin.o
|
||||
$(COPY) $< $(dir $@)
|
||||
|
||||
lib/crtend.o : lib crtend.o
|
||||
$(COPY) crtend.o lib
|
||||
lib/crtend.o : crtend.o
|
||||
$(COPY) $< $(dir $@)
|
||||
|
||||
lib/small-data/crt0.o : lib small_data/crt0.o
|
||||
$(COPY) small_data/crt0.o lib/small-data
|
||||
lib/small-data/crt0.o : small_data/crt0.o
|
||||
$(COPY) $< $(dir $@)
|
||||
|
||||
lib/small-data/crtbegin.o : lib small_data/crtbegin.o
|
||||
$(COPY) small_data/crtbegin.o lib/small-data
|
||||
lib/small-data/crtbegin.o : small_data/crtbegin.o
|
||||
$(COPY) $< $(dir $@)
|
||||
|
||||
lib/small-data/crtend.o : lib small_data/crtend.o
|
||||
$(COPY) small_data/crtend.o lib/small-data
|
||||
lib/small-data/crtend.o : small_data/crtend.o
|
||||
$(COPY) $< $(dir $@)
|
||||
|
||||
lib/baserel/crt0.o : lib baserel/crt0.o
|
||||
$(COPY) baserel/crt0.o lib/baserel
|
||||
lib/baserel/crt0.o : baserel/crt0.o
|
||||
$(COPY) $< $(dir $@)
|
||||
|
||||
lib/baserel/crtbegin.o : lib baserel/crtbegin.o
|
||||
$(COPY) baserel/crtbegin.o lib/baserel
|
||||
lib/baserel/crtbegin.o : baserel/crtbegin.o
|
||||
$(COPY) $< $(dir $@)
|
||||
|
||||
lib/baserel/crtend.o : lib baserel/crtend.o
|
||||
$(COPY) baserel/crtend.o lib/baserel
|
||||
lib/baserel/crtend.o : baserel/crtend.o
|
||||
$(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.
|
||||
$(LIBC_OBJS)/stdlib_alloca_debug.o : stdlib_alloca.c
|
||||
@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
|
||||
@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
|
||||
@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
|
||||
@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
|
||||
@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
|
||||
@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
|
||||
@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
|
||||
@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
|
||||
@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
|
||||
@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
|
||||
@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
|
||||
$(LIBC_OBJS) :
|
||||
$(MAKEDIR) $@
|
||||
|
||||
$(LIBC_OBJS)/libc.a : $(LIBC_OBJS) $(foreach file,$(C_LIB),$(LIBC_OBJS)/$(file))
|
||||
$(LIBC_OBJS)/libc.a : $(foreach file,$(C_LIB),$(LIBC_OBJS)/$(file))
|
||||
-$(DELETE) $@
|
||||
@$(AR) $@ $(foreach file,$(C_LIB),$(LIBC_OBJS)/$(file))
|
||||
$(RANLIB) $@
|
||||
$(COPY) $@ $(DEST_DIR)
|
||||
|
||||
##############################################################################
|
||||
|
||||
# Individual build rules for libunix.a
|
||||
$(LIBUNIX_OBJS) :
|
||||
$(MAKEDIR) $@
|
||||
|
||||
$(LIBUNIX_OBJS)/libunix.a : $(LIBUNIX_OBJS) $(foreach file,$(UNIX_LIB),$(LIBUNIX_OBJS)/$(file))
|
||||
$(LIBUNIX_OBJS)/libunix.a : $(foreach file,$(UNIX_LIB),$(LIBUNIX_OBJS)/$(file))
|
||||
-$(DELETE) $@
|
||||
@$(AR) $@ $(foreach file,$(UNIX_LIB),$(LIBUNIX_OBJS)/$(file))
|
||||
$(RANLIB) $@
|
||||
$(COPY) $@ $(DEST_DIR)
|
||||
|
||||
##############################################################################
|
||||
|
||||
# Individual build rules for libm.a
|
||||
$(LIBM_OBJS) :
|
||||
$(MAKEDIR) $@
|
||||
|
||||
$(LIBM_OBJS)/libm.a : $(LIBM_OBJS) $(foreach file,$(MATH_LIB),$(LIBM_OBJS)/$(file))
|
||||
$(LIBM_OBJS)/libm.a : $(foreach file,$(MATH_LIB),$(LIBM_OBJS)/$(file))
|
||||
-$(DELETE) $@
|
||||
@$(AR) $@ $(foreach file,$(MATH_LIB),$(LIBM_OBJS)/$(file))
|
||||
$(RANLIB) $@
|
||||
$(COPY) $@ $(DEST_DIR)
|
||||
|
||||
##############################################################################
|
||||
|
||||
# Individual build rules for libnet.a
|
||||
$(LIBNET_OBJS) :
|
||||
$(MAKEDIR) $@
|
||||
|
||||
$(LIBNET_OBJS)/libnet.a : $(LIBNET_OBJS) $(foreach file,$(NET_LIB),$(LIBNET_OBJS)/$(file))
|
||||
$(LIBNET_OBJS)/libnet.a : $(foreach file,$(NET_LIB),$(LIBNET_OBJS)/$(file))
|
||||
-$(DELETE) $@
|
||||
@$(AR) $@ $(foreach file,$(NET_LIB),$(LIBNET_OBJS)/$(file))
|
||||
$(RANLIB) $@
|
||||
$(COPY) $@ $(DEST_DIR)
|
||||
|
||||
##############################################################################
|
||||
|
||||
# Individual build rules for libdebug.a
|
||||
$(LIBDEBUG_OBJS) :
|
||||
$(MAKEDIR) $@
|
||||
|
||||
$(LIBDEBUG_OBJS)/libdebug.a : $(LIBDEBUG_OBJS) $(foreach file,$(DEBUG_LIB),$(LIBDEBUG_OBJS)/$(file))
|
||||
$(LIBDEBUG_OBJS)/libdebug.a : $(foreach file,$(DEBUG_LIB),$(LIBDEBUG_OBJS)/$(file))
|
||||
-$(DELETE) $@
|
||||
@$(AR) $@ $(foreach file,$(DEBUG_LIB),$(LIBDEBUG_OBJS)/$(file))
|
||||
$(RANLIB) $@
|
||||
$(COPY) $@ $(DEST_DIR)
|
||||
|
||||
##############################################################################
|
||||
|
||||
# Individual build rules for libamiga.a
|
||||
$(LIBAMIGA_OBJS) :
|
||||
$(MAKEDIR) $@
|
||||
|
||||
$(LIBAMIGA_OBJS)/libamiga.a : $(LIBAMIGA_OBJS) $(foreach file,$(AMIGA_LIB),$(LIBAMIGA_OBJS)/$(file))
|
||||
$(LIBAMIGA_OBJS)/libamiga.a : $(foreach file,$(AMIGA_LIB),$(LIBAMIGA_OBJS)/$(file))
|
||||
-$(DELETE) $@
|
||||
@$(AR) $@ $(foreach file,$(AMIGA_LIB),$(LIBAMIGA_OBJS)/$(file))
|
||||
$(RANLIB) $@
|
||||
$(COPY) $@ $(DEST_DIR)
|
||||
|
||||
##############################################################################
|
||||
|
||||
# Individual build rules for libprofile.a
|
||||
$(LIBPROFILE_OBJS) :
|
||||
$(MAKEDIR) $@
|
||||
|
||||
$(LIBPROFILE_OBJS)/libprofile.a : $(LIBPROFILE_OBJS) $(foreach file,$(PROFILE_LIB),$(LIBPROFILE_OBJS)/$(file))
|
||||
$(LIBPROFILE_OBJS)/libprofile.a : $(foreach file,$(PROFILE_LIB),$(LIBPROFILE_OBJS)/$(file))
|
||||
-$(DELETE) $@
|
||||
@$(AR) $@ $(foreach file,$(PROFILE_LIB),$(LIBPROFILE_OBJS)/$(file))
|
||||
$(RANLIB) $@
|
||||
$(COPY) $@ $(DEST_DIR)
|
||||
|
||||
##############################################################################
|
||||
|
||||
# Individual build rules for the startup code.
|
||||
crt0.o : crt0.S
|
||||
@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
|
||||
@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
|
||||
@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
|
||||
@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
|
||||
@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
|
||||
@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
|
||||
@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)
|
||||
|
||||
20
library/TODO
20
library/TODO
@ -1,19 +1,5 @@
|
||||
C99 math functions:
|
||||
|
||||
(functions generally missing, including their "float" counterparts)
|
||||
fma
|
||||
fmaf
|
||||
lrint
|
||||
lrintf
|
||||
lround
|
||||
lroundf
|
||||
nearbyint
|
||||
nearbyintf
|
||||
remquo
|
||||
remquof
|
||||
round
|
||||
roundf
|
||||
tgamma
|
||||
tgammaf
|
||||
trunc
|
||||
truncf
|
||||
fma() and fmaf() should be implemented as a true "fused" multiply
|
||||
and add function rather than the sequential operation implied in the
|
||||
current implementation.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#define VERSION 1
|
||||
#define REVISION 193
|
||||
#define DATE "4.6.2005"
|
||||
#define VERS "amiga.lib 1.193"
|
||||
#define VSTRING "amiga.lib 1.193 (4.6.2005)\r\n"
|
||||
#define VERSTAG "\0$VER: amiga.lib 1.193 (4.6.2005)"
|
||||
#define REVISION 197
|
||||
#define DATE "4.11.2005"
|
||||
#define VERS "amiga.lib 1.197"
|
||||
#define VSTRING "amiga.lib 1.197 (4.11.2005)\r\n"
|
||||
#define VERSTAG "\0$VER: amiga.lib 1.197 (4.11.2005)"
|
||||
|
||||
@ -1 +1 @@
|
||||
193
|
||||
197
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -61,11 +61,11 @@ struct DiskObject * CXLIB_disko;
|
||||
STRPTR *
|
||||
ArgArrayInit(LONG argc, CONST_STRPTR * argv)
|
||||
{
|
||||
unsigned char ** result = NULL;
|
||||
STRPTR * result = NULL;
|
||||
|
||||
if(argc != 0) /* run from CLI */
|
||||
{
|
||||
int i;
|
||||
LONG i;
|
||||
|
||||
if(argc == 1)
|
||||
goto out; /* skip command name */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: amiga_dotimer.c,v 1.4 2005-03-18 12:38:21 obarthel Exp $
|
||||
* $Id: amiga_dotimer.c,v 1.6 2005-09-03 14:45:14 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -67,9 +67,10 @@ DoTimer(struct timeval *tv,LONG unit,LONG command)
|
||||
#if defined(__amigaos4__)
|
||||
{
|
||||
mp = AllocSysObjectTags(ASOT_PORT,
|
||||
ASOPORT_Action, PA_SIGNAL,
|
||||
ASOPORT_Signal, SIGB_SINGLE,
|
||||
ASOPORT_Target, FindTask(NULL),
|
||||
ASOPORT_Action, PA_SIGNAL,
|
||||
ASOPORT_AllocSig, FALSE,
|
||||
ASOPORT_Signal, SIGB_SINGLE,
|
||||
ASOPORT_Target, FindTask(NULL),
|
||||
TAG_DONE);
|
||||
|
||||
if(mp == NULL)
|
||||
@ -113,7 +114,7 @@ DoTimer(struct timeval *tv,LONG unit,LONG command)
|
||||
|
||||
PROFILE_OFF();
|
||||
|
||||
SetSignal(0,SIGF_SINGLE);
|
||||
SetSignal(0,(1UL << mp->mp_SigBit));
|
||||
|
||||
error = DoIO((struct IORequest *)tr);
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ copy include ram:${dir_name}/include all clone quiet
|
||||
copy changes ram:$dir_name clone
|
||||
|
||||
; Delete the CVS data from the include directory
|
||||
delete ram:${dir_name}/include/CVS ram:${dir_name}/include/sys/CVS all quiet
|
||||
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:
|
||||
pushcd ram:
|
||||
|
||||
@ -19,7 +19,7 @@ cp -a include $dir_name
|
||||
cp changes $dir_name
|
||||
|
||||
# Delete the CVS data from the include directory
|
||||
rm -rf ${dir_name}/include/CVS ${dir_name}/include/sys/CVS
|
||||
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
|
||||
# can unpack it.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#define VERSION 1
|
||||
#define REVISION 193
|
||||
#define DATE "4.6.2005"
|
||||
#define VERS "c.lib 1.193"
|
||||
#define VSTRING "c.lib 1.193 (4.6.2005)\r\n"
|
||||
#define VERSTAG "\0$VER: c.lib 1.193 (4.6.2005)"
|
||||
#define REVISION 197
|
||||
#define DATE "4.11.2005"
|
||||
#define VERS "c.lib 1.197"
|
||||
#define VSTRING "c.lib 1.197 (4.11.2005)\r\n"
|
||||
#define VERSTAG "\0$VER: c.lib 1.197 (4.11.2005)"
|
||||
|
||||
@ -1 +1 @@
|
||||
193
|
||||
197
|
||||
|
||||
184
library/changes
184
library/changes
@ -1,3 +1,161 @@
|
||||
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)
|
||||
|
||||
- In __time_delay() the CheckIO() test was wrong and should have
|
||||
tested for a request still in progress. Fixed.
|
||||
|
||||
- Modified select() to support plain files, too. The new code now
|
||||
compares the current file position against the current file size,
|
||||
if that file is on a file system, or simply checks if there is
|
||||
any data in the file (which works for the default PIPE: device).
|
||||
|
||||
- The raw file descriptor structure member fd_Position is now
|
||||
always updated, regardless of whether the file supports random
|
||||
access or not.
|
||||
|
||||
- The wildcard escape character used in __wildcard_expand_init() was
|
||||
wrong. It should have been "'" but it was "`". Fixed.
|
||||
|
||||
- The startup code now references the linker symbol generated for
|
||||
the user-supplied main() function.
|
||||
|
||||
- log(+/-0), logb(+/-0), log10(+/-0) now return -infinity.
|
||||
|
||||
- getcwd() now considers a buffer size of 0 an error, and it sets
|
||||
the errno code to ERANGE if the buffer is too small.
|
||||
|
||||
- With Unix path semantics enabled, rename() now fails if either
|
||||
the old or the new name are empty strings. Same thing for
|
||||
opendir(), utime(), unlink(), chown(), link(), readlink(),
|
||||
realpath(), chdir(), access(), stat(), rmdir(), lstat(),
|
||||
chmod(), statfs() and open()/fopen().
|
||||
|
||||
- Fixed several issues with the formatted output of strftime()
|
||||
for the "C" locale: "%p" could return " PM", "%c" is now
|
||||
equivalent to "%a %b %e %T %Y", "%x" is equivalent to "%m/%d/%y"
|
||||
and "%X" is now equivalent to "%T".
|
||||
|
||||
- The 68020/030/040/060 versions of the library now include the
|
||||
64 bit integer conversion code. The plain 68000 version does not.
|
||||
|
||||
- The 64 bit integer conversion code used in by the scanf() family
|
||||
was broken due to a misplaced overflow check, which had the cruel
|
||||
effect of triggering for 32 bit integers as well. Fixed.
|
||||
|
||||
- DoTimer() did not allocate the local MsgPort correctly. Fixed.
|
||||
|
||||
|
||||
c.lib 1.194 (15.7.2005)
|
||||
|
||||
- Added getopt_long to libunix.a <tfrieden>
|
||||
|
||||
- Added new libprofile.a which implements gprof gmon.out output <tfrieden>
|
||||
@ -18,7 +176,7 @@
|
||||
|
||||
- The pattern matching code which expands command line arguments, as part
|
||||
of libunix.a, now translates the "*" wildcard into "#?" unless you prefix
|
||||
it with a backtick ("`"), which is the wildcard pattern escape character
|
||||
it with a backtick ("'"), which is the wildcard pattern escape character
|
||||
used on AmigaOS.
|
||||
|
||||
- Repaired the pattern matching code which expands command line arguments:
|
||||
@ -29,7 +187,7 @@
|
||||
- Fixed a bug in vfprintf that would surface when the buffer was enlarged
|
||||
if the pattern was too large to fit the static internal buffer <tfrieden>
|
||||
|
||||
- Added file system names to statfx <tfrieden>
|
||||
- Added file system names to statfs <tfrieden>
|
||||
|
||||
- Moved all the constructor code out of "stdlib_init_exit.c" and into the
|
||||
files which initialize global data, such as the new "stdlib_program_name.c"
|
||||
@ -45,6 +203,28 @@
|
||||
Amiga shared library/device code. Some documentation on how to use them
|
||||
can be found in the <dos.h> header file.
|
||||
|
||||
- Added a complete shared library skeleton example to demonstrate how the
|
||||
clib2 shared library initialization/cleanup functions should be used.
|
||||
This is a dual-build library which will both work with the plain 68k
|
||||
AmigaOS and the PowerPC native AmigaOS4. The example source code can be
|
||||
found in the "skeleton_library" subdirectory.
|
||||
|
||||
- The thread-safe version of isatty() should now work for stdio
|
||||
file descriptors, too.
|
||||
|
||||
- Retrofitted thread-safety into the termios code.
|
||||
|
||||
- The socket/usergroup API function and data type definitions that used to
|
||||
be defined in <unistd.h> have been moved into a separate header file
|
||||
<sys/clib2_net.h> which, for backwards compatibility, can be include
|
||||
from within <unistd.h> if the preprocessor symbol __USE_CLIB2_NETLIB
|
||||
is defined early on. Eventually, <sys/clib2_net.h> should be removed
|
||||
from the general header files and become a local library build header
|
||||
file altogether. Note that in this case you would have to build your
|
||||
own software using common TCP/IP SDK header files.
|
||||
|
||||
- <sys/types.h> now also includes <time.h> and <stddef.h>.
|
||||
|
||||
|
||||
c.lib 1.193 (4.6.2005)
|
||||
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
//
|
||||
// $Id: crt0.S,v 1.3 2005-06-26 12:02:56 tfrieden Exp $
|
||||
// $Id: crt0.S,v 1.6 2005-10-11 09:28:29 obarthel Exp $
|
||||
//
|
||||
// :ts=4
|
||||
//
|
||||
|
||||
.text
|
||||
|
||||
.globl main /* This enforces linkage against the main() function */
|
||||
.globl _main
|
||||
.globl _start
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#define VERSION 1
|
||||
#define REVISION 193
|
||||
#define DATE "4.6.2005"
|
||||
#define VERS "debug.lib 1.193"
|
||||
#define VSTRING "debug.lib 1.193 (4.6.2005)\r\n"
|
||||
#define VERSTAG "\0$VER: debug.lib 1.193 (4.6.2005)"
|
||||
#define REVISION 197
|
||||
#define DATE "4.11.2005"
|
||||
#define VERS "debug.lib 1.197"
|
||||
#define VSTRING "debug.lib 1.197 (4.11.2005)\r\n"
|
||||
#define VERSTAG "\0$VER: debug.lib 1.197 (4.11.2005)"
|
||||
|
||||
@ -1 +1 @@
|
||||
193
|
||||
197
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: dirent_opendir.c,v 1.9 2005-03-18 12:38:22 obarthel Exp $
|
||||
* $Id: dirent_opendir.c,v 1.10 2005-08-26 12:39:33 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -128,6 +128,14 @@ opendir(const char * path_name)
|
||||
|
||||
if(__unix_path_semantics)
|
||||
{
|
||||
if(path_name[0] == '\0')
|
||||
{
|
||||
SHOWMSG("no name given");
|
||||
|
||||
__set_errno(ENOENT);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if(__translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0)
|
||||
goto out;
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -96,7 +96,7 @@ readdir(DIR * directory_pointer)
|
||||
if(dh->dh_VolumeNode == NULL && NOT IsListEmpty((struct List *)&dh->dh_VolumeList))
|
||||
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)
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: fcntl_lseek.c,v 1.9 2005-04-24 09:53:11 obarthel Exp $
|
||||
* $Id: fcntl_lseek.c,v 1.10 2005-07-06 18:48:53 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -46,8 +46,8 @@ lseek(int file_descriptor, off_t offset, int mode)
|
||||
{
|
||||
struct file_action_message fam;
|
||||
off_t result = SEEK_ERROR;
|
||||
struct fd * fd = NULL;
|
||||
off_t position;
|
||||
struct fd * fd;
|
||||
|
||||
ENTER();
|
||||
|
||||
@ -62,6 +62,8 @@ lseek(int file_descriptor, off_t offset, int mode)
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
__stdio_lock();
|
||||
|
||||
fd = __get_file_descriptor(file_descriptor);
|
||||
if(fd == NULL)
|
||||
{
|
||||
@ -69,6 +71,8 @@ lseek(int file_descriptor, off_t offset, int mode)
|
||||
goto out;
|
||||
}
|
||||
|
||||
__fd_lock(fd);
|
||||
|
||||
if(mode < SEEK_SET || mode > SEEK_END)
|
||||
{
|
||||
SHOWMSG("seek mode is invalid");
|
||||
@ -104,6 +108,10 @@ lseek(int file_descriptor, off_t offset, int mode)
|
||||
|
||||
out:
|
||||
|
||||
__fd_unlock(fd);
|
||||
|
||||
__stdio_unlock();
|
||||
|
||||
RETURN(result);
|
||||
return(result);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: fcntl_open.c,v 1.16 2005-04-24 08:46:37 obarthel Exp $
|
||||
* $Id: fcntl_open.c,v 1.17 2005-08-26 12:39:33 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -158,6 +158,14 @@ open(const char *path_name, int open_flag, ... /* mode_t mode */ )
|
||||
{
|
||||
if(__unix_path_semantics)
|
||||
{
|
||||
if(path_name[0] == '\0')
|
||||
{
|
||||
SHOWMSG("no name given");
|
||||
|
||||
__set_errno(ENOENT);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if(__translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0)
|
||||
goto out;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: fcntl_read.c,v 1.8 2005-04-24 08:46:37 obarthel Exp $
|
||||
* $Id: fcntl_read.c,v 1.9 2005-07-06 18:48:53 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -51,8 +51,8 @@ ssize_t
|
||||
read(int file_descriptor, void * buffer, size_t num_bytes)
|
||||
{
|
||||
ssize_t num_bytes_read;
|
||||
struct fd * fd = NULL;
|
||||
ssize_t result = EOF;
|
||||
struct fd * fd;
|
||||
|
||||
ENTER();
|
||||
|
||||
@ -66,6 +66,8 @@ read(int file_descriptor, void * buffer, size_t num_bytes)
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
__stdio_lock();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(buffer == NULL)
|
||||
@ -89,6 +91,8 @@ read(int file_descriptor, void * buffer, size_t num_bytes)
|
||||
goto out;
|
||||
}
|
||||
|
||||
__fd_lock(fd);
|
||||
|
||||
if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_READ))
|
||||
{
|
||||
SHOWMSG("this descriptor is not read-enabled");
|
||||
@ -125,6 +129,10 @@ read(int file_descriptor, void * buffer, size_t num_bytes)
|
||||
|
||||
out:
|
||||
|
||||
__fd_unlock(fd);
|
||||
|
||||
__stdio_unlock();
|
||||
|
||||
RETURN(result);
|
||||
return(result);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: fcntl_write.c,v 1.8 2005-04-24 08:46:37 obarthel Exp $
|
||||
* $Id: fcntl_write.c,v 1.9 2005-07-06 18:48:53 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -51,8 +51,8 @@ ssize_t
|
||||
write(int file_descriptor, const void * buffer, size_t num_bytes)
|
||||
{
|
||||
ssize_t num_bytes_written;
|
||||
struct fd * fd = NULL;
|
||||
ssize_t result = EOF;
|
||||
struct fd * fd;
|
||||
|
||||
ENTER();
|
||||
|
||||
@ -66,6 +66,8 @@ write(int file_descriptor, const void * buffer, size_t num_bytes)
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
__stdio_lock();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(buffer == NULL)
|
||||
@ -89,6 +91,8 @@ write(int file_descriptor, const void * buffer, size_t num_bytes)
|
||||
goto out;
|
||||
}
|
||||
|
||||
__fd_lock(fd);
|
||||
|
||||
if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_WRITE))
|
||||
{
|
||||
SHOWMSG("file descriptor is not write-enabled");
|
||||
@ -125,6 +129,10 @@ write(int file_descriptor, const void * buffer, size_t num_bytes)
|
||||
|
||||
out:
|
||||
|
||||
__fd_unlock(fd);
|
||||
|
||||
__stdio_unlock();
|
||||
|
||||
RETURN(result);
|
||||
return(result);
|
||||
}
|
||||
|
||||
80
library/include/arpa/inet.h
Normal file
80
library/include/arpa/inet.h
Normal 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 */
|
||||
@ -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
|
||||
*
|
||||
@ -31,8 +31,8 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _CYTPE_H
|
||||
#define _CYTPE_H
|
||||
#ifndef _CTYPE_H
|
||||
#define _CTYPE_H
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -120,4 +120,4 @@ extern const unsigned char __ctype_table[];
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* _CYTPE_H */
|
||||
#endif /* _CTYPE_H */
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -40,12 +40,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif /* _SYS_TYPES_H */
|
||||
@ -56,6 +50,12 @@ extern "C" {
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define NAME_MAX FILENAME_MAX
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -40,12 +40,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDIO_H
|
||||
#include <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
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
@ -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
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -40,12 +40,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _SYS_TYPES_H
|
||||
#include <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_WRONLY 1
|
||||
#define O_RDWR 2
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -36,12 +36,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* 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). */
|
||||
enum
|
||||
{
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -40,15 +40,25 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif /* _SYS_TYPES_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif /* _SYS_TYPES_H */
|
||||
#ifdef __GNUC__
|
||||
#ifdef __PPC__
|
||||
#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
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -56,6 +56,12 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* printf() format specifications for different types. */
|
||||
|
||||
/* "Decimal" */
|
||||
@ -315,4 +321,10 @@ extern uintmax_t wcstoumax(const wchar_t *str, char **ptr, int base);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* _INTTYPES_H */
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -244,46 +244,64 @@ extern float tanhf(float x);
|
||||
|
||||
extern float acoshf(float x);
|
||||
extern float asinhf(float x);
|
||||
extern float atanhf(float x);
|
||||
extern float cbrtf(float x);
|
||||
extern float copysignf(float x, float y);
|
||||
extern float erfcf(float x);
|
||||
extern float erff(float x);
|
||||
extern float expm1f(float x);
|
||||
extern float fdimf(float x,float y);
|
||||
extern float fmaf(float x,float y,float z);
|
||||
extern float fmaxf(float x,float y);
|
||||
extern float fminf(float x,float y);
|
||||
extern float hypotf(float x, float y);
|
||||
extern float lgammaf(float x);
|
||||
extern float log1pf(float x);
|
||||
extern float logbf(float x);
|
||||
extern long int lrintf(float x);
|
||||
extern long int lroundf(float x);
|
||||
extern float nanf(const char *tagp);
|
||||
extern float nearbyintf(float x);
|
||||
extern float nextafterf(float x,float y);
|
||||
extern float remainderf(float x, float p);
|
||||
extern float remquof(float x,float y,int * quo);
|
||||
extern float rintf(float x);
|
||||
extern float roundf(float x);
|
||||
extern float scalbnf (float x, int n);
|
||||
extern float tgammaf(float x);
|
||||
extern float truncf(float x);
|
||||
extern int ilogbf(float x);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern double acosh(double x);
|
||||
extern double asinh(double x);
|
||||
extern double atanh(double x);
|
||||
extern double cbrt(double x);
|
||||
extern double copysign(double x, double y);
|
||||
extern double erf(double x);
|
||||
extern double erfc(double x);
|
||||
extern double expm1(double x);
|
||||
extern double fdim(double x,double y);
|
||||
extern double fma(double x,double y,double z);
|
||||
extern double fmax(double x,double y);
|
||||
extern double fmin(double x,double y);
|
||||
extern double hypot(double x,double y);
|
||||
extern double lgamma(double x);
|
||||
extern double log1p(double x);
|
||||
extern double logb(double x);
|
||||
extern long int lrint(double x);
|
||||
extern long int lround(double x);
|
||||
extern double nan(const char *tagp);
|
||||
extern double nearbyint(double x);
|
||||
extern double nextafter(double x,double y);
|
||||
extern double remainder(double x, double p);
|
||||
extern double remquo(double x,double y,int * quo);
|
||||
extern double rint(double x);
|
||||
extern double round(double x);
|
||||
extern double scalbn (double x, int n);
|
||||
extern double tgamma(double x);
|
||||
extern double trunc(double x);
|
||||
extern int ilogb(double x);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
174
library/include/netdb.h
Normal file
174
library/include/netdb.h
Normal 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 */
|
||||
260
library/include/netinet/in.h
Normal file
260
library/include/netinet/in.h
Normal 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 */
|
||||
@ -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
|
||||
*
|
||||
@ -40,15 +40,25 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif /* _SYS_TYPES_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif /* _SYS_TYPES_H */
|
||||
#ifdef __GNUC__
|
||||
#ifdef __PPC__
|
||||
#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
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -68,7 +68,7 @@ extern "C" {
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define __bool_true_and_false_are_defined 1
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -36,12 +36,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDDEF_H
|
||||
#include <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() */
|
||||
#define EOF (-1)
|
||||
|
||||
@ -154,7 +154,7 @@ typedef struct
|
||||
#define L_tmpnam 10
|
||||
|
||||
/* Maximum number of unique file names tmpnam() can generate */
|
||||
#define TMP_MAX 0x3ffff
|
||||
#define TMP_MAX 0x40000
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -36,18 +36,18 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDDEF_H
|
||||
#include <stddef.h>
|
||||
#endif /* _STDDEF_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Maximum number of bytes in a multibyte character */
|
||||
#define MB_CUR_MAX 2
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -36,18 +36,18 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDDEF_H
|
||||
#include <stddef.h>
|
||||
#endif /* _STDDEF_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern char *strerror(int error_number);
|
||||
extern char *strcat(char *dest, const char *src);
|
||||
extern char *strncat(char *dest, const char *src, size_t n);
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -40,18 +40,18 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDDEF_H
|
||||
#include <stddef.h>
|
||||
#endif /* _STDDEF_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* These come from 4.4BSD. */
|
||||
extern int strcasecmp(const char *s1, const char *s2);
|
||||
extern int strncasecmp(const char *s1, const char *s2, size_t len);
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -40,18 +40,18 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif /* _STDARG_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Define the AmigaOS specific varargs macros,
|
||||
if <stdarg.h> didn't already define them. */
|
||||
|
||||
|
||||
72
library/include/sys/filio.h
Normal file
72
library/include/sys/filio.h
Normal 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 */
|
||||
78
library/include/sys/ioccom.h
Normal file
78
library/include/sys/ioccom.h
Normal 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 */
|
||||
68
library/include/sys/ioctl.h
Normal file
68
library/include/sys/ioctl.h
Normal 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 */
|
||||
@ -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
|
||||
*
|
||||
@ -40,18 +40,18 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif /* _SYS_TYPES_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
typedef struct { long val[2]; } fsid_t; /* file system id type */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
102
library/include/sys/select.h
Normal file
102
library/include/sys/select.h
Normal 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 */
|
||||
346
library/include/sys/socket.h
Normal file
346
library/include/sys/socket.h
Normal 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 */
|
||||
@ -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
|
||||
*
|
||||
@ -40,12 +40,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _SYS_TYPES_H
|
||||
#include <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_ISGID 0002000 /* set group id on execution */
|
||||
#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 mkdir(const char * path_name, mode_t mode);
|
||||
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);
|
||||
|
||||
#endif /* __NO_NET_API */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: types.h,v 1.4 2005-02-20 15:46:57 obarthel Exp $
|
||||
* $Id: types.h,v 1.6 2005-10-09 12:32:18 obarthel Exp $
|
||||
*
|
||||
* :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
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -40,12 +40,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _SYS_TYPES_H
|
||||
#include <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
|
||||
* for vectored I/O and even a single struct iovec can overflow a ssize_t.
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -31,14 +31,25 @@
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _TERMIOS_H
|
||||
#define _TERMIOS_H
|
||||
|
||||
typedef unsigned int tcflag_t;
|
||||
typedef unsigned char cc_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 cfsetospeed(struct termios *tios_p,speed_t output_speed);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
#endif /* _TERMIOS_H */
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -36,18 +36,18 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDDEF_H
|
||||
#include <stddef.h>
|
||||
#endif /* _STDDEF_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
* Divide the number returned by clock() by CLOCKS_PER_SEC to obtain
|
||||
* the elapsed time in seconds
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd.h,v 1.12 2005-06-18 07:23:17 obarthel Exp $
|
||||
* $Id: unistd.h,v 1.14 2005-10-09 12:32:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -40,16 +40,20 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _FCNTL_H
|
||||
#include <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). */
|
||||
@ -119,173 +123,32 @@ extern char * __getcwd(char * buffer,size_t buffer_size,const char *file,int lin
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
* The following may have been predefined by local TCP/IP header files. We
|
||||
* don't want to be any trouble...
|
||||
* The following prototypes may clash with the bsdsocket.library or
|
||||
* usergroup.library API definitions.
|
||||
*/
|
||||
|
||||
#if !defined(FD_SET) && !defined(__NO_NET_API)
|
||||
#ifndef __NO_NET_API
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#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 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 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 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 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);
|
||||
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 /* !FD_SET && !__NO_NET_API */
|
||||
#endif /* __NO_NET_API */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -40,18 +40,18 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _TIME_H
|
||||
#include <time.h>
|
||||
#endif /* _TIME_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
struct utimbuf
|
||||
{
|
||||
time_t actime; /* Access time */
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -36,12 +36,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDDEF_H
|
||||
#include <stddef.h>
|
||||
#endif /* _STDDEF_H */
|
||||
@ -60,6 +54,12 @@ extern "C" {
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define WEOF (-1)
|
||||
#define WCHAR_MAX 65535
|
||||
#define WCHAR_MIN 0
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -36,18 +36,18 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _WCHAR_H
|
||||
#include <wchar.h>
|
||||
#endif /* _WCHAR_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
typedef long wctype_t; /* ZZZ */
|
||||
typedef long wctrans_t; /* ZZZ */
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -46,6 +46,8 @@
|
||||
intmax_t
|
||||
strtoimax(const char *str, char **ptr, int base)
|
||||
{
|
||||
const char * stop = str;
|
||||
size_t num_digits_converted = 0;
|
||||
BOOL is_negative;
|
||||
intmax_t result = 0;
|
||||
intmax_t new_sum;
|
||||
@ -172,20 +174,28 @@ strtoimax(const char *str, char **ptr, int base)
|
||||
str++;
|
||||
|
||||
c = (*str);
|
||||
|
||||
num_digits_converted++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Did we convert anything? */
|
||||
if(num_digits_converted == 0)
|
||||
goto out;
|
||||
|
||||
if(is_negative)
|
||||
result = (-sum);
|
||||
else
|
||||
result = sum;
|
||||
|
||||
stop = str;
|
||||
|
||||
out:
|
||||
|
||||
/* If desired, remember where we stopped reading the
|
||||
number from the buffer. */
|
||||
if(ptr != NULL)
|
||||
(*ptr) = (char *)str;
|
||||
(*ptr) = (char *)stop;
|
||||
|
||||
RETURN(result);
|
||||
return(result);
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -46,6 +46,8 @@
|
||||
uintmax_t
|
||||
strtoumax(const char *str, char **ptr, int base)
|
||||
{
|
||||
const char * stop = str;
|
||||
size_t num_digits_converted = 0;
|
||||
BOOL is_negative;
|
||||
uintmax_t result = 0;
|
||||
uintmax_t new_sum;
|
||||
@ -169,9 +171,19 @@ strtoumax(const char *str, char **ptr, int base)
|
||||
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)
|
||||
result = (-sum);
|
||||
else
|
||||
@ -182,7 +194,7 @@ strtoumax(const char *str, char **ptr, int base)
|
||||
/* If desired, remember where we stopped reading the
|
||||
number from the buffer. */
|
||||
if(ptr != NULL)
|
||||
(*ptr) = (char *)str;
|
||||
(*ptr) = (char *)stop;
|
||||
|
||||
RETURN(result);
|
||||
return(result);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#define VERSION 1
|
||||
#define REVISION 193
|
||||
#define DATE "4.6.2005"
|
||||
#define VERS "m.lib 1.193"
|
||||
#define VSTRING "m.lib 1.193 (4.6.2005)\r\n"
|
||||
#define VERSTAG "\0$VER: m.lib 1.193 (4.6.2005)"
|
||||
#define REVISION 197
|
||||
#define DATE "4.11.2005"
|
||||
#define VERS "m.lib 1.197"
|
||||
#define VSTRING "m.lib 1.197 (4.11.2005)\r\n"
|
||||
#define VERSTAG "\0$VER: m.lib 1.197 (4.11.2005)"
|
||||
|
||||
@ -1 +1 @@
|
||||
193
|
||||
197
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#define VERSION 1
|
||||
#define REVISION 193
|
||||
#define DATE "4.6.2005"
|
||||
#define VERS "m881.lib 1.193"
|
||||
#define VSTRING "m881.lib 1.193 (4.6.2005)\r\n"
|
||||
#define VERSTAG "\0$VER: m881.lib 1.193 (4.6.2005)"
|
||||
#define REVISION 197
|
||||
#define DATE "4.11.2005"
|
||||
#define VERS "m881.lib 1.197"
|
||||
#define VSTRING "m881.lib 1.197 (4.11.2005)\r\n"
|
||||
#define VERSTAG "\0$VER: m881.lib 1.197 (4.11.2005)"
|
||||
|
||||
@ -1 +1 @@
|
||||
193
|
||||
197
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: macros.h,v 1.20 2005-05-27 13:19:30 obarthel Exp $
|
||||
* $Id: macros.h,v 1.21 2005-08-02 10:18:50 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -42,6 +42,7 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define BUSY ((struct IORequest *)NULL)
|
||||
#define CANNOT !
|
||||
#define DO_NOTHING ((void)0)
|
||||
#define NO !
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -153,7 +153,7 @@ qS2 = 2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */
|
||||
qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */
|
||||
qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
|
||||
|
||||
INLINE STATIC const double
|
||||
INLINE STATIC double
|
||||
__acos(double x)
|
||||
{
|
||||
double z,p,q,r,w,s,c,df;
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -156,7 +156,7 @@ qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */
|
||||
qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
|
||||
|
||||
|
||||
INLINE STATIC const double
|
||||
INLINE STATIC double
|
||||
__asin(double x)
|
||||
{
|
||||
double t,w,p,q,c,r,s;
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -169,7 +169,7 @@ static const double
|
||||
one = 1.0,
|
||||
huge = 1.0e300;
|
||||
|
||||
INLINE STATIC const double
|
||||
INLINE STATIC double
|
||||
__atan(double x)
|
||||
{
|
||||
double w,s1,s2,z;
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -209,7 +209,7 @@ pi_o_2 = 1.5707963267948965580E+00, /* 0x3FF921FB, 0x54442D18 */
|
||||
pi = 3.1415926535897931160E+00, /* 0x400921FB, 0x54442D18 */
|
||||
pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
|
||||
|
||||
INLINE STATIC const double
|
||||
INLINE STATIC double
|
||||
__atan2(double y,double x)
|
||||
{
|
||||
double z;
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -29,6 +29,15 @@
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* 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
|
||||
@ -41,11 +50,31 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
static const double zero = 0.0;
|
||||
static const double one = 1.0, huge = 1e300;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
double
|
||||
atanh(double x)
|
||||
{
|
||||
/* ZZZ unimplemented */
|
||||
return(0);
|
||||
double t;
|
||||
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;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -29,6 +29,17 @@
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* 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
|
||||
@ -41,11 +52,29 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
float
|
||||
atanhf(float x)
|
||||
static const float zero = 0.0;
|
||||
static const float one = 1.0, huge = 1e30;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
float atanhf(float x)
|
||||
{
|
||||
/* ZZZ unimplemented */
|
||||
return(0);
|
||||
float t;
|
||||
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;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -152,7 +152,7 @@ __ceil(double x)
|
||||
|
||||
static const double huge = 1.0e300;
|
||||
|
||||
INLINE STATIC const double
|
||||
INLINE STATIC double
|
||||
__ceil(double x)
|
||||
{
|
||||
int i0,i1,j0;
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -137,7 +137,7 @@ __cos(double x)
|
||||
|
||||
#if defined(PPC_FLOATING_POINT_SUPPORT)
|
||||
|
||||
INLINE STATIC const double
|
||||
INLINE STATIC double
|
||||
__cos(double x)
|
||||
{
|
||||
double y[2],z=0.0;
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -139,7 +139,7 @@ __cosh(double x)
|
||||
|
||||
static const double one = 1.0, half=0.5, huge = 1.0e300;
|
||||
|
||||
INLINE STATIC const double
|
||||
INLINE STATIC double
|
||||
__cosh(double x)
|
||||
{
|
||||
double t,w;
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -155,7 +155,7 @@ P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */
|
||||
P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */
|
||||
P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
|
||||
|
||||
INLINE STATIC const double
|
||||
INLINE STATIC double
|
||||
__exp(double x)
|
||||
{
|
||||
double y,hi,lo,c,t;
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -134,7 +134,7 @@ __fabs(double x)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
INLINE STATIC const double
|
||||
INLINE STATIC double
|
||||
__fabs(double x)
|
||||
{
|
||||
double res;
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -108,7 +108,7 @@ __fabsf(float x)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
INLINE STATIC const float
|
||||
INLINE STATIC float
|
||||
__fabsf(float number)
|
||||
{
|
||||
union ieee_single x;
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -153,7 +153,8 @@ __floor(double x)
|
||||
#if defined(PPC_FLOATING_POINT_SUPPORT)
|
||||
|
||||
static const double huge = 1.0e300;
|
||||
INLINE STATIC const double
|
||||
|
||||
INLINE STATIC double
|
||||
__floor(double x)
|
||||
{
|
||||
int i0,i1,j0;
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -44,8 +44,9 @@
|
||||
double
|
||||
fma(double x,double y,double z)
|
||||
{
|
||||
/* ZZZ unimplemented */
|
||||
return(0);
|
||||
/* ZZZ this should be a *fused* multiply & add, and
|
||||
not a sequential operation as declared below! */
|
||||
return((x * y) + z);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -44,8 +44,9 @@
|
||||
float
|
||||
fmaf(float x,float y,float z)
|
||||
{
|
||||
/* ZZZ unimplemented */
|
||||
return(0);
|
||||
/* ZZZ this should be a *fused* multiply & add, and
|
||||
not a sequential operation as declared below! */
|
||||
return((x * y) + z);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -102,7 +102,7 @@ static const double
|
||||
one = 1.0,
|
||||
Zero[] = {0.0, -0.0,};
|
||||
|
||||
INLINE STATIC const double
|
||||
INLINE STATIC double
|
||||
__fmod(double x,double y)
|
||||
{
|
||||
int n,hx,hy,hz,ix,iy,sx,i;
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -146,7 +146,7 @@ __frexp(double x,int * nptr)
|
||||
static const double
|
||||
two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */
|
||||
|
||||
INLINE STATIC const double
|
||||
INLINE STATIC double
|
||||
__frexp(double x,int * eptr)
|
||||
{
|
||||
int hx, ix, lx;
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -220,6 +220,8 @@ extern float __kernel_cosf(float x, float y);
|
||||
extern float __kernel_sinf(float x, float y, int iy);
|
||||
extern LONG __rem_pio2f(float x, float *y);
|
||||
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);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -85,38 +85,43 @@ __hypot(double x,double y)
|
||||
|
||||
static const double one = 1.0;
|
||||
|
||||
INLINE STATIC const double
|
||||
INLINE STATIC double
|
||||
__hypot(double x,double y)
|
||||
{
|
||||
int n0;
|
||||
double a=x,b=y,t1,t2,y1,y2,w;
|
||||
int j,k,ha,hb;
|
||||
|
||||
n0 = ((*(int*)&one)>>29)^1; /* high word index */
|
||||
ha = *(n0+(int*)&x)&0x7fffffff; /* high word of x */
|
||||
hb = *(n0+(int*)&y)&0x7fffffff; /* high word of y */
|
||||
GET_HIGH_WORD(ha,x);
|
||||
ha &= 0x7fffffff;
|
||||
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;}
|
||||
*(n0+(int*)&a) = ha; /* a <- |a| */
|
||||
*(n0+(int*)&b) = hb; /* b <- |b| */
|
||||
SET_HIGH_WORD(a,ha); /* a <- |a| */
|
||||
SET_HIGH_WORD(b,hb); /* b <- |b| */
|
||||
if((ha-hb)>0x3c00000) {return a+b;} /* x/y > 2**60 */
|
||||
k=0;
|
||||
if(ha > 0x5f300000) { /* a>2**500 */
|
||||
if(ha >= 0x7ff00000) { /* Inf or NaN */
|
||||
unsigned int low;
|
||||
w = a+b; /* for sNaN */
|
||||
if(((ha&0xfffff)|*(1-n0+(int*)&a))==0) w = a;
|
||||
if(((hb^0x7ff00000)|*(1-n0+(int*)&b))==0) w = b;
|
||||
GET_LOW_WORD(low,a);
|
||||
if(((ha&0xfffff)|low)==0) w = a;
|
||||
GET_LOW_WORD(low,b);
|
||||
if(((hb^0x7ff00000)|low)==0) w = b;
|
||||
return w;
|
||||
}
|
||||
/* scale a and b by 2**-600 */
|
||||
ha -= 0x25800000; hb -= 0x25800000; k += 600;
|
||||
*(n0+(int*)&a) = ha;
|
||||
*(n0+(int*)&b) = hb;
|
||||
SET_HIGH_WORD(a,ha);
|
||||
SET_HIGH_WORD(b,hb);
|
||||
}
|
||||
if(hb < 0x20b00000) { /* b < 2**-500 */
|
||||
if(hb <= 0x000fffff) { /* subnormal b or 0 */
|
||||
if((hb|(*(1-n0+(int*)&b)))==0) return a;
|
||||
if(hb <= 0x000fffff) { /* subnormal b or 0 */
|
||||
unsigned int low;
|
||||
GET_LOW_WORD(low,b);
|
||||
if((hb|low)==0) return a;
|
||||
t1=0;
|
||||
*(n0+(int*)&t1) = 0x7fd00000; /* t1=2^1022 */
|
||||
SET_HIGH_WORD(t1,0x7fd00000); /* t1=2^1022 */
|
||||
b *= t1;
|
||||
a *= t1;
|
||||
k -= 1022;
|
||||
@ -124,30 +129,32 @@ __hypot(double x,double y)
|
||||
ha += 0x25800000; /* a *= 2^600 */
|
||||
hb += 0x25800000; /* b *= 2^600 */
|
||||
k -= 600;
|
||||
*(n0+(int*)&a) = ha;
|
||||
*(n0+(int*)&b) = hb;
|
||||
SET_HIGH_WORD(a,ha);
|
||||
SET_HIGH_WORD(b,hb);
|
||||
}
|
||||
}
|
||||
/* medium size a and b */
|
||||
w = a-b;
|
||||
if (w>b) {
|
||||
t1 = 0;
|
||||
*(n0+(int*)&t1) = ha;
|
||||
SET_HIGH_WORD(t1,ha);
|
||||
t2 = a-t1;
|
||||
w = sqrt(t1*t1-(b*(-b)-t2*(a+t1)));
|
||||
} else {
|
||||
a = a+a;
|
||||
y1 = 0;
|
||||
*(n0+(int*)&y1) = hb;
|
||||
SET_HIGH_WORD(y1,hb);
|
||||
y2 = b - y1;
|
||||
t1 = 0;
|
||||
*(n0+(int*)&t1) = ha+0x00100000;
|
||||
SET_HIGH_WORD(t1,ha+0x00100000);
|
||||
t2 = a - t1;
|
||||
w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b)));
|
||||
}
|
||||
if(k!=0) {
|
||||
unsigned int high;
|
||||
t1 = 1.0;
|
||||
*(n0+(int*)&t1) += (k<<20);
|
||||
GET_HIGH_WORD(high,t1);
|
||||
SET_HIGH_WORD(t1,high+(k<<20));
|
||||
return t1*w;
|
||||
} else return w;
|
||||
}
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -329,6 +329,8 @@ int __rem_pio2(double x, double *y)
|
||||
if(ix>=0x7ff00000) { /* x is inf or NaN */
|
||||
y[0]=y[1]=x-x; return 0;
|
||||
}
|
||||
/* keep the compiler happy */
|
||||
z = 0;
|
||||
/* set z = __scalbn(|x|,ilogb(x)-23) */
|
||||
GET_LOW_WORD(low,x);
|
||||
SET_LOW_WORD(z,low);
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -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
|
||||
ldexp(double x,int n)
|
||||
ldexp(double x, int exp)
|
||||
{
|
||||
double result;
|
||||
|
||||
if(x != 0.0)
|
||||
result = __ldexp(x,n);
|
||||
if(isinf(x) || fpclassify(x) == FP_ZERO)
|
||||
{
|
||||
result = x;
|
||||
}
|
||||
else
|
||||
result = 0.0;
|
||||
{
|
||||
result = scalbn(x,exp);
|
||||
|
||||
if(isinf(result) || (result < DBL_MIN || result > -DBL_MIN))
|
||||
__set_errno(ERANGE);
|
||||
}
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -157,7 +157,7 @@ sin_pi(double x)
|
||||
}
|
||||
|
||||
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;
|
||||
LONG i,hx,lx,ix;
|
||||
@ -165,11 +165,13 @@ lgamma(double x)
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
|
||||
/* purge off +-inf, NaN, +-0, and negative arguments */
|
||||
(*gamma_sign_ptr) = 1;
|
||||
ix = hx&0x7fffffff;
|
||||
if(ix>=0x7ff00000) return x*x;
|
||||
if((ix|lx)==0) return one/zero;
|
||||
if(ix<0x3b900000) { /* |x|<2**-70, return -log(|x|) */
|
||||
if(hx<0) {
|
||||
(*gamma_sign_ptr) = -1;
|
||||
return -log(-x);
|
||||
} else return -log(x);
|
||||
}
|
||||
@ -179,6 +181,8 @@ lgamma(double x)
|
||||
t = sin_pi(x);
|
||||
if(t==zero) return one/zero; /* -integer */
|
||||
nadj = log(pi/fabs(t*x));
|
||||
if(t<zero)
|
||||
(*gamma_sign_ptr) = -1;
|
||||
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 */
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -170,7 +170,7 @@ sin_pif(float x)
|
||||
|
||||
|
||||
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;
|
||||
LONG i,hx,ix;
|
||||
@ -178,11 +178,13 @@ lgammaf(float x)
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
|
||||
/* purge off +-inf, NaN, +-0, and negative arguments */
|
||||
(*gamma_sign_ptr) = 1;
|
||||
ix = hx&0x7fffffff;
|
||||
if(ix>=0x7f800000) return x*x;
|
||||
if(ix==0) return one/zero;
|
||||
if(ix<0x1c800000) { /* |x|<2**-70, return -log(|x|) */
|
||||
if(hx<0) {
|
||||
(*gamma_sign_ptr) = -1;
|
||||
return -logf(-x);
|
||||
} else return -logf(x);
|
||||
}
|
||||
@ -192,6 +194,8 @@ lgammaf(float x)
|
||||
t = sin_pif(x);
|
||||
if(t==zero) return one/zero; /* -integer */
|
||||
nadj = logf(pi/fabsf(t*x));
|
||||
if(t<zero)
|
||||
(*gamma_sign_ptr) = -1;
|
||||
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 */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: math_log.c,v 1.6 2005-02-25 10:14:21 obarthel Exp $
|
||||
* $Id: math_log.c,v 1.8 2005-10-27 08:58:41 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -150,7 +150,7 @@ Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */
|
||||
Lg7 = 1.479819860511658591e-01, /* 3FC2F112 DF3E5244 */
|
||||
zero = 0.0;
|
||||
|
||||
INLINE STATIC const double
|
||||
INLINE STATIC double
|
||||
__log(double x)
|
||||
{
|
||||
double hfsq,f,s,z,R,w,t1,t2,dk;
|
||||
@ -252,8 +252,7 @@ log(double x)
|
||||
{
|
||||
__set_errno(ERANGE);
|
||||
|
||||
/* This should really be minus infinity. */
|
||||
result = (-__get_huge_val());
|
||||
result = -__inf();
|
||||
}
|
||||
|
||||
return(result);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user