Remove files no longer part of the gcc_3_2_anoncvs_20021009 libstdc++.

Approved by:	re(jhb)
This commit is contained in:
David E. O'Brien 2002-11-27 18:52:04 +00:00
parent 6fe0921bc4
commit 5f24279c5d
200 changed files with 1 additions and 43707 deletions

View File

@ -1,18 +0,0 @@
# ex:ts=8
$FreeBSD$
For the import of libstdc++, files were pruned by:
tar xvypf gcc-2.95.1.tar.bz2 '*/libobjc'
Then imported by:
cvs -d /home/ncvs import -m "Virgin import of GCC 2.95.2's libstdc++" \
src/contrib/libstdc++ FSF gcc_2_95_2
To make local changes to libstdc++, simply patch and commit to the main
branch (aka HEAD). Never make local changes on the vendor (FSF) branch.
All local changes should be submitted to "gcc-patches@gcc.gnu.org".
obrien@NUXI.com
31-October-1999

View File

@ -1,9 +0,0 @@
SUMMARY OF RECENT MAJOR CHANGES to LIBSTDC++.
(Also check ../libio/NEWS.)
*** Noteworthy changes in libstdc++ for EGCS
* EGCS includes the SGI STL implementation without changes.
* As a result of these and other changes, libstc++ for EGCS is not binary
compatible with previous releases of libstdc++.

View File

@ -1,7 +0,0 @@
// -*- C++ -*- forwarding header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __CASSERT__
#define __CASSERT__
#include <assert.h>
#endif

View File

@ -1,7 +0,0 @@
// The -*- C++ -*- character type header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __CCTYPE__
#define __CCTYPE__
#include <ctype.h>
#endif

View File

@ -1,7 +0,0 @@
// The -*- C++ -*- error number header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __CERRNO__
#define __CERRNO__
#include <errno.h>
#endif

View File

@ -1,7 +0,0 @@
// -*- C++ -*- forwarding header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __CFLOAT__
#define __CFLOAT__
#include <float.h>
#endif

View File

@ -1,154 +0,0 @@
// Instantiation file for the -*- C++ -*- complex number classes.
// Copyright (C) 1994 Free Software Foundation
#ifdef F
typedef float f;
#endif
#ifdef D
typedef double f;
#endif
#ifdef LD
typedef long double f;
#endif
#if defined (MAIN) && defined (__GNUG__)
#ifdef F
#pragma implementation "fcomplex"
#endif
#ifdef D
#pragma implementation "dcomplex"
#endif
#ifdef LD
#pragma implementation "ldcomplex"
#endif
#endif
#if 0
#define _G_NO_EXTERN_TEMPLATES
#endif
#include <std/complext.cc>
typedef complex<f> c;
typedef const c& ccr;
#ifdef MAIN
template c& __doapl (c*, ccr);
template c& __doaml (c*, ccr);
template c& __doami (c*, ccr);
template c& __doadv (c*, ccr);
#endif
#ifdef ADDCC
template c operator+ (ccr, ccr);
#endif
#ifdef ADDCF
template c operator+ (ccr, f);
#endif
#ifdef ADDFC
template c operator+ (f, ccr);
#endif
#ifdef SUBCC
template c operator- (ccr, ccr);
#endif
#ifdef SUBCF
template c operator- (ccr, f);
#endif
#ifdef SUBFC
template c operator- (f, ccr);
#endif
#ifdef MULCC
template c operator* (ccr, ccr);
#endif
#ifdef MULCF
template c operator* (ccr, f);
#endif
#ifdef MULFC
template c operator* (f, ccr);
#endif
#ifdef DIVCC
template c operator/ (ccr, ccr);
#endif
#ifdef DIVCF
template c operator/ (ccr, f);
#endif
#ifdef DIVFC
template c operator/ (f, ccr);
#endif
#ifdef PLUS
template c operator+ (ccr);
#endif
#ifdef MINUS
template c operator- (ccr);
#endif
#ifdef EQCC
template bool operator== (ccr, ccr);
#endif
#ifdef EQCF
template bool operator== (ccr, f);
#endif
#ifdef EQFC
template bool operator== (f, ccr);
#endif
#ifdef NECC
template bool operator!= (ccr, ccr);
#endif
#ifdef NECF
template bool operator!= (ccr, f);
#endif
#ifdef NEFC
template bool operator!= (f, ccr);
#endif
#ifdef ABS
template f abs (ccr);
#endif
#ifdef ARG
template f arg (ccr);
#endif
#ifdef POLAR
template c polar (f, f);
#endif
#ifdef CONJ
template c conj (ccr);
#endif
#ifdef NORM
template f norm (ccr);
#endif
#ifdef COS
template c cos (ccr);
#endif
#ifdef COSH
template c cosh (ccr);
#endif
#ifdef EXP
template c exp (ccr);
#endif
#ifdef LOG
template c log (ccr);
#endif
#ifdef POWCC
template c pow (ccr, ccr);
#endif
#ifdef POWCF
template c pow (ccr, f);
#endif
#ifdef POWCI
template c pow (ccr, int);
#endif
#ifdef POWFC
template c pow (f, ccr);
#endif
#ifdef SIN
template c sin (ccr);
#endif
#ifdef SINH
template c sinh (ccr);
#endif
#ifdef SQRT
template c sqrt (ccr);
#endif
#ifdef EXTRACT
template istream& operator>> (istream&, complex<f>&);
#endif
#ifdef INSERT
template ostream& operator<< (ostream&, const complex<f>&);
#endif

View File

@ -1,7 +0,0 @@
// -*- C++ -*- forwarding header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __CISO646__
#define __CISO646__
#include <iso646.h>
#endif

View File

@ -1,7 +0,0 @@
// -*- C++ -*- forwarding header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __CLIMITS__
#define __CLIMITS__
#include <limits.h>
#endif

View File

@ -1,7 +0,0 @@
// The -*- C++ -*- locale support header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __CLOCALE__
#define __CLOCALE__
#include <locale.h>
#endif

View File

@ -1,76 +0,0 @@
// The -*- C++ -*- math functions header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __CMATH__
#define __CMATH__
#include <_G_config.h>
#include <math.h>
#ifdef __GNUG__
#pragma interface "cmath"
#endif
extern "C++" {
#if 0
float acos (float);
float asin (float);
float atan (float);
float atan2(float, float);
float ceil (float);
float cos (float);
float cosh (float);
float exp (float);
float fabs (float);
float floor(float);
float fmod (float, float);
float frexp(float, int*);
float modf (float, float*);
float ldexp(float, int);
float log (float);
float log10(float);
float pow (float, float);
float pow (float, int);
float sin (float);
float sinh (float);
float sqrt (float);
float tan (float);
float tanh (float);
#endif
inline float abs (float x) { return fabs (x); }
#if ! _G_MATH_H_INLINES /* hpux and SCO define this in math.h */
inline double abs (double x) { return fabs (x); }
#endif
#if 0
double pow(double, int);
long double acos (long double);
long double asin (long double);
long double atan (long double);
long double atan2(long double, long double);
long double ceil (long double);
long double cos (long double);
long double cosh (long double);
long double exp (long double);
long double fabs (long double);
long double floor(long double);
long double frexp(long double, int*);
long double fmod (long double, long double);
long double frexp(long double, int*);
long double log (long double);
long double log10(long double);
long double modf (long double, long double*);
long double pow (long double, long double);
long double pow (long double, int);
long double sin (long double);
long double sinh (long double);
long double sqrt (long double);
long double tan (long double);
long double tanh (long double);
#endif
inline long double abs (long double x) { return fabs (x); }
} // extern "C++"
#endif

View File

@ -1,7 +0,0 @@
// Implementation file for the -*- C++ -*- math functions header.
// This file is part of the GNU ANSI C++ Library.
#ifdef __GNUG__
#pragma implementation "cmath"
#endif
#include <cmath>

View File

@ -1,18 +0,0 @@
// Main header for the -*- C++ -*- complex number classes.
// This file is part of the GNU ANSI C++ Library.
#ifndef __COMPLEX__
#define __COMPLEX__
#include <std/complext.h>
extern "C++" {
#define __STD_COMPLEX
// ANSI complex types
typedef complex<float> float_complex;
typedef complex<double> double_complex;
typedef complex<long double> long_double_complex;
}
#endif

View File

@ -1,6 +0,0 @@
// -*- C++ -*- backward compatiblity header.
// Copyright (C) 1994 Free Software Foundation
#ifndef __COMPLEX_H__
#include <complex>
#endif

View File

@ -1,9 +0,0 @@
# AIX has wierd shared/non-shared libraries.
ARLIB = libstdc++-ar.a.$(VERSION)
ARLINK = libstdc++-ar.a
SHLINK = libstdc++.a
LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
DEPLIBS = ../$(SHLIB)
SHDEPS = -lm
SHFLAGS = -Wl,-unix

View File

@ -1,88 +0,0 @@
// Low-level functions for atomic operations: Sparc32 version -*- C++ -*-
// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#ifndef _BITS_ATOMICITY_H
#define _BITS_ATOMICITY_H 1
typedef int _Atomic_word;
template <int __inst>
struct __Atomicity_lock
{
static unsigned char _S_atomicity_lock;
};
template <int __inst>
unsigned char __Atomicity_lock<__inst>::_S_atomicity_lock = 0;
template unsigned char __Atomicity_lock<0>::_S_atomicity_lock;
static int
__attribute__ ((__unused__))
__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
_Atomic_word __result, __tmp;
__asm__ __volatile__("1: ldstub [%1], %0\n\t"
" cmp %0, 0\n\t"
" bne 1b\n\t"
" nop"
: "=&r" (__tmp)
: "r" (&__Atomicity_lock<0>::_S_atomicity_lock)
: "memory");
__result = *__mem;
*__mem += __val;
__asm__ __volatile__("stb %%g0, [%0]"
: /* no outputs */
: "r" (&__Atomicity_lock<0>::_S_atomicity_lock)
: "memory");
return __result;
}
static void
__attribute__ ((__unused__))
__atomic_add (volatile _Atomic_word* __mem, int __val)
{
_Atomic_word __tmp;
__asm__ __volatile__("1: ldstub [%1], %0\n\t"
" cmp %0, 0\n\t"
" bne 1b\n\t"
" nop"
: "=&r" (__tmp)
: "r" (&__Atomicity_lock<0>::_S_atomicity_lock)
: "memory");
*__mem += __val;
__asm__ __volatile__("stb %%g0, [%0]"
: /* no outputs */
: "r" (&__Atomicity_lock<0>::_S_atomicity_lock)
: "memory");
}
#endif /* atomicity.h */

View File

@ -1,70 +0,0 @@
// Low-level functions for atomic operations: Sparc64 version -*- C++ -*-
// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#ifndef _BITS_ATOMICITY_H
#define _BITS_ATOMICITY_H 1
typedef long _Atomic_word;
static inline _Atomic_word
__attribute__ ((__unused__))
__exchange_and_add (volatile _Atomic_word *__mem, int __val)
{
_Atomic_word __tmp1, __tmp2;
__asm__ __volatile__("1: ldx [%2], %0\n\t"
" add %0, %3, %1\n\t"
" casx [%2], %0, %1\n\t"
" sub %0, %1, %0\n\t"
" brnz,pn %0, 1b\n\t"
" nop"
: "=&r" (__tmp1), "=&r" (__tmp2)
: "r" (__mem), "r" (__val)
: "memory");
return __tmp2;
}
static inline void
__attribute__ ((__unused__))
__atomic_add (volatile _Atomic_word* __mem, int __val)
{
_Atomic_word __tmp1, __tmp2;
__asm__ __volatile__("1: ldx [%2], %0\n\t"
" add %0, %3, %1\n\t"
" casx [%2], %0, %1\n\t"
" sub %0, %1, %0\n\t"
" brnz,pn %0, 1b\n\t"
" nop"
: "=&r" (__tmp1), "=&r" (__tmp2)
: "r" (__mem), "r" (__val)
: "memory");
}
#endif /* atomicity.h */

View File

@ -1,6 +0,0 @@
# We don't need -fpic on the alpha, so let's install both the shared and
# non-shared versions.
LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
DEPLIBS = ../$(SHLIB)
SHDEPS = -lm

View File

@ -1,2 +0,0 @@
# If FPU instructions are generated by default, we have to use a special libm.a
MLDLIBS = $(LDLIBS) `case "$(CXXFLAGS)" in *-m68000* | *-mc68000* | *-msoft-float* ) echo -lm ;; * ) echo -lm881 ;; esac`

View File

@ -1,8 +0,0 @@
# Elf without shared libm -- we have to link with the archive library, even
# for programs that don't use complex.
LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
SHFLAGS = -h $(SHLIB)
DEPLIBS = ../$(SHLIB)
LDLIBS = -L.. -lstdc++ -lm
MLDLIBS = -L.. -lstdc++ -lm

View File

@ -1,6 +0,0 @@
# Elf with shared libm, so we can link it into the shared libstdc++.
LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
SHFLAGS = -h $(SHLIB)
SHDEPS = -lm
DEPLIBS = ../$(SHLIB)

View File

@ -1,6 +0,0 @@
# Elf with shared libm, so we can link it into the shared libstdc++.
LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK) mshlink
SHFLAGS = -Wl,-soname,$(MSHLINK)
SHDEPS = -lm
DEPLIBS = ../$(SHLIB)

View File

@ -1,6 +0,0 @@
# Elf with shared libm, so we can link it into the shared libstdc++.
LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
SHFLAGS = -Wl,-soname,$(SHLIB)
SHDEPS = -lm
DEPLIBS = ../$(SHLIB)

View File

@ -1,6 +0,0 @@
# HPUX uses the .sl suffix for shared libraries.
SHLIB = libstdc++.sl
LIBS = $(ARLIB) $(ARLINK) $(SHLIB)
DEPLIBS = ../$(SHLIB)
SHFLAGS = $(PICFLAG)

View File

@ -1,6 +0,0 @@
# We don't need -fpic on IRIX, so let's install both the shared and
# non-shared versions.
LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
DEPLIBS = ../$(SHLIB)
SHDEPS = -lm

View File

@ -1,11 +0,0 @@
# Elf with shared libm, so we can link it into the shared libstdc++.
ARLIB = libstdc++-$(LIBSTDCXX_INTERFACE)$(LIBC_INTERFACE)$(CXX_INTERFACE)-$(VERSION).a
MARLINK = libstdc++$(LIBC_INTERFACE)$(CXX_INTERFACE).a.$(LIBSTDCXX_INTERFACE)
SHLIB = libstdc++-$(LIBSTDCXX_INTERFACE)$(LIBC_INTERFACE)$(CXX_INTERFACE)-$(VERSION).so
MSHLINK = libstdc++$(LIBC_INTERFACE)$(CXX_INTERFACE).so.$(LIBSTDCXX_INTERFACE)
LIBS = $(ARLIB) marlink $(ARLINK) $(SHLIB) mshlink $(SHLINK)
SHFLAGS = -Wl,-soname,$(MSHLINK)
SHDEPS = -lm
DEPLIBS = ../$(SHLIB)

View File

@ -1,2 +0,0 @@
# tell we want the mt-safe version
MT_CFLAGS = -D_IO_MTSAFE_IO

View File

@ -1,7 +0,0 @@
# Base shared lib for OpenBSD i386
LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK) mshlink
SHFLAGS = -nostdlib -Wl,-Bshareable,-Bforcearchive
SHDEPS = -lm
DEPLIBS = ../$(SHLIB)

View File

@ -1,3 +0,0 @@
# tell we want the mt-safe version
MT_CFLAGS = -D_IO_MTSAFE_IO -D_PTHREADS

View File

@ -1 +0,0 @@
MT_CFLAGS = -D_PTHREADS

View File

@ -1 +0,0 @@
MT_CFLAGS = -D_PTHREADS

View File

@ -1,6 +0,0 @@
# Solaris2 with shared libm, so we can link it into the shared libstdc++.
LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
SHFLAGS = -h $(SHLIB)
SHDEPS = -lm
DEPLIBS = ../$(SHLIB)

View File

@ -1 +0,0 @@
MT_CFLAGS = -D_SOLTHREADS

View File

@ -1,9 +0,0 @@
# SunOS doesn't provide a shared libm, so we have to link with the archive
# library, even for programs that don't use complex.
# SunOS requires a version number in shared library filenames.
LIBS = $(ARLIB) $(ARLINK) $(SHLIB)
SHFLAGS = $(PICFLAG)
DEPLIBS = ../$(SHLIB)
LDLIBS = -L.. -lstdc++ -lm
MLDLIBS = -L.. -lstdc++ -lm

View File

@ -1,9 +0,0 @@
# x86 Interix. SHLINK is defined to be .dummy to avoid running into
# the lack of symbolic links.
SHLINK = .dummy
SHLIB = libstdc++.so
LIBS = $(ARLIB) $(SHLIB)
DEPLIBS = ../$(SHLIB)
SHFLAGS = $(PICFLAG)

View File

@ -1,8 +0,0 @@
// The -*- C++ -*- setjmp/longjmp header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __CSETJMP__
#define __CSETJMP__
#include <setjmp.h>
#endif

View File

@ -1,7 +0,0 @@
// The -*- C++ -*- signal handling header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __CSIGNAL__
#define __CSIGNAL__
#include <signal.h>
#endif

View File

@ -1,7 +0,0 @@
// -*- C++ -*- forwarding header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __CSTDARG__
#define __CSTDARG__
#include <stdarg.h>
#endif

View File

@ -1,7 +0,0 @@
// -*- C++ -*- forwarding header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __CSTDDEF__
#define __CSTDDEF__
#include <stddef.h>
#endif

View File

@ -1,7 +0,0 @@
// The -*- C++ -*- standard I/O header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __CSTDIO__
#define __CSTDIO__
#include <stdio.h>
#endif

View File

@ -1,23 +0,0 @@
// The -*- C++ -*- standard library header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __CSTDLIB__
#define __CSTDLIB__
#include <stdlib.h>
#ifdef __GNUG__
#pragma interface "cstdlib"
#endif
extern "C++" {
#if _G_HAS_LABS
inline long abs(long x) { return labs (x); }
#else
inline long abs(long x) { return x >= 0 ? x : -x; }
#endif
//inline ldiv_t div(long x, long y) { return ldiv (x, y); }
} // extern "C++"
#endif

View File

@ -1,7 +0,0 @@
// Implementation file for the -*- C++ -*- standard library header.
// This file is part of the GNU ANSI C++ Library.
#ifdef __GNUG__
#pragma implementation "cstdlib"
#endif
#include <cstdlib>

View File

@ -1,96 +0,0 @@
// The -*- C++ -*- null-terminated string header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __CSTRING__
#define __CSTRING__
#include <string.h>
#if 0 // Let's not bother with this just yet.
#include <cstddef>
#ifdef __GNUG__
#pragma interface "cstring"
#endif
// The ANSI C prototypes for these functions have a const argument type and
// non-const return type, so we can't use them.
extern "C++" {
extern inline const char *
_G_strchr (const char *s, int c)
{
return strchr (s, c);
}
extern inline char *
_G_strchr (char *s, int c)
{
return const_cast<char *> (strchr (s, c));
}
extern inline const char *
_G_strpbrk (const char *s1, const char *s2)
{
return strpbrk (s1, s2);
}
extern inline char *
_G_strpbrk (char *s1, const char *s2)
{
return const_cast<char *> (strpbrk (s1, s2));
}
extern inline const char *
_G_strrchr (const char *s, int c)
{
return strrchr (s, c);
}
extern inline char *
_G_strrchr (char *s, int c)
{
return const_cast<char *> (strrchr (s, c));
}
extern inline const char *
_G_strstr (const char *s1, const char *s2)
{
return strstr (s1, s2);
}
extern inline char *
_G_strstr (char *s1, const char *s2)
{
return const_cast<char *> (strstr (s1, s2));
}
extern inline const void *
_G_memchr (const void *s, int c, size_t n)
{
return memchr (s, c, n);
}
extern inline void *
_G_memchr (void *s, int c, size_t n)
{
return const_cast<void *> (memchr (s, c, n));
}
} // extern "C++"
// Lose any vendor macros for these functions.
#undef strchr
#undef strpbrk
#undef strrchr
#undef strstr
#undef memchr
// Ewww, namespace pollution. Anyone have a better idea?
#define strchr _G_strchr
#define strpbrk _G_strpbrk
#define strrchr _G_strrchr
#define strstr _G_strstr
#define memchr _G_memchr
#endif // 0
#endif // !defined (__CSTRING__)

View File

@ -1,7 +0,0 @@
// Implementation file for the -*- C++ -*- null-terminated string header.
// This file is part of the GNU ANSI C++ Library.
#ifdef __GNUG__
#pragma implementation "cstring"
#endif
#include <cstring>

View File

@ -1,7 +0,0 @@
// The -*- C++ -*- time header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __CTIME__
#define __CTIME__
#include <time.h>
#endif

View File

@ -1,7 +0,0 @@
// The -*- C++ -*- wide character header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __CWCHAR__
#define __CWCHAR__
#include <wchar.h>
#endif

View File

@ -1,7 +0,0 @@
// The -*- C++ -*- wide character type header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __CWCTYPE__
#define __CWCTYPE__
#include <wctype.h>
#endif

View File

@ -1,7 +0,0 @@
// -*- C++ -*- forwarding header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __FSTREAM__
#define __FSTREAM__
#include <fstream.h>
#endif

View File

@ -1,7 +0,0 @@
// -*- C++ -*- forwarding header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __IOMANIP__
#define __IOMANIP__
#include <iomanip.h>
#endif

View File

@ -1,15 +0,0 @@
// -*- C++ -*- I/O forward declaration header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __IOSFWD__
#define __IOSFWD__
class ios;
class streambuf;
class istream;
class ostream;
class iostream;
class filebuf;
class ifstream;
class ofstream;
class fstream;
#endif

View File

@ -1,7 +0,0 @@
// -*- C++ -*- forwarding header.
// This file is part of the GNU ANSI C++ Library.
#ifndef __IOSTREAM__
#define __IOSTREAM__
#include <iostream.h>
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,67 +0,0 @@
## Makefile for the libio subdirectory of the GNU C++ Standard library.
##
## Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
##
## This file is part of the libstdc++ version 3 distribution.
## Process this file with automake to produce Makefile.in.
## This file is part of the GNU ISO C++ Library. This library is free
## software; you can redistribute it and/or modify it under the
## terms of the GNU General Public License as published by the
## Free Software Foundation; either version 2, or (at your option)
## any later version.
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
## You should have received a copy of the GNU General Public License along
## with this library; see the file COPYING. If not, write to the Free
## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
## USA.
AUTOMAKE_OPTIONS = 1.3 cygnus
mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
if GLIBCPP_BUILD_LIBIO
noinst_LTLIBRARIES = libio.la
else
noinst_LTLIBRARIES =
endif
# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
LIBIO_INCLUDES = @LIBIO_INCLUDES@
INCLUDES = \
-nostdinc++ \
$(GLIBCPP_INCLUDES) $(LIBIO_INCLUDES) $(TOPLEVEL_INCLUDES)
libio_headers = \
libio.h libioP.h iolibio.h
if GLIBCPP_NEED_LIBIO
LIBIO_SRCS = \
filedoalloc.c genops.c fileops.c stdfiles.c c_codecvt.c \
iofclose.c iofopen.c
else
LIBIO_SRCS =
endif
if GLIBCPP_NEED_WLIBIO
LIBIO_WSRCS = \
wfiledoalloc.c wfileops.c wgenops.c iofwide.c
else
LIBIO_WSRCS =
endif
EXTRA_DIST = iostreamP.h
libio_la_SOURCES = $(LIBIO_SRCS) $(LIBIO_WSRCS)
AM_CFLAGS = -D_GNU_SOURCE @DEBUG_FLAGS@

View File

@ -1,426 +0,0 @@
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_alias = @build_alias@
build_triplet = @build@
host_alias = @host_alias@
host_triplet = @host@
target_alias = @target_alias@
target_triplet = @target@
AR = @AR@
AS = @AS@
ATOMICITY_INC_SRCDIR = @ATOMICITY_INC_SRCDIR@
AWK = @AWK@
BASIC_FILE_H = @BASIC_FILE_H@
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CCODECVT_C = @CCODECVT_C@
CCODECVT_H = @CCODECVT_H@
CLOCALE_H = @CLOCALE_H@
CMESSAGES_H = @CMESSAGES_H@
CPP = @CPP@
CPU_LIMITS_INC_SRCDIR = @CPU_LIMITS_INC_SRCDIR@
CSHADOW_FLAGS = @CSHADOW_FLAGS@
CSTDIO_H = @CSTDIO_H@
CXX = @CXX@
CXXCPP = @CXXCPP@
C_INCLUDE_DIR = @C_INCLUDE_DIR@
DATADIRNAME = @DATADIRNAME@
DEBUG_FLAGS = @DEBUG_FLAGS@
DLLTOOL = @DLLTOOL@
EXEEXT = @EXEEXT@
EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
GCJ = @GCJ@
GCJFLAGS = @GCJFLAGS@
GENCAT = @GENCAT@
GLIBC21 = @GLIBC21@
GLIBCPP_IS_CROSS_COMPILING = @GLIBCPP_IS_CROSS_COMPILING@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
INSTOBJEXT = @INSTOBJEXT@
INTLBISON = @INTLBISON@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
LIBICONV = @LIBICONV@
LIBMATHOBJS = @LIBMATHOBJS@
LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
LIBSUPCXX_PICFLAGS = @LIBSUPCXX_PICFLAGS@
LIBTOOL = @LIBTOOL@
LIBUNWIND_FLAG = @LIBUNWIND_FLAG@
LN_S = @LN_S@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
OPT_LDFLAGS = @OPT_LDFLAGS@
OS_INC_SRCDIR = @OS_INC_SRCDIR@
PACKAGE = @PACKAGE@
POFILES = @POFILES@
POSUB = @POSUB@
RANLIB = @RANLIB@
SECTION_FLAGS = @SECTION_FLAGS@
SECTION_LDFLAGS = @SECTION_LDFLAGS@
STRIP = @STRIP@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_FLAGS = @WARN_FLAGS@
WERROR = @WERROR@
check_msgfmt = @check_msgfmt@
enable_shared = @enable_shared@
enable_static = @enable_static@
glibcpp_CXX = @glibcpp_CXX@
glibcpp_MOFILES = @glibcpp_MOFILES@
glibcpp_POFILES = @glibcpp_POFILES@
glibcpp_basedir = @glibcpp_basedir@
glibcpp_builddir = @glibcpp_builddir@
glibcpp_localedir = @glibcpp_localedir@
glibcpp_prefixdir = @glibcpp_prefixdir@
glibcpp_srcdir = @glibcpp_srcdir@
glibcpp_thread_h = @glibcpp_thread_h@
glibcpp_toolexecdir = @glibcpp_toolexecdir@
glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
gxx_include_dir = @gxx_include_dir@
ifGNUmake = @ifGNUmake@
libio_la = @libio_la@
libtool_VERSION = @libtool_VERSION@
release_VERSION = @release_VERSION@
toplevel_srcdir = @toplevel_srcdir@
AUTOMAKE_OPTIONS = 1.3 cygnus
mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
@GLIBCPP_BUILD_LIBIO_TRUE@noinst_LTLIBRARIES = @GLIBCPP_BUILD_LIBIO_TRUE@libio.la
@GLIBCPP_BUILD_LIBIO_FALSE@noinst_LTLIBRARIES =
# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
LIBIO_INCLUDES = @LIBIO_INCLUDES@
INCLUDES = \
-nostdinc++ \
$(GLIBCPP_INCLUDES) $(LIBIO_INCLUDES) $(TOPLEVEL_INCLUDES)
libio_headers = \
libio.h libioP.h iolibio.h
@GLIBCPP_NEED_LIBIO_TRUE@LIBIO_SRCS = @GLIBCPP_NEED_LIBIO_TRUE@\
@GLIBCPP_NEED_LIBIO_TRUE@ filedoalloc.c genops.c fileops.c stdfiles.c c_codecvt.c \
@GLIBCPP_NEED_LIBIO_TRUE@ iofclose.c iofopen.c
@GLIBCPP_NEED_LIBIO_FALSE@LIBIO_SRCS =
@GLIBCPP_NEED_WLIBIO_TRUE@LIBIO_WSRCS = @GLIBCPP_NEED_WLIBIO_TRUE@\
@GLIBCPP_NEED_WLIBIO_TRUE@ wfiledoalloc.c wfileops.c wgenops.c iofwide.c
@GLIBCPP_NEED_WLIBIO_FALSE@LIBIO_WSRCS =
EXTRA_DIST = iostreamP.h
libio_la_SOURCES = $(LIBIO_SRCS) $(LIBIO_WSRCS)
AM_CFLAGS = -D_GNU_SOURCE @DEBUG_FLAGS@
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
DEFS = @DEFS@ -I. -I$(srcdir) -I..
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
libio_la_LDFLAGS =
libio_la_LIBADD =
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@libio_la_OBJECTS = \
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@filedoalloc.lo \
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@genops.lo fileops.lo \
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@stdfiles.lo \
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@c_codecvt.lo \
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@iofclose.lo \
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@iofopen.lo \
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@wfiledoalloc.lo \
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@wfileops.lo \
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@wgenops.lo \
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@iofwide.lo
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@libio_la_OBJECTS = \
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@wfiledoalloc.lo \
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@wfileops.lo \
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@wgenops.lo \
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@iofwide.lo
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@libio_la_OBJECTS = \
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@filedoalloc.lo \
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@genops.lo \
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@fileops.lo \
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@stdfiles.lo \
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@c_codecvt.lo \
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@iofclose.lo \
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@iofopen.lo
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_FALSE@libio_la_OBJECTS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = ChangeLog Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
SOURCES = $(libio_la_SOURCES)
OBJECTS = $(libio_la_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .lo .o .obj .s
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --cygnus libio/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-noinstLTLIBRARIES:
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
distclean-noinstLTLIBRARIES:
maintainer-clean-noinstLTLIBRARIES:
.c.o:
$(COMPILE) -c $<
# FIXME: We should only use cygpath when building on Windows,
# and only if it is available.
.c.obj:
$(COMPILE) -c `cygpath -w $<`
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
-rm -f *.$(OBJEXT)
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
.c.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.s.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.S.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
maintainer-clean-libtool:
libio.la: $(libio_la_OBJECTS) $(libio_la_DEPENDENCIES)
$(LINK) $(libio_la_LDFLAGS) $(libio_la_OBJECTS) $(libio_la_LIBADD) $(LIBS)
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = libio
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
if test -f $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am:
check: check-am
installcheck-am:
installcheck: installcheck-am
install-info-am:
install-info: install-info-am
install-exec-am:
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am:
uninstall: uninstall-am
all-am: Makefile $(LTLIBRARIES)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-noinstLTLIBRARIES mostlyclean-compile \
mostlyclean-libtool mostlyclean-tags \
mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-noinstLTLIBRARIES clean-compile clean-libtool \
clean-tags clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-noinstLTLIBRARIES distclean-compile \
distclean-libtool distclean-tags distclean-generic \
clean-am
-rm -f libtool
distclean: distclean-am
maintainer-clean-am: maintainer-clean-noinstLTLIBRARIES \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-tags maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-noinstLTLIBRARIES distclean-noinstLTLIBRARIES \
clean-noinstLTLIBRARIES maintainer-clean-noinstLTLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-info-am \
install-info install-exec-am install-exec install-data-am install-data \
install-am install uninstall-am uninstall all-redirect all-am all \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,136 +0,0 @@
/* This file is needed by libio to define various configuration parameters.
These are always the same in the GNU C library. */
#ifndef _G_config_h
#define _G_config_h 1
#ifndef _LIBC
# include <bits/c++config.h>
# ifdef _GLIBCPP_USE_THREADS
# define _IO_MTSAFE_IO
# endif
#endif
/* Define types for libio in terms of the standard internal type names. */
#include <sys/types.h>
#define __need_size_t
#define __need_wchar_t
#define __need_wint_t
#define __need_NULL
#define __need_ptrdiff_t
#ifdef __cplusplus
# include <cstddef>
#else
# include <stddef.h>
#endif
#ifndef _WINT_T
/* Integral type unchanged by default argument promotions that can
hold any value corresponding to members of the extended character
set, as well as at least one value that does not correspond to any
member of the extended character set. */
# define _WINT_T
typedef unsigned int wint_t;
#endif
/* For use as part of glibc (native) or as part of libstdc++ (maybe
not glibc) */
#ifndef __c_mbstate_t_defined
# define __c_mbstate_t_defined 1
/*# ifdef _GLIBCPP_USE_WCHAR_T*/
typedef struct
{
int count;
wint_t value;
}__c_mbstate_t;
/*# endif*/
#endif
#undef __need_mbstate_t
typedef size_t _G_size_t;
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
typedef struct
{
__off_t __pos;
__c_mbstate_t __state;
} _G_fpos_t;
typedef struct
{
__off64_t __pos;
__c_mbstate_t __state;
} _G_fpos64_t;
#else
typedef __off_t _G_fpos_t;
typedef __off64_t _G_fpos64_t;
#endif
#define _G_ssize_t __ssize_t
#define _G_off_t __off_t
#define _G_off64_t __off64_t
#define _G_pid_t __pid_t
#define _G_uid_t __uid_t
#define _G_wchar_t wchar_t
#define _G_wint_t wint_t
#define _G_stat64 stat64
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
# include <iconv.h>
typedef iconv_t _G_iconv_t;
#endif
typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
#define _G_HAVE_BOOL 1
/* These library features are always available in the GNU C library. */
#define _G_HAVE_ATEXIT 1
#define _G_HAVE_SYS_CDEFS 1
#define _G_HAVE_SYS_WAIT 1
#define _G_NEED_STDARG_H 1
#define _G_va_list __gnuc_va_list
#define _G_HAVE_PRINTF_FP 1
#define _G_HAVE_MMAP 1
#define _G_HAVE_LONG_DOUBLE_IO 1
#define _G_HAVE_IO_FILE_OPEN 1
#define _G_HAVE_IO_GETLINE_INFO 1
#define _G_IO_IO_FILE_VERSION 0x20001
//#define _G_OPEN64 __open64
//#define _G_LSEEK64 __lseek64
//#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf)
/* This is defined by <bits/stat.h> if `st_blksize' exists. */
/*#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)*/
#define _G_BUFSIZ 8192
/* These are the vtbl details for ELF. */
#define _G_NAMES_HAVE_UNDERSCORE 0
#define _G_VTABLE_LABEL_HAS_LENGTH 1
#ifndef _G_USING_THUNKS
# define _G_USING_THUNKS 1
#endif /* _G_USING_THUNKS */
#define _G_VTABLE_LABEL_PREFIX "__vt_"
#define _G_VTABLE_LABEL_PREFIX_ID __vt_
#define _G_INTERNAL_CCS "UCS4"
#define _G_HAVE_WEAK_SYMBOL 1
#define _G_STDIO_USES_LIBIO 1
#if defined __cplusplus || defined __STDC__
# define _G_ARGS(ARGLIST) ARGLIST
#else
# define _G_ARGS(ARGLIST) ()
#endif
#endif /* _G_config.h */

View File

@ -1,101 +0,0 @@
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* Modified for GNU iostream by Per Bothner 1991, 1992. */
#ifndef _POSIX_SOURCE
# define _POSIX_SOURCE
#endif
#include "libioP.h"
#include <sys/types.h>
#include <sys/stat.h>
#ifdef __STDC__
#include <stdlib.h>
#include <unistd.h>
#endif
#ifdef _LIBC
# undef isatty
# define isatty(Fd) __isatty (Fd)
#endif
/*
* Allocate a file buffer, or switch to unbuffered I/O.
* Per the ANSI C standard, ALL tty devices default to line buffered.
*
* As a side effect, we set __SOPT or __SNPT (en/dis-able fseek
* optimisation) right after the _fstat() that finds the buffer size.
*/
int
_IO_file_doallocate (fp)
_IO_FILE *fp;
{
_IO_size_t size;
int couldbetty;
char *p;
struct _G_stat64 st;
if (fp->_fileno < 0 || _IO_SYSSTAT (fp, &st) < 0)
{
couldbetty = 0;
size = _IO_BUFSIZ;
#if 0
/* do not try to optimise fseek() */
fp->_flags |= __SNPT;
#endif
}
else
{
couldbetty = S_ISCHR (st.st_mode);
#if _IO_HAVE_ST_BLKSIZE
size = st.st_blksize <= 0 ? _IO_BUFSIZ : st.st_blksize;
#else
size = _IO_BUFSIZ;
#endif
}
ALLOC_BUF (p, size, EOF);
_IO_setb (fp, p, p + size, 1);
if (couldbetty && isatty (fp->_fileno))
fp->_flags |= _IO_LINE_BUF;
return 1;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,97 +0,0 @@
/* Copyright (C) 1993, 1995, 1997-1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#ifdef __STDC__
#include <stdlib.h>
#endif
#if _LIBC
# include "../iconv/gconv_int.h"
# include <shlib-compat.h>
#else
# define SHLIB_COMPAT(a, b, c) 0
# define _IO_new_fclose fclose
#endif
int
_IO_new_fclose (fp)
_IO_FILE *fp;
{
int status;
CHECK_FILE(fp, EOF);
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
/* We desperately try to help programs which are using streams in a
strange way and mix old and new functions. Detect old streams
here. */
if (fp->_vtable_offset != 0)
return _IO_old_fclose (fp);
#endif
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
if (fp->_IO_file_flags & _IO_IS_FILEBUF)
status = _IO_file_close_it (fp);
else
status = fp->_flags & _IO_ERR_SEEN ? -1 : 0;
_IO_FINISH (fp);
_IO_funlockfile (fp);
if (fp->_mode > 0)
{
#if _LIBC
/* This stream has a wide orientation. This means we have to free
the conversion functions. */
struct _IO_codecvt *cc = fp->_codecvt;
if (cc->__cd_in.__cd.__steps->__shlib_handle != NULL)
{
--cc->__cd_in.__cd.__steps->__counter;
__gconv_close_transform (cc->__cd_in.__cd.__steps, 1);
}
if (cc->__cd_out.__cd.__steps->__shlib_handle != NULL)
{
--cc->__cd_out.__cd.__steps->__counter;
__gconv_close_transform (cc->__cd_out.__cd.__steps, 1);
}
#endif
}
_IO_cleanup_region_end (0);
if (_IO_have_backup (fp))
_IO_free_backup_area (fp);
if (fp != _IO_stdin && fp != _IO_stdout && fp != _IO_stderr)
{
fp->_IO_file_flags = 0;
free(fp);
}
return status;
}
#ifdef _LIBC
versioned_symbol (libc, _IO_new_fclose, _IO_fclose, GLIBC_2_1);
strong_alias (_IO_new_fclose, __new_fclose)
versioned_symbol (libc, __new_fclose, fclose, GLIBC_2_1);
#endif

View File

@ -1,78 +0,0 @@
/* Copyright (C) 1993, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#ifdef __STDC__
#include <stdlib.h>
#endif
#ifdef _LIBC
# include <shlib-compat.h>
#else
# define _IO_new_fopen fopen
#endif
_IO_FILE *
_IO_new_fopen (filename, mode)
const char *filename;
const char *mode;
{
struct locked_FILE
{
struct _IO_FILE_plus fp;
#ifdef _IO_MTSAFE_IO
_IO_lock_t lock;
#endif
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
struct _IO_wide_data wd;
#endif /* !(defined _LIBC || defined _GLIBCPP_USE_WCHAR_T) */
} *new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
if (new_f == NULL)
return NULL;
#ifdef _IO_MTSAFE_IO
new_f->fp.file._lock = &new_f->lock;
#endif
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
_IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, &_IO_wfile_jumps);
#else
_IO_no_init (&new_f->fp.file, 1, 0, NULL, NULL);
#endif
_IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
_IO_file_init (&new_f->fp);
#if !_IO_UNIFIED_JUMPTABLES
new_f->fp.vtable = NULL;
#endif
if (_IO_file_fopen ((_IO_FILE *) new_f, filename, mode, 1) != NULL)
return (_IO_FILE *) &new_f->fp;
_IO_un_link (&new_f->fp);
free (new_f);
return NULL;
}
#ifdef _LIBC
strong_alias (_IO_new_fopen, __new_fopen)
versioned_symbol (libc, _IO_new_fopen, _IO_fopen, GLIBC_2_1);
versioned_symbol (libc, __new_fopen, fopen, GLIBC_2_1);
#endif

