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

- Added more code and changes contributed by Peter Bengtsson, thank you

very much! This includes the following:

  - Added SSIZE_MAX to <limits.h>.

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

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

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

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

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

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

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

- Added <stdbool.h>.

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


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14912 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2005-04-03 10:22:48 +00:00
parent d5c36d66e4
commit 3096691d75
34 changed files with 1535 additions and 55 deletions

View File

@ -1,5 +1,5 @@
#
# $Id: GNUmakefile.68k,v 1.47 2005-03-30 19:37:13 obarthel Exp $
# $Id: GNUmakefile.68k,v 1.48 2005-04-03 10:22:47 obarthel Exp $
#
# :ts=8
#
@ -406,6 +406,8 @@ C_LIB = \
time_strftime.o \
time_time.o \
time_weekday.o \
uio_readv.o \
uio_writev.o \
unistd_access.o \
unistd_chdir.o \
unistd_chdir_exit.o \
@ -472,6 +474,8 @@ UNIX_LIB = \
stdlib_mkstemp.o \
stdlib_mktemp.o \
stdlib_system.o \
uio_readv.o \
uio_writev.o \
unistd_access.o \
unistd_chdir.o \
unistd_chdir_exit.o \
@ -494,6 +498,18 @@ UNIX_LIB = \
utime_utime.o
MATH_LIB = \
complex_carg.o \
complex_cargf.o \
complex_cargl.o \
complex_cimag.o \
complex_cimagf.o \
complex_cimagl.o \
complex_conj.o \
complex_conjf.o \
complex_conjl.o \
complex_creal.o \
complex_crealf.o \
complex_creall.o \
math_acos.o \
math_asin.o \
math_atan.o \

View File

@ -1,5 +1,5 @@
#
# $Id: GNUmakefile.os4,v 1.49 2005-03-30 19:37:24 obarthel Exp $
# $Id: GNUmakefile.os4,v 1.50 2005-04-03 10:22:47 obarthel Exp $
#
# :ts=8
#
@ -405,6 +405,8 @@ C_LIB = \
time_strftime.o \
time_time.o \
time_weekday.o \
uio_readv.o \
uio_writev.o \
unistd_access.o \
unistd_chdir.o \
unistd_chdir_exit.o \
@ -472,6 +474,8 @@ UNIX_LIB = \
stdlib_mkstemp.o \
stdlib_mktemp.o \
stdlib_system.o \
uio_readv.o \
uio_writev.o \
unistd_access.o \
unistd_chdir.o \
unistd_chdir_exit.o \
@ -495,6 +499,18 @@ UNIX_LIB = \
# All objects files which make up libm.a
MATH_LIB = \
complex_carg.o \
complex_cargf.o \
complex_cargl.o \
complex_cimag.o \
complex_cimagf.o \
complex_cimagl.o \
complex_conj.o \
complex_conjf.o \
complex_conjl.o \
complex_creal.o \
complex_crealf.o \
complex_creall.o \
math_acos.o \
math_asin.o \
math_atan.o \

View File

@ -32,6 +32,31 @@
- Invoking fstat() on what maps to a con-handler stream now produces
information identifying it as a character special file.
- Added more code and changes contributed by Peter Bengtsson, thank you
very much! This includes the following:
- Added SSIZE_MAX to <limits.h>.
- Added <sys/uio.h>, readv() and writev().
- Cut back the soft link resolution code in lstat().
- In <fcntl.h> O_NDELAY is now an alias for O_NONBLOCK.
- Added <complex.h>, carg(), cargf(), cargl(), cimag(), cimagf(),
cimagl(), conj(), conjf(), conjl(), creal(), crealf() and creall().
Note that the C99 support for the complex floating point data
types is limited to GCC 3.x for now.
- Added va_copy() to <stdarg.h>.
- Added _Exit() to <stdlib.h>.
- Added <stdbool.h>.
- Added vfscanf() to <stdio.h>.
c.lib 1.190 (25.3.2005)

52
library/complex_carg.c Normal file
View File

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

52
library/complex_cargf.c Normal file
View File

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

52
library/complex_cargl.c Normal file
View File

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

52
library/complex_cimag.c Normal file
View File

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

52
library/complex_cimagf.c Normal file
View File

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

52
library/complex_cimagl.c Normal file
View File

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

