diff options
| author | mycroft <mycroft@NetBSD.org> | 1995-03-01 00:00:00 +0000 |
|---|---|---|
| committer | mycroft <mycroft@NetBSD.org> | 1995-03-01 00:00:00 +0000 |
| commit | 4c34be6b52a699cc7287e3b937a69ca90fd2ced9 (patch) | |
| tree | 0b0c2cc7c7d71419513e6302a3adf0b1829bf333 /gnu/lib/libg++/g++-include | |
| parent | 5c42185b5c628c038e11439c03ffcad1b27f6ec5 (diff) | |
Clean up deleted files.
Diffstat (limited to 'gnu/lib/libg++/g++-include')
81 files changed, 0 insertions, 10800 deletions
diff --git a/gnu/lib/libg++/g++-include/CursesW.h b/gnu/lib/libg++/g++-include/CursesW.h deleted file mode 100644 index 7056db5dc56..00000000000 --- a/gnu/lib/libg++/g++-include/CursesW.h +++ /dev/null @@ -1,397 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- - -/* -Copyright (C) 1989 Free Software Foundation - written by Eric Newton (newton@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -#ifndef _CursesWindow_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _CursesWindow_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif - -#include <curses.h> - -/* - * - * C++ class for windows. - * - * - */ - -class CursesWindow -{ -protected: - static int count; // count of all active windows: - // We rely on the c++ promise that - // all otherwise uninitialized - // static class vars are set to 0 - - WINDOW * w; // the curses WINDOW - - int alloced; // true if we own the WINDOW - - CursesWindow* par; // parent, if subwindow - CursesWindow* subwins; // head of subwindows list - CursesWindow* sib; // next subwindow of parent - - void kill_subwindows(); // disable all subwindows - -public: - CursesWindow(WINDOW* &window); // useful only for stdscr - - CursesWindow(int lines, // number of lines - int cols, // number of columns - int begin_y, // line origin - int begin_x); // col origin - - CursesWindow(CursesWindow& par, // parent window - int lines, // number of lines - int cols, // number of columns - int by, // absolute or relative - int bx, // origins: - char absrel = 'a'); // if `a', by & bx are - // absolute screen pos, - // else if `r', they are - // relative to par origin - ~CursesWindow(); - -// terminal status - int lines(); // number of lines on terminal, *not* window - int cols(); // number of cols on terminal, *not* window - -// window status - int height(); // number of lines in this window - int width(); // number of cols in this window - int begx(); // smallest x coord in window - int begy(); // smallest y coord in window - int maxx(); // largest x coord in window - int maxy(); // largest x coord in window - -// window positioning - int move(int y, int x); - -// coordinate positioning - void getyx(int& y, int& x); - int mvcur(int sy, int ey, int sx, int ex); - -// input - int getch(); - int getstr(char * str); - int scanw(const char *, ...); - -// input + positioning - int mvgetch(int y, int x); - int mvgetstr(int y, int x, char * str); - int mvscanw(int, int, const char*, ...); - -// output - int addch(const char ch); - int addstr(const char * str); - int printw(const char * fmt, ...); - int inch(); - int insch(char c); - int insertln(); - -// output + positioning - int mvaddch(int y, int x, char ch); - int mvaddstr(int y, int x, char * str); - int mvprintw(int y, int x, const char * fmt, ...); - int mvinch(int y, int x); - int mvinsch(int y, int x, char ch); - -// borders - int box(char vert, char hor); - -// erasure - int erase(); - int clear(); - int clearok(cbool bf); - int clrtobot(); - int clrtoeol(); - int delch(); - int mvdelch(int y, int x); - int deleteln(); - -// screen control - int scroll(); - int scrollok(cbool bf); - int touchwin(); - int refresh(); - int leaveok(cbool bf); - int flushok(cbool bf); - int standout(); - int standend(); - -// multiple window control - int overlay(CursesWindow &win); - int overwrite(CursesWindow &win); - - -// traversal support - CursesWindow* child(); - CursesWindow* sibling(); - CursesWindow* parent(); -}; - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - - -inline int CursesWindow::begx() -{ - return w->_begx; -} - -inline int CursesWindow::begy() -{ - return w->_begy; -} - -inline int CursesWindow::maxx() -{ - return w->_maxx; -} - -inline int CursesWindow::maxy() -{ - return w->_maxy; -} - -inline int CursesWindow::height() -{ - return maxy() - begy() + 1; -} - -inline int CursesWindow::width() -{ - return maxx() - begx() + 1; -} - -inline int CursesWindow::box(char vert, char hor) -{ - return ::box(w, vert, hor); -} - -inline int CursesWindow::overlay(CursesWindow &win) -{ - return ::overlay(w, win.w); -} - -inline int CursesWindow::overwrite(CursesWindow &win) -{ - return ::overwrite(w, win.w); -} - -inline int CursesWindow::scroll() -{ - return ::scroll(w); -} - - -inline int CursesWindow::touchwin() -{ - return ::touchwin(w); -} - -inline int CursesWindow::addch(const char ch) -{ - return ::waddch(w, ch); -} - -inline int CursesWindow::addstr(const char * str) -{ - return ::waddstr(w, str); -} - -inline int CursesWindow::clear() -{ - return ::wclear(w); -} - -inline int CursesWindow::clrtobot() -{ - return ::wclrtobot(w); -} - -inline int CursesWindow::clrtoeol() -{ - return ::wclrtoeol(w); -} - -inline int CursesWindow::delch() -{ - return ::wdelch(w); -} - -inline int CursesWindow::deleteln() -{ - return ::wdeleteln(w); -} - -inline int CursesWindow::erase() -{ - return ::werase(w); -} - -inline int CursesWindow::getch() -{ - return ::wgetch(w); -} - -inline int CursesWindow::getstr(char * str) -{ - return ::wgetstr(w, str); -} - -inline int CursesWindow::inch() -{ - return winch(w); -} - -inline int CursesWindow::insch(char c) -{ - return ::winsch(w, c); -} - -inline int CursesWindow::insertln() -{ - return ::winsertln(w); -} - -inline int CursesWindow::move(int y, int x) -{ - return ::wmove(w, y, x); -} - - -inline int CursesWindow::mvcur(int sy, int ey, int sx, int ex) -{ - return ::mvcur(sy, ey, sx,ex); -} - -inline int CursesWindow::mvaddch(int y, int x, char ch) -{ - return (::wmove(w, y, x)==0) ? 0 : ::waddch(w, ch); -} - -inline int CursesWindow::mvgetch(int y, int x) -{ - return (::wmove(w, y, x)==0) ? 0 : ::wgetch(w); -} - -inline int CursesWindow::mvaddstr(int y, int x, char * str) -{ - return (::wmove(w, y, x)==0) ? 0 : ::waddstr(w, str); -} - -inline int CursesWindow::mvgetstr(int y, int x, char * str) -{ - return (::wmove(w, y, x)==0) ? 0 : ::wgetstr(w, str); -} - -inline int CursesWindow::mvinch(int y, int x) -{ - return (::wmove(w, y, x)==0) ? 0 : ::winch(w); -} - -inline int CursesWindow::mvdelch(int y, int x) -{ - return (::wmove(w, y, x)==0) ? 0 : ::wdelch(w); -} - -inline int CursesWindow::mvinsch(int y, int x, char ch) -{ - return (::wmove(w, y, x)==0) ? 0 : ::winsch(w, ch); -} - -inline int CursesWindow::refresh() -{ - return ::wrefresh(w); -} - -inline int CursesWindow::clearok(cbool bf) -{ - return ::clearok(w,bf); -} - -inline int CursesWindow::leaveok(cbool bf) -{ - return ::leaveok(w,bf); -} - -inline int CursesWindow::scrollok(cbool bf) -{ - return ::scrollok(w,bf); -} - -inline int CursesWindow::flushok(cbool bf) -{ - return ::flushok(w, bf); -} - -inline void CursesWindow::getyx(int& y, int& x) -{ - ::getyx(w, y, x); -} - -inline int CursesWindow::standout() -{ - return ::wstandout(w); -} - -inline int CursesWindow::standend() -{ - return ::wstandend(w); -} - -inline int CursesWindow::lines() -{ - return LINES; -} - -inline int CursesWindow::cols() -{ - return COLS; -} - -inline CursesWindow* CursesWindow::child() -{ - return subwins; -} - -inline CursesWindow* CursesWindow::parent() -{ - return par; -} - -inline CursesWindow* CursesWindow::sibling() -{ - return sib; -} - - -# endif -#endif diff --git a/gnu/lib/libg++/g++-include/DiscUnif.h b/gnu/lib/libg++/g++-include/DiscUnif.h deleted file mode 100644 index d99a7d47f97..00000000000 --- a/gnu/lib/libg++/g++-include/DiscUnif.h +++ /dev/null @@ -1,79 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Dirk Grunwald (grunwald@cs.uiuc.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ -#ifndef _DiscreteUniform_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _DiscreteUniform_h 1 - -#include <Random.h> - -// -// The interval [lo..hi) -// - -class DiscreteUniform: public Random { - long pLow; - long pHigh; - double delta; -public: - DiscreteUniform(long low, long high, RNG *gen); - - long low(); - long low(long x); - long high(); - long high(long x); - - virtual double operator()(); -}; - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - -inline DiscreteUniform::DiscreteUniform(long low, long high, RNG *gen) : (gen) -{ - pLow = (low < high) ? low : high; - pHigh = (low < high) ? high : low; - delta = (pHigh - pLow) + 1; -} - -inline long DiscreteUniform::low() { return pLow; } - -inline long DiscreteUniform::low(long x) { - long tmp = pLow; - pLow = x; - delta = (pHigh - pLow) + 1; - return tmp; -} - -inline long DiscreteUniform::high() { return pHigh; } - -inline long DiscreteUniform::high(long x) { - long tmp = pHigh; - pHigh = x; - delta = (pHigh - pLow) + 1; - return tmp; -} - -#endif -#endif diff --git a/gnu/lib/libg++/g++-include/Erlang.h b/gnu/lib/libg++/g++-include/Erlang.h deleted file mode 100644 index e770e5a5924..00000000000 --- a/gnu/lib/libg++/g++-include/Erlang.h +++ /dev/null @@ -1,77 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Dirk Grunwald (grunwald@cs.uiuc.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ -#ifndef _Erlang_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _Erlang_h 1 - -#include <Random.h> - -class Erlang: public Random { -protected: - double pMean; - double pVariance; - int k; - double a; - void setState(); -public: - Erlang(double mean, double variance, RNG *gen); - - double mean(); - double mean(double x); - double variance(); - double variance(double x); - - virtual double operator()(); - -}; - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - -inline void Erlang::setState() { - k = int( (pMean * pMean ) / pVariance + 0.5 ); - k = (k > 0) ? k : 1; - a = k / pMean; -} - -inline Erlang::Erlang(double mean, double variance, RNG *gen) : (gen) -{ - pMean = mean; pVariance = variance; - setState(); -} - -inline double Erlang::mean() { return pMean; } -inline double Erlang::mean(double x) { - double tmp = pMean; pMean = x; setState(); return tmp; -}; - -inline double Erlang::variance() { return pVariance; } -inline double Erlang::variance(double x) { - double tmp = pVariance; pVariance = x; setState(); return tmp; -} - - -#endif -#endif diff --git a/gnu/lib/libg++/g++-include/File.h b/gnu/lib/libg++/g++-include/File.h deleted file mode 100644 index ce9dbef8bf0..00000000000 --- a/gnu/lib/libg++/g++-include/File.h +++ /dev/null @@ -1,302 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -#ifndef _File_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _File_h 1 - -#include <builtin.h> -#include <stdio.h> -#include <stddef.h> - -#include <Fmodes.h> - -class Filebuf; - -class File -{ - friend class Filebuf; -protected: - FILE* fp; // _iobuf file pointer - char* nm; // file name (dynamically allocated) - char rw; // 1 = read; 2 = write; 3 = readwrite - // bit 2 (4) means read/write into string - state_value state; // _good/_eof/_fail/_bad - long stat; // last read/write/... return value - - void initialize(); - void reinitialize(const char*); - char *readline (int chunk_number, char terminator); - -public: - File(); - File(const char* filename, io_mode m, access_mode a); - File(const char* filename, const char* m); - File(int filedesc, io_mode m); - File(FILE* fileptr); - File(int sz, char* buf, io_mode m); - - ~File(); - -// binding, rebinding, unbinding to physical files - - File& open(const char* filename, io_mode m, access_mode a); - File& open(const char* filename, const char* m); - File& open(int filedesc, io_mode m); - File& open(FILE* fileptr); - - File& close(); - File& remove(); - -// class variable access - - int filedesc(); - const char* name(); - void setname(const char* newname); - int iocount(); - - int rdstate(); - int eof(); - int fail(); - int bad(); - int good(); - -// other status queries - - int readable(); - int writable(); - int is_open(); - - operator void*(); - -// error handling - - void error(); - void clear(state_value f = _good); // poorly named - void set(state_value f); // set corresponding but - void unset(state_value f); // clear corresponding bit - File& failif(int cond); - void check_state(); - -// character IO - - File& get(char& c); - File& put(char c); - File& unget(char c); - File& putback(char c); // a synonym for unget - -// char* IO - - File& put(const char* s); - File& get (char* s, int n, char terminator = '\n'); - File& getline(char* s, int n, char terminator = '\n'); - File& gets (char **s, char terminator = '\n'); - -// binary IO - - File& read(void* x, int sz, int n); - File& write(void* x, int sz, int n); - -// formatted IO - - File& form(const char* ...); - File& scan(const char* ...); - -// buffer IO - - File& flush(); - -// position control - - File& seek(long pos, int seek_mode=0); // default seek mode=absolute - long tell(); - -// buffer control - - File& setbuf(int buffer_kind); // legal vals: _IONBF, _IOFBF, _IOLBF - File& setbuf(int size, char* buf); - File& raw(); -}; - - -// error handlers - -extern void verbose_File_error_handler(const char*); -extern void quiet_File_error_handler(const char*); -extern void fatal_File_error_handler(const char*); -extern one_arg_error_handler_t File_error_handler; -extern one_arg_error_handler_t set_File_error_handler(one_arg_error_handler_t); - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - - - -inline int File::filedesc() -{ - return fileno(fp); -} - -inline const char* File::name() -{ - return nm; -} - -inline int File::iocount() -{ - return stat; -} - -inline void File::clear(state_value flag) -{ - state = flag; -} - -inline void File::set(state_value flag) -{ - state = state_value(int(state) | int(flag)); -} - -inline void File::unset(state_value flag) -{ - state = state_value(int(state) & ~int(flag)); -} - -inline int File::readable() -{ - if (fp != 0) { if (feof(fp)) set(_eof); if (ferror(fp)) set(_bad);} - return (state == _good && (rw & 01)); -} - -inline int File::writable() -{ - if (fp != 0 && ferror(fp)) set(_bad); - return ((int(state) & (int(_fail)|int(_bad))) == 0 && (rw & 02)); -} - -inline int File::is_open() -{ - return (fp != 0); -} - - -inline File& File::raw() -{ - return this->File::setbuf(_IONBF); -} - - -inline File& File::failif(int cond) -{ - if (cond) set(_fail); return *this; -} - -inline File& File::get(char& c) -{ - if (readable()) - { - int ch = getc(fp); - c = ch; - failif (ch == EOF); - } - return *this; -} - -inline File& File::put(char c) -{ - return failif (!writable() || putc(c, fp) == EOF); -} - -inline File& File::unget(char c) -{ - return failif(!is_open() || !(rw & 01) || ungetc(c, fp) == EOF); -} - -inline File& File::putback(char c) -{ - return failif (!is_open() || !(rw & 01) || ungetc(c, fp) == EOF); -} - -inline File& File::read(void* x, int sz, int n) -{ - return failif (!readable() || (stat = fread(x, sz, n, fp)) != n); -} - -inline File& File::write(void* x, int sz, int n) -{ - return failif (!writable() || (stat = fwrite(x, sz, n, fp)) != n); -} - -inline File& File::flush() -{ - return failif(!is_open() || fflush(fp) == EOF); -} - - -inline File& File::seek(long pos, int seek_mode) -{ - return failif (!is_open() || fseek(fp, pos, seek_mode) < 0); -} - -inline long File::tell() -{ - failif (!is_open() || ((stat = ftell(fp)) < 0)); - return stat; -} - -inline int File::rdstate() -{ - check_state(); return state; // check_state is necessary in rare but -} // possible circumstances - -inline File::operator void*() -{ - check_state(); return (int(state) & (int(_bad)|int(_fail)))? 0 : this ; -} - -inline int File::eof() -{ - check_state(); return state & _eof; -} - -inline int File::fail() -{ - check_state(); return state & _fail; -} - -inline int File::bad() -{ - check_state(); return state & _bad; -} - -inline int File::good() -{ - check_state(); return rdstate() == _good; -} - - -#endif - -#endif diff --git a/gnu/lib/libg++/g++-include/Filebuf.h b/gnu/lib/libg++/g++-include/Filebuf.h deleted file mode 100644 index 2124e21c13d..00000000000 --- a/gnu/lib/libg++/g++-include/Filebuf.h +++ /dev/null @@ -1,32 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -#ifndef _Filebuf_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _Filebuf_h 1 - - -#endif diff --git a/gnu/lib/libg++/g++-include/Fix.h b/gnu/lib/libg++/g++-include/Fix.h deleted file mode 100644 index d325228ce51..00000000000 --- a/gnu/lib/libg++/g++-include/Fix.h +++ /dev/null @@ -1,468 +0,0 @@ -// -// Fix.h : variable length fixed point data type -// - -#ifndef _Fix_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _Fix_h 1 - -#include <stream.h> -#include <std.h> -#include <stddef.h> -#include <Integer.h> - -typedef unsigned short uint16; -typedef short int16; -typedef unsigned long uint32; -typedef long int32; - -#define _Fix_min_length 1 -#define _Fix_max_length 65535 - -#define _Fix_min_value -1.0 -#define _Fix_max_value 1.0 - -extern uint16 Fix_default_length; -extern int Fix_default_print_width; - -struct _Frep // internal Fix representation -{ - uint16 len; // length in bits - uint16 siz; // allocated storage - int16 ref; // reference count - uint16 s[1]; // start of ushort array represention -}; - -typedef struct _Frep* _Fix; - -extern _Frep _Frep_0; -extern _Frep _Frep_m1; -extern _Frep _Frep_quotient_bump; - -class Fix -{ - _Fix rep; - - Fix(_Fix); - - void unique(); - -public: - Fix(); - Fix(Fix&); - Fix(double&); - Fix(int); - Fix(int, Fix&); - Fix(int, double&); - Fix(int, _Frep*); - - ~Fix(); - - Fix operator = (Fix&); - Fix operator = (double&); - - friend int operator == (Fix&, Fix& ); - friend int operator != (Fix&, Fix&); - - friend int operator < (Fix&, Fix&); - friend int operator <= (Fix&, Fix&); - friend int operator > (Fix&, Fix&); - friend int operator >= (Fix&, Fix&); - - Fix& operator + (); - Fix operator - (); - - friend Fix operator + (Fix&, Fix&); - friend Fix operator - (Fix&, Fix&); - friend Fix operator * (Fix&, Fix&); - friend Fix operator / (Fix&, Fix&); - - friend Fix operator * (Fix&, int); - friend Fix operator * (int, Fix&); - friend Fix operator % (Fix&, int); - friend Fix operator << (Fix&, int); - friend Fix operator >> (Fix&, int); - -#ifdef __GNUG__ - friend Fix operator <? (Fix&, Fix&); // min - friend Fix operator >? (Fix&, Fix&); // max -#endif - - Fix operator += (Fix&); - Fix operator -= (Fix&); - Fix operator *= (Fix&); - Fix operator /= (Fix&); - - Fix operator *= (int); - Fix operator %= (int); - Fix operator <<=(int); - Fix operator >>=(int); - - friend char* Ftoa(Fix&, int width = Fix_default_print_width); - friend Fix atoF(const char*, int len = Fix_default_length); - - friend istream& operator >> (istream&, Fix&); - friend ostream& operator << (ostream&, Fix&); - - // built-in functions - friend Fix abs(Fix); // absolute value - friend int sgn(Fix&); // -1, 0, +1 - friend Integer mantissa(Fix&); // integer representation - friend double value(Fix&); // double value - friend int length(Fix&); // field length - friend void show(Fix&); // show contents - - // error handlers - void error(const char* msg); // error handler - void range_error(const char* msg); // range error handler - - // internal class functions - friend void mask(_Fix); - friend int compare(_Fix, _Fix = &_Frep_0); - - friend _Fix new_Fix(uint16); - friend _Fix new_Fix(uint16, _Fix); - friend _Fix new_Fix(uint16, double); - - friend _Fix copy(_Fix, _Fix); - friend _Fix negate(_Fix, _Fix = NULL); - friend _Fix add(_Fix, _Fix, _Fix = NULL); - friend _Fix subtract(_Fix, _Fix, _Fix = NULL); - friend _Fix multiply(_Fix, _Fix, _Fix = NULL); - friend _Fix multiply(_Fix, int, _Fix = NULL); - friend _Fix divide(_Fix, _Fix, _Fix = NULL, _Fix = NULL); - friend _Fix shift(_Fix, int, _Fix = NULL); - - // non-operator versions for user - friend void negate(Fix& x, Fix& r); - friend void add(Fix& x, Fix& y, Fix& r); - friend void subtract(Fix& x, Fix& y, Fix& r); - friend void multiply(Fix& x, Fix& y, Fix& r); - friend void divide(Fix& x, Fix& y, Fix& q, Fix& r); - friend void shift(Fix& x, int y, Fix& r); -}; - -// error handlers - -extern void - default_Fix_error_handler(const char*), - default_Fix_range_error_handler(const char*); - -extern one_arg_error_handler_t - Fix_error_handler, - Fix_range_error_handler; - -extern one_arg_error_handler_t - set_Fix_error_handler(one_arg_error_handler_t f), - set_Fix_range_error_handler(one_arg_error_handler_t f); - -typedef void (*Fix_peh)(_Fix&); -extern Fix_peh Fix_overflow_handler; - -extern void - Fix_overflow_saturate(_Fix&), - Fix_overflow_wrap(_Fix&), - Fix_overflow_warning_saturate(_Fix&), - Fix_overflow_warning(_Fix&), - Fix_overflow_error(_Fix&); - -extern Fix_peh set_overflow_handler(Fix_peh); - -extern int Fix_set_default_length(int); - -// function definitions - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - -inline void Fix::unique() -{ - if ( rep->ref > 1 ) - { - rep->ref--; - rep = new_Fix(rep->len,rep); - } -} - -inline void mask (_Fix x) -{ - int n = x->len & 0x0f; - if ( n ) - x->s[x->siz - 1] &= 0xffff0000 >> n; -} - -inline _Fix copy(_Fix from, _Fix to) -{ - uint16 *ts = to->s, *fs = from->s; - int ilim = to->siz < from->siz ? to->siz : from->siz; - for ( int i=0; i < ilim; i++ ) - *ts++ = *fs++; - for ( ; i < to->siz; i++ ) - *ts++ = 0; - mask(to); - return to; -} - -inline Fix::Fix(_Fix f) -{ - rep = f; -} - -inline Fix::Fix() -{ - rep = new_Fix(Fix_default_length); -} - -inline Fix::Fix(int len) -{ - if ( len < _Fix_min_length || len > _Fix_max_length ) - error("illegal length in declaration"); - rep = new_Fix((uint16 )len); -} - -inline Fix::Fix(double& d) -{ - rep = new_Fix(Fix_default_length,d); -} - -inline Fix::Fix(Fix& y) -{ - rep = y.rep; rep->ref++; -} - -inline Fix::Fix(int len, Fix& y) -{ - if ( len < _Fix_min_length || len > _Fix_max_length ) - error("illegal length in declaration"); - rep = new_Fix((uint16 )len,y.rep); -} - -inline Fix::Fix(int len, _Frep* fr) -{ - if ( len < 1 || len > 65535 ) - error("illegal length in declaration"); - rep = new_Fix((uint16 )len,fr); -} - -inline Fix::Fix(int len, double& d) -{ - if ( len < _Fix_min_length || len > _Fix_max_length ) - error("illegal length in declaration"); - rep = new_Fix((uint16 )len,d); -} - -inline Fix::~Fix() -{ - if ( --rep->ref <= 0 ) delete rep; -} - -inline Fix Fix::operator = (Fix& y) -{ - if ( rep->len == y.rep->len ) { - ++y.rep->ref; - if ( --rep->ref <= 0 ) delete rep; - rep = y.rep; - } - else { - unique(); - copy(y.rep,rep); - } - return *this; -} - -inline Fix Fix::operator = (double& d) -{ - int oldlen = rep->len; - if ( --rep->ref <= 0 ) delete rep; - rep = new_Fix(oldlen,d); - return *this; -} - -inline int operator == (Fix& x, Fix& y) -{ - return compare(x.rep, y.rep) == 0; -} - -inline int operator != (Fix& x, Fix& y) -{ - return compare(x.rep, y.rep) != 0; -} - -inline int operator < (Fix& x, Fix& y) -{ - return compare(x.rep, y.rep) < 0; -} - -inline int operator <= (Fix& x, Fix& y) -{ - return compare(x.rep, y.rep) <= 0; -} - -inline int operator > (Fix& x, Fix& y) -{ - return compare(x.rep, y.rep) > 0; -} - -inline int operator >= (Fix& x, Fix& y) -{ - return compare(x.rep, y.rep) >= 0; -} - -inline Fix& Fix::operator + () -{ - return *this; -} - -inline Fix Fix::operator - () -{ - _Fix r = negate(rep); return r; -} - -inline Fix operator + (Fix& x, Fix& y) -{ - _Fix r = add(x.rep, y.rep); return r; -} - -inline Fix operator - (Fix& x, Fix& y) -{ - _Fix r = subtract(x.rep, y.rep); return r; -} - -inline Fix operator * (Fix& x, Fix& y) -{ - _Fix r = multiply(x.rep, y.rep); return r; -} - -inline Fix operator * (Fix& x, int y) -{ - _Fix r = multiply(x.rep, y); return r; -} - -inline Fix operator * (int y, Fix& x) -{ - _Fix r = multiply(x.rep, y); return r; -} - -inline Fix operator / (Fix& x, Fix& y) -{ - _Fix r = divide(x.rep, y.rep); return r; -} - -inline Fix Fix::operator += (Fix& y) -{ - unique(); add(rep, y.rep, rep); return *this; -} - -inline Fix Fix::operator -= (Fix& y) -{ - unique(); subtract(rep, y.rep, rep); return *this; -} - -inline Fix Fix::operator *= (Fix& y) -{ - unique(); multiply(rep, y.rep, rep); return *this; -} - -inline Fix Fix::operator *= (int y) -{ - unique(); multiply(rep, y, rep); return *this; -} - -inline Fix Fix::operator /= (Fix& y) -{ - unique(); divide(rep, y.rep, rep); return *this; -} - -inline Fix operator % (Fix& x, int y) -{ - Fix r((int )x.rep->len + y, x); return r; -} - -inline Fix operator << (Fix& x, int y) -{ - _Fix rep = shift(x.rep, y); return rep; -} - -inline Fix operator >> (Fix& x, int y) -{ - _Fix rep = shift(x.rep, -y); return rep; -} - -inline Fix Fix::operator <<= (int y) -{ - unique(); shift(rep, y, rep); return *this; -} - -inline Fix Fix::operator >>= (int y) -{ - unique(); shift(rep, -y, rep); return *this; -} - -#ifdef __GNUG__ -inline Fix operator <? (Fix& x, Fix& y) -{ - if ( compare(x.rep, y.rep) <= 0 ) return x; else return y; -} - -inline Fix operator >? (Fix& x, Fix& y) -{ - if ( compare(x.rep, y.rep) >= 0 ) return x; else return y; -} -#endif - -inline Fix abs(Fix x) -{ - _Fix r = (compare(x.rep) >= 0 ? new_Fix(x.rep->len,x.rep) : negate(x.rep)); - return r; -} - -inline int sgn(Fix& x) -{ - int a = compare(x.rep); - return a == 0 ? 0 : (a > 0 ? 1 : -1); -} - -inline int length(Fix& x) -{ - return x.rep->len; -} - -inline ostream& operator << (ostream& s, Fix& y) -{ - return s << Ftoa(y); -} - -inline void negate (Fix& x, Fix& r) -{ - negate(x.rep, r.rep); -} - -inline void add (Fix& x, Fix& y, Fix& r) -{ - add(x.rep, y.rep, r.rep); -} - -inline void subtract (Fix& x, Fix& y, Fix& r) -{ - subtract(x.rep, y.rep, r.rep); -} - -inline void multiply (Fix& x, Fix& y, Fix& r) -{ - multiply(x.rep, y.rep, r.rep); -} - -inline void divide (Fix& x, Fix& y, Fix& q, Fix& r) -{ - divide(x.rep, y.rep, q.rep, r.rep); -} - -inline void shift (Fix& x, int y, Fix& r) -{ - shift(x.rep, y, r.rep); -} - -#endif -#endif diff --git a/gnu/lib/libg++/g++-include/Fix16.h b/gnu/lib/libg++/g++-include/Fix16.h deleted file mode 100644 index 0024c9da110..00000000000 --- a/gnu/lib/libg++/g++-include/Fix16.h +++ /dev/null @@ -1,647 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Kurt Baudendistel (gt-eedsp!baud@gatech.edu) - adapted for libg++ by Doug Lea (dl@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -#ifndef _Fix16_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _Fix16_h 1 - -#include <stream.h> -#include <std.h> - -// constant definitions - -#define Fix16_fs ((double)((unsigned)(1 << 15))) - -#define Fix16_msb (1 << 15) -#define Fix16_m_max ((1 << 15) - 1) -#define Fix16_m_min ((short)(1 << 15)) - -#define Fix16_mult Fix16_fs -#define Fix16_div (1./Fix16_fs) -#define Fix16_max (1. - .5/Fix16_fs) -#define Fix16_min (-1.) - - -#define Fix32_fs ((double)((unsigned long)(1 << 31))) - -#define Fix32_msb ((unsigned long)(1 << 31)) -#define Fix32_m_max ((1 << 31) - 1) -#define Fix32_m_min ((long)(1 << 31)) - -#define Fix32_mult Fix32_fs -#define Fix32_div (1./Fix32_fs) -#define Fix32_max (1. - .5/Fix32_fs) -#define Fix32_min (-1.) - - -// -// Fix16 class: 16-bit Fixed point data type -// -// consists of a 16-bit mantissa (sign bit & 15 data bits). -// - -class Fix16 -{ - friend class Fix32; - - short m; - - short round(double d); - short assign(double d); - Fix16(short i); - Fix16(int i); - - operator double(); - - -public: - Fix16(); - Fix16(Fix16& f); - Fix16(double d); - Fix16(Fix32& f); - - ~Fix16(); - - Fix16& operator=(Fix16& f); - Fix16& operator=(double d); - Fix16& operator=(Fix32& f); - - friend short& mantissa(Fix16& f); - friend double value(Fix16& f); - - Fix16 operator + (); - Fix16 operator - (); - - friend Fix16 operator + (Fix16& f, Fix16& g); - friend Fix16 operator - (Fix16& f, Fix16& g); - friend Fix32 operator * (Fix16& f, Fix16& g); - friend Fix16 operator / (Fix16& f, Fix16& g); - friend Fix16 operator << (Fix16& f, int b); - friend Fix16 operator >> (Fix16& f, int b); - - Fix16& operator += (Fix16& f); - Fix16& operator -= (Fix16& f); - Fix16& operator *= (Fix16& ); - Fix16& operator /= (Fix16& f); - - Fix16& operator <<=(int b); - Fix16& operator >>=(int b); - - friend int operator == (Fix16& f, Fix16& g); - friend int operator != (Fix16& f, Fix16& g); - friend int operator >= (Fix16& f, Fix16& g); - friend int operator <= (Fix16& f, Fix16& g); - friend int operator > (Fix16& f, Fix16& g); - friend int operator < (Fix16& f, Fix16& g); - - friend istream& operator >> (istream& s, Fix16& f); - friend ostream& operator << (ostream& s, Fix16& f); - - void overflow(short&); - void range_error(short&); - - friend Fix16 operator * (Fix16& f, int g); - friend Fix16 operator * (int g, Fix16& f); - Fix16& operator *= (int g); -}; - - -// -// Fix32 class: 32-bit Fixed point data type -// -// consists of a 32-bit mantissa (sign bit & 31 data bits). -// - -class Fix32 -{ - friend class Fix16; - - long m; - - long round(double d); - long assign(double d); - - Fix32(long i); - operator double(); - - -public: - Fix32(); - Fix32(Fix32& f); - Fix32(Fix16& f); - Fix32(double d); - ~Fix32(); - - Fix32& operator = (Fix32& f); - Fix32& operator = (Fix16& f); - Fix32& operator = (double d); - - friend long& mantissa(Fix32& f); - friend double value(Fix32& f); - - Fix32 operator + (); - Fix32 operator - (); - - friend Fix32 operator + (Fix32& f, Fix32& g); - friend Fix32 operator - (Fix32& f, Fix32& g); - friend Fix32 operator * (Fix32& f, Fix32& g); - friend Fix32 operator / (Fix32& f, Fix32& g); - friend Fix32 operator << (Fix32& f, int b); - friend Fix32 operator >> (Fix32& f, int b); - - friend Fix32 operator * (Fix16& f, Fix16& g); - - Fix32& operator += (Fix32& f); - Fix32& operator -= (Fix32& f); - Fix32& operator *= (Fix32& f); - Fix32& operator /= (Fix32& f); - Fix32& operator <<=(int b); - Fix32& operator >>=(int b); - - friend int operator == (Fix32& f, Fix32& g); - friend int operator != (Fix32& f, Fix32& g); - friend int operator >= (Fix32& f, Fix32& g); - friend int operator <= (Fix32& f, Fix32& g); - friend int operator > (Fix32& f, Fix32& g); - friend int operator < (Fix32& f, Fix32& g); - - friend istream& operator >> (istream& s, Fix32& f); - friend ostream& operator << (ostream& s, Fix32& f); - - void overflow(long& i); - void range_error(long& i); - - friend Fix32 operator * (Fix32& f, int g); - friend Fix32 operator * (int g, Fix32& f); - Fix32& operator *= (int g); -}; - -// active error handler declarations - -typedef void (*Fix16_peh)(short&); -typedef void (*Fix32_peh)(long&); - -extern Fix16_peh Fix16_overflow_handler; -extern Fix32_peh Fix32_overflow_handler; - -extern Fix16_peh Fix16_range_error_handler; -extern Fix32_peh Fix32_range_error_handler; - -#if defined(SHORT_NAMES) || defined(VMS) -#define set_overflow_handler sohndl -#define set_range_error_handler srnghdl -#endif - - -// error handler declarations - -extern Fix16_peh set_Fix16_overflow_handler(Fix16_peh); -extern Fix32_peh set_Fix32_overflow_handler(Fix32_peh); -extern void set_overflow_handler(Fix16_peh, Fix32_peh); - -extern Fix16_peh set_Fix16_range_error_handler(Fix16_peh); -extern Fix32_peh set_Fix32_range_error_handler(Fix32_peh); -extern void set_range_error_handler(Fix16_peh, Fix32_peh); - -extern void - Fix16_ignore(short&), - Fix16_overflow_saturate(short&), - Fix16_overflow_warning_saturate(short&), - Fix16_warning(short&), - Fix16_abort(short&); - -extern void - Fix32_ignore(long&), - Fix32_overflow_saturate(long&), - Fix32_overflow_warning_saturate(long&), - Fix32_warning(long&), - Fix32_abort(long&); - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - -inline Fix16::~Fix16() {} - -inline short Fix16::round(double d) -{ - return short( (d >= 0)? d + 0.5 : d - 0.5); -} - -inline Fix16::Fix16(short i) -{ - m = i; -} - -inline Fix16::Fix16(int i) -{ - m = i; -} - -inline Fix16::operator double() -{ - return Fix16_div * m; -} - -inline Fix16::Fix16() -{ - m = 0; -} - -inline Fix16::Fix16(Fix16& f) -{ - m = f.m; -} - -inline Fix16::Fix16(double d) -{ - m = assign(d); -} - - -inline Fix16& Fix16::operator=(Fix16& f) -{ - m = f.m; - return *this; -} - -inline Fix16& Fix16::operator=(double d) -{ - m = assign(d); - return *this; -} - - -inline Fix32::Fix32() -{ - m = 0; -} - -inline Fix32::Fix32(long i) -{ - m = i; -} - -inline Fix32:: operator double() -{ - return Fix32_div * m; -} - - -inline Fix32::Fix32(Fix32& f) -{ - m = f.m; -} - -inline Fix32::Fix32(Fix16& f) -{ - m = long(f.m) << 16; -} - -inline Fix32::Fix32(double d) -{ - m = assign(d); -} - -inline Fix16::Fix16(Fix32& f) -{ - m = f.m >> 16; -} - - -inline Fix16& Fix16::operator=(Fix32& f) -{ - m = f.m >> 16; - return *this; -} - -inline Fix32& Fix32::operator=(Fix32& f) -{ - m = f.m; - return *this; -} - -inline Fix32& Fix32::operator=(Fix16& f) -{ - m = long(f.m) << 16; - return *this; -} - -inline Fix32& Fix32::operator=(double d) -{ - m = assign(d); - return *this; -} - -inline short& mantissa(Fix16& f) -{ - return f.m; -} - -inline double value(Fix16& f) -{ - return double(f); -} - -inline Fix16 Fix16::operator+() -{ - return m; -} - -inline Fix16 Fix16::operator-() -{ - return -m; -} - -inline Fix16 operator+(Fix16& f, Fix16& g) -{ - short sum = f.m + g.m; - if ( (f.m ^ sum) & (g.m ^ sum) & Fix16_msb ) - f.overflow(sum); - return sum; -} - -inline Fix16 operator-(Fix16& f, Fix16& g) -{ - short sum = f.m - g.m; - if ( (f.m ^ sum) & (-g.m ^ sum) & Fix16_msb ) - f.overflow(sum); - return sum; -} - -inline Fix32 operator*(Fix16& f, Fix16& g) -{ - return Fix32( long( long(f.m) * long(g.m) << 1)); -} - -inline Fix16 operator<<(Fix16& a, int b) -{ - return a.m << b; -} - -inline Fix16 operator>>(Fix16& a, int b) -{ - return a.m >> b; -} - -inline Fix16& Fix16:: operator+=(Fix16& f) -{ - return *this = *this + f; -} - -inline Fix16& Fix16:: operator-=(Fix16& f) -{ - return *this = *this - f; -} - -inline Fix16& Fix16::operator*=(Fix16& f) -{ - return *this = *this * f; -} - -inline Fix16& Fix16:: operator/=(Fix16& f) -{ - return *this = *this / f; -} - -inline Fix16& Fix16:: operator<<=(int b) -{ - return *this = *this << b; -} - -inline Fix16& Fix16:: operator>>=(int b) -{ - return *this = *this >> b; -} - -inline int operator==(Fix16& f, Fix16& g) -{ - return f.m == g.m; -} - -inline int operator!=(Fix16& f, Fix16& g) -{ - return f.m != g.m; -} - -inline int operator>=(Fix16& f, Fix16& g) -{ - return f.m >= g.m; -} - -inline int operator<=(Fix16& f, Fix16& g) -{ - return f.m <= g.m; -} - -inline int operator>(Fix16& f, Fix16& g) -{ - return f.m > g.m; -} - -inline int operator<(Fix16& f, Fix16& g) -{ - return f.m < g.m; -} - -inline istream& operator>>(istream& s, Fix16& f) -{ - double d; - s >> d; - f = d; - return s; -} - -inline ostream& operator<<(ostream& s, Fix16& f) -{ - return s << double(f); -} - - -inline Fix16 operator*(Fix16& f, int g) -{ - return Fix16(short(f.m * g)); -} - -inline Fix16 operator*(int g, Fix16& f) -{ - return f * g; -} - - -inline Fix16& Fix16::operator*=(int g) -{ - return *this = *this * g; -} - -inline Fix32::~Fix32() {} - -inline long Fix32::round(double d) -{ - return long( (d >= 0)? d + 0.5 : d - 0.5); -} - - -inline long& mantissa(Fix32& f) -{ - return f.m; -} - -inline double value(Fix32& f) -{ - return double(f); -} - -inline Fix32 Fix32::operator+() -{ - return m; -} - -inline Fix32 Fix32::operator-() -{ - return -m; -} - -inline Fix32 operator+(Fix32& f, Fix32& g) -{ - long sum = f.m + g.m; - if ( (f.m ^ sum) & (g.m ^ sum) & Fix32_msb ) - f.overflow(sum); - return sum; -} - -inline Fix32 operator-(Fix32& f, Fix32& g) -{ - long sum = f.m - g.m; - if ( (f.m ^ sum) & (-g.m ^ sum) & Fix32_msb ) - f.overflow(sum); - return sum; -} - -inline Fix32 operator<<(Fix32& a, int b) -{ - return a.m << b; -} - -inline Fix32 operator>>(Fix32& a, int b) -{ - return a.m >> b; -} - -inline Fix32& Fix32::operator+=(Fix32& f) -{ - return *this = *this + f; -} - -inline Fix32& Fix32::operator-=(Fix32& f) -{ - return *this = *this - f; -} - -inline Fix32& Fix32::operator*=(Fix32& f) -{ - return *this = *this * f; -} - -inline Fix32& Fix32::operator/=(Fix32& f) -{ - return *this = *this / f; -} - - -inline Fix32& Fix32::operator<<=(int b) -{ - return *this = *this << b; -} - -inline Fix32& Fix32::operator>>=(int b) -{ - return *this = *this >> b; -} - -inline int operator==(Fix32& f, Fix32& g) -{ - return f.m == g.m; -} - -inline int operator!=(Fix32& f, Fix32& g) -{ - return f.m != g.m; -} - -inline int operator>=(Fix32& f, Fix32& g) -{ - return f.m >= g.m; -} - -inline int operator<=(Fix32& f, Fix32& g) -{ - return f.m <= g.m; -} - -inline int operator>(Fix32& f, Fix32& g) -{ - return f.m > g.m; -} - -inline int operator<(Fix32& f, Fix32& g) -{ - return f.m < g.m; -} - -inline istream& operator>>(istream& s, Fix32& f) -{ - double d; - s >> d; - f = d; - return s; -} - -inline ostream& operator<<(ostream& s, Fix32& f) -{ - return s << double(f); -} - -inline Fix32 operator*(Fix32& f, int g) -{ - return Fix32(long(f.m * g)); -} - -inline Fix32 operator*(int g, Fix32& f) -{ - return f * g; -} - - - -inline Fix32& Fix32::operator*=(int g) -{ - return *this = *this * g; -} - - -#endif -#endif - diff --git a/gnu/lib/libg++/g++-include/Fix24.h b/gnu/lib/libg++/g++-include/Fix24.h deleted file mode 100644 index ec48afcae6e..00000000000 --- a/gnu/lib/libg++/g++-include/Fix24.h +++ /dev/null @@ -1,595 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Kurt Baudendistel (gt-eedsp!baud@gatech.edu) - adapted for libg++ by Doug Lea (dl@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -#ifndef _Fix24_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _Fix24_h 1 - -#include <stream.h> -#include <std.h> - -// extra type definitions - -typedef struct { - long u; - unsigned long l; -} twolongs; - -// constant definitions - -static const int - Fix24_shift = 31; - -static const double - Fix24_fs = 2147483648., // 2^Fix24_shift - Fix24_mult = Fix24_fs, - Fix24_div = 1./Fix24_fs, - Fix24_max = 1. - .5/Fix24_fs, - Fix24_min = -1.; - -static const unsigned long - Fix24_msb = 0x80000000L, - Fix24_lsb = 0x00000100L, - Fix24_m_max = 0x7fffff00L, - Fix24_m_min = 0x80000000L; - -static const double - Fix48_fs = 36028797018963968., // 2^(24+Fix24_shift) - Fix48_max = 1. - .5/Fix48_fs, - Fix48_min = -1., - Fix48_div_u = 1./Fix24_fs, - Fix48_div_l = 1./Fix48_fs; - -static const twolongs - Fix48_msb = { 0x80000000L, 0L }, - Fix48_lsb = { 0L, 0x00000100L }, - Fix48_m_max = { 0x7fffff00L, 0xffffff00L }, - Fix48_m_min = { 0x80000000L, 0L }; - -// -// Fix24 class: 24-bit Fixed point data type -// -// consists of a 24-bit mantissa (sign bit & 23 data bits). -// - -class Fix24 -{ - friend class Fix48; - - long m; - - long assign(double d); - operator double(); - Fix24(long i); - Fix24(int i); - - -public: - Fix24(); - Fix24(Fix24& f); - Fix24(double d); - Fix24(Fix48& f); - - ~Fix24(); - - Fix24& operator=(Fix24& f); - Fix24& operator=(double d); - Fix24& operator=(Fix48& f); - - friend long& mantissa(Fix24& f); - friend double value(Fix24& f); - - Fix24 operator + (); - Fix24 operator - (); - - friend Fix24 operator + (Fix24& f, Fix24& g); - friend Fix24 operator - (Fix24& f, Fix24& g); - friend Fix48 operator * (Fix24& f, Fix24& g); - friend Fix24 operator * (Fix24& f, int g); - friend Fix24 operator * (int g, Fix24& f); - friend Fix24 operator / (Fix24& f, Fix24& g); - friend Fix24 operator << (Fix24& f, int b); - friend Fix24 operator >> (Fix24& f, int b); - - Fix24& operator += (Fix24& f); - Fix24& operator -= (Fix24& f); - Fix24& operator *= (Fix24& f); - Fix24& operator *= (int b); - Fix24& operator /= (Fix24& f); - - Fix24& operator <<=(int b); - Fix24& operator >>=(int b); - - friend int operator == (Fix24& f, Fix24& g); - friend int operator != (Fix24& f, Fix24& g); - friend int operator >= (Fix24& f, Fix24& g); - friend int operator <= (Fix24& f, Fix24& g); - friend int operator > (Fix24& f, Fix24& g); - friend int operator < (Fix24& f, Fix24& g); - - friend istream& operator >> (istream& s, Fix24& f); - friend ostream& operator << (ostream& s, Fix24& f); - - void overflow(long&); - void range_error(long&); -}; - - -// -// Fix48 class: 48-bit Fixed point data type -// -// consists of a 48-bit mantissa (sign bit & 47 data bits). -// - -class Fix48 -{ - friend class Fix24; - - twolongs m; - - twolongs assign(double d); - operator double(); - Fix48(twolongs i); - -public: - Fix48(); - Fix48(Fix48& f); - Fix48(Fix24& f); - Fix48(double d); - ~Fix48(); - - Fix48& operator = (Fix48& f); - Fix48& operator = (Fix24& f); - Fix48& operator = (double d); - - friend twolongs& mantissa(Fix48& f); - friend double value(Fix48& f); - - Fix48 operator + (); - Fix48 operator - (); - - friend Fix48 operator + (Fix48& f, Fix48& g); - friend Fix48 operator - (Fix48& f, Fix48& g); - friend Fix48 operator * (Fix48& f, int g); - friend Fix48 operator * (int g, Fix48& f); - friend Fix48 operator << (Fix48& f, int b); - friend Fix48 operator >> (Fix48& f, int b); - - friend Fix48 operator * (Fix24& f, Fix24& g); - - Fix48& operator += (Fix48& f); - Fix48& operator -= (Fix48& f); - Fix48& operator *= (int b); - Fix48& operator <<=(int b); - Fix48& operator >>=(int b); - - friend int operator == (Fix48& f, Fix48& g); - friend int operator != (Fix48& f, Fix48& g); - friend int operator >= (Fix48& f, Fix48& g); - friend int operator <= (Fix48& f, Fix48& g); - friend int operator > (Fix48& f, Fix48& g); - friend int operator < (Fix48& f, Fix48& g); - - friend istream& operator >> (istream& s, Fix48& f); - friend ostream& operator << (ostream& s, Fix48& f); - - void overflow(twolongs& i); - void range_error(twolongs& i); -}; - - -// active error handler declarations - -typedef void (*Fix24_peh)(long&); -typedef void (*Fix48_peh)(twolongs&); - -extern Fix24_peh Fix24_overflow_handler; -extern Fix48_peh Fix48_overflow_handler; - -extern Fix24_peh Fix24_range_error_handler; -extern Fix48_peh Fix48_range_error_handler; - - -// error handler declarations - -#if defined(SHORT_NAMES) || defined(VMS) -#define set_overflow_handler sohndl -#define set_range_error_handler srnghdl -#endif - -extern Fix24_peh set_Fix24_overflow_handler(Fix24_peh); -extern Fix48_peh set_Fix48_overflow_handler(Fix48_peh); -extern void set_overflow_handler(Fix24_peh, Fix48_peh); - -extern Fix24_peh set_Fix24_range_error_handler(Fix24_peh); -extern Fix48_peh set_Fix48_range_error_handler(Fix48_peh); -extern void set_range_error_handler(Fix24_peh, Fix48_peh); - -extern void - Fix24_ignore(long&), - Fix24_overflow_saturate(long&), - Fix24_overflow_warning_saturate(long&), - Fix24_warning(long&), - Fix24_abort(long&); - -extern void - Fix48_ignore(twolongs&), - Fix48_overflow_saturate(twolongs&), - Fix48_overflow_warning_saturate(twolongs&), - Fix48_warning(twolongs&), - Fix48_abort(twolongs&); - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - -inline Fix24::~Fix24() {} - -inline Fix24::Fix24(long i) -{ - m = i; -} - -inline Fix24::Fix24(int i) -{ - m = i; -} - -inline Fix24::operator double() -{ - return Fix24_div * m; -} - -inline Fix24::Fix24() -{ - m = 0; -} - -inline Fix24::Fix24(Fix24& f) -{ - m = f.m; -} - -inline Fix24::Fix24(double d) -{ - m = assign(d); -} - -inline Fix24::Fix24(Fix48& f) -{ - m = f.m.u; -} - -inline Fix24& Fix24::operator=(Fix24& f) -{ - m = f.m; - return *this; -} - -inline Fix24& Fix24::operator=(double d) -{ - m = assign(d); - return *this; -} - -inline Fix24& Fix24::operator=(Fix48& f) -{ - m = f.m.u; - return *this; -} - -inline long& mantissa(Fix24& f) -{ - return f.m; -} - -inline double value(Fix24& f) -{ - return double(f); -} - -inline Fix24 Fix24::operator+() -{ - return m; -} - -inline Fix24 Fix24::operator-() -{ - return -m; -} - -inline Fix24 operator+(Fix24& f, Fix24& g) -{ - long sum = f.m + g.m; - if ( (f.m ^ sum) & (g.m ^ sum) & Fix24_msb ) - f.overflow(sum); - return sum; -} - -inline Fix24 operator-(Fix24& f, Fix24& g) -{ - long sum = f.m - g.m; - if ( (f.m ^ sum) & (-g.m ^ sum) & Fix24_msb ) - f.overflow(sum); - return sum; -} - -inline Fix24 operator*(Fix24& a, int b) -{ - return a.m * b; -} - -inline Fix24 operator*(int b, Fix24& a) -{ - return a * b; -} - -inline Fix24 operator<<(Fix24& a, int b) -{ - return a.m << b; -} - -inline Fix24 operator>>(Fix24& a, int b) -{ - return (a.m >> b) & 0xffffff00L; -} - -inline Fix24& Fix24:: operator+=(Fix24& f) -{ - return *this = *this + f; -} - -inline Fix24& Fix24:: operator-=(Fix24& f) -{ - return *this = *this - f; -} - -inline Fix24& Fix24::operator*=(Fix24& f) -{ - return *this = *this * f; -} - -inline Fix24& Fix24:: operator/=(Fix24& f) -{ - return *this = *this / f; -} - -inline Fix24& Fix24:: operator<<=(int b) -{ - return *this = *this << b; -} - -inline Fix24& Fix24:: operator>>=(int b) -{ - return *this = *this >> b; -} - -inline Fix24& Fix24::operator*=(int b) -{ - return *this = *this * b; -} - -inline int operator==(Fix24& f, Fix24& g) -{ - return f.m == g.m; -} - -inline int operator!=(Fix24& f, Fix24& g) -{ - return f.m != g.m; -} - -inline int operator>=(Fix24& f, Fix24& g) -{ - return f.m >= g.m; -} - -inline int operator<=(Fix24& f, Fix24& g) -{ - return f.m <= g.m; -} - -inline int operator>(Fix24& f, Fix24& g) -{ - return f.m > g.m; -} - -inline int operator<(Fix24& f, Fix24& g) -{ - return f.m < g.m; -} - -inline istream& operator>>(istream& s, Fix24& f) -{ - double d; - s >> d; - f = d; - return s; -} - -inline ostream& operator<<(ostream& s, Fix24& f) -{ - return s << double(f); -} - -inline Fix48::~Fix48() {} - -inline Fix48::Fix48(twolongs i) -{ - m = i; -} - -inline Fix48:: operator double() -{ -/* - * Note: can't simply do Fix48_div_u * m.u + Fix48_div_l * m.l, because - * m.u is signed and m.l is unsigned. - */ - return (m.u >= 0)? Fix48_div_u * m.u + Fix48_div_l * m.l : - (Fix48_div_u * ((unsigned long)(m.u & 0xffffff00)) - + Fix48_div_l * m.l) - 2; -} - -inline Fix48::Fix48() -{ - m.u = 0; - m.l = 0; -} - -inline Fix48::Fix48(Fix48& f) -{ - m = f.m; -} - -inline Fix48::Fix48(Fix24& f) -{ - m.u = f.m; - m.l = 0; -} - -inline Fix48::Fix48(double d) -{ - m = assign(d); -} - -inline Fix48& Fix48::operator=(Fix48& f) -{ - m = f.m; - return *this; -} - -inline Fix48& Fix48::operator=(Fix24& f) -{ - m.u = f.m; - m.l = 0; - return *this; -} - -inline Fix48& Fix48::operator=(double d) -{ - m = assign(d); - return *this; -} - -inline twolongs& mantissa(Fix48& f) -{ - return f.m; -} - -inline double value(Fix48& f) -{ - return double(f); -} - -inline Fix48 Fix48::operator+() -{ - return m; -} - -inline Fix48 Fix48::operator-() -{ - twolongs n; - n.l = -m.l; - n.u = ~m.u + ((n.l ^ m.l) & Fix24_msb ? 0 : Fix24_lsb); - return Fix48(n); -} - -inline Fix48 operator*(int b, Fix48& a) -{ - return a * b; -} - -inline Fix48& Fix48::operator+=(Fix48& f) -{ - return *this = *this + f; -} - -inline Fix48& Fix48::operator-=(Fix48& f) -{ - return *this = *this - f; -} - -inline Fix48& Fix48::operator*=(int b) -{ - return *this = *this * b; -} - -inline Fix48& Fix48::operator<<=(int b) -{ - return *this = *this << b; -} - -inline Fix48& Fix48::operator>>=(int b) -{ - return *this = *this >> b; -} - -inline int operator==(Fix48& f, Fix48& g) -{ - return f.m.u == g.m.u && f.m.l == g.m.l; -} - -inline int operator!=(Fix48& f, Fix48& g) -{ - return f.m.u != g.m.u || f.m.l != g.m.l; -} - -inline int operator>=(Fix48& f, Fix48& g) -{ - return f.m.u >= g.m.u || (f.m.u == g.m.u && f.m.l >= g.m.l); -} - -inline int operator<=(Fix48& f, Fix48& g) -{ - return f.m.u <= g.m.u || (f.m.u == g.m.u && f.m.l <= g.m.l); -} - -inline int operator>(Fix48& f, Fix48& g) -{ - return f.m.u > g.m.u || (f.m.u == g.m.u && f.m.l > g.m.l); -} - -inline int operator<(Fix48& f, Fix48& g) -{ - return f.m.u < g.m.u || (f.m.u == g.m.u && f.m.l < g.m.l); -} - -inline istream& operator>>(istream& s, Fix48& f) -{ - double d; - s >> d; - f = d; - return s; -} - -inline ostream& operator<<(ostream& s, Fix48& f) -{ - return s << double(f); -} - - -#endif -#endif - diff --git a/gnu/lib/libg++/g++-include/Fmodes.h b/gnu/lib/libg++/g++-include/Fmodes.h deleted file mode 100644 index 524c2bdc4b5..00000000000 --- a/gnu/lib/libg++/g++-include/Fmodes.h +++ /dev/null @@ -1,34 +0,0 @@ - -#ifndef _Fmodes_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _Fmodes_h 1 - -enum io_mode // known unix file IO modes -{ - io_readonly = 0, - io_writeonly = 1, - io_readwrite = 2, - io_appendonly = 3, - io_append = 4, // append, plus allow reads -}; - -enum access_mode // ways to open a file -{ - a_createonly = 0, // create, fail if file exists - a_create = 1, // create if doesn't exist, else truncate - a_useonly = 2, // use (no truncate) fail if doesn't exist - a_use = 3, // use (no truncate), create if doesn't exist -}; - -enum state_value // File states -{ - _good = 0, // all is well - _eof = 1, // at eof - _fail = 2, // logical or physical IO error - _bad = 4 // unopened/corrupted -}; - -#endif diff --git a/gnu/lib/libg++/g++-include/Geom.h b/gnu/lib/libg++/g++-include/Geom.h deleted file mode 100644 index d70b96a668f..00000000000 --- a/gnu/lib/libg++/g++-include/Geom.h +++ /dev/null @@ -1,59 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Dirk Grunwald (grunwald@cs.uiuc.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ -#ifndef _Geometric_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _Geometric_h - -#include <Random.h> - -class Geometric: public Random { -protected: - double pMean; -public: - Geometric(double mean, RNG *gen); - - double mean(); - double mean(double x); - - virtual double operator()(); - -}; - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - -inline Geometric::Geometric(double mean, RNG *gen) : (gen) -{ - pMean = mean; -} - - -inline double Geometric::mean() { return pMean; } -inline double Geometric::mean(double x) { - double tmp = pMean; pMean = x; return tmp; -} - -#endif -#endif diff --git a/gnu/lib/libg++/g++-include/GetOpt.h b/gnu/lib/libg++/g++-include/GetOpt.h deleted file mode 100644 index 413c52d64c1..00000000000 --- a/gnu/lib/libg++/g++-include/GetOpt.h +++ /dev/null @@ -1,131 +0,0 @@ -/* Getopt for GNU. - Copyright (C) 1987, 1989 Free Software Foundation, Inc. - (Modified by Douglas C. Schmidt for use with GNU G++.) - - This program 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 1, or (at your option) - any later version. - - This program 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 program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - - - -/* This version of `getopt' appears to the caller like standard Unix `getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. - - As `getopt' works, it permutes the elements of `argv' so that, - when it is done, all the options precede everything else. Thus - all application programs are extended to handle flexible argument order. - - Setting the environment variable _POSIX_OPTION_ORDER disables permutation. - Then the behavior is completely standard. - - GNU application programs can use a third alternative mode in which - they can distinguish the relative order of options and other arguments. */ - -#ifndef GetOpt_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define GetOpt_h 1 - -#include <std.h> -#include <stdio.h> - -class GetOpt -{ -private: - /* The next char to be scanned in the option-element - in which the last option character we returned was found. - This allows us to pick up the scan where we left off. - - If this is zero, or a null string, it means resume the scan - by advancing to the next ARGV-element. */ - - static char *nextchar; - - - /* Describe how to deal with options that follow non-option ARGV-elements. - - UNSPECIFIED means the caller did not specify anything; - the default is then REQUIRE_ORDER if the environment variable - _OPTIONS_FIRST is defined, PERMUTE otherwise. - - REQUIRE_ORDER means don't recognize them as options. - Stop option processing when the first non-option is seen. - This is what Unix does. - - PERMUTE is the default. We permute the contents of `argv' as we scan, - so that eventually all the options are at the end. This allows options - to be given in any order, even with programs that were not written to - expect this. - - RETURN_IN_ORDER is an option available to programs that were written - to expect options and other ARGV-elements in any order and that care about - the ordering of the two. We describe each non-option ARGV-element - as if it were the argument of an option with character code zero. - Using `-' as the first character of the list of option characters - requests this mode of operation. - - The special argument `--' forces an end of option-scanning regardless - of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `getopt' to return EOF with `optind' != ARGC. */ - - static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; - - /* Handle permutation of arguments. */ - - /* Describe the part of ARGV that contains non-options that have - been skipped. `first_nonopt' is the index in ARGV of the first of them; - `last_nonopt' is the index after the last of them. */ - - static int first_nonopt; - static int last_nonopt; - - void exchange (char **argv); -public: - /* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - - char *optarg; - - /* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns EOF, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - - int optind; - - /* Callers store zero here to inhibit the error message - for unrecognized options. */ - - int opterr; - - int nargc; - char **nargv; - char *noptstring; - - GetOpt (int argc, char **argv, char *optstring); - int operator () (void); -}; - -#endif diff --git a/gnu/lib/libg++/g++-include/HypGeom.h b/gnu/lib/libg++/g++-include/HypGeom.h deleted file mode 100644 index b120f104e9f..00000000000 --- a/gnu/lib/libg++/g++-include/HypGeom.h +++ /dev/null @@ -1,78 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Dirk Grunwald (grunwald@cs.uiuc.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ -#ifndef _HyperGeometric_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _HyperGeometric_h - -#include <Random.h> - -class HyperGeometric: public Random { -protected: - double pMean; - double pVariance; - double pP; - void setState(); - -public: - HyperGeometric(double mean, double variance, RNG *gen); - - double mean(); - double mean(double x); - double variance(); - double variance(double x); - - virtual double operator()(); -}; - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - -inline void HyperGeometric::setState() { - double z = pVariance / (pMean * pMean); - pP = 0.5 * (1.0 - sqrt((z - 1.0) / ( z + 1.0 ))); -} - -inline HyperGeometric::HyperGeometric(double mean, double variance, RNG *gen) -: (gen) { - pMean = mean; pVariance = variance; - setState(); -} - -inline double HyperGeometric::mean() { return pMean; }; - -inline double HyperGeometric::mean(double x) { - double t = pMean; pMean = x; - setState(); return t; -} - -inline double HyperGeometric::variance() { return pVariance; } - -inline double HyperGeometric::variance(double x) { - double t = pVariance; pVariance = x; - setState(); return t; -} - -#endif -#endif diff --git a/gnu/lib/libg++/g++-include/Incremental.h b/gnu/lib/libg++/g++-include/Incremental.h deleted file mode 100644 index 9b6bb3f8947..00000000000 --- a/gnu/lib/libg++/g++-include/Incremental.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef Incremental_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define Incremental_h -#define DECLARE_INIT_FUNCTION(USER_INIT_FUNCTION) \ -static void USER_INIT_FUNCTION (); extern void (*_initfn)(); \ -static struct xyzzy { xyzzy () {_initfn = USER_INIT_FUNCTION;}; \ -~xyzzy () {};} __2xyzzy; -#else -#error Incremental.h was not the first file included in this module -#endif diff --git a/gnu/lib/libg++/g++-include/Integer.h b/gnu/lib/libg++/g++-include/Integer.h deleted file mode 100644 index a241e65a29e..00000000000 --- a/gnu/lib/libg++/g++-include/Integer.h +++ /dev/null @@ -1,1114 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- - -/* -Copyright (C) 1988 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -#ifndef _Integer_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _Integer_h 1 - -#include <stream.h> - -struct IntRep // internal Integer representations -{ - unsigned short len; // current length - unsigned short sz; // allocated space - short sgn; // 1 means >= 0; 0 means < 0 - unsigned short s[1]; // represented as ushort array starting here -}; - -extern IntRep* Ialloc(IntRep*, const unsigned short *, int, int, int); -extern IntRep* Icalloc(IntRep*, int); -extern IntRep* Icopy_long(IntRep*, long); -extern IntRep* Icopy(IntRep*, const IntRep*); -extern IntRep* Iresize(IntRep*, int); -extern IntRep* add(const IntRep*, int, const IntRep*, int, IntRep*); -extern IntRep* add(const IntRep*, int, long, IntRep*); -extern IntRep* multiply(const IntRep*, const IntRep*, IntRep*); -extern IntRep* multiply(const IntRep*, long, IntRep*); -extern IntRep* lshift(const IntRep*, long, IntRep*); -extern IntRep* lshift(const IntRep*, const IntRep*, int, IntRep*); -extern IntRep* bitop(const IntRep*, const IntRep*, IntRep*, char); -extern IntRep* bitop(const IntRep*, long, IntRep*, char); -extern IntRep* power(const IntRep*, long, IntRep*); -extern IntRep* div(const IntRep*, const IntRep*, IntRep*); -extern IntRep* mod(const IntRep*, const IntRep*, IntRep*); -extern IntRep* div(const IntRep*, long, IntRep*); -extern IntRep* mod(const IntRep*, long, IntRep*); -extern IntRep* compl(const IntRep*, IntRep*); -extern IntRep* abs(const IntRep*, IntRep*); -extern IntRep* negate(const IntRep*, IntRep*); -extern IntRep* pow(const IntRep*, long); -extern IntRep* gcd(const IntRep*, const IntRep* y); -extern int compare(const IntRep*, const IntRep*); -extern int compare(const IntRep*, long); -extern int ucompare(const IntRep*, const IntRep*); -extern int ucompare(const IntRep*, long); -extern char* Itoa(const IntRep* x, int base = 10, int width = 0); -extern IntRep* atoIntRep(const char* s, int base = 10); -extern long Itolong(const IntRep*); -extern double Itodouble(const IntRep*); -extern int Iislong(const IntRep*); -extern int Iisdouble(const IntRep*); -extern long lg(const IntRep*); - - -class Integer -{ -protected: - IntRep* rep; -public: - Integer(); - Integer(long); - Integer(const Integer&); - - ~Integer(); - - void operator = (const Integer&); - void operator = (long); - -// unary operations to self - - void operator ++ (); - void operator -- (); - void negate(); // negate in-place - void abs(); // absolute-value in-place - void complement(); // bitwise complement in-place - -// assignment-based operations - - void operator += (const Integer&); - void operator -= (const Integer&); - void operator *= (const Integer&); - void operator /= (const Integer&); - void operator %= (const Integer&); - void operator <<=(const Integer&); - void operator >>=(const Integer&); - void operator &= (const Integer&); - void operator |= (const Integer&); - void operator ^= (const Integer&); - - void operator += (long); - void operator -= (long); - void operator *= (long); - void operator /= (long); - void operator %= (long); - void operator <<=(long); - void operator >>=(long); - void operator &= (long); - void operator |= (long); - void operator ^= (long); - -// (constructive binary operations are inlined below) - -#ifdef __GNUG__ - friend Integer operator <? (const Integer& x, const Integer& y); // min - friend Integer operator >? (const Integer& x, const Integer& y); // max -#endif - -// builtin Integer functions that must be friends - - friend long lg (const Integer&); // floor log base 2 of abs(x) - friend double ratio(const Integer& x, const Integer& y); - // return x/y as a double - - friend Integer gcd(const Integer&, const Integer&); - friend int even(const Integer&); // true if even - friend int odd(const Integer&); // true if odd - friend int sign(const Integer&); // returns -1, 0, +1 - - friend void setbit(Integer& x, long b); // set b'th bit of x - friend void clearbit(Integer& x, long b); // clear b'th bit - friend int testbit(const Integer& x, long b); // return b'th bit - -// procedural versions of operators - - friend void abs(const Integer& x, Integer& dest); - friend void negate(const Integer& x, Integer& dest); - friend void complement(const Integer& x, Integer& dest); - - friend int compare(const Integer&, const Integer&); - friend int ucompare(const Integer&, const Integer&); - friend void add(const Integer& x, const Integer& y, Integer& dest); - friend void sub(const Integer& x, const Integer& y, Integer& dest); - friend void mul(const Integer& x, const Integer& y, Integer& dest); - friend void div(const Integer& x, const Integer& y, Integer& dest); - friend void mod(const Integer& x, const Integer& y, Integer& dest); - friend void divide(const Integer& x, const Integer& y, - Integer& q, Integer& r); - friend void and(const Integer& x, const Integer& y, Integer& dest); - friend void or(const Integer& x, const Integer& y, Integer& dest); - friend void xor(const Integer& x, const Integer& y, Integer& dest); - friend void lshift(const Integer& x, const Integer& y, Integer& dest); - friend void rshift(const Integer& x, const Integer& y, Integer& dest); - friend void pow(const Integer& x, const Integer& y, Integer& dest); - - friend int compare(const Integer&, long); - friend int ucompare(const Integer&, long); - friend void add(const Integer& x, long y, Integer& dest); - friend void sub(const Integer& x, long y, Integer& dest); - friend void mul(const Integer& x, long y, Integer& dest); - friend void div(const Integer& x, long y, Integer& dest); - friend void mod(const Integer& x, long y, Integer& dest); - friend void divide(const Integer& x, long y, Integer& q, long& r); - friend void and(const Integer& x, long y, Integer& dest); - friend void or(const Integer& x, long y, Integer& dest); - friend void xor(const Integer& x, long y, Integer& dest); - friend void lshift(const Integer& x, long y, Integer& dest); - friend void rshift(const Integer& x, long y, Integer& dest); - friend void pow(const Integer& x, long y, Integer& dest); - - friend int compare(long, const Integer&); - friend int ucompare(long, const Integer&); - friend void add(long x, const Integer& y, Integer& dest); - friend void sub(long x, const Integer& y, Integer& dest); - friend void mul(long x, const Integer& y, Integer& dest); - friend void and(long x, const Integer& y, Integer& dest); - friend void or(long x, const Integer& y, Integer& dest); - friend void xor(long x, const Integer& y, Integer& dest); - -// coercion & conversion - - int fits_in_long() const; - int fits_in_double() const; - - operator long() const; - operator double() const; - - friend char* Itoa(const Integer& x, int base = 10, int width = 0); - friend Integer atoI(const char* s, int base = 10); - - friend istream& operator >> (istream& s, Integer& y); - friend ostream& operator << (ostream& s, const Integer& y); - -// error detection - - int initialized() const; - volatile void error(const char* msg) const; - int OK() const; -}; - - -// (These are declared inline) - - int operator == (const Integer&, const Integer&); - int operator == (const Integer&, long); - int operator != (const Integer&, const Integer&); - int operator != (const Integer&, long); - int operator < (const Integer&, const Integer&); - int operator < (const Integer&, long); - int operator <= (const Integer&, const Integer&); - int operator <= (const Integer&, long); - int operator > (const Integer&, const Integer&); - int operator > (const Integer&, long); - int operator >= (const Integer&, const Integer&); - int operator >= (const Integer&, long); - Integer operator - (const Integer&); - Integer operator ~ (const Integer&); - Integer operator + (const Integer&, const Integer&); - Integer operator + (const Integer&, long); - Integer operator + (long, const Integer&); - Integer operator - (const Integer&, const Integer&); - Integer operator - (const Integer&, long); - Integer operator - (long, const Integer&); - Integer operator * (const Integer&, const Integer&); - Integer operator * (const Integer&, long); - Integer operator * (long, const Integer&); - Integer operator / (const Integer&, const Integer&); - Integer operator / (const Integer&, long); - Integer operator % (const Integer&, const Integer&); - Integer operator % (const Integer&, long); - Integer operator << (const Integer&, const Integer&); - Integer operator << (const Integer&, long); - Integer operator >> (const Integer&, const Integer&); - Integer operator >> (const Integer&, long); - Integer operator & (const Integer&, const Integer&); - Integer operator & (const Integer&, long); - Integer operator & (long, const Integer&); - Integer operator | (const Integer&, const Integer&); - Integer operator | (const Integer&, long); - Integer operator | (long, const Integer&); - Integer operator ^ (const Integer&, const Integer&); - Integer operator ^ (const Integer&, long); - Integer operator ^ (long, const Integer&); - - Integer abs(const Integer&); // absolute value - Integer sqr(const Integer&); // square - - Integer pow(const Integer& x, const Integer& y); - Integer pow(const Integer& x, long y); - Integer Ipow(long x, long y); // x to the y as Integer - - -extern char* dec(const Integer& x, int width = 0); -extern char* oct(const Integer& x, int width = 0); -extern char* hex(const Integer& x, int width = 0); -extern Integer sqrt(const Integer&); // floor of square root -extern Integer lcm(const Integer& x, const Integer& y); // least common mult - - -typedef Integer IntTmp; // for backward compatibility - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - - -inline Integer::Integer() :rep(0) {} - -inline Integer::Integer(long y) :rep(Icopy_long(0, y)) {} - -inline Integer::Integer(const Integer& y) :rep(Icopy(0, y.rep)) {} - -inline Integer::~Integer() { delete rep; } - -inline void Integer::operator = (const Integer& y) -{ - rep = Icopy(rep, y.rep); -} - -inline void Integer::operator = (long y) -{ - rep = Icopy_long(rep, y); -} - -inline Integer::operator long() const -{ - return Itolong(rep); -} - -inline int Integer::initialized() const -{ - return rep != 0; -} - -inline int Integer::fits_in_long() const -{ - return Iislong(rep); -} - -inline Integer::operator double() const -{ - return Itodouble(rep); -} - -inline int Integer::fits_in_double() const -{ - return Iisdouble(rep); -} - -// procedural versions - -inline int compare(const Integer& x, const Integer& y) -{ - return compare(x.rep, y.rep); -} - -inline int ucompare(const Integer& x, const Integer& y) -{ - return ucompare(x.rep, y.rep); -} - -inline int compare(const Integer& x, long y) -{ - return compare(x.rep, y); -} - -inline int ucompare(const Integer& x, long y) -{ - return ucompare(x.rep, y); -} - -inline int compare(long x, const Integer& y) -{ - return -compare(y.rep, x); -} - -inline int ucompare(long x, const Integer& y) -{ - return -ucompare(y.rep, x); -} - -inline void add(const Integer& x, const Integer& y, Integer& dest) -{ - dest.rep = add(x.rep, 0, y.rep, 0, dest.rep); -} - -inline void sub(const Integer& x, const Integer& y, Integer& dest) -{ - dest.rep = add(x.rep, 0, y.rep, 1, dest.rep); -} - -inline void mul(const Integer& x, const Integer& y, Integer& dest) -{ - dest.rep = multiply(x.rep, y.rep, dest.rep); -} - -inline void div(const Integer& x, const Integer& y, Integer& dest) -{ - dest.rep = div(x.rep, y.rep, dest.rep); -} - -inline void mod(const Integer& x, const Integer& y, Integer& dest) -{ - dest.rep = mod(x.rep, y.rep, dest.rep); -} - -inline void and(const Integer& x, const Integer& y, Integer& dest) -{ - dest.rep = bitop(x.rep, y.rep, dest.rep, '&'); -} - -inline void or(const Integer& x, const Integer& y, Integer& dest) -{ - dest.rep = bitop(x.rep, y.rep, dest.rep, '|'); -} - -inline void xor(const Integer& x, const Integer& y, Integer& dest) -{ - dest.rep = bitop(x.rep, y.rep, dest.rep, '^'); -} - -inline void lshift(const Integer& x, const Integer& y, Integer& dest) -{ - dest.rep = lshift(x.rep, y.rep, 0, dest.rep); -} - -inline void rshift(const Integer& x, const Integer& y, Integer& dest) -{ - dest.rep = lshift(x.rep, y.rep, 1, dest.rep); -} - -inline void pow(const Integer& x, const Integer& y, Integer& dest) -{ - dest.rep = power(x.rep, long(y), dest.rep); // not incorrect -} - -inline void add(const Integer& x, long y, Integer& dest) -{ - dest.rep = add(x.rep, 0, y, dest.rep); -} - -inline void sub(const Integer& x, long y, Integer& dest) -{ - dest.rep = add(x.rep, 0, -y, dest.rep); -} - -inline void mul(const Integer& x, long y, Integer& dest) -{ - dest.rep = multiply(x.rep, y, dest.rep); -} - -inline void div(const Integer& x, long y, Integer& dest) -{ - dest.rep = div(x.rep, y, dest.rep); -} - -inline void mod(const Integer& x, long y, Integer& dest) -{ - dest.rep = mod(x.rep, y, dest.rep); -} - -inline void and(const Integer& x, long y, Integer& dest) -{ - dest.rep = bitop(x.rep, y, dest.rep, '&'); -} - -inline void or(const Integer& x, long y, Integer& dest) -{ - dest.rep = bitop(x.rep, y, dest.rep, '|'); -} - -inline void xor(const Integer& x, long y, Integer& dest) -{ - dest.rep = bitop(x.rep, y, dest.rep, '^'); -} - -inline void lshift(const Integer& x, long y, Integer& dest) -{ - dest.rep = lshift(x.rep, y, dest.rep); -} - -inline void rshift(const Integer& x, long y, Integer& dest) -{ - dest.rep = lshift(x.rep, -y, dest.rep); -} - -inline void pow(const Integer& x, long y, Integer& dest) -{ - dest.rep = power(x.rep, y, dest.rep); -} - -inline void abs(const Integer& x, Integer& dest) -{ - dest.rep = abs(x.rep, dest.rep); -} - -inline void negate(const Integer& x, Integer& dest) -{ - dest.rep = negate(x.rep, dest.rep); -} - -inline void complement(const Integer& x, Integer& dest) -{ - dest.rep = compl(x.rep, dest.rep); -} - -inline void add(long x, const Integer& y, Integer& dest) -{ - dest.rep = add(y.rep, 0, x, dest.rep); -} - -inline void sub(long x, const Integer& y, Integer& dest) -{ - dest.rep = add(y.rep, 1, x, dest.rep); -} - -inline void mul(long x, const Integer& y, Integer& dest) -{ - dest.rep = multiply(y.rep, x, dest.rep); -} - -inline void and(long x, const Integer& y, Integer& dest) -{ - dest.rep = bitop(y.rep, x, dest.rep, '&'); -} - -inline void or(long x, const Integer& y, Integer& dest) -{ - dest.rep = bitop(y.rep, x, dest.rep, '|'); -} - -inline void xor(long x, const Integer& y, Integer& dest) -{ - dest.rep = bitop(y.rep, x, dest.rep, '^'); -} - - -// operator versions - -inline int operator == (const Integer& x, const Integer& y) -{ - return compare(x, y) == 0; -} - -inline int operator == (const Integer& x, long y) -{ - return compare(x, y) == 0; -} - -inline int operator != (const Integer& x, const Integer& y) -{ - return compare(x, y) != 0; -} - -inline int operator != (const Integer& x, long y) -{ - return compare(x, y) != 0; -} - -inline int operator < (const Integer& x, const Integer& y) -{ - return compare(x, y) < 0; -} - -inline int operator < (const Integer& x, long y) -{ - return compare(x, y) < 0; -} - -inline int operator <= (const Integer& x, const Integer& y) -{ - return compare(x, y) <= 0; -} - -inline int operator <= (const Integer& x, long y) -{ - return compare(x, y) <= 0; -} - -inline int operator > (const Integer& x, const Integer& y) -{ - return compare(x, y) > 0; -} - -inline int operator > (const Integer& x, long y) -{ - return compare(x, y) > 0; -} - -inline int operator >= (const Integer& x, const Integer& y) -{ - return compare(x, y) >= 0; -} - -inline int operator >= (const Integer& x, long y) -{ - return compare(x, y) >= 0; -} - - -inline void Integer::operator += (const Integer& y) -{ - add(*this, y, *this); -} - -inline void Integer::operator += (long y) -{ - add(*this, y, *this); -} - -inline void Integer::operator ++ () -{ - add(*this, 1, *this); -} - - -inline void Integer::operator -= (const Integer& y) -{ - sub(*this, y, *this); -} - -inline void Integer::operator -= (long y) -{ - sub(*this, y, *this); -} - -inline void Integer::operator -- () -{ - add(*this, -1, *this); -} - - - -inline void Integer::operator *= (const Integer& y) -{ - mul(*this, y, *this); -} - -inline void Integer::operator *= (long y) -{ - mul(*this, y, *this); -} - - -inline void Integer::operator &= (const Integer& y) -{ - and(*this, y, *this); -} - -inline void Integer::operator &= (long y) -{ - and(*this, y, *this); -} - -inline void Integer::operator |= (const Integer& y) -{ - or(*this, y, *this); -} - -inline void Integer::operator |= (long y) -{ - or(*this, y, *this); -} - - -inline void Integer::operator ^= (const Integer& y) -{ - xor(*this, y, *this); -} - -inline void Integer::operator ^= (long y) -{ - xor(*this, y, *this); -} - - - -inline void Integer::operator /= (const Integer& y) -{ - div(*this, y, *this); -} - -inline void Integer::operator /= (long y) -{ - div(*this, y, *this); -} - - -inline void Integer::operator %= (const Integer& y) -{ - mod(*this, y, *this); -} - -inline void Integer::operator %= (long y) -{ - mod(*this, y, *this); -} - - -inline void Integer::operator <<= (const Integer& y) -{ - lshift(*this, y, *this); -} - -inline void Integer::operator <<= (long y) -{ - lshift(*this, y, *this); -} - - -inline void Integer::operator >>= (const Integer& y) -{ - rshift(*this, y, *this); -} - -inline void Integer::operator >>= (long y) -{ - rshift(*this, y, *this); -} - -#ifdef __GNUG__ -inline Integer operator <? (const Integer& x, const Integer& y) -{ - return (compare(x.rep, y.rep) <= 0) ? x : y; -} - -inline Integer operator >? (const Integer& x, const Integer& y) -{ - return (compare(x.rep, y.rep) >= 0)? x : y; -} -#endif - - -inline void Integer::abs() -{ - ::abs(*this, *this); -} - -inline void Integer::negate() -{ - ::negate(*this, *this); -} - - -inline void Integer::complement() -{ - ::complement(*this, *this); -} - - -inline int sign(const Integer& x) -{ - return (x.rep->len == 0) ? 0 : ( (x.rep->sgn == 1) ? 1 : -1 ); -} - -inline int even(const Integer& y) -{ - return y.rep->len == 0 || !(y.rep->s[0] & 1); -} - -inline int odd(const Integer& y) -{ - return y.rep->len > 0 && (y.rep->s[0] & 1); -} - -inline char* Itoa(const Integer& y, int base, int width) -{ - return Itoa(y.rep, base, width); -} - - -inline ostream& operator << (ostream& s, const Integer& y) -{ - return s << Itoa(y.rep); -} - -inline long lg(const Integer& x) -{ - return lg(x.rep); -} - -// constructive operations - -#if defined(__GNUG__) && !defined(NO_NRV) - -inline Integer operator + (const Integer& x, const Integer& y) return r -{ - add(x, y, r); -} - -inline Integer operator + (const Integer& x, long y) return r -{ - add(x, y, r); -} - -inline Integer operator + (long x, const Integer& y) return r -{ - add(x, y, r); -} - -inline Integer operator - (const Integer& x, const Integer& y) return r -{ - sub(x, y, r); -} - -inline Integer operator - (const Integer& x, long y) return r -{ - sub(x, y, r); -} - -inline Integer operator - (long x, const Integer& y) return r -{ - sub(x, y, r); -} - -inline Integer operator * (const Integer& x, const Integer& y) return r -{ - mul(x, y, r); -} - -inline Integer operator * (const Integer& x, long y) return r -{ - mul(x, y, r); -} - -inline Integer operator * (long x, const Integer& y) return r -{ - mul(x, y, r); -} - -inline Integer sqr(const Integer& x) return r -{ - mul(x, x, r); -} - -inline Integer operator & (const Integer& x, const Integer& y) return r -{ - and(x, y, r); -} - -inline Integer operator & (const Integer& x, long y) return r -{ - and(x, y, r); -} - -inline Integer operator & (long x, const Integer& y) return r -{ - and(x, y, r); -} - -inline Integer operator | (const Integer& x, const Integer& y) return r -{ - or(x, y, r); -} - -inline Integer operator | (const Integer& x, long y) return r -{ - or(x, y, r); -} - -inline Integer operator | (long x, const Integer& y) return r -{ - or(x, y, r); -} - -inline Integer operator ^ (const Integer& x, const Integer& y) return r -{ - xor(x, y, r); -} - -inline Integer operator ^ (const Integer& x, long y) return r -{ - xor(x, y, r); -} - -inline Integer operator ^ (long x, const Integer& y) return r -{ - xor(x, y, r); -} - -inline Integer operator / (const Integer& x, const Integer& y) return r -{ - div(x, y, r); -} - -inline Integer operator / (const Integer& x, long y) return r -{ - div(x, y, r); -} - -inline Integer operator % (const Integer& x, const Integer& y) return r -{ - mod(x, y, r); -} - -inline Integer operator % (const Integer& x, long y) return r -{ - mod(x, y, r); -} - -inline Integer operator << (const Integer& x, const Integer& y) return r -{ - lshift(x, y, r); -} - -inline Integer operator << (const Integer& x, long y) return r -{ - lshift(x, y, r); -} - -inline Integer operator >> (const Integer& x, const Integer& y) return r; -{ - rshift(x, y, r); -} - -inline Integer operator >> (const Integer& x, long y) return r -{ - rshift(x, y, r); -} - -inline Integer pow(const Integer& x, long y) return r -{ - pow(x, y, r); -} - -inline Integer Ipow(long x, long y) return r(x) -{ - pow(r, y, r); -} - -inline Integer pow(const Integer& x, const Integer& y) return r -{ - pow(x, y, r); -} - - - -inline Integer abs(const Integer& x) return r -{ - abs(x, r); -} - -inline Integer operator - (const Integer& x) return r -{ - negate(x, r); -} - -inline Integer operator ~ (const Integer& x) return r -{ - complement(x, r); -} - -inline Integer atoI(const char* s, int base) return r -{ - r.rep = atoIntRep(s, base); -} - -inline Integer gcd(const Integer& x, const Integer& y) return r -{ - r.rep = gcd(x.rep, y.rep); -} - -#else /* NO_NRV */ - -inline Integer operator + (const Integer& x, const Integer& y) -{ - Integer r; add(x, y, r); return r; -} - -inline Integer operator + (const Integer& x, long y) -{ - Integer r; add(x, y, r); return r; -} - -inline Integer operator + (long x, const Integer& y) -{ - Integer r; add(x, y, r); return r; -} - -inline Integer operator - (const Integer& x, const Integer& y) -{ - Integer r; sub(x, y, r); return r; -} - -inline Integer operator - (const Integer& x, long y) -{ - Integer r; sub(x, y, r); return r; -} - -inline Integer operator - (long x, const Integer& y) -{ - Integer r; sub(x, y, r); return r; -} - -inline Integer operator * (const Integer& x, const Integer& y) -{ - Integer r; mul(x, y, r); return r; -} - -inline Integer operator * (const Integer& x, long y) -{ - Integer r; mul(x, y, r); return r; -} - -inline Integer operator * (long x, const Integer& y) -{ - Integer r; mul(x, y, r); return r; -} - -inline Integer sqr(const Integer& x) -{ - Integer r; mul(x, x, r); return r; -} - -inline Integer operator & (const Integer& x, const Integer& y) -{ - Integer r; and(x, y, r); return r; -} - -inline Integer operator & (const Integer& x, long y) -{ - Integer r; and(x, y, r); return r; -} - -inline Integer operator & (long x, const Integer& y) -{ - Integer r; and(x, y, r); return r; -} - -inline Integer operator | (const Integer& x, const Integer& y) -{ - Integer r; or(x, y, r); return r; -} - -inline Integer operator | (const Integer& x, long y) -{ - Integer r; or(x, y, r); return r; -} - -inline Integer operator | (long x, const Integer& y) -{ - Integer r; or(x, y, r); return r; -} - -inline Integer operator ^ (const Integer& x, const Integer& y) -{ - Integer r; xor(x, y, r); return r; -} - -inline Integer operator ^ (const Integer& x, long y) -{ - Integer r; xor(x, y, r); return r; -} - -inline Integer operator ^ (long x, const Integer& y) -{ - Integer r; xor(x, y, r); return r; -} - -inline Integer operator / (const Integer& x, const Integer& y) -{ - Integer r; div(x, y, r); return r; -} - -inline Integer operator / (const Integer& x, long y) -{ - Integer r; div(x, y, r); return r; -} - -inline Integer operator % (const Integer& x, const Integer& y) -{ - Integer r; mod(x, y, r); return r; -} - -inline Integer operator % (const Integer& x, long y) -{ - Integer r; mod(x, y, r); return r; -} - -inline Integer operator << (const Integer& x, const Integer& y) -{ - Integer r; lshift(x, y, r); return r; -} - -inline Integer operator << (const Integer& x, long y) -{ - Integer r; lshift(x, y, r); return r; -} - -inline Integer operator >> (const Integer& x, const Integer& y) -{ - Integer r; rshift(x, y, r); return r; -} - -inline Integer operator >> (const Integer& x, long y) -{ - Integer r; rshift(x, y, r); return r; -} - -inline Integer pow(const Integer& x, long y) -{ - Integer r; pow(x, y, r); return r; -} - -inline Integer Ipow(long x, long y) -{ - Integer r(x); pow(r, y, r); return r; -} - -inline Integer pow(const Integer& x, const Integer& y) -{ - Integer r; pow(x, y, r); return r; -} - - - -inline Integer abs(const Integer& x) -{ - Integer r; abs(x, r); return r; -} - -inline Integer operator - (const Integer& x) -{ - Integer r; negate(x, r); return r; -} - -inline Integer operator ~ (const Integer& x) -{ - Integer r; complement(x, r); return r; -} - -inline Integer atoI(const char* s, int base) -{ - Integer r; r.rep = atoIntRep(s, base); return r; -} - -inline Integer gcd(const Integer& x, const Integer& y) -{ - Integer r; r.rep = gcd(x.rep, y.rep); return r; -} - -#endif -#endif -#endif diff --git a/gnu/lib/libg++/g++-include/LogNorm.h b/gnu/lib/libg++/g++-include/LogNorm.h deleted file mode 100644 index 6c7c74cdef1..00000000000 --- a/gnu/lib/libg++/g++-include/LogNorm.h +++ /dev/null @@ -1,84 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Dirk Grunwald (grunwald@cs.uiuc.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ -#ifndef _LogNormal_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _LogNormal_h - -#include "Normal.h" - -class LogNormal: public Normal { -protected: - double logMean; - double logVariance; - void setState(); -public: - LogNormal(double mean, double variance, RNG *gen); - double mean(); - double mean(double x); - double variance(); - double variance(double x); - virtual double operator()(); -}; - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - -inline void LogNormal::setState() -{ - double m2 = logMean * logMean; - pMean = log(m2 / sqrt(logVariance + m2) ); - pVariance = log((sqrt(logVariance + m2)/m2 )); -} - -inline LogNormal::LogNormal(double mean, double variance, RNG *gen) - : (mean, variance, gen) -{ - logMean = mean; - logVariance = variance; - setState(); -} - -inline double LogNormal::mean() { - return logMean; -} - -inline double LogNormal::mean(double x) -{ - double t=logMean; logMean = x; setState(); - return t; -} - -inline double LogNormal::variance() { - return logVariance; -} - -inline double LogNormal::variance(double x) -{ - double t=logVariance; logVariance = x; setState(); - return t; -} - -#endif -#endif diff --git a/gnu/lib/libg++/g++-include/MLCG.h b/gnu/lib/libg++/g++-include/MLCG.h deleted file mode 100644 index 73791f055ce..00000000000 --- a/gnu/lib/libg++/g++-include/MLCG.h +++ /dev/null @@ -1,97 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Dirk Grunwald (grunwald@cs.uiuc.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ -#ifndef _MLCG_h -#define _MLCG_h 1 -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif - -#include <RNG.h> -#include <math.h> - -// -// Multiplicative Linear Conguential Generator -// - -class MLCG : public RNG { - long initialSeedOne; - long initialSeedTwo; - long seedOne; - long seedTwo; - -protected: - -public: - MLCG(long seed1 = 0, long seed2 = 1); - // - // Return a long-words word of random bits - // - virtual unsigned long asLong(); - virtual void reset(); - long seed1(); - void seed1(long); - long seed2(); - void seed2(long); - void reseed(long, long); -}; - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - -inline long -MLCG::seed1() -{ - return(seedOne); -} - -inline void -MLCG::seed1(long s) -{ - initialSeedOne = s; - reset(); -} - -inline long -MLCG::seed2() -{ - return(seedTwo); -} - -inline void -MLCG::seed2(long s) -{ - initialSeedTwo = s; - reset(); -} - -inline void -MLCG::reseed(long s1, long s2) -{ - initialSeedOne = s1; - initialSeedTwo = s2; - reset(); -} - -#endif - -#endif diff --git a/gnu/lib/libg++/g++-include/Makefile b/gnu/lib/libg++/g++-include/Makefile deleted file mode 100644 index cf914535d3a..00000000000 --- a/gnu/lib/libg++/g++-include/Makefile +++ /dev/null @@ -1,58 +0,0 @@ -# %W% (Berkeley) %G% -# -# Cloned from /usr/src/include/Makefile -# Doing a make install builds /usr/include/g++ -# - -all clean cleandir depend lint tags: - -FILES= ACG.h AllocRing.h Binomial.h BitSet.h BitString.h \ - Complex.h CursesW.h DiscUnif.h Erlang.h File.h \ - Filebuf.h Fix.h Fix16.h Fix24.h Fmodes.h Geom.h \ - GetOpt.h HypGeom.h Incremental.h Integer.h LogNorm.h \ - MLCG.h NegExp.h Normal.h Obstack.h Pix.h PlotFile.h \ - Poisson.h RNG.h Random.h Rational.h Regex.h RndInt.h \ - SFile.h SmplHist.h SmplStat.h String.h Uniform.h \ - Weibull.h abs.h assert.h bool.h builtin.h compare.h \ - complex.h curses.h file.h filebuf.h generic.h \ - istream.h malloc.h max.h min.h minmax.h new.h open.h \ - osfcn.h ostream.h regex.h std.h strclass.h stream.h \ - streambuf.h swap.h values.h - -DIRS= gen - -NOOBJ= noobj - -INCDIR= /usr/include/g++ - -install: - @if [ ! -d ${DESTDIR}${INCDIR} ]; then \ - /bin/rm -f ${DESTDIR}${INCDIR} ; \ - mkdir -p ${DESTDIR}${INCDIR} ; \ - chown root.wheel ${DESTDIR}${INCDIR} ; \ - chmod 755 ${DESTDIR}${INCDIR} ; \ - else \ - true ; \ - fi - @echo installing ${FILES} - @-for i in ${FILES}; do \ - cmp -s $$i ${DESTDIR}${INCDIR}/$$i || \ - install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$i \ - ${DESTDIR}${INCDIR}/$$i; \ - done - @echo installing ${DIRS} - @-for i in ${DIRS}; do \ - if [ ! -d ${DESTDIR}${INCDIR}/$$i ]; \ - then \ - mkdir ${DESTDIR}${INCDIR}/$$i; \ - fi; \ - chown ${BINOWN}.${BINGRP} ${DESTDIR}${INCDIR}/$$i; \ - chmod 755 ${DESTDIR}${INCDIR}/$$i; \ - (cd $$i; for j in *.*P; do \ - cmp -s $$j ${DESTDIR}${INCDIR}/$$i/$$j || \ - install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \ - ${DESTDIR}${INCDIR}/$$i/$$j; \ - done); \ - done - -.include <bsd.prog.mk> diff --git a/gnu/lib/libg++/g++-include/NegExp.h b/gnu/lib/libg++/g++-include/NegExp.h deleted file mode 100644 index 21a1a18f233..00000000000 --- a/gnu/lib/libg++/g++-include/NegExp.h +++ /dev/null @@ -1,63 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Dirk Grunwald (grunwald@cs.uiuc.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ -#ifndef _NegativeExpntl_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _NegativeExpntl_h 1 - - -// -// Negative Exponential Random Numbers -// -// - -#include <Random.h> - -class NegativeExpntl: public Random { -protected: - double pMean; -public: - NegativeExpntl(double xmean, RNG *gen); - double mean(); - double mean(double x); - - virtual double operator()(); -}; - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - -inline NegativeExpntl::NegativeExpntl(double xmean, RNG *gen) -: (gen) { - pMean = xmean; -} - -inline double NegativeExpntl::mean() { return pMean; } -inline double NegativeExpntl::mean(double x) { - double t = pMean; pMean = x; - return t; -} - -#endif -#endif diff --git a/gnu/lib/libg++/g++-include/Normal.h b/gnu/lib/libg++/g++-include/Normal.h deleted file mode 100644 index b8a209eba74..00000000000 --- a/gnu/lib/libg++/g++-include/Normal.h +++ /dev/null @@ -1,74 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Dirk Grunwald (grunwald@cs.uiuc.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ -#ifndef _Normal_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _Normal_h - -#include <Random.h> - -class Normal: public Random { - char haveCachedNormal; - double cachedNormal; - -protected: - double pMean; - double pVariance; - double pStdDev; - -public: - Normal(double xmean, double xvariance, RNG *gen); - double mean(); - double mean(double x); - double variance(); - double variance(double x); - virtual double operator()(); -}; - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - -inline Normal::Normal(double xmean, double xvariance, RNG *gen) -: (gen) { - pMean = xmean; - pVariance = xvariance; - pStdDev = sqrt(pVariance); - haveCachedNormal = 0; -} - -inline double Normal::mean() { return pMean; }; -inline double Normal::mean(double x) { - double t=pMean; pMean = x; - return t; -} - -inline double Normal::variance() { return pVariance; } -inline double Normal::variance(double x) { - double t=pVariance; pVariance = x; - pStdDev = sqrt(pVariance); - return t; -}; - -#endif -#endif diff --git a/gnu/lib/libg++/g++-include/Obstack.h b/gnu/lib/libg++/g++-include/Obstack.h deleted file mode 100644 index 0cc2e9bb378..00000000000 --- a/gnu/lib/libg++/g++-include/Obstack.h +++ /dev/null @@ -1,226 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - - -#ifndef _Obstack_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _Obstack_h 1 - -#include <std.h> - -class Obstack -{ - struct _obstack_chunk - { - char* limit; - _obstack_chunk* prev; - char contents[4]; - }; - -protected: - long chunksize; - _obstack_chunk* chunk; - char* objectbase; - char* nextfree; - char* chunklimit; - int alignmentmask; - - void _free(void* obj); - void newchunk(int size); - -public: - Obstack(int size = 4080, int alignment = 4); // 4080=4096-mallocslop - - ~Obstack(); - - void* base(); - void* next_free(); - int alignment_mask(); - int chunk_size(); - int size(); - int room(); - int contains(void* p); // does Obstack hold pointer p? - - void grow(const void* data, int size); - void grow(const void* data, int size, char terminator); - void grow(const char* s); - void grow(char c); - void grow_fast(char c); - void blank(int size); - void blank_fast(int size); - - void* finish(); - void* finish(char terminator); - - void* copy(const void* data, int size); - void* copy(const void* data, int size, char terminator); - void* copy(const char* s); - void* copy(char c); - void* alloc(int size); - - void free(void* obj); - void shrink(int size = 1); // suggested by ken@cs.rochester.edu - - int OK(); // rep invariant -}; - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - - -inline Obstack::~Obstack() -{ - _free(0); -} - -inline void* Obstack::base() -{ - return objectbase; -} - -inline void* Obstack::next_free() -{ - return nextfree; -} - -inline int Obstack::alignment_mask() -{ - return alignmentmask; -} - -inline int Obstack::chunk_size() -{ - return chunksize; -} - -inline int Obstack::size() -{ - return nextfree - objectbase; -} - -inline int Obstack::room() -{ - return chunklimit - nextfree; -} - -inline void Obstack:: grow(const void* data, int size) -{ - if (nextfree+size > chunklimit) - newchunk(size); - bcopy(data, nextfree, size); - nextfree += size; -} - -inline void Obstack:: grow(const void* data, int size, char terminator) -{ - if (nextfree+size+1 > chunklimit) - newchunk(size+1); - bcopy(data, nextfree, size); - nextfree += size; - *(nextfree)++ = terminator; -} - -inline void Obstack:: grow(const char* s) -{ - grow((void*)s, strlen(s), 0); -} - -inline void Obstack:: grow(char c) -{ - if (nextfree+1 > chunklimit) - newchunk(1); - *(nextfree)++ = c; -} - -inline void Obstack:: blank(int size) -{ - if (nextfree+size > chunklimit) - newchunk(size); - nextfree += size; -} - -inline void* Obstack::finish(char terminator) -{ - grow(terminator); - return finish(); -} - -inline void* Obstack::copy(const void* data, int size) -{ - grow (data, size); - return finish(); -} - -inline void* Obstack::copy(const void* data, int size, char terminator) -{ - grow(data, size, terminator); - return finish(); -} - -inline void* Obstack::copy(const char* s) -{ - grow((void*)s, strlen(s), 0); - return finish(); -} - -inline void* Obstack::copy(char c) -{ - grow(c); - return finish(); -} - -inline void* Obstack::alloc(int size) -{ - blank(size); - return finish(); -} - -inline void Obstack:: free(void* obj) -{ - if (obj >= (void*)chunk && obj<(void*)chunklimit) - nextfree = objectbase = (char *) obj; - else - _free(obj); -} - -inline void Obstack:: grow_fast(char c) -{ - *(nextfree)++ = c; -} - -inline void Obstack:: blank_fast(int size) -{ - nextfree += size; -} - -inline void Obstack:: shrink(int size) // from ken@cs.rochester.edu -{ - if (nextfree >= objectbase + size) - nextfree -= size; -} - -#endif - -#endif diff --git a/gnu/lib/libg++/g++-include/Pix.h b/gnu/lib/libg++/g++-include/Pix.h deleted file mode 100644 index 0e087967e05..00000000000 --- a/gnu/lib/libg++/g++-include/Pix.h +++ /dev/null @@ -1,9 +0,0 @@ - -#ifndef _Pix_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _Pix_h 1 -typedef void* Pix; -#endif diff --git a/gnu/lib/libg++/g++-include/PlotFile.h b/gnu/lib/libg++/g++-include/PlotFile.h deleted file mode 100644 index 1a6939641eb..00000000000 --- a/gnu/lib/libg++/g++-include/PlotFile.h +++ /dev/null @@ -1,154 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -/* - a very simple implementation of a class to output unix "plot" - format plotter files. See corresponding unix man pages for - more details. -*/ - -#ifndef _PlotFile_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _PlotFile_h - -#include <File.h> - -/* - Some plot libraries have the `box' command to draw boxes. Some don't. - `box' is included here via moves & lines to allow both possiblilties. -*/ - - -class PlotFile : private File -{ -protected: - PlotFile& cmd(char c); - PlotFile& operator << (const int x); - PlotFile& operator << (const char *s); - -public: - - PlotFile(); - PlotFile(const char* filename, io_mode m, access_mode a); - PlotFile(const char* filename, const char* m); - PlotFile(int filedesc, const io_mode m = io_writeonly); - PlotFile(FILE* fileptr); - - ~PlotFile(); - - operator void*(); - - PlotFile& close() { File::close(); return *this; } - PlotFile& remove() { File::remove(); return *this; } - - int filedesc() { return File::filedesc(); } - const char* name() { return File::name(); } - void setname(const char* newname) { File::setname(newname); } - int iocount() { return File::iocount(); } - - int rdstate() { return File::rdstate(); } - int eof() { return File::eof(); } - int fail() { return File::fail(); } - int bad() { return File::bad(); } - int good() { return File::good(); } - - // other status queries - - int readable() { return File::readable(); } - int writable() { return File::writable(); } - int is_open() { return File::is_open(); } - - void error() { File::error(); } - void clear(state_value f = _good) { File::clear(f); } - void set(state_value f) { File::set(f); } - void unset(state_value f) { File::unset(f); } - PlotFile& failif(int cond) { File::failif(cond); return *this; } - void check_state() { File::check_state(); } - - PlotFile& raw() { File::raw(); return *this; } - - PlotFile& open(const char* filename, io_mode m, access_mode a); - PlotFile& open(const char* filename, const char* m); - PlotFile& open(int filedesc, io_mode m); - PlotFile& open(FILE* fileptr); - PlotFile& setbuf(const int buffer_kind); // vals: _IONBF, _IOFBF, _IOLBF - PlotFile& setbuf(const int size, char* buf); - - PlotFile& arc(const int xi, const int yi, - const int x0, const int y0, - const int x1, const int y1); - PlotFile& box(const int x0, const int y0, - const int x1, const int y1); - PlotFile& circle(const int x, const int y, const int r); - PlotFile& cont(const int xi, const int yi); - PlotFile& dot(const int xi, const int yi, const int dx, - int n, const int* pat); - PlotFile& erase(); - PlotFile& label(const char* s); - PlotFile& line(const int x0, const int y0, - const int x1, const int y1); - PlotFile& linemod(const char* s); - PlotFile& move(const int xi, const int yi); - PlotFile& point(const int xi, const int yi); - PlotFile& space(const int x0, const int y0, - const int x1, const int y1); -}; - - -#endif - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/gnu/lib/libg++/g++-include/Poisson.h b/gnu/lib/libg++/g++-include/Poisson.h deleted file mode 100644 index aaac6e75ae4..00000000000 --- a/gnu/lib/libg++/g++-include/Poisson.h +++ /dev/null @@ -1,60 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Dirk Grunwald (grunwald@cs.uiuc.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ -#ifndef _Poisson_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _Poisson_h - -#include <Random.h> - -class Poisson: public Random { -protected: - double pMean; -public: - Poisson(double mean, RNG *gen); - - double mean(); - double mean(double x); - - virtual double operator()(); -}; - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - -inline Poisson::Poisson(double mean, RNG *gen) -: (gen) { - pMean = mean; -} - -inline double Poisson::mean() { return pMean; } -inline double Poisson::mean(double x) { - double t = pMean; - pMean = x; - return t; -} - - -#endif -#endif diff --git a/gnu/lib/libg++/g++-include/RNG.h b/gnu/lib/libg++/g++-include/RNG.h deleted file mode 100644 index 414b57f3afe..00000000000 --- a/gnu/lib/libg++/g++-include/RNG.h +++ /dev/null @@ -1,88 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Dirk Grunwald (grunwald@cs.uiuc.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ -#ifndef _RNG_h -#define _RNG_h 1 -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif - -#include <assert.h> -#include <math.h> - -union PrivateRNGSingleType { // used to access floats as unsigneds - float s; - unsigned long u; -}; - -union PrivateRNGDoubleType { // used to access doubles as unsigneds - double d; - unsigned long u[2]; -}; - -// -// Base class for Random Number Generators. See ACG and MLCG for instances. -// -class RNG { - static PrivateRNGSingleType singleMantissa; // mantissa bit vector - static PrivateRNGDoubleType doubleMantissa; // mantissa bit vector -public: - RNG(); - // - // Return a long-words word of random bits - // - virtual unsigned long asLong() = 0; - virtual void reset() = 0; - // - // Return random bits converted to either a float or a double - // - float asFloat(); - double asDouble(); -}; - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - - -inline float RNG::asFloat() -{ - PrivateRNGSingleType result; - result.s = 1.0; - result.u |= (asLong() & singleMantissa.u); - result.s -= 1.0; - assert( result.s < 1.0 && result.s >= 0); - return( result.s ); -} - -inline double RNG::asDouble() -{ - PrivateRNGDoubleType result; - result.d = 1.0; - result.u[0] |= (asLong() & doubleMantissa.u[0]); - result.u[1] |= (asLong() & doubleMantissa.u[1]); - result.d -= 1.0; - assert( result.d < 1.0 && result.d >= 0); - return( result.d ); -} - -#endif -#endif diff --git a/gnu/lib/libg++/g++-include/Random.h b/gnu/lib/libg++/g++-include/Random.h deleted file mode 100644 index 94efa09fc0e..00000000000 --- a/gnu/lib/libg++/g++-include/Random.h +++ /dev/null @@ -1,67 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Dirk Grunwald (grunwald@cs.uiuc.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ -#ifndef _Random_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _Random_h 1 -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif - -#include <math.h> -#include "RNG.h" - -class Random { -protected: - RNG *pGenerator; -public: - Random(RNG *generator); - virtual double operator()() = 0; - - RNG *generator(); - void generator(RNG *p); -}; - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - -inline Random::Random(RNG *gen) -{ - pGenerator = gen; -} - -inline RNG *Random::generator() -{ - return(pGenerator); -} - -inline void Random::generator(RNG *p) -{ - pGenerator = p; -} - -#endif - -#endif diff --git a/gnu/lib/libg++/g++-include/Rational.h b/gnu/lib/libg++/g++-include/Rational.h deleted file mode 100644 index 3e7e35f1b73..00000000000 --- a/gnu/lib/libg++/g++-include/Rational.h +++ /dev/null @@ -1,270 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- - -/* -Copyright (C) 1988 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -#ifndef _Rational_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _Rational_h 1 - -#include <Integer.h> -#include <math.h> - -class Rational -{ -protected: - Integer num; - Integer den; - - void normalize(); - -public: - Rational(); - Rational(double); - Rational(long n, long d = 1); - Rational(const Integer& n); - Rational(const Integer& n, const Integer& d); - Rational(const Rational&); - - ~Rational(); - - void operator = (const Rational& y); - - friend int operator == (const Rational& x, const Rational& y); - friend int operator != (const Rational& x, const Rational& y); - friend int operator < (const Rational& x, const Rational& y); - friend int operator <= (const Rational& x, const Rational& y); - friend int operator > (const Rational& x, const Rational& y); - friend int operator >= (const Rational& x, const Rational& y); - - friend Rational operator + (const Rational& x, const Rational& y); - friend Rational operator - (const Rational& x, const Rational& y); - friend Rational operator * (const Rational& x, const Rational& y); - friend Rational operator / (const Rational& x, const Rational& y); - - void operator += (const Rational& y); - void operator -= (const Rational& y); - void operator *= (const Rational& y); - void operator /= (const Rational& y); - -#ifdef __GNUG__ - friend Rational operator <? (const Rational& x, const Rational& y); // min - friend Rational operator >? (const Rational& x, const Rational& y); // max -#endif - - friend Rational operator - (const Rational& x); - - -// builtin Rational functions - - - void negate(); // x = -x - void invert(); // x = 1/x - - friend int sign(const Rational& x); // -1, 0, or +1 - friend Rational abs(const Rational& x); // absolute value - friend Rational sqr(const Rational& x); // square - friend Rational pow(const Rational& x, long y); - friend Rational pow(const Rational& x, Integer& y); - const Integer& numerator() const; - const Integer& denominator() const; - -// coercion & conversion - - operator double() const; - friend Integer floor(const Rational& x); - friend Integer ceil(const Rational& x); - friend Integer trunc(const Rational& x); - friend Integer round(const Rational& x); - - friend istream& operator >> (istream& s, Rational& y); - friend ostream& operator << (ostream& s, const Rational& y); - - -// procedural versions of operators - - friend int compare(const Rational& x, const Rational& y); - friend void add(const Rational& x, const Rational& y, Rational& dest); - friend void sub(const Rational& x, const Rational& y, Rational& dest); - friend void mul(const Rational& x, const Rational& y, Rational& dest); - friend void div(const Rational& x, const Rational& y, Rational& dest); - -// error detection - - volatile void error(const char* msg) const; - int OK() const; - -}; - -typedef Rational RatTmp; // backwards compatibility - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - -inline Rational::Rational() {} -inline Rational::~Rational() {} - -inline Rational::Rational(const Rational& y) :num(y.num), den(y.den) {} - -inline Rational::Rational(const Integer& n) :num(n), den(1) {} - -inline Rational::Rational(const Integer& n, const Integer& d) :num(n),den(d) -{ - normalize(); -} - -inline Rational::Rational(long n, long d) :num(n), den(d) -{ - normalize(); -} - -inline void Rational::operator = (const Rational& y) -{ - num = y.num; den = y.den; -} - -inline int operator == (const Rational& x, const Rational& y) -{ - return compare(x.num, y.num) == 0 && compare(x.den, y.den) == 0; -} - -inline int operator != (const Rational& x, const Rational& y) -{ - return compare(x.num, y.num) != 0 || compare(x.den, y.den) != 0; -} - -inline int operator < (const Rational& x, const Rational& y) -{ - return compare(x, y) < 0; -} - -inline int operator <= (const Rational& x, const Rational& y) -{ - return compare(x, y) <= 0; -} - -inline int operator > (const Rational& x, const Rational& y) -{ - return compare(x, y) > 0; -} - -inline int operator >= (const Rational& x, const Rational& y) -{ - return compare(x, y) >= 0; -} - -inline int sign(const Rational& x) -{ - return sign(x.num); -} - -inline void Rational::negate() -{ - num.negate(); -} - - -inline void Rational::operator += (const Rational& y) -{ - add(*this, y, *this); -} - -inline void Rational::operator -= (const Rational& y) -{ - sub(*this, y, *this); -} - -inline void Rational::operator *= (const Rational& y) -{ - mul(*this, y, *this); -} - -inline void Rational::operator /= (const Rational& y) -{ - div(*this, y, *this); -} - -inline const Integer& Rational::numerator() const { return num; } -inline const Integer& Rational::denominator() const { return den; } -inline Rational::operator double() const { return ratio(num, den); } - -#ifdef __GNUG__ -inline Rational operator <? (const Rational& x, const Rational& y) -{ - if (compare(x, y) <= 0) return x; else return y; -} - -inline Rational operator >? (const Rational& x, const Rational& y) -{ - if (compare(x, y) >= 0) return x; else return y; -} -#endif - -#if defined(__GNUG__) && !defined(NO_NRV) - -inline Rational operator + (const Rational& x, const Rational& y) return r -{ - add(x, y, r); -} - -inline Rational operator - (const Rational& x, const Rational& y) return r -{ - sub(x, y, r); -} - -inline Rational operator * (const Rational& x, const Rational& y) return r -{ - mul(x, y, r); -} - -inline Rational operator / (const Rational& x, const Rational& y) return r -{ - div(x, y, r); -} - -#else /* NO_NRV */ - -inline Rational operator + (const Rational& x, const Rational& y) -{ - Rational r; add(x, y, r); return r; -} - -inline Rational operator - (const Rational& x, const Rational& y) -{ - Rational r; sub(x, y, r); return r; -} - -inline Rational operator * (const Rational& x, const Rational& y) -{ - Rational r; mul(x, y, r); return r; -} - -inline Rational operator / (const Rational& x, const Rational& y) -{ - Rational r; div(x, y, r); return r; -} -#endif -#endif - -#endif diff --git a/gnu/lib/libg++/g++-include/Regex.h b/gnu/lib/libg++/g++-include/Regex.h deleted file mode 100644 index d0cff263f20..00000000000 --- a/gnu/lib/libg++/g++-include/Regex.h +++ /dev/null @@ -1,76 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - - -#ifndef _Regex_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _Regex_h 1 - -struct re_pattern_buffer; // defined elsewhere -struct re_registers; - -class Regex -{ -private: - - Regex(const Regex&) {} // no X(X&) - void operator = (const Regex&) {} // no assignment - -protected: - re_pattern_buffer* buf; - re_registers* reg; - -public: - Regex(const char* t, - int fast = 0, - int bufsize = 40, - const char* transtable = 0); - - ~Regex(); - - int match(const char* s, int len, int pos = 0) const; - int search(const char* s, int len, - int& matchlen, int startpos = 0) const; - int match_info(int& start, int& length, int nth = 0) const; - - int OK() const; // representation invariant -}; - -// some built in regular expressions - -extern const Regex RXwhite; // = "[ \n\t\r\v\f]+" -extern const Regex RXint; // = "-?[0-9]+" -extern const Regex RXdouble; // = "-?\\(\\([0-9]+\\.[0-9]*\\)\\| - // \\([0-9]+\\)\\|\\(\\.[0-9]+\\)\\) - // \\([eE][---+]?[0-9]+\\)?" -extern const Regex RXalpha; // = "[A-Za-z]+" -extern const Regex RXlowercase; // = "[a-z]+" -extern const Regex RXuppercase; // = "[A-Z]+" -extern const Regex RXalphanum; // = "[0-9A-Za-z]+" -extern const Regex RXidentifier; // = "[A-Za-z_][A-Za-z0-9_]*" - - -#endif diff --git a/gnu/lib/libg++/g++-include/RndInt.h b/gnu/lib/libg++/g++-include/RndInt.h deleted file mode 100644 index f674796f058..00000000000 --- a/gnu/lib/libg++/g++-include/RndInt.h +++ /dev/null @@ -1,169 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1990 Free Software Foundation - adapted from a submission from John Reidl <riedl@cs.purdue.edu> - - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -#ifndef _RandomInteger_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _RandomInteger_h 1 - -// RandomInteger uses a random number generator to generate an integer -// in a specified range. By default the range is 0..1. Since in my -// experience random numbers are often needed for a wide variety of -// ranges in the same program, this generator accepts a new low or high value -// as an argument to the asLong and operator() methods to temporarily -// override stored values - -#include <math.h> -#include "RNG.h" - -class RandomInteger -{ - protected: - RNG *pGenerator; - long pLow; - long pHigh; - - long _asLong(long, long); - - public: - - RandomInteger(long low, long high, RNG *gen); - RandomInteger(long high, RNG *gen); - RandomInteger(RNG *gen); - -// read params - - long low() const; - long high() const; - RNG* generator() const; - -// change params - - long low(long x); - long high(long x); - RNG* generator(RNG *gen); - -// get a random number - - long asLong(); - long operator()(); // synonym for asLong - int asInt(); // (possibly) truncate as int - -// override params for one shot - - long asLong(long high); - long asLong(long low, long high); - - long operator () (long high); // synonyms - long operator () (long low, long high); - -}; - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - -inline RandomInteger::RandomInteger(long low, long high, RNG *gen) - : pLow((low < high) ? low : high), - pHigh((low < high) ? high : low), - pGenerator(gen) -{} - -inline RandomInteger::RandomInteger(long high, RNG *gen) - : pLow((0 < high) ? 0 : high), - pHigh((0 < high) ? high : 0), - pGenerator(gen) -{} - - -inline RandomInteger::RandomInteger(RNG *gen) - : pLow(0), - pHigh(1), - pGenerator(gen) -{} - -inline RNG* RandomInteger::generator() const { return pGenerator;} -inline long RandomInteger::low() const { return pLow; } -inline long RandomInteger::high() const { return pHigh; } - -inline RNG* RandomInteger::generator(RNG *gen) -{ - RNG *tmp = pGenerator; pGenerator = gen; return tmp; -} - -inline long RandomInteger::low(long x) -{ - long tmp = pLow; pLow = x; return tmp; -} - -inline long RandomInteger:: high(long x) -{ - long tmp = pHigh; pHigh = x; return tmp; -} - -inline long RandomInteger:: _asLong(long low, long high) -{ - return (pGenerator->asLong() % (high-low+1)) + low; -} - - -inline long RandomInteger:: asLong() -{ - return _asLong(pLow, pHigh); -} - -inline long RandomInteger:: asLong(long high) -{ - return _asLong(pLow, high); -} - -inline long RandomInteger:: asLong(long low, long high) -{ - return _asLong(low, high); -} - -inline long RandomInteger:: operator () () -{ - return _asLong(pLow, pHigh); -} - -inline long RandomInteger:: operator () (long high) -{ - return _asLong(pLow, high); -} - -inline long RandomInteger:: operator () (long low, long high) -{ - return _asLong(low, high); -} - - - - -inline int RandomInteger:: asInt() -{ - return int(asLong()); -} - -#endif - -#endif diff --git a/gnu/lib/libg++/g++-include/SFile.h b/gnu/lib/libg++/g++-include/SFile.h deleted file mode 100644 index 598078ed8fe..00000000000 --- a/gnu/lib/libg++/g++-include/SFile.h +++ /dev/null @@ -1,88 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -#ifndef _SFile_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _SFile_h 1 - -#include <File.h> - -class SFile: public File -{ -protected: - int sz; // unit size for structured binary IO - -public: - SFile(); - SFile(const char* filename, int size, io_mode m, access_mode a); - SFile(const char* filename, int size, const char* m); - SFile(int filedesc, int size, io_mode m); - SFile(FILE* fileptr, int size); - - ~SFile(); - - int size(); - int setsize(int s); - - SFile& get(void* x); - SFile& put(void* x); - SFile& operator[](long i); -}; - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - - -inline int SFile::size() -{ - return sz; -} - -inline int SFile::setsize(int s) -{ - int old = sz; - sz = s; - return old; -} - -inline SFile& SFile::get(void* x) -{ - read(x, sz, 1); return *this; -} - -inline SFile& SFile::put(void* x) -{ - write(x, sz, 1); return *this; -} - -inline SFile& SFile::operator[](long i) -{ - seek(i * sz, 0); return *this; -} - - -#endif - -#endif diff --git a/gnu/lib/libg++/g++-include/SmplHist.h b/gnu/lib/libg++/g++-include/SmplHist.h deleted file mode 100644 index ed1fb5d1364..00000000000 --- a/gnu/lib/libg++/g++-include/SmplHist.h +++ /dev/null @@ -1,82 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Dirk Grunwald (grunwald@cs.uiuc.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -#ifndef SampleHistogram_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define SampleHistogram_h 1 - -#include <stream.h> -#include <SmplStat.h> - -extern const int SampleHistogramMinimum; -extern const int SampleHistogramMaximum; - -class SampleHistogram : public SampleStatistic -{ -protected: - short howManyBuckets; - int *bucketCount; - double *bucketLimit; - -public: - - SampleHistogram(double low, double hi, double bucketWidth = -1.0); - - ~SampleHistogram(); - - virtual void reset(); - virtual void operator+=(double); - - int similarSamples(double); - - int buckets(); - - double bucketThreshold(int i); - int inBucket(int i); - void printBuckets(ostream&); - -}; - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - - inline int SampleHistogram:: buckets() { return(howManyBuckets); }; - - inline double SampleHistogram:: bucketThreshold(int i) { - if (i < 0 || i >= howManyBuckets) - error("invalid bucket access"); - return(bucketLimit[i]); - } - - inline int SampleHistogram:: inBucket(int i) { - if (i < 0 || i >= howManyBuckets) - error("invalid bucket access"); - return(bucketCount[i]); - } - - -#endif - -#endif diff --git a/gnu/lib/libg++/g++-include/SmplStat.h b/gnu/lib/libg++/g++-include/SmplStat.h deleted file mode 100644 index 6aea14aef08..00000000000 --- a/gnu/lib/libg++/g++-include/SmplStat.h +++ /dev/null @@ -1,73 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Dirk Grunwald (grunwald@cs.uiuc.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ -#ifndef SampleStatistic_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define SampleStatistic_h 1 - -#include <builtin.h> - -class SampleStatistic { -protected: - int n; - double x; - double x2; - double minValue, maxValue; - - public : - - SampleStatistic(); - virtual void reset(); - - virtual void operator+=(double); - int samples(); - double mean(); - double stdDev(); - double var(); - double min(); - double max(); - double confidence(int p_percentage); - double confidence(double p_value); - - void error(const char* msg); -}; - -// error handlers - -extern void default_SampleStatistic_error_handler(const char*); -extern one_arg_error_handler_t SampleStatistic_error_handler; - -extern one_arg_error_handler_t - set_SampleStatistic_error_handler(one_arg_error_handler_t f); - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - - inline SampleStatistic:: SampleStatistic(){ reset();} - inline int SampleStatistic:: samples() {return(n);} - inline double SampleStatistic:: min() {return(minValue);} - inline double SampleStatistic:: max() {return(maxValue);} - -#endif -#endif diff --git a/gnu/lib/libg++/g++-include/String.h b/gnu/lib/libg++/g++-include/String.h deleted file mode 100644 index 871b9a2d54d..00000000000 --- a/gnu/lib/libg++/g++-include/String.h +++ /dev/null @@ -1,1341 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -#if defined(SHORT_NAMES) || defined(VMS) -#define re_compile_pattern recmppat -#define re_pattern_buffer repatbuf -#define re_registers reregs -#endif - -#ifndef _String_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _String_h 1 - -#include <stream.h> -#include <Regex.h> - -struct StrRep // internal String representations -{ - unsigned short len; // string length - unsigned short sz; // allocated space - char s[1]; // the string starts here - // (at least 1 char for trailing null) - // allocated & expanded via non-public fcts -}; - -// primitive ops on StrReps -- nearly all String fns go through these. - -StrRep* Salloc(StrRep*, const char*, int, int); -StrRep* Scopy(StrRep*, StrRep*); -StrRep* Sresize(StrRep*, int); -StrRep* Scat(StrRep*, const char*, int, const char*, int); -StrRep* Scat(StrRep*, const char*, int,const char*,int, const char*,int); -StrRep* Sprepend(StrRep*, const char*, int); -StrRep* Sreverse(StrRep*, StrRep*); -StrRep* Supcase(StrRep*, StrRep*); -StrRep* Sdowncase(StrRep*, StrRep*); -StrRep* Scapitalize(StrRep*, StrRep*); - -// These classes need to be defined in the order given - -class String; -class SubString; - -class SubString -{ - friend class String; -protected: - - String& S; // The String I'm a substring of - unsigned short pos; // starting position in S's rep - unsigned short len; // length of substring - - void assign(StrRep*, const char*, int = -1); - SubString(String& x, int p, int l); - SubString(const SubString& x); - -public: - -// Note there are no public constructors. SubStrings are always -// created via String operations - - ~SubString(); - - void operator = (const String& y); - void operator = (const SubString& y); - void operator = (const char* t); - void operator = (char c); - -// return 1 if target appears anywhere in SubString; else 0 - - int contains(char c) const; - int contains(const String& y) const; - int contains(const SubString& y) const; - int contains(const char* t) const; - int contains(const Regex& r) const; - -// return 1 if target matches entire SubString - - int matches(const Regex& r) const; - -// IO - - friend ostream& operator<<(ostream& s, const SubString& x); - -// status - - int length() const; - int empty() const; - const char* chars() const; - - int OK() const; - -}; - - -class String -{ - friend class SubString; - -protected: - StrRep* rep; // Strings are pointers to their representations - -// some helper functions - - int search(int, int, const char*, int = -1) const; - int search(int, int, char) const; - int match(int, int, int, const char*, int = -1) const; - int _gsub(const char*, int, const char* ,int); - int _gsub(const Regex&, const char*, int); - SubString _substr(int, int); - -public: - -// constructors & assignment - - String(); - String(const String& x); - String(const SubString& x); - String(const char* t); - String(const char* t, int len); - String(char c); - - ~String(); - - void operator = (const String& y); - void operator = (const char* y); - void operator = (char c); - void operator = (const SubString& y); - -// concatenation - - void operator += (const String& y); - void operator += (const SubString& y); - void operator += (const char* t); - void operator += (char c); - - void prepend(const String& y); - void prepend(const SubString& y); - void prepend(const char* t); - void prepend(char c); - - -// procedural versions: -// concatenate first 2 args, store result in last arg - - friend void cat(const String&, const String&, String&); - friend void cat(const String&, const SubString&, String&); - friend void cat(const String&, const char*, String&); - friend void cat(const String&, char, String&); - - friend void cat(const SubString&, const String&, String&); - friend void cat(const SubString&, const SubString&, String&); - friend void cat(const SubString&, const char*, String&); - friend void cat(const SubString&, char, String&); - - friend void cat(const char*, const String&, String&); - friend void cat(const char*, const SubString&, String&); - friend void cat(const char*, const char*, String&); - friend void cat(const char*, char, String&); - -// double concatenation, by request. (yes, there are too many versions, -// but if one is supported, then the others should be too...) -// Concatenate first 3 args, store in last arg - - friend void cat(const String&,const String&, const String&,String&); - friend void cat(const String&,const String&,const SubString&,String&); - friend void cat(const String&,const String&, const char*, String&); - friend void cat(const String&,const String&, char, String&); - friend void cat(const String&,const SubString&,const String&,String&); - friend void cat(const String&,const SubString&,const SubString&,String&); - friend void cat(const String&,const SubString&, const char*, String&); - friend void cat(const String&,const SubString&, char, String&); - friend void cat(const String&,const char*, const String&, String&); - friend void cat(const String&,const char*, const SubString&, String&); - friend void cat(const String&,const char*, const char*, String&); - friend void cat(const String&,const char*, char, String&); - - friend void cat(const char*, const String&, const String&,String&); - friend void cat(const char*,const String&,const SubString&,String&); - friend void cat(const char*,const String&, const char*, String&); - friend void cat(const char*,const String&, char, String&); - friend void cat(const char*,const SubString&,const String&,String&); - friend void cat(const char*,const SubString&,const SubString&,String&); - friend void cat(const char*,const SubString&, const char*, String&); - friend void cat(const char*,const SubString&, char, String&); - friend void cat(const char*,const char*, const String&, String&); - friend void cat(const char*,const char*, const SubString&, String&); - friend void cat(const char*,const char*, const char*, String&); - friend void cat(const char*,const char*, char, String&); - - -// searching & matching - -// return position of target in string or -1 for failure - - int index(char c, int startpos = 0) const; - int index(const String& y, int startpos = 0) const; - int index(const SubString& y, int startpos = 0) const; - int index(const char* t, int startpos = 0) const; - int index(const Regex& r, int startpos = 0) const; - -// return 1 if target appears anyhere in String; else 0 - - int contains(char c) const; - int contains(const String& y) const; - int contains(const SubString& y) const; - int contains(const char* t) const; - int contains(const Regex& r) const; - -// return 1 if target appears anywhere after position pos -// (or before, if pos is negative) in String; else 0 - - int contains(char c, int pos) const; - int contains(const String& y, int pos) const; - int contains(const SubString& y, int pos) const; - int contains(const char* t, int pos) const; - int contains(const Regex& r, int pos) const; - -// return 1 if target appears at position pos in String; else 0 - - int matches(char c, int pos = 0) const; - int matches(const String& y, int pos = 0) const; - int matches(const SubString& y, int pos = 0) const; - int matches(const char* t, int pos = 0) const; - int matches(const Regex& r, int pos = 0) const; - -// return number of occurences of target in String - - int freq(char c) const; - int freq(const String& y) const; - int freq(const SubString& y) const; - int freq(const char* t) const; - -// SubString extraction - -// Note that you can't take a substring of a const String, since -// this leaves open the possiblility of indirectly modifying the -// String through the SubString - - SubString at(int pos, int len); - SubString operator () (int pos, int len); // synonym for at - - SubString at(const String& x, int startpos = 0); - SubString at(const SubString& x, int startpos = 0); - SubString at(const char* t, int startpos = 0); - SubString at(char c, int startpos = 0); - SubString at(const Regex& r, int startpos = 0); - - SubString before(int pos); - SubString before(const String& x, int startpos = 0); - SubString before(const SubString& x, int startpos = 0); - SubString before(const char* t, int startpos = 0); - SubString before(char c, int startpos = 0); - SubString before(const Regex& r, int startpos = 0); - - SubString through(int pos); - SubString through(const String& x, int startpos = 0); - SubString through(const SubString& x, int startpos = 0); - SubString through(const char* t, int startpos = 0); - SubString through(char c, int startpos = 0); - SubString through(const Regex& r, int startpos = 0); - - SubString from(int pos); - SubString from(const String& x, int startpos = 0); - SubString from(const SubString& x, int startpos = 0); - SubString from(const char* t, int startpos = 0); - SubString from(char c, int startpos = 0); - SubString from(const Regex& r, int startpos = 0); - - SubString after(int pos); - SubString after(const String& x, int startpos = 0); - SubString after(const SubString& x, int startpos = 0); - SubString after(const char* t, int startpos = 0); - SubString after(char c, int startpos = 0); - SubString after(const Regex& r, int startpos = 0); - - -// deletion - -// delete len chars starting at pos - void del(int pos, int len); - -// delete the first occurrence of target after startpos - - void del(const String& y, int startpos = 0); - void del(const SubString& y, int startpos = 0); - void del(const char* t, int startpos = 0); - void del(char c, int startpos = 0); - void del(const Regex& r, int startpos = 0); - -// global substitution: substitute all occurrences of pat with repl - - int gsub(const String& pat, const String& repl); - int gsub(const SubString& pat, const String& repl); - int gsub(const char* pat, const String& repl); - int gsub(const char* pat, const char* repl); - int gsub(const Regex& pat, const String& repl); - -// friends & utilities - -// split string into array res at separators; return number of elements - - friend int split(const String& x, String res[], int maxn, - const String& sep); - friend int split(const String& x, String res[], int maxn, - const Regex& sep); - - friend String common_prefix(const String& x, const String& y, - int startpos = 0); - friend String common_suffix(const String& x, const String& y, - int startpos = -1); - friend String replicate(char c, int n); - friend String replicate(const String& y, int n); - friend String join(String src[], int n, const String& sep); - -// simple builtin transformations - - friend String reverse(const String& x); - friend String upcase(const String& x); - friend String downcase(const String& x); - friend String capitalize(const String& x); - -// in-place versions of above - - void reverse(); - void upcase(); - void downcase(); - void capitalize(); - -// element extraction - - char& operator [] (int i); - char elem(int i) const; - char firstchar() const; - char lastchar() const; - -// conversion - - operator const char*() const; - const char* chars() const; - - -// IO - - friend ostream& operator<<(ostream& s, const String& x); - friend ostream& operator<<(ostream& s, const SubString& x); - friend istream& operator>>(istream& s, String& x); - - friend int readline(istream& s, String& x, - char terminator = '\n', - int discard_terminator = 1); - -// status - - int length() const; - int empty() const; - -// preallocate some space for String - void alloc(int newsize); - -// report current allocation (not length!) - - int allocation() const; - - - volatile void error(const char* msg) const; - - int OK() const; -}; - -typedef String StrTmp; // for backward compatibility - -// other externs - -int compare(const String& x, const String& y); -int compare(const String& x, const SubString& y); -int compare(const String& x, const char* y); -int compare(const SubString& x, const String& y); -int compare(const SubString& x, const SubString& y); -int compare(const SubString& x, const char* y); -int fcompare(const String& x, const String& y); // ignore case - -extern StrRep _nilStrRep; -extern String _nilString; - -// other inlines - -String operator + (const String& x, const String& y); -String operator + (const String& x, const SubString& y); -String operator + (const String& x, const char* y); -String operator + (const String& x, char y); -String operator + (const SubString& x, const String& y); -String operator + (const SubString& x, const SubString& y); -String operator + (const SubString& x, const char* y); -String operator + (const SubString& x, char y); -String operator + (const char* x, const String& y); -String operator + (const char* x, const SubString& y); - -int operator==(const String& x, const String& y); -int operator!=(const String& x, const String& y); -int operator> (const String& x, const String& y); -int operator>=(const String& x, const String& y); -int operator< (const String& x, const String& y); -int operator<=(const String& x, const String& y); -int operator==(const String& x, const SubString& y); -int operator!=(const String& x, const SubString& y); -int operator> (const String& x, const SubString& y); -int operator>=(const String& x, const SubString& y); -int operator< (const String& x, const SubString& y); -int operator<=(const String& x, const SubString& y); -int operator==(const String& x, const char* t); -int operator!=(const String& x, const char* t); -int operator> (const String& x, const char* t); -int operator>=(const String& x, const char* t); -int operator< (const String& x, const char* t); -int operator<=(const String& x, const char* t); -int operator==(const SubString& x, const String& y); -int operator!=(const SubString& x, const String& y); -int operator> (const SubString& x, const String& y); -int operator>=(const SubString& x, const String& y); -int operator< (const SubString& x, const String& y); -int operator<=(const SubString& x, const String& y); -int operator==(const SubString& x, const SubString& y); -int operator!=(const SubString& x, const SubString& y); -int operator> (const SubString& x, const SubString& y); -int operator>=(const SubString& x, const SubString& y); -int operator< (const SubString& x, const SubString& y); -int operator<=(const SubString& x, const SubString& y); -int operator==(const SubString& x, const char* t); -int operator!=(const SubString& x, const char* t); -int operator> (const SubString& x, const char* t); -int operator>=(const SubString& x, const char* t); -int operator< (const SubString& x, const char* t); -int operator<=(const SubString& x, const char* t); - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - - -// status reports, needed before defining other things - -inline int String::length() const { return rep->len; } -inline int String::empty() const { return rep->len == 0; } -inline const char* String::chars() const { return &(rep->s[0]); } -inline int String::allocation() const { return rep->sz; } -inline void String::alloc(int newsize) { rep = Sresize(rep, newsize); } - -inline int SubString::length() const { return len; } -inline int SubString::empty() const { return len == 0; } -inline const char* SubString::chars() const { return &(S.rep->s[pos]); } - - -// constructors - -inline String::String() - : rep(&_nilStrRep) {} -inline String::String(const String& x) - : rep(Scopy(0, x.rep)) {} -inline String::String(const char* t) - : rep(Salloc(0, t, -1, -1)) {} -inline String::String(const char* t, int tlen) - : rep(Salloc(0, t, tlen, tlen)) {} -inline String::String(const SubString& y) - : rep(Salloc(0, y.chars(), y.length(), y.length())) {} -inline String::String(char c) - : rep(Salloc(0, &c, 1, 1)) {} - -inline String::~String() { if (rep != &_nilStrRep) delete rep; } - -inline SubString::SubString(const SubString& x) - :S(x.S), pos(x.pos), len(x.len) {} -inline SubString::SubString(String& x, int first, int l) - :S(x), pos(first), len(l) {} - -inline SubString::~SubString() {} - -// assignment - -inline void String::operator = (const String& y) -{ - rep = Scopy(rep, y.rep); -} - -inline void String::operator=(const char* t) -{ - rep = Salloc(rep, t, -1, -1); -} - -inline void String::operator=(const SubString& y) -{ - rep = Salloc(rep, y.chars(), y.length(), y.length()); -} - -inline void String::operator=(char c) -{ - rep = Salloc(rep, &c, 1, 1); -} - - -inline void SubString::operator = (const char* ys) -{ - assign(0, ys); -} - -inline void SubString::operator = (char ch) -{ - assign(0, &ch, 1); -} - -inline void SubString::operator = (const String& y) -{ - assign(y.rep, y.chars(), y.length()); -} - -inline void SubString::operator = (const SubString& y) -{ - assign(y.S.rep, y.chars(), y.length()); -} - -// Zillions of cats... - -inline void cat(const String& x, const String& y, String& r) -{ - r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length()); -} - -inline void cat(const String& x, const SubString& y, String& r) -{ - r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length()); -} - -inline void cat(const String& x, const char* y, String& r) -{ - r.rep = Scat(r.rep, x.chars(), x.length(), y, -1); -} - -inline void cat(const String& x, char y, String& r) -{ - r.rep = Scat(r.rep, x.chars(), x.length(), &y, 1); -} - -inline void cat(const SubString& x, const String& y, String& r) -{ - r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length()); -} - -inline void cat(const SubString& x, const SubString& y, String& r) -{ - r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length()); -} - -inline void cat(const SubString& x, const char* y, String& r) -{ - r.rep = Scat(r.rep, x.chars(), x.length(), y, -1); -} - -inline void cat(const SubString& x, char y, String& r) -{ - r.rep = Scat(r.rep, x.chars(), x.length(), &y, 1); -} - -inline void cat(const char* x, const String& y, String& r) -{ - r.rep = Scat(r.rep, x, -1, y.chars(), y.length()); -} - -inline void cat(const char* x, const SubString& y, String& r) -{ - r.rep = Scat(r.rep, x, -1, y.chars(), y.length()); -} - -inline void cat(const char* x, const char* y, String& r) -{ - r.rep = Scat(r.rep, x, -1, y, -1); -} - -inline void cat(const char* x, char y, String& r) -{ - r.rep = Scat(r.rep, x, -1, &y, 1); -} - -inline void cat(const String& a, const String& x, const String& y, String& r) -{ - r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length()); -} - -inline void cat(const String& a, const String& x, const SubString& y, String& r) -{ - r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length()); -} - -inline void cat(const String& a, const String& x, const char* y, String& r) -{ - r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y, -1); -} - -inline void cat(const String& a, const String& x, char y, String& r) -{ - r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), &y, 1); -} - -inline void cat(const String& a, const SubString& x, const String& y, String& r) -{ - r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length()); -} - -inline void cat(const String& a, const SubString& x, const SubString& y, String& r) -{ - r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length()); -} - -inline void cat(const String& a, const SubString& x, const char* y, String& r) -{ - r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y, -1); -} - -inline void cat(const String& a, const SubString& x, char y, String& r) -{ - r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), &y, 1); -} - -inline void cat(const String& a, const char* x, const String& y, String& r) -{ - r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y.chars(), y.length()); -} - -inline void cat(const String& a, const char* x, const SubString& y, String& r) -{ - r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y.chars(), y.length()); -} - -inline void cat(const String& a, const char* x, const char* y, String& r) -{ - r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y, -1); -} - -inline void cat(const String& a, const char* x, char y, String& r) -{ - r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, &y, 1); -} - - -inline void cat(const char* a, const String& x, const String& y, String& r) -{ - r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length()); -} - -inline void cat(const char* a, const String& x, const SubString& y, String& r) -{ - r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length()); -} - -inline void cat(const char* a, const String& x, const char* y, String& r) -{ - r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y, -1); -} - -inline void cat(const char* a, const String& x, char y, String& r) -{ - r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), &y, 1); -} - -inline void cat(const char* a, const SubString& x, const String& y, String& r) -{ - r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length()); -} - -inline void cat(const char* a, const SubString& x, const SubString& y, String& r) -{ - r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length()); -} - -inline void cat(const char* a, const SubString& x, const char* y, String& r) -{ - r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y, -1); -} - -inline void cat(const char* a, const SubString& x, char y, String& r) -{ - r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), &y, 1); -} - -inline void cat(const char* a, const char* x, const String& y, String& r) -{ - r.rep = Scat(r.rep, a, -1, x, -1, y.chars(), y.length()); -} - -inline void cat(const char* a, const char* x, const SubString& y, String& r) -{ - r.rep = Scat(r.rep, a, -1, x, -1, y.chars(), y.length()); -} - -inline void cat(const char* a, const char* x, const char* y, String& r) -{ - r.rep = Scat(r.rep, a, -1, x, -1, y, -1); -} - -inline void cat(const char* a, const char* x, char y, String& r) -{ - r.rep = Scat(r.rep, a, -1, x, -1, &y, 1); -} - - -// operator versions - -inline void String::operator +=(const String& y) -{ - cat(*this, y, *this); -} - -inline void String::operator +=(const SubString& y) -{ - cat(*this, y, *this); -} - -inline void String::operator += (const char* y) -{ - cat(*this, y, *this); -} - -inline void String:: operator +=(char y) -{ - cat(*this, y, *this); -} - -// constructive concatenation - -#if defined(__GNUG__) && !defined(NO_NRV) - -inline String operator + (const String& x, const String& y) return r; -{ - cat(x, y, r); -} - -inline String operator + (const String& x, const SubString& y) return r; -{ - cat(x, y, r); -} - -inline String operator + (const String& x, const char* y) return r; -{ - cat(x, y, r); -} - -inline String operator + (const String& x, char y) return r; -{ - cat(x, y, r); -} - -inline String operator + (const SubString& x, const String& y) return r; -{ - cat(x, y, r); -} - -inline String operator + (const SubString& x, const SubString& y) return r; -{ - cat(x, y, r); -} - -inline String operator + (const SubString& x, const char* y) return r; -{ - cat(x, y, r); -} - -inline String operator + (const SubString& x, char y) return r; -{ - cat(x, y, r); -} - -inline String operator + (const char* x, const String& y) return r; -{ - cat(x, y, r); -} - -inline String operator + (const char* x, const SubString& y) return r; -{ - cat(x, y, r); -} - -inline String reverse(const String& x) return r; -{ - r.rep = Sreverse(x.rep, r.rep); -} - -inline String upcase(const String& x) return r; -{ - r.rep = Supcase(x.rep, r.rep); -} - -inline String downcase(const String& x) return r; -{ - r.rep = Sdowncase(x.rep, r.rep); -} - -inline String capitalize(const String& x) return r; -{ - r.rep = Scapitalize(x.rep, r.rep); -} - -#else /* NO_NRV */ - -inline String operator + (const String& x, const String& y) -{ - String r; cat(x, y, r); return r; -} - -inline String operator + (const String& x, const SubString& y) -{ - String r; cat(x, y, r); return r; -} - -inline String operator + (const String& x, const char* y) -{ - String r; cat(x, y, r); return r; -} - -inline String operator + (const String& x, char y) -{ - String r; cat(x, y, r); return r; -} - -inline String operator + (const SubString& x, const String& y) -{ - String r; cat(x, y, r); return r; -} - -inline String operator + (const SubString& x, const SubString& y) -{ - String r; cat(x, y, r); return r; -} - -inline String operator + (const SubString& x, const char* y) -{ - String r; cat(x, y, r); return r; -} - -inline String operator + (const SubString& x, char y) -{ - String r; cat(x, y, r); return r; -} - -inline String operator + (const char* x, const String& y) -{ - String r; cat(x, y, r); return r; -} - -inline String operator + (const char* x, const SubString& y) -{ - String r; cat(x, y, r); return r; -} - -inline String reverse(const String& x) -{ - String r; r.rep = Sreverse(x.rep, r.rep); return r; -} - -inline String upcase(const String& x) -{ - String r; r.rep = Supcase(x.rep, r.rep); return r; -} - -inline String downcase(const String& x) -{ - String r; r.rep = Sdowncase(x.rep, r.rep); return r; -} - -inline String capitalize(const String& x) -{ - String r; r.rep = Scapitalize(x.rep, r.rep); return r; -} - -#endif - -// prepend - -inline void String::prepend(const String& y) -{ - rep = Sprepend(rep, y.chars(), y.length()); -} - -inline void String::prepend(const char* y) -{ - rep = Sprepend(rep, y, -1); -} - -inline void String::prepend(char y) -{ - rep = Sprepend(rep, &y, 1); -} - -inline void String::prepend(const SubString& y) -{ - rep = Sprepend(rep, y.chars(), y.length()); -} - -// misc transformations - - -inline void String::reverse() -{ - rep = Sreverse(rep, rep); -} - - -inline void String::upcase() -{ - rep = Supcase(rep, rep); -} - - -inline void String::downcase() -{ - rep = Sdowncase(rep, rep); -} - - -inline void String::capitalize() -{ - rep = Scapitalize(rep, rep); -} - -// element extraction - -inline char& String::operator [] (int i) -{ - if (((unsigned)i) >= length()) error("invalid index"); - return rep->s[i]; -} - -inline char String::elem (int i) const -{ - if (((unsigned)i) >= length()) error("invalid index"); - return rep->s[i]; -} - -inline char String::firstchar() const -{ - return elem(0); -} - -inline char String::lastchar() const -{ - return elem(length() - 1); -} - -// searching - -inline int String::index(char c, int startpos) const -{ - return search(startpos, length(), c); -} - -inline int String::index(const char* t, int startpos) const -{ - return search(startpos, length(), t); -} - -inline int String::index(const String& y, int startpos) const -{ - return search(startpos, length(), y.chars(), y.length()); -} - -inline int String::index(const SubString& y, int startpos) const -{ - return search(startpos, length(), y.chars(), y.length()); -} - -inline int String::index(const Regex& r, int startpos) const -{ - int unused; return r.search(chars(), length(), unused, startpos); -} - -inline int String::contains(char c) const -{ - return search(0, length(), c) >= 0; -} - -inline int String::contains(const char* t) const -{ - return search(0, length(), t) >= 0; -} - -inline int String::contains(const String& y) const -{ - return search(0, length(), y.chars(), y.length()) >= 0; -} - -inline int String::contains(const SubString& y) const -{ - return search(0, length(), y.chars(), y.length()) >= 0; -} - -inline int String::contains(char c, int p) const -{ - return match(p, length(), 0, &c, 1) >= 0; -} - -inline int String::contains(const char* t, int p) const -{ - return match(p, length(), 0, t) >= 0; -} - -inline int String::contains(const String& y, int p) const -{ - return match(p, length(), 0, y.chars(), y.length()) >= 0; -} - -inline int String::contains(const SubString& y, int p) const -{ - return match(p, length(), 0, y.chars(), y.length()) >= 0; -} - -inline int String::contains(const Regex& r) const -{ - int unused; return r.search(chars(), length(), unused, 0) >= 0; -} - -inline int String::contains(const Regex& r, int p) const -{ - return r.match(chars(), length(), p) >= 0; -} - - -inline int String::matches(const SubString& y, int p) const -{ - return match(p, length(), 1, y.chars(), y.length()) >= 0; -} - -inline int String::matches(const String& y, int p) const -{ - return match(p, length(), 1, y.chars(), y.length()) >= 0; -} - -inline int String::matches(const char* t, int p) const -{ - return match(p, length(), 1, t) >= 0; -} - -inline int String::matches(char c, int p) const -{ - return match(p, length(), 1, &c, 1) >= 0; -} - -inline int String::matches(const Regex& r, int p) const -{ - int l = (p < 0)? -p : length() - p; - return r.match(chars(), length(), p) == l; -} - - -inline int SubString::contains(const char* t) const -{ - return S.search(pos, pos+len, t) >= 0; -} - -inline int SubString::contains(const String& y) const -{ - return S.search(pos, pos+len, y.chars(), y.length()) >= 0; -} - -inline int SubString::contains(const SubString& y) const -{ - return S.search(pos, pos+len, y.chars(), y.length()) >= 0; -} - -inline int SubString::contains(char c) const -{ - return S.search(pos, pos+len, 0, c) >= 0; -} - -inline int SubString::contains(const Regex& r) const -{ - int unused; return r.search(chars(), len, unused, 0) >= 0; -} - -inline int SubString::matches(const Regex& r) const -{ - return r.match(chars(), len, 0) == len; -} - - -inline int String::gsub(const String& pat, const String& r) -{ - return _gsub(pat.chars(), pat.length(), r.chars(), r.length()); -} - -inline int String::gsub(const SubString& pat, const String& r) -{ - return _gsub(pat.chars(), pat.length(), r.chars(), r.length()); -} - -inline int String::gsub(const Regex& pat, const String& r) -{ - return _gsub(pat, r.chars(), r.length()); -} - -inline int String::gsub(const char* pat, const String& r) -{ - return _gsub(pat, -1, r.chars(), r.length()); -} - -inline int String::gsub(const char* pat, const char* r) -{ - return _gsub(pat, -1, r, -1); -} - - -inline String::operator const char*() const -{ - return str(chars()); -} - -inline ostream& operator<<(ostream& s, const String& x) -{ -#ifdef VMS - s << x.chars(); return s; -#else - s.put(x.chars()); return s; -#endif - -} - -// a zillion comparison operators - -inline int operator==(const String& x, const String& y) -{ - return compare(x, y) == 0; -} - -inline int operator!=(const String& x, const String& y) -{ - return compare(x, y) != 0; -} - -inline int operator>(const String& x, const String& y) -{ - return compare(x, y) > 0; -} - -inline int operator>=(const String& x, const String& y) -{ - return compare(x, y) >= 0; -} - -inline int operator<(const String& x, const String& y) -{ - return compare(x, y) < 0; -} - -inline int operator<=(const String& x, const String& y) -{ - return compare(x, y) <= 0; -} - -inline int operator==(const String& x, const SubString& y) -{ - return compare(x, y) == 0; -} - -inline int operator!=(const String& x, const SubString& y) -{ - return compare(x, y) != 0; -} - -inline int operator>(const String& x, const SubString& y) -{ - return compare(x, y) > 0; -} - -inline int operator>=(const String& x, const SubString& y) -{ - return compare(x, y) >= 0; -} - -inline int operator<(const String& x, const SubString& y) -{ - return compare(x, y) < 0; -} - -inline int operator<=(const String& x, const SubString& y) -{ - return compare(x, y) <= 0; -} - -inline int operator==(const String& x, const char* t) -{ - return compare(x, t) == 0; -} - -inline int operator!=(const String& x, const char* t) -{ - return compare(x, t) != 0; -} - -inline int operator>(const String& x, const char* t) -{ - return compare(x, t) > 0; -} - -inline int operator>=(const String& x, const char* t) -{ - return compare(x, t) >= 0; -} - -inline int operator<(const String& x, const char* t) -{ - return compare(x, t) < 0; -} - -inline int operator<=(const String& x, const char* t) -{ - return compare(x, t) <= 0; -} - -inline int operator==(const SubString& x, const String& y) -{ - return compare(y, x) == 0; -} - -inline int operator!=(const SubString& x, const String& y) -{ - return compare(y, x) != 0; -} - -inline int operator>(const SubString& x, const String& y) -{ - return compare(y, x) < 0; -} - -inline int operator>=(const SubString& x, const String& y) -{ - return compare(y, x) <= 0; -} - -inline int operator<(const SubString& x, const String& y) -{ - return compare(y, x) > 0; -} - -inline int operator<=(const SubString& x, const String& y) -{ - return compare(y, x) >= 0; -} - -inline int operator==(const SubString& x, const SubString& y) -{ - return compare(x, y) == 0; -} - -inline int operator!=(const SubString& x, const SubString& y) -{ - return compare(x, y) != 0; -} - -inline int operator>(const SubString& x, const SubString& y) -{ - return compare(x, y) > 0; -} - -inline int operator>=(const SubString& x, const SubString& y) -{ - return compare(x, y) >= 0; -} - -inline int operator<(const SubString& x, const SubString& y) -{ - return compare(x, y) < 0; -} - -inline int operator<=(const SubString& x, const SubString& y) -{ - return compare(x, y) <= 0; -} - -inline int operator==(const SubString& x, const char* t) -{ - return compare(x, t) == 0; -} - -inline int operator!=(const SubString& x, const char* t) -{ - return compare(x, t) != 0; -} - -inline int operator>(const SubString& x, const char* t) -{ - return compare(x, t) > 0; -} - -inline int operator>=(const SubString& x, const char* t) -{ - return compare(x, t) >= 0; -} - -inline int operator<(const SubString& x, const char* t) -{ - return compare(x, t) < 0; -} - -inline int operator<=(const SubString& x, const char* t) -{ - return compare(x, t) <= 0; -} - - -// a helper needed by at, before, etc. - -inline SubString String::_substr(int first, int l) -{ - if (first < 0 || (unsigned)(first + l) > length()) - return SubString(_nilString, 0, 0) ; - else - return SubString(*this, first, l); -} - - -#endif - -#endif diff --git a/gnu/lib/libg++/g++-include/Uniform.h b/gnu/lib/libg++/g++-include/Uniform.h deleted file mode 100644 index 5d896e8f0cf..00000000000 --- a/gnu/lib/libg++/g++-include/Uniform.h +++ /dev/null @@ -1,81 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Dirk Grunwald (grunwald@cs.uiuc.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ -#ifndef _Uniform_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _Uniform_h 1 - -#include <Random.h> - -// -// The interval [lo..hi] -// - -class Uniform: public Random { - double pLow; - double pHigh; - double delta; -public: - Uniform(double low, double high, RNG *gen); - - double low(); - double low(double x); - double high(); - double high(double x); - - virtual double operator()(); -}; - - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - -inline Uniform::Uniform(double low, double high, RNG *gen):(gen) -{ - pLow = (low < high) ? low : high; - pHigh = (low < high) ? high : low; - delta = pHigh - pLow; -} - -inline double Uniform::low() { return pLow; } - -inline double Uniform::low(double x) { - double tmp = pLow; - pLow = x; - delta = pHigh - pLow; - return tmp; -} - -inline double Uniform::high() { return pHigh; } - -inline double Uniform::high(double x) { - double tmp = pHigh; - pHigh = x; - delta = pHigh - pLow; - return tmp; -} - - -#endif -#endif diff --git a/gnu/lib/libg++/g++-include/Weibull.h b/gnu/lib/libg++/g++-include/Weibull.h deleted file mode 100644 index 6ce8eabf8bc..00000000000 --- a/gnu/lib/libg++/g++-include/Weibull.h +++ /dev/null @@ -1,83 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Dirk Grunwald (grunwald@cs.uiuc.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ -#ifndef _Weibull_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _Weibull_h - -#include <Random.h> - -class Weibull: public Random { -protected: - double pAlpha; - double pInvAlpha; - double pBeta; - - void setState(); - -public: - Weibull(double alpha, double beta, RNG *gen); - - double alpha(); - double alpha(double x); - - double beta(); - double beta(double x); - - virtual double operator()(); -}; - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - -inline void Weibull::setState() { - pInvAlpha = 1.0 / pAlpha; -} - -inline Weibull::Weibull(double alpha, double beta, RNG *gen) : (gen) -{ - pAlpha = alpha; - pBeta = beta; - setState(); -} - -inline double Weibull::alpha() { return pAlpha; } - -inline double Weibull::alpha(double x) { - double tmp = pAlpha; - pAlpha = x; - setState(); - return tmp; -} - -inline double Weibull::beta() { return pBeta; }; -inline double Weibull::beta(double x) { - double tmp = pBeta; - pBeta = x; - return tmp; -}; - - -#endif -#endif diff --git a/gnu/lib/libg++/g++-include/abs.h b/gnu/lib/libg++/g++-include/abs.h deleted file mode 100644 index 8c2c8f98ced..00000000000 --- a/gnu/lib/libg++/g++-include/abs.h +++ /dev/null @@ -1 +0,0 @@ -#include <builtin.h> diff --git a/gnu/lib/libg++/g++-include/bool.h b/gnu/lib/libg++/g++-include/bool.h deleted file mode 100644 index e843aa9c471..00000000000 --- a/gnu/lib/libg++/g++-include/bool.h +++ /dev/null @@ -1,10 +0,0 @@ - -#ifndef _bool_h -#ifdef __GNUG__ -#pragma once -#endif -#define _bool_h 1 - -enum bool { FALSE = 0, TRUE = 1 }; - -#endif diff --git a/gnu/lib/libg++/g++-include/builtin.h b/gnu/lib/libg++/g++-include/builtin.h deleted file mode 100644 index 904059b8af8..00000000000 --- a/gnu/lib/libg++/g++-include/builtin.h +++ /dev/null @@ -1,276 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- - -/* -Copyright (C) 1988 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -/* - arithmetic, etc. functions on built in types -*/ - - -#ifndef _builtin_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _builtin_h 1 - - -typedef void (*one_arg_error_handler_t)(const char*); -typedef void (*two_arg_error_handler_t)(const char*, const char*); - - - -#include <stddef.h> -#include <std.h> -#include <math.h> - -long gcd(long, long); -long lg(unsigned long); -double pow(double, long); -long pow(long, long); - -double start_timer(); -double return_elapsed_time(double last_time = 0.0); - -char* itoa(long x, int base = 10, int width = 0); -char* itoa(unsigned long x, int base = 10, int width = 0); -#ifdef __GNUG__ -char* itoa(long long x, int base = 10, int width = 0); -char* itoa(unsigned long long x, int base = 10, int width = 0); -#endif -char* dtoa(double x, char cvt = 'g', int width = 0, int prec = 6); - -char* hex(long x, int width = 0); -char* hex(unsigned long x, int width = 0); -char* hex(int x, int width = 0); -char* hex(short x, int width = 0); -char* hex(unsigned int x, int width = 0); -char* hex(unsigned short x, int width = 0); - -char* oct(long x, int width = 0); -char* oct(unsigned long x, int width = 0); -char* oct(int x, int width = 0); -char* oct(short x, int width = 0); -char* oct(unsigned int x, int width = 0) ; -char* oct(unsigned short x, int width = 0); - -char* dec(long x, int width = 0); -char* dec(unsigned long x, int width = 0); -char* dec(int x, int width = 0); -char* dec(short x, int width = 0); -char* dec(unsigned int x, int width = 0) ; -char* dec(unsigned short x, int width = 0); - -char* form(const char* fmt ...); -char* chr(char ch, int width = 0); -char* str(const char* s, int width = 0); - -unsigned int hashpjw(const char*); -unsigned int multiplicativehash(int); -unsigned int foldhash(double); - -extern void default_one_arg_error_handler(const char*); -extern void default_two_arg_error_handler(const char*, const char*); - -extern two_arg_error_handler_t lib_error_handler; - -extern two_arg_error_handler_t - set_lib_error_handler(two_arg_error_handler_t f); - - -double abs(double arg); -float abs(float arg); -short abs(short arg); -long abs(long arg); -int sign(long arg); -int sign(double arg); -long sqr(long arg); -double sqr(double arg); -int even(long arg); -int odd(long arg); -long lcm(long x, long y); -void setbit(long& x, long b); -void clearbit(long& x, long b); -int testbit(long x, long b); - -signed char min(signed char a, signed char b); -unsigned char min(unsigned char a, unsigned char b); - -signed short min(signed short a, signed short b); -unsigned short min(unsigned short a, unsigned short b); - -signed int min(signed int a, signed int b); -unsigned int min(unsigned int a, unsigned int b); - -signed long min(signed long a, signed long b); -unsigned long min(unsigned long a, unsigned long b); - -float min(float a, float b); - -double min(double a, double b); - -signed char max(signed char a, signed char b); -unsigned char max(unsigned char a, unsigned char b); - -signed short max(signed short a, signed short b); -unsigned short max(unsigned short a, unsigned short b); - -signed int max(signed int a, signed int b); -unsigned int max(unsigned int a, unsigned int b); - -signed long max(signed long a, signed long b); -unsigned long max(unsigned long a, unsigned long b); - -float max(float a, float b); - -double max(double a, double b); - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - - -inline double abs(double arg) -{ - return (arg < 0.0)? -arg : arg; -} - -inline float abs(float arg) -{ - return (arg < 0.0)? -arg : arg; -} - -inline short abs(short arg) -{ - return (arg < 0)? -arg : arg; -} - -inline long abs(long arg) -{ - return (arg < 0)? -arg : arg; -} - -inline int sign(long arg) -{ - return (arg == 0) ? 0 : ( (arg > 0) ? 1 : -1 ); -} - -inline int sign(double arg) -{ - return (arg == 0.0) ? 0 : ( (arg > 0.0) ? 1 : -1 ); -} - -inline long sqr(long arg) -{ - return arg * arg; -} - -inline double sqr(double arg) -{ - return arg * arg; -} - -inline int even(long arg) -{ - return !(arg & 1); -} - -inline int odd(long arg) -{ - return (arg & 1); -} - -inline long lcm(long x, long y) -{ - return x / gcd(x, y) * y; -} - -inline void setbit(long& x, long b) -{ - x |= (1 << b); -} - -inline void clearbit(long& x, long b) -{ - x &= ~(1 << b); -} - -inline int testbit(long x, long b) -{ - return ((x & (1 << b)) != 0); -} - -inline char* hex(int x, int width = 0) { return hex(long(x), width); } -inline char* hex(short x, int width = 0) { return hex(long(x), width); } -inline char* hex(unsigned int x, int width = 0) -{ return hex((unsigned long)(x), width); } -inline char* hex(unsigned short x, int width = 0) -{ return hex((unsigned long)(x), width); } - -inline char* oct(int x, int width = 0) { return oct(long(x), width); } -inline char* oct(short x, int width = 0) { return oct(long(x), width); } -inline char* oct(unsigned int x, int width = 0) -{ return oct((unsigned long)(x), width); } -inline char* oct(unsigned short x, int width = 0) -{ return oct((unsigned long)(x), width); } - -inline char* dec(int x, int width = 0) { return dec(long(x), width); } -inline char* dec(short x, int width = 0) { return dec(long(x), width); } -inline char* dec(unsigned int x, int width = 0) -{ return dec((unsigned long)(x), width); } -inline char* dec(unsigned short x, int width = 0) -{ return dec((unsigned long)(x), width); } - -inline signed char min(signed char a, signed char b) { return (a < b)?a:b;} -inline unsigned char min(unsigned char a, unsigned char b) {return (a < b)?a:b;} - -inline signed short min(signed short a, signed short b) {return (a < b) ?a:b;} -inline unsigned short min(unsigned short a, unsigned short b) {return (a < b)?a:b;} - -inline signed int min(signed int a, signed int b) {return (a < b)?a:b;} -inline unsigned int min(unsigned int a, unsigned int b) {return (a < b)?a:b;} - -inline signed long min(signed long a, signed long b) {return (a < b)?a:b;} -inline unsigned long min(unsigned long a, unsigned long b) {return (a < b)?a:b;} - -inline float min(float a, float b) {return (a < b)?a:b;} - -inline double min(double a, double b) {return (a < b)?a:b;} - -inline signed char max(signed char a, signed char b) { return (a > b)?a:b;} -inline unsigned char max(unsigned char a, unsigned char b) {return (a > b)?a:b;} - -inline signed short max(signed short a, signed short b) {return (a > b) ?a:b;} -inline unsigned short max(unsigned short a, unsigned short b) {return (a > b)?a:b;} - -inline signed int max(signed int a, signed int b) {return (a > b)?a:b;} -inline unsigned int max(unsigned int a, unsigned int b) {return (a > b)?a:b;} - -inline signed long max(signed long a, signed long b) {return (a > b)?a:b;} -inline unsigned long max(unsigned long a, unsigned long b) {return (a > b)?a:b;} - -inline float max(float a, float b) {return (a > b)?a:b;} - -inline double max(double a, double b) {return (a > b)?a:b;} - -#endif - -#endif diff --git a/gnu/lib/libg++/g++-include/compare.h b/gnu/lib/libg++/g++-include/compare.h deleted file mode 100644 index e298e2f1957..00000000000 --- a/gnu/lib/libg++/g++-include/compare.h +++ /dev/null @@ -1,98 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- - -/* -Copyright (C) 1988 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -#ifndef _compare_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _compare_h 1 - -#include <builtin.h> - -int compare(int a, int b); -int compare(short a, short b); -int compare(char a, char b); -int compare(unsigned long a, unsigned long b); -int compare(unsigned int a, unsigned int b); -int compare(unsigned short a, unsigned short b); -int compare(unsigned char a, unsigned char b); -int compare(float a, float b); -int compare(double a, double b); -int compare(const char* a, const char* b); - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - -inline int compare(int a, int b) -{ - return a - b; -} - -inline int compare(short a, short b) -{ - return a - b; -} - -inline int compare(char a, char b) -{ - return a - b; -} - -inline int compare(unsigned long a, unsigned long b) -{ - return (a < b)? -1 : (a > b)? 1 : 0; -} - -inline int compare(unsigned int a, unsigned int b) -{ - return (a < b)? -1 : (a > b)? 1 : 0; -} - -inline int compare(unsigned short a, unsigned short b) -{ - return (a < b)? -1 : (a > b)? 1 : 0; -} - -inline int compare(unsigned char a, unsigned char b) -{ - return (a < b)? -1 : (a > b)? 1 : 0; -} - -inline int compare(float a, float b) -{ - return (a < b)? -1 : (a > b)? 1 : 0; -} - -inline int compare(double a, double b) -{ - return (a < b)? -1 : (a > b)? 1 : 0; -} - -inline int compare(const char* a, const char* b) -{ - return strcmp(a,b); -} - -#endif -#endif diff --git a/gnu/lib/libg++/g++-include/complex.h b/gnu/lib/libg++/g++-include/complex.h deleted file mode 100644 index 1411c22f0c0..00000000000 --- a/gnu/lib/libg++/g++-include/complex.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _complex_h -#ifdef __GNUG__ -#pragma once -#endif -#define _complex_h -#define __ATT_complex__ -#include <Complex.h> -typedef class Complex complex; -#endif diff --git a/gnu/lib/libg++/g++-include/fcntl.h b/gnu/lib/libg++/g++-include/fcntl.h deleted file mode 100644 index 8fab80af867..00000000000 --- a/gnu/lib/libg++/g++-include/fcntl.h +++ /dev/null @@ -1,31 +0,0 @@ -// $Id: fcntl.h,v 1.2 1993/08/02 17:22:07 mycroft Exp $ - -#ifndef fcntl_h - -extern "C" { - -#ifdef __fcntl_h_recursive -#include_next <fcntl.h> -#else -#define fcntl __hide_fcntl -#define open __hide_open -#define creat __hide_creat - -#define __fcntl_h_recursive -#include <_G_config.h> -#include_next <fcntl.h> - -#undef fcntl -#undef open -#undef creat - -#define fcntl_h 1 - -int fcntl(int, int, ...); -int creat _G_ARGS((const char*, unsigned short int)); - -int open _G_ARGS((const char*, int, ...)); - -#endif -} -#endif diff --git a/gnu/lib/libg++/g++-include/file.h b/gnu/lib/libg++/g++-include/file.h deleted file mode 100644 index ca112456ea1..00000000000 --- a/gnu/lib/libg++/g++-include/file.h +++ /dev/null @@ -1,8 +0,0 @@ - -#ifndef file_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#include <sys/file.h> -#endif diff --git a/gnu/lib/libg++/g++-include/filebuf.h b/gnu/lib/libg++/g++-include/filebuf.h deleted file mode 100644 index 9cf35ccadb0..00000000000 --- a/gnu/lib/libg++/g++-include/filebuf.h +++ /dev/null @@ -1,63 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -#ifndef _filebuf_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _filebuf_h 1 - -#include <streambuf.h> -#include <stdio.h> - -class filebuf: public streambuf -{ -public: - int fd; - char opened; - - int overflow(int c = EOF); - int underflow(); - - filebuf(); - filebuf(int newfd); - filebuf(int newfd, char* buf, int buflen); - filebuf(const char* filename, io_mode m, access_mode a); - filebuf(const char* filename, const char* m); - filebuf(int filedesc, io_mode m); - filebuf(FILE* fileptr); - - ~filebuf(); - - streambuf* open(const char* name, open_mode m); - streambuf* open(const char* filename, io_mode m, access_mode a); - streambuf* open(const char* filename, const char* m); - streambuf* open(int filedesc, io_mode m); - streambuf* open(FILE* fileptr); - int is_open(); - int close(); -}; - - -#endif diff --git a/gnu/lib/libg++/g++-include/generic.h b/gnu/lib/libg++/g++-include/generic.h deleted file mode 100644 index 743a26dcbcb..00000000000 --- a/gnu/lib/libg++/g++-include/generic.h +++ /dev/null @@ -1,63 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -#ifndef generic_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define generic_h 1 - -/* - * See the CPP manual, argument prescan section for explanation - */ - -#define name2(a,b) gEnErIc2(a,b) -#define gEnErIc2(a,b) a ## b - -#define name3(a,b,c) gEnErIc3(a,b,c) -#define gEnErIc3(a,b,c) a ## b ## c - -#define name4(a,b,c,d) gEnErIc4(a,b,c,d) -#define gEnErIc4(a,b,c,d) a ## b ## c ## d - -#define GENERIC_STRING(a) gEnErIcStRiNg(a) -#define gEnErIcStRiNg(a) #a - -#define declare(clas,t) name2(clas,declare)(t) -#define declare2(clas,t1,t2) name2(clas,declare2)(t1,t2) - -#define implement(clas,t) name2(clas,implement)(t) -#define implement2(clas,t1,t2) name2(clas,implement2)(t1,t2) - -extern genericerror(int,char*); -typedef int (*GPT)(int,char*); - -#define set_handler(gen,type,x) name4(set_,type,gen,_handler)(x) - -#define errorhandler(gen,type) name3(type,gen,handler) - -#define callerror(gen,type,a,b) (*errorhandler(gen,type))(a,b) - - -#endif generic_h diff --git a/gnu/lib/libg++/g++-include/grp.h b/gnu/lib/libg++/g++-include/grp.h deleted file mode 100644 index d5ccbb7aa3d..00000000000 --- a/gnu/lib/libg++/g++-include/grp.h +++ /dev/null @@ -1,43 +0,0 @@ -// $Id: grp.h,v 1.3 1993/08/14 22:07:30 mycroft Exp $ - -#ifndef grp_h - -extern "C" { - -#ifdef __grp_h_recursive -#include_next <grp.h> -#else -#define __grp_h_recursive - -#include <stdio.h> - -#define getgrent c_proto_getgrent -#define getgrgid c_proto_getgrgid -#define getgrnam c_proto_getgrnam -#define setgrent c_proto_setgrent -#define endgrent c_proto_endgrent -#define fgetgrent c_proto_fgetgrent - -#include_next <grp.h> - -#define grp_h 1 - -#undef getgrent -#undef getgrgid -#undef getgrnam - -extern struct group* getgrent(); -extern struct group* fgetgrent(FILE*); -extern struct group* getgrgid(int); -extern struct group* getgrnam(const char*); -#if defined(__OSF1__) || defined (__NetBSD__) -extern int setgrent(); -#else -extern void setgrent(); -#endif -extern void endgrent(); - -#endif -} - -#endif diff --git a/gnu/lib/libg++/g++-include/istream.h b/gnu/lib/libg++/g++-include/istream.h deleted file mode 100644 index 1fa10fe594a..00000000000 --- a/gnu/lib/libg++/g++-include/istream.h +++ /dev/null @@ -1,259 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1989 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -/* *** Version 1.2 -- nearly 100% AT&T 1.2 compatible *** */ - -/* istream.h now separately includable */ - -#ifndef _istream_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _istream_h 1 - - -#include <File.h> -#include <streambuf.h> -#include <filebuf.h> -#include <Filebuf.h> - -class whitespace // a class used only to input and -{ // discard white space characters - char filler; -}; - -class ostream; - -class istream -{ - friend void eatwhite(istream& s); -protected: - streambuf* bp; - state_value state; // _good/_eof/_fail/_bad - ostream* tied_to; - char skipws; - char ownbuf; - void _flush(); - char* readline (int chunk_number, char terminator); - -public: - istream(const char* filename, io_mode m, access_mode a, - int sk=1, ostream* t = 0); - istream(const char* filename, const char* m, - int sk=1, ostream* t = 0); - istream(int filedesc, io_mode m, int sk=1, ostream* t = 0); - istream(FILE* fileptr, int sk=1, ostream* t = 0); - istream(int sz, char* buf, int sk=1, ostream* t = 0); - istream(int filedesc, int sk=1, ostream* t = 0); - istream(int filedesc, char* buf, int buflen, - int sk, ostream* t = 0); - istream(streambuf* s, int sk=1, ostream* t = 0); - - ~istream(); - - istream& open(const char* filename, io_mode m, access_mode a); - istream& open(const char* filename, const char* m); - istream& open(int filedesc, io_mode m); - istream& open(FILE* fileptr); - istream& open(const char* filenam, open_mode m); - - istream& close(); - - ostream* tie(ostream* s); - int skip(int); - -// stream status - - int rdstate(); - int eof(); - int fail(); - int bad(); - int good(); - -// other status queries - - int readable(); - int writable(); - int is_open(); - - operator void*(); - int operator !(); - - const char* name(); - - char* bufptr(); - -// error handling - - void error(); - void clear(state_value f = _good); // poorly named - void set(state_value f); // set corresponding bit - void unset(state_value f); // clear corresponding bit - istream& failif(int cond); - -// unformatted IO - - istream& get(char& c); - istream& unget(char c); - istream& putback(char c); // a synonym for unget - - istream& get (char* s, int n, char terminator = '\n'); - istream& getline(char* s, int n, char terminator = '\n'); - istream& gets (char **s, char terminator = '\n'); - - - istream& operator >> (char& c); - istream& operator >> (short& n); - istream& operator >> (unsigned short& n); - istream& operator >> (int& n); - istream& operator >> (unsigned int& n); - istream& operator >> (long& n); - istream& operator >> (unsigned long& n); -#ifdef __GNUG__ - istream& operator >> (long long& n); - istream& operator >> (unsigned long long& n); -#endif - istream& operator >> (float& n); - istream& operator >> (double& n); - istream& operator >> (char* s); - istream& operator >> (whitespace& w); -}; - -// pre-declared streams - -extern istream cin; // stdin - -extern whitespace WS; // for convenience - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - - -inline void istream::clear(state_value flag) -{ - state = flag; -} - -inline void istream::set(state_value flag) -{ - state = state_value(int(state) | int(flag)); -} - -inline void istream::unset(state_value flag) -{ - state = state_value(int(state) & ~int(flag)); -} - -inline int istream::rdstate() -{ - return int(state); -} - -inline int istream::good() -{ - return state == _good; -} - -inline int istream::eof() -{ - return int(state) & int(_eof); -} - -inline int istream::fail() -{ - return int(state) & int(_fail); -} - -inline int istream::bad() -{ - return int(state) & int(_bad); -} - -inline istream::operator void*() -{ - return (state == _good)? this : 0; -} - -inline int istream::operator !() -{ - return (state != _good); -} - -inline istream& istream::failif(int cond) -{ - if (cond) set(_fail); return *this; -} - -inline int istream::is_open() -{ - return bp->is_open(); -} - -inline int istream::readable() -{ - return (bp != 0) && (bp->is_open()) && (state == _good); -} - -inline int istream::writable() -{ - return 0; -} - - -inline char* istream::bufptr() -{ - return bp->base; -} - - -inline istream& istream::close() -{ - bp->close(); return *this; -} - - -inline int istream::skip(int sk) -{ - int was = skipws; skipws = sk; return was; -} - - -inline istream& istream::unget(char c) -{ - if (bp->sputbackc(c) == EOF) set(_fail); return *this; -} - -inline istream& istream::putback(char c) -{ - if (bp->sputbackc(c) == EOF) set(_fail); return *this; -} - -inline void eatwhite(istream& s) -{ - s >> WS; -} - -#endif - - -#endif diff --git a/gnu/lib/libg++/g++-include/malloc.h b/gnu/lib/libg++/g++-include/malloc.h deleted file mode 100644 index dff79ed6b0e..00000000000 --- a/gnu/lib/libg++/g++-include/malloc.h +++ /dev/null @@ -1 +0,0 @@ -#include <std.h> diff --git a/gnu/lib/libg++/g++-include/math-68881.h b/gnu/lib/libg++/g++-include/math-68881.h deleted file mode 100644 index f57494d4641..00000000000 --- a/gnu/lib/libg++/g++-include/math-68881.h +++ /dev/null @@ -1,518 +0,0 @@ -/******************************************************************\ -* * -* <math-68881.h> last modified: 23 May 1992. * -* * -* Copyright (C) 1989 by Matthew Self. * -* You may freely distribute verbatim copies of this software * -* provided that this copyright notice is retained in all copies. * -* You may distribute modifications to this software under the * -* conditions above if you also clearly note such modifications * -* with their author and date. * -* * -* Note: errno is not set to EDOM when domain errors occur for * -* most of these functions. Rather, it is assumed that the * -* 68881's OPERR exception will be enabled and handled * -* appropriately by the operating system. Similarly, overflow * -* and underflow do not set errno to ERANGE. * -* * -* Send bugs to Matthew Self (self@bayes.arc.nasa.gov). * -* * -* $Id: math-68881.h,v 1.1 1993/08/14 22:38:25 mycroft Exp $ * -* * -\******************************************************************/ - -/* If you find this in GCC, - please send bug reports to bug-gcc@prep.ai.mit.edu. */ - -/* Changed by Richard Stallman: % inserted before a #. - New function `hypot' added. - Nans written in hex to avoid 0rnan. - May 1992, use %! for fpcr register. Break lines before function names. - December 1989, add parens around `&' in pow. - November 1990, added alternate definition of HUGE_VAL for Sun. */ - -#include <errno.h> - -#ifndef HUGE_VAL -#ifdef __sun__ -/* The Sun assembler fails to handle the hex constant in the usual defn. */ -#define HUGE_VAL \ -({ \ - static union { int i[2]; double d; } u = { {0x7ff00000, 0} }; \ - u.d; \ -}) -#else -#define HUGE_VAL \ -({ \ - double huge_val; \ - \ - __asm ("fmove%.d %#0x7ff0000000000000,%0" /* Infinity */ \ - : "=f" (huge_val) \ - : /* no inputs */); \ - huge_val; \ -}) -#endif -#endif - -__inline static const double -sin (double x) -{ - double value; - - __asm ("fsin%.x %1,%0" - : "=f" (value) - : "f" (x)); - return value; -} - -__inline static const double -cos (double x) -{ - double value; - - __asm ("fcos%.x %1,%0" - : "=f" (value) - : "f" (x)); - return value; -} - -__inline static const double -tan (double x) -{ - double value; - - __asm ("ftan%.x %1,%0" - : "=f" (value) - : "f" (x)); - return value; -} - -__inline static const double -asin (double x) -{ - double value; - - __asm ("fasin%.x %1,%0" - : "=f" (value) - : "f" (x)); - return value; -} - -__inline static const double -acos (double x) -{ - double value; - - __asm ("facos%.x %1,%0" - : "=f" (value) - : "f" (x)); - return value; -} - -__inline static const double -atan (double x) -{ - double value; - - __asm ("fatan%.x %1,%0" - : "=f" (value) - : "f" (x)); - return value; -} - -__inline static const double -atan2 (double y, double x) -{ - double pi, pi_over_2; - - __asm ("fmovecr%.x %#0,%0" /* extended precision pi */ - : "=f" (pi) - : /* no inputs */ ); - __asm ("fscale%.b %#-1,%0" /* no loss of accuracy */ - : "=f" (pi_over_2) - : "0" (pi)); - if (x > 0) - { - if (y > 0) - { - if (x > y) - return atan (y / x); - else - return pi_over_2 - atan (x / y); - } - else - { - if (x > -y) - return atan (y / x); - else - return - pi_over_2 - atan (x / y); - } - } - else - { - if (y > 0) - { - if (-x > y) - return pi + atan (y / x); - else - return pi_over_2 - atan (x / y); - } - else - { - if (-x > -y) - return - pi + atan (y / x); - else if (y < 0) - return - pi_over_2 - atan (x / y); - else - { - double value; - - errno = EDOM; - __asm ("fmove%.d %#0x7fffffffffffffff,%0" /* quiet NaN */ - : "=f" (value) - : /* no inputs */); - return value; - } - } - } -} - -__inline static const double -sinh (double x) -{ - double value; - - __asm ("fsinh%.x %1,%0" - : "=f" (value) - : "f" (x)); - return value; -} - -__inline static const double -cosh (double x) -{ - double value; - - __asm ("fcosh%.x %1,%0" - : "=f" (value) - : "f" (x)); - return value; -} - -__inline static const double -tanh (double x) -{ - double value; - - __asm ("ftanh%.x %1,%0" - : "=f" (value) - : "f" (x)); - return value; -} - -__inline static const double -atanh (double x) -{ - double value; - - __asm ("fatanh%.x %1,%0" - : "=f" (value) - : "f" (x)); - return value; -} - -__inline static const double -exp (double x) -{ - double value; - - __asm ("fetox%.x %1,%0" - : "=f" (value) - : "f" (x)); - return value; -} - -__inline static const double -expm1 (double x) -{ - double value; - - __asm ("fetoxm1%.x %1,%0" - : "=f" (value) - : "f" (x)); - return value; -} - -__inline static const double -log (double x) -{ - double value; - - __asm ("flogn%.x %1,%0" - : "=f" (value) - : "f" (x)); - return value; -} - -__inline static const double -log1p (double x) -{ - double value; - - __asm ("flognp1%.x %1,%0" - : "=f" (value) - : "f" (x)); - return value; -} - -__inline static const double -log10 (double x) -{ - double value; - - __asm ("flog10%.x %1,%0" - : "=f" (value) - : "f" (x)); - return value; -} - -__inline static const double -sqrt (double x) -{ - double value; - - __asm ("fsqrt%.x %1,%0" - : "=f" (value) - : "f" (x)); - return value; -} - -__inline static const double -hypot (const double x, const double y) -{ - return sqrt (x*x + y*y); -} - -__inline static const double -pow (const double x, const double y) -{ - if (x > 0) - return exp (y * log (x)); - else if (x == 0) - { - if (y > 0) - return 0.0; - else - { - double value; - - errno = EDOM; - __asm ("fmove%.d %#0x7fffffffffffffff,%0" /* quiet NaN */ - : "=f" (value) - : /* no inputs */); - return value; - } - } - else - { - double temp; - - __asm ("fintrz%.x %1,%0" - : "=f" (temp) /* integer-valued float */ - : "f" (y)); - if (y == temp) - { - int i = (int) y; - - if ((i & 1) == 0) /* even */ - return exp (y * log (-x)); - else - return - exp (y * log (-x)); - } - else - { - double value; - - errno = EDOM; - __asm ("fmove%.d %#0x7fffffffffffffff,%0" /* quiet NaN */ - : "=f" (value) - : /* no inputs */); - return value; - } - } -} - -__inline static const double -fabs (double x) -{ - double value; - - __asm ("fabs%.x %1,%0" - : "=f" (value) - : "f" (x)); - return value; -} - -__inline static const double -ceil (double x) -{ - int rounding_mode, round_up; - double value; - - __asm volatile ("fmove%.l %!,%0" - : "=dm" (rounding_mode) - : /* no inputs */ ); - round_up = rounding_mode | 0x30; - __asm volatile ("fmove%.l %0,%!" - : /* no outputs */ - : "dmi" (round_up)); - __asm volatile ("fint%.x %1,%0" - : "=f" (value) - : "f" (x)); - __asm volatile ("fmove%.l %0,%!" - : /* no outputs */ - : "dmi" (rounding_mode)); - return value; -} - -__inline static const double -floor (double x) -{ - int rounding_mode, round_down; - double value; - - __asm volatile ("fmove%.l %!,%0" - : "=dm" (rounding_mode) - : /* no inputs */ ); - round_down = (rounding_mode & ~0x10) - | 0x20; - __asm volatile ("fmove%.l %0,%!" - : /* no outputs */ - : "dmi" (round_down)); - __asm volatile ("fint%.x %1,%0" - : "=f" (value) - : "f" (x)); - __asm volatile ("fmove%.l %0,%!" - : /* no outputs */ - : "dmi" (rounding_mode)); - return value; -} - -__inline static const double -rint (double x) -{ - int rounding_mode, round_nearest; - double value; - - __asm volatile ("fmove%.l %!,%0" - : "=dm" (rounding_mode) - : /* no inputs */ ); - round_nearest = rounding_mode & ~0x30; - __asm volatile ("fmove%.l %0,%!" - : /* no outputs */ - : "dmi" (round_nearest)); - __asm volatile ("fint%.x %1,%0" - : "=f" (value) - : "f" (x)); - __asm volatile ("fmove%.l %0,%!" - : /* no outputs */ - : "dmi" (rounding_mode)); - return value; -} - -__inline static const double -fmod (double x, double y) -{ - double value; - - __asm ("fmod%.x %2,%0" - : "=f" (value) - : "0" (x), - "f" (y)); - return value; -} - -__inline static const double -drem (double x, double y) -{ - double value; - - __asm ("frem%.x %2,%0" - : "=f" (value) - : "0" (x), - "f" (y)); - return value; -} - -__inline static const double -scalb (double x, int n) -{ - double value; - - __asm ("fscale%.l %2,%0" - : "=f" (value) - : "0" (x), - "dmi" (n)); - return value; -} - -__inline static double -logb (double x) -{ - double exponent; - - __asm ("fgetexp%.x %1,%0" - : "=f" (exponent) - : "f" (x)); - return exponent; -} - -__inline static const double -ldexp (double x, int n) -{ - double value; - - __asm ("fscale%.l %2,%0" - : "=f" (value) - : "0" (x), - "dmi" (n)); - return value; -} - -__inline static double -frexp (double x, int *exp) -{ - double float_exponent; - int int_exponent; - double mantissa; - - __asm ("fgetexp%.x %1,%0" - : "=f" (float_exponent) /* integer-valued float */ - : "f" (x)); - int_exponent = (int) float_exponent; - __asm ("fgetman%.x %1,%0" - : "=f" (mantissa) /* 1.0 <= mantissa < 2.0 */ - : "f" (x)); - if (mantissa != 0) - { - __asm ("fscale%.b %#-1,%0" - : "=f" (mantissa) /* mantissa /= 2.0 */ - : "0" (mantissa)); - int_exponent += 1; - } - *exp = int_exponent; - return mantissa; -} - -__inline static double -modf (double x, double *ip) -{ - double temp; - - __asm ("fintrz%.x %1,%0" - : "=f" (temp) /* integer-valued float */ - : "f" (x)); - *ip = temp; - return x - temp; -} - diff --git a/gnu/lib/libg++/g++-include/math.h b/gnu/lib/libg++/g++-include/math.h deleted file mode 100644 index db39f3e00b4..00000000000 --- a/gnu/lib/libg++/g++-include/math.h +++ /dev/null @@ -1,223 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of the GNU C++ Library. This library is free -software; you can redistribute it and/or modify it under the terms of -the GNU Library General Public License as published by the Free -Software Foundation; either version 2 of the License, 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 Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with this library; if not, write to the Free Software -Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id: math.h,v 1.2 1993/08/02 17:22:08 mycroft Exp $ -*/ - - -#ifndef _math_h -#ifdef __GNUG__ -#pragma interface -#endif -#define _math_h 1 - -#if defined(hp300) && defined(__HAVE_FPU__) -#define __HAVE_68881__ 1 -#endif - -#if defined(masscomp) -#define __HAVE_68881__ 1 -#endif - -#ifdef __HAVE_68881__ /* MC68881/2 Floating-Point Coprocessor */ -extern "C" { /* fill in what we've left out */ -#include <math-68881.h> - -double acosh(double); -double asinh(double); -double cbrt(double); -double copysign(double,double); -double erf(double); -double erfc(double); -double finite(double); -double gamma(double); -double hypot(double,double); -double infnan(int); -int isinf(double); -int isnan(double); -double j0(double); -double j1(double); -double jn(int, double); -double lgamma(double); -double y0(double); -double y1(double); -double yn(int, double); - -double aint(double); -double anint(double); -int irint(double); -int nint(double); -} -/* Please add inline asm code for other machines here! */ -#else -extern "C" { - -#include <_G_config.h> - -double acos(double); -double acosh(double); -double asin(double); -double asinh(double); -double atan(double); -double atan2(double, double); -double atanh(double); -double cbrt(double); -double ceil(double); -double copysign(double,double); -double cos(double); -double cosh(double); -double drem(double,double); -double erf(double); -double erfc(double); -double exp(double); -double expm1(double); -double fabs(double); -int finite(double); -double floor(double); -double fmod(double, double); -double frexp(double, int*); -double gamma(double); -double hypot(double,double); -double infnan(int); -#if !defined(sequent) && !defined(DGUX) &&!defined(sony) && !defined(masscomp) && !defined(hpux) -/* see below */ -int isinf(double); -int isnan(double); -#endif -double j0(double); -double j1(double); -double jn(int, double); -double ldexp(double, int); -double lgamma(double); -double log(double); -double log10(double); -double log1p(double); -double logb(double); -double modf(double, double*); -double pow(double, double); -double rint(double); -double scalb _G_ARGS((double, int)); -double sin(double); -double sinh(double); -double sqrt(double); -double tan(double); -double tanh(double); -double y0(double); -double y1(double); -double yn(int, double); - -double aint(double); -double anint(double); -int irint(double); -int nint(double); -} - -#endif - -/* libg++ doesn't use this since it is not available on some systems */ - -/* the following ifdef is just for compiling OOPS */ - -#ifndef DONT_DECLARE_EXCEPTION -struct libm_exception -{ - int type; - char* name; - double arg1, arg2, retval; -}; - -#define DOMAIN 1 -#define SING 2 -#define OVERFLOW 3 -#define UNDERFLOW 4 -#define TLOSS 5 -#define PLOSS 6 - -extern "C" int matherr(libm_exception*); - -#endif - -#include <float.h> - -/* On some systems, HUGE ought to be MAXFLOAT or IEEE infinity */ - -#ifndef HUGE -#define HUGE DBL_MAX -#endif -#ifndef HUGE_VAL -#define HUGE_VAL DBL_MAX -#endif - - -/* sequents don't supply these. The following should suffice */ -#if defined(sequent) || defined(DGUX) || defined(sony) || defined(masscomp) \ -|| defined(hpux) -#include <float.h> -static inline int isnan(double x) { return x != x; } -static inline int isinf(double x) { return x > DBL_MAX || x < -DBL_MAX; } -#endif - -/* These seem to be sun & sysV names of these constants */ - -#ifndef M_E -#define M_E 2.7182818284590452354 -#endif -#ifndef M_LOG2E -#define M_LOG2E 1.4426950408889634074 -#endif -#ifndef M_LOG10E -#define M_LOG10E 0.43429448190325182765 -#endif -#ifndef M_LN2 -#define M_LN2 0.69314718055994530942 -#endif -#ifndef M_LN10 -#define M_LN10 2.30258509299404568402 -#endif -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif -#ifndef M_PI_2 -#define M_PI_2 1.57079632679489661923 -#endif -#ifndef M_1_PI -#define M_1_PI 0.31830988618379067154 -#endif -#ifndef M_PI_4 -#define M_PI_4 0.78539816339744830962 -#endif -#ifndef M_2_PI -#define M_2_PI 0.63661977236758134308 -#endif -#ifndef M_2_SQRTPI -#define M_2_SQRTPI 1.12837916709551257390 -#endif -#ifndef M_SQRT2 -#define M_SQRT2 1.41421356237309504880 -#endif -#ifndef M_SQRT1_2 -#define M_SQRT1_2 0.70710678118654752440 -#endif - -#ifndef PI // as in stroustrup -#define PI M_PI -#endif -#ifndef PI2 -#define PI2 M_PI_2 -#endif - -#endif diff --git a/gnu/lib/libg++/g++-include/max.h b/gnu/lib/libg++/g++-include/max.h deleted file mode 100644 index 8c2c8f98ced..00000000000 --- a/gnu/lib/libg++/g++-include/max.h +++ /dev/null @@ -1 +0,0 @@ -#include <builtin.h> diff --git a/gnu/lib/libg++/g++-include/memory.h b/gnu/lib/libg++/g++-include/memory.h deleted file mode 100644 index b54cecb9f47..00000000000 --- a/gnu/lib/libg++/g++-include/memory.h +++ /dev/null @@ -1,43 +0,0 @@ -// $Id: memory.h,v 1.3 1993/08/14 22:07:31 mycroft Exp $ - -#ifndef _memory_h -#define _memory_h 1 - -#include "_G_config.h" -#include <stddef.h> - -extern "C" { - -void* memalign _G_ARGS((_G_size_t, _G_size_t)); -void* memccpy _G_ARGS((void*, const void*, int, _G_size_t)); -void* memchr _G_ARGS((const void*, int, _G_size_t)); -int memcmp _G_ARGS((const void*, const void*, _G_size_t)); -void* memcpy _G_ARGS((void*, const void*, _G_size_t)); -void* memmove _G_ARGS((void*, const void*, _G_size_t)); -void* memset _G_ARGS((void*, int, _G_size_t)); -int ffs _G_ARGS((int)); -#if defined(__OSF1__) || defined(__NetBSD__) -int getpagesize _G_ARGS((void)); -#else -_G_size_t getpagesize _G_ARGS((void)); -#endif -void* valloc _G_ARGS((_G_size_t)); - -void bcopy _G_ARGS((const void*, void*, _G_size_t)); -int bcmp _G_ARGS((const void*, const void*, int)); -void bzero _G_ARGS((void*, int)); -} - -#ifdef __GNUG__ -#ifndef alloca -#define alloca(x) __builtin_alloca(x) -#endif -#else -#ifndef IV -extern "C" void* alloca(_G_size_t); -#else -extern "C" void* alloca(unsigned long); -#endif /* IV */ -#endif - -#endif diff --git a/gnu/lib/libg++/g++-include/min.h b/gnu/lib/libg++/g++-include/min.h deleted file mode 100644 index 8c2c8f98ced..00000000000 --- a/gnu/lib/libg++/g++-include/min.h +++ /dev/null @@ -1 +0,0 @@ -#include <builtin.h> diff --git a/gnu/lib/libg++/g++-include/minmax.h b/gnu/lib/libg++/g++-include/minmax.h deleted file mode 100644 index 8c2c8f98ced..00000000000 --- a/gnu/lib/libg++/g++-include/minmax.h +++ /dev/null @@ -1 +0,0 @@ -#include <builtin.h> diff --git a/gnu/lib/libg++/g++-include/netdb.h b/gnu/lib/libg++/g++-include/netdb.h deleted file mode 100644 index 4c47550ba2d..00000000000 --- a/gnu/lib/libg++/g++-include/netdb.h +++ /dev/null @@ -1,6 +0,0 @@ -// $Id: netdb.h,v 1.2 1993/08/02 17:22:11 mycroft Exp $ - -extern "C" -{ -#include_next <netdb.h> -} diff --git a/gnu/lib/libg++/g++-include/new.h b/gnu/lib/libg++/g++-include/new.h deleted file mode 100644 index 95d86e02183..00000000000 --- a/gnu/lib/libg++/g++-include/new.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _new_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _new_h 1 - -#include <stddef.h> -#include <std.h> - -#ifndef NO_LIBGXX_MALLOC -#define MALLOC_ALIGN_MASK 7 /* ptrs aligned at 8 byte boundaries */ -#define MALLOC_MIN_OVERHEAD 8 /* 8 bytes of overhead per pointer */ -#endif - -typedef void (*new_handler_t)(); -extern "C" void default_new_handler(); -extern "C" new_handler_t set_new_handler(new_handler_t); - -#ifdef __GNUG__ -#define NEW(where) new { where } -#endif - -// default placement version of operator new -static inline void *operator new(size_t, void *place) { return place; } - -// provide a C++ interface to vector-resize via realloc -static inline void *operator new(size_t size, void *ptr, size_t new_len) -{ - return realloc(ptr, new_len * size); -} - -#endif diff --git a/gnu/lib/libg++/g++-include/open.h b/gnu/lib/libg++/g++-include/open.h deleted file mode 100644 index ffe81a15ac1..00000000000 --- a/gnu/lib/libg++/g++-include/open.h +++ /dev/null @@ -1,39 +0,0 @@ - -#ifndef _open_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _open_h 1 - -#include <File.h> -#include <sys/file.h> // needed to determine values of O_RDONLY... - -/* - - translation stuff for opening files. - -*/ - - -enum sys_open_cmd_io_mode // These should be correct for most systems -{ - sio_read = O_RDONLY, - sio_write = O_WRONLY, - sio_readwrite = O_RDWR, - sio_append = O_APPEND -}; - -enum sys_open_cmd_access_mode -{ - sa_create = O_CREAT, - sa_truncate = O_TRUNC, - sa_createonly = O_EXCL | O_CREAT -}; - - -int open_cmd_arg(io_mode i, access_mode a); // decode modes -char* fopen_cmd_arg(io_mode i); -int open_cmd_arg(const char* m); - -#endif diff --git a/gnu/lib/libg++/g++-include/osfcn.h b/gnu/lib/libg++/g++-include/osfcn.h deleted file mode 100644 index 52b3063586f..00000000000 --- a/gnu/lib/libg++/g++-include/osfcn.h +++ /dev/null @@ -1,4 +0,0 @@ -#include <errno.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> diff --git a/gnu/lib/libg++/g++-include/ostream.h b/gnu/lib/libg++/g++-include/ostream.h deleted file mode 100644 index 3bf30d735d6..00000000000 --- a/gnu/lib/libg++/g++-include/ostream.h +++ /dev/null @@ -1,256 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1989 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -/* *** Version 1.2 -- nearly 100% AT&T 1.2 compatible *** */ - -/* ostream.h now separately includable */ - -#ifndef _ostream_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _ostream_h 1 - -/* uncomment the next line to disable ostream << char */ -//#define NO_OUTPUT_CHAR - - -#include <File.h> -#include <streambuf.h> -#include <filebuf.h> -#include <Filebuf.h> - -class istream; - -class ostream -{ - friend class istream; -protected: - streambuf* bp; - state_value state; // _good/_eof/_fail/_bad - char ownbuf; // true if we own *bp - -public: - ostream(const char* filename, io_mode m, access_mode a); - ostream(const char* filename, const char* m); - ostream(int filedesc, io_mode m); - ostream(FILE* fileptr); - ostream(int sz, char* buf); - ostream(int filedesc, char* buf, int buflen); - ostream(int filedesc); - ostream(streambuf* s); - - ~ostream(); - - ostream& open(const char* filename, io_mode m, access_mode a); - ostream& open(const char* filename, const char* m); - ostream& open(int filedesc, io_mode m); - ostream& open(FILE* fileptr); - ostream& open(const char* filenam, open_mode m); - - ostream& close(); - ostream& flush(); - -// stream status - - int rdstate(); - int eof(); - int fail(); - int bad(); - int good(); - -// other status queries - - int readable(); - int writable(); - int is_open(); - - operator void*(); - int operator !(); - - const char* name(); - - char* bufptr(); - -// error handling - - void error(); - void clear(state_value f = _good); // poorly named - void set(state_value f); // set corresponding bit - void unset(state_value); // clear corresponding bit - ostream& failif(int cond); - -// unformatted IO - - ostream& put(char c); - ostream& put(const char* s); - ostream& put(const char* s, int slen); - -// formatted IO - - ostream& form(const char* fmt, ...); - - ostream& operator << (short n); - ostream& operator << (unsigned short n); - ostream& operator << (int n); - ostream& operator << (unsigned int n); - ostream& operator << (long n); - ostream& operator << (unsigned long n); -#ifdef __GNUG__ - ostream& operator << (long long n); - ostream& operator << (unsigned long long n); -#endif __GNUG__ - ostream& operator << (float n); - ostream& operator << (double n); - ostream& operator << (const char* s); - ostream& operator << (const void* ptr); - -#ifndef NO_OUTPUT_CHAR - ostream& operator << (char c); -#endif - -}; - -extern ostream cout; // stdout -extern ostream cerr; // stderr - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - - -inline void ostream::clear(state_value flag) -{ - state = flag; -} - -inline void ostream::set(state_value flag) -{ - state = state_value(int(state) | int(flag)); -} - -inline void ostream::unset(state_value flag) -{ - state = state_value(int(state) & ~int(flag)); -} - -inline int ostream::rdstate() -{ - return int(state); -} - -inline int ostream::good() -{ - return state == _good; -} - -inline int ostream::eof() -{ - return int(state) & int(_eof); -} - -inline int ostream::fail() -{ - return int(state) & int(_fail); -} - -inline int ostream::bad() -{ - return int(state) & int(_bad); -} - -inline ostream::operator void*() -{ - return (state == _good)? this : 0; -} - -inline int ostream::operator !() -{ - return (state != _good); -} - -inline ostream& ostream::failif(int cond) -{ - if (cond) set(_fail); return *this; -} - -inline int ostream::is_open() -{ - return bp->is_open(); -} - -inline int ostream::readable() -{ - return 0; -} - -inline int ostream::writable() -{ - return (bp != 0) && (state == _good); -} - - -inline char* ostream::bufptr() -{ - return bp->base; -} - -inline ostream& ostream::flush() -{ - bp->overflow(); return *this; -} - -inline ostream& ostream::close() -{ - bp->overflow(); bp->close(); return *this; -} - -inline ostream& ostream::put(char ch) -{ - return failif((state != _good) || bp->sputc((int)ch &0xff) == EOF); -} - -#ifndef NO_OUTPUT_CHAR -inline ostream& ostream::operator << (char ch) -{ - return failif((state != _good) || bp->sputc((int)ch &0xff) == EOF); -} -#endif - -inline ostream& ostream::put(const char* s) -{ - return failif((state != _good) || bp->sputs(s) == EOF); -} - -inline ostream& ostream::put(const char* s, int len) -{ - return failif((state != _good) || bp->sputsn(s, len) == EOF); -} - -inline ostream& ostream::operator << (const char* s) -{ - return failif((state != _good) || bp->sputs(s) == EOF); -} - -#endif - -#endif diff --git a/gnu/lib/libg++/g++-include/pwd.h b/gnu/lib/libg++/g++-include/pwd.h deleted file mode 100644 index f39267f2bf1..00000000000 --- a/gnu/lib/libg++/g++-include/pwd.h +++ /dev/null @@ -1,38 +0,0 @@ -// $Id: pwd.h,v 1.2 1993/08/02 17:22:12 mycroft Exp $ - -#ifndef _pwd_h - -// the Interviews-based standard kludge again - -extern "C" { - -#ifdef __pwd_h_recursive -#include_next <pwd.h> -#else -#define getpwent c_proto_getpwent -#define getpwuid c_proto_getpwuid -#define getpwnam c_proto_getpwnam -#define setpwent c_proto_setpwent -#define endpwent c_proto_endpwent - -#define __pwd_h_recursive -#include_next <pwd.h> - -#define _pwd_h 1 - -#undef getpwent -#undef getpwuid -#undef getpwnam -#undef setpwent -#undef endpwent - -extern struct passwd* getpwent(); -extern struct passwd* getpwuid(int); -extern struct passwd* getpwnam(const char*); -extern int setpwent(); -extern int endpwent(); - -#endif -} - -#endif diff --git a/gnu/lib/libg++/g++-include/regex.h b/gnu/lib/libg++/g++-include/regex.h deleted file mode 100644 index e0252cb72d3..00000000000 --- a/gnu/lib/libg++/g++-include/regex.h +++ /dev/null @@ -1,280 +0,0 @@ -/* Definitions for data structures callers pass the regex library. - Copyright (C) 1985 Free Software Foundation, Inc. - - NO WARRANTY - - BECAUSE THIS PROGRAM IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY -NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW. EXCEPT -WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC, -RICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE THIS PROGRAM "AS IS" -WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY -AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M. -STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY -WHO MAY MODIFY AND REDISTRIBUTE THIS PROGRAM AS PERMITTED BELOW, BE -LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR -OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR -DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR -A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) THIS -PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. - - GENERAL PUBLIC LICENSE TO COPY - - 1. You may copy and distribute verbatim copies of this source file -as you receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy a valid copyright notice "Copyright -(C) 1985 Free Software Foundation, Inc."; and include following the -copyright notice a verbatim copy of the above disclaimer of warranty -and of this License. You may charge a distribution fee for the -physical act of transferring a copy. - - 2. You may modify your copy or copies of this source file or -any portion of it, and copy and distribute such modifications under -the terms of Paragraph 1 above, provided that you also do the following: - - a) cause the modified files to carry prominent notices stating - that you changed the files and the date of any change; and - - b) cause the whole of any work that you distribute or publish, - that in whole or in part contains or is a derivative of this - program or any part thereof, to be licensed at no charge to all - third parties on terms identical to those contained in this - License Agreement (except that you may choose to grant more extensive - warranty protection to some or all third parties, at your option). - - c) You may charge a distribution fee for the physical act of - transferring a copy, and you may at your option offer warranty - protection in exchange for a fee. - -Mere aggregation of another unrelated program with this program (or its -derivative) on a volume of a storage or distribution medium does not bring -the other program under the scope of these terms. - - 3. You may copy and distribute this program (or a portion or derivative -of it, under Paragraph 2) in object code or executable form under the terms -of Paragraphs 1 and 2 above provided that you also do one of the following: - - a) accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of - Paragraphs 1 and 2 above; or, - - b) accompany it with a written offer, valid for at least three - years, to give any third party free (except for a nominal - shipping charge) a complete machine-readable copy of the - corresponding source code, to be distributed under the terms of - Paragraphs 1 and 2 above; or, - - c) accompany it with the information you received as to where the - corresponding source code may be obtained. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form alone.) - -For an executable file, complete source code means all the source code for -all modules it contains; but, as a special exception, it need not include -source code for modules which are standard libraries that accompany the -operating system on which the executable file runs. - - 4. You may not copy, sublicense, distribute or transfer this program -except as expressly provided under this License Agreement. Any attempt -otherwise to copy, sublicense, distribute or transfer this program is void and -your rights to use the program under this License agreement shall be -automatically terminated. However, parties who have received computer -software programs from you with this License Agreement will not have -their licenses terminated so long as such parties remain in full compliance. - - 5. If you wish to incorporate parts of this program into other free -programs whose distribution conditions are different, write to the Free -Software Foundation at 675 Mass Ave, Cambridge, MA 02139. We have not yet -worked out a simple rule that can be stated here, but we will often permit -this. We will be guided by the two goals of preserving the free status of -all derivatives of our free software and of promoting the sharing and reuse of -software. - - -In other words, you are welcome to use, share and improve this program. -You are forbidden to forbid anyone else to use, share and improve -what you give them. Help stamp out software-hoarding! */ - -#if defined(SHORT_NAMES) || defined(VMS) -#define re_compile_pattern recmppat -#define re_pattern_buffer repatbuf -#define re_registers reregs -#endif - -/* Define number of parens for which we record the beginnings and ends. - This affects how much space the `struct re_registers' type takes up. */ -#ifndef RE_NREGS -#define RE_NREGS 10 -#endif - -/* These bits are used in the obscure_syntax variable to choose among - alternative regexp syntaxes. */ - -/* 1 means plain parentheses serve as grouping, and backslash - parentheses are needed for literal searching. - 0 means backslash-parentheses are grouping, and plain parentheses - are for literal searching. */ -#define RE_NO_BK_PARENS 1 - -/* 1 means plain | serves as the "or"-operator, and \| is a literal. - 0 means \| serves as the "or"-operator, and | is a literal. */ -#define RE_NO_BK_VBAR 2 - -/* 0 means plain + or ? serves as an operator, and \+, \? are literals. - 1 means \+, \? are operators and plain +, ? are literals. */ -#define RE_BK_PLUS_QM 4 - -/* 1 means | binds tighter than ^ or $. - 0 means the contrary. */ -#define RE_TIGHT_VBAR 8 - -/* 1 means treat \n as an _OR operator - 0 means treat it as a normal character */ -#define RE_NEWLINE_OR 16 - -/* 0 means that a special characters (such as *, ^, and $) always have - their special meaning regardless of the surrounding context. - 1 means that special characters may act as normal characters in some - contexts. Specifically, this applies to: - ^ - only special at the beginning, or after ( or | - $ - only special at the end, or before ) or | - *, +, ? - only special when not after the beginning, (, or | */ -#define RE_CONTEXT_INDEP_OPS 32 - -/* Now define combinations of bits for the standard possibilities. */ -#define RE_SYNTAX_AWK (RE_NO_BK_PARENS | RE_NO_BK_VBAR | RE_CONTEXT_INDEP_OPS) -#define RE_SYNTAX_EGREP (RE_SYNTAX_AWK | RE_NEWLINE_OR) -#define RE_SYNTAX_GREP (RE_BK_PLUS_QM | RE_NEWLINE_OR) -#define RE_SYNTAX_EMACS 0 - -/* This data structure is used to represent a compiled pattern. */ - -struct re_pattern_buffer - { - char *buffer; /* Space holding the compiled pattern commands. */ - int allocated; /* Size of space that buffer points to */ - int used; /* Length of portion of buffer actually occupied */ - char *fastmap; /* Pointer to fastmap, if any, or zero if none. */ - /* re_search uses the fastmap, if there is one, - to skip quickly over totally implausible characters */ - char *translate; /* Translate table to apply to all characters before comparing. - Or zero for no translation. - The translation is applied to a pattern when it is compiled - and to data when it is matched. */ - char fastmap_accurate; - /* Set to zero when a new pattern is stored, - set to one when the fastmap is updated from it. */ - char can_be_null; /* Set to one by compiling fastmap - if this pattern might match the null string. - It does not necessarily match the null string - in that case, but if this is zero, it cannot. - 2 as value means can match null string - but at end of range or before a character - listed in the fastmap. */ - }; - -/* Structure to store "register" contents data in. - - Pass the address of such a structure as an argument to re_match, etc., - if you want this information back. - - start[i] and end[i] record the string matched by \( ... \) grouping i, - for i from 1 to RE_NREGS - 1. - start[0] and end[0] record the entire string matched. */ - -struct re_registers - { - int start[RE_NREGS]; - int end[RE_NREGS]; - }; - -/* These are the command codes that appear in compiled regular expressions, one per byte. - Some command codes are followed by argument bytes. - A command code can specify any interpretation whatever for its arguments. - Zero-bytes may appear in the compiled regular expression. */ - -enum regexpcode - { - unused, - exactn, /* followed by one byte giving n, and then by n literal bytes */ - begline, /* fails unless at beginning of line */ - endline, /* fails unless at end of line */ - jump, /* followed by two bytes giving relative address to jump to */ - on_failure_jump, /* followed by two bytes giving relative address of place - to resume at in case of failure. */ - finalize_jump, /* Throw away latest failure point and then jump to address. */ - maybe_finalize_jump, /* Like jump but finalize if safe to do so. - This is used to jump back to the beginning - of a repeat. If the command that follows - this jump is clearly incompatible with the - one at the beginning of the repeat, such that - we can be sure that there is no use backtracking - out of repetitions already completed, - then we finalize. */ - dummy_failure_jump, /* jump, and push a dummy failure point. - This failure point will be thrown away - if an attempt is made to use it for a failure. - A + construct makes this before the first repeat. */ - anychar, /* matches any one character */ - charset, /* matches any one char belonging to specified set. - First following byte is # bitmap bytes. - Then come bytes for a bit-map saying which chars are in. - Bits in each byte are ordered low-bit-first. - A character is in the set if its bit is 1. - A character too large to have a bit in the map - is automatically not in the set */ - charset_not, /* similar but match any character that is NOT one of those specified */ - start_memory, /* starts remembering the text that is matched - and stores it in a memory register. - followed by one byte containing the register number. - Register numbers must be in the range 0 through NREGS. */ - stop_memory, /* stops remembering the text that is matched - and stores it in a memory register. - followed by one byte containing the register number. - Register numbers must be in the range 0 through NREGS. */ - duplicate, /* match a duplicate of something remembered. - Followed by one byte containing the index of the memory register. */ - before_dot, /* Succeeds if before dot */ - at_dot, /* Succeeds if at dot */ - after_dot, /* Succeeds if after dot */ - begbuf, /* Succeeds if at beginning of buffer */ - endbuf, /* Succeeds if at end of buffer */ - wordchar, /* Matches any word-constituent character */ - notwordchar, /* Matches any char that is not a word-constituent */ - wordbeg, /* Succeeds if at word beginning */ - wordend, /* Succeeds if at word end */ - wordbound, /* Succeeds if at a word boundary */ - notwordbound, /* Succeeds if not at a word boundary */ - syntaxspec, /* Matches any character whose syntax is specified. - followed by a byte which contains a syntax code, Sword or such like */ - notsyntaxspec /* Matches any character whose syntax differs from the specified. */ - }; - - -extern char *re_compile_pattern (char*, int, struct re_pattern_buffer*); -/* Is this really advertised? */ -extern void re_compile_fastmap (struct re_pattern_buffer*); -extern int re_search(struct re_pattern_buffer*, char*, int, int, - int, struct re_registers*); -extern int re_search_2 (struct re_pattern_buffer*, char*, int, - char*, int, int, int, struct re_registers*, int); -extern int re_match (struct re_pattern_buffer*, char*, int, int, - struct re_registers*); -extern int re_match_2 (struct re_pattern_buffer*, unsigned char*, int, - unsigned char*, int, int, struct re_registers*, int); - -/* 4.2 bsd compatibility (yuck) */ -extern char *re_comp (char*); -extern int re_exec (char*); - -#ifdef SYNTAX_TABLE -extern char *re_syntax_table; -#endif - diff --git a/gnu/lib/libg++/g++-include/setjmp.h b/gnu/lib/libg++/g++-include/setjmp.h deleted file mode 100644 index 12bb1daac61..00000000000 --- a/gnu/lib/libg++/g++-include/setjmp.h +++ /dev/null @@ -1,31 +0,0 @@ -// $Id: setjmp.h,v 1.2 1993/08/02 17:22:13 mycroft Exp $ - -#ifndef _setjmp_h - -extern "C" { - -#ifdef __setjmp_h_recursive -#include_next <setjmp.h> -#else -#define __setjmp_h_recursive -#define setjmp C_header_setjmp -#define longjmp C_header_longjmp - -#ifdef VMS -#include "gnu_cc_include:[000000]setjmp.h" -#else -#include_next <setjmp.h> -#endif - -#undef setjmp -#undef longjmp - -#define _setjmp_h 1 - -extern int setjmp(jmp_buf); -extern void longjmp(jmp_buf, int); - -#endif -} - -#endif diff --git a/gnu/lib/libg++/g++-include/signal.h b/gnu/lib/libg++/g++-include/signal.h deleted file mode 100644 index 6ba7b5a0171..00000000000 --- a/gnu/lib/libg++/g++-include/signal.h +++ /dev/null @@ -1,82 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1989 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of the GNU C++ Library. This library is free -software; you can redistribute it and/or modify it under the terms of -the GNU Library General Public License as published by the Free -Software Foundation; either version 2 of the License, 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 Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with this library; if not, write to the Free Software -Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id: signal.h,v 1.3 1993/08/14 22:07:32 mycroft Exp $ -*/ - -#ifndef _signal_h - -#include <_G_config.h> - -extern "C" { - -#ifdef __signal_h_recursive -#include_next <signal.h> -#else - -#define __signal_h_recursive - -#define signal __hide_signal -#define psignal __hide_psignal -#include_next <signal.h> -#undef signal -#undef psignal - -#define _signal_h 1 - -// The Interviews folks call this SignalHandler. Might as well conform. -typedef _G_signal_return_type (*SignalHandler) (...); -typedef int (*SSignalHandler) (...); - -extern SignalHandler signal _G_ARGS((int sig, SignalHandler action)); -//extern SignalHandler sigset _G_ARGS((int sig, SignalHandler action)); -extern SSignalHandler ssignal _G_ARGS((int sig, SSignalHandler action)); -extern int gsignal _G_ARGS((int sig)); -extern int kill _G_ARGS((_G_pid_t pid, int sig)); -#ifndef __NetBSD__ -extern int killpg _G_ARGS((short int, int)); -#else -extern int killpg _G_ARGS((_G_pid_t, int)); -#endif -extern int siginterrupt _G_ARGS((int, int)); -extern void psignal _G_ARGS((unsigned, const char*)); - -#ifndef hpux // Interviews folks claim that hpux doesn't like these -extern int sigsetmask _G_ARGS((int mask)); -extern int sigblock _G_ARGS((int mask)); -extern int sigpause _G_ARGS((int mask)); -extern int sigvec _G_ARGS((int, struct sigvec*, struct sigvec*)); -#endif - -// The Interviews version also has these ... - -#define SignalBad ((SignalHandler)-1) -#define SignalDefault ((SignalHandler)0) -#define SignalIgnore ((SignalHandler)1) - -#undef BADSIG -#undef SIG_DFL -#undef SIG_IGN -#define BAD_SIG SignalBad -#define SIG_DFL SignalDefault -#define SIG_IGN SignalIgnore - -#endif -} - -#endif - diff --git a/gnu/lib/libg++/g++-include/std.h b/gnu/lib/libg++/g++-include/std.h deleted file mode 100644 index 52b3063586f..00000000000 --- a/gnu/lib/libg++/g++-include/std.h +++ /dev/null @@ -1,4 +0,0 @@ -#include <errno.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> diff --git a/gnu/lib/libg++/g++-include/stdarg.h b/gnu/lib/libg++/g++-include/stdarg.h deleted file mode 100644 index 98c42e9f520..00000000000 --- a/gnu/lib/libg++/g++-include/stdarg.h +++ /dev/null @@ -1,5 +0,0 @@ -// $Id: stdarg.h,v 1.2 1993/08/02 17:22:15 mycroft Exp $ - -extern "C" { -#include_next <stdarg.h> -} diff --git a/gnu/lib/libg++/g++-include/stddef.h b/gnu/lib/libg++/g++-include/stddef.h deleted file mode 100644 index 9a4dc6b357c..00000000000 --- a/gnu/lib/libg++/g++-include/stddef.h +++ /dev/null @@ -1,14 +0,0 @@ -// $Id: stddef.h,v 1.2 1993/08/02 17:22:16 mycroft Exp $ - -#ifndef __libgxx_stddef_h - -extern "C" { -#ifdef __stddef_h_recursive -#include_next <stddef.h> -#else -#include_next <stddef.h> - -#define __libgxx_stddef_h 1 -#endif -} -#endif diff --git a/gnu/lib/libg++/g++-include/stdio.h b/gnu/lib/libg++/g++-include/stdio.h deleted file mode 100644 index 05bb2e2e29e..00000000000 --- a/gnu/lib/libg++/g++-include/stdio.h +++ /dev/null @@ -1,182 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of the GNU C++ Library. This library is free -software; you can redistribute it and/or modify it under the terms of -the GNU Library General Public License as published by the Free -Software Foundation; either version 2 of the License, 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 Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with this library; if not, write to the Free Software -Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id: stdio.h,v 1.3 1993/08/14 22:07:32 mycroft Exp $ -*/ - -#ifndef _stdio_h -#ifdef __GNUG__ -#pragma interface -#endif - -#ifdef __stdio_h_recursive -#include_next <stdio.h> -#else -#define __stdio_h_recursive - -// Note: The #define _stdio_h is at the end of this file, -// in case #include_next <stdio.h> finds an installed version of this -// same file -- we want it to continue until it finds the C version. - -#include <_G_config.h> - -extern "C" { - -#undef NULL - -#define fdopen __hide_fdopen -#define fopen __hide_fopen -#define fprintf __hide_fprintf -#define fputs __hide_fputs -#define fread __hide_fread -#define freopen __hide_freopen -#define fscanf __hide_fscanf -#define ftell __hide_ftell -#define fwrite __hide_fwrite -#define new __hide_new /* In case 'new' is used as a parameter name. */ -#define perror __hide_perror -#define popen __hide_popen -#define printf __hide_printf -#define puts __hide_puts -#define putw __hide_putw -#define rewind __hide_rewind -#define tempnam __hide_tempnam -#define scanf __hide_scanf -#define setbuf __hide_setbuf -#define setbuffer __hide_setbuffer -#define setlinebuf __hide_setlinebuf -#define setvbuf __hide_setvbuf -#define sprintf __hide_sprintf -#define sscanf __hide_sscanf -#define tempnam __hide_tempnam -#define vfprintf __hide_vfprintf -#define vprintf __hide_vprintf -#define vsprintf __hide_vsprintf -#define _flsbuf __hide__flsbuf - -#include_next <stdio.h> - -#undef fdopen -#undef fopen -#undef fprintf -#undef fputs -#undef fread -#undef freopen -#undef fscanf -#undef ftell -#undef fwrite -#undef new -#undef perror -#undef popen -#undef printf -#undef puts -#undef putw -/* SCO defines remove to call unlink; that's very dangerous for us. */ -#undef remove -#undef rewind -#undef tempnam -#undef scanf -#undef setbuf -#undef setbuffer -#undef setlinebuf -#undef setvbuf -#undef sprintf -#undef sscanf -#undef tempnam -#undef vprintf -#undef vfprintf -#undef vsprintf -#undef _flsbuf - -#ifndef NULL -#define NULL _G_NULL -#endif - -#ifndef size_t -#define size_t _G_size_t -#endif -} - -extern "C" { - -int fclose(FILE*); -FILE* fdopen(int, const char*); -int fflush(FILE*); -int fgetc(FILE*); -#ifndef __NetBSD__ -char* fgets _G_ARGS((char*, int, FILE *)); -#else -char* fgets _G_ARGS((char*, _G_size_t, FILE *)); -#endif -FILE* fopen(const char*, const char*); -int fprintf(FILE*, const char* ...); -int fputc(int, FILE*); -int fputs(const char*, FILE*); -size_t fread(void*, size_t, size_t, FILE*); -#ifdef VMS -FILE* freopen(const char*, const char*, FILE* ...); -#else -FILE* freopen(const char*, const char*, FILE*); -#endif -int fscanf(FILE*, const char* ...); -int fseek(FILE*, long, int); -long ftell(FILE *); -size_t fwrite(const void*, size_t, size_t, FILE*); -char* gets(char*); -int getw(FILE*); -int pclose(FILE*); -void perror(const char*); -FILE* popen(const char*, const char*); -int printf(const char* ...); -int puts(const char*); -int putw(int, FILE*); -int rewind(FILE*); -int scanf(const char* ...); -void setbuf(FILE*, char*); -void setbuffer(FILE*, char*, int); -int setlinebuf(FILE*); -int setvbuf(FILE*, char*, int, size_t); -int sscanf(char*, const char* ...); -FILE* tmpfile(); -int ungetc(int, FILE*); -int vfprintf _G_ARGS((FILE*, const char*, _G_va_list)); -int vprintf _G_ARGS((const char*, _G_va_list)); -_G_sprintf_return_type sprintf _G_ARGS((char*, const char* ...)); -_G_sprintf_return_type vsprintf _G_ARGS((char*, const char*, _G_va_list)); - -extern int _filbuf _G_ARGS((FILE*)); -extern int _flsbuf _G_ARGS((unsigned, FILE*)); - -} - -#ifndef L_ctermid -#define L_ctermid 9 -#endif -#ifndef L_cuserid -#define L_cuserid 9 -#endif -#ifndef P_tmpdir -#define P_tmpdir "/tmp/" -#endif -#ifndef L_tmpnam -#define L_tmpnam (sizeof(P_tmpdir) + 15) -#endif - -#define _stdio_h 1 - -#endif -#endif // _stdio_h diff --git a/gnu/lib/libg++/g++-include/stdlib.h b/gnu/lib/libg++/g++-include/stdlib.h deleted file mode 100644 index 3b7e14efcb0..00000000000 --- a/gnu/lib/libg++/g++-include/stdlib.h +++ /dev/null @@ -1,81 +0,0 @@ -// $Id: stdlib.h,v 1.2 1993/08/02 17:22:17 mycroft Exp $ - -#ifndef _stdlib_h -#define _stdlib_h 1 - -#include <_G_config.h> -#include <stddef.h> - -extern "C" { - -int abs(int); - -#ifdef __GNUG__ -void volatile abort(void); -#else -void abort(void); -#endif - -double atof(const char*); -int atoi(const char*); -long atol(const char*); - -int atexit(auto void (*p) (void)); -void* bsearch (const void *, const void *, size_t, - size_t, auto int (*ptf)(const void*, const void*)); -void* calloc(size_t, size_t); -void cfree(void*); - -#ifdef __GNUG__ -void volatile exit(int); -#else -void exit(int); -#endif - -char* fcvt(double, int, int*, int*); -void free(void*); -char* getenv(const char*); -int getopt _G_ARGS((int, char * const *, const char*)); -int getpw(int, char*); -char* gcvt(double, int, char*); -char* ecvt(double, int, int*, int*); -extern char** environ; - -long labs(long); -void* malloc(size_t); -size_t malloc_usable_size(void*); -int putenv(const char*); -extern char* optarg; -extern int opterr; -extern int optind; -void qsort(void*, size_t, size_t, auto int (*ptf)(void*,void*)); -int rand(void); -void* realloc(void*, size_t); -int setkey(const char*); -int srand(unsigned int); -double strtod(const char*, char**); -long strtol(const char*, char**, int); -unsigned long strtoul(const char*, char **, int); -int system(const char*); - -long random(void); -void srandom(int); -char* setstate(char*); -char* initstate(unsigned, char*, int); - -double drand48(void); -void lcong48(short*); -long jrand48(short*); -long lrand48(void); -long mrand48(void); -long nrand48(short*); -short* seed48(short*); -void srand48(long); - -char* ctermid(char*); -char* cuserid(char*); -char* tempnam(const char*, const char*); -char* tmpnam(char*); - -} -#endif diff --git a/gnu/lib/libg++/g++-include/strclass.h b/gnu/lib/libg++/g++-include/strclass.h deleted file mode 100644 index e1799f1ac4e..00000000000 --- a/gnu/lib/libg++/g++-include/strclass.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _strclass_h -#ifdef __GNUG__ -#pragma once -#endif -#define _strclass_h -#include <String.h> -typedef class String string; -#endif diff --git a/gnu/lib/libg++/g++-include/stream.h b/gnu/lib/libg++/g++-include/stream.h deleted file mode 100644 index f55e978734b..00000000000 --- a/gnu/lib/libg++/g++-include/stream.h +++ /dev/null @@ -1,13 +0,0 @@ -/* ostream.h and istream.h now separately includable */ - -#ifndef _stream_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _stream_h 1 - -#include <ostream.h> -#include <istream.h> - -#endif diff --git a/gnu/lib/libg++/g++-include/streambuf.h b/gnu/lib/libg++/g++-include/streambuf.h deleted file mode 100644 index 61a3de5e9c7..00000000000 --- a/gnu/lib/libg++/g++-include/streambuf.h +++ /dev/null @@ -1,165 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -#ifndef _streambuf_h -#ifdef __GNUG__ -#pragma once -#pragma interface -#endif -#define _streambuf_h 1 - -/* streambufs. - basic streambufs and filebufs are as in Stroustrup, ch 8, - but the base class contains virtual extensions that allow - most capabilities of libg++ Files to be used as streambufs - via `Filebufs'. -*/ - -#include <stdio.h> -#include <builtin.h> -#include <Fmodes.h> - -// see below for NO_LINE_BUFFER_STREAMBUFS - -#ifndef BUFSIZE -#ifdef BUFSIZ -#define BUFSIZE BUFSIZ -#else -#define BUFSIZE 1024 -#endif -#endif - -enum open_mode // filebuf open modes -{ - input=0, - output=1, - append=2 -}; - -class streambuf -{ -public: - char* base; // start of buffer - char* pptr; // put-pointer (and gptr fence) - char* gptr; // get-pointer - char* eptr; // last valid addr in buffer - - char alloc; // true if we own freestore alloced buffer - - streambuf(); - streambuf(char* buf, int buflen); - - virtual ~streambuf(); - - int doallocate(); - int allocate(); - - - int must_overflow(int ch); // true if should call overflow - - virtual int overflow(int c = EOF); // flush -- return EOF if fail - virtual int underflow(); // fill -- return EOF if fail - - int sgetc(); // get one char (as int) or EOF - int snextc(); // get and advance - void stossc(); // advance only - - int sputbackc(char); // unget - - int sputc(int c = EOF); // write one char - - virtual streambuf* setbuf(char* buf, int buflen, int preloaded_count = 0); - // (not virtual in AT&T) - -// the following aren't in AT&T version: - - int sputs(const char* s); // write null-terminated str - int sputsn(const char* s, int len); // write len bytes - - virtual const char* name(); - - - virtual streambuf* open(const char* name, open_mode m); - virtual streambuf* open(const char* filename, io_mode m, access_mode a); - virtual streambuf* open(const char* filename, const char* m); - virtual streambuf* open(int filedesc, io_mode m); - virtual streambuf* open(FILE* fileptr); - - virtual int is_open(); - virtual int close(); - - virtual void error(); -}; - - -#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) - - -inline int streambuf::must_overflow(int ch) -{ -#ifndef NO_LINE_BUFFER_STREAMBUF - return pptr >= eptr || ch == '\n'; -#else - return pptr >= eptr; -#endif -} - - -inline int streambuf::allocate() -{ - return (base == 0)? doallocate() : 0; -} - -inline int streambuf::sgetc() -{ - return (gptr >= pptr)? underflow() : int((unsigned char)(*gptr)); -} - - -inline int streambuf::snextc() -{ - ++gptr; - return (gptr >= pptr)? underflow() : int((unsigned char)(*gptr)); -} - - -inline void streambuf::stossc() -{ - if (gptr >= pptr) underflow(); else gptr++; -} - - -inline int streambuf::sputbackc(char ch) -{ - return (gptr > base)? int((unsigned char)(*--gptr = ch)) : EOF; -} - -inline int streambuf::sputc(int ch) -{ - return must_overflow(ch)? overflow(ch) : - int((unsigned char)(*pptr++ = char(ch))); -} - -#endif - -#endif diff --git a/gnu/lib/libg++/g++-include/string.h b/gnu/lib/libg++/g++-include/string.h deleted file mode 100644 index e03adb7d3c0..00000000000 --- a/gnu/lib/libg++/g++-include/string.h +++ /dev/null @@ -1,47 +0,0 @@ -// $Id: string.h,v 1.3 1993/09/27 18:25:49 jtc Exp $ - -#ifndef _string_h -#define _string_h 1 - -#include <_G_config.h> - -#ifndef size_t -#define size_t _G_size_t -#endif - -#ifndef NULL -#define NULL _G_NULL -#endif - -extern "C" { - -char* strcat(char*, const char*); -char* strchr(const char*, int); -int strcmp(const char*, const char*); -int strcoll(const char*, const char*); -char* strcpy(char*, const char*); -size_t strcspn(const char*, const char*); -char* strdup(const char*); -char* strerror(int); -// NOTE: If you get a error message from g++ that this declaration -// conflicts with a <built-in> declaration of strlen(), that usually -// indicates that __SIZE_TYPE__ is incorrectly defined by gcc. -// Fix or add SIZE_TYPE in the appropriate file in gcc/config/*.h. -size_t strlen(const char*); -char* strncat(char*, const char*, size_t); -int strncmp(const char*, const char*, size_t); -char* strncpy(char*, const char*, size_t); -char* strpbrk(const char*, const char*); -char* strrchr(const char*, int); -size_t strspn(const char*, const char*); -char* strstr(const char*, const char *); -char* strtok(char*, const char*); -size_t strxfrm(char*, const char*, size_t); - -char* index(const char*, int); -char* rindex(const char*, int); -} - -#include <memory.h> - -#endif diff --git a/gnu/lib/libg++/g++-include/strings.h b/gnu/lib/libg++/g++-include/strings.h deleted file mode 100644 index ccc06eb163f..00000000000 --- a/gnu/lib/libg++/g++-include/strings.h +++ /dev/null @@ -1,3 +0,0 @@ -// $Id: strings.h,v 1.2 1993/08/02 17:22:19 mycroft Exp $ - -#include <string.h> diff --git a/gnu/lib/libg++/g++-include/swap.h b/gnu/lib/libg++/g++-include/swap.h deleted file mode 100644 index 005cb0e4648..00000000000 --- a/gnu/lib/libg++/g++-include/swap.h +++ /dev/null @@ -1,3 +0,0 @@ -/* From Ron Guillmette; apparently needed for Hansen's code */ - -#define swap(a,b) ({ typeof(a) temp = (a); (a) = (b); (b) = temp; }) diff --git a/gnu/lib/libg++/g++-include/sys/signal.h b/gnu/lib/libg++/g++-include/sys/signal.h deleted file mode 100644 index 6ff8bad7ec7..00000000000 --- a/gnu/lib/libg++/g++-include/sys/signal.h +++ /dev/null @@ -1,39 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1989 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of the GNU C++ Library. This library is free -software; you can redistribute it and/or modify it under the terms of -the GNU Library General Public License as published by the Free -Software Foundation; either version 2 of the License, 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 Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with this library; if not, write to the Free Software -Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id: signal.h,v 1.2 1993/08/02 17:21:44 mycroft Exp $ -*/ - -/* Partly for systems that think signal.h is is sys/ */ -/* But note that some systems that use sys/signal.h to define signal.h. */ - -#ifndef __libgxx_sys_signal_h -#if defined(__sys_signal_h_recursive) || defined(__signal_h_recursive) -#include_next <sys/signal.h> -#else -#define __sys_signal_h_recursive - -extern "C" { -#define signal __hide_signal -#include_next <sys/signal.h> -#undef signal -} - -#define __libgxx_sys_signal_h 1 -#endif -#endif - diff --git a/gnu/lib/libg++/g++-include/sys/socket.h b/gnu/lib/libg++/g++-include/sys/socket.h deleted file mode 100644 index 78b5e872296..00000000000 --- a/gnu/lib/libg++/g++-include/sys/socket.h +++ /dev/null @@ -1,65 +0,0 @@ -// $Id: socket.h,v 1.3 1993/08/15 16:47:00 mycroft Exp $ - -#ifndef __libgxx_sys_socket_h - -#include <_G_config.h> - -extern "C" -{ -#ifdef __sys_socket_h_recursive -#include_next <sys/socket.h> -#else -#define __sys_socket_h_recursive -#include <time.h> - -#ifdef VMS -#include "GNU_CC_INCLUDE:[sys]socket.h" -#else -#include_next <sys/socket.h> -#endif - -#define __libgxx_sys_socket_h 1 - -// void* in select, since different systems use int* or fd_set* -int accept _G_ARGS((int, struct sockaddr*, int*)); -#ifndef __NetBSD__ -int select _G_ARGS((int, void*, void*, void*, struct timeval*)); - -int bind _G_ARGS((int, const void*, int)); -int connect _G_ARGS((int, struct sockaddr*, int)); -#else -int select _G_ARGS((int, struct fd_set*, struct fd_set*, struct fd_set*, struct timeval*)); - -int bind _G_ARGS((int, const struct sockaddr *, int)); -int connect _G_ARGS((int, const struct sockaddr*, int)); -#endif -int getsockname _G_ARGS((int, struct sockaddr*, int*)); -int getpeername _G_ARGS((int, struct sockaddr*, int*)); -int getsockopt(int, int, int, void*, int*); -int listen(int, int); -#ifndef hpux -int rcmd _G_ARGS((char**, int, const char*, const char*, const char*, int*)); -#endif -int recv(int, void*, int, int); -int recvmsg(int, struct msghdr*, int); -int rexec(char**, int, const char*, const char*, const char*, int*); -int rresvport(int*); -int send _G_ARGS((int, const void*, int, int)); -int sendmsg _G_ARGS((int, const struct msghdr*, int)); -int shutdown(int, int); -int socket(int, int, int); -int socketpair(int, int, int, int sv[2]); - -#ifndef __NetBSD__ -int recvfrom _G_ARGS((int, void*, int, int, void*, int *)); -int sendto _G_ARGS((int, const void*, int, int, void*, int)); -int setsockopt _G_ARGS((int, int, int, const char*, int)); -#else -int recvfrom _G_ARGS((int, void*, int, int, struct sockaddr*, int *)); -int sendto _G_ARGS((int, const void*, int, int, const struct sockaddr*, int)); -int setsockopt _G_ARGS((int, int, int, const void*, int)); -#endif -#endif -} - -#endif diff --git a/gnu/lib/libg++/g++-include/sys/stat.h b/gnu/lib/libg++/g++-include/sys/stat.h deleted file mode 100644 index 1c5ef3c9fb9..00000000000 --- a/gnu/lib/libg++/g++-include/sys/stat.h +++ /dev/null @@ -1,49 +0,0 @@ -// $Id: stat.h,v 1.2 1993/08/02 17:21:47 mycroft Exp $ - -#ifndef __libgxx_sys_stat_h - -extern "C" -{ -#ifdef __sys_stat_h_recursive -#include_next <sys/stat.h> -#else -#define __sys_stat_h_recursive -#include <_G_config.h> -#define chmod __hide_chmod -#ifdef VMS -#include "GNU_CC_INCLUDE:[sys]stat.h" -#else -#include_next <sys/stat.h> -#endif -#undef chmod - -#define __libgxx_sys_stat_h 1 - -extern int chmod _G_ARGS((const char*, _G_mode_t)); -extern int stat _G_ARGS((const char *path, struct stat *buf)); -extern int lstat _G_ARGS((const char *path, struct stat *buf)); -extern int fstat _G_ARGS((int fd, struct stat *buf)); - -#ifndef S_ISDIR -#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) -#endif -#ifndef S_ISBLK -#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK) -#endif -#ifndef S_ISCHR -#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR) -#endif -#ifndef S_ISFIFO -#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFFIFO) -#endif -#ifndef S_ISREG -#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) -#endif -#if !defined(S_ISLNK) && defined(S_IFLNK) -#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) -#endif - -#endif -} - -#endif diff --git a/gnu/lib/libg++/g++-include/sys/time.h b/gnu/lib/libg++/g++-include/sys/time.h deleted file mode 100644 index b08404702a3..00000000000 --- a/gnu/lib/libg++/g++-include/sys/time.h +++ /dev/null @@ -1,43 +0,0 @@ -// $Id: time.h,v 1.2 1993/08/02 17:21:48 mycroft Exp $ - -#ifndef __libgxx_sys_time_h - -extern "C" -{ -#ifdef __sys_time_h_recursive -#include_next <sys/time.h> -#else -#define __sys_time_h_recursive - -// Some system (e.g Ultrix) define these in sys/time.h. - -#ifndef __time_h_recursive -#define time __hide_time -#define clock __hide_clock -#define gmtime __hide_gmtime -#define localtime __hide_localtime -#define ctime __hide_ctime -#define asctime __hide_asctime -#define strftime __hide_strftime -#endif - -#ifdef VMS -#include "GNU_CC_INCLUDE:[sys]resourcetime.h" -#else -#include_next <sys/time.h> -#endif -#undef __sys_time_h_recursive - -#define __libgxx_sys_time_h 1 - -#undef clock -#undef ctime -#undef gmtime -#undef localtime -#undef time -#undef asctime -#undef strftime -#endif -} - -#endif diff --git a/gnu/lib/libg++/g++-include/sys/times.h b/gnu/lib/libg++/g++-include/sys/times.h deleted file mode 100644 index 047a984c564..00000000000 --- a/gnu/lib/libg++/g++-include/sys/times.h +++ /dev/null @@ -1,22 +0,0 @@ -// $Id: times.h,v 1.2 1993/08/02 17:21:50 mycroft Exp $ - -#ifndef __libgxx_sys_times_h - -extern "C" -{ -#ifdef __sys_times_h_recursive -#include_next <sys/times.h> -#else -#define __sys_times_h_recursive -#include_next <sys/times.h> -#define __libgxx_sys_times_h 1 - -#include <_G_config.h> - -extern _G_clock_t times _G_ARGS((struct tms*)); - -#endif -} - - -#endif diff --git a/gnu/lib/libg++/g++-include/sys/types.h b/gnu/lib/libg++/g++-include/sys/types.h deleted file mode 100644 index 4c87cdb5641..00000000000 --- a/gnu/lib/libg++/g++-include/sys/types.h +++ /dev/null @@ -1,27 +0,0 @@ -// $Id: types.h,v 1.2 1993/08/02 17:21:51 mycroft Exp $ - -#ifndef __libgxx_sys_types_h - -extern "C" -{ -#ifdef __sys_types_h_recursive -#include_next <sys/types.h> -#else - -#define __sys_types_h_recursive -#include <stddef.h> - -#ifdef VMS -#include "GNU_CC_INCLUDE:[sys]types.h" -#else -#include_next <sys/types.h> -#endif - -#define __libgxx_sys_types_h 1 - -#endif -} - - -#endif - diff --git a/gnu/lib/libg++/g++-include/sys/wait.h b/gnu/lib/libg++/g++-include/sys/wait.h deleted file mode 100644 index babdc3ca413..00000000000 --- a/gnu/lib/libg++/g++-include/sys/wait.h +++ /dev/null @@ -1,44 +0,0 @@ -// $Id: wait.h,v 1.3 1993/08/15 16:47:01 mycroft Exp $ - -#ifndef __libgxx_sys_wait_h - -#include <_G_config.h> - -extern "C" { -#ifdef __sys_wait_h_recursive -#include_next <sys/wait.h> -#else -#define __sys_wait_h_recursive - - -#if _G_HAVE_SYS_WAIT -#ifdef VMS -#include "GNU_CC_INCLUDE:[sys]wait.h" -#else -#include_next <sys/wait.h> -#endif -#else /* !_G_HAVE_SYS_WAIT */ -/* Traditional definitions. */ -#define WEXITSTATUS(status) (((x) >> 8) & 0xFF) -#define WIFSTOPPED(x) (((x) & 0xFF) == 0177) -#define WIFEXITED(x) (! WIFSTOPPED(x) && WTERMSIG(x) == 0) -#define WIFSIGNALED(x) (! WIFSTOPPED(x) && WTERMSIG(x) != 0) -#define WTERMSIG(status) ((x) & 0x7F) -#define WSTOPSIG(status) (((x) >> 8) & 0xFF) -#endif /* !_G_HAVE_SYS_WAIT */ - -#define __libgxx_sys_wait_h 1 - -struct rusage; -extern _G_pid_t wait _G_ARGS((int*)); -extern _G_pid_t waitpid _G_ARGS((_G_pid_t, int*, int)); -extern _G_pid_t wait3 _G_ARGS((int*, int options, struct rusage*)); -#ifndef __NetBSD__ -extern _G_pid_t wait4 _G_ARGS((int, int*, int, struct rusage*)); -#else -extern _G_pid_t wait4 _G_ARGS((_G_pid_t, int*, int, struct rusage*)); -#endif -#endif -} - -#endif diff --git a/gnu/lib/libg++/g++-include/time.h b/gnu/lib/libg++/g++-include/time.h deleted file mode 100644 index 80158599191..00000000000 --- a/gnu/lib/libg++/g++-include/time.h +++ /dev/null @@ -1,110 +0,0 @@ -// $Id: time.h,v 1.3 1993/08/14 22:07:33 mycroft Exp $ - -#ifndef _G_time_h -#define _G_time_h - -extern "C" { - -#ifdef __time_h_recursive -#include_next <time.h> -#else -#define __time_h_recursive - -#include <_G_config.h> - -// A clean way to use and/or define time_t might allow removal of this crud. -#ifndef __sys_time_h_recursive -#define time __hide_time -#define clock __hide_clock -#define difftime __hide_difftime -#define gmtime __hide_gmtime -#define localtime __hide_localtime -#define ctime __hide_ctime -#define asctime __hide_asctime -#define strftime __hide_strftime -#endif -#define mktime __hide_mktime -#define tzset __hide_tzset -#define tzsetwall __hide_tzsetwall -#define getitimer __hide_getitimer -#define setitimer __hide_setitimer -#define gettimeofday __hide_gettimeofday -#define settimeofday __hide_settimeofday - -#ifdef VMS - struct unix_time - { - long int tv_sec; - long int tv_usec; - }; - - struct rusage - { - struct unix_time ru_utime; - }; - -#define RUSAGE_SELF 0 //define it, it will be unused -#else -#ifdef hpux -#define _INCLUDE_POSIX_SOURCE -#endif - -#include_next <time.h> -#endif -#undef __time_h_recursive - -#define time_h 1 - -#undef time -#undef clock -#undef difftime -#undef gmtime -#undef localtime -#undef asctime -#undef ctime -#undef mktime -#undef strftime -#undef tzset -#undef tzsetwall -#undef getitimer -#undef setitimer -#undef gettimeofday -#undef settimeofday - -extern char* asctime _G_ARGS((const struct tm*)); -extern char* ctime _G_ARGS((const _G_time_t*)); -double difftime _G_ARGS((_G_time_t, _G_time_t)); -extern struct tm* gmtime _G_ARGS((const _G_time_t*)); -extern struct tm* localtime _G_ARGS((const _G_time_t*)); -extern _G_time_t mktime(struct tm*); -extern _G_size_t strftime _G_ARGS((char*,_G_size_t,const char*,const struct tm*)); -extern void tzset(); -extern void tzsetwall(); - -extern int getitimer(int, struct itimerval*); -extern int setitimer _G_ARGS((int, const struct itimerval*,struct itimerval*)); -extern int gettimeofday(struct timeval*, struct timezone*); -extern int settimeofday _G_ARGS((const struct timeval*,const struct timezone*)); -extern int stime _G_ARGS((const _G_time_t*)); -extern int dysize(int); - -#if defined(___AIX__) -int clock (void); -#elif defined(hpux) -unsigned long clock(void); -#else -long clock(void); -#endif -_G_time_t time(_G_time_t*); -unsigned ualarm(unsigned, unsigned); -#ifndef __NetBSD__ -unsigned usleep(unsigned); -void profil _G_ARGS((unsigned short*, _G_size_t, unsigned int, unsigned)); -#else -void usleep(unsigned); -int profil _G_ARGS((char*, int, int, int)); -#endif - -#endif -} -#endif diff --git a/gnu/lib/libg++/g++-include/unistd.h b/gnu/lib/libg++/g++-include/unistd.h deleted file mode 100644 index e3cd0685fb8..00000000000 --- a/gnu/lib/libg++/g++-include/unistd.h +++ /dev/null @@ -1,189 +0,0 @@ -// $Id: unistd.h,v 1.3 1993/08/14 22:07:34 mycroft Exp $ - -#ifndef _G_unistd_h -#define _G_unistd_h 1 - -#include <_G_config.h> - -extern "C" { - -#if _G_HAVE_UNISTD -#ifndef _G_USE_PROTOS -#define chmod __hide_chmod -#define chown __hide_chown -#define execl __hide_execl -#define execlp __hide_execlp -#define execle __hide_execle -#define fchown __hide_fchown -#define ioctl __hide_ioctl -#define setgid __hide_setgid -#define setuid __hide_setuid -#endif -#ifdef _AIX -// AIX's unistd.h defines int rename (const char *old, const char *new). -// This is not legal ANSI. It causes a C++ syntax error (because of 'new'). -#define new __new -#endif -#include_next <unistd.h> -#ifdef _AIX -#undef new -#endif -#ifndef _G_USE_PROTOS -#undef chmod -#undef chown -#undef execl -#undef execle -#undef execlp -#undef fchown -#undef ioctl -#undef setgid -#undef setuid -#endif -#else -#ifndef SEEK_SET -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 -#endif - -#ifndef F_OK -#define F_OK 0 -#endif -#ifndef X_OK -#define X_OK 1 -#endif -#ifndef W_OK -#define W_OK 2 -#endif -#ifndef R_OK -#define R_OK 4 -#endif -#endif - -#ifdef __GNUG__ -extern void volatile _exit(int); -#else -void _exit(int); -#endif - -extern unsigned alarm _G_ARGS((unsigned)); -#ifndef __NetBSD__ -extern int brk _G_ARGS((void*)); -#else -extern char* brk _G_ARGS((const char*)); -#endif -extern int chdir _G_ARGS((const char*)); -extern int chmod _G_ARGS((const char*, _G_mode_t)); -extern int chown (const char*, _G_uid_t, _G_gid_t); -extern int close _G_ARGS((int)); -extern char* crypt _G_ARGS((const char*, const char*)); -extern int dup _G_ARGS((int)); -extern int dup2 _G_ARGS((int, int)); -#ifndef __NetBSD__ -extern void encrypt _G_ARGS((char*, int)); -#else -extern int encrypt _G_ARGS((char*, int)); -#endif -extern int execl (const char*, const char *, ...); -extern int execle (const char*, const char *, ...); -extern int execlp (const char*, const char*, ...); -#ifndef __NetBSD__ -extern int exect _G_ARGS((const char*, const char**, char**)); -extern int execv _G_ARGS((const char*, const char * const *)); -extern int execve _G_ARGS((const char*, const char * const *, const char * const *)); -extern int execvp _G_ARGS((const char*, const char * const *)); -extern int fchown (int, _G_uid_t, _G_gid_t); -#else -extern int exect _G_ARGS((const char*, char * const*, char * const *)); -extern int execv _G_ARGS((const char*, char * const *)); -extern int execve _G_ARGS((const char*, char * const *, char * const *)); -extern int execvp _G_ARGS((const char*, char * const *)); -extern int fchown (int, int, int); -#endif -extern _G_pid_t fork _G_ARGS((void)); -extern int fsync _G_ARGS((int)); -extern int ftruncate _G_ARGS((int, _G_off_t)); -extern char* getcwd _G_ARGS((char*, _G_size_t)); -extern int getdomainname _G_ARGS((char*, int)); -extern int getdtablesize _G_ARGS((void)); -#ifndef __NetBSD__ -extern int getgroups _G_ARGS((int, _G_gid_t*)); -#else -extern int getgroups _G_ARGS((int, int*)); -#endif -extern _G_uid_t geteuid _G_ARGS((void)); -extern _G_gid_t getegid _G_ARGS((void)); -extern _G_gid_t getgid _G_ARGS((void)); -extern long gethostid _G_ARGS((void)); -extern int gethostname _G_ARGS((char*, int)); -extern _G_pid_t getpgrp _G_ARGS((...)); -extern _G_pid_t getpid _G_ARGS((void)); -extern _G_pid_t getppid _G_ARGS((void)); -extern char* getlogin _G_ARGS((void)); -extern char* getpass _G_ARGS((const char*)); -extern _G_uid_t getuid _G_ARGS((void)); -#ifndef __NetBSD__ -extern int ioctl (int, int, ... ); -#else -extern int ioctl (int, unsigned long, ... ); -#endif -extern int isatty _G_ARGS((int)); -extern int link _G_ARGS((const char*, const char*)); -extern int lockf _G_ARGS((int, int, long)); -extern int mkstemp _G_ARGS((char*)); -extern char* mktemp _G_ARGS((char*)); -extern int nice _G_ARGS((int)); -extern int pause _G_ARGS((void)); -extern int pipe _G_ARGS((int*)); -extern int readlink _G_ARGS((const char*, char*, int)); -extern int rename _G_ARGS((const char*, const char*)); -extern int rmdir _G_ARGS((const char*)); -#if defined( __OSF1__ ) || defined (__NetBSD__) -extern char* sbrk _G_ARGS((int)); -#else -extern void* sbrk _G_ARGS((int)); -#endif -extern int syscall _G_ARGS((int, ...)); -extern int setgid (_G_gid_t); -extern int sethostname _G_ARGS((const char*, int)); -#ifdef _G_SYSV -extern _G_pid_t setpgrp _G_ARGS((void)); -extern _G_pid_t setsid _G_ARGS((void)); -#else -#ifndef __NetBSD__ -extern _G_pid_t setpgrp _G_ARGS((_G_pid_t, _G_pid_t)); -#else -extern _G_pid_t setsid _G_ARGS((void)); -extern int setpgrp _G_ARGS((_G_pid_t, _G_pid_t)); -#endif -#endif -extern int setregid _G_ARGS((int, int)); -extern int setreuid _G_ARGS((int, int)); -extern int setuid (_G_uid_t); -extern unsigned sleep _G_ARGS((unsigned)); -extern void swab _G_ARGS((void*, void*, int)); -extern int symlink _G_ARGS((const char*, const char*)); -extern long sysconf _G_ARGS((int)); -extern int truncate _G_ARGS((const char*, _G_off_t)); -extern char* ttyname _G_ARGS((int)); -extern int ttyslot _G_ARGS((void)); -//extern int umask _G_ARGS((int)); /* commented out for now; wrong for SunOs4.1 */ -extern int unlink _G_ARGS((const char*)); -#ifndef __NetBSD__ -extern _G_pid_t vfork _G_ARGS((void)); -#else -extern int vfork _G_ARGS((void)); -#endif -extern int vadvise _G_ARGS((int)); -extern int vhangup _G_ARGS((void)); -extern _G_off_t lseek _G_ARGS((int, long, int)); -extern _G_ssize_t read _G_ARGS((int, void*, _G_size_t)); -extern _G_ssize_t write _G_ARGS((int, const void*, _G_size_t)); -extern int access _G_ARGS((const char*, int)); -#ifndef hpux -extern int flock _G_ARGS((int, int)); -#endif - -} - -#endif |