View File

@ -1,476 +0,0 @@
/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include <libioP.h>
#ifdef _LIBC
# include <dlfcn.h>
# include <wchar.h>
# include <locale/localeinfo.h>
# include <wcsmbs/wcsmbsload.h>
# include <iconv/gconv_int.h>
#endif
#include <stdlib.h>
#include <string.h>
#if defined(_LIBC) || defined(_GLIBCPP_USE_WCHAR_T)
# include <langinfo.h>
#endif
#ifdef _GLIBCPP_USE_WCHAR_T
/* Prototypes of libio's codecvt functions. */
static enum __codecvt_result do_out (struct _IO_codecvt *codecvt,
__c_mbstate_t *statep,
const wchar_t *from_start,
const wchar_t *from_end,
const wchar_t **from_stop, char *to_start,
char *to_end, char **to_stop);
static enum __codecvt_result do_unshift (struct _IO_codecvt *codecvt,
__c_mbstate_t *statep, char *to_start,
char *to_end, char **to_stop);
static enum __codecvt_result do_in (struct _IO_codecvt *codecvt,
__c_mbstate_t *statep,
const char *from_start,
const char *from_end,
const char **from_stop, wchar_t *to_start,
wchar_t *to_end, wchar_t **to_stop);
static int do_encoding (struct _IO_codecvt *codecvt);
static int do_length (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
const char *from_start,
const char *from_end, _IO_size_t max);
static int do_max_length (struct _IO_codecvt *codecvt);
static int do_always_noconv (struct _IO_codecvt *codecvt);
/* The functions used in `codecvt' for libio are always the same. */
struct _IO_codecvt __libio_codecvt =
{
.__codecvt_destr = NULL, /* Destructor, never used. */
.__codecvt_do_out = do_out,
.__codecvt_do_unshift = do_unshift,
.__codecvt_do_in = do_in,
.__codecvt_do_encoding = do_encoding,
.__codecvt_do_always_noconv = do_always_noconv,
.__codecvt_do_length = do_length,
.__codecvt_do_max_length = do_max_length
};
#ifdef _LIBC
static struct __gconv_trans_data libio_translit =
{
.__trans_fct = __gconv_transliterate
};
#endif
#endif /* defined(GLIBCPP_USE_WCHAR_T) */
/* Return orientation of stream. If mode is nonzero try to change
the orientation first. */
#undef _IO_fwide
int
_IO_fwide (fp, mode)
_IO_FILE *fp;
int mode;
{
/* Normalize the value. */
mode = mode < 0 ? -1 : (mode == 0 ? 0 : 1);
if (mode == 0 || fp->_mode != 0)
/* The caller simply wants to know about the current orientation
or the orientation already has been determined. */
return fp->_mode;
/* Set the orientation appropriately. */
if (mode > 0)
{
#ifdef _GLIBCPP_USE_WCHAR_T
struct _IO_codecvt *cc = fp->_codecvt;
fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_write_base;
#ifdef _LIBC
/* Get the character conversion functions based on the currently
selected locale for LC_CTYPE. */
{
struct gconv_fcts fcts;
/* Clear the state. We start all over again. */
memset (&fp->_wide_data->_IO_state, '\0', sizeof (__c_mbstate_t));
memset (&fp->_wide_data->_IO_last_state, '\0', sizeof (__c_mbstate_t));
__wcsmbs_clone_conv (&fcts);
/* The functions are always the same. */
*cc = __libio_codecvt;
cc->__cd_in.__cd.__nsteps = 1; /* Only one step allowed. */
cc->__cd_in.__cd.__steps = fcts.towc;
cc->__cd_in.__cd.__data[0].__invocation_counter = 0;
cc->__cd_in.__cd.__data[0].__internal_use = 1;
cc->__cd_in.__cd.__data[0].__flags = __GCONV_IS_LAST;
cc->__cd_in.__cd.__data[0].__statep = &fp->_wide_data->_IO_state;
/* XXX For now no transliteration. */
cc->__cd_in.__cd.__data[0].__trans = NULL;
cc->__cd_out.__cd.__nsteps = 1; /* Only one step allowed. */
cc->__cd_out.__cd.__steps = fcts.tomb;
cc->__cd_out.__cd.__data[0].__invocation_counter = 0;
cc->__cd_out.__cd.__data[0].__internal_use = 1;
cc->__cd_out.__cd.__data[0].__flags = __GCONV_IS_LAST;
cc->__cd_out.__cd.__data[0].__statep = &fp->_wide_data->_IO_state;
/* And now the transliteration. */
cc->__cd_out.__cd.__data[0].__trans = &libio_translit;
}
#else
# ifdef _GLIBCPP_USE_WCHAR_T
{
/* Determine internal and external character sets.
XXX For now we make our life easy: we assume a fixed internal
encoding (as most sane systems have; hi HP/UX!). If somebody
cares about systems which changing internal charsets they
should come up with a solution for the determination of the
currently used internal character set. */
#if 0
const char *internal_ccs = _G_INTERNAL_CCS;
const char *external_ccs = nl_langinfo(CODESET);
if (external_ccs == NULL)
external_ccs = "ISO-8859-1";
cc->__cd_in = iconv_open (internal_ccs, external_ccs);
if (cc->__cd_in != (iconv_t) -1)
cc->__cd_out = iconv_open (external_ccs, internal_ccs);
#endif
}
# else
# error "somehow determine this from LC_CTYPE"
# endif
#endif
/* From now on use the wide character callback functions. */
((struct _IO_FILE_plus *) fp)->vtable = fp->_wide_data->_wide_vtable;
#else /* !defined(_GLIBCPP_USE_WCHAR_T) */
mode = fp->_mode;
#endif /* !defined(_GLIBCPP_USE_WCHAR_T) */
}
/* Set the mode now. */
fp->_mode = mode;
return mode;
}
#ifdef weak_alias
weak_alias (_IO_fwide, fwide)
#endif
#ifdef _GLIBCPP_USE_WCHAR_T
static enum __codecvt_result
do_out (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
const wchar_t *from_start, const wchar_t *from_end,
const wchar_t **from_stop, char *to_start, char *to_end,
char **to_stop)
{
enum __codecvt_result result;
#ifdef _LIBC
struct __gconv_step *gs = codecvt->__cd_out.__cd.__steps;
int status;
size_t dummy;
const unsigned char *from_start_copy = (unsigned char *) from_start;
codecvt->__cd_out.__cd.__data[0].__outbuf = to_start;
codecvt->__cd_out.__cd.__data[0].__outbufend = to_end;
codecvt->__cd_out.__cd.__data[0].__statep = statep;
status = DL_CALL_FCT (gs->__fct,
(gs, codecvt->__cd_out.__cd.__data, &from_start_copy,
(const unsigned char *) from_end, NULL,
&dummy, 0, 0));
*from_stop = (wchar_t *) from_start_copy;
*to_stop = codecvt->__cd_out.__cd.__data[0].__outbuf;
switch (status)
{
case __GCONV_OK:
case __GCONV_EMPTY_INPUT:
result = __codecvt_ok;
break;
case __GCONV_FULL_OUTPUT:
case __GCONV_INCOMPLETE_INPUT:
result = __codecvt_partial;
break;
default:
result = __codecvt_error;
break;
}
#else
# ifdef _GLIBCPP_USE_WCHAR_T
size_t res;
const char *from_start_copy = (const char *) from_start;
size_t from_len = from_end - from_start;
char *to_start_copy = to_start;
size_t to_len = to_end - to_start;
res = iconv (codecvt->__cd_out, &from_start_copy, &from_len,
&to_start_copy, &to_len);
if (res == 0 || from_len == 0)
result = __codecvt_ok;
else if (to_len < codecvt->__codecvt_do_max_length (codecvt))
result = __codecvt_partial;
else
result = __codecvt_error;
# else
/* Decide what to do. */
result = __codecvt_error;
# endif
#endif
return result;
}
static enum __codecvt_result
do_unshift (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
char *to_start, char *to_end, char **to_stop)
{
enum __codecvt_result result;
#ifdef _LIBC
struct __gconv_step *gs = codecvt->__cd_out.__cd.__steps;
int status;
size_t dummy;
codecvt->__cd_out.__cd.__data[0].__outbuf = to_start;
codecvt->__cd_out.__cd.__data[0].__outbufend = to_end;
codecvt->__cd_out.__cd.__data[0].__statep = statep;
status = DL_CALL_FCT (gs->__fct,
(gs, codecvt->__cd_out.__cd.__data, NULL, NULL,
NULL, &dummy, 1, 0));
*to_stop = codecvt->__cd_out.__cd.__data[0].__outbuf;
switch (status)
{
case __GCONV_OK:
case __GCONV_EMPTY_INPUT:
result = __codecvt_ok;
break;
case __GCONV_FULL_OUTPUT:
case __GCONV_INCOMPLETE_INPUT:
result = __codecvt_partial;
break;
default:
result = __codecvt_error;
break;
}
#else
# ifdef _GLIBCPP_USE_WCHAR_T
size_t res;
char *to_start_copy = (char *) to_start;
size_t to_len = to_end - to_start;
res = iconv (codecvt->__cd_out, NULL, NULL, &to_start_copy, &to_len);
if (res == 0)
result = __codecvt_ok;
else if (to_len < codecvt->__codecvt_do_max_length (codecvt))
result = __codecvt_partial;
else
result = __codecvt_error;
# else
/* Decide what to do. */
result = __codecvt_error;
# endif
#endif
return result;
}
static enum __codecvt_result
do_in (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
const char *from_start, const char *from_end, const char **from_stop,
wchar_t *to_start, wchar_t *to_end, wchar_t **to_stop)
{
enum __codecvt_result result;
#ifdef _LIBC
struct __gconv_step *gs = codecvt->__cd_in.__cd.__steps;
int status;
size_t dummy;
const unsigned char *from_start_copy = (unsigned char *) from_start;
codecvt->__cd_in.__cd.__data[0].__outbuf = (char *) to_start;
codecvt->__cd_in.__cd.__data[0].__outbufend = (char *) to_end;
codecvt->__cd_in.__cd.__data[0].__statep = statep;
status = DL_CALL_FCT (gs->__fct,
(gs, codecvt->__cd_in.__cd.__data, &from_start_copy,
from_end, NULL, &dummy, 0, 0));
*from_stop = from_start_copy;
*to_stop = (wchar_t *) codecvt->__cd_in.__cd.__data[0].__outbuf;
switch (status)
{
case __GCONV_OK:
case __GCONV_EMPTY_INPUT:
result = __codecvt_ok;
break;
case __GCONV_FULL_OUTPUT:
case __GCONV_INCOMPLETE_INPUT:
result = __codecvt_partial;
break;
default:
result = __codecvt_error;
break;
}
#else
# ifdef _GLIBCPP_USE_WCHAR_T
size_t res;
const char *from_start_copy = (const char *) from_start;
size_t from_len = from_end - from_start;
char *to_start_copy = (char *) from_start;
size_t to_len = to_end - to_start;
res = iconv (codecvt->__cd_in, &from_start_copy, &from_len,
&to_start_copy, &to_len);
if (res == 0)
result = __codecvt_ok;
else if (to_len == 0)
result = __codecvt_partial;
else if (from_len < codecvt->__codecvt_do_max_length (codecvt))
result = __codecvt_partial;
else
result = __codecvt_error;
# else
/* Decide what to do. */
result = __codecvt_error;
# endif
#endif
return result;
}
static int
do_encoding (struct _IO_codecvt *codecvt)
{
#ifdef _LIBC
/* See whether the encoding is stateful. */
if (codecvt->__cd_in.__cd.__steps[0].__stateful)
return -1;
/* Fortunately not. Now determine the input bytes for the conversion
necessary for each wide character. */
if (codecvt->__cd_in.__cd.__steps[0].__min_needed_from
!= codecvt->__cd_in.__cd.__steps[0].__max_needed_from)
/* Not a constant value. */
return 0;
return codecvt->__cd_in.__cd.__steps[0].__min_needed_from;
#else
/* Worst case scenario. */
return -1;
#endif
}
static int
do_always_noconv (struct _IO_codecvt *codecvt)
{
return 0;
}
static int
do_length (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
const char *from_start, const char *from_end, _IO_size_t max)
{
int result;
#ifdef _LIBC
const unsigned char *cp = (const unsigned char *) from_start;
wchar_t to_buf[max];
struct __gconv_step *gs = codecvt->__cd_in.__cd.__steps;
int status;
size_t dummy;
codecvt->__cd_in.__cd.__data[0].__outbuf = (char *) to_buf;
codecvt->__cd_in.__cd.__data[0].__outbufend = (char *) &to_buf[max];
codecvt->__cd_in.__cd.__data[0].__statep = statep;
status = DL_CALL_FCT (gs->__fct,
(gs, codecvt->__cd_in.__cd.__data, &cp, from_end,
NULL, &dummy, 0, 0));
result = cp - (const unsigned char *) from_start;
#else
# ifdef _GLIBCPP_USE_WCHAR_T
const char *from_start_copy = (const char *) from_start;
size_t from_len = from_end - from_start;
wchar_t to_buf[max];
size_t res;
char *to_start = (char *) to_buf;
res = iconv (codecvt->__cd_in, &from_start_copy, &from_len,
&to_start, &max);
result = from_start_copy - (char *) from_start;
# else
/* Decide what to do. */
result = 0;
# endif
#endif
return result;
}
static int
do_max_length (struct _IO_codecvt *codecvt)
{
#ifdef _LIBC
return codecvt->__cd_in.__cd.__steps[0].__max_needed_from;
#else
return MB_CUR_MAX;
#endif
}
#endif /* defined(_GLIBCPP_USE_WCHAR_T) */

View File

@ -1,82 +0,0 @@
#include "libio.h"
/* These emulate stdio functionality, but with a different name
(_IO_ungetc instead of ungetc), and using _IO_FILE instead of FILE. */
#ifdef __cplusplus
extern "C" {
#endif
extern int _IO_fclose __P((_IO_FILE*));
extern int _IO_new_fclose __P((_IO_FILE*));
extern int _IO_old_fclose __P((_IO_FILE*));
extern _IO_FILE *_IO_fdopen __P((int, const char*));
extern _IO_FILE *_IO_old_fdopen __P((int, const char*));
extern _IO_FILE *_IO_new_fdopen __P((int, const char*));
extern int _IO_fflush __P((_IO_FILE*));
extern int _IO_fgetpos __P((_IO_FILE*, _IO_fpos_t*));
extern int _IO_fgetpos64 __P((_IO_FILE*, _IO_fpos64_t*));
extern char* _IO_fgets __P((char*, int, _IO_FILE*));
extern _IO_FILE *_IO_fopen __P((const char*, const char*));
extern _IO_FILE *_IO_old_fopen __P((const char*, const char*));
extern _IO_FILE *_IO_new_fopen __P((const char*, const char*));
extern _IO_FILE *_IO_fopen64 __P((const char*, const char*));
extern int _IO_fprintf __P((_IO_FILE*, const char*, ...));
extern int _IO_fputs __P((const char*, _IO_FILE*));
extern int _IO_fsetpos __P((_IO_FILE*, const _IO_fpos_t *));
extern int _IO_fsetpos64 __P((_IO_FILE*, const _IO_fpos64_t *));
extern long int _IO_ftell __P((_IO_FILE*));
extern _IO_size_t _IO_fread __P((void*, _IO_size_t, _IO_size_t, _IO_FILE*));
extern _IO_size_t _IO_fwrite __P((const void*,
_IO_size_t, _IO_size_t, _IO_FILE*));
extern char* _IO_gets __P((char*));
extern void _IO_perror __P((const char*));
extern int _IO_printf __P((const char*, ...));
extern int _IO_puts __P((const char*));
extern int _IO_scanf __P((const char*, ...));
extern void _IO_setbuffer __P((_IO_FILE *, char*, _IO_size_t));
extern int _IO_setvbuf __P((_IO_FILE*, char*, int, _IO_size_t));
extern int _IO_sscanf __P((const char*, const char*, ...));
extern int _IO_sprintf __P((char *, const char*, ...));
extern int _IO_ungetc __P((int, _IO_FILE*));
extern int _IO_vsscanf __P((const char *, const char *, _IO_va_list));
extern int _IO_vsprintf __P((char*, const char*, _IO_va_list));
extern int _IO_vswprintf __P((wchar_t*, _IO_size_t, const wchar_t*,
_IO_va_list));
struct obstack;
extern int _IO_obstack_vprintf __P ((struct obstack *, const char *,
_IO_va_list));
extern int _IO_obstack_printf __P ((struct obstack *, const char *, ...));
#ifndef _IO_pos_BAD
#define _IO_pos_BAD ((_IO_off64_t)(-1))
#endif
#define _IO_clearerr(FP) ((FP)->_flags &= ~(_IO_ERR_SEEN|_IO_EOF_SEEN))
#define _IO_fseek(__fp, __offset, __whence) \
(_IO_seekoff(__fp, __offset, __whence, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD ? EOF : 0)
#define _IO_rewind(FILE) (void)_IO_seekoff(FILE, 0, 0, _IOS_INPUT|_IOS_OUTPUT)
#define _IO_vprintf(FORMAT, ARGS) _IO_vfprintf(_IO_stdout, FORMAT, ARGS)
#define _IO_freopen(FILENAME, MODE, FP) \
(_IO_file_close_it(FP), _IO_file_fopen(FP, FILENAME, MODE, 0))
#define _IO_old_freopen(FILENAME, MODE, FP) \
(_IO_old_file_close_it (FP), _IO_old_file_fopen(FP, FILENAME, MODE))
#define _IO_freopen64(FILENAME, MODE, FP) \
(_IO_file_close_it(FP), _IO_file_fopen(FP, FILENAME, MODE, 1))
#define _IO_fileno(FP) ((FP)->_fileno)
extern _IO_FILE* _IO_popen __P((const char*, const char*));
extern _IO_FILE* _IO_new_popen __P((const char*, const char*));
extern _IO_FILE* _IO_old_popen __P((const char*, const char*));
extern int __new_pclose __P((_IO_FILE *));
extern int __old_pclose __P((_IO_FILE *));
#define _IO_pclose _IO_fclose
#define _IO_setbuf(_FP, _BUF) _IO_setbuffer(_FP, _BUF, _IO_BUFSIZ)
#define _IO_setlinebuf(_FP) _IO_setvbuf(_FP, NULL, 1, 0)
_IO_FILE *__new_freopen __P ((const char *, const char *, _IO_FILE *));
_IO_FILE *__old_freopen __P ((const char *, const char *, _IO_FILE *));
#ifdef __cplusplus
}
#endif

View File

@ -1,511 +0,0 @@
/* Copyright (C) 1991,92,93,94,95,97,98,99,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
Written by Per Bothner <bothner@cygnus.com>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#ifndef _IO_STDIO_H
#define _IO_STDIO_H
#include <_G_config.h>
/* ALL of these should be defined in _G_config.h */
#define _IO_pos_t _G_fpos_t /* obsolete */
#define _IO_fpos_t _G_fpos_t
#define _IO_fpos64_t _G_fpos64_t
#define _IO_size_t _G_size_t
#define _IO_ssize_t _G_ssize_t
#define _IO_off_t _G_off_t
#define _IO_off64_t _G_off64_t
#define _IO_pid_t _G_pid_t
#define _IO_uid_t _G_uid_t
#define _IO_iconv_t _G_iconv_t
#define _IO_HAVE_SYS_WAIT _G_HAVE_SYS_WAIT
#define _IO_HAVE_ST_BLKSIZE _G_HAVE_ST_BLKSIZE
#define _IO_BUFSIZ _G_BUFSIZ
#define _IO_va_list _G_va_list
#define _IO_wint_t _G_wint_t
#ifdef _G_NEED_STDARG_H
/* This define avoids name pollution if we're using GNU stdarg.h */
# define __need___va_list
# include <stdarg.h>
# ifdef __GNUC_VA_LIST
# undef _IO_va_list
# define _IO_va_list __gnuc_va_list
# endif /* __GNUC_VA_LIST */
#endif
#ifndef __THROW
# ifdef __cplusplus
# define __THROW throw ()
# else
# define __THROW
# endif
#endif /* not __THROW */
#ifndef __P
# define __P(p) p __THROW
#endif /* not __P */
#ifndef __PMT
# define __PMT(p) p
#endif /* not __PMT */
/* For backward compatibility */
#ifndef _PARAMS
# define _PARAMS(protos) __P(protos)
#endif /*!_PARAMS*/
#ifndef __STDC__
# ifndef const
# define const
# endif
#endif
#define _IO_UNIFIED_JUMPTABLES 1
#ifndef _G_HAVE_PRINTF_FP
# define _IO_USE_DTOA 1
#endif
#ifndef EOF
# define EOF (-1)
#endif
#ifndef NULL
# if defined __GNUG__ && \
(__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
# define NULL (__null)
# else
# if !defined(__cplusplus)
# define NULL ((void*)0)
# else
# define NULL (0)
# endif
# endif
#endif
#define _IOS_INPUT 1
#define _IOS_OUTPUT 2
#define _IOS_ATEND 4
#define _IOS_APPEND 8
#define _IOS_TRUNC 16
#define _IOS_NOCREATE 32
#define _IOS_NOREPLACE 64
#define _IOS_BIN 128
/* Magic numbers and bits for the _flags field.
The magic numbers use the high-order bits of _flags;
the remaining bits are available for variable flags.
Note: The magic numbers must all be negative if stdio
emulation is desired. */
#define _IO_MAGIC 0xFBAD0000 /* Magic number */
#define _OLD_STDIO_MAGIC 0xFABC0000 /* Emulate old stdio. */
#define _IO_MAGIC_MASK 0xFFFF0000
#define _IO_USER_BUF 1 /* User owns buffer; don't delete it on close. */
#define _IO_UNBUFFERED 2
#define _IO_NO_READS 4 /* Reading not allowed */
#define _IO_NO_WRITES 8 /* Writing not allowd */
#define _IO_EOF_SEEN 0x10
#define _IO_ERR_SEEN 0x20
#define _IO_DELETE_DONT_CLOSE 0x40 /* Don't call close(_fileno) on cleanup. */
#define _IO_LINKED 0x80 /* Set if linked (using _chain) to streambuf::_list_all.*/
#define _IO_IN_BACKUP 0x100
#define _IO_LINE_BUF 0x200
#define _IO_TIED_PUT_GET 0x400 /* Set if put and get pointer logicly tied. */
#define _IO_CURRENTLY_PUTTING 0x800
#define _IO_IS_APPENDING 0x1000
#define _IO_IS_FILEBUF 0x2000
#define _IO_BAD_SEEN 0x4000
#define _IO_USER_LOCK 0x8000
/* These are "formatting flags" matching the iostream fmtflags enum values. */
#define _IO_SKIPWS 01
#define _IO_LEFT 02
#define _IO_RIGHT 04
#define _IO_INTERNAL 010
#define _IO_DEC 020
#define _IO_OCT 040
#define _IO_HEX 0100
#define _IO_SHOWBASE 0200
#define _IO_SHOWPOINT 0400
#define _IO_UPPERCASE 01000
#define _IO_SHOWPOS 02000
#define _IO_SCIENTIFIC 04000
#define _IO_FIXED 010000
#define _IO_UNITBUF 020000
#define _IO_STDIO 040000
#define _IO_DONT_CLOSE 0100000
#define _IO_BOOLALPHA 0200000
struct _IO_jump_t; struct _IO_FILE;
/* Handle lock. */
#ifdef _IO_MTSAFE_IO
# if defined __GLIBC__ && __GLIBC__ >= 2
# if __GLIBC_MINOR__ == 0
# include <stdio-lock.h>
# else
# include <bits/stdio-lock.h>
# endif
# else
/*# include <comthread.h>*/
# endif
#else
typedef void _IO_lock_t;
#endif
/* A streammarker remembers a position in a buffer. */
struct _IO_marker {
struct _IO_marker *_next;
struct _IO_FILE *_sbuf;
/* If _pos >= 0
it points to _buf->Gbase()+_pos. FIXME comment */
/* if _pos < 0, it points to _buf->eBptr()+_pos. FIXME comment */
int _pos;
#if 0
void set_streampos(streampos sp) { _spos = sp; }
void set_offset(int offset) { _pos = offset; _spos = (streampos)(-2); }
public:
streammarker(streambuf *sb);
~streammarker();
int saving() { return _spos == -2; }
int delta(streammarker&);
int delta();
#endif
};
/* This is the structure from the libstdc++ codecvt class. */
enum __codecvt_result
{
__codecvt_ok,
__codecvt_partial,
__codecvt_error,
__codecvt_noconv
};
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
/* The order of the elements in the following struct must match the order
of the virtual functions in the libstdc++ codecvt class. */
struct _IO_codecvt
{
void (*__codecvt_destr) (struct _IO_codecvt *);
enum __codecvt_result (*__codecvt_do_out) (struct _IO_codecvt *,
__c_mbstate_t *,
const wchar_t *,
const wchar_t *,
const wchar_t **, char *,
char *, char **);
enum __codecvt_result (*__codecvt_do_unshift) (struct _IO_codecvt *,
__c_mbstate_t *, char *,
char *, char **);
enum __codecvt_result (*__codecvt_do_in) (struct _IO_codecvt *,
__c_mbstate_t *,
const char *, const char *,
const char **, wchar_t *,
wchar_t *, wchar_t **);
int (*__codecvt_do_encoding) (struct _IO_codecvt *);
int (*__codecvt_do_always_noconv) (struct _IO_codecvt *);
int (*__codecvt_do_length) (struct _IO_codecvt *, __c_mbstate_t *,
const char *, const char *, _IO_size_t);
int (*__codecvt_do_max_length) (struct _IO_codecvt *);
_IO_iconv_t __cd_in;
_IO_iconv_t __cd_out;
};
/* Extra data for wide character streams. */
struct _IO_wide_data
{
wchar_t *_IO_read_ptr; /* Current read pointer */
wchar_t *_IO_read_end; /* End of get area. */
wchar_t *_IO_read_base; /* Start of putback+get area. */
wchar_t *_IO_write_base; /* Start of put area. */
wchar_t *_IO_write_ptr; /* Current put pointer. */
wchar_t *_IO_write_end; /* End of put area. */
wchar_t *_IO_buf_base; /* Start of reserve area. */
wchar_t *_IO_buf_end; /* End of reserve area. */
/* The following fields are used to support backing up and undo. */
wchar_t *_IO_save_base; /* Pointer to start of non-current get area. */
wchar_t *_IO_backup_base; /* Pointer to first valid character of
backup area */
wchar_t *_IO_save_end; /* Pointer to end of non-current get area. */
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
__c_mbstate_t _IO_state;
__c_mbstate_t _IO_last_state;
#endif
struct _IO_codecvt _codecvt;
wchar_t _shortbuf[1];
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
struct _IO_jump_t *_wide_vtable;
#endif
};
#else /* !(defined _LIBC || defined _GLIBCPP_USE_WCHAR_T) */
/* Because _IO_no_init unconditionally takes a `_IO_wide_data*' as its
last parameter we must still define this type. We intentionally
leave it incomplete to prevent any use of this type when we are not
supporting wide characters. */
struct _IO_wide_data;
#endif /* !(defined _LIBC || defined _GLIBCPP_USE_WCHAR_T) */
struct _IO_FILE {
int _flags; /* High-order word is _IO_MAGIC; rest is flags. */
#define _IO_file_flags _flags
/* The following pointers correspond to the C++ streambuf protocol. */
/* Note: Tk uses the _IO_read_ptr and _IO_read_end fields directly. */
char* _IO_read_ptr; /* Current read pointer */
char* _IO_read_end; /* End of get area. */
char* _IO_read_base; /* Start of putback+get area. */
char* _IO_write_base; /* Start of put area. */
char* _IO_write_ptr; /* Current put pointer. */
char* _IO_write_end; /* End of put area. */
char* _IO_buf_base; /* Start of reserve area. */
char* _IO_buf_end; /* End of reserve area. */
/* The following fields are used to support backing up and undo. */
char *_IO_save_base; /* Pointer to start of non-current get area. */
char *_IO_backup_base; /* Pointer to first valid character of backup area */
char *_IO_save_end; /* Pointer to end of non-current get area. */
struct _IO_marker *_markers;
struct _IO_FILE *_chain;
int _fileno;
int _blksize;
_IO_off_t _old_offset; /* This used to be _offset but it's too small. */
#define __HAVE_COLUMN /* temporary */
/* 1+column number of pbase(); 0 is unknown. */
unsigned short _cur_column;
signed char _vtable_offset;
char _shortbuf[1];
/* char* _save_gptr; char* _save_egptr; */
_IO_lock_t *_lock;
#ifdef _IO_USE_OLD_IO_FILE
};
struct _IO_FILE_complete
{
struct _IO_FILE _file;
#endif
#if defined _G_IO_IO_FILE_VERSION && _G_IO_IO_FILE_VERSION == 0x20001
_IO_off64_t _offset;
# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
/* Wide character stream stuff. */
struct _IO_codecvt *_codecvt;
struct _IO_wide_data *_wide_data;
# else
void *__pad1;
void *__pad2;
# endif
int _mode;
/* Make sure we don't get into trouble again. */
char _unused2[15 * sizeof (int) - 2 * sizeof (void *)];
#endif
};
#ifndef __cplusplus
typedef struct _IO_FILE _IO_FILE;
#endif
struct _IO_FILE_plus;
extern struct _IO_FILE_plus _IO_2_1_stdin_;
extern struct _IO_FILE_plus _IO_2_1_stdout_;
extern struct _IO_FILE_plus _IO_2_1_stderr_;
#ifndef _LIBC
#define _IO_stdin ((_IO_FILE*)(&_IO_2_1_stdin_))
#define _IO_stdout ((_IO_FILE*)(&_IO_2_1_stdout_))
#define _IO_stderr ((_IO_FILE*)(&_IO_2_1_stderr_))
#else
extern _IO_FILE *_IO_stdin;
extern _IO_FILE *_IO_stdout;
extern _IO_FILE *_IO_stderr;
#endif
/* Functions to do I/O and file management for a stream. */
/* Read NBYTES bytes from COOKIE into a buffer pointed to by BUF.
Return number of bytes read. */
typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
/* Write N bytes pointed to by BUF to COOKIE. Write all N bytes
unless there is an error. Return number of bytes written, or -1 if
there is an error without writing anything. If the file has been
opened for append (__mode.__append set), then set the file pointer
to the end of the file and then do the write; if not, just write at
the current file pointer. */
typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
size_t __n);
/* Move COOKIE's file position to *POS bytes from the
beginning of the file (if W is SEEK_SET),
the current position (if W is SEEK_CUR),
or the end of the file (if W is SEEK_END).
Set *POS to the new file position.
Returns zero if successful, nonzero if not. */
typedef int __io_seek_fn (void *__cookie, _IO_off64_t *__pos, int __w);
/* Close COOKIE. */
typedef int __io_close_fn (void *__cookie);
#ifdef _GNU_SOURCE
/* User-visible names for the above. */
typedef __io_read_fn cookie_read_function_t;
typedef __io_write_fn cookie_write_function_t;
typedef __io_seek_fn cookie_seek_function_t;
typedef __io_close_fn cookie_close_function_t;
/* The structure with the cookie function pointers. */
typedef struct
{
__io_read_fn *read; /* Read bytes. */
__io_write_fn *write; /* Write bytes. */
__io_seek_fn *seek; /* Seek/tell file position. */
__io_close_fn *close; /* Close file. */
} _IO_cookie_io_functions_t;
typedef _IO_cookie_io_functions_t cookie_io_functions_t;
struct _IO_cookie_file;
/* Initialize one of those. */
extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int __read_write,
void *__cookie, _IO_cookie_io_functions_t __fns);
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern int __underflow (_IO_FILE *) __THROW;
extern int __uflow (_IO_FILE *) __THROW;
extern int __overflow (_IO_FILE *, int) __THROW;
extern _IO_wint_t __wunderflow (_IO_FILE *) __THROW;
extern _IO_wint_t __wuflow (_IO_FILE *) __THROW;
extern _IO_wint_t __woverflow (_IO_FILE *, _IO_wint_t) __THROW;
#define _IO_getc_unlocked(_fp) \
((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end ? __uflow (_fp) \
: *(unsigned char *) (_fp)->_IO_read_ptr++)
#define _IO_peekc_unlocked(_fp) \
((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end \
&& __underflow (_fp) == EOF ? EOF \
: *(unsigned char *) (_fp)->_IO_read_ptr)
#define _IO_putc_unlocked(_ch, _fp) \
(((_fp)->_IO_write_ptr >= (_fp)->_IO_write_end) \
? __overflow (_fp, (unsigned char) (_ch)) \
: (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch)))
#define _IO_getwc_unlocked(_fp) \
((_fp)->_wide_data->_IO_read_ptr >= (_fp)->_wide_data->_IO_read_end \
? __wuflow (_fp) : (_IO_wint_t) *(_fp)->_wide_data->_IO_read_ptr++)
#define _IO_putwc_unlocked(_wch, _fp) \
((_fp)->_wide_data->_IO_write_ptr >= (_fp)->_wide_data->_IO_write_end \
? __woverflow (_fp, _wch) \
: (_IO_wint_t) (*(_fp)->_wide_data->_IO_write_ptr++ = (_wch)))
#define _IO_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0)
#define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0)
extern int _IO_getc (_IO_FILE *__fp) __THROW;
extern int _IO_putc (int __c, _IO_FILE *__fp) __THROW;
extern int _IO_feof (_IO_FILE *__fp) __THROW;
extern int _IO_ferror (_IO_FILE *__fp) __THROW;
extern int _IO_peekc_locked (_IO_FILE *__fp) __THROW;
/* This one is for Emacs. */
#define _IO_PENDING_OUTPUT_COUNT(_fp) \
((_fp)->_IO_write_ptr - (_fp)->_IO_write_base)
extern void _IO_flockfile (_IO_FILE *) __THROW;
extern void _IO_funlockfile (_IO_FILE *) __THROW;
extern int _IO_ftrylockfile (_IO_FILE *) __THROW;
#ifdef _IO_MTSAFE_IO
# define _IO_peekc(_fp) _IO_peekc_locked (_fp)
#else
# define _IO_peekc(_fp) _IO_peekc_unlocked (_fp)
# define _IO_flockfile(_fp) /**/
# define _IO_funlockfile(_fp) /**/
# define _IO_ftrylockfile(_fp) /**/
# define _IO_cleanup_region_start(_fct, _fp) /**/
# define _IO_cleanup_region_end(_Doit) /**/
#endif /* !_IO_MTSAFE_IO */
extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
_IO_va_list, int *__restrict) __THROW;
extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
_IO_va_list) __THROW;
extern _IO_ssize_t _IO_padn (_IO_FILE *, int, _IO_ssize_t) __THROW;
extern _IO_size_t _IO_sgetn (_IO_FILE *, void *, _IO_size_t) __THROW;
extern _IO_off64_t _IO_seekoff (_IO_FILE *, _IO_off64_t, int, int) __THROW;
extern _IO_off64_t _IO_seekpos (_IO_FILE *, _IO_off64_t, int) __THROW;
extern void _IO_free_backup_area (_IO_FILE *) __THROW;
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
extern _IO_wint_t _IO_getwc (_IO_FILE *__fp) __THROW;
extern _IO_wint_t _IO_putwc (wchar_t __wc, _IO_FILE *__fp) __THROW;
extern int _IO_fwide (_IO_FILE *__fp, int __mode) __THROW;
# if __GNUC__ >= 2
/* A special optimized version of the function above. It optimizes the
case of initializing an unoriented byte stream. */
# define _IO_fwide(__fp, __mode) \
({ int __result = (__mode); \
if (__result < 0) \
{ \
if ((__fp)->_mode == 0) \
/* We know that all we have to do is to set the flag. */ \
(__fp)->_mode = -1; \
__result = (__fp)->_mode; \
} \
else \
__result = _IO_fwide (__fp, __result); \
__result; })
# endif
extern int _IO_vfwscanf (_IO_FILE * __restrict, const wchar_t * __restrict,
_IO_va_list, int *__restrict) __THROW;
extern int _IO_vfwprintf (_IO_FILE *__restrict, const wchar_t *__restrict,
_IO_va_list) __THROW;
extern _IO_ssize_t _IO_wpadn (_IO_FILE *, wint_t, _IO_ssize_t) __THROW;
extern void _IO_free_wbackup_area (_IO_FILE *) __THROW;
#endif
#ifdef __cplusplus
}
#endif
#endif /* _IO_STDIO_H */

View File