52
library/complex_conj.c Normal file
View File

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

52
library/complex_conjf.c Normal file
View File

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

52
library/complex_conjl.c Normal file
View File

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

52
library/complex_creal.c Normal file
View File

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

52
library/complex_crealf.c Normal file
View File

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

52
library/complex_creall.c Normal file
View File

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

68
library/complex_headers.h Executable file
View File

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

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

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

View File

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

View File

@ -1,5 +1,5 @@
/*
* $Id: limits.h,v 1.5 2005-01-09 09:40:33 obarthel Exp $
* $Id: limits.h,v 1.6 2005-04-03 10:22:48 obarthel Exp $
*
* :ts=4
*
@ -93,6 +93,10 @@
/****************************************************************************/
#define SSIZE_MAX 2147483647L
/****************************************************************************/
#define PATH_MAX 1024
/****************************************************************************/

View File

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

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

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

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio.h,v 1.9 2005-03-06 09:04:44 obarthel Exp $
* $Id: stdio.h,v 1.10 2005-04-03 10:22:48 obarthel Exp $
*
* :ts=4
*
@ -400,6 +400,15 @@ extern int __vasprintf(const char *file,int line,char **ret,const char *format,v
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard, but it should
be part of ISO/IEC 9899:1999, also known as "C99". */
/****************************************************************************/
extern int vfscanf(FILE *stream, const char *format, va_list arg);
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -1,5 +1,5 @@
/*
* $Id: stdlib.h,v 1.8 2005-03-02 12:57:56 obarthel Exp $
* $Id: stdlib.h,v 1.9 2005-04-03 10:22:48 obarthel Exp $
*
* :ts=4
*
@ -187,6 +187,15 @@ extern char * mkdtemp(char *name_template);
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard, but it should
be part of ISO/IEC 9899:1999, also known as "C99". */
/****************************************************************************/
extern void _Exit(int status);
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */

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

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

View File

@ -1,5 +1,5 @@
#
# $Id: smakefile,v 1.36 2005-03-30 19:37:26 obarthel Exp $
# $Id: smakefile,v 1.37 2005-04-03 10:22:47 obarthel Exp $
#
# :ts=8
#
@ -507,6 +507,8 @@ TIME_OBJ = \
UNISTD_OBJ = \
ftw_ftw.o \
ftw_nftw.o \
uio_readv.o \
uio_writev.o \
unistd_access.o \
unistd_chdir.o \
unistd_chdir_exit.o \

View File

@ -1,5 +1,5 @@
/*
* $Id: stat_lstat.c,v 1.8 2005-03-02 18:49:01 obarthel Exp $
* $Id: stat_lstat.c,v 1.9 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
@ -63,17 +63,18 @@
*/
static BPTR
lstat_lock(const char *name,const int mode,int *link_length)
lstat_lock(const char *name,const int mode,int * link_length)
{
D_S(struct bcpl_name,bname);
const size_t name_size = sizeof(bname->name);
char * new_name = NULL;
struct DevProc * dvp = NULL;
LONG link_count = 16;
BPTR lock = ZERO;
size_t name_len;
LONG error;
assert( name != NULL && link_length != NULL );
name_len = strlen(name);
if(name_len >= name_size)
{
@ -112,35 +113,15 @@ lstat_lock(const char *name,const int mode,int *link_length)
{
LONG result;
/* Should we give the soft link resolution another try? */
link_count--;
if(link_count == 0)
{
/* Nope, we already spent too much time trying to
resolve nested links. */
SetIoErr(ERROR_TOO_MANY_LEVELS);
goto out;
}
/* For soft link resolution we need a temporary buffer to
let the file system store the resolved path name in. */
new_name = malloc(name_size);
if(new_name == NULL)
{
new_name = malloc(name_size);
if(new_name == NULL)
{
SetIoErr(ERROR_NO_FREE_STORE);
goto out;
}
strcpy(new_name,name);
name = new_name;
SetIoErr(ERROR_NO_FREE_STORE);
goto out;
}
/* Remember that we found a link. */
if((*link_length) < (int)name_size)
(*link_length) = name_size;
/* Now ask the file system to resolve the entire path. */
result = ReadLink(dvp->dvp_Port,dvp->dvp_Lock,(STRPTR)name,(STRPTR)name,name_size);
if(result < 0)
@ -151,15 +132,13 @@ lstat_lock(const char *name,const int mode,int *link_length)
goto out;
}
assert( result > 0 );
/* Remember the length of the link name. */
if((*link_length) < result)
(*link_length) = result;
(*link_length) = result;
/* We now have a new name to resolve. */
name_len = strlen(name);
bname->name[0] = name_len;
memmove(&bname->name[1],name,name_len);
/* Finished for now. */
break;
}
else
{

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_fscanf.c,v 1.5 2005-03-24 15:31:16 obarthel Exp $
* $Id: stdio_fscanf.c,v 1.6 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
@ -72,7 +72,7 @@ fscanf(FILE *stream, const char *format, ...)
#endif /* CHECK_FOR_NULL_POINTERS */
va_start(arg,format);
result = __vfscanf(stream,format,arg);
result = vfscanf(stream,format,arg);
va_end(arg);
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_protos.h,v 1.17 2005-04-01 18:46:37 obarthel Exp $
* $Id: stdio_protos.h,v 1.18 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
@ -150,11 +150,6 @@ extern int __flush_iob_write_buffer(struct iob * file);
/****************************************************************************/
/* stdio_vfscanf.c */
extern int __vfscanf(FILE *stream, const char *format, va_list arg);
/****************************************************************************/
/* stdio_fgetc.c */
extern int __fgetc_check(FILE * stream);
extern int __fgetc(FILE *stream);

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_scanf.c,v 1.4 2005-02-28 10:07:31 obarthel Exp $
* $Id: stdio_scanf.c,v 1.5 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
@ -71,7 +71,7 @@ scanf(const char *format, ...)
#endif /* CHECK_FOR_NULL_POINTERS */
va_start(arg,format);
result = __vfscanf(stdin,format,arg);
result = vfscanf(stdin,format,arg);
va_end(arg);
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_sscanf.c,v 1.6 2005-02-28 10:07:31 obarthel Exp $
* $Id: stdio_sscanf.c,v 1.7 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
@ -85,7 +85,7 @@ sscanf(const char *s,const char *format, ...)
string_iob.iob_StringLength = strlen(s);
va_start(arg,format);
result = __vfscanf((FILE *)&string_iob,format,arg);
result = vfscanf((FILE *)&string_iob,format,arg);
va_end(arg);
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_vfscanf.c,v 1.11 2005-02-27 21:58:21 obarthel Exp $
* $Id: stdio_vfscanf.c,v 1.12 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
@ -62,7 +62,7 @@
/****************************************************************************/
int
__vfscanf(FILE *stream, const char *format, va_list arg)
vfscanf(FILE *stream, const char *format, va_list arg)
{
enum format_size_t
{

57
library/uio_headers.h Normal file
View File

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

156
library/uio_readv.c Normal file
View File

@ -0,0 +1,156 @@
/*
* $Id: uio_readv.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _STDLIB_NULL_POINTER_CHECK_H
#include "stdlib_null_pointer_check.h"
#endif /* _STDLIB_NULL_POINTER_CHECK_H */
/****************************************************************************/
#ifndef _UIO_HEADERS_H
#include "uio_headers.h"
#endif /* _UIO_HEADERS_H */
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
ssize_t
readv(int file_descriptor,const struct iovec *iov,int vec_count)
{
ssize_t result = -1;
struct file_action_message msg;
ssize_t total_num_bytes_read;
ssize_t part_num_bytes_read;
ssize_t num_bytes_read;
struct fd * fd;
int i;
ENTER();
SHOWVALUE(file_descriptor);
SHOWPOINTER(iov);
SHOWVALUE(vec_count);
#if defined(CHECK_FOR_NULL_POINTERS)
{
if(iov == NULL)
{
__set_errno(EFAULT);
goto out;
}
}
#endif /* CHECK_FOR_NULL_POINTERS */
if(vec_count < 1 || vec_count > MAX_IOVEC)
{
__set_errno(EINVAL);
goto out;
}
/* Check for overflow. An expensive test, but better to do it here than in the read loop. */
for(i = 0, total_num_bytes_read = 0 ; i < vec_count ; i++)
{
/* Paraoia... */
if(iov[i].iov_len < 0)
{
__set_errno(EINVAL);
goto out;
}
total_num_bytes_read += iov[i].iov_len;
if(total_num_bytes_read < 0) /* Rollover. */
{
__set_errno(EINVAL);
goto out;
}
}
fd = __get_file_descriptor(file_descriptor);
if(fd == NULL)
{
__set_errno(EBADF);
goto out;
}
total_num_bytes_read = 0;
part_num_bytes_read = 0;
i = 0;
while(i < vec_count) /* XXX: Should this loop be locked? */
{
if(__check_abort_enabled)
__check_abort();
if(iov[i].iov_len > 0)
{
msg.fam_Action = file_action_read;
msg.fam_Data = (char *)iov[i].iov_base + part_num_bytes_read;
msg.fam_Size = iov[i].iov_len - part_num_bytes_read;
num_bytes_read = (*fd->fd_Action)(fd,&msg);
if(num_bytes_read < 0)
{
__set_errno(msg.fam_Error);
goto out;
}
/* End of file reached? */
if(num_bytes_read == 0)
break;
total_num_bytes_read += num_bytes_read;
part_num_bytes_read += num_bytes_read;
if(part_num_bytes_read < iov[i].iov_len)
{
/* Avoid busy-waiting for more data here? */
continue;
}
}
part_num_bytes_read = 0;
i++;
}
result = total_num_bytes_read;
out:
RETURN(result);
return(result);
}

160
library/uio_writev.c Normal file
View File

@ -0,0 +1,160 @@
/*
* $Id: uio_writev.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _STDLIB_NULL_POINTER_CHECK_H
#include "stdlib_null_pointer_check.h"
#endif /* _STDLIB_NULL_POINTER_CHECK_H */
/****************************************************************************/
#ifndef _UIO_HEADERS_H
#include "uio_headers.h"
#endif /* _UIO_HEADERS_H */
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
ssize_t
writev(int file_descriptor,const struct iovec *iov,int vec_count)
{
ssize_t result = -1;
struct file_action_message msg;
ssize_t total_num_bytes_written;
char * buffer = NULL;
struct fd * fd;
int i;
ENTER();
SHOWVALUE(file_descriptor);
SHOWPOINTER(iov);
SHOWVALUE(vec_count);
#if defined(CHECK_FOR_NULL_POINTERS)
{
if(iov == NULL)
{
__set_errno(EFAULT);
goto out;
}
}
#endif /* CHECK_FOR_NULL_POINTERS */
if(vec_count < 1 || vec_count > MAX_IOVEC)
{
__set_errno(EINVAL);
goto out;
}
/* Check for overflow. An expensive test, but better to do it
here than in the write loop. */
for(i = 0, total_num_bytes_written = 0 ; i < vec_count ; i++)
{
if(iov[i].iov_len < 0)
{
/* Paraoia... */
__set_errno(EINVAL);
goto out;
}
total_num_bytes_written += iov[i].iov_len;
if(total_num_bytes_written < 0) /* Rollover. */
{
__set_errno(EINVAL);
goto out;
}
}
fd = __get_file_descriptor(file_descriptor);
if(fd == NULL)
{
__set_errno(EBADF);
goto out;
}
buffer = malloc(total_num_bytes_written);
if(buffer != NULL)
{
char * b = buffer;
for(i = 0 ; i < vec_count ; i++)
{
memcpy(b,iov[i].iov_base,iov[i].iov_len);
b += iov[i].iov_len;
}
msg.fam_Action = file_action_write;
msg.fam_Data = buffer;
msg.fam_Size = total_num_bytes_written;
if((*fd->fd_Action)(fd,&msg) < 0)
{
__set_errno(msg.fam_Error);
goto out;
}
}
else
{
for(i = 0 ; i < vec_count ; i++)
{
if(__check_abort_enabled)
__check_abort();
if(iov[i].iov_len > 0)
{
msg.fam_Action = file_action_write;
msg.fam_Data = (char *)iov[i].iov_base;
msg.fam_Size = iov[i].iov_len;
if((*fd->fd_Action)(fd,&msg) < 0)
{
__set_errno(msg.fam_Error);
goto out;
}
}
}
}
result = total_num_bytes_written;
out:
if(buffer != NULL)
free(buffer);
RETURN(result);
return(result);
}