From 6f87af20c351e777702cc58a31dbef03bbbf1bac Mon Sep 17 00:00:00 2001 From: Laurynas Biveinis <lauras@softhome.net> Date: Fri, 12 Jan 2001 19:39:07 +0000 Subject: [PATCH] acinclude.m4 (GLIBCPP_CHECK_CTYPE_SUPPORT): check for DJGPP <ctype.h> * acinclude.m4 (GLIBCPP_CHECK_CTYPE_SUPPORT): check for DJGPP <ctype.h> (LIB_AC_PROG_CXX): replace [/\\] with [\\/] to work around older bash bug. * aclocal.m4: regenerated. * configure.target: set os_include_dir to config/os/djgpp under DJGPP. * configure: regenerated. * config/os/djgpp, config/os/djgpp/bits: new directories. * config/os/djgpp/bits/ctype_base.h, config/os/djgpp/bits/ctype_inline.h, config/os/djgpp/bits/ctype_noninline.h, config/os/djgpp/bits/os_defines.h: new files. From-SVN: r38958 --- libstdc++-v3/ChangeLog | 14 ++++ libstdc++-v3/acinclude.m4 | 19 ++++- libstdc++-v3/aclocal.m4 | 19 ++++- .../config/os/djgpp/bits/ctype_base.h | 58 ++++++++++++++ .../config/os/djgpp/bits/ctype_inline.h | 67 ++++++++++++++++ .../config/os/djgpp/bits/ctype_noninline.h | 79 +++++++++++++++++++ .../config/os/djgpp/bits/os_defines.h | 44 +++++++++++ libstdc++-v3/configure.target | 3 + 8 files changed, 301 insertions(+), 2 deletions(-) create mode 100644 libstdc++-v3/config/os/djgpp/bits/ctype_base.h create mode 100644 libstdc++-v3/config/os/djgpp/bits/ctype_inline.h create mode 100644 libstdc++-v3/config/os/djgpp/bits/ctype_noninline.h create mode 100644 libstdc++-v3/config/os/djgpp/bits/os_defines.h diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 04ae9606117a..859c72de7fe9 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,17 @@ +2001-01-12 Laurynas Biveinis <lauras@softhome.net> + + * acinclude.m4 (GLIBCPP_CHECK_CTYPE_SUPPORT): check for DJGPP <ctype.h> + (LIB_AC_PROG_CXX): replace [/\\] with [\\/] to work around older + bash bug. + * aclocal.m4: regenerated. + * configure.target: set os_include_dir to config/os/djgpp under DJGPP. + * configure: regenerated. + * config/os/djgpp, config/os/djgpp/bits: new directories. + * config/os/djgpp/bits/ctype_base.h, + config/os/djgpp/bits/ctype_inline.h, + config/os/djgpp/bits/ctype_noninline.h, + config/os/djgpp/bits/os_defines.h: new files. + 2001-01-11 Joseph S. Myers <jsm28@cam.ac.uk> * include/c_std/bits/std_cstdio.h: Undef printf. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 66a0bccf3a23..6516797d4e9d 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -152,7 +152,7 @@ LIB_AC_PROG_CXX . [$]{glibcpp_basedir}/configure.host case [$]{glibcpp_basedir} in - /* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;; + /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;; *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;; esac @@ -953,6 +953,23 @@ AC_DEFUN(GLIBCPP_CHECK_CTYPE_SUPPORT, [ fi fi + dnl Test for <ctype> functionality -- DJGPP + dnl FIXME: this test won't work if __dj_ENFORCE_FUNCTION_CALLS + dnl is defined. + if test $ctype_default = "yes"; then + AC_MSG_CHECKING([<ctype> for DJGPP]) + AC_TRY_COMPILE([#include <ctype.h>], + [int + foo (int a) + { return __dj_ctype_flags[0] + __dj_ctype_flags[1];}], \ + ctype_djgpp=yes, ctype_djgpp=no) + AC_MSG_RESULT($ctype_djgpp) + if test $ctype_djgpp = "yes"; then + ctype_include_dir="config/os/djgpp" + ctype_default=no + fi + fi + if test $ctype_default = "yes"; then ctype_include_dir="config/os/generic" AC_MSG_WARN("Using default ctype headers.") diff --git a/libstdc++-v3/aclocal.m4 b/libstdc++-v3/aclocal.m4 index 288f61daa97e..b1f670591c2c 100644 --- a/libstdc++-v3/aclocal.m4 +++ b/libstdc++-v3/aclocal.m4 @@ -164,7 +164,7 @@ LIB_AC_PROG_CXX . [$]{glibcpp_basedir}/configure.host case [$]{glibcpp_basedir} in - /* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;; + /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;; *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;; esac @@ -965,6 +965,23 @@ AC_DEFUN(GLIBCPP_CHECK_CTYPE_SUPPORT, [ fi fi + dnl Test for <ctype> functionality -- DJGPP + dnl FIXME: this test won't work if __dj_ENFORCE_FUNCTION_CALLS + dnl is defined. + if test $ctype_default = "yes"; then + AC_MSG_CHECKING([<ctype> for DJGPP]) + AC_TRY_COMPILE([#include <ctype.h>], + [int + foo (int a) + { return __dj_ctype_flags[0] + __dj_ctype_flags[1];}], \ + ctype_djgpp=yes, ctype_djgpp=no) + AC_MSG_RESULT($ctype_djgpp) + if test $ctype_djgpp = "yes"; then + ctype_include_dir="config/os/djgpp" + ctype_default=no + fi + fi + if test $ctype_default = "yes"; then ctype_include_dir="config/os/generic" AC_MSG_WARN("Using default ctype headers.") diff --git a/libstdc++-v3/config/os/djgpp/bits/ctype_base.h b/libstdc++-v3/config/os/djgpp/bits/ctype_base.h new file mode 100644 index 000000000000..1c41fbd55715 --- /dev/null +++ b/libstdc++-v3/config/os/djgpp/bits/ctype_base.h @@ -0,0 +1,58 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + + struct ctype_base + { + typedef unsigned short mask; + + // Non-standard typedefs. + typedef unsigned char __to_type; + + enum + { + space = __dj_ISSPACE, // Whitespace + print = __dj_ISPRINT, // Printing + cntrl = __dj_ISCNTRL, // Control character + upper = __dj_ISUPPER, // UPPERCASE + lower = __dj_ISLOWER, // lowercase + alpha = __dj_ISALPHA, // Alphabetic + digit = __dj_ISDIGIT, // Numeric + punct = __dj_ISPUNCT, // Punctuation + xdigit = __dj_ISXDIGIT, // Hexadecimal numeric + alnum = __dj_ISAL, // Alphanumeric + graph = __dj_ISGRAPH // Graphical + }; + }; + + + diff --git a/libstdc++-v3/config/os/djgpp/bits/ctype_inline.h b/libstdc++-v3/config/os/djgpp/bits/ctype_inline.h new file mode 100644 index 000000000000..52ec0d605b79 --- /dev/null +++ b/libstdc++-v3/config/os/djgpp/bits/ctype_inline.h @@ -0,0 +1,67 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000, 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) +// functions go in ctype.cc + + bool + ctype<char>:: + is(mask __m, char __c) const throw() + { return _M_table[(unsigned char)(__c + 1)] & __m; } + + const char* + ctype<char>:: + is(const char* __low, const char* __high, mask* __vec) const throw() + { + while (__low < __high) + *__vec++ = _M_table[(unsigned char)(*__low++)]; + return __high; + } + + const char* + ctype<char>:: + scan_is(mask __m, const char* __low, const char* __high) const throw() + { + while (__low < __high && !this->is(__m, *__low)) + ++__low; + return __low; + } + + const char* + ctype<char>:: + scan_not(mask __m, const char* __low, const char* __high) const throw() + { + while (__low < __high && this->is(__m, *__low) != 0) + ++__low; + return __low; + } diff --git a/libstdc++-v3/config/os/djgpp/bits/ctype_noninline.h b/libstdc++-v3/config/os/djgpp/bits/ctype_noninline.h new file mode 100644 index 000000000000..d13f987ec9a7 --- /dev/null +++ b/libstdc++-v3/config/os/djgpp/bits/ctype_noninline.h @@ -0,0 +1,79 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from DJGPP <ctype.h> + +// DJGPP specific code +extern unsigned short __dj_type_cflags[]; +extern unsigned char __dj_ctype_toupper[]; +extern unsigned char __dj_ctype_tolower[]; + + ctype<char>::ctype(const mask* __table = 0, bool __del = false, + size_t __refs = 0) + : _Ctype_nois<char>(__refs), + _M_del(__table != 0 && __del), + _M_toupper(__dj_ctype_toupper), + _M_tolower(__dj_ctype_tolower), + _M_ctable(NULL), + _M_table(__table == 0 ? __dj_type_cflags : __table) + { } + + char + ctype<char>::do_toupper(char __c) const + { return _M_toupper[(int)(__c)+1]) } + + const char* + ctype<char>::do_toupper(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = ::toupper((int) *__low); + ++__low; + } + return __high; + } + + char + ctype<char>::do_tolower(char __c) const + { return _M_tolower[(int)(__c)+1]) } + + const char* + ctype<char>::do_tolower(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = ::tolower((int) *__low); + ++__low; + } + return __high; + } diff --git a/libstdc++-v3/config/os/djgpp/bits/os_defines.h b/libstdc++-v3/config/os/djgpp/bits/os_defines.h new file mode 100644 index 000000000000..f979b1eb60df --- /dev/null +++ b/libstdc++-v3/config/os/djgpp/bits/os_defines.h @@ -0,0 +1,44 @@ +// Specific definitions for DJGPP -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + +#ifndef _GLIBCPP_OS_DEFINES +#define _GLIBCPP_OS_DEFINES + + +/* System-specific #define, typedefs, corrections, etc, go here. This + file will come before all others. */ + +#define __off_t off_t +#define __off64_t off64_t +#define __ssize_t ssize_t + +// FIXME: should there be '#undef POSIX_SOURCE'? + +#endif diff --git a/libstdc++-v3/configure.target b/libstdc++-v3/configure.target index 089e0791d60b..11538630d7cf 100644 --- a/libstdc++-v3/configure.target +++ b/libstdc++-v3/configure.target @@ -87,6 +87,9 @@ case "${target_os}" in cygwin*) os_include_dir="config/os/newlib" ;; + *djgpp*) + os_include_dir="config/os/djgpp" + ;; linux* | gnu*) os_include_dir="config/os/gnu-linux" ;; -- GitLab