@ -1,821 +0,0 @@
/* Copyright (C) 1993, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
# include <errno.h>
#ifndef __set_errno
# define __set_errno(Val) errno = (Val)
#endif
#if defined __GLIBC__ && __GLIBC__ >= 2
# include <bits/libc-lock.h>
#else
/*# include <comthread.h>*/
#endif
#include "iolibio.h"
#ifdef __cplusplus
extern "C" {
#endif
#define _IO_seek_set 0
#define _IO_seek_cur 1
#define _IO_seek_end 2
/* THE JUMPTABLE FUNCTIONS.
* The _IO_FILE type is used to implement the FILE type in GNU libc,
* as well as the streambuf class in GNU iostreams for C++.
* These are all the same, just used differently.
* An _IO_FILE (or FILE) object is allows followed by a pointer to
* a jump table (of pointers to functions). The pointer is accessed
* with the _IO_JUMPS macro. The jump table has a eccentric format,
* so as to be compatible with the layout of a C++ virtual function table.
* (as implemented by g++). When a pointer to a streambuf object is
* coerced to an (_IO_FILE*), then _IO_JUMPS on the result just
* happens to point to the virtual function table of the streambuf.
* Thus the _IO_JUMPS function table used for C stdio/libio does
* double duty as the virtual function table for C++ streambuf.
*
* The entries in the _IO_JUMPS function table (and hence also the
* virtual functions of a streambuf) are described below.
* The first parameter of each function entry is the _IO_FILE/streambuf
* object being acted on (i.e. the 'this' parameter).
*/
#if (!defined _IO_USE_OLD_IO_FILE \
&& (!defined _G_IO_NO_BACKWARD_COMPAT || _G_IO_NO_BACKWARD_COMPAT == 0))
# define _IO_JUMPS_OFFSET 1
#endif
#define _IO_JUMPS(THIS) (THIS)->vtable
#define _IO_WIDE_JUMPS(THIS) ((struct _IO_FILE *) (THIS))->_wide_data->_wide_vtable
#define _IO_CHECK_WIDE(THIS) (((struct _IO_FILE *) (THIS))->_wide_data != NULL)
#if _IO_JUMPS_OFFSET
# define _IO_JUMPS_FUNC(THIS) \
(*(struct _IO_jump_t **) ((void *) &_IO_JUMPS ((struct _IO_FILE_plus *) (THIS)) \
+ (THIS)->_vtable_offset))
#else
# define _IO_JUMPS_FUNC(THIS) _IO_JUMPS ((struct _IO_FILE_plus *) (THIS))
#endif
#define _IO_WIDE_JUMPS_FUNC(THIS) _IO_WIDE_JUMPS(THIS)
#if _G_USING_THUNKS
# define JUMP_FIELD(TYPE, NAME) TYPE NAME
# define JUMP0(FUNC, THIS) _IO_JUMPS_FUNC(THIS)->FUNC (THIS)
# define JUMP1(FUNC, THIS, X1) _IO_JUMPS_FUNC(THIS)->FUNC (THIS, X1)
# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS_FUNC(THIS)->FUNC (THIS, X1, X2)
# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS_FUNC(THIS)->FUNC (THIS, X1,X2, X3)
# define JUMP_INIT(NAME, VALUE) VALUE
# define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0), JUMP_INIT (dummy2, 0)
# define WJUMP0(FUNC, THIS) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC (THIS)
# define WJUMP1(FUNC, THIS, X1) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC (THIS, X1)
# define WJUMP2(FUNC, THIS, X1, X2) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC (THIS, X1, X2)
# define WJUMP3(FUNC, THIS, X1,X2,X3) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC (THIS, X1,X2, X3)
#else
/* These macros will change when we re-implement vtables to use "thunks"! */
# define JUMP_FIELD(TYPE, NAME) struct { short delta1, delta2; TYPE pfn; } NAME
# define JUMP0(FUNC, THIS) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS)
# define JUMP1(FUNC, THIS, X1) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1)
# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1, X2)
# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1,X2,X3)
# define JUMP_INIT(NAME, VALUE) {0, 0, VALUE}
# define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0)
# define WJUMP0(FUNC, THIS) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS)
# define WJUMP1(FUNC, THIS, X1) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1)
# define WJUMP2(FUNC, THIS, X1, X2) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1, X2)
# define WJUMP3(FUNC, THIS, X1,X2,X3) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1,X2,X3)
#endif
/* The 'finish' function does any final cleaning up of an _IO_FILE object.
It does not delete (free) it, but does everything else to finalize it.
It matches the streambuf::~streambuf virtual destructor. */
typedef void (*_IO_finish_t) __PMT ((_IO_FILE *, int)); /* finalize */
#define _IO_FINISH(FP) JUMP1 (__finish, FP, 0)
#define _IO_WFINISH(FP) WJUMP1 (__finish, FP, 0)
/* The 'overflow' hook flushes the buffer.
The second argument is a character, or EOF.
It matches the streambuf::overflow virtual function. */
typedef int (*_IO_overflow_t) __PMT ((_IO_FILE *, int));
#define _IO_OVERFLOW(FP, CH) JUMP1 (__overflow, FP, CH)
#define _IO_WOVERFLOW(FP, CH) WJUMP1 (__overflow, FP, CH)
/* The 'underflow' hook tries to fills the get buffer.
It returns the next character (as an unsigned char) or EOF. The next
character remains in the get buffer, and the get position is not changed.
It matches the streambuf::underflow virtual function. */
typedef int (*_IO_underflow_t) __PMT ((_IO_FILE *));
#define _IO_UNDERFLOW(FP) JUMP0 (__underflow, FP)
#define _IO_WUNDERFLOW(FP) WJUMP0 (__underflow, FP)
/* The 'uflow' hook returns the next character in the input stream
(cast to unsigned char), and increments the read position;
EOF is returned on failure.
It matches the streambuf::uflow virtual function, which is not in the
cfront implementation, but was added to C++ by the ANSI/ISO committee. */
#define _IO_UFLOW(FP) JUMP0 (__uflow, FP)
#define _IO_WUFLOW(FP) WJUMP0 (__uflow, FP)
/* The 'pbackfail' hook handles backing up.
It matches the streambuf::pbackfail virtual function. */
typedef int (*_IO_pbackfail_t) __PMT ((_IO_FILE *, int));
#define _IO_PBACKFAIL(FP, CH) JUMP1 (__pbackfail, FP, CH)
#define _IO_WPBACKFAIL(FP, CH) WJUMP1 (__pbackfail, FP, CH)
/* The 'xsputn' hook writes upto N characters from buffer DATA.
Returns the number of character actually written.
It matches the streambuf::xsputn virtual function. */
typedef _IO_size_t (*_IO_xsputn_t) __PMT ((_IO_FILE *FP, const void *DATA,
_IO_size_t N));
#define _IO_XSPUTN(FP, DATA, N) JUMP2 (__xsputn, FP, DATA, N)
#define _IO_WXSPUTN(FP, DATA, N) WJUMP2 (__xsputn, FP, DATA, N)
/* The 'xsgetn' hook reads upto N characters into buffer DATA.
Returns the number of character actually read.
It matches the streambuf::xsgetn virtual function. */
typedef _IO_size_t (*_IO_xsgetn_t) __PMT ((_IO_FILE *FP, void *DATA,
_IO_size_t N));
#define _IO_XSGETN(FP, DATA, N) JUMP2 (__xsgetn, FP, DATA, N)
#define _IO_WXSGETN(FP, DATA, N) WJUMP2 (__xsgetn, FP, DATA, N)
/* The 'seekoff' hook moves the stream position to a new position
relative to the start of the file (if DIR==0), the current position
(MODE==1), or the end of the file (MODE==2).
It matches the streambuf::seekoff virtual function.
It is also used for the ANSI fseek function. */
typedef _IO_off64_t (*_IO_seekoff_t) __PMT ((_IO_FILE *FP, _IO_off64_t OFF,
int DIR, int MODE));
#define _IO_SEEKOFF(FP, OFF, DIR, MODE) JUMP3 (__seekoff, FP, OFF, DIR, MODE)
#define _IO_WSEEKOFF(FP, OFF, DIR, MODE) WJUMP3 (__seekoff, FP, OFF, DIR, MODE)
/* The 'seekpos' hook also moves the stream position,
but to an absolute position given by a fpos64_t (seekpos).
It matches the streambuf::seekpos virtual function.
It is also used for the ANSI fgetpos and fsetpos functions. */
/* The _IO_seek_cur and _IO_seek_end options are not allowed. */
typedef _IO_off64_t (*_IO_seekpos_t) __PMT ((_IO_FILE *, _IO_off64_t, int));
#define _IO_SEEKPOS(FP, POS, FLAGS) JUMP2 (__seekpos, FP, POS, FLAGS)
#define _IO_WSEEKPOS(FP, POS, FLAGS) WJUMP2 (__seekpos, FP, POS, FLAGS)
/* The 'setbuf' hook gives a buffer to the file.
It matches the streambuf::setbuf virtual function. */
typedef _IO_FILE* (*_IO_setbuf_t) __PMT ((_IO_FILE *, char *, _IO_ssize_t));
#define _IO_SETBUF(FP, BUFFER, LENGTH) JUMP2 (__setbuf, FP, BUFFER, LENGTH)
#define _IO_WSETBUF(FP, BUFFER, LENGTH) WJUMP2 (__setbuf, FP, BUFFER, LENGTH)
/* The 'sync' hook attempts to synchronize the internal data structures
of the file with the external state.
It matches the streambuf::sync virtual function. */
typedef int (*_IO_sync_t) __PMT ((_IO_FILE *));
#define _IO_SYNC(FP) JUMP0 (__sync, FP)
#define _IO_WSYNC(FP) WJUMP0 (__sync, FP)
/* The 'doallocate' hook is used to tell the file to allocate a buffer.
It matches the streambuf::doallocate virtual function, which is not
in the ANSI/ISO C++ standard, but is part traditional implementations. */
typedef int (*_IO_doallocate_t) __PMT ((_IO_FILE *));
#define _IO_DOALLOCATE(FP) JUMP0 (__doallocate, FP)
#define _IO_WDOALLOCATE(FP) WJUMP0 (__doallocate, FP)
/* The following four hooks (sysread, syswrite, sysclose, sysseek, and
sysstat) are low-level hooks specific to this implementation.
There is no correspondence in the ANSI/ISO C++ standard library.
The hooks basically correspond to the Unix system functions
(read, write, close, lseek, and stat) except that a _IO_FILE*
parameter is used instead of a integer file descriptor; the default
implementation used for normal files just calls those functions.
The advantage of overriding these functions instead of the higher-level
ones (underflow, overflow etc) is that you can leave all the buffering
higher-level functions. */
/* The 'sysread' hook is used to read data from the external file into
an existing buffer. It generalizes the Unix read(2) function.
It matches the streambuf::sys_read virtual function, which is
specific to this implementation. */
typedef _IO_ssize_t (*_IO_read_t) __PMT ((_IO_FILE *, void *, _IO_ssize_t));
#define _IO_SYSREAD(FP, DATA, LEN) JUMP2 (__read, FP, DATA, LEN)
#define _IO_WSYSREAD(FP, DATA, LEN) WJUMP2 (__read, FP, DATA, LEN)
/* The 'syswrite' hook is used to write data from an existing buffer
to an external file. It generalizes the Unix write(2) function.
It matches the streambuf::sys_write virtual function, which is
specific to this implementation. */
typedef _IO_ssize_t (*_IO_write_t) __PMT ((_IO_FILE *, const void *,
_IO_ssize_t));
#define _IO_SYSWRITE(FP, DATA, LEN) JUMP2 (__write, FP, DATA, LEN)
#define _IO_WSYSWRITE(FP, DATA, LEN) WJUMP2 (__write, FP, DATA, LEN)
/* The 'sysseek' hook is used to re-position an external file.
It generalizes the Unix lseek(2) function.
It matches the streambuf::sys_seek virtual function, which is
specific to this implementation. */
typedef _IO_off64_t (*_IO_seek_t) __PMT ((_IO_FILE *, _IO_off64_t, int));
#define _IO_SYSSEEK(FP, OFFSET, MODE) JUMP2 (__seek, FP, OFFSET, MODE)
#define _IO_WSYSSEEK(FP, OFFSET, MODE) WJUMP2 (__seek, FP, OFFSET, MODE)
/* The 'sysclose' hook is used to finalize (close, finish up) an
external file. It generalizes the Unix close(2) function.
It matches the streambuf::sys_close virtual function, which is
specific to this implementation. */
typedef int (*_IO_close_t) __PMT ((_IO_FILE *)); /* finalize */
#define _IO_SYSCLOSE(FP) JUMP0 (__close, FP)
#define _IO_WSYSCLOSE(FP) WJUMP0 (__close, FP)
/* The 'sysstat' hook is used to get information about an external file
into a struct stat buffer. It generalizes the Unix fstat(2) call.
It matches the streambuf::sys_stat virtual function, which is
specific to this implementation. */
typedef int (*_IO_stat_t) __PMT ((_IO_FILE *, void *));
#define _IO_SYSSTAT(FP, BUF) JUMP1 (__stat, FP, BUF)
#define _IO_WSYSSTAT(FP, BUF) WJUMP1 (__stat, FP, BUF)
/* The 'showmany' hook can be used to get an image how much input is
available. In many cases the answer will be 0 which means unknown
but some cases one can provide real information. */
typedef int (*_IO_showmanyc_t) __PMT ((_IO_FILE *));
#define _IO_SHOWMANYC(FP) JUMP0 (__showmanyc, FP)
#define _IO_WSHOWMANYC(FP) WJUMP0 (__showmanyc, FP)
/* The 'imbue' hook is used to get information about the currently
installed locales. */
typedef void (*_IO_imbue_t) __PMT ((_IO_FILE *, void *));
#define _IO_IMBUE(FP, LOCALE) JUMP1 (__imbue, FP, LOCALE)
#define _IO_WIMBUE(FP, LOCALE) WJUMP1 (__imbue, FP, LOCALE)
#define _IO_CHAR_TYPE char /* unsigned char ? */
#define _IO_INT_TYPE int
struct _IO_jump_t
{
JUMP_FIELD(_G_size_t, __dummy);
#if _G_USING_THUNKS
JUMP_FIELD(_G_size_t, __dummy2);
#endif
JUMP_FIELD(_IO_finish_t, __finish);
JUMP_FIELD(_IO_overflow_t, __overflow);
JUMP_FIELD(_IO_underflow_t, __underflow);
JUMP_FIELD(_IO_underflow_t, __uflow);
JUMP_FIELD(_IO_pbackfail_t, __pbackfail);
/* showmany */
JUMP_FIELD(_IO_xsputn_t, __xsputn);
JUMP_FIELD(_IO_xsgetn_t, __xsgetn);
JUMP_FIELD(_IO_seekoff_t, __seekoff);
JUMP_FIELD(_IO_seekpos_t, __seekpos);
JUMP_FIELD(_IO_setbuf_t, __setbuf);
JUMP_FIELD(_IO_sync_t, __sync);
JUMP_FIELD(_IO_doallocate_t, __doallocate);
JUMP_FIELD(_IO_read_t, __read);
JUMP_FIELD(_IO_write_t, __write);
JUMP_FIELD(_IO_seek_t, __seek);
JUMP_FIELD(_IO_close_t, __close);
JUMP_FIELD(_IO_stat_t, __stat);
JUMP_FIELD(_IO_showmanyc_t, __showmanyc);
JUMP_FIELD(_IO_imbue_t, __imbue);
#if 0
get_column;
set_column;
#endif
};
/* We always allocate an extra word following an _IO_FILE.
This contains a pointer to the function jump table used.
This is for compatibility with C++ streambuf; the word can
be used to smash to a pointer to a virtual function table. */
struct _IO_FILE_plus
{
_IO_FILE file;
const struct _IO_jump_t *vtable;
};
/* Special file type for fopencookie function. */
struct _IO_cookie_file
{
struct _IO_FILE_plus __fp;
void *__cookie;
_IO_cookie_io_functions_t __io_functions;
};
/* Iterator type for walking global linked list of _IO_FILE objects. */
typedef struct _IO_FILE *_IO_ITER;
/* Generic functions */
extern void _IO_switch_to_main_get_area __P ((_IO_FILE *));
extern void _IO_switch_to_backup_area __P ((_IO_FILE *));
extern int _IO_switch_to_get_mode __P ((_IO_FILE *));
extern void _IO_init __P ((_IO_FILE *, int));
extern int _IO_sputbackc __P ((_IO_FILE *, int));
extern int _IO_sungetc __P ((_IO_FILE *));
extern void _IO_un_link __P ((struct _IO_FILE_plus *));
extern void _IO_link_in __P ((struct _IO_FILE_plus *));
extern void _IO_doallocbuf __P ((_IO_FILE *));
extern void _IO_unsave_markers __P ((_IO_FILE *));
extern void _IO_setb __P ((_IO_FILE *, char *, char *, int));
extern unsigned _IO_adjust_column __P ((unsigned, const char *, int));
#define _IO_sputn(__fp, __s, __n) _IO_XSPUTN (__fp, __s, __n)
extern void _IO_switch_to_main_wget_area __P ((_IO_FILE *));
extern void _IO_switch_to_wbackup_area __P ((_IO_FILE *));
extern int _IO_switch_to_wget_mode __P ((_IO_FILE *));
extern void _IO_wsetb __P ((_IO_FILE *, wchar_t *, wchar_t *, int));
extern wint_t _IO_sputbackwc __P ((_IO_FILE *, wint_t));
extern wint_t _IO_sungetwc __P ((_IO_FILE *));
extern void _IO_wdoallocbuf __P ((_IO_FILE *));
extern void _IO_unsave_wmarkers __P ((_IO_FILE *));
extern unsigned _IO_adjust_wcolumn __P ((unsigned, const wchar_t *, int));
/* Marker-related function. */
extern void _IO_init_marker __P ((struct _IO_marker *, _IO_FILE *));
extern void _IO_init_wmarker __P ((struct _IO_marker *, _IO_FILE *));
extern void _IO_remove_marker __P ((struct _IO_marker *));
extern int _IO_marker_difference __P ((struct _IO_marker *,
struct _IO_marker *));
extern int _IO_marker_delta __P ((struct _IO_marker *));
extern int _IO_wmarker_delta __P ((struct _IO_marker *));
extern int _IO_seekmark __P ((_IO_FILE *, struct _IO_marker *, int));
extern int _IO_seekwmark __P ((_IO_FILE *, struct _IO_marker *, int));
/* Functions for iterating global list and dealing with
its lock */
extern _IO_ITER _IO_iter_begin __P ((void));
extern _IO_ITER _IO_iter_end __P ((void));
extern _IO_ITER _IO_iter_next __P ((_IO_ITER));
extern _IO_FILE *_IO_iter_file __P ((_IO_ITER));
extern void _IO_list_lock __P ((void));
extern void _IO_list_unlock __P ((void));
extern void _IO_list_resetlock __P ((void));
/* Default jumptable functions. */
extern int _IO_default_underflow __P ((_IO_FILE *));
extern int _IO_default_uflow __P ((_IO_FILE *));
extern wint_t _IO_wdefault_uflow __P ((_IO_FILE *));
extern int _IO_default_doallocate __P ((_IO_FILE *));
extern int _IO_wdefault_doallocate __P ((_IO_FILE *));
extern void _IO_default_finish __P ((_IO_FILE *, int));
extern void _IO_wdefault_finish __P ((_IO_FILE *, int));
extern int _IO_default_pbackfail __P ((_IO_FILE *, int));
extern wint_t _IO_wdefault_pbackfail __P ((_IO_FILE *, wint_t));
extern _IO_FILE* _IO_default_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
extern _IO_FILE* _IO_wdefault_setbuf __P ((_IO_FILE *, wchar_t *,
_IO_ssize_t));
extern _IO_size_t _IO_default_xsputn __P ((_IO_FILE *, const void *,
_IO_size_t));
extern _IO_size_t _IO_wdefault_xsputn __P ((_IO_FILE *, const void *,
_IO_size_t));
extern _IO_size_t _IO_default_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
extern _IO_size_t _IO_wdefault_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
extern _IO_off64_t _IO_default_seekoff __P ((_IO_FILE *,
_IO_off64_t, int, int));
extern _IO_off64_t _IO_default_seekpos __P ((_IO_FILE *, _IO_off64_t, int));
extern _IO_ssize_t _IO_default_write __P ((_IO_FILE *, const void *,
_IO_ssize_t));
extern _IO_ssize_t _IO_default_read __P ((_IO_FILE *, void *, _IO_ssize_t));
extern int _IO_default_stat __P ((_IO_FILE *, void *));
extern _IO_off64_t _IO_default_seek __P ((_IO_FILE *, _IO_off64_t, int));
extern int _IO_default_sync __P ((_IO_FILE *));
#define _IO_default_close ((_IO_close_t) _IO_default_sync)
extern int _IO_default_showmanyc __P ((_IO_FILE *));
extern void _IO_default_imbue __P ((_IO_FILE *, void *));
extern struct _IO_jump_t _IO_file_jumps;
extern struct _IO_jump_t _IO_wfile_jumps;
extern struct _IO_jump_t _IO_old_file_jumps;
extern struct _IO_jump_t _IO_streambuf_jumps;
extern struct _IO_jump_t _IO_proc_jumps;
extern struct _IO_jump_t _IO_old_proc_jumps;
extern struct _IO_jump_t _IO_str_jumps;
extern struct _IO_jump_t _IO_wstr_jumps;
extern struct _IO_codecvt __libio_codecvt;
extern int _IO_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
extern int _IO_new_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
extern int _IO_old_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
extern int _IO_wdo_write __P ((_IO_FILE *, const wchar_t *, _IO_size_t));
extern int _IO_flush_all __P ((void));
extern int _IO_cleanup __P ((void));
extern void _IO_flush_all_linebuffered __P ((void));
extern int _IO_new_fgetpos __P ((_IO_FILE *, _IO_fpos_t *));
extern int _IO_old_fgetpos __P ((_IO_FILE *, _IO_fpos_t *));
extern int _IO_new_fsetpos __P ((_IO_FILE *, const _IO_fpos_t *));
extern int _IO_old_fsetpos __P ((_IO_FILE *, const _IO_fpos_t *));
extern int _IO_new_fgetpos64 __P ((_IO_FILE *, _IO_fpos64_t *));
extern int _IO_old_fgetpos64 __P ((_IO_FILE *, _IO_fpos64_t *));
extern int _IO_new_fsetpos64 __P ((_IO_FILE *, const _IO_fpos64_t *));
extern int _IO_old_fsetpos64 __P ((_IO_FILE *, const _IO_fpos64_t *));
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
# define _IO_do_flush(_f) \
((_f)->_mode <= 0 \
? _IO_do_write(_f, (_f)->_IO_write_base, \
(_f)->_IO_write_ptr-(_f)->_IO_write_base) \
: _IO_wdo_write(_f, (_f)->_wide_data->_IO_write_base, \
((_f)->_wide_data->_IO_write_ptr \
- (_f)->_wide_data->_IO_write_base)))
#else
# define _IO_do_flush(_f) \
_IO_do_write(_f, (_f)->_IO_write_base, \
(_f)->_IO_write_ptr-(_f)->_IO_write_base)
#endif
#define _IO_old_do_flush(_f) \
_IO_old_do_write(_f, (_f)->_IO_write_base, \
(_f)->_IO_write_ptr-(_f)->_IO_write_base)
#define _IO_in_put_mode(_fp) ((_fp)->_flags & _IO_CURRENTLY_PUTTING)
#define _IO_mask_flags(fp, f, mask) \
((fp)->_flags = ((fp)->_flags & ~(mask)) | ((f) & (mask)))
#define _IO_setg(fp, eb, g, eg) ((fp)->_IO_read_base = (eb),\
(fp)->_IO_read_ptr = (g), (fp)->_IO_read_end = (eg))
#define _IO_wsetg(fp, eb, g, eg) ((fp)->_wide_data->_IO_read_base = (eb),\
(fp)->_wide_data->_IO_read_ptr = (g), \
(fp)->_wide_data->_IO_read_end = (eg))
#define _IO_setp(__fp, __p, __ep) \
((__fp)->_IO_write_base = (__fp)->_IO_write_ptr \
= __p, (__fp)->_IO_write_end = (__ep))
#define _IO_wsetp(__fp, __p, __ep) \
((__fp)->_wide_data->_IO_write_base \
= (__fp)->_wide_data->_IO_write_ptr = __p, \
(__fp)->_wide_data->_IO_write_end = (__ep))
#define _IO_have_backup(fp) ((fp)->_IO_save_base != NULL)
#define _IO_have_wbackup(fp) ((fp)->_wide_data->_IO_save_base != NULL)
#define _IO_in_backup(fp) ((fp)->_flags & _IO_IN_BACKUP)
#define _IO_have_markers(fp) ((fp)->_markers != NULL)
#define _IO_blen(fp) ((fp)->_IO_buf_end - (fp)->_IO_buf_base)
#define _IO_wblen(fp) ((fp)->_wide_data->_IO_buf_end \
- (fp)->_wide_data->_IO_buf_base)
/* Jumptable functions for files. */
extern int _IO_file_doallocate __P ((_IO_FILE *));
extern _IO_FILE* _IO_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
extern _IO_off64_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
extern _IO_size_t _IO_file_xsputn __P ((_IO_FILE *, const void *, _IO_size_t));
extern _IO_size_t _IO_file_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
extern int _IO_file_stat __P ((_IO_FILE *, void *));
extern int _IO_file_close __P ((_IO_FILE *));
extern int _IO_file_underflow __P ((_IO_FILE *));
extern int _IO_file_overflow __P ((_IO_FILE *, int));
#define _IO_file_is_open(__fp) ((__fp)->_fileno != -1)
extern void _IO_file_init __P ((struct _IO_FILE_plus *));
extern _IO_FILE* _IO_file_attach __P ((_IO_FILE *, int));
extern _IO_FILE* _IO_file_open __P ((_IO_FILE *, const char *, int, int,
int, int));
extern _IO_FILE* _IO_file_fopen __P ((_IO_FILE *, const char *, const char *,
int));
extern _IO_ssize_t _IO_file_write __P ((_IO_FILE *, const void *,
_IO_ssize_t));
extern _IO_ssize_t _IO_file_read __P ((_IO_FILE *, void *, _IO_ssize_t));
extern int _IO_file_sync __P ((_IO_FILE *));
extern int _IO_file_close_it __P ((_IO_FILE *));
extern _IO_off64_t _IO_file_seek __P ((_IO_FILE *, _IO_off64_t, int));
extern void _IO_file_finish __P ((_IO_FILE *, int));
extern _IO_FILE* _IO_new_file_attach __P ((_IO_FILE *, int));
extern int _IO_new_file_close_it __P ((_IO_FILE *));
extern void _IO_new_file_finish __P ((_IO_FILE *, int));
extern _IO_FILE* _IO_new_file_fopen __P ((_IO_FILE *, const char *, const char *,
int));
extern void _IO_no_init __P ((_IO_FILE *, int, int, struct _IO_wide_data *,
struct _IO_jump_t *));
extern void _IO_new_file_init __P ((struct _IO_FILE_plus *));
extern _IO_FILE* _IO_new_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
extern int _IO_new_file_sync __P ((_IO_FILE *));
extern int _IO_new_file_underflow __P ((_IO_FILE *));
extern int _IO_new_file_overflow __P ((_IO_FILE *, int));
extern _IO_off64_t _IO_new_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
extern _IO_ssize_t _IO_new_file_write __P ((_IO_FILE *, const void *,
_IO_ssize_t));
extern _IO_size_t _IO_new_file_xsputn __P ((_IO_FILE *, const void *, _IO_size_t));
extern _IO_FILE* _IO_old_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
extern _IO_off64_t _IO_old_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int,
int));
extern _IO_size_t _IO_old_file_xsputn __P ((_IO_FILE *, const void *,
_IO_size_t));
extern int _IO_old_file_underflow __P ((_IO_FILE *));
extern int _IO_old_file_overflow __P ((_IO_FILE *, int));
extern void _IO_old_file_init __P ((struct _IO_FILE_plus *));
extern _IO_FILE* _IO_old_file_attach __P ((_IO_FILE *, int));
extern _IO_FILE* _IO_old_file_fopen __P ((_IO_FILE *, const char *,
const char *));
extern _IO_ssize_t _IO_old_file_write __P ((_IO_FILE *, const void *,
_IO_ssize_t));
extern int _IO_old_file_sync __P ((_IO_FILE *));
extern int _IO_old_file_close_it __P ((_IO_FILE *));
extern void _IO_old_file_finish __P ((_IO_FILE *, int));
extern int _IO_wfile_doallocate __P ((_IO_FILE *));
extern _IO_size_t _IO_wfile_xsputn __P ((_IO_FILE *, const void *,
_IO_size_t));
extern _IO_FILE* _IO_wfile_setbuf __P ((_IO_FILE *, wchar_t *, _IO_ssize_t));
extern wint_t _IO_wfile_sync __P ((_IO_FILE *));
extern wint_t _IO_wfile_underflow __P ((_IO_FILE *));
extern wint_t _IO_wfile_overflow __P ((_IO_FILE *, wint_t));
extern _IO_off64_t _IO_wfile_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
/* Jumptable functions for proc_files. */
extern _IO_FILE* _IO_proc_open __P ((_IO_FILE *, const char *, const char *));
extern _IO_FILE* _IO_new_proc_open __P ((_IO_FILE *, const char *, const char *));
extern _IO_FILE* _IO_old_proc_open __P ((_IO_FILE *, const char *, const char *));
extern int _IO_proc_close __P ((_IO_FILE *));
extern int _IO_new_proc_close __P ((_IO_FILE *));
extern int _IO_old_proc_close __P ((_IO_FILE *));
/* Jumptable functions for strfiles. */
extern int _IO_str_underflow __P ((_IO_FILE *));
extern int _IO_str_overflow __P ((_IO_FILE *, int));
extern int _IO_str_pbackfail __P ((_IO_FILE *, int));
extern _IO_off64_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
extern void _IO_str_finish __P ((_IO_FILE *, int));
/* Other strfile functions */
struct _IO_strfile_;
extern void _IO_str_init_static __P ((struct _IO_strfile_ *, char *, int, char *));
extern void _IO_str_init_readonly __P ((struct _IO_strfile_ *, const char *, int));
extern _IO_ssize_t _IO_str_count __P ((_IO_FILE *));
/* And the wide character versions. */
extern void _IO_wstr_init_static __P ((_IO_FILE *, wchar_t *, int, wchar_t *));
extern void _IO_wstr_init_readonly __P ((_IO_FILE *, const char *, int));
extern _IO_ssize_t _IO_wstr_count __P ((_IO_FILE *));
extern _IO_wint_t _IO_wstr_overflow __P ((_IO_FILE *, _IO_wint_t));
extern _IO_wint_t _IO_wstr_underflow __P ((_IO_FILE *));
extern _IO_off64_t _IO_wstr_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
extern _IO_wint_t _IO_wstr_pbackfail __P ((_IO_FILE *, _IO_wint_t));
extern void _IO_wstr_finish __P ((_IO_FILE *, int));
extern int _IO_vasprintf __P ((char **result_ptr, __const char *format,
_IO_va_list args));
extern int _IO_vdprintf __P ((int d, __const char *format, _IO_va_list arg));
extern int _IO_vsnprintf __P ((char *string, _IO_size_t maxlen,
__const char *format, _IO_va_list args));
extern _IO_size_t _IO_getline __P ((_IO_FILE *,char *, _IO_size_t, int, int));
extern _IO_size_t _IO_getline_info __P ((_IO_FILE *,char *, _IO_size_t,
int, int, int *));
extern _IO_ssize_t _IO_getdelim __P ((char **, _IO_size_t *, int, _IO_FILE *));
extern _IO_size_t _IO_getwline __P ((_IO_FILE *,wchar_t *, _IO_size_t, wint_t,
int));
extern _IO_size_t _IO_getwline_info __P ((_IO_FILE *,wchar_t *, _IO_size_t,
wint_t, int, wint_t *));
extern double _IO_strtod __P ((const char *, char **));
extern char *_IO_dtoa __P ((double __d, int __mode, int __ndigits,
int *__decpt, int *__sign, char **__rve));
extern int _IO_outfloat __P ((double __value, _IO_FILE *__sb, int __type,
int __width, int __precision, int __flags,
int __sign_mode, int __fill));
extern struct _IO_FILE_plus *_IO_list_all;
extern void (*_IO_cleanup_registration_needed) __PMT ((void));
#ifndef EOF
# define EOF (-1)
#endif
#ifndef NULL
# if defined __GNUG__ && \
(__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
# define NULL (__null)
# else
# if !defined(__cplusplus)
# define NULL ((void*)0)
# else
# define NULL (0)
# endif
# endif
#endif
#if _G_HAVE_MMAP
#ifdef __cplusplus
}
#endif
# include <unistd.h>
# include <fcntl.h>
# include <sys/mman.h>
# include <sys/param.h>
#ifdef __cplusplus
extern "C" {
#endif
# if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
# define MAP_ANONYMOUS MAP_ANON
# endif
# if !defined(MAP_ANONYMOUS) || !defined(EXEC_PAGESIZE)
# undef _G_HAVE_MMAP
# define _G_HAVE_MMAP 0
# endif
#endif /* _G_HAVE_MMAP */
#if _G_HAVE_MMAP
# ifdef _LIBC
/* When using this code in the GNU libc we must not pollute the name space. */
# define mmap __mmap
# define munmap __munmap
# define ftruncate __ftruncate
# endif
# define ROUND_TO_PAGE(_S) \
(((_S) + EXEC_PAGESIZE - 1) & ~(EXEC_PAGESIZE - 1))
# define FREE_BUF(_B, _S) \
munmap ((_B), ROUND_TO_PAGE (_S))
# define ALLOC_BUF(_B, _S, _R) \
do { \
(_B) = (char *) mmap (0, ROUND_TO_PAGE (_S), \
PROT_READ | PROT_WRITE, \
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \
if ((_B) == (char *) MAP_FAILED) \
return (_R); \
} while (0)
# define ALLOC_WBUF(_B, _S, _R) \
do { \
(_B) = (wchar_t *) mmap (0, ROUND_TO_PAGE (_S), \
PROT_READ | PROT_WRITE, \
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \
if ((_B) == (wchar_t *) MAP_FAILED) \
return (_R); \
} while (0)
#else /* _G_HAVE_MMAP */
# define FREE_BUF(_B, _S) \
free(_B)
# define ALLOC_BUF(_B, _S, _R) \
do { \
(_B) = (char*)malloc(_S); \
if ((_B) == NULL) \
return (_R); \
} while (0)
# define ALLOC_WBUF(_B, _S, _R) \
do { \
(_B) = (wchar_t *)malloc(_S); \
if ((_B) == NULL) \
return (_R); \
} while (0)
#endif /* _G_HAVE_MMAP */
#ifndef OS_FSTAT
# define OS_FSTAT fstat
#endif
struct stat;
extern _IO_ssize_t _IO_read __P ((int, void *, _IO_size_t));
extern _IO_ssize_t _IO_write __P ((int, const void *, _IO_size_t));
extern _IO_off64_t _IO_lseek __P ((int, _IO_off64_t, int));
extern int _IO_close __P ((int));
extern int _IO_fstat __P ((int, struct stat *));
extern int _IO_vscanf __P ((const char *, _IO_va_list));
/* _IO_pos_BAD is an _IO_off64_t value indicating error, unknown, or EOF. */
#ifndef _IO_pos_BAD
# define _IO_pos_BAD ((_IO_off64_t) -1)
#endif
/* _IO_pos_adjust adjust an _IO_off64_t by some number of bytes. */
#ifndef _IO_pos_adjust
# define _IO_pos_adjust(pos, delta) ((pos) += (delta))
#endif
/* _IO_pos_0 is an _IO_off64_t value indicating beginning of file. */
#ifndef _IO_pos_0
# define _IO_pos_0 ((_IO_off64_t) 0)
#endif
#ifdef __cplusplus
}
#endif
#ifdef _IO_MTSAFE_IO
/* check following! */
# ifdef _IO_USE_OLD_IO_FILE
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock }
# else
# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\
NULL, WDP, 0 }
# else
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\
0 }
# endif
# endif
#else
# ifdef _IO_USE_OLD_IO_FILE
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
0, _IO_pos_BAD }
# else
# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD, \
NULL, WDP, 0 }
# else
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD, \
0 }
# endif
# endif
#endif
/* VTABLE_LABEL defines NAME as of the CLASS class.
CNLENGTH is strlen(#CLASS). */
#ifdef __GNUC__
# if _G_VTABLE_LABEL_HAS_LENGTH
# define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
extern char NAME[] asm (_G_VTABLE_LABEL_PREFIX #CNLENGTH #CLASS);
# else
# define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
extern char NAME[] asm (_G_VTABLE_LABEL_PREFIX #CLASS);
# endif
#endif /* __GNUC__ */
#if !defined(builtinbuf_vtable) && defined(__cplusplus)
# ifdef __GNUC__
VTABLE_LABEL(builtinbuf_vtable, builtinbuf, 10)
# else
# if _G_VTABLE_LABEL_HAS_LENGTH
# define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##10builtinbuf
# else
# define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##builtinbuf
# endif
# endif
#endif /* !defined(builtinbuf_vtable) && defined(__cplusplus) */
#if defined(__STDC__) || defined(__cplusplus)
# define _IO_va_start(args, last) va_start(args, last)
#else
# define _IO_va_start(args, last) va_start(args)
#endif
extern struct _IO_fake_stdiobuf _IO_stdin_buf, _IO_stdout_buf, _IO_stderr_buf;
#if 1
# define COERCE_FILE(FILE) /* Nothing */
#else
/* This is part of the kludge for binary compatibility with old stdio. */
# define COERCE_FILE(FILE) \
(((FILE)->_IO_file_flags & _IO_MAGIC_MASK) == _OLD_MAGIC_MASK \
&& (FILE) = *(FILE**)&((int*)fp)[1])
#endif
#ifdef EINVAL
# define MAYBE_SET_EINVAL __set_errno (EINVAL)
#else
# define MAYBE_SET_EINVAL /* nothing */
#endif
#ifdef IO_DEBUG
# define CHECK_FILE(FILE, RET) \
if ((FILE) == NULL) { MAYBE_SET_EINVAL; return RET; } \
else { COERCE_FILE(FILE); \
if (((FILE)->_IO_file_flags & _IO_MAGIC_MASK) != _IO_MAGIC) \
{ MAYBE_SET_EINVAL; return RET; }}
#else
# define CHECK_FILE(FILE, RET) COERCE_FILE (FILE)
#endif

View File

@ -1,71 +0,0 @@
/* Copyright (C) 1993, 1994, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
/* This file provides definitions of _IO_stdin, _IO_stdout, and _IO_stderr
for C code. Compare stdstreams.cc.
(The difference is that here the vtable field is set to 0,
so the objects defined are not valid C++ objects. On the other
hand, we don't need a C++ compiler to build this file.) */
#include "libioP.h"
#ifdef _IO_MTSAFE_IO
# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
static struct _IO_wide_data _IO_wide_data_##FD \
= { ._wide_vtable = &_IO_wfile_jumps }; \
struct _IO_FILE_plus NAME \
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \
&_IO_file_jumps};
# else
# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
struct _IO_FILE_plus NAME \
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), \
&_IO_file_jumps};
# endif
#else
# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
static struct _IO_wide_data _IO_wide_data_##FD \
= { ._wide_vtable = &_IO_wfile_jumps }; \
struct _IO_FILE_plus NAME \
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \
&_IO_file_jumps};
# else
# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
struct _IO_FILE_plus NAME \
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), \
&_IO_file_jumps};
# endif
#endif
DEF_STDFILE(_IO_2_1_stdin_, 0, 0, _IO_NO_WRITES);
DEF_STDFILE(_IO_2_1_stdout_, 1, &_IO_2_1_stdin_, _IO_NO_READS);
DEF_STDFILE(_IO_2_1_stderr_, 2, &_IO_2_1_stdout_, _IO_NO_READS+_IO_UNBUFFERED);
struct _IO_FILE_plus *_IO_list_all = &_IO_2_1_stderr_;

View File

