Message-ID: <20010111120100.572.qmail@lauras.lt> From: "Laurynas Biveinis" Date: Thu, 11 Jan 2001 14:01:00 +0200 To: djgpp-workers AT delorie DOT com Subject: RFC: libstdc++-v3 port Mail-Followup-To: djgpp-workers AT delorie DOT com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Reply-To: djgpp-workers AT delorie DOT com Below is preliminary port of libstdc++-v3 to DJGPP. There are still quite a few rough edges with configure, libtool, etc., but I'd like to submit this part before GCC 3.0 branch. Any comments? Laurynas ? libstdc++-v3/config/os/djgpp Index: libstdc++-v3/acinclude.m4 =================================================================== RCS file: /cvs/gcc/egcs/libstdc++-v3/acinclude.m4,v retrieving revision 1.118 diff -u -r1.118 acinclude.m4 --- acinclude.m4 2001/01/03 15:53:22 1.118 +++ acinclude.m4 2001/01/11 11:55:45 @@ -152,7 +152,7 @@ . [$]{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 @@ -949,6 +949,23 @@ AC_MSG_RESULT($ctype_newlib) if test $ctype_newlib = "yes"; then ctype_include_dir="config/os/newlib" + ctype_default=no + fi + fi + + dnl Test for 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([ for DJGPP]) + AC_TRY_COMPILE([#include ], + [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 Index: libstdc++-v3/configure.target =================================================================== RCS file: /cvs/gcc/egcs/libstdc++-v3/configure.target,v retrieving revision 1.9 diff -u -r1.9 configure.target --- configure.target 2000/12/19 20:02:13 1.9 +++ configure.target 2001/01/11 11:55:45 @@ -87,6 +87,9 @@ cygwin*) os_include_dir="config/os/newlib" ;; + *djgpp*) + os_include_dir="config/os/djgpp" + ;; linux* | gnu*) os_include_dir="config/os/gnu-linux" ;; --- /dev/null Sat Jan 6 18:39:53 2001 +++ ctype_base.h Wed Jan 10 14:28:58 2001 @@ -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 + }; + }; + + + --- /dev/null Sat Jan 6 18:39:53 2001 +++ ctype_inline.h Wed Jan 10 14:28:58 2001 @@ -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:: + is(mask __m, char __c) const throw() + { return _M_table[(unsigned char)(__c + 1)] & __m; } + + const char* + ctype:: + 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:: + 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:: + scan_not(mask __m, const char* __low, const char* __high) const throw() + { + while (__low < __high && this->is(__m, *__low) != 0) + ++__low; + return __low; + } --- /dev/null Sat Jan 6 18:39:53 2001 +++ ctype_noninline.h Wed Jan 10 14:28:58 2001 @@ -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 + +// DJGPP specific code +extern unsigned short __dj_type_cflags[]; +extern unsigned char __dj_ctype_toupper[]; +extern unsigned char __dj_ctype_tolower[]; + + ctype::ctype(const mask* __table = 0, bool __del = false, + size_t __refs = 0) + : _Ctype_nois(__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::do_toupper(char __c) const + { return _M_toupper[(int)(__c)+1]) } + + const char* + ctype::do_toupper(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = ::toupper((int) *__low); + ++__low; + } + return __high; + } + + char + ctype::do_tolower(char __c) const + { return _M_tolower[(int)(__c)+1]) } + + const char* + ctype::do_tolower(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = ::tolower((int) *__low); + ++__low; + } + return __high; + } --- /dev/null Sat Jan 6 18:39:53 2001 +++ os_defines.h Wed Jan 10 14:28:58 2001 @@ -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