@ -1,43 +0,0 @@
/* Copyright (C) 1993, 1994, 1996, 1997, 2000 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"
#undef stdin
#undef stdout
#undef stderr
_IO_FILE *stdin = (FILE *) &_IO_2_1_stdin_;
_IO_FILE *stdout = (FILE *) &_IO_2_1_stdout_;
_IO_FILE *stderr = (FILE *) &_IO_2_1_stderr_;
#undef _IO_stdin
#undef _IO_stdout
#undef _IO_stderr
#ifdef _LIBC
strong_alias (stdin, _IO_stdin);
strong_alias (stdout, _IO_stdout);
strong_alias (stderr, _IO_stderr);
#endif

View File

@ -1,108 +0,0 @@
/* Copyright (C) 1993, 1997, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* Modified for GNU iostream by Per Bothner 1991, 1992. */
#ifndef _POSIX_SOURCE
# define _POSIX_SOURCE
#endif
#include "libioP.h"
#ifdef _GLIBCPP_USE_WCHAR_T
#include <sys/types.h>
#include <sys/stat.h>
#ifdef __STDC__
#include <stdlib.h>
#include <unistd.h>
#endif
#ifdef _LIBC
# undef isatty
# define isatty(Fd) __isatty (Fd)
#endif
/*
* Allocate a file buffer, or switch to unbuffered I/O.
* Per the ANSI C standard, ALL tty devices default to line buffered.
*
* As a side effect, we set __SOPT or __SNPT (en/dis-able fseek
* optimisation) right after the _fstat() that finds the buffer size.
*/
int
_IO_wfile_doallocate (fp)
_IO_FILE *fp;
{
_IO_size_t size;
int couldbetty;
wchar_t *p;
struct _G_stat64 st;
/* Allocate room for the external buffer. */
if (fp->_IO_buf_base == NULL)
_IO_file_doallocate (fp);
if (fp->_fileno < 0 || _IO_SYSSTAT (fp, &st) < 0)
{
couldbetty = 0;
size = _IO_BUFSIZ;
#if 0
/* do not try to optimise fseek() */
fp->_flags |= __SNPT;
#endif
}
else
{
couldbetty = S_ISCHR (st.st_mode);
#if _IO_HAVE_ST_BLKSIZE
size = st.st_blksize <= 0 ? _IO_BUFSIZ : st.st_blksize;
#else
size = _IO_BUFSIZ;
#endif
}
ALLOC_WBUF (p, size * sizeof (wchar_t), EOF);
_IO_wsetb (fp, p, p + size, 1);
if (couldbetty && isatty (fp->_fileno))
fp->_flags |= _IO_LINE_BUF;
return 1;
}
#endif /* _GLIBCPP_USE_WCHAR_T */

View File

@ -1,754 +0,0 @@
/* Copyright (C) 1993, 95, 97, 98, 99, 2000 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
Written by Ulrich Drepper <drepper@cygnus.com>.
Based on the single byte version by Per Bothner <bothner@cygnus.com>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include <assert.h>
#include <libioP.h>
#ifdef _GLIBCPP_USE_WCHAR_T
#include <wchar.h>
#ifdef HAVE_GCONV_H
# include <gconv.h>
#endif
#include <stdlib.h>
#include <string.h>
#ifndef _LIBC
# define _IO_new_do_write _IO_do_write
# define _IO_new_file_attach _IO_file_attach
# define _IO_new_file_close_it _IO_file_close_it
# define _IO_new_file_finish _IO_file_finish
# define _IO_new_file_fopen _IO_file_fopen
# define _IO_new_file_init _IO_file_init
# define _IO_new_file_setbuf _IO_file_setbuf
# define _IO_new_file_sync _IO_file_sync
# define _IO_new_file_overflow _IO_file_overflow
# define _IO_new_file_seekoff _IO_file_seekoff
# define _IO_new_file_underflow _IO_file_underflow
# define _IO_new_file_write _IO_file_write
# define _IO_new_file_xsputn _IO_file_xsputn
#endif
_IO_FILE *
_IO_wfile_setbuf (fp, p, len)
_IO_FILE *fp;
wchar_t *p;
_IO_ssize_t len;
{
if (_IO_wdefault_setbuf (fp, p, len) == NULL)
return NULL;
fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr =
fp->_wide_data->_IO_write_end = fp->_wide_data->_IO_buf_base;
_IO_wsetg (fp, fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base,
fp->_wide_data->_IO_buf_base);
return fp;
}
/* Convert TO_DO wide character from DATA to FP.
Then mark FP as having empty buffers. */
int
_IO_wdo_write (fp, data, to_do)
_IO_FILE *fp;
const wchar_t *data;
_IO_size_t to_do;
{
struct _IO_codecvt *cc = fp->_codecvt;
if (to_do > 0)
{
if (fp->_IO_write_end == fp->_IO_write_ptr
&& fp->_IO_write_end != fp->_IO_write_base)
{
if (_IO_new_do_write (fp, fp->_IO_write_base,
fp->_IO_write_ptr - fp->_IO_write_base) == EOF)
return EOF;
}
do
{
enum __codecvt_result result;
const wchar_t *new_data;
/* Now convert from the internal format into the external buffer. */
result = (*cc->__codecvt_do_out) (cc, &fp->_wide_data->_IO_state,
data, data + to_do, &new_data,
fp->_IO_write_ptr,
fp->_IO_buf_end,
&fp->_IO_write_ptr);
/* Write out what we produced so far. */
if (_IO_new_do_write (fp, fp->_IO_write_base,
fp->_IO_write_ptr - fp->_IO_write_base) == EOF)
/* Something went wrong. */
return EOF;
to_do -= new_data - data;
/* Next see whether we had problems during the conversion. If yes,
we cannot go on. */
if (result != __codecvt_ok
&& (result != __codecvt_partial || new_data - data == 0))
break;
data = new_data;
}
while (to_do > 0);
}
_IO_wsetg (fp, fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base,
fp->_wide_data->_IO_buf_base);
fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr
= fp->_wide_data->_IO_buf_base;
fp->_wide_data->_IO_write_end = ((fp->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
? fp->_wide_data->_IO_buf_base
: fp->_wide_data->_IO_buf_end);
return to_do == 0 ? 0 : WEOF;
}
wint_t
_IO_wfile_underflow (fp)
_IO_FILE *fp;
{
struct _IO_codecvt *cd;
enum __codecvt_result status;
_IO_ssize_t count;
int tries;
const char *read_ptr_copy;
if (fp->_flags & _IO_NO_READS)
{
fp->_flags |= _IO_ERR_SEEN;
__set_errno (EBADF);
return WEOF;
}
if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
return *fp->_wide_data->_IO_read_ptr;
cd = fp->_codecvt;
/* Maybe there is something left in the external buffer. */
if (fp->_IO_read_ptr < fp->_IO_read_end)
{
/* Convert it. */
size_t avail_bytes = fp->_IO_read_end - fp->_IO_read_ptr;
if (avail_bytes >= (*cd->__codecvt_do_max_length) (cd))
{
/* There is more in the external. */
const char *read_stop = (const char *) fp->_IO_read_ptr;
fp->_wide_data->_IO_last_state = fp->_wide_data->_IO_state;
status = (*cd->__codecvt_do_in) (cd, &fp->_wide_data->_IO_state,
fp->_IO_read_ptr, fp->_IO_read_end,
&read_stop,
fp->_wide_data->_IO_read_end,
fp->_wide_data->_IO_buf_end,
&fp->_wide_data->_IO_read_end);
fp->_IO_read_ptr = (char *) read_stop;
/* If we managed to generate some text return the next character. */
if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
return *fp->_wide_data->_IO_read_ptr;
if (status == __codecvt_error)
{
__set_errno (EILSEQ);
fp->_flags |= _IO_ERR_SEEN;
return WEOF;
}
}
/* Move the remaining content of the read buffer to the beginning. */
memmove (fp->_IO_buf_base, fp->_IO_read_ptr,
fp->_IO_read_end - fp->_IO_read_ptr);
fp->_IO_read_end = (fp->_IO_buf_base
+ (fp->_IO_read_end - fp->_IO_read_ptr));
fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_buf_base;
}
else
fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_read_end =
fp->_IO_buf_base;
if (fp->_IO_buf_base == NULL)
{
/* Maybe we already have a push back pointer. */
if (fp->_IO_save_base != NULL)
{
free (fp->_IO_save_base);
fp->_flags &= ~_IO_IN_BACKUP;
}
_IO_doallocbuf (fp);
fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_read_end =
fp->_IO_buf_base;
}
fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end =
fp->_IO_buf_base;
if (fp->_wide_data->_IO_buf_base == NULL)
{
/* Maybe we already have a push back pointer. */
if (fp->_wide_data->_IO_save_base != NULL)
{
free (fp->_wide_data->_IO_save_base);
fp->_flags &= ~_IO_IN_BACKUP;
}
_IO_wdoallocbuf (fp);
}
/* Flush all line buffered files before reading. */
/* FIXME This can/should be moved to genops ?? */
if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED))
_IO_flush_all_linebuffered ();
_IO_switch_to_get_mode (fp);
fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_ptr =
fp->_wide_data->_IO_buf_base;
fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_buf_base;
fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr =
fp->_wide_data->_IO_write_end = fp->_wide_data->_IO_buf_base;
tries = 0;
again:
count = _IO_SYSREAD (fp, fp->_IO_read_end,
fp->_IO_buf_end - fp->_IO_read_end);
if (count <= 0)
{
if (count == 0 && tries == 0)
fp->_flags |= _IO_EOF_SEEN;
else
fp->_flags |= _IO_ERR_SEEN, count = 0;
}
fp->_IO_read_end += count;
if (count == 0)
{
if (tries != 0)
/* There are some bytes in the external buffer but they don't
convert to anything. */
__set_errno (EILSEQ);
return WEOF;
}
if (fp->_offset != _IO_pos_BAD)
_IO_pos_adjust (fp->_offset, count);
/* Now convert the read input. */
fp->_wide_data->_IO_last_state = fp->_wide_data->_IO_state;
fp->_IO_read_base = fp->_IO_read_ptr;
status = (*cd->__codecvt_do_in) (cd, &fp->_wide_data->_IO_state,
fp->_IO_read_ptr, fp->_IO_read_end,
&read_ptr_copy,
fp->_wide_data->_IO_read_end,
fp->_wide_data->_IO_buf_end,
&fp->_wide_data->_IO_read_end);
fp->_IO_read_ptr = (char *) read_ptr_copy;
if (fp->_wide_data->_IO_read_end == fp->_wide_data->_IO_buf_base)
{
if (status == __codecvt_error || fp->_IO_read_end == fp->_IO_buf_end)
{
__set_errno (EILSEQ);
fp->_flags |= _IO_ERR_SEEN;
return WEOF;
}
/* The read bytes make no complete character. Try reading again. */
assert (status == __codecvt_partial);
++tries;
goto again;
}
return *fp->_wide_data->_IO_read_ptr;
}
wint_t
_IO_wfile_overflow (f, wch)
_IO_FILE *f;
wint_t wch;
{
if (f->_flags & _IO_NO_WRITES) /* SET ERROR */
{
f->_flags |= _IO_ERR_SEEN;
__set_errno (EBADF);
return WEOF;
}
/* If currently reading or no buffer allocated. */
if ((f->_flags & _IO_CURRENTLY_PUTTING) == 0)
{
/* Allocate a buffer if needed. */
if (f->_wide_data->_IO_write_base == 0)
{
_IO_wdoallocbuf (f);
_IO_wsetg (f, f->_wide_data->_IO_buf_base,
f->_wide_data->_IO_buf_base, f->_wide_data->_IO_buf_base);
if (f->_IO_write_base == NULL)
{
_IO_doallocbuf (f);
_IO_setg (f, f->_IO_buf_base, f->_IO_buf_base, f->_IO_buf_base);
}
}
else
{
/* Otherwise must be currently reading. If _IO_read_ptr
(and hence also _IO_read_end) is at the buffer end,
logically slide the buffer forwards one block (by setting
the read pointers to all point at the beginning of the
block). This makes room for subsequent output.
Otherwise, set the read pointers to _IO_read_end (leaving
that alone, so it can continue to correspond to the
external position). */
if (f->_wide_data->_IO_read_ptr == f->_wide_data->_IO_buf_end)
{
f->_IO_read_end = f->_IO_read_ptr = f->_IO_buf_base;
f->_wide_data->_IO_read_end = f->_wide_data->_IO_read_ptr =
f->_wide_data->_IO_buf_base;
}
}
f->_wide_data->_IO_write_ptr = f->_wide_data->_IO_read_ptr;
f->_wide_data->_IO_write_base = f->_wide_data->_IO_write_ptr;
f->_wide_data->_IO_write_end = f->_wide_data->_IO_buf_end;
f->_wide_data->_IO_read_base = f->_wide_data->_IO_read_ptr =
f->_wide_data->_IO_read_end;
f->_IO_write_ptr = f->_IO_read_ptr;
f->_IO_write_base = f->_IO_write_ptr;
f->_IO_write_end = f->_IO_buf_end;
f->_IO_read_base = f->_IO_read_ptr = f->_IO_read_end;
f->_flags |= _IO_CURRENTLY_PUTTING;
if (f->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
f->_wide_data->_IO_write_end = f->_wide_data->_IO_write_ptr;
}
if (wch == WEOF)
return _IO_do_flush (f);
if (f->_wide_data->_IO_write_ptr == f->_wide_data->_IO_buf_end)
/* Buffer is really full */
if (_IO_do_flush (f) == WEOF)
return WEOF;
*f->_wide_data->_IO_write_ptr++ = wch;
if ((f->_flags & _IO_UNBUFFERED)
|| ((f->_flags & _IO_LINE_BUF) && wch == L'\n'))
if (_IO_do_flush (f) == WEOF)
return WEOF;
return wch;
}
wint_t
_IO_wfile_sync (fp)
_IO_FILE *fp;
{
_IO_ssize_t delta;
wint_t retval = 0;
/* char* ptr = cur_ptr(); */
if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_write_base)
if (_IO_do_flush (fp))
return WEOF;
delta = fp->_wide_data->_IO_read_ptr - fp->_wide_data->_IO_read_end;
if (delta != 0)
{
/* We have to find out how many bytes we have to go back in the
external buffer. */
struct _IO_codecvt *cv = fp->_codecvt;
_IO_off64_t new_pos;
int clen = (*cv->__codecvt_do_encoding) (cv);
if (clen > 0)
/* It is easy, a fixed number of input bytes are used for each
wide character. */
delta *= clen;
else
{
/* We have to find out the hard way how much to back off.
To do this we determine how much input we needed to
generate the wide characters up to the current reading
position. */
int nread;
fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state;
nread = (*cv->__codecvt_do_length) (cv, &fp->_wide_data->_IO_state,
fp->_IO_read_base,
fp->_IO_read_end, delta);
fp->_IO_read_ptr = fp->_IO_read_base + nread;
delta = -(fp->_IO_read_end - fp->_IO_read_base - nread);
}
new_pos = _IO_SYSSEEK (fp, delta, 1);
if (new_pos != (_IO_off64_t) EOF)
{
fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_read_ptr;
fp->_IO_read_end = fp->_IO_read_ptr;
}
#ifdef ESPIPE
else if (errno == ESPIPE)
; /* Ignore error from unseekable devices. */
#endif
else
retval = WEOF;
}
if (retval != WEOF)
fp->_offset = _IO_pos_BAD;
/* FIXME: Cleanup - can this be shared? */
/* setg(base(), ptr, ptr); */
return retval;
}
_IO_off64_t
_IO_wfile_seekoff (fp, offset, dir, mode)
_IO_FILE *fp;
_IO_off64_t offset;
int dir;
int mode;
{
_IO_off64_t result;
_IO_off64_t delta, new_offset;
long int count;
/* POSIX.1 8.2.3.7 says that after a call the fflush() the file
offset of the underlying file must be exact. */
int must_be_exact = ((fp->_wide_data->_IO_read_base
== fp->_wide_data->_IO_read_end)
&& (fp->_wide_data->_IO_write_base
== fp->_wide_data->_IO_write_ptr));
if (mode == 0)
dir = _IO_seek_cur, offset = 0; /* Don't move any pointers. */
/* Flush unwritten characters.
(This may do an unneeded write if we seek within the buffer.
But to be able to switch to reading, we would need to set
egptr to ptr. That can't be done in the current design,
which assumes file_ptr() is eGptr. Anyway, since we probably
end up flushing when we close(), it doesn't make much difference.)
FIXME: simulate mem-papped files. */
if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_write_base
|| _IO_in_put_mode (fp))
if (_IO_switch_to_wget_mode (fp))
return WEOF;
if (fp->_wide_data->_IO_buf_base == NULL)
{
/* It could be that we already have a pushback buffer. */
if (fp->_wide_data->_IO_read_base != NULL)
{
free (fp->_wide_data->_IO_read_base);
fp->_flags &= ~_IO_IN_BACKUP;
}
_IO_doallocbuf (fp);
_IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
_IO_wsetp (fp, fp->_wide_data->_IO_buf_base,
fp->_wide_data->_IO_buf_base);
_IO_wsetg (fp, fp->_wide_data->_IO_buf_base,
fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base);
}
switch (dir)
{
struct _IO_codecvt *cv;
int clen;
case _IO_seek_cur:
/* Adjust for read-ahead (bytes is buffer). To do this we must
find out which position in the external buffer corresponds to
the current position in the internal buffer. */
cv = fp->_codecvt;
clen = (*cv->__codecvt_do_encoding) (cv);
if (clen > 0)
offset -= (fp->_wide_data->_IO_read_end
- fp->_wide_data->_IO_read_ptr) * clen;
else
{
int nread;
delta = fp->_wide_data->_IO_read_ptr - fp->_wide_data->_IO_read_end;
fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state;
nread = (*cv->__codecvt_do_length) (cv, &fp->_wide_data->_IO_state,
fp->_IO_read_base,
fp->_IO_read_end, delta);
fp->_IO_read_ptr = fp->_IO_read_base + nread;
offset -= fp->_IO_read_end - fp->_IO_read_base - nread;
}
if (fp->_offset == _IO_pos_BAD)
goto dumb;
/* Make offset absolute, assuming current pointer is file_ptr(). */
offset += fp->_offset;
dir = _IO_seek_set;
break;
case _IO_seek_set:
break;
case _IO_seek_end:
{
struct _G_stat64 st;
if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG (st.st_mode))
{
offset += st.st_size;
dir = _IO_seek_set;
}
else
goto dumb;
}
}
/* At this point, dir==_IO_seek_set. */
/* If we are only interested in the current position we've found it now. */
if (mode == 0)
return offset;
/* If destination is within current buffer, optimize: */
if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
&& !_IO_in_backup (fp))
{
/* Offset relative to start of main get area. */
_IO_off64_t rel_offset = (offset - fp->_offset
+ (fp->_IO_read_end - fp->_IO_read_base));
if (rel_offset >= 0)
{
#if 0
if (_IO_in_backup (fp))
_IO_switch_to_main_get_area (fp);
#endif
if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base)
{
fp->_IO_read_ptr = fp->_IO_read_base + rel_offset;
_IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
/* Now set the pointer for the internal buffer. This
might be an iterative process. Though the read
pointer is somewhere in the current external buffer
this does not mean we can convert this whole buffer
at once fitting in the internal buffer. */
do
{
}
while (0);
_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
goto resync;
}
#ifdef TODO
/* If we have streammarkers, seek forward by reading ahead. */
if (_IO_have_markers (fp))
{
int to_skip = rel_offset
- (fp->_IO_read_ptr - fp->_IO_read_base);
if (ignore (to_skip) != to_skip)
goto dumb;
_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
goto resync;
}
#endif
}
#ifdef TODO
if (rel_offset < 0 && rel_offset >= Bbase () - Bptr ())
{
if (!_IO_in_backup (fp))
_IO_switch_to_backup_area (fp);
gbump (fp->_IO_read_end + rel_offset - fp->_IO_read_ptr);
_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
goto resync;
}
#endif
}
#ifdef TODO
_IO_unsave_markers (fp);
#endif
if (fp->_flags & _IO_NO_READS)
goto dumb;
/* Try to seek to a block boundary, to improve kernel page management. */
new_offset = offset & ~(fp->_IO_buf_end - fp->_IO_buf_base - 1);
delta = offset - new_offset;
if (delta > fp->_IO_buf_end - fp->_IO_buf_base)
{
new_offset = offset;
delta = 0;
}
result = _IO_SYSSEEK (fp, new_offset, 0);
if (result < 0)
return EOF;
if (delta == 0)
count = 0;
else
{
count = _IO_SYSREAD (fp, fp->_IO_buf_base,
(must_be_exact
? delta : fp->_IO_buf_end - fp->_IO_buf_base));
if (count < delta)
{
/* We weren't allowed to read, but try to seek the remainder. */
offset = count == EOF ? delta : delta-count;
dir = _IO_seek_cur;
goto dumb;
}
}
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + delta,
fp->_IO_buf_base + count);
_IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
fp->_offset = result + count;
_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
return offset;
dumb:
_IO_unsave_markers (fp);
result = _IO_SYSSEEK (fp, offset, dir);
if (result != EOF)
{
_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
fp->_offset = result;
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
_IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
}
return result;
resync:
/* We need to do it since it is possible that the file offset in
the kernel may be changed behind our back. It may happen when
we fopen a file and then do a fork. One process may access the
the file and the kernel file offset will be changed. */
if (fp->_offset >= 0)
_IO_SYSSEEK (fp, fp->_offset, 0);
return offset;
}
_IO_size_t
_IO_wfile_xsputn (f, data, n)
_IO_FILE *f;
const void *data;
_IO_size_t n;
{
register const wchar_t *s = (const wchar_t *) data;
_IO_size_t to_do = n;
int must_flush = 0;
_IO_size_t count;
if (n <= 0)
return 0;
/* This is an optimized implementation.
If the amount to be written straddles a block boundary
(or the filebuf is unbuffered), use sys_write directly. */
/* First figure out how much space is available in the buffer. */
count = f->_wide_data->_IO_write_end - f->_wide_data->_IO_write_ptr;
if ((f->_flags & _IO_LINE_BUF) && (f->_flags & _IO_CURRENTLY_PUTTING))
{
count = f->_wide_data->_IO_buf_end - f->_wide_data->_IO_write_ptr;
if (count >= n)
{
register const wchar_t *p;
for (p = s + n; p > s; )
{
if (*--p == L'\n')
{
count = p - s + 1;
must_flush = 1;
break;
}
}
}
}
/* Then fill the buffer. */
if (count > 0)
{
if (count > to_do)
count = to_do;
if (count > 20)
{
#ifdef _LIBC
f->_wide_data->_IO_write_ptr =
__wmempcpy (f->_wide_data->_IO_write_ptr, s, count);
#else
wmemcpy (f->_wide_data->_IO_write_ptr, s, count);
f->_wide_data->_IO_write_ptr += count;
#endif
s += count;
}
else
{
register wchar_t *p = f->_wide_data->_IO_write_ptr;
register int i = (int) count;
while (--i >= 0)
*p++ = *s++;
f->_wide_data->_IO_write_ptr = p;
}
to_do -= count;
}
if (to_do > 0)
to_do -= _IO_wdefault_xsputn (f, s, to_do);
if (must_flush
&& f->_wide_data->_IO_write_ptr != f->_wide_data->_IO_write_base)
_IO_wdo_write (f, f->_wide_data->_IO_write_base,
f->_wide_data->_IO_write_ptr
- f->_wide_data->_IO_write_base);
return n - to_do;
}
struct _IO_jump_t _IO_wfile_jumps =
{
JUMP_INIT_DUMMY,
JUMP_INIT(finish, _IO_new_file_finish),
JUMP_INIT(overflow, (_IO_overflow_t) _IO_wfile_overflow),
JUMP_INIT(underflow, (_IO_underflow_t) _IO_wfile_underflow),
JUMP_INIT(uflow, (_IO_underflow_t) _IO_wdefault_uflow),
JUMP_INIT(pbackfail, (_IO_pbackfail_t) _IO_wdefault_pbackfail),
JUMP_INIT(xsputn, _IO_wfile_xsputn),
JUMP_INIT(xsgetn, _IO_file_xsgetn),
JUMP_INIT(seekoff, _IO_wfile_seekoff),
JUMP_INIT(seekpos, _IO_default_seekpos),
JUMP_INIT(setbuf, _IO_new_file_setbuf),
JUMP_INIT(sync, (_IO_sync_t) _IO_wfile_sync),
JUMP_INIT(doallocate, _IO_wfile_doallocate),
JUMP_INIT(read, _IO_file_read),
JUMP_INIT(write, _IO_new_file_write),
JUMP_INIT(seek, _IO_file_seek),
JUMP_INIT(close, _IO_file_close),
JUMP_INIT(stat, _IO_file_stat),
JUMP_INIT(showmanyc, _IO_default_showmanyc),
JUMP_INIT(imbue, _IO_default_imbue)
};
#endif /* _GLIBCPP_USE_WCHAR_T */

View File

@ -1,756 +0,0 @@
/* Copyright (C) 1993, 1995, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
Written by Ulrich Drepper <drepper@cygnus.com>.
Based on the single byte version by Per Bothner <bothner@cygnus.com>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
/* Generic or default I/O operations. */
#include "libioP.h"
#ifdef _GLIBCPP_USE_WCHAR_T
#ifdef __STDC__
#include <stdlib.h>
#endif
#include <string.h>
#include <wchar.h>
#ifndef _LIBC
# define __wmemcpy(dst, src, n) wmemcpy (dst, src, n)
#endif
static int save_for_wbackup __P ((_IO_FILE *fp, wchar_t *end_p))
#ifdef _LIBC
internal_function
#endif
;
/* Return minimum _pos markers
Assumes the current get area is the main get area. */
_IO_ssize_t _IO_least_wmarker __P ((_IO_FILE *fp, wchar_t *end_p));
_IO_ssize_t
_IO_least_wmarker (fp, end_p)
_IO_FILE *fp;
wchar_t *end_p;
{
_IO_ssize_t least_so_far = end_p - fp->_wide_data->_IO_read_base;
struct _IO_marker *mark;
for (mark = fp->_markers; mark != NULL; mark = mark->_next)
if (mark->_pos < least_so_far)
least_so_far = mark->_pos;
return least_so_far;
}
/* Switch current get area from backup buffer to (start of) main get area. */
void
_IO_switch_to_main_wget_area (fp)
_IO_FILE *fp;
{
wchar_t *tmp;
fp->_flags &= ~_IO_IN_BACKUP;
/* Swap _IO_read_end and _IO_save_end. */
tmp = fp->_wide_data->_IO_read_end;
fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_save_end;
fp->_wide_data->_IO_save_end= tmp;
/* Swap _IO_read_base and _IO_save_base. */
tmp = fp->_wide_data->_IO_read_base;
fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_save_base;
fp->_wide_data->_IO_save_base = tmp;
/* Set _IO_read_ptr. */
fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_base;
}
/* Switch current get area from main get area to (end of) backup area. */
void
_IO_switch_to_wbackup_area (fp)
_IO_FILE *fp;
{
wchar_t *tmp;
fp->_flags |= _IO_IN_BACKUP;
/* Swap _IO_read_end and _IO_save_end. */
tmp = fp->_wide_data->_IO_read_end;
fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_save_end;
fp->_wide_data->_IO_save_end = tmp;
/* Swap _IO_read_base and _IO_save_base. */
tmp = fp->_wide_data->_IO_read_base;
fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_save_base;
fp->_wide_data->_IO_save_base = tmp;
/* Set _IO_read_ptr. */
fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
}
void
_IO_wsetb (f, b, eb, a)
_IO_FILE *f;
wchar_t *b;
wchar_t *eb;
int a;
{
if (f->_wide_data->_IO_buf_base && !(f->_flags & _IO_USER_BUF))
FREE_BUF (f->_wide_data->_IO_buf_base, _IO_wblen (f));
f->_wide_data->_IO_buf_base = b;
f->_wide_data->_IO_buf_end = eb;
if (a)
f->_flags &= ~_IO_USER_BUF;
else
f->_flags |= _IO_USER_BUF;
}
wint_t
_IO_wdefault_pbackfail (fp, c)
_IO_FILE *fp;
wint_t c;
{
if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base
&& !_IO_in_backup (fp)
&& (wint_t) fp->_IO_read_ptr[-1] == c)
--fp->_IO_read_ptr;
else
{
/* Need to handle a filebuf in write mode (switch to read mode). FIXME!*/
if (!_IO_in_backup (fp))
{
/* We need to keep the invariant that the main get area
logically follows the backup area. */
if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base
&& _IO_have_wbackup (fp))
{
if (save_for_wbackup (fp, fp->_wide_data->_IO_read_ptr))
return WEOF;
}
else if (!_IO_have_wbackup (fp))
{
/* No backup buffer: allocate one. */
/* Use nshort buffer, if unused? (probably not) FIXME */
int backup_size = 128;
wchar_t *bbuf = (wchar_t *) malloc (backup_size
* sizeof (wchar_t));
if (bbuf == NULL)
return WEOF;
fp->_wide_data->_IO_save_base = bbuf;
fp->_wide_data->_IO_save_end = (fp->_wide_data->_IO_save_base
+ backup_size);
fp->_wide_data->_IO_backup_base = fp->_wide_data->_IO_save_end;
}
fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_ptr;
_IO_switch_to_wbackup_area (fp);
}
else if (fp->_wide_data->_IO_read_ptr <= fp->_wide_data->_IO_read_base)
{
/* Increase size of existing backup buffer. */
_IO_size_t new_size;
_IO_size_t old_size = (fp->_wide_data->_IO_read_end
- fp->_wide_data->_IO_read_base);
wchar_t *new_buf;
new_size = 2 * old_size;
new_buf = (wchar_t *) malloc (new_size * sizeof (wchar_t));
if (new_buf == NULL)
return WEOF;
__wmemcpy (new_buf + (new_size - old_size),
fp->_wide_data->_IO_read_base, old_size);
free (fp->_wide_data->_IO_read_base);
_IO_wsetg (fp, new_buf, new_buf + (new_size - old_size),
new_buf + new_size);
fp->_wide_data->_IO_backup_base = fp->_wide_data->_IO_read_ptr;
}
*--fp->_wide_data->_IO_read_ptr = c;
}
return c;
}
void
_IO_wdefault_finish (fp, dummy)
_IO_FILE *fp;
int dummy;
{
struct _IO_marker *mark;
if (fp->_wide_data->_IO_buf_base && !(fp->_flags & _IO_USER_BUF))
{
FREE_BUF (fp->_wide_data->_IO_buf_base,
_IO_wblen (fp) * sizeof (wchar_t));
fp->_wide_data->_IO_buf_base = fp->_wide_data->_IO_buf_end = NULL;
}
for (mark = fp->_markers; mark != NULL; mark = mark->_next)
mark->_sbuf = NULL;
if (fp->_IO_save_base)
{
free (fp->_wide_data->_IO_save_base);
fp->_IO_save_base = NULL;
}
#ifdef _IO_MTSAFE_IO
_IO_lock_fini (*fp->_lock);
#endif
_IO_un_link ((struct _IO_FILE_plus *) fp);
}
wint_t
_IO_wdefault_uflow (fp)
_IO_FILE *fp;
{
wint_t wch;
wch = _IO_UNDERFLOW (fp);
if (wch == WEOF)
return WEOF;
return *fp->_wide_data->_IO_read_ptr++;
}
wint_t
__woverflow (f, wch)
_IO_FILE *f;
wint_t wch;
{
if (f->_mode == 0)
_IO_fwide (f, 1);
return _IO_OVERFLOW (f, wch);
}
wint_t
__wuflow (fp)
_IO_FILE *fp;
{
if (fp->_mode < 0 || (fp->_mode == 0 && _IO_fwide (fp, 1) != 1))
return WEOF;
if (fp->_mode == 0)
_IO_fwide (fp, 1);
if (_IO_in_put_mode (fp))
if (_IO_switch_to_wget_mode (fp) == EOF)
return WEOF;
if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
return *fp->_wide_data->_IO_read_ptr++;
if (_IO_in_backup (fp))
{
_IO_switch_to_main_wget_area (fp);
if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
return *fp->_wide_data->_IO_read_ptr++;
}
if (_IO_have_markers (fp))
{
if (save_for_wbackup (fp, fp->_wide_data->_IO_read_end))
return WEOF;
}
else if (_IO_have_wbackup (fp))
_IO_free_wbackup_area (fp);
return _IO_UFLOW (fp);
}
wint_t
__wunderflow (fp)
_IO_FILE *fp;
{
if (fp->_mode < 0 || (fp->_mode == 0 && _IO_fwide (fp, 1) != 1))
return WEOF;
if (fp->_mode == 0)
_IO_fwide (fp, 1);
if (_IO_in_put_mode (fp))
if (_IO_switch_to_wget_mode (fp) == EOF)
return WEOF;
if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
return *fp->_wide_data->_IO_read_ptr;
if (_IO_in_backup (fp))
{
_IO_switch_to_main_wget_area (fp);
if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
return *fp->_wide_data->_IO_read_ptr;
}
if (_IO_have_markers (fp))
{
if (save_for_wbackup (fp, fp->_wide_data->_IO_read_end))
return WEOF;
}
else if (_IO_have_backup (fp))
_IO_free_wbackup_area (fp);
return _IO_UNDERFLOW (fp);
}
_IO_size_t
_IO_wdefault_xsputn (f, data, n)
_IO_FILE *f;
const void *data;
_IO_size_t n;
{
const wchar_t *s = (const wchar_t *) data;
_IO_size_t more = n;
if (more <= 0)
return 0;
for (;;)
{
/* Space available. */
_IO_ssize_t count = (f->_wide_data->_IO_write_end
- f->_wide_data->_IO_write_ptr);
if (count > 0)
{
if ((_IO_size_t) count > more)
count = more;
if (count > 20)
{
#ifdef _LIBC
f->_wide_data->_IO_write_ptr =
__wmempcpy (f->_wide_data->_IO_write_ptr, s, count);
#else
memcpy (f->_wide_data->_IO_write_ptr, s, count);
f->_wide_data->_IO_write_ptr += count;
#endif
s += count;
}
else if (count <= 0)
count = 0;
else
{
wchar_t *p = f->_wide_data->_IO_write_ptr;
_IO_ssize_t i;
for (i = count; --i >= 0; )
*p++ = *s++;
f->_wide_data->_IO_write_ptr = p;
}
more -= count;
}
if (more == 0 || __woverflow (f, *s++) == WEOF)
break;
more--;
}
return n - more;
}
_IO_size_t
_IO_wdefault_xsgetn (fp, data, n)
_IO_FILE *fp;
void *data;
_IO_size_t n;
{
_IO_size_t more = n;
wchar_t *s = (wchar_t*) data;
for (;;)
{
/* Data available. */
_IO_ssize_t count = (fp->_wide_data->_IO_read_end
- fp->_wide_data->_IO_read_ptr);
if (count > 0)
{
if ((_IO_size_t) count > more)
count = more;
if (count > 20)
{
#ifdef _LIBC
s = __wmempcpy (s, fp->_wide_data->_IO_read_ptr, count);
#else
memcpy (s, fp->_wide_data->_IO_read_ptr, count);
s += count;
#endif
fp->_wide_data->_IO_read_ptr += count;
}
else if (count <= 0)
count = 0;
else
{
wchar_t *p = fp->_wide_data->_IO_read_ptr;
int i = (int) count;
while (--i >= 0)
*s++ = *p++;
fp->_wide_data->_IO_read_ptr = p;
}
more -= count;
}
if (more == 0 || __wunderflow (fp) == WEOF)
break;
}
return n - more;
}
void
_IO_wdoallocbuf (fp)
_IO_FILE *fp;
{
if (fp->_wide_data->_IO_buf_base)
return;
if (!(fp->_flags & _IO_UNBUFFERED))
if (_IO_DOALLOCATE (fp) != WEOF)
return;
_IO_wsetb (fp, fp->_wide_data->_shortbuf, fp->_wide_data->_shortbuf + 1, 0);
}
_IO_FILE *
_IO_wdefault_setbuf (fp, p, len)
_IO_FILE *fp;
wchar_t *p;
_IO_ssize_t len;
{
if (_IO_SYNC (fp) == EOF)
return NULL;
if (p == NULL || len == 0)
{
fp->_flags |= _IO_UNBUFFERED;
_IO_wsetb (fp, fp->_wide_data->_shortbuf, fp->_wide_data->_shortbuf + 1,
0);
}
else
{
fp->_flags &= ~_IO_UNBUFFERED;
_IO_wsetb (fp, p, p + len, 0);
}
fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr
= fp->_wide_data->_IO_write_end = 0;
fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_ptr
= fp->_wide_data->_IO_read_end = 0;
return fp;
}
int
_IO_wdefault_doallocate (fp)
_IO_FILE *fp;
{
wchar_t *buf;
ALLOC_WBUF (buf, _IO_BUFSIZ, EOF);
_IO_wsetb (fp, buf, buf + _IO_BUFSIZ, 1);
return 1;
}
int
_IO_switch_to_wget_mode (fp)
_IO_FILE *fp;
{
if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_write_base)
if (_IO_OVERFLOW (fp, WEOF) == WEOF)
return EOF;
if (_IO_in_backup (fp))
fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_backup_base;
else
{
fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_buf_base;
if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_read_end)
fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_write_ptr;
}
fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_write_ptr;
fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr
= fp->_wide_data->_IO_write_end = fp->_wide_data->_IO_read_ptr;
fp->_flags &= ~_IO_CURRENTLY_PUTTING;
return 0;
}
void
_IO_free_wbackup_area (fp)
_IO_FILE *fp;
{
if (_IO_in_backup (fp))
_IO_switch_to_main_wget_area (fp); /* Just in case. */
free (fp->_wide_data->_IO_save_base);
fp->_wide_data->_IO_save_base = NULL;
fp->_wide_data->_IO_save_end = NULL;
fp->_wide_data->_IO_backup_base = NULL;
}
#if 0
int
_IO_switch_to_wput_mode (fp)
_IO_FILE *fp;
{
fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_read_ptr;
fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_read_ptr;
/* Following is wrong if line- or un-buffered? */
fp->_wide_data->_IO_write_end = (fp->_flags & _IO_IN_BACKUP
? fp->_wide_data->_IO_read_end
: fp->_wide_data->_IO_buf_end);
fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_end;
fp->_flags |= _IO_CURRENTLY_PUTTING;
return 0;
}
#endif
static int
#ifdef _LIBC
internal_function
#endif
save_for_wbackup (fp, end_p)
_IO_FILE *fp;
wchar_t *end_p;
{
/* Append [_IO_read_base..end_p] to backup area. */
_IO_ssize_t least_mark = _IO_least_wmarker (fp, end_p);
/* needed_size is how much space we need in the backup area. */
_IO_size_t needed_size = ((end_p - fp->_wide_data->_IO_read_base)
- least_mark);
/* FIXME: Dubious arithmetic if pointers are NULL */
_IO_size_t current_Bsize = (fp->_wide_data->_IO_save_end
- fp->_wide_data->_IO_save_base);
_IO_size_t avail; /* Extra space available for future expansion. */
_IO_ssize_t delta;
struct _IO_marker *mark;
if (needed_size > current_Bsize)
{
wchar_t *new_buffer;
avail = 100;
new_buffer = (wchar_t *) malloc ((avail + needed_size)
* sizeof (wchar_t));
if (new_buffer == NULL)
return EOF; /* FIXME */
if (least_mark < 0)
{
#ifdef _LIBC
__wmempcpy (__wmempcpy (new_buffer + avail,
fp->_wide_data->_IO_save_end + least_mark,
-least_mark),
fp->_wide_data->_IO_read_base,
end_p - fp->_wide_data->_IO_read_base);
#else
memcpy (new_buffer + avail,
fp->_wide_data->_IO_save_end + least_mark,
-least_mark * sizeof (wchar_t));
memcpy (new_buffer + avail - least_mark,
fp->_wide_data->_IO_read_base,
(end_p - fp->_wide_data->_IO_read_base) * sizeof (wchar_t));
#endif
}
else
{
#ifdef _LIBC
__wmemcpy (new_buffer + avail,
fp->_wide_data->_IO_read_base + least_mark,
needed_size);
#else
memcpy (new_buffer + avail,
fp->_wide_data->_IO_read_base + least_mark,
needed_size * sizeof (wchar_t));
#endif
}
if (fp->_wide_data->_IO_save_base)
free (fp->_wide_data->_IO_save_base);
fp->_wide_data->_IO_save_base = new_buffer;
fp->_wide_data->_IO_save_end = new_buffer + avail + needed_size;
}
else
{
avail = current_Bsize - needed_size;
if (least_mark < 0)
{
#ifdef _LIBC
__wmemmove (fp->_wide_data->_IO_save_base + avail,
fp->_wide_data->_IO_save_end + least_mark,
-least_mark);
__wmemcpy (fp->_wide_data->_IO_save_base + avail - least_mark,
fp->_wide_data->_IO_read_base,
end_p - fp->_wide_data->_IO_read_base);
#else
memmove (fp->_wide_data->_IO_save_base + avail,
fp->_wide_data->_IO_save_end + least_mark,
-least_mark * sizeof (wchar_t));
memcpy (fp->_wide_data->_IO_save_base + avail - least_mark,
fp->_wide_data->_IO_read_base,
(end_p - fp->_wide_data->_IO_read_base) * sizeof (wchar_t));
#endif
}
else if (needed_size > 0)
#ifdef _LIBC
__wmemcpy (fp->_wide_data->_IO_save_base + avail,
fp->_wide_data->_IO_read_base + least_mark,
needed_size);
#else
memcpy (fp->_wide_data->_IO_save_base + avail,
fp->_wide_data->_IO_read_base + least_mark,
needed_size * sizeof (wchar_t));
#endif
}
fp->_wide_data->_IO_backup_base = fp->_wide_data->_IO_save_base + avail;
/* Adjust all the streammarkers. */
delta = end_p - fp->_wide_data->_IO_read_base;
for (mark = fp->_markers; mark != NULL; mark = mark->_next)
mark->_pos -= delta;
return 0;
}
wint_t
_IO_sputbackwc (fp, c)
_IO_FILE *fp;
wint_t c;
{
wint_t result;
if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base
&& (wchar_t)fp->_wide_data->_IO_read_ptr[-1] == (wchar_t) c)
{
fp->_wide_data->_IO_read_ptr--;
result = c;
}
else
result = _IO_PBACKFAIL (fp, c);
if (result != EOF)
fp->_flags &= ~_IO_EOF_SEEN;
return result;
}
wint_t
_IO_sungetwc (fp)
_IO_FILE *fp;
{
int result;
if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base)
{
fp->_wide_data->_IO_read_ptr--;
result = *fp->_wide_data->_IO_read_ptr;
}
else
result = _IO_PBACKFAIL (fp, EOF);
if (result != WEOF)
fp->_flags &= ~_IO_EOF_SEEN;
return result;
}
unsigned
_IO_adjust_wcolumn (start, line, count)
unsigned start;
const wchar_t *line;
int count;
{
const wchar_t *ptr = line + count;
while (ptr > line)
if (*--ptr == L'\n')
return line + count - ptr - 1;
return start + count;
}
void
_IO_init_wmarker (marker, fp)
struct _IO_marker *marker;
_IO_FILE *fp;
{
marker->_sbuf = fp;
if (_IO_in_put_mode (fp))
_IO_switch_to_wget_mode (fp);
if (_IO_in_backup (fp))
marker->_pos = fp->_wide_data->_IO_read_ptr - fp->_wide_data->_IO_read_end;
else
marker->_pos = (fp->_wide_data->_IO_read_ptr
- fp->_wide_data->_IO_read_base);
/* Should perhaps sort the chain? */
marker->_next = fp->_markers;
fp->_markers = marker;
}
#define BAD_DELTA EOF
/* Return difference between MARK and current position of MARK's stream. */
int
_IO_wmarker_delta (mark)
struct _IO_marker *mark;
{
int cur_pos;
if (mark->_sbuf == NULL)
return BAD_DELTA;
if (_IO_in_backup (mark->_sbuf))
cur_pos = (mark->_sbuf->_wide_data->_IO_read_ptr
- mark->_sbuf->_wide_data->_IO_read_end);
else
cur_pos = (mark->_sbuf->_wide_data->_IO_read_ptr
- mark->_sbuf->_wide_data->_IO_read_base);
return mark->_pos - cur_pos;
}
int
_IO_seekwmark (fp, mark, delta)
_IO_FILE *fp;
struct _IO_marker *mark;
int delta;
{
if (mark->_sbuf != fp)
return EOF;
if (mark->_pos >= 0)
{
if (_IO_in_backup (fp))
_IO_switch_to_main_wget_area (fp);
fp->_wide_data->_IO_read_ptr = (fp->_wide_data->_IO_read_base
+ mark->_pos);
}
else
{
if (!_IO_in_backup (fp))
_IO_switch_to_wbackup_area (fp);
fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end + mark->_pos;
}
return 0;
}
void
_IO_unsave_wmarkers (fp)
_IO_FILE *fp;
{
struct _IO_marker *mark = fp->_markers;
if (mark)
{
#ifdef TODO
streampos offset = seekoff (0, ios::cur, ios::in);
if (offset != EOF)
{
offset += eGptr () - Gbase ();
for ( ; mark != NULL; mark = mark->_next)
mark->set_streampos (mark->_pos + offset);
}
else
{
for ( ; mark != NULL; mark = mark->_next)
mark->set_streampos (EOF);
}
#endif
fp->_markers = 0;
}
if (_IO_have_backup (fp))
_IO_free_wbackup_area (fp);
}
#endif /* _GLIBCPP_USE_WCHAR_T */

View File

@ -1,135 +0,0 @@
// Instantiation file for the -*- C++ -*- string classes.
// Copyright (C) 1994 Free Software Foundation
// This file is part of the GNU ANSI C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// As a special exception, if you link this library with files
// compiled with a GNU compiler to produce an executable, this does not cause
// the resulting executable to be covered by the GNU General Public License.
// This exception does not however invalidate any other reasons why
// the executable file might be covered by the GNU General Public License.
// Written by Jason Merrill based upon the specification by Takanori Adachi
// in ANSI X3J16/94-0013R2.
#ifdef __GNUG__
#ifdef TRAITS
#ifdef C
#pragma implementation "std/straits.h"
#endif
#endif
#endif
#include <string>
#ifdef C
typedef char c;
#endif
#ifdef W
typedef wchar_t c;
#endif
#if defined(TRAITS) && !defined(C)
template class string_char_traits <c>;
#else
/* string_char_traits<char> is already explicitly specialized in
std/straits.h. */
#endif
typedef basic_string <c> s;
#ifdef MAIN
template class basic_string <c>;
#endif
#ifdef ADDSS
template s operator+ (const s&, const s&);
#endif
#ifdef ADDPS
template s operator+ (const c*, const s&);
#endif
#ifdef ADDCS
template s operator+ (c, const s&);
#endif
#ifdef ADDSP
template s operator+ (const s&, const c*);
#endif
#ifdef ADDSC
template s operator+ (const s&, c);
#endif
#ifdef EQSS
template bool operator== (const s&, const s&);
#endif
#ifdef EQPS
template bool operator== (const c*, const s&);
#endif
#ifdef EQSP
template bool operator== (const s&, const c*);
#endif
#ifdef NESS
template bool operator!= (const s&, const s&);
#endif
#ifdef NEPS
template bool operator!= (const c*, const s&);
#endif
#ifdef NESP
template bool operator!= (const s&, const c*);
#endif
#ifdef LTSS
template bool operator< (const s&, const s&);
#endif
#ifdef LTPS
template bool operator< (const c*, const s&);
#endif
#ifdef LTSP
template bool operator< (const s&, const c*);
#endif
#ifdef GTSS
template bool operator> (const s&, const s&);
#endif
#ifdef GTPS
template bool operator> (const c*, const s&);
#endif
#ifdef GTSP
template bool operator> (const s&, const c*);
#endif
#ifdef LESS
template bool operator<= (const s&, const s&);
#endif
#ifdef LEPS
template bool operator<= (const c*, const s&);
#endif
#ifdef LESP
template bool operator<= (const s&, const c*);
#endif
#ifdef GESS
template bool operator>= (const s&, const s&);
#endif
#ifdef GEPS
template bool operator>= (const c*, const s&);
#endif
#ifdef GESP
template bool operator>= (const s&, const c*);
#endif
#ifdef EXTRACT
template istream& operator>> (istream&, s&);
#endif // EXTRACT
#ifdef INSERT
template ostream& operator<< (ostream&, const s&);
#endif // INSERT
#ifdef GETLINE
template istream& getline (istream&, s&, c);
#endif

View File

@ -1,47 +0,0 @@
// Explicit instantiation file for -*- C++ -*- math library.
// Copyright (C) 2001 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// These are explicit instantiations of the behind-the-scenes internal
// helper functions used in the math routines of libstdc++.
#include <cmath>
namespace std
{
// This function is only declared/used in the cheaders=c_std case.
template float
__cmath_power<float>(float, unsigned int);
template double
__cmath_power<double>(double, unsigned int);
template long double
__cmath_power<long double>(long double, unsigned int);
} // namespace std

View File

@ -1,343 +0,0 @@
/* This is part of libio/iostream, providing -*- C++ -*- input/output.
Copyright (C) 2000 Free Software Foundation
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
/* Written by Magnus Fromreide (magfr@lysator.liu.se). */
/* seekoff and ideas for overflow is largely borrowed from libstdc++-v3 */
#ifndef __SSTREAM__
#define __SSTREAM__
#include <iostream.h>
#include <streambuf.h>
#include <string>
namespace std
{
class stringbuf : public streambuf
{
public:
typedef char char_type;
typedef int int_type;
typedef streampos pos_type;
typedef streamoff off_type;
explicit
stringbuf(int which=ios::in|ios::out)
: streambuf(), mode(static_cast<ios::open_mode>(which)),
stream(NULL), stream_len(0)
{
stringbuf_init();
}
explicit
stringbuf(const string &str, int which=ios::in|ios::out)
: streambuf(), mode(static_cast<ios::open_mode>(which)),
stream(NULL), stream_len(0)
{
if (mode & (ios::in|ios::out))
{
stream_len = str.size();
stream = new char_type[stream_len];
str.copy(stream, stream_len);
}
stringbuf_init();
}
virtual
~stringbuf()
{
delete[] stream;
}
string
str() const
{
if (pbase() != 0)
return string(stream, pptr()-pbase());
else
return string();
}
void
str(const string& str)
{
delete[] stream;
stream_len = str.size();
stream = new char_type[stream_len];
str.copy(stream, stream_len);
stringbuf_init();
}
protected:
// The buffer is already in gptr, so if it ends then it is out of data.
virtual int
underflow()
{
return EOF;
}
virtual int
overflow(int c = EOF)
{
int res;
if (mode & ios::out)
{
if (c != EOF)
{
streamsize old_stream_len = stream_len;
stream_len += 1;
char_type* new_stream = new char_type[stream_len];
memcpy(new_stream, stream, old_stream_len);
delete[] stream;
stream = new_stream;
stringbuf_sync(gptr()-eback(), pptr()-pbase());
sputc(c);
res = c;
}
else
res = EOF;
}
else
res = 0;
return res;
}
virtual streambuf*
setbuf(char_type* s, streamsize n)
{
if (n != 0)
{
delete[] stream;
stream = new char_type[n];
memcpy(stream, s, n);
stream_len = n;
stringbuf_sync(0, 0);
}
return this;
}
virtual pos_type
seekoff(off_type off, ios::seek_dir way, int which = ios::in | ios::out)
{
pos_type ret = pos_type(off_type(-1));
bool testin = which & ios::in && mode & ios::in;
bool testout = which & ios::out && mode & ios::out;
bool testboth = testin && testout && way != ios::cur;
if (stream_len && ((testin != testout) || testboth))
{
char_type* beg = stream;
char_type* curi = NULL;
char_type* curo = NULL;
char_type* endi = NULL;
char_type* endo = NULL;
if (testin)
{
curi = gptr();
endi = egptr();
}
if (testout)
{
curo = pptr();
endo = epptr();
}
off_type newoffi = 0;
off_type newoffo = 0;
if (way == ios::beg)
{
newoffi = beg - curi;
newoffo = beg - curo;
}
else if (way == ios::end)
{
newoffi = endi - curi;
newoffo = endo - curo;
}
if (testin && newoffi + off + curi - beg >= 0 &&
endi - beg >= newoffi + off + curi - beg)
{
gbump(newoffi + off);
ret = pos_type(newoffi + off + curi);
}
if (testout && newoffo + off + curo - beg >= 0 &&
endo - beg >= newoffo + off + curo - beg)
{
pbump(newoffo + off);
ret = pos_type(newoffo + off + curo);
}
}
return ret;
}
virtual pos_type
seekpos(pos_type sp, int which = ios::in | ios::out)
{
pos_type ret = seekoff(sp, ios::beg, which);
return ret;
}
private:
void
stringbuf_sync(streamsize i, streamsize o)
{
if (mode & ios::in)
setg(stream, stream + i, stream + stream_len);
if (mode & ios::out)
{
setp(stream, stream + stream_len);
pbump(o);
}
}
void
stringbuf_init()
{
if (mode & ios::ate)
stringbuf_sync(0, stream_len);
else
stringbuf_sync(0, 0);
}
private:
ios::open_mode mode;
char_type* stream;
streamsize stream_len;
};
class istringstream : public istream {
public:
typedef char char_type;
typedef int int_type;
typedef streampos pos_type;
typedef streamoff off_type;
explicit
istringstream(int which=ios::in)
: istream(&sb), sb(which | ios::in)
{ }
explicit
istringstream(const string& str, int which=ios::in)
: istream(&sb), sb(str, which | ios::in)
{ }
stringbuf*
rdbuf() const
{
return const_cast<stringbuf*>(&sb);
}
string
str() const
{
return rdbuf()->str();
}
void
str(const string& s)
{
rdbuf()->str(s);
}
private:
stringbuf sb;
};
class ostringstream : public ostream {
public:
typedef char char_type;
typedef int int_type;
typedef streampos pos_type;
typedef streamoff off_type;
explicit
ostringstream(int which=ios::out)
: ostream(&sb), sb(which | ios::out)
{ }
explicit
ostringstream(const string& str, int which=ios::out)
: ostream(&sb), sb(str, which | ios::out)
{ }
stringbuf*
rdbuf() const
{
return const_cast<stringbuf*>(&sb);
}
string
str() const
{
return rdbuf()->str();
}
void str(const string& s)
{
rdbuf()->str(s);
}
private:
stringbuf sb;
};
class stringstream : public iostream {
public:
typedef char char_type;
typedef int int_type;
typedef streampos pos_type;
typedef streamoff off_type;
explicit
stringstream(int which=ios::out|ios::in)
: iostream(&sb), sb(which)
{ }
explicit
stringstream(const string& str, int which=ios::out|ios::in)
: iostream(&sb), sb(str, which)
{ }
stringbuf*
rdbuf() const
{
return const_cast<stringbuf*>(&sb);
}
string
str() const
{
return rdbuf()->str();
}
void
str(const string& s)
{
rdbuf()->str(s);
}
private:
stringbuf sb;
};
};
#endif /* not __STRSTREAM__ */

View File

@ -1,524 +0,0 @@
// Member templates for the -*- C++ -*- string classes.
// Copyright (C) 1994, 1999 Free Software Foundation
// This file is part of the GNU ANSI C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// As a special exception, if you link this library with files
// compiled with a GNU compiler to produce an executable, this does not cause
// the resulting executable to be covered by the GNU General Public License.
// This exception does not however invalidate any other reasons why
// the executable file might be covered by the GNU General Public License.
// Written by Jason Merrill based upon the specification by Takanori Adachi
// in ANSI X3J16/94-0013R2.
extern "C++" {
template <class charT, class traits, class Allocator>
inline void * basic_string <charT, traits, Allocator>::Rep::
operator new (size_t s, size_t extra)
{
return Allocator::allocate(s + extra * sizeof (charT));
}
template <class charT, class traits, class Allocator>
inline void basic_string <charT, traits, Allocator>::Rep::
operator delete (void * ptr)
{
Allocator::deallocate(ptr, sizeof(Rep) +
reinterpret_cast<Rep *>(ptr)->res *
sizeof (charT));
}
template <class charT, class traits, class Allocator>
inline size_t basic_string <charT, traits, Allocator>::Rep::
frob_size (size_t s)
{
size_t i = 16;
while (i < s) i *= 2;
return i;
}
template <class charT, class traits, class Allocator>
inline basic_string <charT, traits, Allocator>::Rep *
basic_string <charT, traits, Allocator>::Rep::
create (size_t extra)
{
extra = frob_size (extra + 1);
Rep *p = new (extra) Rep;
p->res = extra;
p->ref = 1;
p->selfish = false;
return p;
}
template <class charT, class traits, class Allocator>
charT * basic_string <charT, traits, Allocator>::Rep::
clone ()
{
Rep *p = Rep::create (len);
p->copy (0, data (), len);
p->len = len;
return p->data ();
}
template <class charT, class traits, class Allocator>
inline bool basic_string <charT, traits, Allocator>::Rep::
excess_slop (size_t s, size_t r)
{
return 2 * (s <= 16 ? 16 : s) < r;
}
template <class charT, class traits, class Allocator>
inline bool basic_string <charT, traits, Allocator>::
check_realloc (basic_string::size_type s) const
{
s += sizeof (charT);
rep ()->selfish = false;
return (rep ()->ref > 1
|| s > capacity ()
|| Rep::excess_slop (s, capacity ()));
}
template <class charT, class traits, class Allocator>
void basic_string <charT, traits, Allocator>::
alloc (basic_string::size_type __size, bool __save)
{
if (! check_realloc (__size))
return;
Rep *p = Rep::create (__size);
if (__save)
{
p->copy (0, data (), length ());
p->len = length ();
}
else
p->len = 0;
repup (p);
}
template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>&
basic_string <charT, traits, Allocator>::
replace (size_type pos1, size_type n1,
const basic_string& str, size_type pos2, size_type n2)
{
const size_t len2 = str.length ();
if (pos1 == 0 && n1 >= length () && pos2 == 0 && n2 >= len2)
return operator= (str);
OUTOFRANGE (pos2 > len2);
if (n2 > len2 - pos2)
n2 = len2 - pos2;
return replace (pos1, n1, str.data () + pos2, n2);
}
template <class charT, class traits, class Allocator>
inline void basic_string <charT, traits, Allocator>::Rep::
copy (size_t pos, const charT *s, size_t n)
{
if (n)
traits::copy (data () + pos, s, n);
}
template <class charT, class traits, class Allocator>
inline void basic_string <charT, traits, Allocator>::Rep::
move (size_t pos, const charT *s, size_t n)
{
if (n)
traits::move (data () + pos, s, n);
}
template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>&
basic_string <charT, traits, Allocator>::
replace (size_type pos, size_type n1, const charT* s, size_type n2)
{
const size_type len = length ();
OUTOFRANGE (pos > len);
if (n1 > len - pos)
n1 = len - pos;
LENGTHERROR (len - n1 > max_size () - n2);
size_t newlen = len - n1 + n2;
if (check_realloc (newlen))
{
Rep *p = Rep::create (newlen);
p->copy (0, data (), pos);
p->copy (pos + n2, data () + pos + n1, len - (pos + n1));
p->copy (pos, s, n2);
repup (p);
}
else
{
rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1));
rep ()->copy (pos, s, n2);
}
rep ()->len = newlen;
return *this;
}
template <class charT, class traits, class Allocator>
inline void basic_string <charT, traits, Allocator>::Rep::
set (size_t pos, const charT c, size_t n)
{
traits::set (data () + pos, c, n);
}
template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>::
replace (size_type pos, size_type n1, size_type n2, charT c)
{
const size_t len = length ();
OUTOFRANGE (pos > len);
if (n1 > len - pos)
n1 = len - pos;
LENGTHERROR (len - n1 > max_size () - n2);
size_t newlen = len - n1 + n2;
if (check_realloc (newlen))
{
Rep *p = Rep::create (newlen);
p->copy (0, data (), pos);
p->copy (pos + n2, data () + pos + n1, len - (pos + n1));
p->set (pos, c, n2);
repup (p);
}
else
{
rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1));
rep ()->set (pos, c, n2);
}
rep ()->len = newlen;
return *this;
}
template <class charT, class traits, class Allocator>
void basic_string <charT, traits, Allocator>::
resize (size_type n, charT c)
{
LENGTHERROR (n > max_size ());
if (n > length ())
append (n - length (), c);
else
erase (n);
}
template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
copy (charT* s, size_type n, size_type pos) const
{
OUTOFRANGE (pos > length ());
if (n > length () - pos)
n = length () - pos;
traits::copy (s, data () + pos, n);
return n;
}
template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find (const charT* s, size_type pos, size_type n) const
{
size_t xpos = pos;
for (; xpos + n <= length (); ++xpos)
if (traits::eq (data () [xpos], *s)
&& traits::compare (data () + xpos, s, n) == 0)
return xpos;
return npos;
}
template <class charT, class traits, class Allocator>
inline basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
_find (const charT* ptr, charT c, size_type xpos, size_type len)
{
for (; xpos < len; ++xpos)
if (traits::eq (ptr [xpos], c))
return xpos;
return npos;
}
template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find (charT c, size_type pos) const
{
return _find (data (), c, pos, length ());
}
template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
rfind (const charT* s, size_type pos, size_type n) const
{
if (n > length ())
return npos;
size_t xpos = length () - n;
if (xpos > pos)
xpos = pos;
for (++xpos; xpos-- > 0; )
if (traits::eq (data () [xpos], *s)
&& traits::compare (data () + xpos, s, n) == 0)
return xpos;
return npos;
}
template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
rfind (charT c, size_type pos) const
{
if (1 > length ())
return npos;
size_t xpos = length () - 1;
if (xpos > pos)
xpos = pos;
for (++xpos; xpos-- > 0; )
if (traits::eq (data () [xpos], c))
return xpos;
return npos;
}
template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find_first_of (const charT* s, size_type pos, size_type n) const
{
size_t xpos = pos;
for (; xpos < length (); ++xpos)
if (_find (s, data () [xpos], 0, n) != npos)
return xpos;
return npos;
}
template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find_last_of (const charT* s, size_type pos, size_type n) const
{
if (length() == 0)
return npos;
size_t xpos = length () - 1;
if (xpos > pos)
xpos = pos;
for (++xpos; xpos-- > 0;)
if (_find (s, data () [xpos], 0, n) != npos)
return xpos;
return npos;
}
template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find_first_not_of (const charT* s, size_type pos, size_type n) const
{
size_t xpos = pos;
for (; xpos < length (); ++xpos)
if (_find (s, data () [xpos], 0, n) == npos)
return xpos;
return npos;
}
template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find_first_not_of (charT c, size_type pos) const
{
size_t xpos = pos;
for (; xpos < length (); ++xpos)
if (traits::ne (data () [xpos], c))
return xpos;
return npos;
}
template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find_last_not_of (const charT* s, size_type pos, size_type n) const
{
if (length() == 0)
return npos;
size_t xpos = length () - 1;
if (xpos > pos)
xpos = pos;
for (++xpos; xpos-- > 0;)
if (_find (s, data () [xpos], 0, n) == npos)
return xpos;
return npos;
}
template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find_last_not_of (charT c, size_type pos) const
{
if (length() == 0)
return npos;
size_t xpos = length () - 1;
if (xpos > pos)
xpos = pos;
for (++xpos; xpos-- > 0;)
if (traits::ne (data () [xpos], c))
return xpos;
return npos;
}
template <class charT, class traits, class Allocator>
int basic_string <charT, traits, Allocator>::
compare (const basic_string& str, size_type pos, size_type n) const
{
OUTOFRANGE (pos > length ());
size_t rlen = length () - pos;
if (rlen > n)
rlen = n;
if (rlen > str.length ())
rlen = str.length ();
int r = traits::compare (data () + pos, str.data (), rlen);
if (r != 0)
return r;
if (rlen == n)
return 0;
return (length () - pos) - str.length ();
}
template <class charT, class traits, class Allocator>
int basic_string <charT, traits, Allocator>::
compare (const charT* s, size_type pos, size_type n) const
{
OUTOFRANGE (pos > length ());
size_t rlen = length () - pos;
if (rlen > n)
rlen = n;
int r = traits::compare (data () + pos, s, rlen);
if (r != 0)
return r;
return (length () - pos) - n;
}
#include <iostream.h>
template <class charT, class traits, class Allocator>
istream &
operator>> (istream &is, basic_string <charT, traits, Allocator> &s)
{
int w = is.width (0);
if (is.ipfx0 ())
{
register streambuf *sb = is.rdbuf ();
s.resize (0);
while (1)
{
int ch = sb->sbumpc ();
if (ch == EOF)
{
is.setstate (ios::eofbit);
break;
}
else if (traits::is_del (ch))
{
sb->sungetc ();
break;
}
s += static_cast<charT> (ch);
if (--w == 1)
break;
}
}
is.isfx ();
if (s.length () == 0)
is.setstate (ios::failbit);
return is;
}
template <class charT, class traits, class Allocator>
ostream &
operator<< (ostream &o, const basic_string <charT, traits, Allocator>& s)
{
return o.write (s.data (), s.length ());
}
template <class charT, class traits, class Allocator>
istream&
getline (istream &is, basic_string <charT, traits, Allocator>& s, charT delim)
{
if (is.ipfx1 ())
{
_IO_size_t count = 0;
streambuf *sb = is.rdbuf ();
s.resize (0);
while (1)
{
int ch = sb->sbumpc ();
if (ch == EOF)
{
is.setstate (count == 0
? (ios::failbit|ios::eofbit)
: ios::eofbit);
break;
}
++count;
if (ch == delim)
break;
s += static_cast<charT> (ch);
if (s.length () == s.npos - 1)
{
is.setstate (ios::failbit);
break;
}
}
}
// We need to be friends with istream to do this.
// is._gcount = count;
is.isfx ();
return is;
}
template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::Rep
basic_string<charT, traits, Allocator>::nilRep = { 0, 0, 1, false };
template <class charT, class traits, class Allocator>
const basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::npos;
} // extern "C++"

View File

@ -1,657 +0,0 @@
// Main templates for the -*- C++ -*- string classes.
// Copyright (C) 1994, 1995, 1999 Free Software Foundation
// This file is part of the GNU ANSI C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// As a special exception, if you link this library with files
// compiled with a GNU compiler to produce an executable, this does not cause
// the resulting executable to be covered by the GNU General Public License.
// This exception does not however invalidate any other reasons why
// the executable file might be covered by the GNU General Public License.
// Written by Jason Merrill based upon the specification by Takanori Adachi
// in ANSI X3J16/94-0013R2.
#ifndef __BASTRING__
#define __BASTRING__
#ifdef __GNUG__
#pragma interface
#endif
#include <cstddef>
#include <std/straits.h>
// NOTE : This does NOT conform to the draft standard and is likely to change
#include <alloc.h>
extern "C++" {
class istream; class ostream;
#include <iterator>
#ifdef __STL_USE_EXCEPTIONS
extern void __out_of_range (const char *);
extern void __length_error (const char *);
#define OUTOFRANGE(cond) \
do { if (cond) __out_of_range (#cond); } while (0)
#define LENGTHERROR(cond) \
do { if (cond) __length_error (#cond); } while (0)
#else
#include <cassert>
#define OUTOFRANGE(cond) assert (!(cond))
#define LENGTHERROR(cond) assert (!(cond))
#endif
template <class charT, class traits = string_char_traits<charT>,
class Allocator = alloc >
class basic_string
{
private:
struct Rep {
size_t len, res, ref;
bool selfish;
charT* data () { return reinterpret_cast<charT *>(this + 1); }
charT& operator[] (size_t s) { return data () [s]; }
charT* grab () { if (selfish) return clone (); ++ref; return data (); }
#if defined __i486__ || defined __i586__ || defined __i686__
void release ()
{
size_t __val;
// This opcode exists as a .byte instead of as a mnemonic for the
// benefit of SCO OpenServer 5. The system assembler (which is
// essentially required on this target) can't assemble xaddl in
//COFF mode.
asm (".byte 0xf0, 0x0f, 0xc1, 0x02" // lock; xaddl %eax, (%edx)
: "=a" (__val)
: "0" (-1), "m" (ref), "d" (&ref)
: "memory");
if (__val == 1)
delete this;
}
#elif defined __sparcv9__
void release ()
{
size_t __newval, __oldval = ref;
do
{
__newval = __oldval - 1;
__asm__ ("cas [%4], %2, %0"
: "=r" (__oldval), "=m" (ref)
: "r" (__oldval), "m" (ref), "r"(&(ref)), "0" (__newval));
}
while (__newval != __oldval);
if (__oldval == 0)
delete this;
}
#else
void release () { if (--ref == 0) delete this; }
#endif
inline static void * operator new (size_t, size_t);
inline static void operator delete (void *);
inline static Rep* create (size_t);
charT* clone ();
inline void copy (size_t, const charT *, size_t);
inline void move (size_t, const charT *, size_t);
inline void set (size_t, const charT, size_t);
inline static bool excess_slop (size_t, size_t);
inline static size_t frob_size (size_t);
private:
Rep &operator= (const Rep &);
};
public:
// types:
typedef traits traits_type;
typedef typename traits::char_type value_type;
typedef Allocator allocator_type;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef charT& reference;
typedef const charT& const_reference;
typedef charT* pointer;
typedef const charT* const_pointer;
typedef pointer iterator;
typedef const_pointer const_iterator;
typedef ::reverse_iterator<iterator> reverse_iterator;
typedef ::reverse_iterator<const_iterator> const_reverse_iterator;
static const size_type npos = static_cast<size_type>(-1);
private:
Rep *rep () const { return reinterpret_cast<Rep *>(dat) - 1; }
void repup (Rep *p) { rep ()->release (); dat = p->data (); }
public:
const charT* data () const
{ return rep ()->data(); }
size_type length () const
{ return rep ()->len; }
size_type size () const
{ return rep ()->len; }
size_type capacity () const
{ return rep ()->res; }
size_type max_size () const
{ return (npos - 1)/sizeof (charT); } // XXX
bool empty () const
{ return size () == 0; }
// _lib.string.cons_ construct/copy/destroy:
basic_string& operator= (const basic_string& str)
{
if (&str != this) { rep ()->release (); dat = str.rep ()->grab (); }
return *this;
}
explicit basic_string (): dat (nilRep.grab ()) { }
basic_string (const basic_string& str): dat (str.rep ()->grab ()) { }
basic_string (const basic_string& str, size_type pos, size_type n = npos)
: dat (nilRep.grab ()) { assign (str, pos, n); }
basic_string (const charT* s, size_type n)
: dat (nilRep.grab ()) { assign (s, n); }
basic_string (const charT* s)
: dat (nilRep.grab ()) { assign (s); }
basic_string (size_type n, charT c)
: dat (nilRep.grab ()) { assign (n, c); }
#ifdef __STL_MEMBER_TEMPLATES
template<class InputIterator>
basic_string(InputIterator __begin, InputIterator __end)
#else
basic_string(const_iterator __begin, const_iterator __end)
#endif
: dat (nilRep.grab ()) { assign (__begin, __end); }
~basic_string ()
{ rep ()->release (); }
void swap (basic_string &s) { charT *d = dat; dat = s.dat; s.dat = d; }
basic_string& append (const basic_string& str, size_type pos = 0,
size_type n = npos)
{ return replace (length (), 0, str, pos, n); }
basic_string& append (const charT* s, size_type n)
{ return replace (length (), 0, s, n); }
basic_string& append (const charT* s)
{ return append (s, traits::length (s)); }
basic_string& append (size_type n, charT c)
{ return replace (length (), 0, n, c); }
#ifdef __STL_MEMBER_TEMPLATES
template<class InputIterator>
basic_string& append(InputIterator first, InputIterator last)
#else
basic_string& append(const_iterator first, const_iterator last)
#endif
{ return replace (iend (), iend (), first, last); }
void push_back(charT __c)
{ append(1, __c); }
basic_string& assign (const basic_string& str, size_type pos = 0,
size_type n = npos)
{ return replace (0, npos, str, pos, n); }
basic_string& assign (const charT* s, size_type n)
{ return replace (0, npos, s, n); }
basic_string& assign (const charT* s)
{ return assign (s, traits::length (s)); }
basic_string& assign (size_type n, charT c)
{ return replace (0, npos, n, c); }
#ifdef __STL_MEMBER_TEMPLATES
template<class InputIterator>
basic_string& assign(InputIterator first, InputIterator last)
#else
basic_string& assign(const_iterator first, const_iterator last)
#endif
{ return replace (ibegin (), iend (), first, last); }
basic_string& operator= (const charT* s)
{ return assign (s); }
basic_string& operator= (charT c)
{ return assign (1, c); }
basic_string& operator+= (const basic_string& rhs)
{ return append (rhs); }
basic_string& operator+= (const charT* s)
{ return append (s); }
basic_string& operator+= (charT c)
{ return append (1, c); }
basic_string& insert (size_type pos1, const basic_string& str,
size_type pos2 = 0, size_type n = npos)
{ return replace (pos1, 0, str, pos2, n); }
basic_string& insert (size_type pos, const charT* s, size_type n)
{ return replace (pos, 0, s, n); }
basic_string& insert (size_type pos, const charT* s)
{ return insert (pos, s, traits::length (s)); }
basic_string& insert (size_type pos, size_type n, charT c)
{ return replace (pos, 0, n, c); }
iterator insert(iterator p, charT c)
{ size_type __o = p - ibegin ();
insert (p - ibegin (), 1, c); selfish ();
return ibegin () + __o; }
iterator insert(iterator p, size_type n, charT c)
{ size_type __o = p - ibegin ();
insert (p - ibegin (), n, c); selfish ();
return ibegin () + __o; }
#ifdef __STL_MEMBER_TEMPLATES
template<class InputIterator>
void insert(iterator p, InputIterator first, InputIterator last)
#else
void insert(iterator p, const_iterator first, const_iterator last)
#endif
{ replace (p, p, first, last); }
basic_string& erase (size_type pos = 0, size_type n = npos)
{ return replace (pos, n, (size_type)0, (charT)0); }
iterator erase(iterator p)
{ size_type __o = p - begin();
replace (__o, 1, (size_type)0, (charT)0); selfish ();
return ibegin() + __o; }
iterator erase(iterator f, iterator l)
{ size_type __o = f - ibegin();
replace (__o, l-f, (size_type)0, (charT)0);selfish ();
return ibegin() + __o; }
basic_string& replace (size_type pos1, size_type n1, const basic_string& str,
size_type pos2 = 0, size_type n2 = npos);
basic_string& replace (size_type pos, size_type n1, const charT* s,
size_type n2);
basic_string& replace (size_type pos, size_type n1, const charT* s)
{ return replace (pos, n1, s, traits::length (s)); }
basic_string& replace (size_type pos, size_type n1, size_type n2, charT c);
basic_string& replace (size_type pos, size_type n, charT c)
{ return replace (pos, n, 1, c); }
basic_string& replace (iterator i1, iterator i2, const basic_string& str)
{ return replace (i1 - ibegin (), i2 - i1, str); }
basic_string& replace (iterator i1, iterator i2, const charT* s, size_type n)
{ return replace (i1 - ibegin (), i2 - i1, s, n); }
basic_string& replace (iterator i1, iterator i2, const charT* s)
{ return replace (i1 - ibegin (), i2 - i1, s); }
basic_string& replace (iterator i1, iterator i2, size_type n, charT c)
{ return replace (i1 - ibegin (), i2 - i1, n, c); }
#ifdef __STL_MEMBER_TEMPLATES
template<class InputIterator>
basic_string& replace(iterator i1, iterator i2,
InputIterator j1, InputIterator j2);
#else
basic_string& replace(iterator i1, iterator i2,
const_iterator j1, const_iterator j2);
#endif
private:
static charT eos () { return traits::eos (); }
void unique () { if (rep ()->ref > 1) alloc (length (), true); }
void selfish () { unique (); rep ()->selfish = true; }
public:
charT operator[] (size_type pos) const
{
if (pos == length ())
return eos ();
return data ()[pos];
}
reference operator[] (size_type pos)
{ selfish (); return (*rep ())[pos]; }
reference at (size_type pos)
{
OUTOFRANGE (pos >= length ());
return (*this)[pos];
}
const_reference at (size_type pos) const
{
OUTOFRANGE (pos >= length ());
return data ()[pos];
}
private:
void terminate () const
{ traits::assign ((*rep ())[length ()], eos ()); }
public:
const charT* c_str () const
{ if (length () == 0) return ""; terminate (); return data (); }
void resize (size_type n, charT c);
void resize (size_type n)
{ resize (n, eos ()); }
void reserve (size_type) { }
size_type copy (charT* s, size_type n, size_type pos = 0) const;
size_type find (const basic_string& str, size_type pos = 0) const
{ return find (str.data(), pos, str.length()); }
size_type find (const charT* s, size_type pos, size_type n) const;
size_type find (const charT* s, size_type pos = 0) const
{ return find (s, pos, traits::length (s)); }
size_type find (charT c, size_type pos = 0) const;
size_type rfind (const basic_string& str, size_type pos = npos) const
{ return rfind (str.data(), pos, str.length()); }
size_type rfind (const charT* s, size_type pos, size_type n) const;
size_type rfind (const charT* s, size_type pos = npos) const
{ return rfind (s, pos, traits::length (s)); }
size_type rfind (charT c, size_type pos = npos) const;
size_type find_first_of (const basic_string& str, size_type pos = 0) const
{ return find_first_of (str.data(), pos, str.length()); }
size_type find_first_of (const charT* s, size_type pos, size_type n) const;
size_type find_first_of (const charT* s, size_type pos = 0) const
{ return find_first_of (s, pos, traits::length (s)); }
size_type find_first_of (charT c, size_type pos = 0) const
{ return find (c, pos); }
size_type find_last_of (const basic_string& str, size_type pos = npos) const
{ return find_last_of (str.data(), pos, str.length()); }
size_type find_last_of (const charT* s, size_type pos, size_type n) const;
size_type find_last_of (const charT* s, size_type pos = npos) const
{ return find_last_of (s, pos, traits::length (s)); }
size_type find_last_of (charT c, size_type pos = npos) const
{ return rfind (c, pos); }
size_type find_first_not_of (const basic_string& str, size_type pos = 0) const
{ return find_first_not_of (str.data(), pos, str.length()); }
size_type find_first_not_of (const charT* s, size_type pos, size_type n) const;
size_type find_first_not_of (const charT* s, size_type pos = 0) const
{ return find_first_not_of (s, pos, traits::length (s)); }
size_type find_first_not_of (charT c, size_type pos = 0) const;
size_type find_last_not_of (const basic_string& str, size_type pos = npos) const
{ return find_last_not_of (str.data(), pos, str.length()); }
size_type find_last_not_of (const charT* s, size_type pos, size_type n) const;
size_type find_last_not_of (const charT* s, size_type pos = npos) const
{ return find_last_not_of (s, pos, traits::length (s)); }
size_type find_last_not_of (charT c, size_type pos = npos) const;
basic_string substr (size_type pos = 0, size_type n = npos) const
{ return basic_string (*this, pos, n); }
int compare (const basic_string& str, size_type pos = 0, size_type n = npos) const;
// There is no 'strncmp' equivalent for charT pointers.
int compare (const charT* s, size_type pos, size_type n) const;
int compare (const charT* s, size_type pos = 0) const
{ return compare (s, pos, traits::length (s)); }
iterator begin () { selfish (); return &(*this)[0]; }
iterator end () { selfish (); return &(*this)[length ()]; }
private:
iterator ibegin () const { return &(*rep ())[0]; }
iterator iend () const { return &(*rep ())[length ()]; }
public:
const_iterator begin () const { return ibegin (); }
const_iterator end () const { return iend (); }
reverse_iterator rbegin() { return reverse_iterator (end ()); }
const_reverse_iterator rbegin() const
{ return const_reverse_iterator (end ()); }
reverse_iterator rend() { return reverse_iterator (begin ()); }
const_reverse_iterator rend() const
{ return const_reverse_iterator (begin ()); }
private:
void alloc (size_type size, bool save);
static size_type _find (const charT* ptr, charT c, size_type xpos, size_type len);
inline bool check_realloc (size_type s) const;
static Rep nilRep;
charT *dat;
};
#ifdef __STL_MEMBER_TEMPLATES
template <class charT, class traits, class Allocator> template <class InputIterator>
basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>::
replace (iterator i1, iterator i2, InputIterator j1, InputIterator j2)
#else
template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>::
replace (iterator i1, iterator i2, const_iterator j1, const_iterator j2)
#endif
{
const size_type len = length ();
size_type pos = i1 - ibegin ();
size_type n1 = i2 - i1;
size_type n2 = j2 - j1;
OUTOFRANGE (pos > len);
if (n1 > len - pos)
n1 = len - pos;
LENGTHERROR (len - n1 > max_size () - n2);
size_t newlen = len - n1 + n2;
if (check_realloc (newlen))
{
Rep *p = Rep::create (newlen);
p->copy (0, data (), pos);
p->copy (pos + n2, data () + pos + n1, len - (pos + n1));
for (; j1 != j2; ++j1, ++pos)
traits::assign ((*p)[pos], *j1);
repup (p);
}
else
{
rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1));
for (; j1 != j2; ++j1, ++pos)
traits::assign ((*rep ())[pos], *j1);
}
rep ()->len = newlen;
return *this;
}
template <class charT, class traits, class Allocator>
inline basic_string <charT, traits, Allocator>
operator+ (const basic_string <charT, traits, Allocator>& lhs,
const basic_string <charT, traits, Allocator>& rhs)
{
basic_string <charT, traits, Allocator> str (lhs);
str.append (rhs);
return str;
}
template <class charT, class traits, class Allocator>
inline basic_string <charT, traits, Allocator>
operator+ (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
basic_string <charT, traits, Allocator> str (lhs);
str.append (rhs);
return str;
}
template <class charT, class traits, class Allocator>
inline basic_string <charT, traits, Allocator>
operator+ (charT lhs, const basic_string <charT, traits, Allocator>& rhs)
{
basic_string <charT, traits, Allocator> str (1, lhs);
str.append (rhs);
return str;
}
template <class charT, class traits, class Allocator>
inline basic_string <charT, traits, Allocator>
operator+ (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
basic_string <charT, traits, Allocator> str (lhs);
str.append (rhs);
return str;
}
template <class charT, class traits, class Allocator>
inline basic_string <charT, traits, Allocator>
operator+ (const basic_string <charT, traits, Allocator>& lhs, charT rhs)
{
basic_string <charT, traits, Allocator> str (lhs);
str.append (1, rhs);
return str;
}
template <class charT, class traits, class Allocator>
inline bool
operator== (const basic_string <charT, traits, Allocator>& lhs,
const basic_string <charT, traits, Allocator>& rhs)
{
return (lhs.compare (rhs) == 0);
}
template <class charT, class traits, class Allocator>
inline bool
operator== (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
return (rhs.compare (lhs) == 0);
}
template <class charT, class traits, class Allocator>
inline bool
operator== (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
return (lhs.compare (rhs) == 0);
}
template <class charT, class traits, class Allocator>
inline bool
operator!= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
return (rhs.compare (lhs) != 0);
}
template <class charT, class traits, class Allocator>
inline bool
operator!= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
return (lhs.compare (rhs) != 0);
}
template <class charT, class traits, class Allocator>
inline bool
operator< (const basic_string <charT, traits, Allocator>& lhs,
const basic_string <charT, traits, Allocator>& rhs)
{
return (lhs.compare (rhs) < 0);
}
template <class charT, class traits, class Allocator>
inline bool
operator< (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
return (rhs.compare (lhs) > 0);
}
template <class charT, class traits, class Allocator>
inline bool
operator< (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
return (lhs.compare (rhs) < 0);
}
template <class charT, class traits, class Allocator>
inline bool
operator> (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
return (rhs.compare (lhs) < 0);
}
template <class charT, class traits, class Allocator>
inline bool
operator> (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
return (lhs.compare (rhs) > 0);
}
template <class charT, class traits, class Allocator>
inline bool
operator<= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
return (rhs.compare (lhs) >= 0);
}
template <class charT, class traits, class Allocator>
inline bool
operator<= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
return (lhs.compare (rhs) <= 0);
}
template <class charT, class traits, class Allocator>
inline bool
operator>= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
return (rhs.compare (lhs) <= 0);
}
template <class charT, class traits, class Allocator>
inline bool
operator>= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
return (lhs.compare (rhs) >= 0);
}
template <class charT, class traits, class Allocator>
inline bool
operator!= (const basic_string <charT, traits, Allocator>& lhs,
const basic_string <charT, traits, Allocator>& rhs)
{
return (lhs.compare (rhs) != 0);
}
template <class charT, class traits, class Allocator>
inline bool
operator> (const basic_string <charT, traits, Allocator>& lhs,
const basic_string <charT, traits, Allocator>& rhs)
{
return (lhs.compare (rhs) > 0);
}
template <class charT, class traits, class Allocator>
inline bool
operator<= (const basic_string <charT, traits, Allocator>& lhs,
const basic_string <charT, traits, Allocator>& rhs)
{
return (lhs.compare (rhs) <= 0);
}
template <class charT, class traits, class Allocator>
inline bool
operator>= (const basic_string <charT, traits, Allocator>& lhs,
const basic_string <charT, traits, Allocator>& rhs)
{
return (lhs.compare (rhs) >= 0);
}
class istream; class ostream;
template <class charT, class traits, class Allocator> istream&
operator>> (istream&, basic_string <charT, traits, Allocator>&);
template <class charT, class traits, class Allocator> ostream&
operator<< (ostream&, const basic_string <charT, traits, Allocator>&);
template <class charT, class traits, class Allocator> istream&
getline (istream&, basic_string <charT, traits, Allocator>&, charT delim = '\n');
} // extern "C++"
#include <std/bastring.cc>
#endif

View File

@ -1,273 +0,0 @@
// Member templates for the -*- C++ -*- complex number classes.
// Copyright (C) 1994 Free Software Foundation
// This file is part of the GNU ANSI C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// As a special exception, if you link this library with files
// compiled with a GNU compiler to produce an executable, this does not cause
// the resulting executable to be covered by the GNU General Public License.
// This exception does not however invalidate any other reasons why
// the executable file might be covered by the GNU General Public License.
// Written by Jason Merrill based upon the specification in the 27 May 1994
// C++ working paper, ANSI document X3J16/94-0098.
#include <complex>
extern "C++" {
template <class FLOAT> complex<FLOAT>
cos (const complex<FLOAT>& x)
{
return complex<FLOAT> (cos (real (x)) * cosh (imag (x)),
- sin (real (x)) * sinh (imag (x)));
}
template <class FLOAT> complex<FLOAT>
cosh (const complex<FLOAT>& x)
{
return complex<FLOAT> (cosh (real (x)) * cos (imag (x)),
sinh (real (x)) * sin (imag (x)));
}
template <class FLOAT> complex<FLOAT>
exp (const complex<FLOAT>& x)
{
return polar (FLOAT (exp (real (x))), imag (x));
}
template <class FLOAT> complex<FLOAT>
log (const complex<FLOAT>& x)
{
return complex<FLOAT> (log (abs (x)), arg (x));
}
template <class FLOAT> complex<FLOAT>
pow (const complex<FLOAT>& x, const complex<FLOAT>& y)
{
FLOAT logr = log (abs (x));
FLOAT t = arg (x);
return polar (FLOAT (exp (logr * real (y) - imag (y) * t)),
FLOAT (imag (y) * logr + real (y) * t));
}
template <class FLOAT> complex<FLOAT>
pow (const complex<FLOAT>& x, FLOAT y)
{
return exp (FLOAT (y) * log (x));
}
template <class FLOAT> complex<FLOAT>
pow (FLOAT x, const complex<FLOAT>& y)
{
return exp (y * FLOAT (log (x)));
}
template <class FLOAT> complex<FLOAT>
sin (const complex<FLOAT>& x)
{
return complex<FLOAT> (sin (real (x)) * cosh (imag (x)),
cos (real (x)) * sinh (imag (x)));
}
template <class FLOAT> complex<FLOAT>
sinh (const complex<FLOAT>& x)
{
return complex<FLOAT> (sinh (real (x)) * cos (imag (x)),
cosh (real (x)) * sin (imag (x)));
}
#include <iostream.h>
template <class FLOAT> istream&
operator >> (istream& is, complex<FLOAT>& x)
{
FLOAT re, im = 0;
char ch = 0;
if (is.ipfx0 ())
{
if (is.peek () == '(')
is >> ch;
is >> re;
if (ch == '(')
{
is >> ch;
if (ch == ',')
is >> im >> ch;
}
}
is.isfx ();
if (ch != 0 && ch != ')')
is.setstate (ios::failbit);
else if (is.good ())
x = complex<FLOAT> (re, im);
return is;
}
template <class FLOAT> ostream&
operator << (ostream& os, const complex<FLOAT>& x)
{
return os << '(' << real (x) << ',' << imag (x) << ')';
}
// The code below is adapted from f2c's libF77, and is subject to this
// copyright:
/****************************************************************
Copyright 1990, 1991, 1992, 1993 by AT&T Bell Laboratories and Bellcore.
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the names of AT&T Bell Laboratories or
Bellcore or any of their entities not be used in advertising or
publicity pertaining to distribution of the software without
specific, written prior permission.
AT&T and Bellcore disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall AT&T or Bellcore be liable for
any special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
****************************************************************/
template <class FLOAT> complex<FLOAT>&
__doadv (complex<FLOAT>* ths, const complex<FLOAT>& y)
{
FLOAT ar = abs (y.re);
FLOAT ai = abs (y.im);
FLOAT nr, ni;
FLOAT t, d;
if (ar <= ai)
{
t = y.re / y.im;
d = y.im * (1 + t*t);
nr = (ths->re * t + ths->im) / d;
ni = (ths->im * t - ths->re) / d;
}
else
{
t = y.im / y.re;
d = y.re * (1 + t*t);
nr = (ths->re + ths->im * t) / d;
ni = (ths->im - ths->re * t) / d;
}
ths->re = nr;
ths->im = ni;
return *ths;
}
template <class FLOAT> complex<FLOAT>
operator / (const complex<FLOAT>& x, const complex<FLOAT>& y)
{
FLOAT ar = abs (real (y));
FLOAT ai = abs (imag (y));
FLOAT nr, ni;
FLOAT t, d;
if (ar <= ai)
{
t = real (y) / imag (y);
d = imag (y) * (1 + t*t);
nr = (real (x) * t + imag (x)) / d;
ni = (imag (x) * t - real (x)) / d;
}
else
{
t = imag (y) / real (y);
d = real (y) * (1 + t*t);
nr = (real (x) + imag (x) * t) / d;
ni = (imag (x) - real (x) * t) / d;
}
return complex<FLOAT> (nr, ni);
}
template <class FLOAT> complex<FLOAT>
operator / (FLOAT x, const complex<FLOAT>& y)
{
FLOAT ar = abs (real (y));
FLOAT ai = abs (imag (y));
FLOAT nr, ni;
FLOAT t, d;
if (ar <= ai)
{
t = real (y) / imag (y);
d = imag (y) * (1 + t*t);
nr = x * t / d;
ni = -x / d;
}
else
{
t = imag (y) / real (y);
d = real (y) * (1 + t*t);
nr = x / d;
ni = -x * t / d;
}
return complex<FLOAT> (nr, ni);
}
template <class FLOAT> complex<FLOAT>
pow (const complex<FLOAT>& xin, int y)
{
if (y == 0)
return complex<FLOAT> (1.0);
complex<FLOAT> r (1.0);
complex<FLOAT> x (xin);
if (y < 0)
{
y = -y;
x = FLOAT(1)/x;
}
for (;;)
{
if (y & 1)
r *= x;
if (y >>= 1)
x *= x;
else
return r;
}
}
template <class FLOAT> complex<FLOAT>
sqrt (const complex<FLOAT>& x)
{
FLOAT r = abs (x);
FLOAT nr, ni;
if (r == 0.0)
nr = ni = r;
else if (real (x) > 0)
{
nr = sqrt (0.5 * (r + real (x)));
ni = imag (x) / nr / 2;
}
else
{
ni = sqrt (0.5 * (r - real (x)));
if (imag (x) < 0)
ni = - ni;
nr = imag (x) / ni / 2;
}
return complex<FLOAT> (nr, ni);
}
} // extern "C++"

View File

@ -1,400 +0,0 @@
// The template and inlines for the -*- C++ -*- complex number classes.
// Copyright (C) 1994 Free Software Foundation
// This file is part of the GNU ANSI C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms of
// the GNU General Public License as published by the Free Software
// Foundation; either version 2, or (at your option) any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// As a special exception, if you link this library with files compiled
// with a GNU compiler to produce an executable, this does not cause the
// resulting executable to be covered by the GNU General Public License.
// This exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
// Written by Jason Merrill based upon the specification in the 27 May 1994
// C++ working paper, ANSI document X3J16/94-0098.
#ifndef __COMPLEXT__
#define __COMPLEXT__
#ifdef __GNUG__
#pragma interface
#endif
#include <cmath>
#if ! defined (__GNUG__) && ! defined (__attribute__)
#define __attribute__(foo) /* Ignore. */
#endif
class istream;
class ostream;
extern "C++" {
template <class _FLT> class complex;
template <class _FLT> complex<_FLT>&
__doapl (complex<_FLT>* ths, const complex<_FLT>& r);
template <class _FLT> complex<_FLT>&
__doami (complex<_FLT>* ths, const complex<_FLT>& r);
template <class _FLT> complex<_FLT>&
__doaml (complex<_FLT>* ths, const complex<_FLT>& r);
template <class _FLT> complex<_FLT>&
__doadv (complex<_FLT>* ths, const complex<_FLT>& r);
template <class _FLT>
class complex
{
public:
complex (_FLT r = 0, _FLT i = 0): re (r), im (i) { }
complex& operator += (const complex&);
complex& operator -= (const complex&);
complex& operator *= (const complex&);
complex& operator /= (const complex&);
_FLT real () const { return re; }
_FLT imag () const { return im; }
private:
_FLT re, im;
friend complex& __doapl<> (complex *, const complex&);
friend complex& __doami<> (complex *, const complex&);
friend complex& __doaml<> (complex *, const complex&);
friend complex& __doadv<> (complex *, const complex&);
};
// Declare specializations.
class complex<float>;
class complex<double>;
class complex<long double>;
template <class _FLT>
inline complex<_FLT>&
__doapl (complex<_FLT>* ths, const complex<_FLT>& r)
{
ths->re += r.re;
ths->im += r.im;
return *ths;
}
template <class _FLT>
inline complex<_FLT>&
complex<_FLT>::operator += (const complex<_FLT>& r)
{
return __doapl (this, r);
}
template <class _FLT>
inline complex<_FLT>&
__doami (complex<_FLT>* ths, const complex<_FLT>& r)
{
ths->re -= r.re;
ths->im -= r.im;
return *ths;
}
template <class _FLT>
inline complex<_FLT>&
complex<_FLT>::operator -= (const complex<_FLT>& r)
{
return __doami (this, r);
}
template <class _FLT>
inline complex<_FLT>&
__doaml (complex<_FLT>* ths, const complex<_FLT>& r)
{
_FLT f = ths->re * r.re - ths->im * r.im;
ths->im = ths->re * r.im + ths->im * r.re;
ths->re = f;
return *ths;
}
template <class _FLT>
inline complex<_FLT>&
complex<_FLT>::operator *= (const complex<_FLT>& r)
{
return __doaml (this, r);
}
template <class _FLT>
inline complex<_FLT>&
complex<_FLT>::operator /= (const complex<_FLT>& r)
{
return __doadv (this, r);
}
template <class _FLT> inline _FLT
imag (const complex<_FLT>& x) __attribute__ ((const));
template <class _FLT> inline _FLT
imag (const complex<_FLT>& x)
{
return x.imag ();
}
template <class _FLT> inline _FLT
real (const complex<_FLT>& x) __attribute__ ((const));
template <class _FLT> inline _FLT
real (const complex<_FLT>& x)
{
return x.real ();
}
template <class _FLT> inline complex<_FLT>
operator + (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
template <class _FLT> inline complex<_FLT>
operator + (const complex<_FLT>& x, const complex<_FLT>& y)
{
return complex<_FLT> (real (x) + real (y), imag (x) + imag (y));
}
template <class _FLT> inline complex<_FLT>
operator + (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
template <class _FLT> inline complex<_FLT>
operator + (const complex<_FLT>& x, _FLT y)
{
return complex<_FLT> (real (x) + y, imag (x));
}
template <class _FLT> inline complex<_FLT>
operator + (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
template <class _FLT> inline complex<_FLT>
operator + (_FLT x, const complex<_FLT>& y)
{
return complex<_FLT> (x + real (y), imag (y));
}
template <class _FLT> inline complex<_FLT>
operator - (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
template <class _FLT> inline complex<_FLT>
operator - (const complex<_FLT>& x, const complex<_FLT>& y)
{
return complex<_FLT> (real (x) - real (y), imag (x) - imag (y));
}
template <class _FLT> inline complex<_FLT>
operator - (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
template <class _FLT> inline complex<_FLT>
operator - (const complex<_FLT>& x, _FLT y)
{
return complex<_FLT> (real (x) - y, imag (x));
}
template <class _FLT> inline complex<_FLT>
operator - (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
template <class _FLT> inline complex<_FLT>
operator - (_FLT x, const complex<_FLT>& y)
{
return complex<_FLT> (x - real (y), - imag (y));
}
template <class _FLT> inline complex<_FLT>
operator * (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
template <class _FLT> inline complex<_FLT>
operator * (const complex<_FLT>& x, const complex<_FLT>& y)
{
return complex<_FLT> (real (x) * real (y) - imag (x) * imag (y),
real (x) * imag (y) + imag (x) * real (y));
}
template <class _FLT> inline complex<_FLT>
operator * (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
template <class _FLT> inline complex<_FLT>
operator * (const complex<_FLT>& x, _FLT y)
{
return complex<_FLT> (real (x) * y, imag (x) * y);
}
template <class _FLT> inline complex<_FLT>
operator * (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
template <class _FLT> inline complex<_FLT>
operator * (_FLT x, const complex<_FLT>& y)
{
return complex<_FLT> (x * real (y), x * imag (y));
}
template <class _FLT> complex<_FLT>
operator / (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
template <class _FLT> complex<_FLT>
operator / (const complex<_FLT>& x, _FLT y)
{
return complex<_FLT> (real (x) / y, imag (x) / y);
}
template <class _FLT> inline complex<_FLT>
operator + (const complex<_FLT>& x) __attribute__ ((const));
template <class _FLT> inline complex<_FLT>
operator + (const complex<_FLT>& x)
{
return x;
}
template <class _FLT> inline complex<_FLT>
operator - (const complex<_FLT>& x) __attribute__ ((const));
template <class _FLT> inline complex<_FLT>
operator - (const complex<_FLT>& x)
{
return complex<_FLT> (-real (x), -imag (x));
}
template <class _FLT> inline bool
operator == (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
template <class _FLT> inline bool
operator == (const complex<_FLT>& x, const complex<_FLT>& y)
{
return real (x) == real (y) && imag (x) == imag (y);
}
template <class _FLT> inline bool
operator == (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
template <class _FLT> inline bool
operator == (const complex<_FLT>& x, _FLT y)
{
return real (x) == y && imag (x) == 0;
}
template <class _FLT> inline bool
operator == (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
template <class _FLT> inline bool
operator == (_FLT x, const complex<_FLT>& y)
{
return x == real (y) && imag (y) == 0;
}
template <class _FLT> inline bool
operator != (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
template <class _FLT> inline bool
operator != (const complex<_FLT>& x, const complex<_FLT>& y)
{
return real (x) != real (y) || imag (x) != imag (y);
}
template <class _FLT> inline bool
operator != (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
template <class _FLT> inline bool
operator != (const complex<_FLT>& x, _FLT y)
{
return real (x) != y || imag (x) != 0;
}
template <class _FLT> inline bool
operator != (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
template <class _FLT> inline bool
operator != (_FLT x, const complex<_FLT>& y)
{
return x != real (y) || imag (y) != 0;
}
// Some targets don't provide a prototype for hypot when -ansi.
extern "C" double hypot (double, double) __attribute__ ((const));
template <class _FLT> inline _FLT
abs (const complex<_FLT>& x) __attribute__ ((const));
template <class _FLT> inline _FLT
abs (const complex<_FLT>& x)
{
return hypot (real (x), imag (x));
}
template <class _FLT> inline _FLT
arg (const complex<_FLT>& x) __attribute__ ((const));
template <class _FLT> inline _FLT
arg (const complex<_FLT>& x)
{
return atan2 (imag (x), real (x));
}
template <class _FLT> inline complex<_FLT>
polar (_FLT r, _FLT t) __attribute__ ((const));
template <class _FLT> inline complex<_FLT>
polar (_FLT r, _FLT t)
{
return complex<_FLT> (r * cos (t), r * sin (t));
}
template <class _FLT> inline complex<_FLT>
conj (const complex<_FLT>& x) __attribute__ ((const));
template <class _FLT> inline complex<_FLT>
conj (const complex<_FLT>& x)
{
return complex<_FLT> (real (x), -imag (x));
}
template <class _FLT> inline _FLT
norm (const complex<_FLT>& x) __attribute__ ((const));
template <class _FLT> inline _FLT
norm (const complex<_FLT>& x)
{
return real (x) * real (x) + imag (x) * imag (x);
}
// Declarations of templates in complext.ccI
template <class _FLT> complex<_FLT>
operator / (const complex<_FLT>&, const complex<_FLT>&) __attribute__ ((const));
template <class _FLT> complex<_FLT>
operator / (_FLT, const complex<_FLT>&) __attribute__ ((const));
template <class _FLT> complex<_FLT>
cos (const complex<_FLT>&) __attribute__ ((const));
template <class _FLT> complex<_FLT>
cosh (const complex<_FLT>&) __attribute__ ((const));
template <class _FLT> complex<_FLT>
exp (const complex<_FLT>&) __attribute__ ((const));
template <class _FLT> complex<_FLT>
log (const complex<_FLT>&) __attribute__ ((const));
template <class _FLT> complex<_FLT>
pow (const complex<_FLT>&, const complex<_FLT>&) __attribute__ ((const));
template <class _FLT> complex<_FLT>
pow (const complex<_FLT>&, _FLT) __attribute__ ((const));
template <class _FLT> complex<_FLT>
pow (const complex<_FLT>&, int) __attribute__ ((const));
template <class _FLT> complex<_FLT>
pow (_FLT, const complex<_FLT>&) __attribute__ ((const));
template <class _FLT> complex<_FLT>
sin (const complex<_FLT>&) __attribute__ ((const));
template <class _FLT> complex<_FLT>
sinh (const complex<_FLT>&) __attribute__ ((const));
template <class _FLT> complex<_FLT>
sqrt (const complex<_FLT>&) __attribute__ ((const));
template <class _FLT> istream& operator >> (istream&, complex<_FLT>&);
template <class _FLT> ostream& operator << (ostream&, const complex<_FLT>&);
} // extern "C++"
// Specializations and such
#include <std/fcomplex.h>
#include <std/dcomplex.h>
#include <std/ldcomplex.h>
#endif

View File

@ -1,91 +0,0 @@
// The -*- C++ -*- double_complex class.
// Copyright (C) 1994 Free Software Foundation
// This file is part of the GNU ANSI C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// As a special exception, if you link this library with files
// compiled with a GNU compiler to produce an executable, this does not cause
// the resulting executable to be covered by the GNU General Public License.
// This exception does not however invalidate any other reasons why
// the executable file might be covered by the GNU General Public License.
// Written by Jason Merrill based upon the specification in the 27 May 1994
// C++ working paper, ANSI document X3J16/94-0098.
#ifndef __DCOMPLEX__
#define __DCOMPLEX__
#ifdef __GNUG__
#pragma interface "dcomplex"
#endif
extern "C++" {
class complex<double>
{
public:
complex (double r = 0, double i = 0): re (r), im (i) { }
complex (const complex<float>& r): re (r.real ()), im (r.imag ()) { }
explicit complex (const complex<long double>& r);
complex& operator+= (const complex& r) { return __doapl (this, r); }
complex& operator-= (const complex& r) { return __doami (this, r); }
complex& operator*= (const complex& r) { return __doaml (this, r); }
complex& operator/= (const complex& r) { return __doadv (this, r); }
double real () const { return re; }
double imag () const { return im; }
private:
double re, im;
friend complex& __doapl<> (complex *, const complex&);
friend complex& __doami<> (complex *, const complex&);
friend complex& __doaml<> (complex *, const complex&);
friend complex& __doadv<> (complex *, const complex&);
#ifndef __STRICT_ANSI__
friend inline complex operator + (const complex& x, double y)
{ return operator+<> (x, y); }
friend inline complex operator + (double x, const complex& y)
{ return operator+<> (x, y); }
friend inline complex operator - (const complex& x, double y)
{ return operator-<> (x, y); }
friend inline complex operator - (double x, const complex& y)
{ return operator-<> (x, y); }
friend inline complex operator * (const complex& x, double y)
{ return operator*<> (x, y); }
friend inline complex operator * (double x, const complex& y)
{ return operator*<> (x, y); }
friend inline complex operator / (const complex& x, double y)
{ return operator/<> (x, y); }
friend inline complex operator / (double x, const complex& y)
{ return operator/<> (x, y); }
friend inline bool operator == (const complex& x, double y)
{ return operator==<> (x, y); }
friend inline bool operator == (double x, const complex& y)
{ return operator==<> (x, y); }
friend inline bool operator != (const complex& x, double y)
{ return operator!=<> (x, y); }
friend inline bool operator != (double x, const complex& y)
{ return operator!=<> (x, y); }
#endif /* __STRICT_ANSI__ */
};
inline complex<float>::complex (const complex<double>& r)
: re (r.real ()), im (r.imag ())
{ }
} // extern "C++"
#endif

View File

@ -1,87 +0,0 @@
// The -*- C++ -*- float_complex class.
// Copyright (C) 1994 Free Software Foundation
// This file is part of the GNU ANSI C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// As a special exception, if you link this library with files
// compiled with a GNU compiler to produce an executable, this does not cause
// the resulting executable to be covered by the GNU General Public License.
// This exception does not however invalidate any other reasons why
// the executable file might be covered by the GNU General Public License.
// Written by Jason Merrill based upon the specification in the 27 May 1994
// C++ working paper, ANSI document X3J16/94-0098.
#ifndef __FCOMPLEX__
#define __FCOMPLEX__
#ifdef __GNUG__
#pragma interface "fcomplex"
#endif
extern "C++" {
class complex<float>
{
public:
complex (float r = 0, float i = 0): re (r), im (i) { }
explicit complex (const complex<double>& r);
explicit complex (const complex<long double>& r);
complex& operator+= (const complex& r) { return __doapl (this, r); }
complex& operator-= (const complex& r) { return __doami (this, r); }
complex& operator*= (const complex& r) { return __doaml (this, r); }
complex& operator/= (const complex& r) { return __doadv (this, r); }
float real () const { return re; }
float imag () const { return im; }
private:
float re, im;
friend complex& __doapl<> (complex *, const complex&);
friend complex& __doami<> (complex *, const complex&);
friend complex& __doaml<> (complex *, const complex&);
friend complex& __doadv<> (complex *, const complex&);
#ifndef __STRICT_ANSI__
friend inline complex operator + (const complex& x, float y)
{ return operator+<> (x, y); }
friend inline complex operator + (float x, const complex& y)
{ return operator+<> (x, y); }
friend inline complex operator - (const complex& x, float y)
{ return operator-<> (x, y); }
friend inline complex operator - (float x, const complex& y)
{ return operator-<> (x, y); }
friend inline complex operator * (const complex& x, float y)
{ return operator*<> (x, y); }
friend inline complex operator * (float x, const complex& y)
{ return operator*<> (x, y); }
friend inline complex operator / (const complex& x, float y)
{ return operator/<> (x, y); }
friend inline complex operator / (float x, const complex& y)
{ return operator/<> (x, y); }
friend inline bool operator == (const complex& x, float y)
{ return operator==<> (x, y); }
friend inline bool operator == (float x, const complex& y)
{ return operator==<> (x, y); }
friend inline bool operator != (const complex& x, float y)
{ return operator!=<> (x, y); }
friend inline bool operator != (float x, const complex& y)
{ return operator!=<> (x, y); }
#endif /* __STRICT_ANSI__ */
};
} // extern "C++"
#endif

View File

@ -1,111 +0,0 @@
// The template and inlines for the -*- C++ -*- gslice class.
// Copyright (C) 1997-1999 Cygnus Solutions
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
#ifndef __GSLICE__
#define __GSLICE__
extern "C++" {
struct _Indexer {
size_t _M_count;
size_t _M_start;
valarray<size_t> _M_size;
valarray<size_t> _M_stride;
valarray<size_t> _M_index;
_Indexer(size_t, const valarray<size_t>&, const valarray<size_t>&);
void _M_increment_use() { ++_M_count; }
size_t _M_decrement_use() { return --_M_count; }
};
class gslice
{
public:
gslice ();
gslice (size_t, const valarray<size_t>&, const valarray<size_t>&);
gslice(const gslice&);
~gslice();
gslice& operator= (const gslice&);
size_t start () const;
valarray<size_t> size () const;
valarray<size_t> stride () const;
private:
_Indexer* _M_index;
template<typename _Tp> friend class valarray;
};
inline size_t
gslice::start () const
{ return _M_index ? _M_index->_M_start : 0; }
inline valarray<size_t>
gslice::size () const
{ return _M_index ? _M_index->_M_size : valarray<size_t>(); }
inline valarray<size_t>
gslice::stride () const
{ return _M_index ? _M_index->_M_stride : valarray<size_t>(); }
inline gslice::gslice () : _M_index(0) {}
inline
gslice::gslice(size_t __o, const valarray<size_t>& __l,
const valarray<size_t>& __s)
: _M_index(new _Indexer(__o, __l, __s)) {}
inline
gslice::gslice(const gslice& __g) : _M_index(__g._M_index)
{ if (_M_index) _M_index->_M_increment_use(); }
inline
gslice::~gslice()
{ if (_M_index && _M_index->_M_decrement_use() == 0) delete _M_index; }
inline gslice&
gslice::operator= (const gslice& __g)
{
if (__g._M_index) __g._M_index->_M_increment_use();
if (_M_index && _M_index->_M_decrement_use() == 0) delete _M_index;
_M_index = __g._M_index;
return *this;
}
} // extern "C++"
#endif // __GSLICE__
// Local Variables:
// mode:c++
// End:

View File

@ -1,170 +0,0 @@
// The template and inlines for the -*- C++ -*- gslice_array class.
// Copyright (C) 1997-1999 Cygnus Solutions
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
#ifndef __GSLICE_ARRAY__
#define __GSLICE_ARRAY__
extern "C++" {
template<typename _Tp> class gslice_array
{
public:
typedef _Tp value_type;
void operator= (const valarray<_Tp>&) const;
void operator*= (const valarray<_Tp>&) const;
void operator/= (const valarray<_Tp>&) const;
void operator%= (const valarray<_Tp>&) const;
void operator+= (const valarray<_Tp>&) const;
void operator-= (const valarray<_Tp>&) const;
void operator^= (const valarray<_Tp>&) const;
void operator&= (const valarray<_Tp>&) const;
void operator|= (const valarray<_Tp>&) const;
void operator<<=(const valarray<_Tp>&) const;
void operator>>=(const valarray<_Tp>&) const;
void operator=(const _Tp&);
template<class _Dom>
void operator= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator*= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator/= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator%= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator+= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator-= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator^= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator&= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator|= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator<<= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator>>= (const _Expr<_Dom,_Tp>&) const;
private:
_Array<_Tp> _M_array;
const valarray<size_t>& _M_index;
friend class valarray<_Tp>;
gslice_array (_Array<_Tp>, const valarray<size_t>&);
// this constructor needs to be implemented.
gslice_array (const gslice_array&);
// not implemented
gslice_array();
gslice_array& operator= (const gslice_array&);
};
template<typename _Tp>
inline
gslice_array<_Tp>::gslice_array (_Array<_Tp> __a,
const valarray<size_t>& __i)
: _M_array (__a), _M_index (__i) {}
template<typename _Tp>
inline
gslice_array<_Tp>::gslice_array (const gslice_array<_Tp>& __a)
: _M_array (__a._M_array), _M_index (__a._M_index) {}
template<typename _Tp>
inline void
gslice_array<_Tp>::operator= (const _Tp& __t)
{
__valarray_fill (_M_array, _Array<size_t>(_M_index),
_M_index.size(), __t);
}
template<typename _Tp>
inline void
gslice_array<_Tp>::operator= (const valarray<_Tp>& __v) const
{
__valarray_copy (_Array<_Tp> (__v), __v.size (),
_M_array, _Array<size_t>(_M_index));
}
template<typename _Tp>
template<class E>
inline void
gslice_array<_Tp>::operator= (const _Expr<E, _Tp>& __e) const
{
__valarray_copy (__e, _M_index.size(), _M_array,
_Array<size_t>(_M_index));
}
#undef _DEFINE_VALARRAY_OPERATOR
#define _DEFINE_VALARRAY_OPERATOR(op, name) \
template<typename _Tp> \
inline void \
gslice_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const \
{ \
_Array_augmented_##name (_M_array, _Array<size_t>(_M_index), \
_Array<_Tp> (__v), __v.size ()); \
} \
\
template<typename _Tp> template<class E> \
inline void \
gslice_array<_Tp>::operator##op##= (const _Expr<E, _Tp>& __e) const \
{ \
_Array_augmented_##name (_M_array, _Array<size_t>(_M_index), __e, \
_M_index.size()); \
}
_DEFINE_VALARRAY_OPERATOR(*, multiplies)
_DEFINE_VALARRAY_OPERATOR(/, divides)
_DEFINE_VALARRAY_OPERATOR(%, modulus)
_DEFINE_VALARRAY_OPERATOR(+, plus)
_DEFINE_VALARRAY_OPERATOR(-, minus)
_DEFINE_VALARRAY_OPERATOR(^, xor)
_DEFINE_VALARRAY_OPERATOR(&, and)
_DEFINE_VALARRAY_OPERATOR(|, or)
_DEFINE_VALARRAY_OPERATOR(<<, shift_left)
_DEFINE_VALARRAY_OPERATOR(>>, shift_right)
#undef _DEFINE_VALARRAY_OPERATOR
} // extern "C++"
#endif // __GSLICE_ARRAY__
// Local Variables:
// mode:c++
// End:

View File

@ -1,157 +0,0 @@
// The template and inlines for the -*- C++ -*- indirect_array class.
// Copyright (C) 1997-1999 Cygnus Solutions
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
#ifndef __INDIRECT_ARRAY__
#define __INDIRECT_ARRAY__
extern "C++" {
template <class _Tp> class indirect_array
{
public:
typedef _Tp value_type;
void operator= (const valarray<_Tp>&) const;
void operator*= (const valarray<_Tp>&) const;
void operator/= (const valarray<_Tp>&) const;
void operator%= (const valarray<_Tp>&) const;
void operator+= (const valarray<_Tp>&) const;
void operator-= (const valarray<_Tp>&) const;
void operator^= (const valarray<_Tp>&) const;
void operator&= (const valarray<_Tp>&) const;
void operator|= (const valarray<_Tp>&) const;
void operator<<= (const valarray<_Tp>&) const;
void operator>>= (const valarray<_Tp>&) const;
void operator= (const _Tp&);
template<class _Dom>
void operator= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator*= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator/= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator%= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator+= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator-= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator^= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator&= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator|= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator<<= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator>>= (const _Expr<_Dom, _Tp>&) const;
private:
indirect_array (const indirect_array&);
indirect_array (_Array<_Tp>, size_t, _Array<size_t>);
friend class valarray<_Tp>;
friend class gslice_array<_Tp>;
const size_t _M_sz;
const _Array<size_t> _M_index;
const _Array<_Tp> _M_array;
// not implemented
indirect_array ();
indirect_array& operator= (const indirect_array&);
};
template<typename _Tp>
inline indirect_array<_Tp>::indirect_array(const indirect_array<_Tp>& __a)
: _M_sz (__a._M_sz), _M_index (__a._M_index),
_M_array (__a._M_array) {}
template<typename _Tp>
inline
indirect_array<_Tp>::indirect_array (_Array<_Tp> __a, size_t __s,
_Array<size_t> __i)
: _M_sz (__s), _M_index (__i), _M_array (__a) {}
template<typename _Tp>
inline void
indirect_array<_Tp>::operator= (const _Tp& __t)
{ __valarray_fill(_M_array, _M_index, _M_sz, __t); }
template<typename _Tp>
inline void
indirect_array<_Tp>::operator= (const valarray<_Tp>& __v) const
{ __valarray_copy (_Array<_Tp> (__v), _M_sz, _M_array, _M_index); }
template<typename _Tp>
template<class _Dom>
inline void
indirect_array<_Tp>::operator= (const _Expr<_Dom,_Tp>& __e) const
{ __valarray_copy (__e, _M_sz, _M_array, _M_index); }
#undef _DEFINE_VALARRAY_OPERATOR
#define _DEFINE_VALARRAY_OPERATOR(op, name) \
template<typename _Tp> \
inline void \
indirect_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const \
{ \
_Array_augmented_##name (_M_array, _M_index, _Array<_Tp> (__v), _M_sz); \
} \
\
template<typename _Tp> template<class _Dom> \
inline void \
indirect_array<_Tp>::operator##op##= (const _Expr<_Dom,_Tp>& __e) const \
{ \
_Array_augmented_##name (_M_array, _M_index, __e, _M_sz); \
}
_DEFINE_VALARRAY_OPERATOR(*, multiplies)
_DEFINE_VALARRAY_OPERATOR(/, divides)
_DEFINE_VALARRAY_OPERATOR(%, modulus)
_DEFINE_VALARRAY_OPERATOR(+, plus)
_DEFINE_VALARRAY_OPERATOR(-, minus)
_DEFINE_VALARRAY_OPERATOR(^, xor)
_DEFINE_VALARRAY_OPERATOR(&, and)
_DEFINE_VALARRAY_OPERATOR(|, or)
_DEFINE_VALARRAY_OPERATOR(<<, shift_left)
_DEFINE_VALARRAY_OPERATOR(>>, shift_right)
#undef _DEFINE_VALARRAY_OPERATOR
} // extern "C++"
#endif // __INDIRECT_ARRAY__
// Local Variables:
// mode:c++
// End:

View File

@ -1,95 +0,0 @@
// The -*- C++ -*- long_double_complex class.
// Copyright (C) 1994 Free Software Foundation
// This file is part of the GNU ANSI C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// As a special exception, if you link this library with files
// compiled with a GNU compiler to produce an executable, this does not cause
// the resulting executable to be covered by the GNU General Public License.
// This exception does not however invalidate any other reasons why
// the executable file might be covered by the GNU General Public License.
// Written by Jason Merrill based upon the specification in the 27 May 1994
// C++ working paper, ANSI document X3J16/94-0098.
#ifndef __LDCOMPLEX__
#define __LDCOMPLEX__
#ifdef __GNUG__
#pragma interface "ldcomplex"
#endif
extern "C++" {
class complex<long double>
{
public:
complex (long double r = 0, long double i = 0): re (r), im (i) { }
complex (const complex<float>& r): re (r.real ()), im (r.imag ()) { }
complex (const complex<double>& r): re (r.real ()), im (r.imag ()) { }
complex& operator+= (const complex& r) { return __doapl (this, r); }
complex& operator-= (const complex& r) { return __doami (this, r); }
complex& operator*= (const complex& r) { return __doaml (this, r); }
complex& operator/= (const complex& r) { return __doadv (this, r); }
long double real () const { return re; }
long double imag () const { return im; }
private:
long double re, im;
friend complex& __doapl<> (complex *, const complex&);
friend complex& __doami<> (complex *, const complex&);
friend complex& __doaml<> (complex *, const complex&);
friend complex& __doadv<> (complex *, const complex&);
#ifndef __STRICT_ANSI__
friend inline complex operator + (const complex& x, long double y)
{ return operator+<> (x, y); }
friend inline complex operator + (long double x, const complex& y)
{ return operator+<> (x, y); }
friend inline complex operator - (const complex& x, long double y)
{ return operator-<> (x, y); }
friend inline complex operator - (long double x, const complex& y)
{ return operator-<> (x, y); }
friend inline complex operator * (const complex& x, long double y)
{ return operator*<> (x, y); }
friend inline complex operator * (long double x, const complex& y)
{ return operator*<> (x, y); }
friend inline complex operator / (const complex& x, long double y)
{ return operator/<> (x, y); }
friend inline complex operator / (long double x, const complex& y)
{ return operator/<> (x, y); }
friend inline bool operator == (const complex& x, long double y)
{ return operator==<> (x, y); }
friend inline bool operator == (long double x, const complex& y)
{ return operator==<> (x, y); }
friend inline bool operator != (const complex& x, long double y)
{ return operator!=<> (x, y); }
friend inline bool operator != (long double x, const complex& y)
{ return operator!=<> (x, y); }
#endif /* __STRICT_ANSI__ */
};
inline complex<float>::complex (const complex<long double>& r)
: re (r.real ()), im (r.imag ())
{ }
inline complex<double>::complex (const complex<long double>& r)
: re (r.real ()), im (r.imag ())
{ }
} // extern "C++"
#endif

View File

@ -1,154 +0,0 @@
// The template and inlines for the -*- C++ -*- mask_array class.
// Copyright (C) 1997-1999 Cygnus Solutions
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
#ifndef __MASK_ARRAY__
#define __MASK_ARRAY__
extern "C++" {
template <class _T> class mask_array
{
public:
typedef _T value_type;
void operator= (const valarray<_T>&) const;
void operator*= (const valarray<_T>&) const;
void operator/= (const valarray<_T>&) const;
void operator%= (const valarray<_T>&) const;
void operator+= (const valarray<_T>&) const;
void operator-= (const valarray<_T>&) const;
void operator^= (const valarray<_T>&) const;
void operator&= (const valarray<_T>&) const;
void operator|= (const valarray<_T>&) const;
void operator<<=(const valarray<_T>&) const;
void operator>>=(const valarray<_T>&) const;
void operator= (const _T&);
template<class _Dom>
void operator= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator*= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator/= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator%= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator+= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator-= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator^= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator&= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator|= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator<<=(const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator>>=(const _Expr<_Dom,_T>&) const;
private:
mask_array (_Array<_T>, size_t, _Array<bool>);
friend class valarray<_T>;
const size_t _M_sz;
const _Array<bool> _M_mask;
const _Array<_T> _M_array;
mask_array (const mask_array&);
// not implemented
mask_array ();
mask_array& operator= (const mask_array&);
};
template<typename _Tp>
inline mask_array<_Tp>::mask_array (const mask_array<_Tp>& a)
: _M_sz (a._M_sz), _M_mask (a._M_mask), _M_array (a._M_array) {}
template<typename _T>
inline
mask_array<_T>::mask_array (_Array<_T> __a, size_t __s, _Array<bool> __m)
: _M_sz (__s), _M_mask (__m), _M_array (__a) {}
template<typename _T>
inline void
mask_array<_T>::operator= (const _T& __t)
{ __valarray_fill (_M_array, _M_sz, _M_mask, __t); }
template<typename _T>
inline void
mask_array<_T>::operator= (const valarray<_T>& __v) const
{ __valarray_copy (_Array<_T> (__v), __v.size (), _M_array, _M_mask); }
template<typename _T>
template<class E>
inline void
mask_array<_T>::operator= (const _Expr<E, _T>& __e) const
{ __valarray_copy (__e, __e.size (), _M_array, _M_mask); }
#undef _DEFINE_VALARRAY_OPERATOR
#define _DEFINE_VALARRAY_OPERATOR(op, name) \
template<typename _T> \
inline void \
mask_array<_T>::operator##op##= (const valarray<_T>& __v) const \
{ \
_Array_augmented_##name (_M_array, _M_mask, \
_Array<_T> (__v), __v.size ()); \
} \
\
template<typename _T> template<class E> \
inline void \
mask_array<_T>::operator##op##= (const _Expr<E, _T>& __e) const \
{ \
_Array_augmented_##name (_M_array, _M_mask, __e, __e.size ()); \
}
_DEFINE_VALARRAY_OPERATOR(*, multiplies)
_DEFINE_VALARRAY_OPERATOR(/, divides)
_DEFINE_VALARRAY_OPERATOR(%, modulus)
_DEFINE_VALARRAY_OPERATOR(+, plus)
_DEFINE_VALARRAY_OPERATOR(-, minus)
_DEFINE_VALARRAY_OPERATOR(^, xor)
_DEFINE_VALARRAY_OPERATOR(&, and)
_DEFINE_VALARRAY_OPERATOR(|, or)
_DEFINE_VALARRAY_OPERATOR(<<, shift_left)
_DEFINE_VALARRAY_OPERATOR(>>, shift_right)
#undef _DEFINE_VALARRAY_OPERATOR
} // extern "C++"
#endif // __MASK_ARRAY__
// Local Variables:
// mode:c++
// End:

View File

@ -1,76 +0,0 @@
// The template and inlines for the -*- C++ -*- slice class.
// Copyright (C) 1997-1999 Cygnus Solutions
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
#ifndef __SLICE__
#define __SLICE__
extern "C++" {
class slice
{
public:
slice ();
slice (size_t, size_t, size_t);
size_t start () const;
size_t size () const;
size_t stride () const;
private:
size_t _M_off; // offset
size_t _M_sz; // size
size_t _M_st; // stride unit
};
inline slice::slice () {}
inline slice::slice (size_t __o, size_t __d, size_t __s)
: _M_off (__o), _M_sz (__d), _M_st (__s) {}
inline size_t
slice::start () const
{ return _M_off; }
inline size_t
slice::size () const
{ return _M_sz; }
inline size_t
slice::stride () const
{ return _M_st; }
} // extern "C++"
#endif // __SLICE__
// Local Variables:
// mode:c++
// End:

View File

@ -1,156 +0,0 @@
// The template and inlines for the -*- C++ -*- slice_array class.
// Copyright (C) 1997-1999 Cygnus Solutions
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
#ifndef __SLICE_ARRAY__
#define __SLICE_ARRAY__
extern "C++" {
template<typename _T>
class slice_array
{
public:
typedef _T value_type;
void operator= (const valarray<_T>&) const;
void operator*= (const valarray<_T>&) const;
void operator/= (const valarray<_T>&) const;
void operator%= (const valarray<_T>&) const;
void operator+= (const valarray<_T>&) const;
void operator-= (const valarray<_T>&) const;
void operator^= (const valarray<_T>&) const;
void operator&= (const valarray<_T>&) const;
void operator|= (const valarray<_T>&) const;
void operator<<= (const valarray<_T>&) const;
void operator>>= (const valarray<_T>&) const;
void operator= (const _T &);
template<class _Dom>
void operator= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator*= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator/= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator%= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator+= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator-= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator^= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator&= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator|= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator<<= (const _Expr<_Dom,_T>&) const;
template<class _Dom>
void operator>>= (const _Expr<_Dom,_T>&) const;
private:
friend class valarray<_T>;
slice_array(_Array<_T>, const slice&);
const size_t _M_sz;
const size_t _M_stride;
const _Array<_T> _M_array;
// this constructor is implemented since we need to return a value.
slice_array (const slice_array&);
// not implemented
slice_array ();
slice_array& operator= (const slice_array&);
};
template<typename _T>
inline slice_array<_T>::slice_array (_Array<_T> __a, const slice& __s)
: _M_sz (__s.size ()), _M_stride (__s.stride ()),
_M_array (__a.begin () + __s.start ()) {}
template<typename _Tp>
inline slice_array<_Tp>::slice_array(const slice_array<_Tp>& a)
: _M_sz(a._M_sz), _M_stride(a._M_stride), _M_array(a._M_array) {}
template<typename _T>
inline void
slice_array<_T>::operator= (const _T& __t)
{ __valarray_fill (_M_array, _M_sz, _M_stride, __t); }
template<typename _T>
inline void
slice_array<_T>::operator= (const valarray<_T>& __v) const
{ __valarray_copy (_Array<_T> (__v), _M_array, _M_sz, _M_stride); }
template<typename _T>
template<class _Dom>
inline void
slice_array<_T>::operator= (const _Expr<_Dom,_T>& __e) const
{ __valarray_copy (__e, _M_sz, _M_array, _M_stride); }
#undef _DEFINE_VALARRAY_OPERATOR
#define _DEFINE_VALARRAY_OPERATOR(op, name) \
template<typename _T> \
inline void \
slice_array<_T>::operator##op##= (const valarray<_T>& __v) const \
{ \
_Array_augmented_##name (_M_array, _M_sz, _M_stride, _Array<_T> (__v));\
} \
\
template<typename _T> template<class _Dom> \
inline void \
slice_array<_T>::operator##op##= (const _Expr<_Dom,_T>& __e) const \
{ \
_Array_augmented_##name (_M_array, _M_stride, __e, _M_sz); \
}
_DEFINE_VALARRAY_OPERATOR(*, multiplies)
_DEFINE_VALARRAY_OPERATOR(/, divides)
_DEFINE_VALARRAY_OPERATOR(%, modulus)
_DEFINE_VALARRAY_OPERATOR(+, plus)
_DEFINE_VALARRAY_OPERATOR(-, minus)
_DEFINE_VALARRAY_OPERATOR(^, xor)
_DEFINE_VALARRAY_OPERATOR(&, and)
_DEFINE_VALARRAY_OPERATOR(|, or)
_DEFINE_VALARRAY_OPERATOR(<<, shift_left)
_DEFINE_VALARRAY_OPERATOR(>>, shift_right)
#undef _DEFINE_VALARRAY_OPERATOR
} // extern "C++"
#endif // __SLICE_ARRAY__
// Local Variables:
// mode:c++
// End:

View File

@ -1,728 +0,0 @@
// The template and inlines for the -*- C++ -*- valarray class.
// Copyright (C) 1997-1999 Cygnus Solutions
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
#ifndef __STD_VALARRAY__
#define __STD_VALARRAY__
#define _G_NO_VALARRAY_TEMPLATE_EXPORT 1
#include <cstddef>
#include <cmath>
#include <cstdlib>
#include <numeric>
#include <functional>
#include <algorithm>
#ifndef alloca
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not GNU C. */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
#include <alloca.h>
#else /* not sparc */
#if defined (MSDOS) && !defined (__TURBOC__)
#include <malloc.h>
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
#include <malloc.h>
#pragma alloca
#else /* not MSDOS, __TURBOC__, or _AIX */
#ifdef __hpux
#endif /* __hpux */
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc. */
#endif /* not GNU C. */
#endif /* alloca not defined. */
extern "C" {
void* alloca(size_t);
}
extern "C++" {
template<class _Clos, typename _Tp> class _Expr;
template<typename _Tp1, typename _Tp2> class _ValArray;
template<template<class> class _Oper,
template<class, class> class _Meta, class _Dom> struct _UnClos;
template<template<class> class _Oper,
template<class, class> class _Meta1,
template<class, class> class _Meta2,
class _Dom1, class _Dom2> class _BinClos;
template<template<class, class> class _Meta, class _Dom> class _SClos;
template<template<class, class> class _Meta, class _Dom> class _GClos;
template<template<class, class> class _Meta, class _Dom> class _IClos;
template<template<class, class> class _Meta, class _Dom> class _ValFunClos;
template<template<class, class> class _Meta, class _Dom> class _RefFunClos;
template<class _Tp> struct _Unary_plus;
template<class _Tp> struct _Bitwise_and;
template<class _Tp> struct _Bitwise_or;
template<class _Tp> struct _Bitwise_xor;
template<class _Tp> struct _Bitwise_not;
template<class _Tp> struct _Shift_left;
template<class _Tp> struct _Shift_right;
template<class _Tp> class valarray; // An array of type _Tp
class slice; // BLAS-like slice out of an array
template<class _Tp> class slice_array;
class gslice; // generalized slice out of an array
template<class _Tp> class gslice_array;
template<class _Tp> class mask_array; // masked array
template<class _Tp> class indirect_array; // indirected array
} // extern "C++"
#include <std/valarray_array.h>
#include <std/valarray_meta.h>
extern "C++" {
template<class _Tp> class valarray
{
public:
typedef _Tp value_type;
// _lib.valarray.cons_ construct/destroy:
valarray();
explicit valarray(size_t);
valarray(const _Tp&, size_t);
valarray(const _Tp* __restrict__, size_t);
valarray(const valarray&);
valarray(const slice_array<_Tp>&);
valarray(const gslice_array<_Tp>&);
valarray(const mask_array<_Tp>&);
valarray(const indirect_array<_Tp>&);
template<class _Dom>
valarray(const _Expr<_Dom,_Tp>& __e);
~valarray();
// _lib.valarray.assign_ assignment:
valarray<_Tp>& operator=(const valarray<_Tp>&);
valarray<_Tp>& operator=(const _Tp&);
valarray<_Tp>& operator=(const slice_array<_Tp>&);
valarray<_Tp>& operator=(const gslice_array<_Tp>&);
valarray<_Tp>& operator=(const mask_array<_Tp>&);
valarray<_Tp>& operator=(const indirect_array<_Tp>&);
template<class _Dom> valarray<_Tp>&
operator= (const _Expr<_Dom,_Tp>&);
// _lib.valarray.access_ element access:
_Tp operator[](size_t) const;
_Tp& operator[](size_t);
// _lib.valarray.sub_ subset operations:
_Expr<_SClos<_ValArray,_Tp>, _Tp> operator[](slice) const;
slice_array<_Tp> operator[](slice);
_Expr<_GClos<_ValArray,_Tp>, _Tp> operator[](const gslice&) const;
gslice_array<_Tp> operator[](const gslice&);
valarray<_Tp> operator[](const valarray<bool>&) const;
mask_array<_Tp> operator[](const valarray<bool>&);
_Expr<_IClos<_ValArray, _Tp>, _Tp>
operator[](const valarray<size_t>&) const;
indirect_array<_Tp> operator[](const valarray<size_t>&);
// _lib.valarray.unary_ unary operators:
_Expr<_UnClos<_Unary_plus,_ValArray,_Tp>,_Tp> operator+ () const;
_Expr<_UnClos<negate,_ValArray,_Tp>,_Tp> operator- () const;
_Expr<_UnClos<_Bitwise_not,_ValArray,_Tp>,_Tp> operator~ () const;
_Expr<_UnClos<logical_not,_ValArray,_Tp>,bool> operator! () const;
// _lib.valarray.cassign_ computed assignment:
valarray<_Tp>& operator*= (const _Tp&);
valarray<_Tp>& operator/= (const _Tp&);
valarray<_Tp>& operator%= (const _Tp&);
valarray<_Tp>& operator+= (const _Tp&);
valarray<_Tp>& operator-= (const _Tp&);
valarray<_Tp>& operator^= (const _Tp&);
valarray<_Tp>& operator&= (const _Tp&);
valarray<_Tp>& operator|= (const _Tp&);
valarray<_Tp>& operator<<=(const _Tp&);
valarray<_Tp>& operator>>=(const _Tp&);
valarray<_Tp>& operator*= (const valarray<_Tp>&);
valarray<_Tp>& operator/= (const valarray<_Tp>&);
valarray<_Tp>& operator%= (const valarray<_Tp>&);
valarray<_Tp>& operator+= (const valarray<_Tp>&);
valarray<_Tp>& operator-= (const valarray<_Tp>&);
valarray<_Tp>& operator^= (const valarray<_Tp>&);
valarray<_Tp>& operator|= (const valarray<_Tp>&);
valarray<_Tp>& operator&= (const valarray<_Tp>&);
valarray<_Tp>& operator<<=(const valarray<_Tp>&);
valarray<_Tp>& operator>>=(const valarray<_Tp>&);
template<class _Dom>
valarray<_Tp>& operator*= (const _Expr<_Dom,_Tp>&);
template<class _Dom>
valarray<_Tp>& operator/= (const _Expr<_Dom,_Tp>&);
template<class _Dom>
valarray<_Tp>& operator%= (const _Expr<_Dom,_Tp>&);
template<class _Dom>
valarray<_Tp>& operator+= (const _Expr<_Dom,_Tp>&);
template<class _Dom>
valarray<_Tp>& operator-= (const _Expr<_Dom,_Tp>&);
template<class _Dom>
valarray<_Tp>& operator^= (const _Expr<_Dom,_Tp>&);
template<class _Dom>
valarray<_Tp>& operator|= (const _Expr<_Dom,_Tp>&);
template<class _Dom>
valarray<_Tp>& operator&= (const _Expr<_Dom,_Tp>&);
template<class _Dom>
valarray<_Tp>& operator<<=(const _Expr<_Dom,_Tp>&);
template<class _Dom>
valarray<_Tp>& operator>>=(const _Expr<_Dom,_Tp>&);
// _lib.valarray.members_ member functions:
size_t size() const;
_Tp sum() const;
_Tp min() const;
_Tp max() const;
// FIXME: Extension
_Tp product () const;
valarray<_Tp> shift (int) const;
valarray<_Tp> cshift(int) const;
_Expr<_ValFunClos<_ValArray,_Tp>,_Tp> apply(_Tp func(_Tp)) const;
_Expr<_RefFunClos<_ValArray,_Tp>,_Tp> apply(_Tp func(const _Tp&)) const;
void resize(size_t __size, _Tp __c = _Tp());
private:
size_t _M_size;
_Tp* __restrict__ _M_data;
friend class _Array<_Tp>;
};
template<typename _Tp> struct _Unary_plus : unary_function<_Tp,_Tp> {
_Tp operator() (const _Tp& __t) const { return __t; }
};
template<typename _Tp> struct _Bitwise_and : binary_function<_Tp,_Tp,_Tp> {
_Tp operator() (_Tp __x, _Tp __y) const { return __x & __y; }
};
template<typename _Tp> struct _Bitwise_or : binary_function<_Tp,_Tp,_Tp> {
_Tp operator() (_Tp __x, _Tp __y) const { return __x | __y; }
};
template<typename _Tp> struct _Bitwise_xor : binary_function<_Tp,_Tp,_Tp> {
_Tp operator() (_Tp __x, _Tp __y) const { return __x ^ __y; }
};
template<typename _Tp> struct _Bitwise_not : unary_function<_Tp,_Tp> {
_Tp operator() (_Tp __t) const { return ~__t; }
};
template<typename _Tp> struct _Shift_left : unary_function<_Tp,_Tp> {
_Tp operator() (_Tp __x, _Tp __y) const { return __x << __y; }
};
template<typename _Tp> struct _Shift_right : unary_function<_Tp,_Tp> {
_Tp operator() (_Tp __x, _Tp __y) const { return __x >> __y; }
};
template<typename _Tp>
inline _Tp
valarray<_Tp>::operator[] (size_t __i) const
{ return _M_data[__i]; }
template<typename _Tp>
inline _Tp&
valarray<_Tp>::operator[] (size_t __i)
{ return _M_data[__i]; }
} // extern "C++"
#include <std/slice.h>
#include <std/slice_array.h>
#include <std/gslice.h>
#include <std/gslice_array.h>
#include <std/mask_array.h>
#include <std/indirect_array.h>
extern "C++" {
template<typename _Tp>
inline valarray<_Tp>::valarray () : _M_size (0), _M_data (0) {}
template<typename _Tp>
inline valarray<_Tp>::valarray (size_t __n)
: _M_size (__n), _M_data (new _Tp[__n]) {}
template<typename _Tp>
inline valarray<_Tp>::valarray (const _Tp& __t, size_t __n)
: _M_size (__n), _M_data (new _Tp[__n])
{ __valarray_fill (_M_data, _M_size, __t); }
template<typename _Tp>
inline valarray<_Tp>::valarray (const _Tp* __restrict__ __pT, size_t __n)
: _M_size (__n), _M_data (new _Tp[__n])
{ __valarray_copy (__pT, __n, _M_data); }
template<typename _Tp>
inline valarray<_Tp>::valarray (const valarray<_Tp>& __v)
: _M_size (__v._M_size), _M_data (new _Tp[__v._M_size])
{ __valarray_copy (__v._M_data, _M_size, _M_data); }
template<typename _Tp>
inline valarray<_Tp>::valarray (const slice_array<_Tp>& __sa)
: _M_size (__sa._M_sz), _M_data (new _Tp[__sa._M_sz])
{ __valarray_copy (__sa._M_array, __sa._M_sz, __sa._M_stride,
_Array<_Tp>(_M_data)); }
template<typename _Tp>
inline valarray<_Tp>::valarray (const gslice_array<_Tp>& __ga)
: _M_size (__ga._M_index.size()), _M_data (new _Tp[_M_size])
{ __valarray_copy (__ga._M_array, _Array<size_t>(__ga._M_index),
_Array<_Tp>(_M_data), _M_size); }
template<typename _Tp>
inline valarray<_Tp>::valarray (const mask_array<_Tp>& __ma)
: _M_size (__ma._M_sz), _M_data (new _Tp[__ma._M_sz])
{ __valarray_copy (__ma._M_array, __ma._M_mask,
_Array<_Tp>(_M_data), _M_size); }
template<typename _Tp>
inline valarray<_Tp>::valarray (const indirect_array<_Tp>& __ia)
: _M_size (__ia._M_sz), _M_data (new _Tp[__ia._M_sz])
{ __valarray_copy (__ia._M_array, __ia._M_index,
_Array<_Tp>(_M_data), _M_size); }
template<typename _Tp> template<class _Dom>
inline valarray<_Tp>::valarray (const _Expr<_Dom, _Tp>& __e)
: _M_size (__e.size ()), _M_data (new _Tp[_M_size])
{ __valarray_copy (__e, _M_size, _Array<_Tp>(_M_data)); }
template<typename _Tp>
inline valarray<_Tp>::~valarray () { delete[] _M_data; }
template<typename _Tp>
inline valarray<_Tp>&
valarray<_Tp>::operator= (const valarray<_Tp>& __v)
{
__valarray_copy(__v._M_data, _M_size, _M_data);
return *this;
}
template<typename _Tp>
inline valarray<_Tp>&
valarray<_Tp>::operator= (const _Tp& __t)
{
__valarray_fill (_M_data, _M_size, __t);
return *this;
}
template<typename _Tp>
inline valarray<_Tp>&
valarray<_Tp>::operator= (const slice_array<_Tp>& __sa)
{
__valarray_copy (__sa._M_array, __sa._M_sz,
__sa._M_stride, _Array<_Tp>(_M_data));
return *this;
}
template<typename _Tp>
inline valarray<_Tp>&
valarray<_Tp>::operator= (const gslice_array<_Tp>& __ga)
{
__valarray_copy (__ga._M_array, _Array<size_t>(__ga._M_index),
_Array<_Tp>(_M_data), _M_size);
return *this;
}
template<typename _Tp>
inline valarray<_Tp>&
valarray<_Tp>::operator= (const mask_array<_Tp>& __ma)
{
__valarray_copy (__ma._M_array, __ma._M_mask,
_Array<_Tp>(_M_data), _M_size);
return *this;
}
template<typename _Tp>
inline valarray<_Tp>&
valarray<_Tp>::operator= (const indirect_array<_Tp>& __ia)
{
__valarray_copy (__ia._M_array, __ia._M_index,
_Array<_Tp>(_M_data), _M_size);
return *this;
}
template<typename _Tp> template<class _Dom>
inline valarray<_Tp>&
valarray<_Tp>::operator= (const _Expr<_Dom, _Tp>& __e)
{
__valarray_copy (__e, _M_size, _Array<_Tp>(_M_data));
return *this;
}
template<typename _Tp>
inline _Expr<_SClos<_ValArray,_Tp>, _Tp>
valarray<_Tp>::operator[] (slice __s) const
{
typedef _SClos<_ValArray,_Tp> _Closure;
return _Expr<_Closure, _Tp> (_Closure (_Array<_Tp>(_M_data), __s));
}
template<typename _Tp>
inline slice_array<_Tp>
valarray<_Tp>::operator[] (slice __s)
{
return slice_array<_Tp> (_Array<_Tp>(_M_data), __s);
}
template<typename _Tp>
inline _Expr<_GClos<_ValArray,_Tp>, _Tp>
valarray<_Tp>::operator[] (const gslice& __gs) const
{
typedef _GClos<_ValArray,_Tp> _Closure;
return _Expr<_Closure, _Tp>
(_Closure (_Array<_Tp>(_M_data), __gs._M_index->_M_index));
}
template<typename _Tp>
inline gslice_array<_Tp>
valarray<_Tp>::operator[] (const gslice& __gs)
{
return gslice_array<_Tp>
(_Array<_Tp>(_M_data), __gs._M_index->_M_index);
}
template<typename _Tp>
inline valarray<_Tp>
valarray<_Tp>::operator[] (const valarray<bool>& __m) const
{
size_t __s (0);
size_t __e (__m.size ());
for (size_t __i=0; __i<__e; ++__i)
if (__m[__i]) ++__s;
return valarray<_Tp> (mask_array<_Tp> (_Array<_Tp>(_M_data), __s,
_Array<bool> (__m)));
}
template<typename _Tp>
inline mask_array<_Tp>
valarray<_Tp>::operator[] (const valarray<bool>& __m)
{
size_t __s (0);
size_t __e (__m.size ());
for (size_t __i=0; __i<__e; ++__i)
if (__m[__i]) ++__s;
return mask_array<_Tp> (_Array<_Tp>(_M_data), __s, _Array<bool> (__m));
}
template<typename _Tp>
inline _Expr<_IClos<_ValArray,_Tp>, _Tp>
valarray<_Tp>::operator[] (const valarray<size_t>& __i) const
{
typedef _IClos<_ValArray,_Tp> _Closure;
return _Expr<_Closure, _Tp> (_Closure (*this, __i));
}
template<typename _Tp>
inline indirect_array<_Tp>
valarray<_Tp>::operator[] (const valarray<size_t>& __i)
{
return indirect_array<_Tp> (_Array<_Tp>(_M_data), __i.size(),
_Array<size_t> (__i));
}
template<class _Tp>
inline size_t valarray<_Tp>::size () const { return _M_size; }
template<class _Tp>
inline _Tp
valarray<_Tp>::sum () const
{
return accumulate (_M_data, _M_data + _M_size, _Tp ());
}
template<typename _Tp>
inline _Tp
valarray<_Tp>::product () const
{
return accumulate (_M_data, _M_data+_M_size, _Tp(1), multiplies<_Tp> ());
}
template <class _Tp>
inline valarray<_Tp>
valarray<_Tp>::shift (int __n) const
{
_Tp* const __a = static_cast<_Tp*> (alloca (sizeof(_Tp) * _M_size));
if (! __n) // __n == 0: no shift
__valarray_copy (_M_data, _M_size, __a);
else if (__n > 0) { // __n > 0: shift left
if (__n > _M_size)
__valarray_fill(__a, __n, _Tp());
else {
__valarray_copy (_M_data+__n, _M_size-__n, __a);
__valarray_fill (__a+_M_size-__n, __n, _Tp());
}
}
else { // __n < 0: shift right
__valarray_copy (_M_data, _M_size+__n, __a-__n);
__valarray_fill(__a, -__n, _Tp());
}
return valarray<_Tp> (__a, _M_size);
}
template <class _Tp>
inline valarray<_Tp>
valarray<_Tp>::cshift (int __n) const
{
_Tp* const __a = static_cast<_Tp*> (alloca (sizeof(_Tp) * _M_size));
if (! __n) // __n == 0: no cshift
__valarray_copy(_M_data, _M_size, __a);
else if (__n > 0) { // __n > 0: cshift left
__valarray_copy (_M_data, __n, __a + _M_size-__n);
__valarray_copy (_M_data + __n, _M_size-__n, __a);
}
else { // __n < 0: cshift right
__valarray_copy (_M_data + _M_size + __n, -__n, __a);
__valarray_copy (_M_data, _M_size + __n, __a - __n);
}
return valarray<_Tp> (__a, _M_size);
}
template <class _Tp>
inline void
valarray<_Tp>::resize (size_t __n, _Tp __c)
{
if (_M_size != __n) {
delete[] _M_data;
_M_size = __n;
_M_data = new _Tp[_M_size];
}
__valarray_fill (_M_data, _M_size, __c);
}
template<typename _Tp>
inline _Tp
valarray<_Tp>::min() const
{
return *min_element (_M_data, _M_data+_M_size);
}
template<typename _Tp>
inline _Tp
valarray<_Tp>::max() const
{
return *max_element (_M_data, _M_data+_M_size);
}
template<class _Tp>
inline _Expr<_ValFunClos<_ValArray,_Tp>,_Tp>
valarray<_Tp>::apply (_Tp func (_Tp)) const
{
typedef _ValFunClos<_ValArray,_Tp> _Closure;
return _Expr<_Closure,_Tp> (_Closure (*this, func));
}
template<class _Tp>
inline _Expr<_RefFunClos<_ValArray,_Tp>,_Tp>
valarray<_Tp>::apply (_Tp func (const _Tp &)) const
{
typedef _RefFunClos<_ValArray,_Tp> _Closure;
return _Expr<_Closure,_Tp> (_Closure (*this, func));
}
#define _DEFINE_VALARRAY_UNARY_OPERATOR(_Op, _Name) \
template<typename _Tp> \
inline _Expr<_UnClos<_Name,_ValArray,_Tp>, _Tp> \
valarray<_Tp>::operator##_Op() const \
{ \
typedef _UnClos<_Name,_ValArray,_Tp> _Closure; \
return _Expr<_Closure, _Tp> (_Closure (*this)); \
}
_DEFINE_VALARRAY_UNARY_OPERATOR(+, _Unary_plus)
_DEFINE_VALARRAY_UNARY_OPERATOR(-, negate)
_DEFINE_VALARRAY_UNARY_OPERATOR(~, _Bitwise_not)
#undef _DEFINE_VALARRAY_UNARY_OPERATOR
template<typename _Tp>
inline _Expr<_UnClos<logical_not,_ValArray,_Tp>, bool>
valarray<_Tp>::operator!() const
{
typedef _UnClos<logical_not,_ValArray,_Tp> _Closure;
return _Expr<_Closure, bool> (_Closure (*this));
}
#define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name) \
template<class _Tp> \
inline valarray<_Tp> & \
valarray<_Tp>::operator##_Op##= (const _Tp &__t) \
{ \
_Array_augmented_##_Name (_Array<_Tp>(_M_data), _M_size, __t); \
return *this; \
} \
\
template<class _Tp> \
inline valarray<_Tp> & \
valarray<_Tp>::operator##_Op##= (const valarray<_Tp> &__v) \
{ \
_Array_augmented_##_Name (_Array<_Tp>(_M_data), _M_size, \
_Array<_Tp>(__v._M_data)); \
return *this; \
}
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(+, plus)
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(-, minus)
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(*, multiplies)
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(/, divides)
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(%, modulus)
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(^, xor)
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(&, and)
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(|, or)
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(<<, shift_left)
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(>>, shift_right)
#undef _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT
#define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name) \
template<class _Tp> template<class _Dom> \
inline valarray<_Tp> & \
valarray<_Tp>::operator##_Op##= (const _Expr<_Dom,_Tp> &__e) \
{ \
_Array_augmented_##_Name (_Array<_Tp>(_M_data), __e, _M_size); \
return *this; \
}
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(+, plus)
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(-, minus)
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(*, multiplies)
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(/, divides)
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(%, modulus)
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(^, xor)
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(&, and)
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(|, or)
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(<<, shift_left)
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(>>, shift_right)
#undef _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT
#define _DEFINE_BINARY_OPERATOR(_Op, _Name) \
template<typename _Tp> \
inline _Expr<_BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp>, _Tp> \
operator##_Op (const valarray<_Tp> &__v, const valarray<_Tp> &__w) \
{ \
typedef _BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp> _Closure; \
return _Expr<_Closure, _Tp> (_Closure (__v, __w)); \
} \
\
template<typename _Tp> \
inline _Expr<_BinClos<_Name,_ValArray,_Constant,_Tp,_Tp>,_Tp> \
operator##_Op (const valarray<_Tp> &__v, const _Tp &__t) \
{ \
typedef _BinClos<_Name,_ValArray,_Constant,_Tp,_Tp> _Closure; \
return _Expr<_Closure, _Tp> (_Closure (__v, __t)); \
} \
\
template<typename _Tp> \
inline _Expr<_BinClos<_Name,_Constant,_ValArray,_Tp,_Tp>,_Tp> \
operator##_Op (const _Tp &__t, const valarray<_Tp> &__v) \
{ \
typedef _BinClos<_Name,_Constant,_ValArray,_Tp,_Tp> _Closure; \
return _Expr<_Closure, _Tp> (_Closure (__t, __v)); \
}
_DEFINE_BINARY_OPERATOR(+, plus)
_DEFINE_BINARY_OPERATOR(-, minus)
_DEFINE_BINARY_OPERATOR(*, multiplies)
_DEFINE_BINARY_OPERATOR(/, divides)
_DEFINE_BINARY_OPERATOR(%, modulus)
_DEFINE_BINARY_OPERATOR(^, _Bitwise_xor)
_DEFINE_BINARY_OPERATOR(&, _Bitwise_and)
_DEFINE_BINARY_OPERATOR(|, _Bitwise_or)
_DEFINE_BINARY_OPERATOR(<<, _Shift_left)
_DEFINE_BINARY_OPERATOR(>>, _Shift_right)
#undef _DEFINE_BINARY_OPERATOR
#define _DEFINE_LOGICAL_OPERATOR(_Op, _Name) \
template<typename _Tp> \
inline _Expr<_BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp>,bool> \
operator##_Op (const valarray<_Tp> &__v, const valarray<_Tp> &__w) \
{ \
typedef _BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp> _Closure; \
return _Expr<_Closure, bool> (_Closure (__v, __w)); \
} \
\
template<class _Tp> \
inline _Expr<_BinClos<_Name,_ValArray,_Constant,_Tp,_Tp>,bool> \
operator##_Op (const valarray<_Tp> &__v, const _Tp &__t) \
{ \
typedef _BinClos<_Name,_ValArray,_Constant,_Tp,_Tp> _Closure; \
return _Expr<_Closure, bool> (_Closure (__v, __t)); \
} \
\
template<class _Tp> \
inline _Expr<_BinClos<_Name,_Constant,_ValArray,_Tp,_Tp>,bool> \
operator##_Op (const _Tp &__t, const valarray<_Tp> &__v) \
{ \
typedef _BinClos<_Name,_Constant,_ValArray,_Tp,_Tp> _Closure; \
return _Expr<_Closure, bool> (_Closure (__t, __v)); \
}
_DEFINE_LOGICAL_OPERATOR(&&, logical_and)
_DEFINE_LOGICAL_OPERATOR(||, logical_or)
_DEFINE_LOGICAL_OPERATOR(==, equal_to)
_DEFINE_LOGICAL_OPERATOR(!=, not_equal_to)
_DEFINE_LOGICAL_OPERATOR(<, less)
_DEFINE_LOGICAL_OPERATOR(>, greater)
_DEFINE_LOGICAL_OPERATOR(<=, less_equal)
_DEFINE_LOGICAL_OPERATOR(>=, greater_equal)
#undef _DEFINE_VALARRAY_OPERATOR
#undef _G_NO_VALARRAY_TEMPLATE_EXPORT
} // extern "C++"
#endif // __STD_VALARRAY__
// Local Variables:
// mode:c++
// End:

View File

@ -1,161 +0,0 @@
// Character traits template for the -*- C++ -*- string classes.
// Copyright (C) 1994 Free Software Foundation
// This file is part of the GNU ANSI C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// As a special exception, if you link this library with files
// compiled with a GNU compiler to produce an executable, this does not cause
// the resulting executable to be covered by the GNU General Public License.
// This exception does not however invalidate any other reasons why
// the executable file might be covered by the GNU General Public License.
// Written by Jason Merrill based upon the specification by Takanori Adachi
// in ANSI X3J16/94-0013R2.
#ifndef __STRING_CHAR_TRAITS__
#define __STRING_CHAR_TRAITS__
#ifdef __GNUG__
// For string_char_traits <char>
#pragma interface "std/straits.h"
#endif
#include <cstddef>
extern "C++" {
template <class charT>
struct string_char_traits {
typedef charT char_type; // for users to acquire the basic character type
// constraints
static void assign (char_type& c1, const char_type& c2)
{ c1 = c2; }
static bool eq (const char_type& c1, const char_type& c2)
{ return (c1 == c2); }
static bool ne (const char_type& c1, const char_type& c2)
{ return !(c1 == c2); }
static bool lt (const char_type& c1, const char_type& c2)
{ return (c1 < c2); }
static char_type eos () { return char_type(); } // the null character
static bool is_del(char_type a) { return 0; }
// characteristic function for delimiters of charT
// speed-up functions
static int compare (const char_type* s1, const char_type* s2, size_t n)
{
size_t i;
for (i = 0; i < n; ++i)
if (ne (s1[i], s2[i]))
return lt (s1[i], s2[i]) ? -1 : 1;
return 0;
}
static size_t length (const char_type* s)
{
size_t l = 0;
while (ne (*s++, eos ()))
++l;
return l;
}
static char_type* copy (char_type* s1, const char_type* s2, size_t n)
{
for (; n--; )
assign (s1[n], s2[n]);
return s1;
}
static char_type* move (char_type* s1, const char_type* s2, size_t n)
{
char_type a[n];
size_t i;
for (i = 0; i < n; ++i)
assign (a[i], s2[i]);
for (i = 0; i < n; ++i)
assign (s1[i], a[i]);
return s1;
}
static char_type* set (char_type* s1, const char_type& c, size_t n)
{
for (; n--; )
assign (s1[n], c);
return s1;
}
};
class istream;
class ostream;
#include <cctype>
#include <cstring>
struct string_char_traits <char> {
typedef char char_type;
static void assign (char_type& c1, const char_type& c2)
{ c1 = c2; }
static bool eq (const char_type & c1, const char_type& c2)
{ return (c1 == c2); }
static bool ne (const char_type& c1, const char_type& c2)
{ return (c1 != c2); }
static bool lt (const char_type& c1, const char_type& c2)
{ return (c1 < c2); }
static char_type eos () { return 0; }
static bool is_del(char_type a) { return isspace(a); }
static int compare (const char_type* s1, const char_type* s2, size_t n)
{ return memcmp (s1, s2, n); }
static size_t length (const char_type* s)
{ return strlen (s); }
static char_type* copy (char_type* s1, const char_type* s2, size_t n)
{ return (char_type*) memcpy (s1, s2, n); }
static char_type* move (char_type* s1, const char_type* s2, size_t n)
{ return (char_type*) memmove (s1, s2, n); }
static char_type* set (char_type* s1, const char_type& c, size_t n)
{ return (char_type*) memset (s1, c, n); }
};
#if 0
#include <cwctype>
struct string_char_traits <wchar_t> {
typedef wchar_t char_type;
static void assign (char_type& c1, const char_type& c2)
{ c1 = c2; }
static bool eq (const char_type & c1, const char_type& c2)
{ return (c1 == c2); }
static bool ne (const char_type& c1, const char_type& c2)
{ return (c1 != c2); }
static bool lt (const char_type& c1, const char_type& c2)
{ return (c1 < c2); }
static char_type eos () { return 0; }
static bool is_del(char_type a) { return iswspace(a); }
static int compare (const char_type* s1, const char_type* s2, size_t n)
{ return wmemcmp (s1, s2, n); }
static size_t length (const char_type* s)
{ return wcslen (s); }
static char_type* copy (char_type* s1, const char_type* s2, size_t n)
{ return wmemcpy (s1, s2, n); }
static char_type* set (char_type* s1, const char_type& c, size_t n)
{ return wmemset (s1, c, n); }
};
#endif
} // extern "C++"
#endif

View File

@ -1,346 +0,0 @@
// The template and inlines for the -*- C++ -*- internal _Array helper class.
// Copyright (C) 1997-1999 Cygnus Solutions
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
#ifndef __VALARRAY_ARRAY__
#define __VALARRAY_ARRAY__
#include <cstdlib>
#include <cstring>
extern "C++" {
//
// Helper functions on raw pointers
//
// fill plain array __a[<__n>] with __t
template<typename _Tp>
inline void
__valarray_fill (_Tp* __restrict__ __a, size_t __n, const _Tp& __t)
{ while (__n--) *__a++ = __t; }
// fill strided array __a[<__n-1 : __s>] with __t
template<typename _Tp>
inline void
__valarray_fill (_Tp* __restrict__ __a, size_t __n,
size_t __s, const _Tp& __t)
{ for (size_t __i=0; __i<__n; ++__i, __a+=__s) *__a = __t; }
// fill indirect array __a[__i[<__n>]] with __i
template<typename _Tp>
inline void
__valarray_fill(_Tp* __restrict__ __a, const size_t* __restrict__ __i,
size_t __n, const _Tp& __t)
{ for (size_t __j=0; __j<__n; ++__j, ++__i) __a[*__i] = __t; }
// copy plain array __a[<__n>] in __b[<__n>]
template<typename _Tp>
inline void
__valarray_copy (const _Tp* __restrict__ __a, size_t __n,
_Tp* __restrict__ __b)
{ memcpy (__b, __a, __n * sizeof(_Tp)); }
// copy strided array __a[<__n : __s>] in plain __b[<__n>]
template<typename _Tp>
inline void
__valarray_copy (const _Tp* __restrict__ __a, size_t __n, size_t __s,
_Tp* __restrict__ __b)
{ for (size_t __i=0; __i<__n; ++__i, ++__b, __a += __s) *__b = *__a; }
// copy plain __a[<__n>] in strided __b[<__n : __s>]
template<typename _Tp>
inline void
__valarray_copy (const _Tp* __restrict__ __a, _Tp* __restrict__ __b,
size_t __n, size_t __s)
{ for (size_t __i=0; __i<__n; ++__i, ++__a, __b+=__s) *__b = *__a; }
// copy indexed __a[__i[<__n>]] in plain __b[<__n>]
template<typename _Tp>
inline void
__valarray_copy (const _Tp* __restrict__ __a,
const size_t* __restrict__ __i,
_Tp* __restrict__ __b, size_t __n)
{ for (size_t __j=0; __j<__n; ++__j, ++__b, ++__i) *__b = __a[*__i]; }
// copy plain __a[<__n>] in indexed __b[__i[<__n>]]
template<typename _Tp>
inline void
__valarray_copy (const _Tp* __restrict__ __a, size_t __n,
_Tp* __restrict__ __b, const size_t* __restrict__ __i)
{ for (size_t __j=0; __j<__n; ++__j, ++__a, ++__i) __b[*__i] = *__a; }
//
// Helper class _Array, first layer of valarray abstraction.
// All operations on valarray should be forwarded to this class
// whenever possible. -- gdr
//
template<typename _Tp> struct _Array {
explicit _Array (size_t);
explicit _Array (_Tp* const __restrict__);
explicit _Array (const valarray<_Tp>&);
_Array (const _Tp* __restrict__, size_t);
void free_data() const;
_Tp* begin () const;
_Tp* const __restrict__ _M_data;
};
template<typename _Tp>
inline void
__valarray_fill (_Array<_Tp> __a, size_t __n, const _Tp& __t)
{ __valarray_fill (__a._M_data, __n, __t); }
template<typename _Tp>
inline void
__valarray_fill (_Array<_Tp> __a, size_t __n, size_t __s, const _Tp& __t)
{ __valarray_fill (__a._M_data, __n, __s, __t); }
template<typename _Tp>
inline void
__valarray_fill (_Array<_Tp> __a, _Array<size_t> __i,
size_t __n, const _Tp& __t)
{ __valarray_fill (__a._M_data, __i._M_data, __n, __t); }
template<typename _Tp>
inline void
__valarray_copy (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b)
{ __valarray_copy (__a._M_data, __n, __b._M_data); }
template<typename _Tp>
inline void
__valarray_copy (_Array<_Tp> __a, size_t __n, size_t __s, _Array<_Tp> __b)
{ __valarray_copy(__a._M_data, __n, __s, __b._M_data); }
template<typename _Tp>
inline void
__valarray_copy (_Array<_Tp> __a, _Array<_Tp> __b, size_t __n, size_t __s)
{ __valarray_copy (__a._M_data, __b._M_data, __n, __s); }
template<typename _Tp>
inline void
__valarray_copy (_Array<_Tp> __a, _Array<size_t> __i,
_Array<_Tp> __b, size_t __n)
{ __valarray_copy (__a._M_data, __i._M_data, __b._M_data, __n); }
template<typename _Tp>
inline void
__valarray_copy (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b,
_Array<size_t> __i)
{ __valarray_copy (__a._M_data, __n, __b._M_data, __i._M_data); }
template<typename _Tp>
inline
_Array<_Tp>::_Array (size_t __n) : _M_data (new _Tp[__n]) {}
template<typename _Tp>
inline
_Array<_Tp>::_Array (_Tp* const __restrict__ __p) : _M_data (__p) {}
template<typename _Tp>
inline _Array<_Tp>::_Array (const valarray<_Tp>& __v)
: _M_data (__v._M_data) {}
template<typename _Tp>
inline
_Array<_Tp>::_Array (const _Tp* __restrict__ __b, size_t __s)
: _M_data (new _Tp[__s]) { __valarray_copy (__b, __s, _M_data); }
template<typename _Tp>
inline void
_Array<_Tp>::free_data() const { delete[] _M_data; }
template<typename _Tp>
inline _Tp*
_Array<_Tp>::begin () const
{ return _M_data; }
#define _DEFINE_ARRAY_FUNCTION(_Op, _Name) \
template<typename _Tp> \
inline void \
_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, const _Tp& __t) \
{ \
for (_Tp* __p=__a._M_data; __p<__a._M_data+__n; ++__p) \
*__p _Op##= __t; \
} \
\
template<typename _Tp> \
inline void \
_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b) \
{ \
_Tp* __p (__a._M_data); \
for (_Tp* __q=__b._M_data; __q<__b._M_data+__n; ++__p, ++__q) \
*__p _Op##= *__q; \
} \
\
template<typename _Tp, class _Dom> \
void \
_Array_augmented_##_Name (_Array<_Tp> __a, \
const _Expr<_Dom,_Tp>& __e, size_t __n) \
{ \
_Tp* __p (__a._M_data); \
for (size_t __i=0; __i<__n; ++__i, ++__p) *__p _Op##= __e[__i]; \
} \
\
template<typename _Tp> \
inline void \
_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, size_t __s, \
_Array<_Tp> __b) \
{ \
_Tp* __q (__b._M_data); \
for (_Tp* __p=__a._M_data; __p<__a._M_data+__s*__n; __p+=__s, ++__q) \
*__p _Op##= *__q; \
} \
\
template<typename _Tp> \
inline void \
_Array_augmented_##_Name (_Array<_Tp> __a, _Array<_Tp> __b, \
size_t __n, size_t __s) \
{ \
_Tp* __q (__b._M_data); \
for (_Tp* __p=__a._M_data; __p<__a._M_data+__n; ++__p, __q+=__s) \
*__p _Op##= *__q; \
} \
\
template<typename _Tp, class _Dom> \
void \
_Array_augmented_##_Name (_Array<_Tp> __a, size_t __s, \
const _Expr<_Dom,_Tp>& __e, size_t __n) \
{ \
_Tp* __p (__a._M_data); \
for (size_t __i=0; __i<__n; ++__i, __p+=__s) *__p _Op##= __e[__i]; \
} \
\
template<typename _Tp> \
inline void \
_Array_augmented_##_Name (_Array<_Tp> __a, _Array<size_t> __i, \
_Array<_Tp> __b, size_t __n) \
{ \
_Tp* __q (__b._M_data); \
for (size_t* __j=__i._M_data; __j<__i._M_data+__n; ++__j, ++__q) \
__a._M_data[*__j] _Op##= *__q; \
} \
\
template<typename _Tp> \
inline void \
_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, \
_Array<_Tp> __b, _Array<size_t> __i) \
{ \
_Tp* __p (__a._M_data); \
for (size_t* __j=__i._M_data; __j<__i._M_data+__n; ++__j, ++__p) \
*__p _Op##= __b._M_data[*__j]; \
} \
\
template<typename _Tp, class _Dom> \
void \
_Array_augmented_##_Name (_Array<_Tp> __a, _Array<size_t> __i, \
const _Expr<_Dom, _Tp>& __e, size_t __n) \
{ \
size_t* __j (__i._M_data); \
for (size_t __k=0; __k<__n; ++__k, ++__j) \
__a._M_data[*__j] _Op##= __e[__k]; \
} \
\
template<typename _Tp> \
void \
_Array_augmented_##_Name (_Array<_Tp> __a, _Array<bool> __m, \
_Array<_Tp> __b, size_t __n) \
{ \
bool* ok (__m._M_data); \
_Tp* __p (__a._M_data); \
for (_Tp* __q=__b._M_data; __q<__b._M_data+__n; ++__q, ++ok, ++__p) { \
while (! *ok) { \
++ok; \
++__p; \
} \
*__p _Op##= *__q; \
} \
} \
\
template<typename _Tp> \
void \
_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, \
_Array<_Tp> __b, _Array<bool> __m) \
{ \
bool* ok (__m._M_data); \
_Tp* __q (__b._M_data); \
for (_Tp* __p=__a._M_data; __p<__a._M_data+__n; ++__p, ++ok, ++__q) { \
while (! *ok) { \
++ok; \
++__q; \
} \
*__p _Op##= *__q; \
} \
} \
\
template<typename _Tp, class _Dom> \
void \
_Array_augmented_##_Name (_Array<_Tp> __a, _Array<bool> __m, \
const _Expr<_Dom, _Tp>& __e, size_t __n) \
{ \
bool* ok(__m._M_data); \
_Tp* __p (__a._M_data); \
for (size_t __i=0; __i<__n; ++__i, ++ok, ++__p) { \
while (! *ok) { \
++ok; \
++__p; \
} \
*__p _Op##= __e[__i]; \
} \
}
_DEFINE_ARRAY_FUNCTION(+, plus)
_DEFINE_ARRAY_FUNCTION(-, minus)
_DEFINE_ARRAY_FUNCTION(*, multiplies)
_DEFINE_ARRAY_FUNCTION(/, divides)
_DEFINE_ARRAY_FUNCTION(%, modulus)
_DEFINE_ARRAY_FUNCTION(^, xor)
_DEFINE_ARRAY_FUNCTION(|, or)
_DEFINE_ARRAY_FUNCTION(&, and)
_DEFINE_ARRAY_FUNCTION(<<, shift_left)
_DEFINE_ARRAY_FUNCTION(>>, shift_right)
#undef _DEFINE_ARRAY_FUNCTION
} // extern "C++"
#ifdef _G_NO_VALARRAY_TEMPLATE_EXPORT
# define export
# include <std/valarray_array.tcc>
#endif
#endif // __VALARRAY_ARRAY__
// Local Variables:
// mode:c++
// End:

View File

@ -1,130 +0,0 @@
// The template and inlines for the -*- C++ -*- internal _Array helper class.
// Copyright (C) 1997-1999 Cygnus Solutions
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
#ifndef __VALARRAY_ARRAY_TCC__
#define __VALARRAY_ARRAY_TCC__
extern "C++" {
export template<typename _Tp>
void
__valarray_fill (_Array<_Tp> __a, size_t __n, _Array<bool> __m, const _Tp& __t)
{
_Tp* __p = __a._M_data;
bool* __ok (__m._M_data);
for (size_t __i=0; __i<__n; ++__i, ++__ok, ++__p) {
while (! *__ok) {
++__ok;
++__p;
}
*__p = __t;
}
}
export template<typename _Tp>
void
__valarray_copy (_Array<_Tp> __a, _Array<bool> __m, _Array<_Tp> __b, size_t __n)
{
_Tp* __p (__a._M_data);
bool* __ok (__m._M_data);
for (_Tp* __q=__b._M_data; __q<__b._M_data+__n; ++__q, ++__ok, ++__p) {
while (! *__ok) {
++__ok;
++__p;
}
*__q = *__p;
}
}
export template<typename _Tp>
void
__valarray_copy (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b, _Array<bool> __m)
{
_Tp* __q (__b._M_data);
bool* __ok (__m._M_data);
for (_Tp* __p=__a._M_data; __p<__a._M_data+__n; ++__p, ++__ok, ++__q) {
while (! *__ok) {
++__ok;
++__q;
}
*__q = *__p;
}
}
export template<typename _Tp, class _Dom>
void
__valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n, _Array<_Tp> __a)
{
_Tp* __p (__a._M_data);
for (size_t __i=0; __i<__n; ++__i, ++__p) *__p = __e[__i];
}
export template<typename _Tp, class _Dom>
void
__valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n,
_Array<_Tp> __a, size_t __s)
{
_Tp* __p (__a._M_data);
for (size_t __i=0; __i<__n; ++__i, __p+=__s) *__p = __e[__i];
}
export template<typename _Tp, class _Dom>
void
__valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n,
_Array<_Tp> __a, _Array<size_t> __i)
{
size_t* __j (__i._M_data);
for (size_t __k=0; __k<__n; ++__k, ++__j) __a._M_data[*__j] = __e[__k];
}
export template<typename _Tp, class _Dom>
void
__valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n,
_Array<_Tp> __a, _Array<bool> __m)
{
bool* __ok (__m._M_data);
_Tp* __p (__a._M_data);
for (size_t __i=0; __i<__n; ++__i, ++__ok, ++__p) {
while (! *__ok) {
++__ok;
++__p;
}
*__p = __e[__i];
}
}
} // extern "C++"
#endif // __VALARRAY_ARRAY_TCC__
// Local Variables:
// mode:c++
// End:

File diff suppressed because it is too large Load Diff

View File

@ -1,97 +0,0 @@
// Methods for Exception Support for -*- C++ -*-
// Copyright (C) 1994, 1995, 1997 Free Software Foundation
// This file is part of the GNU ANSI C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// As a special exception, if you link this library with files
// compiled with a GNU compiler to produce an executable, this does not cause
// the resulting executable to be covered by the GNU General Public License.
// This exception does not however invalidate any other reasons why
// the executable file might be covered by the GNU General Public License.
// Written by Mike Stump based upon the specification in the 20 September 1994
// C++ working paper, ANSI document X3J16/94-0158.
#ifndef __STDEXCEPT__
#define __STDEXCEPT__
#ifdef __GNUG__
#pragma interface "stdexcept"
#endif
#include <exception>
#include <string>
extern "C++" {
namespace std {
class logic_error : public exception {
string _what;
public:
logic_error(const string& what_arg): _what (what_arg) { }
virtual const char* what () const { return _what.c_str (); }
};
class domain_error : public logic_error {
public:
domain_error (const string& what_arg): logic_error (what_arg) { }
};
class invalid_argument : public logic_error {
public:
invalid_argument (const string& what_arg): logic_error (what_arg) { }
};
class length_error : public logic_error {
public:
length_error (const string& what_arg): logic_error (what_arg) { }
};
class out_of_range : public logic_error {
public:
out_of_range (const string& what_arg): logic_error (what_arg) { }
};
class runtime_error : public exception {
string _what;
public:
runtime_error(const string& what_arg): _what (what_arg) { }
virtual const char* what () const { return _what.c_str (); }
protected:
runtime_error(): exception () { }
};
class range_error : public runtime_error {
public:
range_error (const string& what_arg): runtime_error (what_arg) { }
};
class overflow_error : public runtime_error {
public:
overflow_error (const string& what_arg): runtime_error (what_arg) { }
};
class underflow_error : public runtime_error {
public:
underflow_error (const string& what_arg): runtime_error (what_arg) { }
};
} // namespace std
} // extern "C++"
#endif

View File

@ -1,21 +0,0 @@
// Implementation file for Exception Support for -*- C++ -*-
// This file is part of the GNU ANSI C++ Library.
#ifdef __GNUG__
#pragma implementation "stdexcept"
#endif
#include <stdexcept>
// Entry points for string.
void
__out_of_range (const char *s)
{
throw std::out_of_range (s);
}
void __length_error (const char *s)
{
throw std::length_error (s);
}

View File

@ -1,15 +0,0 @@
// -*- C++ -*- compatibility header.
// This file is part of the GNU ANSI C++ Library.
#include <algorithm>
#include <deque>
#include <functional>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <stack>
#include <utility>
#include <vector>

View File

@ -1,381 +0,0 @@
Fri Mar 16 12:46:19 GMT 2001 Bernd Schmidt (bernds@redhat.com)
* gcc-2.95.3 Released.
1999-11-06 Martin v. Löwis <loewis@informatik.hu-berlin.de>
* bitset (class bitset): Declare reference as our friend.
* bitset: Include limits.h.
Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com)
* gcc-2.95.2 Released.
Mon Aug 16 01:29:24 PDT 1999 Jeff Law (law@cygnus.com)
* gcc-2.95.1 Released.
Sun Aug 8 21:06:16 1999 Alexandre Oliva <oliva@dcc.unicamp.br>
* pthread_alloc: Solaris' ctype.h defines _U to 01; use _Up as
template parameter instead.
Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com)
* gcc-2.95 Released.
Sun Jul 25 23:40:51 PDT 1999 Jeff Law (law@cygnus.com)
* gcc-2.95 Released.
1999-07-11 Martin v. Löwis (loewis@informatik.hu-berlin.de)
* stl_function.h (bind1st, bind2nd): Rename __opr to __oper,
as __opr is used internally by egcs.
* stl_numeric.h (__power, power): Likewise.
1999-06-18 Martin von Löwis <loewis@informatik.hu-berlin.de>
* stl_queue.h: Rename _M_c to c, and _M_comp to comp.
1999-06-17 Alexandre Oliva <oliva@dcc.unicamp.br>
* stl_algo.h (transform): Rename __opr to __oper, as __opr is used
internally by egcs.
Reported by Harri Porten <porten@tu-harburg.de>
1999-05-17 Mark Kettenis <kettenis@gnu.org>
* stl_config.h: Only define __STL_PTHREADS with GLIBC >= 2 for
Linux.
Mon May 17 03:33:47 1999 Mumit Khan <khan@xraylith.wisc.edu>
* stl_config.h (__CYGWIN__): Cygwin newlib RTL lacks drand48.
1999-05-07 Ulrich Drepper <drepper@cygnus.com>
* stl_alloc.h: Make it possible to compile with __USE_MALLOC.
Tue Apr 13 00:32:57 1999 Mumit Khan <khan@xraylith.wisc.edu>
* stl_config.h (__MINGW32__): Mingw32 RTL lacks drand48.
Sun Apr 11 23:48:30 1999 Jeffrey A Law (law@cygnus.com)
* bitset: Re-install Alexandre's lost patch from 1998-11-27.
1999-01-20 Ulrich Drepper <drepper@cygnus.com>
* stl_construct.h (__destroy_aux): Use != instead of < for
ForwardIterator comparison.
Patch by jmaurer@menuett.rhein-main.de (Jens Maurer).
1999-01-20 Mark Mitchell <mark@markmitchell.com>
* stl_config.h (__STL_USE_NAMESPACES): Define.
1998-11-27 Alexandre Oliva <oliva@dcc.unicamp.br>
* bitset: Explicitly convert basic_string<...>::npos to size_t in
default argument to constructor, to avoid parse error at `>'.
(__STL_EXPLICIT_FUNCTION_TMPL_ARGS): Replace #if with #ifdef.
1998-11-01 Mark Mitchell <mark@markmitchell.com>
* stl_alloc.h (default_alloc_template::_S_free_list): Don't
qualify _NFREELISTS.
1998-10-11 Mark Mitchell <mark@markmitchell.com>
* stl_config.h (__SGI_STL_USE_AUTO_PTR_CONVERSIONS): Define.
* memory (auto_ptr::operator auto_ptr_ref<_Tp1>): Fix typo.
(auto_ptr::operator auto_ptr<_Tp1>): Add missing
semicolon.
1998-09-03 Jason Merrill <jason@yorick.cygnus.com>
* stl_config.h: Define __STL_HAS_WCHAR_T,
__STL_MEMBER_TEMPLATE_CLASSES, __STL_HAS_NAMESPACES,
__STL_NO_NAMESPACES and __STL_LONG_LONG.
1998-09-02 Jason Merrill <jason@yorick.cygnus.com>
* algorithm alloc.h defalloc.h hash_map.h hash_set.h iterator
memory pthread_alloc pthread_alloc.h rope ropeimpl.h stl_algo.h
stl_algobase.h stl_alloc.h stl_bvector.h stl_config.h
stl_construct.h stl_deque.h stl_function.h stl_hash_fun.h
stl_hash_map.h stl_hash_set.h stl_hashtable.h stl_heap.h
stl_iterator.h stl_list.h stl_map.h stl_multimap.h stl_multiset.h
stl_numeric.h stl_pair.h stl_queue.h stl_raw_storage_iter.h
stl_relops.h stl_rope.h stl_set.h stl_slist.h stl_stack.h
stl_tempbuf.h stl_tree.h stl_uninitialized.h stl_vector.h
tempbuf.h type_traits.h: Update to SGI STL 3.11.
Fri Jul 10 15:20:09 1998 Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
* stl_tempbuf.h (temporary_buffer): Add missing typename.
* type_traits.h: update comments.
Sun Jun 28 00:49:42 1998 Jeffrey A Law (law@cygnus.com)
* stl_config.h (__STL_PTHREADS): Don't define for glibc 2 if
_G_USING_THUNKS is not defined.
1998-04-07 18:32 Ulrich Drepper <drepper@cygnus.com>
* stl_hashtable.h (__stl_prime_list): Mark last two numbers as
unsigned long since they are otherwise too large for long int on
32bit machines.
Fri Feb 20 16:15:05 1998 H.J. Lu (hjl@gnu.org)
Jason Merrill <jason@yorick.cygnus.com>
* ropeimpl.h: Check __STL_PTHREADS instead of _PTHREADS.
* stl_alloc.h: Ditto.
* stl_config.h: Ditto.
* stl_rope.h: Ditto.
* stl_config.h: include <_G_config.h> if __GNUG__ is defined.
(__STL_PTHREADS): Defined if _PTHREADS is defined or
__GLIBC__ >= 2.
Tue Jan 27 12:01:25 1998 Jason Merrill <jason@yorick.cygnus.com>
* stl_algo.h (__lg): Fix for n == 0.
Sat Nov 8 00:45:17 1997 Jason Merrill <jason@yorick.cygnus.com>
* stl_hash_set.h (swap): Fix typo.
Fri Nov 7 10:27:40 1997 Jason Merrill <jason@yorick.cygnus.com>
* stl_hashtable.h: Fix typo.
Thu Nov 6 11:19:09 1997 Jason Merrill <jason@yorick.cygnus.com>
* stl_algo.h, stl_algobase.h, stl_bvector.h,
stl_deque.h: Update to October 28 SGI release.
Sun Nov 2 12:14:56 1997 Jason Merrill <jason@yorick.cygnus.com>
* algo.h, algobase.h, alloc.h, bvector.h, defalloc.h, deque.h,
function.h, hash_map.h, hash_set.h, hashtable.h, heap.h, iterator.h,
list.h, map.h, multimap.h, multiset.h, pair.h, pthread_alloc.h,
rope.h, ropeimpl.h, set.h, slist.h, stack.h, stl_config.h, tempbuf.h,
tree.h, type_traits.h, vector.h: Update to October 27 SGI snapshot.
* algorithm, deque, functional, hash_map, hash_set, iterator, list,
map, memory, numeric, pthread_alloc, queue, rope, set, slist, stack,
stl_algo.h, stl_algobase.h, stl_alloc.h, stl_bvector.h,
stl_construct.h, stl_deque.h, stl_function.h, stl_hash_fun.h,
stl_hash_map.h, stl_hash_set.h, stl_hashtable.h, stl_heap.h,
stl_iterator.h, stl_list.h, stl_map.h, stl_multimap.h, stl_multiset.h,
stl_numeric.h, stl_pair.h, stl_queue.h, stl_raw_storage_iter.h,
stl_relops.h, stl_rope.h, stl_set.h, stl_slist.h, stl_stack.h,
stl_tempbuf.h, stl_tree.h, stl_uninitialized.h, stl_vector.h,
utility, vector: New files in October 27 SGI snapshot.
Fri Oct 17 19:07:42 1997 Jason Merrill <jason@yorick.cygnus.com>
* tree.h, vector.h: Fix accidental divergence from SGI release.
Tue Sep 9 19:47:28 1997 Jason Merrill <jason@yorick.cygnus.com>
* algo.h, algobase.h, alloc.h, bvector.h, deque.h, hashtable.h,
iterator.h, list.h, rope.h, ropeimpl.h, slist.h, stl_config.h,
tree.h, vector.h: Update To September 8 SGI release.
Tue Sep 9 17:38:47 1997 Mark Mitchell <mmitchell@usa.net>
* stl_config.h (__STL_MEMBER_TEMPLATES): Enable.
Tue Aug 5 17:06:01 1997 Jason Merrill <jason@yorick.cygnus.com>
* deque.h, function.h, hashtable.h, list.h, rope.h, ropeimpl.h,
tree.h: Update to July 31 SGI release.
Fri Jul 18 10:06:56 1997 Jason Merrill <jason@yorick.cygnus.com>
* algo.h, defalloc.h, hashtable.h, rope.h, ropeimpl.h, slist.h:
Update to June 30 SGI release.
Fri Jul 04 02:17:15 1997 Ulrich Drepper <drepper@cygnus.com>
* tree.h (rb_tree): Reverse order of member initializations
to prevent warnings.
Sun Jun 15 18:17:21 1997 Jason Merrill <jason@yorick.cygnus.com>
* *.h: Update to 6/13 SGI release.
Fri May 23 10:56:18 1997 Jason Merrill <jason@yorick.cygnus.com>
* stl_config.h: Add support for exceptions with g++.
* *.h: Update to 5/8 SGI release.
Thu Apr 24 19:00:23 1997 Jason Merrill <jason@yorick.cygnus.com>
* *.h: Update to 3/24 SGI release.
Wed Feb 19 18:19:18 1997 Jason Merrill <jason@yorick.cygnus.com>
* *.h: Update to 2/18 SGI release.
* bool.h: Lose.
Mon Feb 10 16:33:23 1997 Jason Merrill <jason@yorick.cygnus.com>
* alloc.h: Don't define __USE_MALLOC for g++.
* bool.h: Lose g++ case.
* *.h: Update to 2/4 SGI release.
Mon Jan 13 14:39:16 1997 Jason Merrill <jason@yorick.cygnus.com>
* *.h: Update to 1/8 SGI release.
Mon Sep 30 17:56:43 1996 Jason Merrill <jason@yorick.cygnus.com>
* alloc.h (__unlock): Never use __lock_release.
Fri Sep 27 19:03:06 1996 Jason Merrill <jason@yorick.cygnus.com>
* alloc.h (__default_alloc_template): lock is a friend.
Thu Sep 19 20:10:37 1996 Jason Merrill <jason@yorick.cygnus.com>
Propagate these changes to new STL code:
* tree.h: Rearrange member initializers in rb_tree constructors.
* vector.h (insert): Cast iterator difference to size_type to
avoid warning.
* *.h: Update to SGI snapshot (fixed).
* *.c, Makefile.in, configure.in: Removed.
Sat Sep 14 09:43:06 1996 Jason Merrill <jason@yorick.cygnus.com>
* deque.h, list.h, tree.h: Remove kludge obsoleted by new
overloading code.
Sat Aug 10 14:59:50 1996 Jason Merrill <jason@yorick.cygnus.com>
* tempbuf.cc (__stl_temp_buffer): Align like a pointer.
Wed Jun 26 13:00:44 1996 Jason Merrill <jason@yorick.cygnus.com>
* iterator.h: Add default template parameters.
Wed Apr 24 10:45:22 1996 Doug Evans <dje@blues.cygnus.com>
* Makefile.in (tempbuf.o,random.o): Add rules for SunOS VPATH.
Fri Apr 5 17:52:31 1996 Per Bothner <bothner@kalessin.cygnus.com>
* configure.in (EXTRA_MOSTLYCLEAN): New, to remove stl.list.
Fri Mar 22 14:58:30 1996 Jason Merrill <jason@yorick.cygnus.com>
Propagate these changes to new STL code:
* tree.h: Rearrange member initializers in rb_tree constructors.
* vector.h (insert): Cast iterator difference to size_type to
avoid warning.
Sun Mar 10 07:49:03 1996 Jason Merrill <jason@yorick.cygnus.com>
* deque.h (distance_type): Add overload for g++.
From Joe Buck.
Thu Feb 22 14:07:12 1996 Jason Merrill <jason@yorick.cygnus.com>
* bool.h: Revert.
* algo.h bvector.h deque.h function.h iterator.h list.h
pair.h stack.h tree.h vector.h: Wrap #include <bool.h> with
#ifndef __GNUG__.
* defalloc.h list.h deque.h tree.h: Use __GNUG__ to control
workarounds.
Wed Feb 21 17:13:02 1996 Jason Merrill <jason@yorick.cygnus.com>
* bool.h (TRUE, FALSE): Define for people expecting the bool.h
from libg++. Is this a good idea?
Tue Feb 20 18:40:02 1996 Jason Merrill <jason@yorick.cygnus.com>
* algo.h bool.h bvector.h defalloc.h deque.h function.h heap.h
iterator.h list.h map.h pair.h random.cc stack.h tree.c tree.h
vector.h: Revert to HP release with workarounds for missing
overloading functionality.
* Makefile.in (STL_OBJECTS): Remove tree.o.
Thu Nov 9 17:05:23 1995 Jason Merrill <jason@yorick.cygnus.com>
* algo.h algobase.h bvector.h defalloc.h deque.h function.h heap.h
iterator.h list.h map.h multimap.h multiset.h pair.h projectn.h
set.h stack.h tempbuf.h tree.h vector.h: Wrap #include <bool.h>
with #ifndef __GNUG__.
Thu Nov 2 17:05:44 1995 Jason Merrill <jason@yorick.cygnus.com>
* deque.h (deque<T>::insert): Fix merge typo.
* vector.h (value_type): Lose.
Thu Nov 2 14:33:47 1995 Per Bothner <bothner@kalessin.cygnus.com>
* algo.h, algobase.h, deque.h, function.h, list.h, pair.h, random.cc:
Merge in Oct 31 1995 release from HP.
Fri Aug 11 17:11:12 1995 Per Bothner <bothner@kalessin.cygnus.com>
* list.h: Avoid duplicate construction and destruction of list_nodes.
Patch from Klamer Schutte <klamer@ph.tn.tudelft.nl>.
Fri Aug 11 16:45:18 1995 Per Bothner <bothner@kalessin.cygnus.com>
* algo.h, algobase.h, deque.h: Merged in Jul 12 1995 release from HP.
Mon Jun 5 18:38:56 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* Makefile.in (stl.list): Depend on stamp-picdir.
Wed May 17 02:30:47 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* tree.h: Rearrange member initializers in rb_tree constructors.
* Update to HP's February 7, 1995 release.
Fri May 5 10:45:31 1995 Mike Stump <mrs@cygnus.com>
* random.cc (seed): Move `for' decl out of `for' statement.
Wed Apr 26 13:09:16 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* configure.in (XCXXINCLUDES): Rename.
Wed Mar 29 19:24:56 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* tree.h (insert): Return a value.
* vector.h (insert): Cast iterator difference to size_type to
avoid warning.
Sun Feb 12 09:12:17 1995 Mike Stump <mrs@cygnus.com>
* tree.h (rb_tree::max_size): Add definition when using GNU
workaround.
Thu Jan 12 01:37:42 1995 deanm@medulla.LABS.TEK.COM (Dean Messing)
* configure.in (LIBDIR): Set to yes.
Fri Dec 30 18:26:20 1994 Mike Stump <mrs@cygnus.com>
* iterator.h: Add default template parameters where possible.
Fri Dec 30 16:29:39 1994 Mike Stump <mrs@cygnus.com>
* algo.h: Change rand to __rand to fix make check on linux systems.
Tue Nov 29 15:30:30 1994 Per Bothner <bothner@kalessin.cygnus.com>
* Initial check-in, based on HP's October 21, 1994.

View File

@ -1,13 +0,0 @@
This directory contains an SGI release of the C++ Standard Template
Library, slightly modified to work with g++.
Note that this is based on a pre-Draft Standard for C++.
Things are likely to change. For example, the header file names
are very likely to change. The Allocator interface will change. Etc, etc.
CYGNUS MAKES NO COMMITTMENT (yet) TO SUPPORT BACKWARD COMPATIBILITY FOR STL.
For examples of things that should work, look in the ../tests directory.
DOCUMENTATION:
See http://www.sgi.com/Technology/STL/ or http://www.dinkumware.com/
on the World-Wide Web.

View File

@ -1,114 +0,0 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
#ifndef __SGI_STL_ALGO_H
#define __SGI_STL_ALGO_H
#include <algobase.h>
#include <tempbuf.h>
#include <stl_algo.h>
#include <stl_numeric.h>
#ifdef __STL_USE_NAMESPACES
// Names from <stl_algo.h>
using __STD::for_each;
using __STD::find;
using __STD::find_if;
using __STD::adjacent_find;
using __STD::count;
using __STD::count_if;
using __STD::search;
using __STD::search_n;
using __STD::swap_ranges;
using __STD::transform;
using __STD::replace;
using __STD::replace_if;
using __STD::replace_copy;
using __STD::replace_copy_if;
using __STD::generate;
using __STD::generate_n;
using __STD::remove;
using __STD::remove_if;
using __STD::remove_copy;
using __STD::remove_copy_if;
using __STD::unique;
using __STD::unique_copy;
using __STD::reverse;
using __STD::reverse_copy;
using __STD::rotate;
using __STD::rotate_copy;
using __STD::random_shuffle;
using __STD::random_sample;
using __STD::random_sample_n;
using __STD::partition;
using __STD::stable_partition;
using __STD::sort;
using __STD::stable_sort;
using __STD::partial_sort;
using __STD::partial_sort_copy;
using __STD::nth_element;
using __STD::lower_bound;
using __STD::upper_bound;
using __STD::equal_range;
using __STD::binary_search;
using __STD::merge;
using __STD::inplace_merge;
using __STD::includes;
using __STD::set_union;
using __STD::set_intersection;
using __STD::set_difference;
using __STD::set_symmetric_difference;
using __STD::min_element;
using __STD::max_element;
using __STD::next_permutation;
using __STD::prev_permutation;
using __STD::find_first_of;
using __STD::find_end;
using __STD::is_sorted;
using __STD::is_heap;
// Names from stl_heap.h
using __STD::push_heap;
using __STD::pop_heap;
using __STD::make_heap;
using __STD::sort_heap;
// Names from <stl_numeric.h>
using __STD::accumulate;
using __STD::inner_product;
using __STD::partial_sum;
using __STD::adjacent_difference;
using __STD::power;
using __STD::iota;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_ALGO_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,71 +0,0 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
#ifndef __SGI_STL_ALGOBASE_H
#define __SGI_STL_ALGOBASE_H
#ifndef __SGI_STL_PAIR_H
#include <pair.h>
#endif
#ifndef __SGI_STL_ITERATOR_H
#include <iterator.h>
#endif
#ifndef __SGI_STL_INTERNAL_ALGOBASE_H
#include <stl_algobase.h>
#endif
#ifndef __SGI_STL_INTERNAL_UNINITIALIZED_H
#include <stl_uninitialized.h>
#endif
#ifdef __STL_USE_NAMESPACES
// Names from stl_algobase.h
using __STD::iter_swap;
using __STD::swap;
using __STD::min;
using __STD::max;
using __STD::copy;
using __STD::copy_backward;
using __STD::copy_n;
using __STD::fill;
using __STD::fill_n;
using __STD::mismatch;
using __STD::equal;
using __STD::lexicographical_compare;
using __STD::lexicographical_compare_3way;
// Names from stl_uninitialized.h
using __STD::uninitialized_copy;
using __STD::uninitialized_copy_n;
using __STD::uninitialized_fill;
using __STD::uninitialized_fill_n;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_ALGOBASE_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,40 +0,0 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
#ifndef __SGI_STL_ALGORITHM
#define __SGI_STL_ALGORITHM
#include <stl_algobase.h>
#include <stl_construct.h>
#include <stl_uninitialized.h>
#include <stl_tempbuf.h>
#include <stl_algo.h>
#endif /* __SGI_STL_ALGORITHM */
// Local Variables:
// mode:C++
// End:

View File

@ -1,46 +0,0 @@
/*
* Copyright (c) 1996-1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
#ifndef __SGI_STL_ALLOC_H
#define __SGI_STL_ALLOC_H
#ifndef __STL_CONFIG_H
#include <stl_config.h>
#endif
#ifndef __SGI_STL_INTERNAL_ALLOC_H
#include <stl_alloc.h>
#endif
#ifdef __STL_USE_NAMESPACES
using __STD::__malloc_alloc_template;
using __STD::malloc_alloc;
using __STD::simple_alloc;
using __STD::debug_alloc;
using __STD::__default_alloc_template;
using __STD::alloc;
using __STD::single_client_alloc;
#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG
using __STD::__malloc_alloc_oom_handler;
#endif /* __STL_STATIC_TEMPLATE_MEMBER_BUG */
#ifdef __STL_USE_STD_ALLOCATORS
using __STD::allocator;
#endif /* __STL_USE_STD_ALLOCATORS */
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_ALLOC_H */
// Local Variables:
// mode:C++
// End:

File diff suppressed because it is too large Load Diff

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