diff options
author | (no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-03-18 18:24:07 +0000 |
---|---|---|
committer | (no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-03-18 18:24:07 +0000 |
commit | 407b0765cb48af19a3faf10c5b8f1d000cf5d212 (patch) | |
tree | 01ceba7d32282d889a2632d339acaa304c30afd6 | |
parent | 8cccd283d23f26d115a54fdabb9221d226c66073 (diff) |
This commit was manufactured by cvs2svn to create tagrtlopt-merge-20030318
'rtlopt-merge-20030318'.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/tags/rtlopt-merge-20030318@64541 138bc75d-0d04-0410-961f-82ee72b054a4
1133 files changed, 45 insertions, 64956 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 46daf2702b6..c259d56dc0b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +Tue Mar 18 19:22:57 CET 2003 Jan Hubicka <jh@suse.cz> + + * alias.c (rtx_equal_for_memref_p): Assume that X and Y has been + canonicalized. + (memrefs_conflict_p): Likewise. + (addr_side_effect_eval): Canonicalize the constructed address. + Tue Mar 18 13:15:08 CET 2003 Jan Hubicka <jh@suse.cz> * i386.md (cvtts?2si peep2): New. diff --git a/gcc/alias.c b/gcc/alias.c index f1b0530b443..ba8fceec298 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -1118,6 +1118,7 @@ canon_rtx (x) } /* Return 1 if X and Y are identical-looking rtx's. + Expect that X and Y has been already canonicalized. We use the data in reg_known_value above to see if two registers with different numbers are, in fact, equivalent. */ @@ -1136,9 +1137,6 @@ rtx_equal_for_memref_p (x, y) if (x == 0 || y == 0) return 0; - x = canon_rtx (x); - y = canon_rtx (y); - if (x == y) return 1; @@ -1177,24 +1175,42 @@ rtx_equal_for_memref_p (x, y) case ADDRESSOF: return (XINT (x, 1) == XINT (y, 1) - && rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0))); + && rtx_equal_for_memref_p (XEXP (x, 0), + XEXP (y, 0))); default: break; } - /* For commutative operations, the RTX match if the operand match in any - order. Also handle the simple binary and unary cases without a loop. */ - if (code == EQ || code == NE || GET_RTX_CLASS (code) == 'c') + /* canon_rtx knows how to handle plus. No need to canonicalize. */ + if (code == PLUS) return ((rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0)) && rtx_equal_for_memref_p (XEXP (x, 1), XEXP (y, 1))) || (rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 1)) && rtx_equal_for_memref_p (XEXP (x, 1), XEXP (y, 0)))); + /* For commutative operations, the RTX match if the operand match in any + order. Also handle the simple binary and unary cases without a loop. */ + if (code == EQ || code == NE || GET_RTX_CLASS (code) == 'c') + { + rtx xop0 = canon_rtx (XEXP (x, 0)); + rtx yop0 = canon_rtx (XEXP (y, 0)); + rtx yop1 = canon_rtx (XEXP (y, 1)); + + return ((rtx_equal_for_memref_p (xop0, yop0) + && rtx_equal_for_memref_p (canon_rtx (XEXP (x, 1)), yop1)) + || (rtx_equal_for_memref_p (xop0, yop1) + && rtx_equal_for_memref_p (canon_rtx (XEXP (x, 1)), yop0))); + } else if (GET_RTX_CLASS (code) == '<' || GET_RTX_CLASS (code) == '2') - return (rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0)) - && rtx_equal_for_memref_p (XEXP (x, 1), XEXP (y, 1))); + { + return (rtx_equal_for_memref_p (canon_rtx (XEXP (x, 0)), + canon_rtx (XEXP (y, 0))) + && rtx_equal_for_memref_p (canon_rtx (XEXP (x, 1)), + canon_rtx (XEXP (y, 1)))); + } else if (GET_RTX_CLASS (code) == '1') - return rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0)); + return rtx_equal_for_memref_p (canon_rtx (XEXP (x, 0)), + canon_rtx (XEXP (y, 0))); /* Compare the elements. If any pair of corresponding elements fail to match, return 0 for the whole things. @@ -1218,13 +1234,14 @@ rtx_equal_for_memref_p (x, y) /* And the corresponding elements must match. */ for (j = 0; j < XVECLEN (x, i); j++) - if (rtx_equal_for_memref_p (XVECEXP (x, i, j), - XVECEXP (y, i, j)) == 0) + if (rtx_equal_for_memref_p (canon_rtx (XVECEXP (x, i, j)), + canon_rtx (XVECEXP (y, i, j))) == 0) return 0; break; case 'e': - if (rtx_equal_for_memref_p (XEXP (x, i), XEXP (y, i)) == 0) + if (rtx_equal_for_memref_p (canon_rtx (XEXP (x, i)), + canon_rtx (XEXP (y, i))) == 0) return 0; break; @@ -1549,9 +1566,11 @@ addr_side_effect_eval (addr, size, n_refs) } if (offset) - addr = gen_rtx_PLUS (GET_MODE (addr), XEXP (addr, 0), GEN_INT (offset)); + addr = gen_rtx_PLUS (GET_MODE (addr), XEXP (addr, 0), + GEN_INT (offset)); else addr = XEXP (addr, 0); + addr = canon_rtx (addr); return addr; } @@ -1561,6 +1580,7 @@ addr_side_effect_eval (addr, size, n_refs) C is nonzero, we are testing aliases between X and Y + C. XSIZE is the size in bytes of the X reference, similarly YSIZE is the size in bytes for Y. + Expect that canon_rtx has been already called for X and Y. If XSIZE or YSIZE is zero, we do not know the amount of memory being referenced (the reference was BLKmode), so make the most pessimistic @@ -1588,13 +1608,13 @@ memrefs_conflict_p (xsize, x, ysize, y, c) else if (GET_CODE (x) == LO_SUM) x = XEXP (x, 1); else - x = canon_rtx (addr_side_effect_eval (x, xsize, 0)); + x = addr_side_effect_eval (x, xsize, 0); if (GET_CODE (y) == HIGH) y = XEXP (y, 0); else if (GET_CODE (y) == LO_SUM) y = XEXP (y, 1); else - y = canon_rtx (addr_side_effect_eval (y, ysize, 0)); + y = addr_side_effect_eval (y, ysize, 0); if (rtx_equal_for_memref_p (x, y)) { @@ -1717,7 +1737,7 @@ memrefs_conflict_p (xsize, x, ysize, y, c) { if (GET_CODE (y) == AND || ysize < -INTVAL (XEXP (x, 1))) xsize = -1; - return memrefs_conflict_p (xsize, XEXP (x, 0), ysize, y, c); + return memrefs_conflict_p (xsize, canon_rtx (XEXP (x, 0)), ysize, y, c); } if (GET_CODE (y) == AND && GET_CODE (XEXP (y, 1)) == CONST_INT) { @@ -1727,7 +1747,7 @@ memrefs_conflict_p (xsize, x, ysize, y, c) a following reference, so we do nothing with that for now. */ if (GET_CODE (x) == AND || xsize < -INTVAL (XEXP (y, 1))) ysize = -1; - return memrefs_conflict_p (xsize, x, ysize, XEXP (y, 0), c); + return memrefs_conflict_p (xsize, x, ysize, canon_rtx (XEXP (y, 0)), c); } if (GET_CODE (x) == ADDRESSOF) diff --git a/gcc/config/i386/scodbx.h b/gcc/config/i386/scodbx.h deleted file mode 100644 index 7da93053256..00000000000 --- a/gcc/config/i386/scodbx.h +++ /dev/null @@ -1,84 +0,0 @@ -/* Definitions for Intel 386 running SCO Unix System V, - using dbx-in-coff encapsulation. - Copyright (C) 1992, 1995, 1996, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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 GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "i386/svr3dbx.h" - -/* Overridden defines for SCO systems from sco.h. */ - -/* By default, target has a 80387, uses IEEE compatible arithmetic, - and returns float values in the 387, ie, - (TARGET_80387 | TARGET_FLOAT_RETURNS_IN_80387) - - SCO's software emulation of a 387 fails to handle the `fucomp' - opcode. fucomp is only used when generating IEEE compliant code. - So don't make TARGET_IEEE_FP default for SCO. */ - -#undef TARGET_SUBTARGET_DEFAULT -#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_FLOAT_RETURNS) - -/* Use crt1.o as a startup file and crtn.o as a closing file. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!r:%{!z:svr3.ifile%s}%{z:svr3z.ifile%s}}\ - %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}" - -/* Library spec, including SCO international language support. */ - -#undef LIB_SPEC -#define LIB_SPEC \ - "%{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp} %{scointl:libintl.a%s} -lc" - -/* Specify predefined symbols in preprocessor. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -DM_UNIX -DM_I386 -DM_COFF -DM_WORDSWAP -Asystem=svr3" - -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) %{scointl:-DM_INTERNAT}" - -/* This spec is used for telling cpp whether char is signed or not. */ - -#undef SIGNED_CHAR_SPEC -#if DEFAULT_SIGNED_CHAR -#define SIGNED_CHAR_SPEC \ - "%{funsigned-char:-D__CHAR_UNSIGNED__ -D_CHAR_UNSIGNED}" -#else -#define SIGNED_CHAR_SPEC \ - "%{!fsigned-char:-D__CHAR_UNSIGNED__ -D_CHAR_UNSIGNED}" -#endif - -/* caller has to pop the extra argument passed to functions that return - structures. */ - -#undef RETURN_POPS_ARGS -#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \ - ((FUNDECL) && TREE_CODE (FUNDECL) == IDENTIFIER_NODE ? 0 \ - : (TARGET_RTD \ - && (TYPE_ARG_TYPES (FUNTYPE) == 0 \ - || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \ - == void_type_node))) ? (SIZE) \ - : 0) -/* On other 386 systems, the last line looks like this: - : (aggregate_value_p (TREE_TYPE (FUNTYPE))) ? GET_MODE_SIZE (Pmode) : 0) */ - -/* Handle #pragma pack. */ -#define HANDLE_SYSV_PRAGMA diff --git a/gcc/config/i386/xm-dgux.h b/gcc/config/i386/xm-dgux.h deleted file mode 100644 index 881c5c7be9d..00000000000 --- a/gcc/config/i386/xm-dgux.h +++ /dev/null @@ -1,4 +0,0 @@ -/* Configuration for GCC for Intel i386 running DG/ux */ - -/* looks just like sysv4 for now */ -#include "xm-svr4.h" diff --git a/gcc/config/i386/xm-sun.h b/gcc/config/i386/xm-sun.h deleted file mode 100644 index 6c0f0a25630..00000000000 --- a/gcc/config/i386/xm-sun.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Configuration for GNU C-compiler for Intel 80386 running SunOS 4.0. - Copyright (C) 1988, 1997 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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 GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define USG diff --git a/gcc/config/i386/xm-sysv3.h b/gcc/config/i386/xm-sysv3.h deleted file mode 100644 index 9a655443ff5..00000000000 --- a/gcc/config/i386/xm-sysv3.h +++ /dev/null @@ -1,3 +0,0 @@ -/* Configuration for GCC for Intel i386 running System V Release 3. */ - -#include "xm-svr3.h" diff --git a/gcc/fixinc/tests/base/internal/sgimacros.h b/gcc/fixinc/tests/base/internal/sgimacros.h deleted file mode 100644 index a491e865af7..00000000000 --- a/gcc/fixinc/tests/base/internal/sgimacros.h +++ /dev/null @@ -1,17 +0,0 @@ -/* DO NOT EDIT THIS FILE. - - It has been auto-edited by fixincludes from: - - "fixinc/tests/inc/internal/sgimacros.h" - - This had to be done to correct non-standard usages in the - original, manufacturer supplied header file. */ - - - -#if defined( IRIX___RESTRICT_CHECK ) -#ifdef __c99 -# ifndef __cplusplus -# define __restrict restrict -# endif -#endif /* IRIX___RESTRICT_CHECK */ diff --git a/gcc/fixinc/tests/base/internal/wchar_core.h b/gcc/fixinc/tests/base/internal/wchar_core.h deleted file mode 100644 index 5b358a32213..00000000000 --- a/gcc/fixinc/tests/base/internal/wchar_core.h +++ /dev/null @@ -1,15 +0,0 @@ -/* DO NOT EDIT THIS FILE. - - It has been auto-edited by fixincludes from: - - "fixinc/tests/inc/internal/wchar_core.h" - - This had to be done to correct non-standard usages in the - original, manufacturer supplied header file. */ - - - -#if defined( IRIX_WCSFTIME_CHECK ) -#if _NO_XOPEN5 && !defined(__c99) -extern size_t wcsftime(wchar_t *, __SGI_LIBC_NAMESPACE_QUALIFIER size_t, const char *, const struct tm *); -#endif /* IRIX_WCSFTIME_CHECK */ diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb42.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb42.C deleted file mode 100644 index c27aa8d2df7..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb42.C +++ /dev/null @@ -1,19 +0,0 @@ -//Build don't link: -#include <vector> -#include <algorithm> - -template <class T> class Expr -{ -public : -Expr(){}; -Expr(const T&){}; -}; - -template <class T > -inline bool compare(const Expr<T> a, const Expr<T> b){ return true; }; - -int main() -{ - std::vector<int> a(3); - std::sort( a.begin(), a.end(), compare ); // ERROR - no matching function -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000105-1.c b/gcc/testsuite/gcc.c-torture/compile/20000105-1.c deleted file mode 100644 index 6f389d88b22..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000105-1.c +++ /dev/null @@ -1,27 +0,0 @@ -main(int na, char* argv[]) -{ - int wflg = 0, tflg = 0; - int dflg = 0; - exit(0); - while(1) - { - switch(argv[1][0]) - { - help: - exit(0); - case 'w': - case 'W': - wflg = 1; - break; - case 't': - case 'T': - tflg = 1; - break; - case 'd': - dflg = 1; - break; - } - } -} - - diff --git a/gcc/testsuite/gcc.c-torture/compile/20000105-2.c b/gcc/testsuite/gcc.c-torture/compile/20000105-2.c deleted file mode 100644 index 7689395f45d..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000105-2.c +++ /dev/null @@ -1,5 +0,0 @@ -foo () -{ - long long int i = (int) ""; -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/20000120-1.c b/gcc/testsuite/gcc.c-torture/compile/20000120-1.c deleted file mode 100644 index 99843933bd0..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000120-1.c +++ /dev/null @@ -1,13 +0,0 @@ -extern char letters[26+1]; -char letter; -int letter_number; -char letters[] = "AbCdefghiJklmNopQrStuVwXyZ"; - -static void -pad_home1 () -{ - letter = letters[letter_number = - letters[letter_number + 1] ? letter_number + - 1 : 0]; -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/20000120-2.c b/gcc/testsuite/gcc.c-torture/compile/20000120-2.c deleted file mode 100644 index 737eb92ac64..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000120-2.c +++ /dev/null @@ -1,18 +0,0 @@ -extern __inline__ int -odd(int i) -{ - return i & 0x1; -} - -int -foo(int i, int j) -{ - return odd(i + j); -} - -int -odd(int i) -{ - return i & 0x1; -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/20000127-1.c b/gcc/testsuite/gcc.c-torture/compile/20000127-1.c deleted file mode 100644 index 34b173c680f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000127-1.c +++ /dev/null @@ -1,7 +0,0 @@ -double bar(void), c; -int foo(void) { - double a, b; - int i = bar() + bar(); - a = i; i += 1; a += 0.1; i = c + i; - return i; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000211-1.c b/gcc/testsuite/gcc.c-torture/compile/20000211-1.c deleted file mode 100644 index 8d8a4074e0f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000211-1.c +++ /dev/null @@ -1,98 +0,0 @@ -typedef long unsigned int size_t; -typedef unsigned char Bufbyte; -typedef int Bytecount; -typedef int Charcount; -typedef struct lstream Lstream; -typedef int Lisp_Object; -extern Lisp_Object Qnil; -extern inline int -TRUE_LIST_P (Lisp_Object object) -{ - return (( object ) == ( Qnil )) ; -} -struct Lisp_String -{ - Bytecount _size; - Bufbyte *_data; -}; -typedef enum lstream_buffering -{ - LSTREAM_LINE_BUFFERED, -} Lstream_buffering; -struct lstream -{ - Lstream_buffering buffering; - unsigned char *out_buffer; - size_t out_buffer_size; - size_t out_buffer_ind; - size_t byte_count; - long flags; - char data[1]; -}; -typedef struct printf_spec printf_spec; -struct printf_spec -{ -}; -typedef union printf_arg printf_arg; -union printf_arg -{ -}; -typedef struct -{ - int cur; -} printf_spec_dynarr; -typedef struct -{ -} printf_arg_dynarr; -static void -doprnt_1 (Lisp_Object stream, const Bufbyte *string, Bytecount len, - Charcount minlen, Charcount maxlen, int minus_flag, int zero_flag) -{ - Charcount cclen; - Bufbyte pad; - Lstream *lstr = (( struct lstream *) ((void *)(((( stream ) & ((1UL << ((4 * 8 ) - 4 ) ) - 1UL) ) ) | 0x40000000 )) ) ; - cclen = ( len ) ; - if (zero_flag) - pad = '0'; - pad = ' '; -#if 0 - if (minlen > cclen && !minus_flag) -#endif - { - int to_add = minlen - cclen; - while (to_add > 0) - { - (( lstr )->out_buffer_ind >= ( lstr )->out_buffer_size ? Lstream_fputc ( lstr , pad ) : (( lstr )->out_buffer[( lstr )->out_buffer_ind++] = (unsigned char) ( pad ), ( lstr )->byte_count++, ( lstr )->buffering == LSTREAM_LINE_BUFFERED && ( lstr )->out_buffer[( lstr )->out_buffer_ind - 1] == '\n' ? Lstream_flush_out ( lstr ) : 0)) ; - to_add--; - } - } - if (maxlen >= 0) - len = ( ((( maxlen ) <= ( cclen )) ? ( maxlen ) : ( cclen )) ) ; - Lstream_write (lstr, string, len); - if (minlen > cclen && minus_flag) - { - int to_add = minlen - cclen; - while (to_add > 0) - { - (( lstr )->out_buffer_ind >= ( lstr )->out_buffer_size ? Lstream_fputc ( lstr , pad ) : (( lstr )->out_buffer[( lstr )->out_buffer_ind++] = (unsigned char) ( pad ), ( lstr )->byte_count++, ( lstr )->buffering == LSTREAM_LINE_BUFFERED && ( lstr )->out_buffer[( lstr )->out_buffer_ind - 1] == '\n' ? Lstream_flush_out ( lstr ) : 0)) ; - to_add--; - } - } -} -static Bytecount -emacs_doprnt_1 (Lisp_Object stream, const Bufbyte *format_nonreloc, - Lisp_Object format_reloc, Bytecount format_length, - int nargs, - const Lisp_Object *largs) -{ - int i; - printf_spec_dynarr *specs = 0; - format_nonreloc = (( (( struct Lisp_String *) ((void *)(((( format_reloc ) & ((1UL << ((4 * 8 ) - 4 ) ) - 1UL) ) ) | 0x40000000 )) ) )->_data + 0) ; - format_length = (( (( struct Lisp_String *) ((void *)(((( format_reloc ) & ((1UL << ((4 * 8 ) - 4 ) ) - 1UL) ) ) | 0x40000000 )) ) )->_size) ; - specs = parse_doprnt_spec (format_nonreloc, format_length); - for (i = 0; i < (( specs )->cur) ; i++) - { - char ch; - doprnt_1 (stream, (Bufbyte *) &ch, 1, 0, -1, 0, 0); - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000211-3.c b/gcc/testsuite/gcc.c-torture/compile/20000211-3.c deleted file mode 100644 index 7e43c8ad467..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000211-3.c +++ /dev/null @@ -1,10 +0,0 @@ -void f_clos(int x) - -{ - switch(x) { - default: - mumble: - } -} - - diff --git a/gcc/testsuite/gcc.c-torture/compile/20000224-1.c b/gcc/testsuite/gcc.c-torture/compile/20000224-1.c deleted file mode 100644 index 1c72b6accab..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000224-1.c +++ /dev/null @@ -1,41 +0,0 @@ -enum Lisp_Type -{ - Lisp_Int - ,Lisp_Record - ,Lisp_Cons - ,Lisp_String - ,Lisp_Vector - ,Lisp_Symbol - ,Lisp_Char -}; -typedef -union Lisp_Object - { - struct - { - enum Lisp_Type type: 3L ; - unsigned long markbit: 1; - unsigned long val: 32; - } gu; - long i; - } -Lisp_Object; -extern int initialized; -void -init_device_faces (int *d) -{ - if (initialized) - { - Lisp_Object tdevice; - do { - tdevice = (union Lisp_Object) - { gu: - { markbit: 0, - type: Lisp_Record, - val: ((unsigned long )d) - } - }; - } while (0); - call_critical_lisp_code (tdevice); - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000314-1.c b/gcc/testsuite/gcc.c-torture/compile/20000314-1.c deleted file mode 100644 index 26c13a7d685..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000314-1.c +++ /dev/null @@ -1,11 +0,0 @@ -struct { - char a[5]; -} *p; - -int main () -{ - int i = -1; - - if(p->a[-i]) - return 1; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000314-2.c b/gcc/testsuite/gcc.c-torture/compile/20000314-2.c deleted file mode 100644 index 3fdb3c3a857..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000314-2.c +++ /dev/null @@ -1,6 +0,0 @@ -extern void malloc(__SIZE_TYPE__ size); - -toto() -{ - malloc(100); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000319-1.c b/gcc/testsuite/gcc.c-torture/compile/20000319-1.c deleted file mode 100644 index db00e4f016f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000319-1.c +++ /dev/null @@ -1,6 +0,0 @@ -struct foo -{ - long x; - char y; - long boom[0]; -}; diff --git a/gcc/testsuite/gcc.c-torture/compile/20000326-1.c b/gcc/testsuite/gcc.c-torture/compile/20000326-1.c deleted file mode 100644 index 71ed149c8ed..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000326-1.c +++ /dev/null @@ -1,23 +0,0 @@ -long sys_reboot(int magic1, int magic2, int cmd, void * arg) -{ - switch (cmd) { - case 0x89ABCDEF: - break; - - case 0x00000000: - break; - - case 0xCDEF0123: - break; - - case 0x4321FEDC: - break; - - case 0xA1B2C3D4: - break; - - default: - break; - }; - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000326-2.c b/gcc/testsuite/gcc.c-torture/compile/20000326-2.c deleted file mode 100644 index 055260f6e64..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000326-2.c +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef NO_LABEL_VALUES -extern int printk(const char *fmt, ...); - -void foo (int x, int y) -{ - __label__ here; - here: - printk ("", &&here); -} - -#else -int x; -#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/20000329-1.c b/gcc/testsuite/gcc.c-torture/compile/20000329-1.c deleted file mode 100644 index 547bf96f955..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000329-1.c +++ /dev/null @@ -1,40 +0,0 @@ -int giop_tx_big_endian; - -inline -void -giop_encode_ulong (unsigned long i, char *buf) -{ - if (giop_tx_big_endian) - { - *(unsigned long *) buf = i; - } - else - { - *buf++ = i & 0xff; - *buf++ = (i >> 8) & 0xff; - *buf++ = (i >> 16) & 0xff; - *buf = (i >> 24) & 0xff; - } -} - - - -static -double -time_giop_encode (unsigned long l) -{ - int c; - char buf[4]; - - for (c = 0; c < (512 * 1024 * 1024); ++c) - { - giop_encode_ulong (l, buf); - } -} - -int -main (int ac, char *av[]) -{ - giop_tx_big_endian = 1; - time_giop_encode (0); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000403-1.c b/gcc/testsuite/gcc.c-torture/compile/20000403-1.c deleted file mode 100644 index 27345b56fef..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000403-1.c +++ /dev/null @@ -1,18 +0,0 @@ -struct utsname { - char sysname[32 ]; - char version[32 ]; -}; -int -uname(name) - struct utsname *name; -{ - int mib[2], rval; - long len; - char *p; - int oerrno; - if (sysctl(mib, 2, &name->sysname, &len, 0 , 0) == -1) - ; - for (p = name->version; len--; ++p) { - *p = ' '; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000403-2.c b/gcc/testsuite/gcc.c-torture/compile/20000403-2.c deleted file mode 100644 index c793a49fb6c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000403-2.c +++ /dev/null @@ -1,6 +0,0 @@ -void -foo () -{ - long long tmp; - (( tmp ) = (long long)( tmp ) >> ( 32 )) ; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000405-1.c b/gcc/testsuite/gcc.c-torture/compile/20000405-1.c deleted file mode 100644 index 64dd2e16882..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000405-1.c +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (C) 2000 Free Software Foundation - -// by Alexandre Oliva <oliva@lsd.ic.unicamp.br> -// simplified from libio/floatconv.c - -static const double bar[] = { 0 }; -int j; - -double -foo () -{ - return bar[j]; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000405-2.c b/gcc/testsuite/gcc.c-torture/compile/20000405-2.c deleted file mode 100644 index 0b8559f1436..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000405-2.c +++ /dev/null @@ -1,6 +0,0 @@ -extern void foo (int); - -void bar (unsigned long l) -{ - foo(l == 0); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000405-3.c b/gcc/testsuite/gcc.c-torture/compile/20000405-3.c deleted file mode 100644 index c2e88339eea..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000405-3.c +++ /dev/null @@ -1,9 +0,0 @@ -struct foo { - void *entry[40]; -} __attribute__ ((aligned(32))); - -int foo (struct foo *ptr, int idx, void *pointer) -{ - ptr->entry[idx] = pointer; - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000412-1.c b/gcc/testsuite/gcc.c-torture/compile/20000412-1.c deleted file mode 100644 index 243b469e7d2..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000412-1.c +++ /dev/null @@ -1,16 +0,0 @@ -typedef struct { - short a; - short b; -} s1; - -extern void g(unsigned char *b); - -void f(void) -{ - s1 a; - unsigned char *b; - - a.a = 0; - b = (unsigned char *)&a; - g(b); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000412-2.c b/gcc/testsuite/gcc.c-torture/compile/20000412-2.c deleted file mode 100644 index e76a1eb73b5..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000412-2.c +++ /dev/null @@ -1,4 +0,0 @@ -char list[250][64]; - -int f(int idx) { return (strlen(list[idx])); } - diff --git a/gcc/testsuite/gcc.c-torture/compile/20000420-1.c b/gcc/testsuite/gcc.c-torture/compile/20000420-1.c deleted file mode 100644 index 552f02e423c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000420-1.c +++ /dev/null @@ -1,19 +0,0 @@ -struct z_candidate { struct z_candidate *next;int viable;}; -int pedantic; - -static struct z_candidate * -splice_viable (cands) - struct z_candidate *cands; -{ - struct z_candidate **p = &cands; - - for (; *p; ) - { - if (pedantic ? (*p)->viable == 1 : (*p)->viable) - p = &((*p)->next); - else - *p = (*p)->next; - } - - return cands; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000420-2.c b/gcc/testsuite/gcc.c-torture/compile/20000420-2.c deleted file mode 100644 index 2d825f01992..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000420-2.c +++ /dev/null @@ -1,11 +0,0 @@ -struct x { int a, b, c; }; - -extern struct x a (); -extern void b (struct x); - -void -foo () -{ - a (); - b (a ()); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000427-1.c b/gcc/testsuite/gcc.c-torture/compile/20000427-1.c deleted file mode 100644 index dc51419cf01..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000427-1.c +++ /dev/null @@ -1,9 +0,0 @@ -int lwidth; -int lheight; -void ConvertFor3dDriver (int requirePO2, int maxAspect) -{ - int oldw = lwidth, oldh = lheight; - - lheight = FindNearestPowerOf2 (lheight); - while (lwidth/lheight > maxAspect) lheight += lheight; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000502-1.c b/gcc/testsuite/gcc.c-torture/compile/20000502-1.c deleted file mode 100644 index fcf7899a159..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000502-1.c +++ /dev/null @@ -1,17 +0,0 @@ -static int minimum(int a, int b) -{ - if(a < b) - return a; - else - return b; -} -static int a, b; -static inline int foo(void) -{ - a = minimum (a, b); - return 0; -} -static int bar(void) -{ - return foo(); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000504-1.c b/gcc/testsuite/gcc.c-torture/compile/20000504-1.c deleted file mode 100644 index 1941bb34da5..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000504-1.c +++ /dev/null @@ -1,15 +0,0 @@ -struct foo { - int a; - int b; -}; - -int func(struct foo *foo, int a) -{ - if (foo->b == 0) { - int ret = foo->a = a; - if (a >= 0) - foo->a = a; - return (ret); - } - return (0); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000511-1.c b/gcc/testsuite/gcc.c-torture/compile/20000511-1.c deleted file mode 100644 index 11c131522e6..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000511-1.c +++ /dev/null @@ -1,31 +0,0 @@ -typedef struct { - char y; - char x[32]; -} X; - -int z (void) -{ - X xxx; - xxx.x[0] = - xxx.x[31] = '0'; - xxx.y = 0xf; - return f (xxx, xxx); -} - -int main (void) -{ - int val; - - val = z (); - if (val != 0x60) - abort (); - exit (0); -} - -int f(X x, X y) -{ - if (x.y != y.y) - return 'F'; - - return x.x[0] + y.x[0]; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000517-1.c b/gcc/testsuite/gcc.c-torture/compile/20000517-1.c deleted file mode 100644 index 903e61eefad..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000517-1.c +++ /dev/null @@ -1,9 +0,0 @@ -void test2 (int*, int, int, int); - -void test () -{ - int l; - - test2 (0, 0, 0, 0); - test2 (&l, 0, 0, 0); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000518-1.c b/gcc/testsuite/gcc.c-torture/compile/20000518-1.c deleted file mode 100644 index fda44b657cc..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000518-1.c +++ /dev/null @@ -1,17 +0,0 @@ -void callit1(void*); - -extern __inline__ void test() -{ - __label__ l1; - - callit1(&&l1); - -l1: - -} - - -void dotest() -{ - test(); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000523-1.c b/gcc/testsuite/gcc.c-torture/compile/20000523-1.c deleted file mode 100644 index eab4a9c42d1..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000523-1.c +++ /dev/null @@ -1,5 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation */ -/* Contributed by Alexandre Oliva <aoliva@cygnus.com> */ - -enum { foo = sizeof(void *) }; -int i = sizeof(void *); diff --git a/gcc/testsuite/gcc.c-torture/compile/20000605-1.c b/gcc/testsuite/gcc.c-torture/compile/20000605-1.c deleted file mode 100644 index 1fe5882340f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000605-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation */ - -/* make sure we don't get confused by various flavors of void */ - -/* Origin: Jakub Jelinek <jakub@redhat.com> - * Joel Sherrill <joel.sherrill@OARcorp.com> - */ - -typedef void foo; -foo bar(void); -void baz(void) -{ - bar(); -} - -void volatile f(); - -int x() -{ - f(); -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/20000606-1.c b/gcc/testsuite/gcc.c-torture/compile/20000606-1.c deleted file mode 100644 index 93977c0931a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000606-1.c +++ /dev/null @@ -1,10 +0,0 @@ -typedef struct _foo foo; -extern foo bar; -struct _foo { - int a; -}; - -void baz(void) -{ - bar.a = 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000609-1.c b/gcc/testsuite/gcc.c-torture/compile/20000609-1.c deleted file mode 100644 index f03aa35a7ac..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000609-1.c +++ /dev/null @@ -1,6 +0,0 @@ -int main () -{ - char temp[1024] = "tempfile"; - return temp[0] != 't'; -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/20000629-1.c b/gcc/testsuite/gcc.c-torture/compile/20000629-1.c deleted file mode 100644 index 58b522ed815..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000629-1.c +++ /dev/null @@ -1,28 +0,0 @@ -struct a -{ - struct a * x; -}; - -void -foo (struct a * b) -{ - int i; - - for (i = 0; i < 1000; i++) - { - b->x = b; - b++; - } -} - -void -bar (struct a * b) -{ - int i; - - for (i = 0; i < 1000; i++) - { - b->x = b; - b--; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000701-1.c b/gcc/testsuite/gcc.c-torture/compile/20000701-1.c deleted file mode 100644 index 2f1e731579b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000701-1.c +++ /dev/null @@ -1,19 +0,0 @@ -void -dr106_1(void *pv, int i) -{ - *pv; - i ? *pv : *pv; - *pv, *pv; -} - -void -dr106_2(const void *pcv, volatile void *pvv, int i) -{ - *pcv; - i ? *pcv : *pcv; - *pcv, *pcv; - - *pvv; - i ? *pvv : *pvv; - *pvv, *pvv; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000717-1.c b/gcc/testsuite/gcc.c-torture/compile/20000717-1.c deleted file mode 100644 index 9a0c747ad5b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000717-1.c +++ /dev/null @@ -1,11 +0,0 @@ -short -inner_product (short *a, short *b) -{ - int i; - short sum = 0; - - for (i = 9; i >= 0; i--) - sum += (*a++) * (*b++); - - return sum; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000718.c b/gcc/testsuite/gcc.c-torture/compile/20000718.c deleted file mode 100644 index acabaf16011..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000718.c +++ /dev/null @@ -1,14 +0,0 @@ -extern double foo(double, double); -extern void bar(float*, int*); - -void -baz(int* arg) -{ - float tmp = (float)foo(2.0,1.0); - unsigned i; - short junk[64]; - - for (i=0; i<10; i++, arg++) { - bar(&tmp, arg); - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000728-1.c b/gcc/testsuite/gcc.c-torture/compile/20000728-1.c deleted file mode 100644 index f56d940834e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000728-1.c +++ /dev/null @@ -1,16 +0,0 @@ -struct clock { - long sec; long usec; -}; - -int foo(void) -{ - struct clock clock_old = {0, 0}; - - for (;;) { - long foo; - - if (foo == clock_old.sec && 0 == clock_old.usec); - } - return 0; -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/20000802-1.c b/gcc/testsuite/gcc.c-torture/compile/20000802-1.c deleted file mode 100644 index 0b2f1d6af56..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000802-1.c +++ /dev/null @@ -1,15 +0,0 @@ -struct foo { - char a[3]; - char b; - char c; -}; - -struct foo bs; -int x; -char y[3]; - -void bar(void) -{ - memcpy(bs.a, y, 3); - bs.a[1] = ((x ? &bs.b : &bs.c) - (char *)&bs) - 2; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000803-1.c b/gcc/testsuite/gcc.c-torture/compile/20000803-1.c deleted file mode 100644 index 08b50a9f210..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000803-1.c +++ /dev/null @@ -1,11 +0,0 @@ -static int gl_cnt = 0; -static char gl_buf[1024]; - -void -gl_yank() -{ - int i; - - for (i=gl_cnt; i >= 0; i--) - gl_buf[i+10] = gl_buf[i]; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000804-1.c b/gcc/testsuite/gcc.c-torture/compile/20000804-1.c deleted file mode 100644 index d99cb7b5584..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000804-1.c +++ /dev/null @@ -1,12 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation */ -__complex__ long long f () -{ - int i[99]; - __complex__ long long v; - - v += f (); - asm("": "+r" (v) : "r" (0), "r" (1)); - v = 2; - return v; - g (&v); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000804-1.x b/gcc/testsuite/gcc.c-torture/compile/20000804-1.x deleted file mode 100644 index 458c8e720e3..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000804-1.x +++ /dev/null @@ -1,8 +0,0 @@ -# This does not work on m68hc11 due to the use of an asm statement -# to force a 'long long' (64-bits) to go in a register. - -if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { - return 1 -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/20000818-1.c b/gcc/testsuite/gcc.c-torture/compile/20000818-1.c deleted file mode 100644 index 01f10f60cf2..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000818-1.c +++ /dev/null @@ -1,6 +0,0 @@ -void -foo (long double x) -{ - struct {long double t;} y = {x}; -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/20000825-1.c b/gcc/testsuite/gcc.c-torture/compile/20000825-1.c deleted file mode 100644 index 3c2e5bda75a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000825-1.c +++ /dev/null @@ -1,31 +0,0 @@ -typedef signed int s32; -typedef signed long s64; -typedef unsigned int u32; -typedef unsigned long u64; - -extern __inline__ u32 foobar(int logmask) -{ - u32 ret = ~(1 << logmask); // fails - // s32 ret = ~(1 << logmask); // ok - // u64 ret = ~(1 << logmask); // ok - // s64 ret = ~(1 << logmask); // ok - return ret; -} - -// This procedure compiles fine... -u32 good(u32 var) -{ - var = foobar(0); - return var; -} - -// This procedure does not compile... -// Same as above, but formal parameter is a pointer -// Both good() and fails() compile ok if we choose -// a different type for "ret" in foobar(). -u32 fails(u32 *var) -{ - *var = foobar(0); - return *var; -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/20000827-1.c b/gcc/testsuite/gcc.c-torture/compile/20000827-1.c deleted file mode 100644 index a985f908b2b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000827-1.c +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation */ -/* Contributed by Alexandre Oliva <aoliva@redhat.com> */ - -int -foo () -{ - while (1) - { - int a; - char b; - /* gcse should not merge these asm statements, since their - output operands have different modes. */ - __asm__("":"=r" (a)); __asm__("":"=r" (b)); - if (b) - return a; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000922-1.c b/gcc/testsuite/gcc.c-torture/compile/20000922-1.c deleted file mode 100644 index 0fef966e676..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000922-1.c +++ /dev/null @@ -1,12 +0,0 @@ -extern void doit(int); -void -quick_doit(int x) -{ -#ifdef __OPTIMIZE__ - if (__builtin_constant_p (x) - && x != 0) - asm volatile ("%0" : : "i#*X"(x)); - else -#endif - doit(x); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000923-1.c b/gcc/testsuite/gcc.c-torture/compile/20000923-1.c deleted file mode 100644 index 9ed98868206..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20000923-1.c +++ /dev/null @@ -1,8 +0,0 @@ -const int a = 3; -const int b = 50; - -void foo (void) -{ - long int x[a][b]; - asm ("" : : "r" (x) : "memory"); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001018-1.c b/gcc/testsuite/gcc.c-torture/compile/20001018-1.c deleted file mode 100644 index 86e5cd5dda9..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20001018-1.c +++ /dev/null @@ -1,10 +0,0 @@ -void -foo (void) -{ - extern char i[10]; - - { - extern char i[]; - char x[sizeof (i) == 10 ? 1 : -1]; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001024-1.c b/gcc/testsuite/gcc.c-torture/compile/20001024-1.c deleted file mode 100644 index 59208cde107..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20001024-1.c +++ /dev/null @@ -1,13 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation */ -/* Contributed by Nathan Sidwell <nathan@codesourcery.com> */ - -typedef __SIZE_TYPE__ size_t; - -extern void *memset(void *, int, size_t); - -struct Baz; - -void quux(struct Baz *context) -{ - memset(context, 0, 4); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001109-1.c b/gcc/testsuite/gcc.c-torture/compile/20001109-1.c deleted file mode 100644 index cce8047ae8a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20001109-1.c +++ /dev/null @@ -1,7 +0,0 @@ -typedef struct _foo foo; -extern foo bar; -struct _foo { - int a; -}; - -int tst[__alignof__ (bar) >= __alignof__ (int) ? 1 : -1]; diff --git a/gcc/testsuite/gcc.c-torture/compile/20001109-2.c b/gcc/testsuite/gcc.c-torture/compile/20001109-2.c deleted file mode 100644 index a23e56bd34b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20001109-2.c +++ /dev/null @@ -1,6 +0,0 @@ -extern struct foo bar; -struct foo { - int a; -}; - -int tst[__alignof__ (bar) >= __alignof__ (int) ? 1 : -1]; diff --git a/gcc/testsuite/gcc.c-torture/compile/20001116-1.c b/gcc/testsuite/gcc.c-torture/compile/20001116-1.c deleted file mode 100644 index c356392fa37..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20001116-1.c +++ /dev/null @@ -1,3 +0,0 @@ -int x[60]; -char *y = ((char*)&(x[2*8 + 2]) - 8); -int z = (&"Foobar"[1] - &"Foobar"[0]); diff --git a/gcc/testsuite/gcc.c-torture/compile/20001121-1.c b/gcc/testsuite/gcc.c-torture/compile/20001121-1.c deleted file mode 100644 index 38efe6da0fe..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20001121-1.c +++ /dev/null @@ -1,21 +0,0 @@ -extern int bar(int); - -int foo(int x) -{ - return 1 + bar( - ({ - int y; - switch (x) - { - case 0: y = 1; break; - case 1: y = 2; break; - case 2: y = 3; break; - case 3: y = 4; break; - case 4: y = 5; break; - case 5: y = 6; break; - default: y = 7; break; - } - y; - }) - ); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001123-1.c b/gcc/testsuite/gcc.c-torture/compile/20001123-1.c deleted file mode 100644 index 59534480db2..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20001123-1.c +++ /dev/null @@ -1,11 +0,0 @@ - -typedef __builtin_va_list __gnuc_va_list; -typedef __gnuc_va_list va_list; - -struct X { int y; }; - -void func(va_list va) -{ - char* a = __builtin_va_arg(va, char**)[0]; - int b = __builtin_va_arg(va, struct X*)->y; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001123-2.c b/gcc/testsuite/gcc.c-torture/compile/20001123-2.c deleted file mode 100644 index dcb5dd1fa3e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20001123-2.c +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright 2000 Free Software Foundation - - by Alexandre Oliva <aoliva@redhat.com> - - Based on zlib/gzio.c. - - This used to generate duplicate labels when compiled with - sh-elf-gcc -O2 -m3 -fPIC. - - Bug reported by NIIBE Yutaka <gniibe@m17n.org>. */ - -void foo (void); - -void -bar () -{ - unsigned len; - - for (len = 0; len < 2; len++) - foo (); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001205-1.c b/gcc/testsuite/gcc.c-torture/compile/20001205-1.c deleted file mode 100644 index 69708e59ea0..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20001205-1.c +++ /dev/null @@ -1,21 +0,0 @@ -static inline unsigned long rdfpcr(void) -{ - unsigned long tmp, ret; - __asm__ ("" : "=r"(tmp), "=r"(ret)); - return ret; -} - -static inline unsigned long -swcr_update_status(unsigned long swcr, unsigned long fpcr) -{ - swcr &= ~0x7e0000ul; - swcr |= (fpcr >> 3) & 0x7e0000ul; - return swcr; -} - -unsigned long osf_getsysinfo(unsigned long flags) -{ - unsigned long w; - w = swcr_update_status(flags, rdfpcr()); - return w; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001205-1.x b/gcc/testsuite/gcc.c-torture/compile/20001205-1.x deleted file mode 100644 index 134cdf109fe..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20001205-1.x +++ /dev/null @@ -1,7 +0,0 @@ -# This does not work on m68hc11 due to the asm statement which -# forces two 'long' (32-bits) variables to go in registers. - -if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { - return 1 -} -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/20001212-1.c b/gcc/testsuite/gcc.c-torture/compile/20001212-1.c deleted file mode 100644 index 009138c5d3f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20001212-1.c +++ /dev/null @@ -1,10 +0,0 @@ -typedef struct -{ - long double l; -} ld; - -ld a (ld x, ld y) -{ - ld b; - b.l = x.l + y.l; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001221-1.c b/gcc/testsuite/gcc.c-torture/compile/20001221-1.c deleted file mode 100644 index 66ae7141147..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20001221-1.c +++ /dev/null @@ -1,70 +0,0 @@ -static void -foo () -{ - long maplength; - int type; - { - const long nibbles = 8; - char buf1[nibbles + 1]; - char buf2[nibbles + 1]; - char buf3[nibbles + 1]; - buf1[nibbles] = '\0'; - buf2[nibbles] = '\0'; - buf3[nibbles] = '\0'; - ((nibbles) <= 16 - ? (({ - void *__s = (buf1); - union - { - unsigned int __ui; - unsigned short int __usi; - unsigned char __uc; - } - *__u = __s; - unsigned char __c = (unsigned char)('0'); - switch ((unsigned int) (nibbles)) - { - case 16: - __u->__ui = __c * 0x01010101; - __u = __extension__ ((void *) __u + 4); - case 12: - __u->__ui = __c * 0x01010101; - __u = __extension__ ((void *) __u + 4); - case 0: - break; - } - __s; - })) - : 0); - ((nibbles) <= 16 - ? (({ - void *__s = (buf2); - union - { - unsigned int __ui; - unsigned short int __usi; - unsigned char __uc; - } - *__u = __s; - unsigned char __c = (unsigned char)('0'); - switch ((unsigned int) (nibbles)) - { - case 16: - __u->__ui = __c * 0x01010101; - __u = __extension__ ((void *) __u + 4); - case 12: - __u->__ui = __c * 0x01010101; - __u = __extension__ ((void *) __u + 4); - case 8: - __u->__ui = __c * 0x01010101; - __u = __extension__ ((void *) __u + 4); - case 4: - __u->__ui = __c * 0x01010101; - case 0: - break; - } - __s; - })) - : 0); - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001222-1.c b/gcc/testsuite/gcc.c-torture/compile/20001222-1.c deleted file mode 100644 index de97eeef70e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20001222-1.c +++ /dev/null @@ -1,6 +0,0 @@ -/* Testcase for PR c/1501. */ -double __complex__ -f (void) -{ - return ~(1.0 + 2.0i); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c deleted file mode 100644 index 54dacf74167..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* This testcase exposed two branch shortening bugs on powerpc. */ - -#define C(a,b) \ - if (a > b) goto gt; \ - if (a < b) goto lt; - -#define C4(x,b) C((x)[0], b) C((x)[1],b) C((x)[2],b) C((x)[3],b) -#define C16(x,y) C4(x, (y)[0]) C4(x, (y)[1]) C4(x, (y)[2]) C4(x, (y)[3]) - -#define C64(x,y) C16(x,y) C16(x+4,y) C16(x+8,y) C16(x+12,y) -#define C256(x,y) C64(x,y) C64(x,y+4) C64(x,y+8) C64(x,y+12) - -#define C1024(x,y) C256(x,y) C256(x+16,y) C256(x+32,y) C256(x+48,y) -#define C4096(x,y) C1024(x,y) C1024(x,y+16) C1024(x,y+32) C1024(x,y+48) - -unsigned foo(int x[64], int y[64]) -{ - C4096(x,y); - - return 0x01234567; - gt: - return 0x12345678; - lt: - return 0xF0123456; -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/20001226-1.x b/gcc/testsuite/gcc.c-torture/compile/20001226-1.x deleted file mode 100644 index 6e46f46724e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20001226-1.x +++ /dev/null @@ -1,22 +0,0 @@ -# This does not assemble on m68hc11 because the function is larger -# than 64K. - -global target_triplet -if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { - return 1 -} - -# It doesn't work on Xtensa with -O0 because the function is larger -# than the range of a jump instruction (+- 128K) and the assembler -# does not yet relax jumps to indirect jumps. - -set torture_eval_before_compile { - set compiler_conditional_xfail_data { - "jump beyond 128K not supported" \ - "xtensa-*-*" \ - { "-O0" } \ - { "" } - } -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/20010102-1.c b/gcc/testsuite/gcc.c-torture/compile/20010102-1.c deleted file mode 100644 index a409b566098..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010102-1.c +++ /dev/null @@ -1,101 +0,0 @@ -/* This testcase derives from gnu obstack.c/obstack.h and failed with - -O3 -funroll-all-loops, or -O1 -frename-registers -funroll-loops on - sparc-sun-solaris2.7. - - Copyright (C) 2001 Free Software Foundation. */ - -# define PTR_INT_TYPE __PTRDIFF_TYPE__ - -struct _obstack_chunk -{ - char *limit; - struct _obstack_chunk *prev; - char contents[4]; -}; - -struct obstack -{ - long chunk_size; - struct _obstack_chunk *chunk; - char *object_base; - char *next_free; - char *chunk_limit; - PTR_INT_TYPE temp; - int alignment_mask; - struct _obstack_chunk *(*chunkfun) (void *, long); - void (*freefun) (void *, struct _obstack_chunk *); - void *extra_arg; - unsigned use_extra_arg:1; - unsigned maybe_empty_object:1; - unsigned alloc_failed:1; -}; - -extern void _obstack_newchunk (struct obstack *, int); - -struct fooalign {char x; double d;}; -#define DEFAULT_ALIGNMENT \ - ((PTR_INT_TYPE) ((char *) &((struct fooalign *) 0)->d - (char *) 0)) -union fooround {long x; double d;}; -#define DEFAULT_ROUNDING (sizeof (union fooround)) - -#ifndef COPYING_UNIT -#define COPYING_UNIT int -#endif - -#define CALL_CHUNKFUN(h, size) \ - (((h) -> use_extra_arg) \ - ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \ - : (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size))) - -#define CALL_FREEFUN(h, old_chunk) \ - do { \ - if ((h) -> use_extra_arg) \ - (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \ - else \ - (*(void (*) (void *)) (h)->freefun) ((old_chunk)); \ - } while (0) - -void -_obstack_newchunk (h, length) - struct obstack *h; - int length; -{ - register struct _obstack_chunk *old_chunk = h->chunk; - register struct _obstack_chunk *new_chunk; - register long new_size; - register long obj_size = h->next_free - h->object_base; - register long i; - long already; - - new_size = (obj_size + length) + (obj_size >> 3) + 100; - if (new_size < h->chunk_size) - new_size = h->chunk_size; - - new_chunk = CALL_CHUNKFUN (h, new_size); - h->chunk = new_chunk; - new_chunk->prev = old_chunk; - new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size; - - if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT) - { - for (i = obj_size / sizeof (COPYING_UNIT) - 1; - i >= 0; i--) - ((COPYING_UNIT *)new_chunk->contents)[i] - = ((COPYING_UNIT *)h->object_base)[i]; - already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT); - } - else - already = 0; - for (i = already; i < obj_size; i++) - new_chunk->contents[i] = h->object_base[i]; - - if (h->object_base == old_chunk->contents && ! h->maybe_empty_object) - { - new_chunk->prev = old_chunk->prev; - CALL_FREEFUN (h, old_chunk); - } - - h->object_base = new_chunk->contents; - h->next_free = h->object_base + obj_size; - h->maybe_empty_object = 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010107-1.c b/gcc/testsuite/gcc.c-torture/compile/20010107-1.c deleted file mode 100644 index 222def4d9ef..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010107-1.c +++ /dev/null @@ -1,6 +0,0 @@ -unsigned long x[4]; - -void foo(void) -{ - ((void (*)())(x+2))(); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010112-1.c b/gcc/testsuite/gcc.c-torture/compile/20010112-1.c deleted file mode 100644 index 69bbe169e31..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010112-1.c +++ /dev/null @@ -1,14 +0,0 @@ -/* Test that putting an initialized variable in a register works. */ - -#ifdef __i386__ -#define REGISTER asm ("eax") -#elif defined (__arm__) -#define REGISTER asm ("r0") -#else -/* Put examples for other architectures here. */ -#define REGISTER -#endif - -void f() { - register int i REGISTER = 3; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010113-1.c b/gcc/testsuite/gcc.c-torture/compile/20010113-1.c deleted file mode 100644 index 35b7c1f1d7e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010113-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* Origin: PR c/364 from and@genesyslab.com, very much reduced to a - testcase by Joseph Myers <jsm28@cam.ac.uk>. - - The initializer of z is a valid address constant, and GCC 2.95.2 - accepts it as such. CVS GCC as of 2001-01-13 rejects it, but accepts - it if y is changed to x in the initializer. */ - -struct { - struct { - int x; - int y; - } p; -} v; - -int *z = &((&(v.p))->y); diff --git a/gcc/testsuite/gcc.c-torture/compile/20010114-1.c b/gcc/testsuite/gcc.c-torture/compile/20010114-1.c deleted file mode 100644 index 9b608aad132..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010114-1.c +++ /dev/null @@ -1,5 +0,0 @@ -/* Origin: PR c/166 from Joerg Czeranski <jc@joerch.org>. */ -/* In the declaration of proc, x cannot be parsed as a typedef name, - so it must be parsed as a parameter name. */ -typedef int x; -void proc(int (*x)(void)) {} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010114-2.c b/gcc/testsuite/gcc.c-torture/compile/20010114-2.c deleted file mode 100644 index 75f5ea20e09..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010114-2.c +++ /dev/null @@ -1,6 +0,0 @@ -/* Origin: <URL:http://gcc.gnu.org/ml/gcc-patches/2000-12/msg01384.html> - from Fred Fish <fnf@geekgadgets.org>. See also PR c/1625. */ - -#include <stdbool.h> - -struct { int x; bool y; } foo = { 0, false }; diff --git a/gcc/testsuite/gcc.c-torture/compile/20010117-1.c b/gcc/testsuite/gcc.c-torture/compile/20010117-1.c deleted file mode 100644 index d0772b3c32d..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010117-1.c +++ /dev/null @@ -1,7 +0,0 @@ -unsigned char u, v, w; - -void baz (void) -{ - if ((u - v - w) & 0x80) - v = 1; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010117-2.c b/gcc/testsuite/gcc.c-torture/compile/20010117-2.c deleted file mode 100644 index 813468b56b2..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010117-2.c +++ /dev/null @@ -1,20 +0,0 @@ -unsigned char a, b; - -void baz (void) -{ - if (b & 0x08) - { - int g = 0; - int c = (b & 0x01); - int d = a - g - c; - int e = (a & 0x0f) - (g & 0x0f); - int f = (a & 0xf0) - (g & 0xf0); - int h = (a & 0x0f) - (g & 0x0f); - - if ((a ^ g) & (a ^ d) & 0x80) b |= 0x40; - if ((d & 0xff00) == 0) b |= 0x01; - if (!((a - h - c) & 0xff)) b |= 0x02; - if ((a - g - c) & 0x80) b |= 0x80; - a = (e & 0x0f) | (f & 0xf0); - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010118-1.c b/gcc/testsuite/gcc.c-torture/compile/20010118-1.c deleted file mode 100644 index 6d1fc6431c6..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010118-1.c +++ /dev/null @@ -1,21 +0,0 @@ -static unsigned int bar(void *h, unsigned int n) -{ - static int i; - return i++; -} - -static void baz(unsigned int *x) -{ - (*x)++; -} - -long -foo(void *h, unsigned int l) -{ - unsigned int n; - long m; - n = bar(h, 0); - n = bar(h, n); - m = ({ baz(&n); 21; }); - return m; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010124-1.c b/gcc/testsuite/gcc.c-torture/compile/20010124-1.c deleted file mode 100644 index dd2d9c11737..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010124-1.c +++ /dev/null @@ -1,9 +0,0 @@ -/* Origin: testcase from Joseph Myers <jsm28@cam.ac.uk>, problem pointed - out in a post to comp.std.c - <980283801.3063.0.nnrp-07.c2deb1c2@news.demon.co.uk> - by Dibyendu Majumdar <dibyendu@mazumdar.demon.co.uk>. - Compound literals should be parsed as postfix expressions, rather than - as cast expressions. In particular, they are valid operands of sizeof. */ - -struct s { int a; int b; }; -char x[((sizeof (struct s){ 1, 2 }) == sizeof (struct s)) ? 1 : -1]; diff --git a/gcc/testsuite/gcc.c-torture/compile/20010202-1.c b/gcc/testsuite/gcc.c-torture/compile/20010202-1.c deleted file mode 100644 index e72586a3371..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010202-1.c +++ /dev/null @@ -1,6 +0,0 @@ -int foo (int n, char m[1][n]); - -int foo (int n, char m[1][n]) -{ -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/20010209-1.c b/gcc/testsuite/gcc.c-torture/compile/20010209-1.c deleted file mode 100644 index 20434644be6..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010209-1.c +++ /dev/null @@ -1,7 +0,0 @@ -short int a; - -int main (void) -{ - a = 65535.0; - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010226-1.c b/gcc/testsuite/gcc.c-torture/compile/20010226-1.c deleted file mode 100644 index c06be53dc52..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010226-1.c +++ /dev/null @@ -1,22 +0,0 @@ -void f1 (void *); -void f3 (void *, void (*)(void *)); -void f2 (void *); - -int foo (void *a, int b) -{ - if (!b) - { - f1 (a); - return 1; - } - if (b) - { - void bar (void *c) - { - if (c == a) - f2 (c); - } - f3 (a, bar); - } - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010227-1.c b/gcc/testsuite/gcc.c-torture/compile/20010227-1.c deleted file mode 100644 index 767cb0d1c2e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010227-1.c +++ /dev/null @@ -1,6 +0,0 @@ -void foo (void) -{ - double a = 0.0; - double b = a; - if (&b != &a); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010313-1.c b/gcc/testsuite/gcc.c-torture/compile/20010313-1.c deleted file mode 100644 index a5a6ee65217..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010313-1.c +++ /dev/null @@ -1,5 +0,0 @@ -/* Origin: Joseph Myers <jsm28@cam.ac.uk>. */ -/* After the open parenthesis before the __attribute__, we used to shift - the __attribute__ (expecting a parenthesised abstract declarator) - instead of reducing to the start of a parameter list. */ -void bar (int (__attribute__((__mode__(__SI__))) int foo)); diff --git a/gcc/testsuite/gcc.c-torture/compile/20010320-1.c b/gcc/testsuite/gcc.c-torture/compile/20010320-1.c deleted file mode 100644 index 14686d62318..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010320-1.c +++ /dev/null @@ -1,28 +0,0 @@ -typedef struct sec { -const char *name; -int id; -int index; -struct sec *next; -unsigned int flags; -unsigned int user_set_vma : 1; -unsigned int reloc_done : 1; -unsigned int linker_mark : 1; -unsigned int gc_mark : 1; -unsigned int segment_mark : 1; -unsigned long long vma; } asection; - -static void pe_print_pdata (asection *section) -{ - unsigned long long i; - unsigned long long start = 0, stop = 0; - int onaline = (3*8) ; - - for (i = start; i < stop; i += onaline) - { - if (i + (3*8) > stop) - break; - - f (((unsigned long) ((( i + section->vma ) >> 32) & 0xffffffff)) , ((unsigned long) ((( i + section->vma ) & 0xffffffff))) ) ; - } -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/20010326-1.c b/gcc/testsuite/gcc.c-torture/compile/20010326-1.c deleted file mode 100644 index 43acf4588ca..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010326-1.c +++ /dev/null @@ -1,16 +0,0 @@ -float d; -int e, f; - -void foo (void) -{ - struct { float u, v; } a = {0.0, 0.0}; - float b; - int c; - - c = e; - if (c == 0) - c = f; - b = d; - if (a.v < b) - a.v = b; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010327-1.c b/gcc/testsuite/gcc.c-torture/compile/20010327-1.c deleted file mode 100644 index 10f7e39516f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010327-1.c +++ /dev/null @@ -1,9 +0,0 @@ -/* This testcase tests whether GCC can produce static initialized data - that references addresses of size 'unsigned long', even if that's not - the same as __SIZE_TYPE__. (See 20011114-1.c for the same test of - size __SIZE_TYPE__.) - - Some rare environments might not have the required relocs to support - this; they should have this test disabled in the .x file. */ -extern void _text; -static unsigned long x = (unsigned long) &_text - 0x10000000L - 1; diff --git a/gcc/testsuite/gcc.c-torture/compile/20010328-1.c b/gcc/testsuite/gcc.c-torture/compile/20010328-1.c deleted file mode 100644 index d92c6dae113..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010328-1.c +++ /dev/null @@ -1,80 +0,0 @@ -typedef unsigned int size_t; -typedef unsigned int __u_int; -typedef unsigned long __u_long; - -__extension__ typedef unsigned long long int __u_quad_t; -__extension__ typedef long long int __quad_t; - -typedef struct - { - int __val[2]; - } __fsid_t; - -typedef long int __blksize_t; -typedef long int __blkcnt_t; -typedef __quad_t __blkcnt64_t; -typedef __u_long __fsblkcnt_t; -typedef __u_quad_t __fsblkcnt64_t; -typedef __u_long __fsfilcnt_t; -typedef __u_quad_t __fsfilcnt64_t; -typedef __u_quad_t __ino64_t; - -extern void *memcpy (void *__restrict __dest, - __const void *__restrict __src, size_t __n) ; - -struct statfs - { - int f_type; - int f_bsize; - - __fsblkcnt_t f_blocks; - __fsblkcnt_t f_bfree; - __fsblkcnt_t f_bavail; - __fsfilcnt_t f_files; - __fsfilcnt_t f_ffree; - - __fsid_t f_fsid; - int f_namelen; - int f_spare[6]; - }; - - -struct statfs64 - { - int f_type; - int f_bsize; - __fsblkcnt64_t f_blocks; - __fsblkcnt64_t f_bfree; - __fsblkcnt64_t f_bavail; - __fsfilcnt64_t f_files; - __fsfilcnt64_t f_ffree; - __fsid_t f_fsid; - int f_namelen; - int f_spare[6]; - }; - -extern int __statfs (__const char *__file, struct statfs *__buf); -extern int __statfs64 (__const char *__file, struct statfs64 *__buf); - - -int -__statfs64 (const char *file, struct statfs64 *buf) -{ - struct statfs buf32; - - if (__statfs (file, &buf32) < 0) - return -1; - - buf->f_type = buf32.f_type; - buf->f_bsize = buf32.f_bsize; - buf->f_blocks = buf32.f_blocks; - buf->f_bfree = buf32.f_bfree; - buf->f_bavail = buf32.f_bavail; - buf->f_files = buf32.f_files; - buf->f_ffree = buf32.f_ffree; - buf->f_fsid = buf32.f_fsid; - buf->f_namelen = buf32.f_namelen; - memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); - - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010329-1.c b/gcc/testsuite/gcc.c-torture/compile/20010329-1.c deleted file mode 100644 index 4d495e1afc8..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010329-1.c +++ /dev/null @@ -1,17 +0,0 @@ -union u { - unsigned char a; - double b; -}; - -int a; - -union u foo (void) -{ - union u b; - - if (a) - b.a = 1; - else - b.a = 0; - return b; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010404-1.c b/gcc/testsuite/gcc.c-torture/compile/20010404-1.c deleted file mode 100644 index f890118e15d..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010404-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* This testcase caused a floating point exception in the compiler when - compiled with -O2. The crash occurs when trying to simplify division - and modulo operations. */ - -#include <limits.h> - -extern void bar (int); - -void foo () -{ - int a = INT_MIN; - int b = -1; - bar (a / b); - bar (a % b); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010408-1.c b/gcc/testsuite/gcc.c-torture/compile/20010408-1.c deleted file mode 100644 index 9aa3597a24a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010408-1.c +++ /dev/null @@ -1,77 +0,0 @@ -extern struct win *windows, *wtab[]; -struct win -{ - struct win *w_next; -}; - -struct auser; - -struct comm -{ - char *name; - int flags; -}; - -extern struct comm comms[]; - -extern int WindowByNoN (char *); -extern int FindCommnr (char *); -extern int AclSetPermCmd (struct auser *, char *, struct comm *); -extern int AclSetPermWin (struct auser *, struct auser *, char *, struct win *); - - -int - AclSetPerm(uu, u, mode, s) - struct auser *uu, *u; -char *mode, *s; -{ - struct win *w; - int i; - char *p, ch; - - do - { - } - while (0); - - while (*s) - { - switch (*s) - { - case '*': - return AclSetPerm(uu, u, mode, "#?"); - case '#': - if (uu) - AclSetPermWin(uu, u, mode, (struct win *)1); - else - for (w = windows; w; w = w->w_next) - AclSetPermWin((struct auser *)0, u, mode, w); - s++; - break; - case '?': - if (uu) - AclSetPermWin(uu, u, mode, (struct win *)0); - else - for (i = 0; i <= 174; i++) - AclSetPermCmd(u, mode, &comms[i]); - s++; - break; - default: - for (p = s; *p && *p != ' ' && *p != '\t' && *p != ','; p++) - ; - if ((ch = *p)) - *p++ = '\0'; - if ((i = FindCommnr(s)) != -1) - AclSetPermCmd(u, mode, &comms[i]); - else if (((i = WindowByNoN(s)) >= 0) && wtab[i]) - AclSetPermWin((struct auser *)0, u, mode, wtab[i]); - else - return -1; - if (ch) - p[-1] = ch; - s = p; - } - } - - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010421-1.c b/gcc/testsuite/gcc.c-torture/compile/20010421-1.c deleted file mode 100644 index bec6aa90304..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010421-1.c +++ /dev/null @@ -1,8 +0,0 @@ -int j; - -void residual () -{ - long double s; - for (j = 3; j < 9; j++) - s -= 3; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010423-1.c b/gcc/testsuite/gcc.c-torture/compile/20010423-1.c deleted file mode 100644 index ef7771f8e6b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010423-1.c +++ /dev/null @@ -1,16 +0,0 @@ -/* Origin: PR c/2618 from Cesar Eduardo Barros <cesarb@nitnet.com.br>, - adapted to a testcase by Joseph Myers <jsm28@cam.ac.uk>. - - Boolean conversions were causing infinite recursion between convert - and fold in certain cases. */ - -#include <stdbool.h> - -bool x; -unsigned char y; - -void -fn (void) -{ - x = y & 0x1 ? 1 : 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010426-1.c b/gcc/testsuite/gcc.c-torture/compile/20010426-1.c deleted file mode 100644 index 356818f9ec8..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010426-1.c +++ /dev/null @@ -1,19 +0,0 @@ -struct { char *m; long n; } a[20]; -int b = 20, c; -void bar(void) __attribute__((__noreturn__)); - -int -foo(int x) -{ - int i; - - for (i = 0; i < x; i++) - { - a[0].m = "a"; a[0].n = 10; c=1; - a[c].m = "b"; a[c].n = 32; c++; - if (c >= b) bar (); - a[c].m = "c"; a[c].n = 80; c++; - if (c >= b) bar (); - } - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010503-1.c b/gcc/testsuite/gcc.c-torture/compile/20010503-1.c deleted file mode 100644 index 75005f456c3..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010503-1.c +++ /dev/null @@ -1,17 +0,0 @@ -void f1 (double); -void f2 (int); - -void -foo (int type, double xx) -{ - if (type) - f1 (xx); - else - f2 (type); -} - -void -bar (int type) -{ - foo (type, 1.0); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010510-1.c b/gcc/testsuite/gcc.c-torture/compile/20010510-1.c deleted file mode 100644 index 23d44f8642c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010510-1.c +++ /dev/null @@ -1,3 +0,0 @@ -typedef char *ident; -#ident "This is ident" -ident i; diff --git a/gcc/testsuite/gcc.c-torture/compile/20010516-1.c b/gcc/testsuite/gcc.c-torture/compile/20010516-1.c deleted file mode 100644 index 7732812cfb1..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010516-1.c +++ /dev/null @@ -1,5 +0,0 @@ -foo() -{ - char d; - asm volatile ( "" :: "m"(&d)); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010518-1.c b/gcc/testsuite/gcc.c-torture/compile/20010518-1.c deleted file mode 100644 index 4ab40d8e226..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010518-1.c +++ /dev/null @@ -1,205 +0,0 @@ -/* This was cut down from reload1.c in May 2001, was observed to cause - a bootstrap failure for powerpc-apple-darwin1.3. - - Copyright (C) 2001 Free Software Foundation. */ - -enum insn_code -{ - CODE_FOR_extendqidi2 = 3, - CODE_FOR_nothing = 870 -}; - -struct rtx_def; - -enum machine_mode -{ - VOIDmode, - MAX_MACHINE_MODE -}; - -typedef unsigned long long HARD_REG_ELT_TYPE; -typedef HARD_REG_ELT_TYPE HARD_REG_SET[((77 + (8 * 8) - 1) / (8 * 8))]; - -enum rtx_code -{ - UNKNOWN, - NIL, - REG, - LAST_AND_UNUSED_RTX_CODE -}; - -typedef struct -{ - unsigned min_align:8; - unsigned base_after_vec:1; - unsigned min_after_vec:1; - unsigned max_after_vec:1; - unsigned min_after_base:1; - unsigned max_after_base:1; - unsigned offset_unsigned:1; - unsigned:2; - unsigned scale:8; -} -addr_diff_vec_flags; -typedef union rtunion_def -{ - long long rtwint; - int rtint; - unsigned int rtuint; - const char *rtstr; - struct rtx_def *rtx; - struct rtvec_def *rtvec; - enum machine_mode rttype; - addr_diff_vec_flags rt_addr_diff_vec_flags; - struct cselib_val_struct *rt_cselib; - struct bitmap_head_def *rtbit; - union tree_node *rttree; - struct basic_block_def *bb; -} -rtunion; -typedef struct rtx_def -{ - enum rtx_code code:16; - enum machine_mode mode:8; - unsigned int jump:1; - unsigned int call:1; - unsigned int unchanging:1; - unsigned int volatil:1; - unsigned int in_struct:1; - unsigned int used:1; - unsigned integrated:1; - unsigned frame_related:1; - rtunion fld[1]; -} - *rtx; - -enum reload_type -{ - RELOAD_FOR_INPUT, RELOAD_FOR_OUTPUT, RELOAD_FOR_INSN, - RELOAD_FOR_INPUT_ADDRESS, RELOAD_FOR_INPADDR_ADDRESS, - RELOAD_FOR_OUTPUT_ADDRESS, RELOAD_FOR_OUTADDR_ADDRESS, - RELOAD_FOR_OPERAND_ADDRESS, RELOAD_FOR_OPADDR_ADDR, - RELOAD_OTHER, RELOAD_FOR_OTHER_ADDRESS -}; - -struct reload -{ - rtx in; - rtx out; - // enum reg_class class; - enum machine_mode inmode; - enum machine_mode outmode; - enum machine_mode mode; - unsigned int nregs; - int inc; - rtx in_reg; - rtx out_reg; - int regno; - rtx reg_rtx; - int opnum; - int secondary_in_reload; - int secondary_out_reload; - enum insn_code secondary_in_icode; - enum insn_code secondary_out_icode; - enum reload_type when_needed; - unsigned int optional:1; - unsigned int nocombine:1; - unsigned int secondary_p:1; - unsigned int nongroup:1; -}; - -struct insn_chain -{ - rtx insn; -}; - -extern int n_reloads; -static short reload_order[(2 * 10 * (2 + 1))]; -int reload_spill_index[(2 * 10 * (2 + 1))]; -extern struct reload rld[(2 * 10 * (2 + 1))]; -static rtx *reg_last_reload_reg; -static HARD_REG_SET reg_reloaded_valid; -static HARD_REG_SET reg_reloaded_dead; -static HARD_REG_SET reg_reloaded_died; -static HARD_REG_SET reg_is_output_reload; -extern const unsigned int mode_size[]; -extern int target_flags; - -static void -emit_reload_insns (chain) - struct insn_chain *chain; -{ - rtx insn = chain->insn; - register int j; - rtx following_insn = (((insn)->fld[2]).rtx); - rtx before_insn = (((insn)->fld[1]).rtx); - - for (j = 0; j < n_reloads; j++) - { - register int r = reload_order[j]; - register int i = reload_spill_index[r]; - - { - rtx out = (((enum rtx_code) (rld[r].out)->code) == REG ? rld[r].out : rld[r].out_reg); - register int nregno = (((out)->fld[0]).rtuint); - - if (nregno >= 77) - { - rtx src_reg, store_insn = (rtx) 0; - - reg_last_reload_reg[nregno] = 0; - if (src_reg && ((enum rtx_code) (src_reg)->code) == REG && (((src_reg)->fld[0]).rtuint) < 77) - { - int src_regno = (((src_reg)->fld[0]).rtuint); - int nr = - (((src_regno) >= 32 - && (src_regno) <= - 63) ? (((mode_size[(int) (rld[r].mode)]) + 8 - - 1) / 8) : (((mode_size[(int) (rld[r].mode)]) + - (!(target_flags & 0x00000020) ? 4 : - 8) - 1) / (!(target_flags & 0x00000020) ? 4 : 8))); - rtx note = 0; - - while (nr-- > 0) - { - ((reg_reloaded_dead) - [(src_regno + nr) / ((unsigned) (8 * 8))] &= - ~(((HARD_REG_ELT_TYPE) (1)) << ((src_regno + nr) % ((unsigned) (8 * 8))))); - ((reg_reloaded_valid) - [(src_regno + nr) / ((unsigned) (8 * 8))] |= - ((HARD_REG_ELT_TYPE) (1)) << ((src_regno + nr) % ((unsigned) (8 * 8)))); - ((reg_is_output_reload) - [(src_regno + nr) / ((unsigned) (8 * 8))] |= - ((HARD_REG_ELT_TYPE) (1)) << ((src_regno + nr) % ((unsigned) (8 * 8)))); - if (note) - ((reg_reloaded_died) - [(src_regno) / ((unsigned) (8 * 8))] |= - ((HARD_REG_ELT_TYPE) (1)) << ((src_regno) % ((unsigned) (8 * 8)))); - else - ((reg_reloaded_died) - [(src_regno) / ((unsigned) (8 * 8))] &= - ~(((HARD_REG_ELT_TYPE) (1)) << ((src_regno) % ((unsigned) (8 * 8))))); - } - reg_last_reload_reg[nregno] = src_reg; - } - } - else - { - int num_regs = - (((nregno) >= 32 - && (nregno) <= - 63) - ? (((mode_size - [(int) (((enum machine_mode) (rld[r].out)->mode))]) + - 8 - - 1) / - 8) - : (((mode_size - [(int) (((enum machine_mode) (rld[r].out)->mode))]) + - (!(target_flags & 0x00000020) ? 4 : 8) - 1) / (!(target_flags & 0x00000020) ? 4 : 8))); - while (num_regs-- > 0) - reg_last_reload_reg[nregno + num_regs] = 0; - } - } - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010518-2.c b/gcc/testsuite/gcc.c-torture/compile/20010518-2.c deleted file mode 100644 index aa8ce344c05..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010518-2.c +++ /dev/null @@ -1,13 +0,0 @@ -/* Large static storage. */ - -#include <limits.h> - -static volatile char chars_1[INT_MAX / 2]; -static volatile char chars_2[1]; - -int -foo (void) -{ - chars_1[10] = 'y'; - chars_2[0] = 'x'; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010518-2.x b/gcc/testsuite/gcc.c-torture/compile/20010518-2.x deleted file mode 100644 index 1bd6f8fd464..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010518-2.x +++ /dev/null @@ -1,8 +0,0 @@ -# This test fails on HC11/HC12 when it is compiled without -mshort because -# the array is too large (INT_MAX/2 > 64K). Force to use 16-bit ints for it. -if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { - set options "-S -mshort" -} else { - set options "-S" -} -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/20010525-1.c b/gcc/testsuite/gcc.c-torture/compile/20010525-1.c deleted file mode 100644 index 2e4ae382ab9..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010525-1.c +++ /dev/null @@ -1,6 +0,0 @@ -static int kind_varread(char *str) -{ - if (0 == memcmp("%_#", str, 3)) return 2; - /* NOTREACHED */ -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/20010605-1.c b/gcc/testsuite/gcc.c-torture/compile/20010605-1.c deleted file mode 100644 index 036b796982e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010605-1.c +++ /dev/null @@ -1,15 +0,0 @@ -int -main (int argc, char **argv) -{ - int size = 10; - - typedef struct { - char val[size]; - } block; - block retframe_block() - { - return *(block*)0; - } - - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010605-2.c b/gcc/testsuite/gcc.c-torture/compile/20010605-2.c deleted file mode 100644 index b8d9d5892da..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010605-2.c +++ /dev/null @@ -1,17 +0,0 @@ -/* Origin: Joseph Myers <jsm28@cam.ac.uk>. */ -/* As an extension, GCC allows a struct or union to be cast to its own - type, but failed to allow this when a typedef was involved. - Reported as PR c/2735 by <cowan@ccil.org>. */ -union u { int i; }; -typedef union u uu; -union u a; -uu b; - -void -foo (void) -{ - a = (union u) b; - a = (uu) b; - b = (union u) a; - b = (uu) a; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010605-3.c b/gcc/testsuite/gcc.c-torture/compile/20010605-3.c deleted file mode 100644 index a43c0b1e462..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010605-3.c +++ /dev/null @@ -1,20 +0,0 @@ -struct A { unsigned long buf[100]; }; -int foo(unsigned int *x) -{ - unsigned int a; - - if (!x) - return -22; - -#ifdef __ia64__ - if (({ - register long b asm ("r8") = 0; - register long c asm ("r9") = 0; - asm ("" : "=r"(c), "=r"(b) : "m"(*(struct A *)x), "1"(b)); - a = (unsigned int) c; - b; })) - return -14; -#endif - - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010610-1.c b/gcc/testsuite/gcc.c-torture/compile/20010610-1.c deleted file mode 100644 index ee8e2431bbb..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010610-1.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Origin: Kaveh R. Ghazi <ghazi@caip.rutgers.edu> - - Boolean types were not accepted as array sizes nor as switch - quantities. */ - -#include <stdbool.h> - -int -main(void) -{ - bool arr[(bool)1]; - - switch (arr[0]) - { - default:; - } - - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010611-1.c b/gcc/testsuite/gcc.c-torture/compile/20010611-1.c deleted file mode 100644 index 87723bd497a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010611-1.c +++ /dev/null @@ -1,24 +0,0 @@ -/* Origin: PR c/3116 from Andreas Jaeger <aj@suse.de>. */ -/* When determining type compatibility of function types, we must remove - qualifiers from argument types. We used to fail to do this properly - in store_parm_decls when comparing prototype and non-prototype - declarations. */ -struct _IO_FILE { - int _flags; -}; - -typedef struct _IO_FILE __FILE; -typedef struct _IO_FILE _IO_FILE; -typedef long int wchar_t; - -extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n, - __FILE *__restrict __stream); - -wchar_t * -fgetws (buf, n, fp) - wchar_t *buf; - int n; - _IO_FILE *fp; -{ - return (wchar_t *)0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010701-1.c b/gcc/testsuite/gcc.c-torture/compile/20010701-1.c deleted file mode 100644 index 7fb7ab5b150..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010701-1.c +++ /dev/null @@ -1,5 +0,0 @@ -/* Test that postfix attributes only apply to a single declared object. - (decl_attributes used to chain them onto the end of the prefix attributes, - which caused them to apply to other declarations as well.) */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk>. */ -void __attribute__((__noreturn__)) foo (const char *, ...) __attribute__((__format__(__printf__, 1, 2))), bar (void); diff --git a/gcc/testsuite/gcc.c-torture/compile/20010706-1.c b/gcc/testsuite/gcc.c-torture/compile/20010706-1.c deleted file mode 100644 index 44aec371a99..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010706-1.c +++ /dev/null @@ -1,5 +0,0 @@ - -foo(unsigned int x) -{ - return (x << 1) | (x >> 31); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010711-1.c b/gcc/testsuite/gcc.c-torture/compile/20010711-1.c deleted file mode 100644 index a0787421f94..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010711-1.c +++ /dev/null @@ -1,11 +0,0 @@ -typedef unsigned long long value; - -void foo (value *v) {} - -void test () -{ - value v; - foo (&v); - if (v-- > 0) - foo (&v); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010711-2.c b/gcc/testsuite/gcc.c-torture/compile/20010711-2.c deleted file mode 100644 index 2f8d68ba4ae..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010711-2.c +++ /dev/null @@ -1,11 +0,0 @@ -typedef unsigned long long value; - -void foo (value *v) {} - -void test () -{ - value v; - foo (&v); - if (v-- == 1) - foo (&v); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010714-1.c b/gcc/testsuite/gcc.c-torture/compile/20010714-1.c deleted file mode 100644 index fc4bdbac7d5..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010714-1.c +++ /dev/null @@ -1,5 +0,0 @@ -/* Test that prefix attributes after a comma only apply to a single - declared object or function. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk>. */ - -__attribute__((noreturn)) void d0 (void), __attribute__((format(printf, 1, 2))) d1 (const char *, ...), d2 (void); diff --git a/gcc/testsuite/gcc.c-torture/compile/20010824-1.c b/gcc/testsuite/gcc.c-torture/compile/20010824-1.c deleted file mode 100644 index 8e67722b960..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010824-1.c +++ /dev/null @@ -1,7 +0,0 @@ -void f(int n) -{ -bugcauser: - if (n != 0) - f(n-1); - return; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010903-1.c b/gcc/testsuite/gcc.c-torture/compile/20010903-1.c deleted file mode 100644 index 8e519f26e41..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010903-1.c +++ /dev/null @@ -1,28 +0,0 @@ -struct A { - long a; -}; - -static inline void foo(struct A *x) -{ - __asm__ __volatile__("" : "+m"(x->a) : "r"(x) : "memory", "cc"); -} - -static inline void bar(struct A *x) -{ - foo(x); -} - -struct B { char buf[640]; struct A a; }; -struct B b[32]; - -int baz(void) -{ - int i; - struct B *j; - for (i = 1; i < 32; i++) - { - j = &b[i]; - bar(&j->a); - } - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010903-2.c b/gcc/testsuite/gcc.c-torture/compile/20010903-2.c deleted file mode 100644 index a5d78c0111d..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010903-2.c +++ /dev/null @@ -1,15 +0,0 @@ -extern int __dummy (void *__preg, const char *__string); -extern int rpmatch (const char *response); - -int -rpmatch (const char *response) -{ - auto inline int try (void *re); - - inline int try (void *re) - { - return __dummy (re, response); - } - static void *yesre; - return (try (&yesre)); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010911-1.c b/gcc/testsuite/gcc.c-torture/compile/20010911-1.c deleted file mode 100644 index f5a4724bc72..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010911-1.c +++ /dev/null @@ -1,4 +0,0 @@ -/* Test for segfault handling an empty attribute. */ -/* Origin: PR c/4294 from <tori@ringstrom.mine.nu>. */ - -void __attribute__(()) foo(); diff --git a/gcc/testsuite/gcc.c-torture/compile/20011010-1.c b/gcc/testsuite/gcc.c-torture/compile/20011010-1.c deleted file mode 100644 index b0137554379..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011010-1.c +++ /dev/null @@ -1,10 +0,0 @@ -extern int used (void); - - -int foo () -{ - int i; - for (; used (); ({while (1) if (used ()) return 0;})) - i++; - return i; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011023-1.c b/gcc/testsuite/gcc.c-torture/compile/20011023-1.c deleted file mode 100644 index eca1adf17ca..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011023-1.c +++ /dev/null @@ -1,14 +0,0 @@ -/* Test whether tree inlining works with prototyped nested functions. */ - -extern void foo (char *x); -void bar (void); -void bar (void) -{ - auto void baz (void); - void baz (void) - { - char tmp[2]; - foo (tmp); - } - baz (); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011029-1.c b/gcc/testsuite/gcc.c-torture/compile/20011029-1.c deleted file mode 100644 index 3b2bcdf2e9d..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011029-1.c +++ /dev/null @@ -1,9 +0,0 @@ -void foo (void *) __attribute__ ((noreturn)); - -void -bar (void *x) -{ - if (__builtin_setjmp (x)) - return; - foo (x); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011106-1.c b/gcc/testsuite/gcc.c-torture/compile/20011106-1.c deleted file mode 100644 index 9363780a65a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011106-1.c +++ /dev/null @@ -1,7 +0,0 @@ -/* Test that functions passed to the comma operator are correctly converted - to pointers. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk>. */ - -void foo (void); -void (*fp) (void); -char x[sizeof (1, foo) == sizeof (fp) ? 1 : -1]; diff --git a/gcc/testsuite/gcc.c-torture/compile/20011106-2.c b/gcc/testsuite/gcc.c-torture/compile/20011106-2.c deleted file mode 100644 index 358f9d2ed49..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011106-2.c +++ /dev/null @@ -1,7 +0,0 @@ -/* Test the the type of a component of a conditional expression between - two structures is correct. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk>. */ - -struct s { char c; } a, b; -int c; -char x[sizeof ((c ? a : b).c) == 1 ? 1 : -1]; diff --git a/gcc/testsuite/gcc.c-torture/compile/20011109-1.c b/gcc/testsuite/gcc.c-torture/compile/20011109-1.c deleted file mode 100644 index f1987a74bf2..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011109-1.c +++ /dev/null @@ -1,51 +0,0 @@ -typedef struct { short x[4]; } S; -typedef struct { unsigned int a, b, c; S *d; } T; - -S *(*foo) (T *, int, int, int, int); -unsigned short *(*bar)(const T *); -unsigned short baz(T *,const int); - -T *die (void) -{ - typedef struct { unsigned int a, b, e; double f, g; } U; - - char h[8], i[2053], j[2053]; - double k, l, m; - U n; - T *o; - unsigned short p; - int q, r; - long s; - unsigned short *t; - S *u; - unsigned char *v, *w; - unsigned int x; - - o = 0; - for (x = 0; x < n.e; x++) - { - l = 1.0; - if (n.g - n.f <= 1.0) - l = ((1 << o->c) - 1) / (n.g - n.f); - v = w; - for (r = o->b - 1; r >= 0; r--) - { - u = foo (o, 0, r, o->a, 1); - if (!u) - break; - t = bar (o); - for (q = 0; q < (int) o->a; q++) - { - h[0] = *v; - s = *v++; - k = (double) s; - m = l*k; - p = m < 0 ? 0 : m > (1 << o->c) - 1 ? (1 << o->c) - 1 : m + 0.5; - p = baz (o,p); - t[q] = p; - *u++ = o->d[p]; - } - } - } - return o; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011114-1.c b/gcc/testsuite/gcc.c-torture/compile/20011114-1.c deleted file mode 100644 index 5e6e821845d..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011114-1.c +++ /dev/null @@ -1,2 +0,0 @@ -extern void _text; -static __SIZE_TYPE__ x = (__SIZE_TYPE__) &_text - 0x10000000L - 1; diff --git a/gcc/testsuite/gcc.c-torture/compile/20011114-2.c b/gcc/testsuite/gcc.c-torture/compile/20011114-2.c deleted file mode 100644 index 46f0aedeb3a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011114-2.c +++ /dev/null @@ -1,13 +0,0 @@ -typedef struct { int c, d, e, f, g; } D; - -void bar (unsigned long, unsigned long); -void foo (D *y) -{ - int x = 0; - - if (y->f == 0) - x |= 0x1; - if (y->g == 0) - x |= 0x2; - bar ((x << 16) | (y->c & 0xffff), (y->d << 16) | (y->e & 0xffff)); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011114-3.c b/gcc/testsuite/gcc.c-torture/compile/20011114-3.c deleted file mode 100644 index 882792525c9..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011114-3.c +++ /dev/null @@ -1,42 +0,0 @@ -typedef struct { int s, t; } C; -C x; -int foo (void); -void bar (int); - -int baz (void) -{ - int a = 0, c, d = 0; - C *b = &x; - - while ((c = foo ())) - switch(c) - { - case 23: - bar (1); - break; - default: - break; - } - - if (a == 0 || (a & 1)) - { - if (b->s) - { - if (a) - bar (1); - else - a = 16; - } - else if (b->t) - { - if (a) - bar (1); - else - a = 32; - } - } - - if (d && (a & ~127)) - bar (2); - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011114-4.c b/gcc/testsuite/gcc.c-torture/compile/20011114-4.c deleted file mode 100644 index 516ef4f2325..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011114-4.c +++ /dev/null @@ -1,38 +0,0 @@ -static inline int foo (long x) -{ - register int a = 0; - register unsigned b; - - do - { - b = (x & 0x7f); - x = (x >> 7) | ~(-1L >> 7); - a += 1; - } - while ((x != 0 || (b & 0x40) != 0) && (x != -1 || (b & 0x40) == 0)); - return a; -} - -static inline int bar (unsigned long x) -{ - register int a = 0; - register unsigned b; - - do - { - b = (x & 0x7f); - x >>= 7; - a++; - } - while (x != 0); - return a; -} - -int -baz (unsigned long x, int y) -{ - if (y) - return foo ((long) x); - else - return bar (x); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011119-1.c b/gcc/testsuite/gcc.c-torture/compile/20011119-1.c deleted file mode 100644 index 2204c11c90b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011119-1.c +++ /dev/null @@ -1,4 +0,0 @@ -extern inline int foo (void) { return 23; } -int xxx(void) __asm__("xxx"); -int xxx(void) { return 23; } -extern int foo (void) __attribute__ ((weak, alias ("xxx"))); diff --git a/gcc/testsuite/gcc.c-torture/compile/20011119-2.c b/gcc/testsuite/gcc.c-torture/compile/20011119-2.c deleted file mode 100644 index ab649b98bc7..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011119-2.c +++ /dev/null @@ -1,6 +0,0 @@ -extern inline int foo (void) { return 23; } -int bar (void) { return foo (); } -extern int foo (void) __attribute__ ((weak, alias ("xxx"))); -int baz (void) { return foo (); } -int xxx(void) __asm__("xxx"); -int xxx(void) { return 23; } diff --git a/gcc/testsuite/gcc.c-torture/compile/20011130-1.c b/gcc/testsuite/gcc.c-torture/compile/20011130-1.c deleted file mode 100644 index 82ff042cee6..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011130-1.c +++ /dev/null @@ -1,7 +0,0 @@ -extern struct S x[]; -struct S { int i; }; -char *bar (const struct S *); -void foo (void) -{ - bar (x); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011130-2.c b/gcc/testsuite/gcc.c-torture/compile/20011130-2.c deleted file mode 100644 index 6439527e89c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011130-2.c +++ /dev/null @@ -1,54 +0,0 @@ -/* This testcase caused infinite loop in life info computation - after if conversion on IA-64. Conditional register dead for - pseudo holding sign-extended k was improperly computed, - resulting in this pseudo beeing live at start of bb if it was - dead at the end and vice versa; as it was a bb which had edge - to itself, this resulted in alternative propagating this basic - block forever. */ - -typedef struct { - unsigned char a; - unsigned char b; -} S0; - -typedef struct { - S0 *c; - int d; - unsigned int e; - unsigned char *f[3]; - void *g; -} S1; - -int bar (int, void *); - -int foo (S1 *x, float y) -{ - S0 *h; - int i, j, k, l, m; - float n, o, p; - unsigned char *q, *r[3]; - - h = x->c; - m = h->a; - l = h->b; - n = y; - o = 0.0; - if (x->d == 8) - for (j = 0; j < x->e; j++) - for (k = 0; k < 3; k++) - { - n = y; - o = 0.0; - if (m) - q = x->f[k] + x->e - 1 - j; - else - q = x->f[k] + j; - p = (*q - o) * y / (n - o); - p = 0.0 > p ? 0.0 : p; - p = y < p ? y : p; - if (l) - p = r[k][(int) p]; - bar (p, x->g); - } - return 1; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011205-1.c b/gcc/testsuite/gcc.c-torture/compile/20011205-1.c deleted file mode 100644 index ffc5ac419ea..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011205-1.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Failure to mark_addressable all operands before evaluation means we - don't set up the proper temporaries, which leaves us with an asm that - doesn't match its contraints. */ - -long foo() -{ - long x; - asm("" : "=r"(x) : "m"(x)); - return x; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011217-1.c b/gcc/testsuite/gcc.c-torture/compile/20011217-1.c deleted file mode 100644 index 3e89ca04c19..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011217-1.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Test that the initializer of a compound literal is properly walked - when tree inlining. */ -/* Origin: PR c/5105 from <aj@suse.de>. */ - -typedef struct { long p; } pt; - -inline pt f (pt _p) -{ - long p = _p.p; - - return (pt) { (p) }; -} - -static int mmap_mem (void) -{ - pt p; - p = f (p); - - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011217-2.c b/gcc/testsuite/gcc.c-torture/compile/20011217-2.c deleted file mode 100644 index 0d9935969c3..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011217-2.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Test that the initializer of a compound literal is properly walked - when tree inlining. */ -/* Origin: glibc (as reported in PR c/5105) from <aj@suse.de>. */ - -inline int -finite (double __x) -{ - return (__extension__ - (((((union { double __d; int __i[2]; }) {__d: __x}).__i[1] - | 0x800fffffu) + 1) >> 31)); -} - -int -main (void) -{ - double x = 1.0; - - return finite (x); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011218-1.c b/gcc/testsuite/gcc.c-torture/compile/20011218-1.c deleted file mode 100644 index bf63489b855..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011218-1.c +++ /dev/null @@ -1,16 +0,0 @@ -/* This testcase failed on Alpha at -O2 because $27 hard register - for the indirect call was exposed too early and reload couldn't - allocate it for multiplication and division. */ - -struct S { - int a, b; - void (*f) (long, int); -}; - -void foo (struct S *x) -{ - long c = x->a * 50; - c /= (long) x->b; - c *= (long) x->b; - x->f (c, 0); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011219-1.c b/gcc/testsuite/gcc.c-torture/compile/20011219-1.c deleted file mode 100644 index 04923092dff..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011219-1.c +++ /dev/null @@ -1,29 +0,0 @@ -/* This testcase failed on IA-64 at -O2 during scheduling. */ - -void * baz (unsigned long); -static inline double ** -bar (long w, long x, long y, long z) -{ - long i, a = x - w + 1, b = z - y + 1; - double **m = (double **) baz (sizeof (double *) * (a + 1)); - - m += 1; - m -= w; - m[w] = (double *) baz (sizeof (double) * (a * b + 1)); - m[w] += 1; - m[w] -= y; - for (i = w + 1; i <= x; i++) - m[i] = m[i - 1] + b; - return m; -} - -void -foo (double w[], int x, double y[], double z[]) -{ - int i; - double **a; - - a = bar (1, 50, 1, 50); - for (i = 1; i <= x; i++) - a[1][i] = - w[x - i] / w[x]; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011219-2.c b/gcc/testsuite/gcc.c-torture/compile/20011219-2.c deleted file mode 100644 index 2ad7eb1a372..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011219-2.c +++ /dev/null @@ -1,20 +0,0 @@ -/* This testcase failed on Alpha at -O2 when simplifying conditional - expressions. */ - -struct S { - unsigned long a; - double b, c; -}; - -extern double bar (double, double); - -int -foo (unsigned long x, unsigned int y, struct S *z) -{ - unsigned int a = z->a; - int b = y / z->a > 1 ? y / z->a : 1; - - a = y / b < z->a ? y / b : z->a; - z->c = z->b * bar ((double) a, (double) x); - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011229-1.c b/gcc/testsuite/gcc.c-torture/compile/20011229-1.c deleted file mode 100644 index 97b2655434a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011229-1.c +++ /dev/null @@ -1,78 +0,0 @@ -/* ICE: call insn does not satisfy its constraints, MMIX port. - Origin: ghostscript-6.52, reduction from hp@bitrange.com. */ -struct s0 -{ - void (*init_color)(void *, void *); -}; -struct s1 -{ - void (*map_cmyk)(short, void *, void **, void *); - void (*map_rgb_alpha)(short, void *, void **, void *); -}; -struct s5 -{ - long fill1; int fill2; - long fill3; unsigned int fill4, fill5; -}; -struct s2 -{ - struct s5 x, y; -}; -struct s3 -{ - long dev_color; - unsigned int key; -}; -struct s4 -{ - unsigned char spp; - int alpha; - struct mc_ - { - unsigned int values[14]; - unsigned int mask, test; - int exact; - } mask_color; - void **pis; - struct s0 *pcs; - struct dd_ - { - struct s2 row[2]; - struct s2 pixel0; - } dda; - struct s3 clues[256]; -}; -extern struct s1 *get_cmap_procs (void **, void *); -int image_render_color (struct s4 *, unsigned char *, int, void *); -int -image_render_color (struct s4 *penum, unsigned char *buffer, - int data_x, void *dev) -{ - struct s3 *clues = penum->clues; - void **pis = penum->pis; - struct s2 pnext; - struct s0 *pcs = penum->pcs; - struct s1 *cmap_procs = get_cmap_procs(pis, dev); - void (*map_4)(short, void *, void **, void *) = - (penum->alpha ? cmap_procs->map_rgb_alpha : cmap_procs->map_cmyk); - unsigned int mask = penum->mask_color.mask; - unsigned int test = penum->mask_color.test; - struct s3 *pic_next = &clues[1]; - int spp = penum->spp; - unsigned char *psrc = buffer + data_x * spp; - unsigned char v[6]; - - pnext = penum->dda.pixel0; - __builtin_memset (&v, 0, sizeof(v)); - (*(pcs)->init_color) (0, 0); - - if (spp == 4) - { - v[0] = psrc[0]; - v[1] = psrc[1]; - if ((buffer[0] & mask) == test && penum->mask_color.exact) - pic_next->dev_color = 0; - (*map_4)(v[0], &pic_next->dev_color, pis, dev); - } - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011229-2.c b/gcc/testsuite/gcc.c-torture/compile/20011229-2.c deleted file mode 100644 index bb49bd18e34..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20011229-2.c +++ /dev/null @@ -1,17 +0,0 @@ -/* Test whether jump threading doesn't ICE if redirecting the jump to exit - block. */ - -extern int bar (); -extern void baz (); - -void foo () -{ - int x; - - do - { - if ((x = bar ()) == 1) - baz (); - } - while (x == 1); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020103-1.c b/gcc/testsuite/gcc.c-torture/compile/20020103-1.c deleted file mode 100644 index b9861688ddd..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020103-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* This testcase failed on Alpha at -O2 when simplifying conditional - expressions. */ - -int foo (void); - -struct A -{ - int a, b, c, d; -}; - -void bar (struct A *x) -{ - int e, f; - - e = foo (); - e = e / x->b; - if (e < 1) - e = 1; - f = (x->a + x->c) / e; - if (f < x->d) - x->d -= (1 << 16) / 8; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020106-1.c b/gcc/testsuite/gcc.c-torture/compile/20020106-1.c deleted file mode 100644 index c114af1aa8c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020106-1.c +++ /dev/null @@ -1,8 +0,0 @@ -/* Origin: PR c/5279 from <wilco@equator.com>. */ - -int -foo () -{ - extern long long Y; - return (0 > Y++); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020109-1.c b/gcc/testsuite/gcc.c-torture/compile/20020109-1.c deleted file mode 100644 index 532fe6de2d5..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020109-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* This testcase ICEd when 2 different successors of a basic block - were successfully threaded and try_forward_edges was not expecting - that. */ - -typedef struct A -{ - struct A *s, *t; - unsigned int u; -} A; - -void bar (A *); - -void -foo (A *x, A *y, A *z) -{ - while (y - && (((y && y->t && y->t->u) ? y : z)->t - == ((x && x->t && x->t->u) ? x : z)->t)) - y = y->s; - - if (y) - bar (y); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020109-2.c b/gcc/testsuite/gcc.c-torture/compile/20020109-2.c deleted file mode 100644 index 31673156569..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020109-2.c +++ /dev/null @@ -1,30 +0,0 @@ -typedef union -{ - unsigned char member3; - signed short member4; - unsigned int member5; -} -UNI02; - -struct srt_dat_t -{ - UNI02 un2; - unsigned long member1; - signed short member2; -}; - -struct srt_dat_t exsrt1; -void -extern_test (struct srt_dat_t arg1) -{ - arg1.un2.member3++; - arg1.member1++; - arg1.member2++; -} - -int -main (void) -{ - extern_test (exsrt1); - return (0); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020110.c b/gcc/testsuite/gcc.c-torture/compile/20020110.c deleted file mode 100644 index 90e0ce95d29..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020110.c +++ /dev/null @@ -1,12 +0,0 @@ -/* Copyright 2002 Free Software Foundation */ - -/* Make sure the nested extern declaration doesn't conflict with the - non-extern one in the enclosing scope. */ - -void foo() { - static long bar; - - { - extern int bar; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020116-1.c b/gcc/testsuite/gcc.c-torture/compile/20020116-1.c deleted file mode 100644 index 6c023edcabe..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020116-1.c +++ /dev/null @@ -1,28 +0,0 @@ -void noret (void) __attribute__ ((noreturn)); -int foo (int, char **); -char *a, *b; -int d; - -int -main (int argc, char **argv) -{ - register int c; - - d = 1; - while ((c = foo (argc, argv)) != -1) - switch (c) { - case 's': - case 'c': - case 'f': - a = b; - break; - case 'v': - d = 1; - break; - case 'V': - d = 0; - break; - } - noret (); - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020120-1.c b/gcc/testsuite/gcc.c-torture/compile/20020120-1.c deleted file mode 100644 index e049a9720ee..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020120-1.c +++ /dev/null @@ -1,55 +0,0 @@ -/* This ICEed on IA-32 with -O2 -mcpu=i386, because reload was trying - to reload into %sil register. */ - -struct A -{ - void *a; - unsigned int b, c, d; -}; - -struct B -{ - struct A *e; -}; - -void bar (struct A *); -void baz (struct A *); - -static inline unsigned int -inl (unsigned int v, unsigned char w, unsigned char x, unsigned char y, - unsigned char z) -{ - switch (v) - { - case 2: - return ((w & 0xf8) << 8) | ((x & 0xfc) << 3) | ((y & 0xf8) >> 3); - case 4: - return (z << 24) | (w << 16) | (x << 8) | y; - default: - return 0; - } -} - -void foo (struct B *x, int y, const float *z) -{ - struct A *a = x->e; - - if (y) - { - if (x->e->a) - bar (x->e); - } - else - { - unsigned char c[4]; - unsigned int b; - - c[0] = z[0]; c[1] = z[1]; c[2] = z[2]; c[3] = z[3]; - b = inl (a->b, c[0], c[1], c[2], c[3] ); - if (a->a) - bar (a); - else - baz (a); - a->c = b; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020121-1.c b/gcc/testsuite/gcc.c-torture/compile/20020121-1.c deleted file mode 100644 index f8950f4ce8b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020121-1.c +++ /dev/null @@ -1,30 +0,0 @@ -/* This testcase resulted in a 'unrecognizeable insn' on powerpc-linux-gnu - because of a missing trunc_int_for_mode in simplify_and_const_int. */ - -struct display { - struct disphist *hstent; - int pid; - int status; -}; - -struct disphist { - struct disphist *next; - char *name; - int startTries; - unsigned rLogin:2, - sd_how:2, - sd_when:2, - lock:1, - goodExit:1; - char *nuser, *npass, **nargs; -}; - -void -StartDisplay (struct display *d) -{ - d->pid = 0; - d->status = 0; - d->hstent->lock = d->hstent->rLogin = d->hstent->goodExit = - d->hstent->sd_how = d->hstent->sd_when = 0; -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/20020206-1.c b/gcc/testsuite/gcc.c-torture/compile/20020206-1.c deleted file mode 100644 index c21c5645409..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020206-1.c +++ /dev/null @@ -1,18 +0,0 @@ -/* Origin: PR optimization/5429 from Philipp Thomas <pthomas@suse.de>. */ -/* This testcase caused ICE on IA-32 -O2 -march=i686 due to rtl sharing - problem in noce_process_if_block. Fixed by - http://gcc.gnu.org/ml/gcc-patches/2002-01/msg02146.html. */ - -typedef struct { - unsigned char a; -} A; - -unsigned int foo (A *x) -{ - unsigned char b[2] = { 0, 0 }; - unsigned char c = 0; - - c = (x->a) ? b[1] : b[0]; - - return (unsigned int) c; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020210-1.c b/gcc/testsuite/gcc.c-torture/compile/20020210-1.c deleted file mode 100644 index 5ca27f4f6ca..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020210-1.c +++ /dev/null @@ -1,2 +0,0 @@ -/* PR c/5615 */ -void f(int a, struct {int b[a];} c) {} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020303-1.c b/gcc/testsuite/gcc.c-torture/compile/20020303-1.c deleted file mode 100644 index a120adf7148..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020303-1.c +++ /dev/null @@ -1,5 +0,0 @@ -/* With -fzero-initialized-in-bss, we made I a common symbol instead - of a symbol in the .bss section. Not only does that break semantics, - but a common symbol can't be weak. */ - -int i __attribute__((weak)) = 0; diff --git a/gcc/testsuite/gcc.c-torture/compile/20020304-1.c b/gcc/testsuite/gcc.c-torture/compile/20020304-1.c deleted file mode 100644 index 3940d5ffd2e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020304-1.c +++ /dev/null @@ -1,777 +0,0 @@ -/* In 3.0, this test case (extracted from Bigloo) crashes the compiler in - bb-reorder.c. This is a regression from 2.95, already fixed in 3.1. - - Original bug report is c/5830 by Manuel Serrano <Manuel.Serrano@inria.fr>. - */ - -typedef union scmobj { - struct pair { - union scmobj *car; - union scmobj *cdr; - } pair_t; - struct vector { - long header; - int length; - union scmobj *obj0; - } vector_t; -} *obj_t; - -extern obj_t create_vector (int); -extern obj_t make_pair (obj_t, obj_t); -extern long bgl_list_length (obj_t); -extern int BGl_equalzf3zf3zz__r4_equivalence_6_2z00 (obj_t, obj_t); -extern obj_t BGl_evcompilezd2lambdazd2zz__evcompilez00 (obj_t - BgL_formalsz00_39, - obj_t BgL_bodyz00_40, - obj_t BgL_wherez00_41, - obj_t - BgL_namedzf3zf3_42, - obj_t BgL_locz00_43); - -obj_t -BGl_evcompilezd2lambdazd2zz__evcompilez00 (obj_t BgL_formalsz00_39, - obj_t BgL_bodyz00_40, - obj_t BgL_wherez00_41, - obj_t BgL_namedzf3zf3_42, - obj_t BgL_locz00_43) -{ - if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 - (BgL_formalsz00_39, - ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { - BgL_tagzd21966zd2_943: - if ((BgL_namedzf3zf3_42 != - ((obj_t) (obj_t) ((long) (((long) (1) << 2) | 2))))) { - obj_t BgL_v1042z00_998; - { - int BgL_auxz00_4066; - BgL_auxz00_4066 = (int) (((long) 3)); - BgL_v1042z00_998 = create_vector (BgL_auxz00_4066); - } - { - obj_t BgL_arg1586z00_1000; - BgL_arg1586z00_1000 = make_pair (BgL_wherez00_41, BgL_bodyz00_40); - { - int BgL_auxz00_4070; - BgL_auxz00_4070 = (int) (((long) 2)); - ((&(((obj_t) (BgL_v1042z00_998))->vector_t.obj0))[BgL_auxz00_4070] = - BgL_arg1586z00_1000, - ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - } - { - int BgL_auxz00_4073; - BgL_auxz00_4073 = (int) (((long) 1)); - ((&(((obj_t) (BgL_v1042z00_998))->vector_t.obj0))[BgL_auxz00_4073] = - BgL_locz00_43, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - { - obj_t BgL_auxz00_4078; - int BgL_auxz00_4076; - { - long BgL_auxz00_4079; - { - long BgL_auxz00_4080; - BgL_auxz00_4080 = bgl_list_length (BgL_formalsz00_39); - BgL_auxz00_4079 = (BgL_auxz00_4080 + ((long) 37)); - } - BgL_auxz00_4078 = - (obj_t) ((long) (((long) (BgL_auxz00_4079) << 2) | 1)); - } - BgL_auxz00_4076 = (int) (((long) 0)); - ((&(((obj_t) (BgL_v1042z00_998))->vector_t.obj0))[BgL_auxz00_4076] = - BgL_auxz00_4078, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - return BgL_v1042z00_998; - } else { - obj_t BgL_v1043z00_1005; - { - int BgL_auxz00_4085; - BgL_auxz00_4085 = (int) (((long) 3)); - BgL_v1043z00_1005 = create_vector (BgL_auxz00_4085); - } - { - int BgL_auxz00_4088; - BgL_auxz00_4088 = (int) (((long) 2)); - ((&(((obj_t) (BgL_v1043z00_1005))->vector_t.obj0))[BgL_auxz00_4088] = - BgL_bodyz00_40, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - { - int BgL_auxz00_4091; - BgL_auxz00_4091 = (int) (((long) 1)); - ((&(((obj_t) (BgL_v1043z00_1005))->vector_t.obj0))[BgL_auxz00_4091] = - BgL_locz00_43, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - { - obj_t BgL_auxz00_4096; - int BgL_auxz00_4094; - { - long BgL_auxz00_4097; - { - long BgL_auxz00_4098; - BgL_auxz00_4098 = bgl_list_length (BgL_formalsz00_39); - BgL_auxz00_4097 = (BgL_auxz00_4098 + ((long) 42)); - } - BgL_auxz00_4096 = - (obj_t) ((long) (((long) (BgL_auxz00_4097) << 2) | 1)); - } - BgL_auxz00_4094 = (int) (((long) 0)); - ((&(((obj_t) (BgL_v1043z00_1005))->vector_t.obj0))[BgL_auxz00_4094] = - BgL_auxz00_4096, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - return BgL_v1043z00_1005; - } - } else { - if (((((long) BgL_formalsz00_39) & ((1 << 2) - 1)) == 3)) { - if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 - (((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t).cdr), - ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { - goto BgL_tagzd21966zd2_943; - } else { - obj_t BgL_cdrzd21979zd2_953; - BgL_cdrzd21979zd2_953 = - ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t).cdr); - if (((((long) BgL_cdrzd21979zd2_953) & ((1 << 2) - 1)) == 3)) { - if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 - (((((obj_t) ((long) BgL_cdrzd21979zd2_953 - 3))->pair_t).cdr), - ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { - goto BgL_tagzd21966zd2_943; - } else { - obj_t BgL_cdrzd21986zd2_956; - BgL_cdrzd21986zd2_956 = - ((((obj_t) ((long) BgL_cdrzd21979zd2_953 - 3))->pair_t).cdr); - if (((((long) BgL_cdrzd21986zd2_956) & ((1 << 2) - 1)) == 3)) { - if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 - (((((obj_t) ((long) BgL_cdrzd21986zd2_956 - 3))->pair_t). - cdr), - ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { - goto BgL_tagzd21966zd2_943; - } else { - obj_t BgL_cdrzd21994zd2_959; - { - obj_t BgL_auxz00_4120; - BgL_auxz00_4120 = - ((((obj_t) ((long) BgL_cdrzd21979zd2_953 - 3))->pair_t). - cdr); - BgL_cdrzd21994zd2_959 = - ((((obj_t) ((long) BgL_auxz00_4120 - 3))->pair_t).cdr); - } - if (((((long) BgL_cdrzd21994zd2_959) & ((1 << 2) - 1)) == 3)) { - if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 - (((((obj_t) ((long) BgL_cdrzd21994zd2_959 - 3))-> - pair_t).cdr), - ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { - goto BgL_tagzd21966zd2_943; - } else { - int BgL_testz00_4128; - { - obj_t BgL_auxz00_4129; - BgL_auxz00_4129 = - ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t). - car); - BgL_testz00_4128 = - ((((long) BgL_auxz00_4129) & ((1 << 2) - 1)) == 3); - } - if (BgL_testz00_4128) { - BgL_tagzd21971zd2_948: - if ((BgL_namedzf3zf3_42 != - ((obj_t) (obj_t) - ((long) (((long) (1) << 2) | 2))))) { - obj_t BgL_v1052z00_1026; - { - int BgL_auxz00_4134; - BgL_auxz00_4134 = (int) (((long) 3)); - BgL_v1052z00_1026 = create_vector (BgL_auxz00_4134); - } - { - obj_t BgL_arg1606z00_1028; - { - obj_t BgL_v1053z00_1029; - { - int BgL_auxz00_4137; - BgL_auxz00_4137 = (int) (((long) 3)); - BgL_v1053z00_1029 = - create_vector (BgL_auxz00_4137); - } - { - int BgL_auxz00_4140; - BgL_auxz00_4140 = (int) (((long) 2)); - ((& - (((obj_t) (BgL_v1053z00_1029))->vector_t. - obj0))[BgL_auxz00_4140] = - BgL_formalsz00_39, - ((obj_t) (obj_t) - ((long) (((long) (3) << 2) | 2)))); - } - { - int BgL_auxz00_4143; - BgL_auxz00_4143 = (int) (((long) 1)); - ((& - (((obj_t) (BgL_v1053z00_1029))->vector_t. - obj0))[BgL_auxz00_4143] = - BgL_bodyz00_40, - ((obj_t) (obj_t) - ((long) (((long) (3) << 2) | 2)))); - } - { - int BgL_auxz00_4146; - BgL_auxz00_4146 = (int) (((long) 0)); - ((& - (((obj_t) (BgL_v1053z00_1029))->vector_t. - obj0))[BgL_auxz00_4146] = - BgL_wherez00_41, - ((obj_t) (obj_t) - ((long) (((long) (3) << 2) | 2)))); - } - BgL_arg1606z00_1028 = BgL_v1053z00_1029; - } - { - int BgL_auxz00_4149; - BgL_auxz00_4149 = (int) (((long) 2)); - ((&(((obj_t) (BgL_v1052z00_1026))->vector_t.obj0)) - [BgL_auxz00_4149] = - BgL_arg1606z00_1028, - ((obj_t) (obj_t) - ((long) (((long) (3) << 2) | 2)))); - } - } - { - int BgL_auxz00_4152; - BgL_auxz00_4152 = (int) (((long) 1)); - ((&(((obj_t) (BgL_v1052z00_1026))->vector_t.obj0)) - [BgL_auxz00_4152] = - BgL_locz00_43, - ((obj_t) (obj_t) - ((long) (((long) (3) << 2) | 2)))); - } - { - obj_t BgL_auxz00_4157; - int BgL_auxz00_4155; - BgL_auxz00_4157 = - (obj_t) ((long) - (((long) (((long) 55)) << 2) | 1)); - BgL_auxz00_4155 = (int) (((long) 0)); - ((&(((obj_t) (BgL_v1052z00_1026))->vector_t.obj0)) - [BgL_auxz00_4155] = - BgL_auxz00_4157, - ((obj_t) (obj_t) - ((long) (((long) (3) << 2) | 2)))); - } - return BgL_v1052z00_1026; - } else { - obj_t BgL_v1054z00_1030; - { - int BgL_auxz00_4160; - BgL_auxz00_4160 = (int) (((long) 3)); - BgL_v1054z00_1030 = create_vector (BgL_auxz00_4160); - } - { - obj_t BgL_arg1608z00_1032; - BgL_arg1608z00_1032 = - make_pair (BgL_bodyz00_40, BgL_formalsz00_39); - { - int BgL_auxz00_4164; - BgL_auxz00_4164 = (int) (((long) 2)); - ((&(((obj_t) (BgL_v1054z00_1030))->vector_t.obj0)) - [BgL_auxz00_4164] = - BgL_arg1608z00_1032, - ((obj_t) (obj_t) - ((long) (((long) (3) << 2) | 2)))); - } - } - { - int BgL_auxz00_4167; - BgL_auxz00_4167 = (int) (((long) 1)); - ((&(((obj_t) (BgL_v1054z00_1030))->vector_t.obj0)) - [BgL_auxz00_4167] = - BgL_locz00_43, - ((obj_t) (obj_t) - ((long) (((long) (3) << 2) | 2)))); - } - { - obj_t BgL_auxz00_4172; - int BgL_auxz00_4170; - BgL_auxz00_4172 = - (obj_t) ((long) - (((long) (((long) 56)) << 2) | 1)); - BgL_auxz00_4170 = (int) (((long) 0)); - ((&(((obj_t) (BgL_v1054z00_1030))->vector_t.obj0)) - [BgL_auxz00_4170] = - BgL_auxz00_4172, - ((obj_t) (obj_t) - ((long) (((long) (3) << 2) | 2)))); - } - return BgL_v1054z00_1030; - } - } else { - int BgL_testz00_4175; - { - obj_t BgL_auxz00_4176; - { - obj_t BgL_auxz00_4177; - BgL_auxz00_4177 = - ((((obj_t) ((long) BgL_formalsz00_39 - 3))-> - pair_t).cdr); - BgL_auxz00_4176 = - ((((obj_t) ((long) BgL_auxz00_4177 - 3))->pair_t). - car); - } - BgL_testz00_4175 = - ((((long) BgL_auxz00_4176) & ((1 << 2) - 1)) == 3); - } - if (BgL_testz00_4175) { - goto BgL_tagzd21971zd2_948; - } else { - int BgL_testz00_4181; - { - obj_t BgL_auxz00_4182; - { - obj_t BgL_auxz00_4183; - { - obj_t BgL_auxz00_4184; - BgL_auxz00_4184 = - ((((obj_t) ((long) BgL_formalsz00_39 - 3))-> - pair_t).cdr); - BgL_auxz00_4183 = - ((((obj_t) ((long) BgL_auxz00_4184 - 3))-> - pair_t).cdr); - } - BgL_auxz00_4182 = - ((((obj_t) ((long) BgL_auxz00_4183 - 3))-> - pair_t).car); - } - BgL_testz00_4181 = - ((((long) BgL_auxz00_4182) & ((1 << 2) - 1)) == - 3); - } - if (BgL_testz00_4181) { - goto BgL_tagzd21971zd2_948; - } else { - goto BgL_tagzd21971zd2_948; - } - } - } - } - } else { - int BgL_testz00_4189; - { - obj_t BgL_auxz00_4190; - BgL_auxz00_4190 = - ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t). - car); - BgL_testz00_4189 = - ((((long) BgL_auxz00_4190) & ((1 << 2) - 1)) == 3); - } - if (BgL_testz00_4189) { - goto BgL_tagzd21971zd2_948; - } else { - int BgL_testz00_4193; - { - obj_t BgL_auxz00_4194; - { - obj_t BgL_auxz00_4195; - BgL_auxz00_4195 = - ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t). - cdr); - BgL_auxz00_4194 = - ((((obj_t) ((long) BgL_auxz00_4195 - 3))->pair_t). - car); - } - BgL_testz00_4193 = - ((((long) BgL_auxz00_4194) & ((1 << 2) - 1)) == 3); - } - if (BgL_testz00_4193) { - goto BgL_tagzd21971zd2_948; - } else { - int BgL_testz00_4199; - { - obj_t BgL_auxz00_4200; - { - obj_t BgL_auxz00_4201; - { - obj_t BgL_auxz00_4202; - BgL_auxz00_4202 = - ((((obj_t) ((long) BgL_formalsz00_39 - 3))-> - pair_t).cdr); - BgL_auxz00_4201 = - ((((obj_t) ((long) BgL_auxz00_4202 - 3))-> - pair_t).cdr); - } - BgL_auxz00_4200 = - ((((obj_t) ((long) BgL_auxz00_4201 - 3))->pair_t). - car); - } - BgL_testz00_4199 = - ((((long) BgL_auxz00_4200) & ((1 << 2) - 1)) == 3); - } - if (BgL_testz00_4199) { - goto BgL_tagzd21971zd2_948; - } else { - if ((BgL_namedzf3zf3_42 != - ((obj_t) (obj_t) - ((long) (((long) (1) << 2) | 2))))) { - obj_t BgL_v1050z00_1022; - { - int BgL_auxz00_4209; - BgL_auxz00_4209 = (int) (((long) 3)); - BgL_v1050z00_1022 = - create_vector (BgL_auxz00_4209); - } - { - obj_t BgL_arg1604z00_1024; - BgL_arg1604z00_1024 = - make_pair (BgL_wherez00_41, BgL_bodyz00_40); - { - int BgL_auxz00_4213; - BgL_auxz00_4213 = (int) (((long) 2)); - ((& - (((obj_t) (BgL_v1050z00_1022))->vector_t. - obj0))[BgL_auxz00_4213] = - BgL_arg1604z00_1024, - ((obj_t) (obj_t) - ((long) (((long) (3) << 2) | 2)))); - } - } - { - int BgL_auxz00_4216; - BgL_auxz00_4216 = (int) (((long) 1)); - ((&(((obj_t) (BgL_v1050z00_1022))->vector_t.obj0)) - [BgL_auxz00_4216] = - BgL_locz00_43, - ((obj_t) (obj_t) - ((long) (((long) (3) << 2) | 2)))); - } - { - obj_t BgL_auxz00_4221; - int BgL_auxz00_4219; - BgL_auxz00_4221 = - (obj_t) ((long) - (((long) (((long) 50)) << 2) | 1)); - BgL_auxz00_4219 = (int) (((long) 0)); - ((&(((obj_t) (BgL_v1050z00_1022))->vector_t.obj0)) - [BgL_auxz00_4219] = - BgL_auxz00_4221, - ((obj_t) (obj_t) - ((long) (((long) (3) << 2) | 2)))); - } - return BgL_v1050z00_1022; - } else { - obj_t BgL_v1051z00_1025; - { - int BgL_auxz00_4224; - BgL_auxz00_4224 = (int) (((long) 3)); - BgL_v1051z00_1025 = - create_vector (BgL_auxz00_4224); - } - { - int BgL_auxz00_4227; - BgL_auxz00_4227 = (int) (((long) 2)); - ((&(((obj_t) (BgL_v1051z00_1025))->vector_t.obj0)) - [BgL_auxz00_4227] = - BgL_bodyz00_40, - ((obj_t) (obj_t) - ((long) (((long) (3) << 2) | 2)))); - } - { - int BgL_auxz00_4230; - BgL_auxz00_4230 = (int) (((long) 1)); - ((&(((obj_t) (BgL_v1051z00_1025))->vector_t.obj0)) - [BgL_auxz00_4230] = - BgL_locz00_43, - ((obj_t) (obj_t) - ((long) (((long) (3) << 2) | 2)))); - } - { - obj_t BgL_auxz00_4235; - int BgL_auxz00_4233; - BgL_auxz00_4235 = - (obj_t) ((long) - (((long) (((long) 54)) << 2) | 1)); - BgL_auxz00_4233 = (int) (((long) 0)); - ((&(((obj_t) (BgL_v1051z00_1025))->vector_t.obj0)) - [BgL_auxz00_4233] = - BgL_auxz00_4235, - ((obj_t) (obj_t) - ((long) (((long) (3) << 2) | 2)))); - } - return BgL_v1051z00_1025; - } - } - } - } - } - } - } else { - int BgL_testz00_4238; - { - obj_t BgL_auxz00_4239; - BgL_auxz00_4239 = - ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t).car); - BgL_testz00_4238 = - ((((long) BgL_auxz00_4239) & ((1 << 2) - 1)) == 3); - } - if (BgL_testz00_4238) { - goto BgL_tagzd21971zd2_948; - } else { - int BgL_testz00_4242; - { - obj_t BgL_auxz00_4243; - BgL_auxz00_4243 = - ((((obj_t) ((long) BgL_cdrzd21979zd2_953 - 3))->pair_t). - car); - BgL_testz00_4242 = - ((((long) BgL_auxz00_4243) & ((1 << 2) - 1)) == 3); - } - if (BgL_testz00_4242) { - goto BgL_tagzd21971zd2_948; - } else { - if ((BgL_namedzf3zf3_42 != - ((obj_t) (obj_t) ((long) (((long) (1) << 2) | 2))))) { - obj_t BgL_v1048z00_1018; - { - int BgL_auxz00_4248; - BgL_auxz00_4248 = (int) (((long) 3)); - BgL_v1048z00_1018 = create_vector (BgL_auxz00_4248); - } - { - obj_t BgL_arg1602z00_1020; - BgL_arg1602z00_1020 = - make_pair (BgL_wherez00_41, BgL_bodyz00_40); - { - int BgL_auxz00_4252; - BgL_auxz00_4252 = (int) (((long) 2)); - ((&(((obj_t) (BgL_v1048z00_1018))->vector_t.obj0)) - [BgL_auxz00_4252] = - BgL_arg1602z00_1020, - ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - } - { - int BgL_auxz00_4255; - BgL_auxz00_4255 = (int) (((long) 1)); - ((&(((obj_t) (BgL_v1048z00_1018))->vector_t.obj0)) - [BgL_auxz00_4255] = - BgL_locz00_43, - ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - { - obj_t BgL_auxz00_4260; - int BgL_auxz00_4258; - BgL_auxz00_4260 = - (obj_t) ((long) (((long) (((long) 49)) << 2) | 1)); - BgL_auxz00_4258 = (int) (((long) 0)); - ((&(((obj_t) (BgL_v1048z00_1018))->vector_t.obj0)) - [BgL_auxz00_4258] = - BgL_auxz00_4260, - ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - return BgL_v1048z00_1018; - } else { - obj_t BgL_v1049z00_1021; - { - int BgL_auxz00_4263; - BgL_auxz00_4263 = (int) (((long) 3)); - BgL_v1049z00_1021 = create_vector (BgL_auxz00_4263); - } - { - int BgL_auxz00_4266; - BgL_auxz00_4266 = (int) (((long) 2)); - ((&(((obj_t) (BgL_v1049z00_1021))->vector_t.obj0)) - [BgL_auxz00_4266] = - BgL_bodyz00_40, - ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - { - int BgL_auxz00_4269; - BgL_auxz00_4269 = (int) (((long) 1)); - ((&(((obj_t) (BgL_v1049z00_1021))->vector_t.obj0)) - [BgL_auxz00_4269] = - BgL_locz00_43, - ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - { - obj_t BgL_auxz00_4274; - int BgL_auxz00_4272; - BgL_auxz00_4274 = - (obj_t) ((long) (((long) (((long) 53)) << 2) | 1)); - BgL_auxz00_4272 = (int) (((long) 0)); - ((&(((obj_t) (BgL_v1049z00_1021))->vector_t.obj0)) - [BgL_auxz00_4272] = - BgL_auxz00_4274, - ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - return BgL_v1049z00_1021; - } - } - } - } - } - } else { - int BgL_testz00_4277; - { - obj_t BgL_auxz00_4278; - BgL_auxz00_4278 = - ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t).car); - BgL_testz00_4277 = - ((((long) BgL_auxz00_4278) & ((1 << 2) - 1)) == 3); - } - if (BgL_testz00_4277) { - goto BgL_tagzd21971zd2_948; - } else { - if ((BgL_namedzf3zf3_42 != - ((obj_t) (obj_t) ((long) (((long) (1) << 2) | 2))))) { - obj_t BgL_v1046z00_1014; - { - int BgL_auxz00_4283; - BgL_auxz00_4283 = (int) (((long) 3)); - BgL_v1046z00_1014 = create_vector (BgL_auxz00_4283); - } - { - obj_t BgL_arg1600z00_1016; - BgL_arg1600z00_1016 = - make_pair (BgL_wherez00_41, BgL_bodyz00_40); - { - int BgL_auxz00_4287; - BgL_auxz00_4287 = (int) (((long) 2)); - ((&(((obj_t) (BgL_v1046z00_1014))->vector_t.obj0)) - [BgL_auxz00_4287] = - BgL_arg1600z00_1016, - ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - } - { - int BgL_auxz00_4290; - BgL_auxz00_4290 = (int) (((long) 1)); - ((&(((obj_t) (BgL_v1046z00_1014))->vector_t.obj0)) - [BgL_auxz00_4290] = - BgL_locz00_43, - ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - { - obj_t BgL_auxz00_4295; - int BgL_auxz00_4293; - BgL_auxz00_4295 = - (obj_t) ((long) (((long) (((long) 48)) << 2) | 1)); - BgL_auxz00_4293 = (int) (((long) 0)); - ((&(((obj_t) (BgL_v1046z00_1014))->vector_t.obj0)) - [BgL_auxz00_4293] = - BgL_auxz00_4295, - ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - return BgL_v1046z00_1014; - } else { - obj_t BgL_v1047z00_1017; - { - int BgL_auxz00_4298; - BgL_auxz00_4298 = (int) (((long) 3)); - BgL_v1047z00_1017 = create_vector (BgL_auxz00_4298); - } - { - int BgL_auxz00_4301; - BgL_auxz00_4301 = (int) (((long) 2)); - ((&(((obj_t) (BgL_v1047z00_1017))->vector_t.obj0)) - [BgL_auxz00_4301] = - BgL_bodyz00_40, - ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - { - int BgL_auxz00_4304; - BgL_auxz00_4304 = (int) (((long) 1)); - ((&(((obj_t) (BgL_v1047z00_1017))->vector_t.obj0)) - [BgL_auxz00_4304] = - BgL_locz00_43, - ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - { - obj_t BgL_auxz00_4309; - int BgL_auxz00_4307; - BgL_auxz00_4309 = - (obj_t) ((long) (((long) (((long) 52)) << 2) | 1)); - BgL_auxz00_4307 = (int) (((long) 0)); - ((&(((obj_t) (BgL_v1047z00_1017))->vector_t.obj0)) - [BgL_auxz00_4307] = - BgL_auxz00_4309, - ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - return BgL_v1047z00_1017; - } - } - } - } - } else { - if ((BgL_namedzf3zf3_42 != - ((obj_t) (obj_t) ((long) (((long) (1) << 2) | 2))))) { - obj_t BgL_v1044z00_1010; - { - int BgL_auxz00_4314; - BgL_auxz00_4314 = (int) (((long) 3)); - BgL_v1044z00_1010 = create_vector (BgL_auxz00_4314); - } - { - obj_t BgL_arg1598z00_1012; - BgL_arg1598z00_1012 = make_pair (BgL_wherez00_41, BgL_bodyz00_40); - { - int BgL_auxz00_4318; - BgL_auxz00_4318 = (int) (((long) 2)); - ((&(((obj_t) (BgL_v1044z00_1010))->vector_t.obj0)) - [BgL_auxz00_4318] = - BgL_arg1598z00_1012, - ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - } - { - int BgL_auxz00_4321; - BgL_auxz00_4321 = (int) (((long) 1)); - ((&(((obj_t) (BgL_v1044z00_1010))->vector_t.obj0))[BgL_auxz00_4321] - = - BgL_locz00_43, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - { - obj_t BgL_auxz00_4326; - int BgL_auxz00_4324; - BgL_auxz00_4326 = - (obj_t) ((long) (((long) (((long) 47)) << 2) | 1)); - BgL_auxz00_4324 = (int) (((long) 0)); - ((&(((obj_t) (BgL_v1044z00_1010))->vector_t.obj0))[BgL_auxz00_4324] - = - BgL_auxz00_4326, - ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - return BgL_v1044z00_1010; - } else { - obj_t BgL_v1045z00_1013; - { - int BgL_auxz00_4329; - BgL_auxz00_4329 = (int) (((long) 3)); - BgL_v1045z00_1013 = create_vector (BgL_auxz00_4329); - } - { - int BgL_auxz00_4332; - BgL_auxz00_4332 = (int) (((long) 2)); - ((&(((obj_t) (BgL_v1045z00_1013))->vector_t.obj0))[BgL_auxz00_4332] - = - BgL_bodyz00_40, - ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - { - int BgL_auxz00_4335; - BgL_auxz00_4335 = (int) (((long) 1)); - ((&(((obj_t) (BgL_v1045z00_1013))->vector_t.obj0))[BgL_auxz00_4335] - = - BgL_locz00_43, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - { - obj_t BgL_auxz00_4340; - int BgL_auxz00_4338; - BgL_auxz00_4340 = - (obj_t) ((long) (((long) (((long) 51)) << 2) | 1)); - BgL_auxz00_4338 = (int) (((long) 0)); - ((&(((obj_t) (BgL_v1045z00_1013))->vector_t.obj0))[BgL_auxz00_4338] - = - BgL_auxz00_4340, - ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); - } - return BgL_v1045z00_1013; - } - } - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020304-2.c b/gcc/testsuite/gcc.c-torture/compile/20020304-2.c deleted file mode 100644 index 9a162d4935d..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020304-2.c +++ /dev/null @@ -1,10 +0,0 @@ -/* This testcase ICEd because a SUBREG of MEM/v was never - simplified. */ -volatile unsigned long long *a; - -unsigned char -foo (void) -{ - unsigned char b = (*a != 0); - return b; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020309-1.c b/gcc/testsuite/gcc.c-torture/compile/20020309-1.c deleted file mode 100644 index b74061764de..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020309-1.c +++ /dev/null @@ -1,14 +0,0 @@ -int -sub1 (char *p, int i) -{ - char j = p[i]; - - { - void - sub2 () - { - i = 2; - p = p + 2; - } - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020309-2.c b/gcc/testsuite/gcc.c-torture/compile/20020309-2.c deleted file mode 100644 index 77699e43d3d..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020309-2.c +++ /dev/null @@ -1,16 +0,0 @@ -/* This testcase ICEd on IA-32 at -O2, because loop was calling convert_modes - between a MODE_FLOAT and MODE_INT class modes. */ - -typedef union -{ - double d; - long long ll; -} A; - -void -foo (A x, A **y, A z) -{ - for (; *y; y++) - if (x.ll == 262 && (*y)->d == z.d) - break; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020312-1.c b/gcc/testsuite/gcc.c-torture/compile/20020312-1.c deleted file mode 100644 index 9f61dae64a5..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020312-1.c +++ /dev/null @@ -1,19 +0,0 @@ -/* PR optimization/5892 */ -typedef struct { unsigned long a; unsigned int b, c; } A; -typedef struct { unsigned long a; A *b; int c; } B; - -static inline unsigned int -bar (unsigned int x) -{ - unsigned long r; - asm ("" : "=r" (r) : "0" (x)); - return r >> 31; -} - -int foo (B *x) -{ - A *y; - y = x->b; - y->b = bar (x->c); - y->c = ({ unsigned int z = 1; (z << 24) | (z >> 24); }); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020312-1.x b/gcc/testsuite/gcc.c-torture/compile/20020312-1.x deleted file mode 100644 index 105f2516474..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020312-1.x +++ /dev/null @@ -1,6 +0,0 @@ -# This does not compile on HC11/HC12 due to the asm which requires -# two 32-bit registers. -if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { - return 1 -} -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/20020314-1.c b/gcc/testsuite/gcc.c-torture/compile/20020314-1.c deleted file mode 100644 index b21eb14f8d9..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020314-1.c +++ /dev/null @@ -1,26 +0,0 @@ -typedef struct tux_req_struct tux_req_t; -struct tux_req_struct -{ - struct socket *sock; - char usermode; - char *userbuf; - unsigned int userlen; - char error; - void *private; -}; -void user_send_buffer (tux_req_t *req, int cachemiss) -{ - int ret; -repeat: - switch (ret) { - case -11: - if (add_output_space_event(req, req->sock)) { - del_tux_atom(req); - goto repeat; - } - do { } while (0); - break; - default: - add_req_to_workqueue(req); - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020315-1.c b/gcc/testsuite/gcc.c-torture/compile/20020315-1.c deleted file mode 100644 index c6c9daa2f72..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020315-1.c +++ /dev/null @@ -1,34 +0,0 @@ -/* PR bootstrap/4128 */ - -extern int bar (char *, char *, int, int); -extern long baz (char *, char *, int, int); - -int sgt (char *a, char *b, int c, int d) -{ - return bar (a, b, c, d) > 0; -} - -long dgt (char *a, char *b, int c, int d) -{ - return baz (a, b, c, d) > 0; -} - -int sne (char *a, char *b, int c, int d) -{ - return bar (a, b, c, d) != 0; -} - -long dne (char *a, char *b, int c, int d) -{ - return baz (a, b, c, d) != 0; -} - -int seq (char *a, char *b, int c, int d) -{ - return bar (a, b, c, d) == 0; -} - -long deq (char *a, char *b, int c, int d) -{ - return baz (a, b, c, d) == 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020318-1.c b/gcc/testsuite/gcc.c-torture/compile/20020318-1.c deleted file mode 100644 index 097a35d7956..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020318-1.c +++ /dev/null @@ -1,16 +0,0 @@ -/* PR c/5656 - This testcase ICEd on IA-32 at -O3, due to tree inliner not converting - parameter assignment when using K&R syntax. */ - -void foo (c) - char c; -{ - (void) &c; -} - -int bar (void); - -void baz (void) -{ - foo (bar ()); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020319-1.c b/gcc/testsuite/gcc.c-torture/compile/20020319-1.c deleted file mode 100644 index be5b9c2fece..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020319-1.c +++ /dev/null @@ -1,20 +0,0 @@ -/* This testcase ICEd in combine.c:do_SUBST() self-test for sign-extended -CONST_INT because expr.c:expand_expr() was not sign-extending array index -into constant strings. */ - -typedef unsigned char uch; -extern uch outbuf[]; -extern unsigned outcnt; - -extern void flush_outbuf (void); - -int zip(void) -{ - outcnt = 0; - - {outbuf[outcnt++]=(uch)("\037\213"[0]); if (outcnt==16384) flush_outbuf();}; - {outbuf[outcnt++]=(uch)("\037\213"[1]); if (outcnt==16384) flush_outbuf();}; - - return 0; -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/20020320-1.c b/gcc/testsuite/gcc.c-torture/compile/20020320-1.c deleted file mode 100644 index 385c061e193..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020320-1.c +++ /dev/null @@ -1,24 +0,0 @@ -/* PR bootstrap/4192 - This testcase caused infinite loop in flow (several places), - because flow assumes gen_jump generates simple_jump_p. */ - -typedef void (*T) (void); -extern T x[]; - -void -foo (void) -{ - static T *p = x; - static _Bool a; - T f; - - if (__builtin_expect (a, 0)) - return; - - while ((f = *p)) - { - p++; - f (); - } - a = 1; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020323-1.c b/gcc/testsuite/gcc.c-torture/compile/20020323-1.c deleted file mode 100644 index ed3c66651d9..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020323-1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* This testcase caused ICE on powerpc at -O3, because regrename did - not handle match_dup of match_operator if the RTLs were not shared. */ - -struct A -{ - unsigned char *a0, *a1; - int a2; -}; - -void bar (struct A *); - -unsigned int -foo (int x) -{ - struct A a; - unsigned int b; - - if (x < -128 || x > 255 || x == -1) - return 26; - - a.a0 = (unsigned char *) &b; - a.a1 = a.a0 + sizeof (unsigned int); - a.a2 = 0; - bar (&a); - return b; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020330-1.c b/gcc/testsuite/gcc.c-torture/compile/20020330-1.c deleted file mode 100644 index cac7099127f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020330-1.c +++ /dev/null @@ -1,27 +0,0 @@ -/* PR 5446 */ -/* This testcase is similar to gcc.c-torture/compile/20011219-1.c except - with parts of it omitted, causing an ICE with -O3 on IA-64. */ - -void * baz (unsigned long); -static inline double ** -bar (long w, long x, long y, long z) -{ - long i, a = x - w + 1, b = z - y + 1; - double **m = (double **) baz (sizeof (double *) * (a + 1)); - - m += 1; - m -= w; - m[w] = (double *) baz (sizeof (double) * (a * b + 1)); - for (i = w + 1; i <= x; i++) - m[i] = m[i - 1] + b; - return m; -} - -void -foo (double w[], int x, double y[], double z[]) -{ - int i; - double **a; - - a = bar (1, 50, 1, 50); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020409-1.c b/gcc/testsuite/gcc.c-torture/compile/20020409-1.c deleted file mode 100644 index 1bdc08ff3b8..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020409-1.c +++ /dev/null @@ -1,9 +0,0 @@ -/* PR c/5078 */ - -#include <limits.h> - -int f(int i) -{ - i -= 2 * (INT_MAX + 1); - return i; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020415-1.c b/gcc/testsuite/gcc.c-torture/compile/20020415-1.c deleted file mode 100644 index 95cdc1eafeb..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020415-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* Check that floating point casts of integer operations don't ICE. */ -/* The first of these routines caused problems for a patch, that wasn't - otherwise caught by a full bootstrap, the regression test suite or - SPEC CPU2000. */ - -double -andop (unsigned int x) -{ - return x & 1; -} - -double -orop (unsigned int x) -{ - return x | 1; -} - -double -notop (unsigned int x) -{ - return ~x; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020418-1.c b/gcc/testsuite/gcc.c-torture/compile/20020418-1.c deleted file mode 100644 index df01e6847e3..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020418-1.c +++ /dev/null @@ -1,18 +0,0 @@ -/* PR c/6358 - This testcase ICEd on IA-32 in foo, because current_function_return_rtx - was assigned a hard register only after expand_null_return was called, - thus return pseudo was clobbered twice and the hard register not at - all. */ - -void baz (void); - -double foo (void) -{ - baz (); - return; -} - -double bar (void) -{ - baz (); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020530-1.c b/gcc/testsuite/gcc.c-torture/compile/20020530-1.c deleted file mode 100644 index a6794892ec7..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020530-1.c +++ /dev/null @@ -1,16 +0,0 @@ -/* PR optimization/6822 */ - -extern unsigned char foo1 (void); -extern unsigned short foo2 (void); - -int bar1 (void) -{ - unsigned char q = foo1 (); - return (q < 0x80) ? 64 : 0; -} - -int bar2 (void) -{ - unsigned short h = foo2 (); - return (h < 0x8000) ? 64 : 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020604-1.c b/gcc/testsuite/gcc.c-torture/compile/20020604-1.c deleted file mode 100644 index 19e082030a4..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020604-1.c +++ /dev/null @@ -1,87 +0,0 @@ -/* PR c/6957 - This testcase ICEd at -O2 on IA-32, because - (insn 141 139 142 (set (subreg:SF (reg:QI 72) 0) - (plus:SF (reg:SF 73) - (reg:SF 76))) 525 {*fop_sf_comm_nosse} (insn_list 134 (nil)) - (expr_list:REG_DEAD (reg:SF 73) (nil))) - couldn't be reloaded. */ - -void -foo (unsigned int n, int x, int y, unsigned char *z) -{ - int a, b; - float c[2048][4]; - - switch (x) - { - case 0x1906: - a = b = -1; - break; - case 0x190A: - a = b = -1; - break; - case 0x8049: - a = b = -1; - break; - case 0x1907: - a = 1; - b = 2; - break; - default: - return; - } - - if (a >= 0) - { - unsigned char *d = z; - unsigned int i; - for (i = 0; i < n; i++) - { - do - { - union - { - float r; - unsigned int i; - } - e; - e.r = c[i][1]; - d[a] = - ((e.i >= 0x3f7f0000) ? ((int) e.i < - 0) ? (unsigned char) 0 - : (unsigned char) 255 : (e.r = - e.r * (255.0F / 256.0F) + - 32768.0F, (unsigned char) e.i)); - } - while (0); - d += y; - } - } - - if (b >= 0) - { - unsigned char *d = z; - unsigned int i; - for (i = 0; i < n; i++) - { - do - { - union - { - float r; - unsigned int i; - } - e; - e.r = c[i][2]; - d[b] = - ((e.i >= 0x3f7f0000) ? ((int) e.i < - 0) ? (unsigned char) 0 - : (unsigned char) 255 : (e.r = - e.r * (255.0F / 256.0F) + - 32768.0F, (unsigned char) e.i)); - } - while (0); - d += y; - } - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020604-1.x b/gcc/testsuite/gcc.c-torture/compile/20020604-1.x deleted file mode 100644 index bced22f0f44..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020604-1.x +++ /dev/null @@ -1,10 +0,0 @@ -# The array is too big. -if { [istarget "h8300-*-*"] } { - return 1; -} - -if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { - return 1; -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/20020605-1.c b/gcc/testsuite/gcc.c-torture/compile/20020605-1.c deleted file mode 100644 index 960a4be7ed1..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020605-1.c +++ /dev/null @@ -1,17 +0,0 @@ -/* This testcase caused on IA-32 -O2 endless loop in - merge_blocks when trying to merge a basic block - with itself. */ - -void f (void) -{ - char *c; - do - { - if (c) - break; - } - while (1); - if (!c) - while (1) - f (); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020701-1.c b/gcc/testsuite/gcc.c-torture/compile/20020701-1.c deleted file mode 100644 index 1258cec28b7..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020701-1.c +++ /dev/null @@ -1,75 +0,0 @@ -/* PR target/7177 - Problem with cris-axis-elf: ICE in global. - Origin: hp@axis.com. */ - -typedef __SIZE_TYPE__ size_t; -void f1 (void *); -char *f2 (const char *); -int atoi (const char *); -char *strchr (const char *, int); -int strcmp (const char *, const char *); -size_t strlen (const char *); -typedef enum { A, B, C } t1; -extern const char _v[]; - -static t1 -f (const char* p1, const char* p2, char p3) -{ - char *v1; - char *v2; - char *a; - char *v3; - char *v4; - char *v5; - char *e; - char *v6; - t1 r = C; - - v1 = f2 (p2); - v4 = f2 (p1); - - a = v2 = v1; - e = v5 = v4; - memcpy (&e, &e, sizeof (e)); - - v3 = strchr (v2, ','); - v6 = strchr (v5, ','); - - while ((_v + 1)[(unsigned) *a] & 4) - a++; - while ((_v + 1)[(unsigned) *e] & 4) - e++; - - if (a == v3 && e == v6) - { - if (p3) - r = atoi (v5) < atoi (v2) ? B : A; - else - r = atoi (v5) > atoi (v2) ? B : A; - v2 = ++a; - v5 = ++e; - v3 = strchr (v2, ','); - v6 = strchr (v5, ','); - - while ((_v + 1)[(unsigned) *a] & 4) - a++; - while ((_v + 1)[(unsigned) *e] & 4) - e++; - - if (a == v3 && e == v6) - { - if (r == B) - r = B; - else if (p3) - r = atoi (v5) < atoi (v2) ? B : A; - else - r = atoi (v5) > atoi (v2) ? B : A; - } - else - r = C; - } - - f1 (v1); - f1 (v4); - return r; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020706-1.c b/gcc/testsuite/gcc.c-torture/compile/20020706-1.c deleted file mode 100644 index c8811bc68ff..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020706-1.c +++ /dev/null @@ -1,50 +0,0 @@ -// Contributed by Alexandre Oliva <aoliva@redhat.com> -// From Red Hat case 106165. - -typedef struct s1 -{ - unsigned short v1; - unsigned char *v2; -} S1; - -extern void bar(const struct s1 *const hdb); -extern unsigned char* foo (); - -unsigned int sn; -S1 *hdb; -S1 *pb; -unsigned short len; - -unsigned int crashIt() -{ - unsigned char *p; - unsigned int nsn; - unsigned short cnt; - - if (sn != 0) return 1; - - if ((len < 12) || ((p = (((pb->v1) >= 8) ? pb->v2 : foo() )) == 0)) - return 1; - - nsn = ( - (((*(unsigned int*)p) & 0x000000ff) << 24) | - (((*(unsigned int*)p) & 0x0000ff00) << 8) | - (((*(unsigned int*)p) & 0x00ff0000) >> 8) | - (((*(unsigned int*)p) & 0xff000000) >> 24) ); - p += 4; - - cnt = (unsigned short) (( - (((*(unsigned int*)p) & 0x000000ff) << 24) | - (((*(unsigned int*)p) & 0x0000ff00) << 8) | - (((*(unsigned int*)p) & 0x00ff0000) >> 8) | - (((*(unsigned int*)p) & 0xff000000) >> 24) ) & - 0xffff); - - if ((len != 12 + (cnt * 56)) || (nsn == 0)) - { - bar(hdb); - return 1; - } - - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020706-2.c b/gcc/testsuite/gcc.c-torture/compile/20020706-2.c deleted file mode 100644 index b84dda60fd3..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020706-2.c +++ /dev/null @@ -1,26 +0,0 @@ -// Contributed by Alexandre Oliva <aoliva@redhat.com> -// From Red Hat case 106165. - -typedef unsigned short (FUNC_P) (void *, unsigned char *, unsigned short); - -void crashIt(int id, FUNC_P *func, unsigned char *funcparm) -{ - unsigned char buff[5], reverse[4]; - unsigned char *bp = buff; - unsigned char *rp = reverse; - unsigned short int count = 0; - unsigned short cnt; - while (id > 0) - { - *rp++ = (unsigned char) (id & 0x7F); - id >>= 7; - count++; - } - cnt = count + 1; - while ((count--) > 1) - { - *bp++ = (unsigned char)(*(--rp) | 0x80); - } - *bp++ = *(--rp); - (void)(*func)(funcparm, buff, cnt); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020709-1.c b/gcc/testsuite/gcc.c-torture/compile/20020709-1.c deleted file mode 100644 index af0e1ddf469..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020709-1.c +++ /dev/null @@ -1,7 +0,0 @@ -extern double atof (__const char *__nptr) __attribute__ ((__pure__)); - -void bar (char *s) -{ - union {double val; unsigned int a, b;} u; - u.val = atof (s); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020710-1.c b/gcc/testsuite/gcc.c-torture/compile/20020710-1.c deleted file mode 100644 index bf6c9066cdd..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020710-1.c +++ /dev/null @@ -1,12 +0,0 @@ -/* Red Hat bugzilla #68395 - PR middle-end/7245 - This testcase ICEd on IA-32 because shift & compare patterns - predicates allowed any immediate, but constraints allowed only - numbers from 1 to 31. */ - -void foo (int *x, unsigned int y) -{ - int a = y >> -13; - if (a) - *x = a; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020715-1.c b/gcc/testsuite/gcc.c-torture/compile/20020715-1.c deleted file mode 100644 index 5294133f37b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020715-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* PR optimization/7153 */ -/* Verify that GCC doesn't promote a register when its - lifetime is not limited to one basic block. */ - -void f(char); -void g(void); - -void scale(void) -{ - int width; - char bytes; - char *src; - - if (width) - { - bytes = *src; - g(); - width *= bytes; - } - - f(bytes); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020910-1.c b/gcc/testsuite/gcc.c-torture/compile/20020910-1.c deleted file mode 100644 index 31398ea3d45..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020910-1.c +++ /dev/null @@ -1,14 +0,0 @@ -unsigned int x0 = 0; - -typedef struct { - unsigned int field1 : 20; - unsigned int field2 : 12; -} XX; - -static XX yy; - -static void foo (void) -{ - yy.field1 = (unsigned int ) (&x0); -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/20020926-1.c b/gcc/testsuite/gcc.c-torture/compile/20020926-1.c deleted file mode 100644 index 260e844549a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020926-1.c +++ /dev/null @@ -1,21 +0,0 @@ -/* PR c/7160 */ -/* Verify that the register-to-stack converter properly handles - branches without return value containing function calls. */ - -extern int gi; - -extern int foo1(int, int); -extern void foo2(int, int); -extern float foo3(int); - -float bar(int i1, int i2) -{ - int i3; - - if (i2) { - i3 = foo1(i1, gi); - foo2(i1, i3); - } - else - return foo3(i2); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020927-1.c b/gcc/testsuite/gcc.c-torture/compile/20020927-1.c deleted file mode 100644 index b93d8a18d5e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020927-1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* PR optimization/7520 */ -/* ICE at -O3 on x86 due to register life problems caused by - the return-without-value in bar. */ - -int -foo () -{ - int i; - long long int j; - - while (1) - { - if (j & 1) - ++i; - j >>= 1; - if (j) - return i; - } -} - -int -bar () -{ - if (foo ()) - return; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020930-1.c b/gcc/testsuite/gcc.c-torture/compile/20020930-1.c deleted file mode 100644 index d2fa3748ab5..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20020930-1.c +++ /dev/null @@ -1,10 +0,0 @@ -/* PR c/8002 */ - -float expm1f(float x) { - union { - float value; - unsigned word; - } sf_u; - sf_u.word = (unsigned) x * 2; - return x + sf_u.value; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021001-1.c b/gcc/testsuite/gcc.c-torture/compile/20021001-1.c deleted file mode 100644 index 9f0f9c0978f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021001-1.c +++ /dev/null @@ -1,4 +0,0 @@ -int foo (double x, double y) -{ - return !__builtin_isunordered (x, y); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021007-1.c b/gcc/testsuite/gcc.c-torture/compile/20021007-1.c deleted file mode 100644 index de4c0defae9..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021007-1.c +++ /dev/null @@ -1,11 +0,0 @@ -/* PR c/7411 */ -/* Verify that GCC simplifies the null addition to i before - virtual register substitution tries it and winds up with - a memory to memory move. */ - -void foo () -{ - int i = 0,j; - - i+=j=0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021015-1.c b/gcc/testsuite/gcc.c-torture/compile/20021015-1.c deleted file mode 100644 index 789b8a8b176..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021015-1.c +++ /dev/null @@ -1,12 +0,0 @@ -/* PR target/7370. */ - -int g (int *x, int *y); - -void f () -{ - int x, y; - char a[4000]; - - g (&x, &y); - x = x/y + x; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021015-2.c b/gcc/testsuite/gcc.c-torture/compile/20021015-2.c deleted file mode 100644 index 6b158c5bdc8..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021015-2.c +++ /dev/null @@ -1,7 +0,0 @@ -/* PR target/8232. */ - -int f (char *p, char *q, int i) -{ - return bcmp (p, q, i); -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/20021103-1.c b/gcc/testsuite/gcc.c-torture/compile/20021103-1.c deleted file mode 100644 index 82802001a5d..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021103-1.c +++ /dev/null @@ -1,10 +0,0 @@ -/* PR middle-end/8408 */ -/* Verify that the recognizer explicitly - handles ADDRESSOF operands. */ - -void foo(void) -{ - double d1 = 3.14159, d2; - if (&d2 == &d1) - ; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021108-1.c b/gcc/testsuite/gcc.c-torture/compile/20021108-1.c deleted file mode 100644 index c421639035a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021108-1.c +++ /dev/null @@ -1,7 +0,0 @@ -int -main() -{ -l1: - return &&l1-&&l2; -l2: -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021110.c b/gcc/testsuite/gcc.c-torture/compile/20021110.c deleted file mode 100644 index dd2aa7e09dd..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021110.c +++ /dev/null @@ -1,10 +0,0 @@ -/* PR c/8439 */ -/* Verify that GCC properly handles null increments. */ - -struct empty { -}; - -void foo(struct empty *p) -{ - p++; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021119-1.c b/gcc/testsuite/gcc.c-torture/compile/20021119-1.c deleted file mode 100644 index d4306b89b99..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021119-1.c +++ /dev/null @@ -1,11 +0,0 @@ -/* PR c/8588 */ -/* Contributed by Volker Reichelt. */ - -/* Verify that GCC converts integer constants - in shift operations. */ - -void foo() -{ - unsigned int i, j; - j = (i >> 0xf0); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021120-1.c b/gcc/testsuite/gcc.c-torture/compile/20021120-1.c deleted file mode 100644 index 423f8ec1964..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021120-1.c +++ /dev/null @@ -1,9 +0,0 @@ -/* PR c/8518 */ -/* Contributed by Volker Reichelt. */ - -/* Verify that GCC doesn't get confused by the - redefinition of an extern inline function. */ - -extern int inline foo () { return 0; } -extern int inline bar () { return 0; } -static int inline bar () { return foo(); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20021120-2.c b/gcc/testsuite/gcc.c-torture/compile/20021120-2.c deleted file mode 100644 index 51f0e257dfd..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021120-2.c +++ /dev/null @@ -1,9 +0,0 @@ -/* PR c/8518 */ -/* Contributed by Volker Reichelt. */ - -/* Verify that GCC doesn't get confused by the - redefinition of an extern inline function. */ - -extern int inline foo () { return 0; } -extern int inline bar () { return 0; } -static int bar () { return foo(); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20021123-1.c b/gcc/testsuite/gcc.c-torture/compile/20021123-1.c deleted file mode 100644 index dd2aa7e09dd..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021123-1.c +++ /dev/null @@ -1,10 +0,0 @@ -/* PR c/8439 */ -/* Verify that GCC properly handles null increments. */ - -struct empty { -}; - -void foo(struct empty *p) -{ - p++; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021123-2.c b/gcc/testsuite/gcc.c-torture/compile/20021123-2.c deleted file mode 100644 index 423f8ec1964..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021123-2.c +++ /dev/null @@ -1,9 +0,0 @@ -/* PR c/8518 */ -/* Contributed by Volker Reichelt. */ - -/* Verify that GCC doesn't get confused by the - redefinition of an extern inline function. */ - -extern int inline foo () { return 0; } -extern int inline bar () { return 0; } -static int inline bar () { return foo(); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20021123-3.c b/gcc/testsuite/gcc.c-torture/compile/20021123-3.c deleted file mode 100644 index 51f0e257dfd..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021123-3.c +++ /dev/null @@ -1,9 +0,0 @@ -/* PR c/8518 */ -/* Contributed by Volker Reichelt. */ - -/* Verify that GCC doesn't get confused by the - redefinition of an extern inline function. */ - -extern int inline foo () { return 0; } -extern int inline bar () { return 0; } -static int bar () { return foo(); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20021123-4.c b/gcc/testsuite/gcc.c-torture/compile/20021123-4.c deleted file mode 100644 index d4306b89b99..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021123-4.c +++ /dev/null @@ -1,11 +0,0 @@ -/* PR c/8588 */ -/* Contributed by Volker Reichelt. */ - -/* Verify that GCC converts integer constants - in shift operations. */ - -void foo() -{ - unsigned int i, j; - j = (i >> 0xf0); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021124-1.c b/gcc/testsuite/gcc.c-torture/compile/20021124-1.c deleted file mode 100644 index 3ab2b2ef495..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021124-1.c +++ /dev/null @@ -1,7 +0,0 @@ -/* PR optimization/8275 */ -/* Contributed by Volker Reichelt. */ - -unsigned int foo (unsigned int u) -{ - return (u >> 32) & 0xffff; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021204-1.c b/gcc/testsuite/gcc.c-torture/compile/20021204-1.c deleted file mode 100644 index 4e8d3fefcbb..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021204-1.c +++ /dev/null @@ -1,16 +0,0 @@ -/* PR c/7622 */ - -/* Verify that GCC can handle the mix of - extern inline and nested functions. */ - -extern inline int t() -{ - int q() { return 0; } - - return q(); -} - -int foo() -{ - return t(); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021205-1.c b/gcc/testsuite/gcc.c-torture/compile/20021205-1.c deleted file mode 100644 index 9c400cfac3a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021205-1.c +++ /dev/null @@ -1,11 +0,0 @@ -/* dg-do compile */ -/* dg-options "-O3" */ -typedef struct x x; -extern void *baz(char *); -struct x { char * (*bar) (int); }; -static x **foo() { return ((x**)baz(0)); } -int xyzzy() -{ - baz((*foo())->bar(0)); - return 3; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021212-1.c b/gcc/testsuite/gcc.c-torture/compile/20021212-1.c deleted file mode 100644 index b89669d75b8..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021212-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* PR optimization/8334 */ -/* Verify that GCC produces valid operands - after simplifying an addition. */ - -void foo(int m, int n, double *f) -{ - int i, j, k = 1; - - for (j = 0; j < n; j++) { - for (i = k; i < m; i++) { - f[i] = (double) (i * j); - f[i + j] = (double) ((i + 1) * j); - } - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021230-1.c b/gcc/testsuite/gcc.c-torture/compile/20021230-1.c deleted file mode 100644 index 45ab51fd5ef..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021230-1.c +++ /dev/null @@ -1,8 +0,0 @@ -/* SH has special handling for combined and/shift sequences. Make - sure that it behaves properly when one input is in the MACL register. */ -int r, t; - -static void initRGB() -{ - t = ((r*255/3) & 0xff) << 16; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030109-1.c b/gcc/testsuite/gcc.c-torture/compile/20030109-1.c deleted file mode 100644 index 4df7d18721a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20030109-1.c +++ /dev/null @@ -1,6 +0,0 @@ -void foo () -{ - int x1, x2, x3; - - bar (&x2 - &x1, &x3 - &x2); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030110-1.c b/gcc/testsuite/gcc.c-torture/compile/20030110-1.c deleted file mode 100644 index 1cbbaea3c10..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20030110-1.c +++ /dev/null @@ -1,39 +0,0 @@ -extern char bpp; - -void foo() -{ - if (bpp == 32) - { - if (2 < 8) - { - do - { - while (inb(0x9ae8) & (0x0100 >> (2 +1))); - } - while(0); - } - else - { - do - { - while (inb(0x9ae8) & (0x0100 >> (2))); - } - while(0); - } - } - else - do - { - while (inb(0x9ae8) & (0x0100 >> (1))); - } - while(0); - if (8 < 8) - { - do - { - while (inb(0x9ae8) & (0x0100 >> (8 +1))); - } - while(0); - } -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/20030125-1.c b/gcc/testsuite/gcc.c-torture/compile/20030125-1.c deleted file mode 100644 index 656304e2d67..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20030125-1.c +++ /dev/null @@ -1,24 +0,0 @@ - int count; - - int func(int *valp) { - int val, locked = 0; - - while ((val = *valp) != 0) { - if (count) { - if (count) - locked = 1; - else - locked = 1; - - if (!locked) - continue; - } - - if (!count) - count--; - - break; - } - - return val; - } diff --git a/gcc/testsuite/gcc.c-torture/compile/20030206-1.c b/gcc/testsuite/gcc.c-torture/compile/20030206-1.c deleted file mode 100644 index 1e0d5445877..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20030206-1.c +++ /dev/null @@ -1,14 +0,0 @@ -/* PR c/9530 */ -/* Contributed by Volker Reichelt. */ - -/* Verify that the call to 'foo' is not turned - into a sibling call. */ - -void foo(float d); - -float bar(float d); - -float baz(float d) -{ - foo(bar(d)); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030216-1.c b/gcc/testsuite/gcc.c-torture/compile/20030216-1.c deleted file mode 100644 index 8f692f09276..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20030216-1.c +++ /dev/null @@ -1,42 +0,0 @@ -/* PR c/8086 */ - -#define P(x) \ - (((((((((((((((((((((((((((((((( \ - (x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) \ - *(x)+a) - -int -polynomial(int a) -{ - return P(3); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030219-1.c b/gcc/testsuite/gcc.c-torture/compile/20030219-1.c deleted file mode 100644 index ecc943f7737..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20030219-1.c +++ /dev/null @@ -1,6 +0,0 @@ -int global_one; - -void clobber_register() -{ - *(volatile unsigned char *)(0xE0000000 * global_one) = 0x00; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030224-1.c b/gcc/testsuite/gcc.c-torture/compile/20030224-1.c deleted file mode 100644 index 6832dc81e47..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20030224-1.c +++ /dev/null @@ -1,17 +0,0 @@ -void zzz (char *s1, char *s2, int len, int *q) -{ - int z = 5; - unsigned int i, b; - struct { char a[z]; } x; - - for (i = 0; i < len; i++) - s1[i] = s2[i]; - - b = z & 0x3; - - len += (b == 0 ? 0 : 1) + z; - - *q = len; - - foo (x, x); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030305-1.c b/gcc/testsuite/gcc.c-torture/compile/20030305-1.c deleted file mode 100644 index 2f608196fdd..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20030305-1.c +++ /dev/null @@ -1,18 +0,0 @@ -/* PR c/9799 */ -/* Verify that GCC doesn't crash on excess elements - in initializer for a flexible array member. */ - -typedef struct { - int aaa; -} s1_t; - -typedef struct { - int bbb; - s1_t s1_array[]; -} s2_t; - -static s2_t s2_array[]= { - { 1, 4 }, - { 2, 5 }, - { 3, 6 } -}; diff --git a/gcc/testsuite/gcc.c-torture/compile/20030314-1.c b/gcc/testsuite/gcc.c-torture/compile/20030314-1.c deleted file mode 100644 index 02d4fed526a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20030314-1.c +++ /dev/null @@ -1,18 +0,0 @@ -/* PR optimization/8396 */ -/* Originator: <papadopo@shfj.cea.fr> */ - -/* Verify that the tree inliner doesn't mess up the types - when passing the value of read-only constant arguments. */ - -static inline bar(const short int xs, const short int xe) -{ - if (xe && (xs < xe)) - ; -} - -void f() -{ - short int xe; - - bar(0, xe); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/900116-1.c b/gcc/testsuite/gcc.c-torture/compile/900116-1.c deleted file mode 100644 index 37c7eb789b9..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/900116-1.c +++ /dev/null @@ -1,14 +0,0 @@ -struct st {char a, b, c, d; } - -zloop (struct st *s, int *p, int *q) -{ - int i; - struct st ss; - - for (i = 0; i < 100; i++) - { - ss = s[i]; - p[i] = ss.c; - q[i] = ss.b; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/900216-1.c b/gcc/testsuite/gcc.c-torture/compile/900216-1.c deleted file mode 100644 index 8a4bfb74e78..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/900216-1.c +++ /dev/null @@ -1,9 +0,0 @@ -foo (p, a, b) - unsigned short *p; -{ - unsigned int x; - - x = p[0]; - - return (x == 134U); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/900313-1.c b/gcc/testsuite/gcc.c-torture/compile/900313-1.c deleted file mode 100644 index f2bc40d7242..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/900313-1.c +++ /dev/null @@ -1,172 +0,0 @@ -main () -{ - char *a; - foo (alloca (10000)); - foo (alloca (100000)); - foo (alloca ((int) &main)); -} - -many_par (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) -{ - char *x; - int aa, ba, ca, da, ea, fa, ga, ha, ia, ja, ka, la, ma, na, oa, pa; - - aa = bar (); - ba = bar (); - ca = bar (); - da = bar (); - ea = bar (); - fa = bar (); - ga = bar (); - ha = bar (); - ia = bar (); - ja = bar (); - ka = bar (); - la = bar (); - ma = bar (); - na = bar (); - oa = bar (); - pa = bar (); - foobar (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, aa, ba, ca, - da, ea, fa, ga, ha, ia, ja, ka, la, ma, na, oa, pa); - -} - -foobar (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, aa, ba, ca, - da, ea, fa, ga, ha, ia, ja, ka, la, ma, na, oa, pa) -{ - int ab, bb, cb, db, eb, fb, gb, hb, ib, jb, kb, lb, mb, nb, ob, pb; - int qb, rb, sb, tb, ub, vb, xb, yb; - - ab = bar (); - bb = bar (); - cb = bar (); - db = bar (); - eb = bar (); - fb = bar (); - gb = bar (); - hb = bar (); - ib = bar (); - jb = bar (); - kb = bar (); - lb = bar (); - mb = bar (); - nb = bar (); - ob = bar (); - pb = bar (); - qb = bar (); - rb = bar (); - sb = bar (); - tb = bar (); - ub = bar (); - vb = bar (); - xb = bar (); - yb = bar (); - - boofar (a); - boofar (b); - boofar (c); - boofar (d); - boofar (e); - boofar (f); - boofar (g); - boofar (h); - boofar (i); - boofar (j); - boofar (k); - boofar (l); - boofar (m); - boofar (n); - boofar (o); - boofar (p); - boofar (aa); - boofar (ba); - boofar (ca); - boofar (da); - boofar (ea); - boofar (fa); - boofar (ga); - boofar (ha); - boofar (ia); - boofar (ja); - boofar (ka); - boofar (la); - boofar (ma); - boofar (na); - boofar (oa); - boofar (pa); - - boofar (ab); - boofar (bb); - boofar (cb); - boofar (db); - boofar (eb); - boofar (fb); - boofar (gb); - boofar (hb); - boofar (ib); - boofar (jb); - boofar (kb); - boofar (lb); - boofar (mb); - boofar (nb); - boofar (ob); - boofar (pb); - - boofar (a); - boofar (b); - boofar (c); - boofar (d); - boofar (e); - boofar (f); - boofar (g); - boofar (h); - boofar (i); - boofar (j); - boofar (k); - boofar (l); - boofar (m); - boofar (n); - boofar (o); - boofar (p); - boofar (aa); - boofar (ba); - boofar (ca); - boofar (da); - boofar (ea); - boofar (fa); - boofar (ga); - boofar (ha); - boofar (ia); - boofar (ja); - boofar (ka); - boofar (la); - boofar (ma); - boofar (na); - boofar (oa); - boofar (pa); - - boofar (ab); - boofar (bb); - boofar (cb); - boofar (db); - boofar (eb); - boofar (fb); - boofar (gb); - boofar (hb); - boofar (ib); - boofar (jb); - boofar (kb); - boofar (lb); - boofar (mb); - boofar (nb); - boofar (ob); - boofar (pb); - -} - -test_exit_ignore_stack () -{ - foobar (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/900407-1.c b/gcc/testsuite/gcc.c-torture/compile/900407-1.c deleted file mode 100644 index fdf47791cd7..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/900407-1.c +++ /dev/null @@ -1,10 +0,0 @@ -foo (a, b, p) - int *p; -{ - int c; - p[1] = a + 0x1000; - c = b + 0xffff0000; - if ((b + 0xffff0000) == 0) - c++; - p[2] = c; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/900516-1.c b/gcc/testsuite/gcc.c-torture/compile/900516-1.c deleted file mode 100644 index 69e96144745..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/900516-1.c +++ /dev/null @@ -1 +0,0 @@ -f(c){return!(c?2.0:1.0);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920301-1.c b/gcc/testsuite/gcc.c-torture/compile/920301-1.c deleted file mode 100644 index c4d663eb8a7..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920301-1.c +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef NO_LABEL_VALUES -f(){static void*t[]={&&x};x:;} -#endif -g(){static unsigned p[5];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920409-1.c b/gcc/testsuite/gcc.c-torture/compile/920409-1.c deleted file mode 100644 index b96ec53d595..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920409-1.c +++ /dev/null @@ -1 +0,0 @@ -x(){int y;y>0.0?y:y-1;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920409-2.c b/gcc/testsuite/gcc.c-torture/compile/920409-2.c deleted file mode 100644 index ef2bdb8b7e7..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920409-2.c +++ /dev/null @@ -1,2 +0,0 @@ -double x(){int x1,x2;double v; -if(((long)(x1-x2))<1)return -1.0;v=t(v);v=y(1,v>0.0?(int)v:((int)v-1));} diff --git a/gcc/testsuite/gcc.c-torture/compile/920410-1.c b/gcc/testsuite/gcc.c-torture/compile/920410-1.c deleted file mode 100644 index 4bfa7a665a3..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920410-1.c +++ /dev/null @@ -1,30 +0,0 @@ -int alloc_float(f) - float f; -{ union - { - float f; - int i; - } - u; - u.f=f; - return u.i&~1; -} - -float c_float(int obj) -{ union - { - float f; - int i; - } u; - - u.i=obj; - return u.f; -} - -main() -{ int x=alloc_float(1.2); - int y=alloc_float(5.7); - int z=alloc_float(c_float(x)*c_float(y)); - - printf("%g\n",(double)c_float(z)); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/920410-2.c b/gcc/testsuite/gcc.c-torture/compile/920410-2.c deleted file mode 100644 index 958aae9cb0f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920410-2.c +++ /dev/null @@ -1,12 +0,0 @@ -joe() -{ - int j; - - while( 1 ) - { - for( j = 0; j < 4; j++ ) - ; - for( j = 0; j < 4; j++ ) - ; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/920411-2.c b/gcc/testsuite/gcc.c-torture/compile/920411-2.c deleted file mode 100644 index 0cc13c8436a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920411-2.c +++ /dev/null @@ -1 +0,0 @@ -x(){int n;double x;n=x<1?n:n+1;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920413-1.c b/gcc/testsuite/gcc.c-torture/compile/920413-1.c deleted file mode 100644 index 45b5fc5d09c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920413-1.c +++ /dev/null @@ -1,2 +0,0 @@ -union u {double d;long long ll;}; -f(double x, int n){union u v;v.d=x;if(n>=0){v.ll<<=63;}else{v.ll+=1<<-n;v.ll>>=-n;}return v.ll;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920415-1.c b/gcc/testsuite/gcc.c-torture/compile/920415-1.c deleted file mode 100644 index 8d9bc065349..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920415-1.c +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef NO_LABEL_VALUES -f () -{ - __label__ l; - void *x() - { - return &&l; - } - goto *x (); - abort (); - return; - l: - exit (0); -} -#else -int x; -#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-1.c b/gcc/testsuite/gcc.c-torture/compile/920428-1.c deleted file mode 100644 index fdc478a382c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920428-1.c +++ /dev/null @@ -1 +0,0 @@ -x(){char*q;return(long)q>>8&0xff;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-2.c b/gcc/testsuite/gcc.c-torture/compile/920428-2.c deleted file mode 100644 index 23f32a83a9d..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920428-2.c +++ /dev/null @@ -1,531 +0,0 @@ -double sin(double x); -double cos(double x); -double tan(double x); -double asin(double x); -double acos(double x); -double atan(double x); -double atan2(double y, double x); -double sinh(double x); -double cosh(double x); -double tanh(double x); -double exp(double x); -double expm1(double x); -double log(double x); -double log10(double x); -double log1p(double x); -double pow(double x, double y); -double sqrt(double x); -double cbrt(double x); -double ceil(double x); -double floor(double x); -double fabs(double x); -double frexp(double value, int *eptr); -double ldexp(double value, int exp); -double modf(double value, double *iptr); -double erf(double x); -double erfc(double x); -double atof(const char *nptr); -double hypot(double x, double y); -double lgamma(double x); -double j0(double x); -double j1(double x); -double jn(int n, double x); -double y0(double x); -double y1(double x); -double yn(int n, double x); -extern struct _iobuf { - int _cnt; - char *_ptr; - char *_base; - int _bufsiz; - short _flag; - char _file; -} _iob[]; -typedef unsigned long size_t; -typedef char *va_list; -struct _iobuf *fopen(const char *filename, const char *type); -struct _iobuf *freopen(const char *filename, const char *type, struct _iobuf *stream); -struct _iobuf *fdopen(int fildes, const char *type); -struct _iobuf *popen(const char *command, const char *type); -int pclose(struct _iobuf *stream); -int fflush(struct _iobuf *stream); -int fclose(struct _iobuf *stream); -int remove(const char *path); -int rename(const char *from, const char *to); -struct _iobuf *tmpfile(void); -char *tmpnam(char *s); -int setvbuf(struct _iobuf *iop, char *buf, int type, size_t size); -int setbuf(struct _iobuf *stream, char *buf); -int setbuffer(struct _iobuf *stream, char *buf, size_t size); -int setlinebuf(struct _iobuf *stream); -int fprintf(struct _iobuf *stream, const char *format, ...); -int printf(const char *format, ...); -char *sprintf(char *s, const char *format, ...); -int vfprintf(struct _iobuf *stream, const char *format, va_list arg); -int vprintf(const char *format, va_list arg); -int vsprintf(char *s, const char *format, va_list arg); -int fscanf(struct _iobuf *stream, const char *format, ...); -int scanf(const char *format, ...); -int sscanf(char *s, const char *format, ...); -int fgetc(struct _iobuf *stream); -int getw(struct _iobuf *stream); -char *fgets(char *s, int n, struct _iobuf *stream); -char *gets(char *s); -int fputc(int c, struct _iobuf *stream); -int putw(int w, struct _iobuf *stream); -int fputs(const char *s, struct _iobuf *stream); -int puts(const char *s); -int ungetc(int c, struct _iobuf *stream); -int fread(void *ptr, size_t size, size_t count, struct _iobuf *iop); -int fwrite(const void *ptr, size_t size, size_t count, struct _iobuf *iop); -int fseek(struct _iobuf *stream, long offset, int ptrname); -long ftell(struct _iobuf *stream); -void rewind(struct _iobuf *stream); -int fgetpos(struct _iobuf *stream, long *pos); -int fsetpos(struct _iobuf *stream, const long *pos); -void perror(const char *s); -typedef unsigned char byte; -typedef unsigned char uchar; -typedef unsigned short ushort; -typedef unsigned int uint; -typedef unsigned long ulong; -typedef unsigned char u_char; -typedef unsigned short u_short; -typedef unsigned int u_int; -typedef unsigned long u_long; -typedef unsigned short ushort_; -typedef struct _physadr { int r[1]; } *physadr; -typedef struct label_t { - int val[11]; -} label_t; -typedef struct _quad { long val[2]; } quad; -typedef long daddr_t; -typedef char * caddr_t; -typedef u_long ino_t; -typedef long swblk_t; -typedef long time_t; -typedef short dev_t; -typedef long off_t; -typedef u_short uid_t; -typedef u_short gid_t; -typedef signed char prio_t; -typedef long fd_mask; -typedef struct fd_set { - fd_mask fds_bits[(((256 )+(( (sizeof(fd_mask) * 8 ) )-1))/( (sizeof(fd_mask) * 8 ) )) ]; -} fd_set; -typedef struct qhdr { - struct qhdr *link, *rlink; -} *queue_t; -typedef char *ptr_ord_t; -typedef double floatp; -typedef char *(*proc_alloc_t)(unsigned num_elements, unsigned element_size, const char *client_name ); -typedef void (*proc_free_t)(char *data, unsigned num_elements, unsigned element_size, const char *client_name ); -extern struct _iobuf *gs_out; -typedef struct gs_point_s { - double x, y; -} gs_point; -typedef struct gs_int_point_s { - int x, y; -} gs_int_point; -typedef struct gs_rect_s { - gs_point p, q; -} gs_rect; -typedef struct gs_int_rect_s { - gs_int_point p, q; -} gs_int_rect; -typedef struct gs_state_s gs_state; -typedef struct { - proc_alloc_t alloc; - proc_free_t free; -} gs_memory_procs; -char *gs_malloc(uint, uint, const char * ); -void gs_free(char *, uint, uint, const char * ); -extern char gs_debug[128]; -extern int gs_log_error(int, const char *, int ); -typedef long fixed; -typedef struct gs_fixed_point_s { - fixed x, y; -} gs_fixed_point; -typedef struct gs_fixed_rect_s { - gs_fixed_point p, q; -} gs_fixed_rect; -typedef struct gs_matrix_s { - long _xx; float xx; long _xy; float xy; long _yx; float yx; long _yy; float yy; long _tx; float tx; long _ty; float ty; -} gs_matrix; -void gs_make_identity(gs_matrix * ); -int gs_make_translation(floatp, floatp, gs_matrix * ), - gs_make_scaling(floatp, floatp, gs_matrix * ), - gs_make_rotation(floatp, gs_matrix * ); -int gs_matrix_multiply(const gs_matrix *, const gs_matrix *, gs_matrix * ), - gs_matrix_invert(const gs_matrix *, gs_matrix * ), - gs_matrix_rotate(const gs_matrix *, floatp, gs_matrix * ); -int gs_point_transform(floatp, floatp, const gs_matrix *, gs_point * ), - gs_point_transform_inverse(floatp, floatp, const gs_matrix *, gs_point * ), - gs_distance_transform(floatp, floatp, const gs_matrix *, gs_point * ), - gs_distance_transform_inverse(floatp, floatp, const gs_matrix *, gs_point * ), - gs_bbox_transform_inverse(gs_rect *, gs_matrix *, gs_rect * ); -typedef struct gs_matrix_fixed_s { - long _xx; float xx; long _xy; float xy; long _yx; float yx; long _yy; float yy; long _tx; float tx; long _ty; float ty; - fixed tx_fixed, ty_fixed; -} gs_matrix_fixed; -extern void gs_update_matrix_fixed(gs_matrix_fixed * ); -int gs_point_transform2fixed(gs_matrix_fixed *, floatp, floatp, gs_fixed_point * ), - gs_distance_transform2fixed(gs_matrix_fixed *, floatp, floatp, gs_fixed_point * ); -typedef struct { - long xx, xy, yx, yy; - int skewed; - int shift; - int max_bits; - fixed round; -} fixed_coeff; - -typedef enum { - gs_cap_butt = 0, - gs_cap_round = 1, - gs_cap_square = 2 -} gs_line_cap; -typedef enum { - gs_join_miter = 0, - gs_join_round = 1, - gs_join_bevel = 2 -} gs_line_join; -gs_state *gs_state_alloc(proc_alloc_t, proc_free_t ); -int gs_state_free(gs_state * ); -int gs_gsave(gs_state * ), - gs_grestore(gs_state * ), - gs_grestoreall(gs_state * ); -gs_state *gs_gstate(gs_state * ); -int gs_currentgstate(gs_state * , const gs_state * ), - gs_setgstate(gs_state * , const gs_state * ); -gs_state *gs_state_swap_saved(gs_state *, gs_state * ); -void gs_state_swap(gs_state *, gs_state * ); -int gs_initgraphics(gs_state * ); -typedef struct gx_device_s gx_device; -int gs_flushpage(gs_state * ); -int gs_copypage(gs_state * ); -int gs_output_page(gs_state *, int, int ); -int gs_copyscanlines(gx_device *, int, byte *, uint, int *, uint * ); -gx_device * gs_getdevice(int ); -int gs_copydevice(gx_device **, gx_device *, proc_alloc_t ); -int gs_makeimagedevice(gx_device **, gs_matrix *, uint, uint, byte *, int, proc_alloc_t ); -void gs_nulldevice(gs_state * ); -int gs_setdevice(gs_state *, gx_device * ); -gx_device * gs_currentdevice(gs_state * ); -const char * gs_devicename(gx_device * ); -void gs_deviceinitialmatrix(gx_device *, gs_matrix * ); -int gs_closedevice(gx_device * ); -int gs_setlinewidth(gs_state *, floatp ); -float gs_currentlinewidth(const gs_state * ); -int gs_setlinecap(gs_state *, gs_line_cap ); -gs_line_cap gs_currentlinecap(const gs_state * ); -int gs_setlinejoin(gs_state *, gs_line_join ); -gs_line_join gs_currentlinejoin(const gs_state * ); -int gs_setmiterlimit(gs_state *, floatp ); -float gs_currentmiterlimit(const gs_state * ); -int gs_setdash(gs_state *, const float *, uint, floatp ); -uint gs_currentdash_length(const gs_state * ); -int gs_currentdash_pattern(const gs_state *, float * ); -float gs_currentdash_offset(const gs_state * ); -int gs_setflat(gs_state *, floatp ); -float gs_currentflat(const gs_state * ); -int gs_setstrokeadjust(gs_state *, int ); -int gs_currentstrokeadjust(const gs_state * ); -typedef enum { - gs_color_space_DeviceGray = 0, - gs_color_space_DeviceRGB, - gs_color_space_DeviceCMYK -} gs_color_space; -typedef struct gs_color_s gs_color; -extern const uint gs_color_sizeof; -int gs_setgray(gs_state *, floatp ); -float gs_currentgray(gs_state * ); -int gs_sethsbcolor(gs_state *, floatp, floatp, floatp ), - gs_currenthsbcolor(gs_state *, float [3] ), - gs_setrgbcolor(gs_state *, floatp, floatp, floatp ), - gs_currentrgbcolor(gs_state *, float [3] ); -int gs_currentcolorspace(gs_state *, gs_color_space * ); -typedef float (*gs_transfer_proc)(gs_state *, floatp ); -int gs_settransfer(gs_state *, gs_transfer_proc ), - gs_settransfer_remap(gs_state *, gs_transfer_proc, int ); -gs_transfer_proc gs_currenttransfer(gs_state * ); -int gs_setcolortransfer(gs_state *, gs_transfer_proc , - gs_transfer_proc , gs_transfer_proc , - gs_transfer_proc ), - gs_setcolortransfer_remap(gs_state *, gs_transfer_proc , - gs_transfer_proc , gs_transfer_proc , - gs_transfer_proc , int ); -void gs_currentcolortransfer(gs_state *, gs_transfer_proc [4] ); -int gs_setscreen(gs_state *, floatp, floatp, float (*)(floatp, floatp ) ); -int gs_currentscreen(gs_state *, float *, float *, float (**)(floatp, floatp ) ); -int gs_sethalftonephase(gs_state *, int, int ); -int gs_currenthalftonephase(gs_state *, gs_int_point * ); -typedef struct gs_screen_enum_s gs_screen_enum; -extern const uint gs_screen_enum_sizeof; -int gs_screen_init(gs_screen_enum *, gs_state *, floatp, floatp ); -int gs_screen_currentpoint(gs_screen_enum *, gs_point * ); -int gs_screen_next(gs_screen_enum *, floatp ); -struct gs_state_s { - gs_state *saved; - gs_memory_procs memory_procs; - gs_matrix_fixed ctm; - gs_matrix ctm_inverse; - int inverse_valid; - struct gx_path_s *path; - struct gx_clip_path_s *clip_path; - int clip_rule; - struct line_params_s *line_params; - struct halftone_params_s *halftone; - float (*ht_proc)(floatp, floatp ); - gs_int_point ht_phase; - gs_int_point phase_mod; - struct gs_color_s *color; - struct gx_device_color_s *dev_color; - struct gx_transfer_s *transfer; - struct gs_font_s *font; - gs_matrix char_tm; - int char_tm_valid; - byte in_cachedevice; - byte in_charpath; - - - - - int level; - float flatness; - int stroke_adjust; - struct device_s *device; - int device_is_shared; - -}; -typedef unsigned long gx_bitmap_id; -typedef struct gx_bitmap_s { - byte *data; - int raster; - gs_int_point size; - gx_bitmap_id id; - ushort rep_width, rep_height; -} gx_bitmap; -typedef unsigned long gx_color_index; -typedef unsigned short gx_color_value; -typedef struct gx_device_color_info_s { - int num_components; - - int depth; - gx_color_value max_gray; - gx_color_value max_rgb; - - gx_color_value dither_gray; - gx_color_value dither_rgb; - -} gx_device_color_info; -typedef struct gx_device_procs_s gx_device_procs; -struct gx_device_s { - int params_size; gx_device_procs *procs; const char *dname; int width; int height; float x_pixels_per_inch; float y_pixels_per_inch; float l_margin, b_margin, r_margin, t_margin; gx_device_color_info color_info; int is_open; -}; -typedef struct gs_prop_item_s gs_prop_item; -struct gx_device_procs_s { - int (*open_device)(gx_device *dev ); - void (*get_initial_matrix)(gx_device *dev, gs_matrix *pmat ); - int (*sync_output)(gx_device *dev ); - int (*output_page)(gx_device *dev, int num_copies, int flush ); - int (*close_device)(gx_device *dev ); - gx_color_index (*map_rgb_color)(gx_device *dev, gx_color_value red, gx_color_value green, gx_color_value blue ); - int (*map_color_rgb)(gx_device *dev, gx_color_index color, gx_color_value rgb[3] ); - int (*fill_rectangle)(gx_device *dev, int x, int y, int width, int height, gx_color_index color ); - int (*tile_rectangle)(gx_device *dev, gx_bitmap *tile, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1, int phase_x, int phase_y ); - int (*copy_mono)(gx_device *dev, unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1 ); - int (*copy_color)(gx_device *dev, unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height ); - int (*draw_line)(gx_device *dev, int x0, int y0, int x1, int y1, gx_color_index color ); - int (*get_bits)(gx_device *dev, int y, unsigned char *data, unsigned int size, int pad_to_word ); - int (*get_props)(gx_device *dev, gs_prop_item *plist ); - - int (*put_props)(gx_device *dev, gs_prop_item *plist, int count ); - -}; -extern unsigned int gx_device_bytes_per_scan_line(gx_device *dev, int pad_to_word ); -int gx_default_open_device(gx_device *dev ); -void gx_default_get_initial_matrix(gx_device *dev, gs_matrix *pmat ); -int gx_default_sync_output(gx_device *dev ); -int gx_default_output_page(gx_device *dev, int num_copies, int flush ); -int gx_default_close_device(gx_device *dev ); -gx_color_index gx_default_map_rgb_color(gx_device *dev, gx_color_value red, gx_color_value green, gx_color_value blue ); -int gx_default_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3] ); -int gx_default_tile_rectangle(gx_device *dev, gx_bitmap *tile, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1, int phase_x, int phase_y ); -int gx_default_copy_color(gx_device *dev, unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height ); -int gx_default_draw_line(gx_device *dev, int x0, int y0, int x1, int y1, gx_color_index color ); -int gx_default_get_bits(gx_device *dev, int y, unsigned char *data, unsigned int size, int pad_to_word ); -int gx_default_get_props(gx_device *dev, gs_prop_item *plist ); -int gx_default_put_props(gx_device *dev, gs_prop_item *plist, int count ); -typedef struct device_s { - gx_device *info; - int is_band_device; - gx_color_index white, black; -} device; -int gs_initmatrix(gs_state * ), - gs_defaultmatrix(const gs_state *, gs_matrix * ), - gs_currentmatrix(const gs_state *, gs_matrix * ), - gs_setmatrix(gs_state *, const gs_matrix * ), - gs_translate(gs_state *, floatp, floatp ), - gs_scale(gs_state *, floatp, floatp ), - gs_rotate(gs_state *, floatp ), - gs_concat(gs_state *, const gs_matrix * ); -int gs_transform(gs_state *, floatp, floatp, gs_point * ), - gs_dtransform(gs_state *, floatp, floatp, gs_point * ), - gs_itransform(gs_state *, floatp, floatp, gs_point * ), - gs_idtransform(gs_state *, floatp, floatp, gs_point * ); -static int -ctm_set_inverse(gs_state *pgs) -{ int code = gs_matrix_invert(&*(gs_matrix *)&(pgs)->ctm , &pgs->ctm_inverse); - 0; - if ( code < 0 ) return code; - pgs->inverse_valid = 1; - return 0; -} -void -gs_update_matrix_fixed(gs_matrix_fixed *pmat) -{ (*pmat). tx = ((float)(((*pmat). tx_fixed = ((fixed)(((*pmat). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (*pmat). ty = ((float)(((*pmat). ty_fixed = ((fixed)(((*pmat). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))); -} -int -gs_initmatrix(gs_state *pgs) -{ gx_device *dev = pgs->device->info; - (*dev->procs->get_initial_matrix)(dev, &*(gs_matrix *)&(pgs)->ctm ); - (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0; - return 0; -} -int -gs_defaultmatrix(const gs_state *pgs, gs_matrix *pmat) -{ gx_device *dev = pgs->device->info; - (*dev->procs->get_initial_matrix)(dev, pmat); - return 0; -} -int -gs_currentmatrix(const gs_state *pgs, gs_matrix *pmat) -{ *pmat = *(gs_matrix *)&(pgs)->ctm; - return 0; -} -int -gs_setmatrix(gs_state *pgs, const gs_matrix *pmat) -{ *(gs_matrix *)&(pgs)->ctm = *pmat; - (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0; - return 0; -} -int -gs_translate(gs_state *pgs, floatp dx, floatp dy) -{ gs_point pt; - int code; - if ( (code = gs_distance_transform(dx, dy, &*(gs_matrix *)&(pgs)->ctm , &pt)) < 0 ) - return code; - pgs->ctm.tx += pt.x; - pgs->ctm.ty += pt.y; - (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0; - return 0; -} -int -gs_scale(gs_state *pgs, floatp sx, floatp sy) -{ pgs->ctm.xx *= sx; - pgs->ctm.xy *= sx; - pgs->ctm.yx *= sy; - pgs->ctm.yy *= sy; - pgs->inverse_valid = 0, pgs->char_tm_valid = 0; - return 0; -} -int -gs_rotate(gs_state *pgs, floatp ang) -{ int code = gs_matrix_rotate(&*(gs_matrix *)&(pgs)->ctm , ang, &*(gs_matrix *)&(pgs)->ctm ); - pgs->inverse_valid = 0, pgs->char_tm_valid = 0; - return code; -} -int -gs_concat(gs_state *pgs, const gs_matrix *pmat) -{ int code = gs_matrix_multiply(pmat, &*(gs_matrix *)&(pgs)->ctm , &*(gs_matrix *)&(pgs)->ctm ); - (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0; - return code; -} -int -gs_transform(gs_state *pgs, floatp x, floatp y, gs_point *pt) -{ return gs_point_transform(x, y, &*(gs_matrix *)&(pgs)->ctm , pt); -} -int -gs_dtransform(gs_state *pgs, floatp dx, floatp dy, gs_point *pt) -{ return gs_distance_transform(dx, dy, &*(gs_matrix *)&(pgs)->ctm , pt); -} -int -gs_itransform(gs_state *pgs, floatp x, floatp y, gs_point *pt) -{ - - if ( !!(((*(long *)(&((&pgs->ctm)->xy)) | *(long *)(&( (&pgs->ctm)->yx)) ) << 1) == 0) ) - { return gs_point_transform_inverse(x, y, &*(gs_matrix *)&(pgs)->ctm , pt); - } - else - { if ( !pgs->inverse_valid ) { int code = ctm_set_inverse(pgs); if ( code < 0 ) return code; }; - return gs_point_transform(x, y, &pgs->ctm_inverse, pt); - } -} -int -gs_idtransform(gs_state *pgs, floatp dx, floatp dy, gs_point *pt) -{ - - if ( !!(((*(long *)(&((&pgs->ctm)->xy)) | *(long *)(&( (&pgs->ctm)->yx)) ) << 1) == 0) ) - { return gs_distance_transform_inverse(dx, dy, - &*(gs_matrix *)&(pgs)->ctm , pt); - } - else - { if ( !pgs->inverse_valid ) { int code = ctm_set_inverse(pgs); if ( code < 0 ) return code; }; - return gs_distance_transform(dx, dy, &pgs->ctm_inverse, pt); - } -} -int -gs_translate_to_fixed(register gs_state *pgs, fixed px, fixed py) -{ pgs->ctm.tx = ((float)((pgs->ctm.tx_fixed = px)*(1.0/(1<<12 ) ))); - pgs->ctm.ty = ((float)((pgs->ctm.ty_fixed = py)*(1.0/(1<<12 ) ))); - pgs->inverse_valid = 0; - pgs->char_tm_valid = 1; - return 0; -} -int -gx_matrix_to_fixed_coeff(const gs_matrix *pmat, register fixed_coeff *pfc, - int max_bits) -{ gs_matrix ctm; - int scale = -10000; - int expt, shift; - ctm = *pmat; - pfc->skewed = 0; - if ( !((*(long *)(&(ctm.xx)) << 1) == 0) ) - { (void)frexp(ctm.xx, &scale); - } - if ( !((*(long *)(&(ctm.xy)) << 1) == 0) ) - { (void)frexp(ctm.xy, &expt); - if ( expt > scale ) scale = expt; - pfc->skewed = 1; - } - if ( !((*(long *)(&(ctm.yx)) << 1) == 0) ) - { (void)frexp(ctm.yx, &expt); - if ( expt > scale ) scale = expt; - pfc->skewed = 1; - } - if ( !((*(long *)(&(ctm.yy)) << 1) == 0) ) - { (void)frexp(ctm.yy, &expt); - if ( expt > scale ) scale = expt; - } - scale = sizeof(long) * 8 - 1 - max_bits - scale; - shift = scale - 12; - if ( shift > 0 ) - { pfc->shift = shift; - pfc->round = (fixed)1 << (shift - 1); - } - else - { pfc->shift = 0; - pfc->round = 0; - scale -= shift; - } - pfc->xx = (((*(long *)(&(ctm.xx)) << 1) == 0) ? 0 : (long)ldexp(ctm.xx, scale)); - pfc->yy = (((*(long *)(&(ctm.yy)) << 1) == 0) ? 0 : (long)ldexp(ctm.yy, scale)); - if ( pfc->skewed ) - { pfc->xy = (((*(long *)(&(ctm.xy)) << 1) == 0) ? 0 : (long)ldexp(ctm.xy, scale)); - pfc->yx = (((*(long *)(&(ctm.yx)) << 1) == 0) ? 0 : (long)ldexp(ctm.yx, scale)); - } - else - pfc->xy = pfc->yx = 0; - pfc->max_bits = max_bits; - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-3.c b/gcc/testsuite/gcc.c-torture/compile/920428-3.c deleted file mode 100644 index 13640c98ad2..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920428-3.c +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef NO_LABEL_VALUES -x(a){static void*j[]={&&l1,&&l2};goto*j[a];l1:return 0;l2:return 1;} -#else -main(){ exit (0); } -#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-4.c b/gcc/testsuite/gcc.c-torture/compile/920428-4.c deleted file mode 100644 index cc5e30c2a80..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920428-4.c +++ /dev/null @@ -1 +0,0 @@ -x(a){struct{int p[a],i;}l;l.i;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-5.c b/gcc/testsuite/gcc.c-torture/compile/920428-5.c deleted file mode 100644 index ff313799280..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920428-5.c +++ /dev/null @@ -1 +0,0 @@ -typedef struct{unsigned b0:1;}*t;x(a,b)t a,b;{b->b0=a->b0;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-6.c b/gcc/testsuite/gcc.c-torture/compile/920428-6.c deleted file mode 100644 index e43af7ed3a7..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920428-6.c +++ /dev/null @@ -1,22 +0,0 @@ -typedef struct x -{ - struct x *type; - struct x *chain; - struct x *value; -} *tree; - -int -func (new, old) - register tree new, old; -{ - if (old->type == 0 || new->type == 0) - { - register tree t = old->type; - if (t == 0) - t = new->type; - for (; t; t = t->chain ) - if (t->value) - return 1; - } - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-7.c b/gcc/testsuite/gcc.c-torture/compile/920428-7.c deleted file mode 100644 index 69b1d979aa9..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920428-7.c +++ /dev/null @@ -1 +0,0 @@ -x(float*x){int a[4],i=0,j;for(j=0;j<2;j++){f(a[i++]);f(a[i++]);}} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-1.c b/gcc/testsuite/gcc.c-torture/compile/920501-1.c deleted file mode 100644 index 29e197341aa..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-1.c +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef NO_LABEL_VALUES -a(){int**b[]={&&c};c:;} -#else -int x; -#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-10.c b/gcc/testsuite/gcc.c-torture/compile/920501-10.c deleted file mode 100644 index ecb5bb4151c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-10.c +++ /dev/null @@ -1 +0,0 @@ -x(y){return 8193*y;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-11.c b/gcc/testsuite/gcc.c-torture/compile/920501-11.c deleted file mode 100644 index d636357e867..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-11.c +++ /dev/null @@ -1 +0,0 @@ -typedef struct{int s;}S;foo(){int i=(int)&(S){(void*)((int)&(S){1})};} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-12.c b/gcc/testsuite/gcc.c-torture/compile/920501-12.c deleted file mode 100644 index 594e14178b9..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-12.c +++ /dev/null @@ -1,5 +0,0 @@ -x(x){ return 3 + x;} -a(x){int y[994]; return 3 + x;} -b(x){int y[999]; return 2*(x + 3);} -A(x){int y[9999];return 2*(x + 3);} -B(x){int y[9949];return 3 + x;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-12.x b/gcc/testsuite/gcc.c-torture/compile/920501-12.x deleted file mode 100644 index 61ba34933fb..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-12.x +++ /dev/null @@ -1,6 +0,0 @@ -# This test fails on HC11/HC12 when it is compiled without -mshort because -# the stack arrays are too large. Force to use 16-bit ints for it. -if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { - set options "-mshort" -} -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-13.c b/gcc/testsuite/gcc.c-torture/compile/920501-13.c deleted file mode 100644 index b5a6798ecc2..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-13.c +++ /dev/null @@ -1 +0,0 @@ -typedef struct{int i;}t;inline y(t u){}x(){t u;y(u);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-15.c b/gcc/testsuite/gcc.c-torture/compile/920501-15.c deleted file mode 100644 index 81fd66401d5..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-15.c +++ /dev/null @@ -1 +0,0 @@ -x(a)double a;{int i;return i>a?i:i+1;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-16.c b/gcc/testsuite/gcc.c-torture/compile/920501-16.c deleted file mode 100644 index f82b7524b24..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-16.c +++ /dev/null @@ -1 +0,0 @@ -f(n){struct z{int a,b[n],c[n];};} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-17.c b/gcc/testsuite/gcc.c-torture/compile/920501-17.c deleted file mode 100644 index 05a4d408d50..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-17.c +++ /dev/null @@ -1 +0,0 @@ -x(){static const char x[]="x";char y[2];y[0]=x[1];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-18.c b/gcc/testsuite/gcc.c-torture/compile/920501-18.c deleted file mode 100644 index 70f7c0af505..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-18.c +++ /dev/null @@ -1,2 +0,0 @@ -union u{int i;float f;}; -x(p)int p;{union u x;for(x.i=0;x.i<p;x.i++)if(x.f>(float)3.0)break;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-19.c b/gcc/testsuite/gcc.c-torture/compile/920501-19.c deleted file mode 100644 index 1671cc37e68..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-19.c +++ /dev/null @@ -1 +0,0 @@ -long long x=0;y(){x=0;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-2.c b/gcc/testsuite/gcc.c-torture/compile/920501-2.c deleted file mode 100644 index 905f5ddb627..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-2.c +++ /dev/null @@ -1,11 +0,0 @@ -extern short distdata[64][64], taxidata[64][64]; -extern short PieceList[2][64]; - -int -ScoreKBNK (short int winner, short int king1, short int king2) -{ - register short s; - - s = taxidata[king1][king2] + distdata[PieceList[winner][1]][king2]; - return s; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-20.c b/gcc/testsuite/gcc.c-torture/compile/920501-20.c deleted file mode 100644 index 170d0501761..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-20.c +++ /dev/null @@ -1 +0,0 @@ -int*f(x)int*x;{if(x[4]){int h[1];if(setjmp(h))return x;}} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-21.c b/gcc/testsuite/gcc.c-torture/compile/920501-21.c deleted file mode 100644 index 4a9f05a1b20..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-21.c +++ /dev/null @@ -1,3 +0,0 @@ -typedef unsigned short t; -struct foo{t d;}; -int bar(d)t d;{struct foo u;u.d=d;return(int)(&u);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-22.c b/gcc/testsuite/gcc.c-torture/compile/920501-22.c deleted file mode 100644 index b15d7984b1b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-22.c +++ /dev/null @@ -1 +0,0 @@ -x(){int y[]={};} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-23.c b/gcc/testsuite/gcc.c-torture/compile/920501-23.c deleted file mode 100644 index 291d93e6c5d..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-23.c +++ /dev/null @@ -1,16 +0,0 @@ -typedef unsigned char qi; -typedef unsigned short hi; -typedef unsigned long si; -typedef unsigned long long di; -subi(a){return 100-a;} -add(a,b){return a+b;} -mul(a){return 85*a;} -memshift(p)unsigned*p;{unsigned x;for(;;){x=*p++>>16;if(x)return x;}} -ldw(xp)si*xp;{return xp[4];} -ldws_m(xp)si*xp;{si x;do{x=xp[3];xp+=3;}while(x);} -postinc_si(p)si*p;{si x;for(;;){x=*p++;if(x)return x;}} -preinc_si(p)si*p;{si x;for(;;){x=*++p;if(x)return x;}} -postinc_di(p)di*p;{di x;for(;;){x=*p++;if(x)return x;}} -preinc_di(p)di*p;{di x;for(;;){x=*++p;if(x)return x;}} -inc_overlap(p,a)di*p;{do{p=*(di**)p;p=(di*)((int)p+4);}while(*p);} -di move_di(p,p2)di*p,*p2;{di x=p;p2=((di*)x)[1];return p2[1];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-3.c b/gcc/testsuite/gcc.c-torture/compile/920501-3.c deleted file mode 100644 index 41ef87fbf7f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-3.c +++ /dev/null @@ -1,2 +0,0 @@ -struct{long long x:24,y:40;}v; -x(){v.y=0;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-4.c b/gcc/testsuite/gcc.c-torture/compile/920501-4.c deleted file mode 100644 index 9cd2fd7bd7a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-4.c +++ /dev/null @@ -1,49 +0,0 @@ -foo () -{ - int r0[8186 ]; - int r1[2 ]; - int r2[2 ]; - int bitm0[2 ]; - int bitm1[2 ]; - int bitm2[2 ]; - - int i,j,k,m,n,m_max; - int f; - double fm,ft; - - while (1) { - - if (m%4 == 2) - ++m; - - if (m_max != 0 && m > m_max) - break; - - fm=m; - - r0[k=1]=0; - bitm0[0] = 0; - - while ( n%f == 0 ) { - while ( (ft != 0) && (ft < fm )) { - bitm1[i] = 0; - r1[i]=0; - } - - while ( r0[i] != 0 && r1[i] != 0 ) { - if ( r0[i] < r1[i] ) { - bitm2[k] = bitm0[i]; - r2[k++]=0; - } - else if ( r0[i] > r1[j] ) { - bitm2[k] = bitm1[j]; - r2[k++]=r1[j++]; - } - else { - bitm1[k] = bitm0[i]; - r2[k++]=r0[i++]; - } - } - } - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-4.x b/gcc/testsuite/gcc.c-torture/compile/920501-4.x deleted file mode 100644 index cf60af9be67..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-4.x +++ /dev/null @@ -1,6 +0,0 @@ -# This test fails on HC11/HC12 when it is compiled without -mshort because -# the 'r0' array is too large. Force to use 16-bit ints for it. -if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { - set options "-mshort" -} -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-6.c b/gcc/testsuite/gcc.c-torture/compile/920501-6.c deleted file mode 100644 index d0a406381ff..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-6.c +++ /dev/null @@ -1 +0,0 @@ -x(y,z)float*y;{*y=z;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-7.c b/gcc/testsuite/gcc.c-torture/compile/920501-7.c deleted file mode 100644 index aed88045e54..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-7.c +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef NO_LABEL_VALUES -x(){if(&&e-&&b<0)x();b:goto*&&b;e:;} -#else -int x; -#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-8.c b/gcc/testsuite/gcc.c-torture/compile/920501-8.c deleted file mode 100644 index 68e33934d21..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-8.c +++ /dev/null @@ -1 +0,0 @@ -x(int*p){int x=p;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-9.c b/gcc/testsuite/gcc.c-torture/compile/920501-9.c deleted file mode 100644 index 98a06000bf2..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920501-9.c +++ /dev/null @@ -1 +0,0 @@ -short x(a)unsigned a;{a=32987799;return a;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920502-1.c b/gcc/testsuite/gcc.c-torture/compile/920502-1.c deleted file mode 100644 index b576c6c990c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920502-1.c +++ /dev/null @@ -1 +0,0 @@ -extern void*t[];x(i){goto*t[i];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920502-2.c b/gcc/testsuite/gcc.c-torture/compile/920502-2.c deleted file mode 100644 index d3aa1e26d81..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920502-2.c +++ /dev/null @@ -1 +0,0 @@ -x(c){1LL<<c;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920520-1.c b/gcc/testsuite/gcc.c-torture/compile/920520-1.c deleted file mode 100644 index 6b1cd7b17c4..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920520-1.c +++ /dev/null @@ -1 +0,0 @@ -f(){asm("%0"::"r"(1.5F));}g(){asm("%0"::"r"(1.5));} diff --git a/gcc/testsuite/gcc.c-torture/compile/920520-1.x b/gcc/testsuite/gcc.c-torture/compile/920520-1.x deleted file mode 100644 index 3687bf6145d..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920520-1.x +++ /dev/null @@ -1,9 +0,0 @@ -set options "-S" - -# This does not work on m68hc11 due to the asm which forces a -# float or a double to go in a register. - -if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { - return 1 -} -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/920521-1.c b/gcc/testsuite/gcc.c-torture/compile/920521-1.c deleted file mode 100644 index 95b949798dc..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920521-1.c +++ /dev/null @@ -1 +0,0 @@ -f(){asm("f":::"cc");}g(x,y){asm("g"::"%r"(x), "r"(y));} diff --git a/gcc/testsuite/gcc.c-torture/compile/920521-1.x b/gcc/testsuite/gcc.c-torture/compile/920521-1.x deleted file mode 100644 index 4cfce33b2dc..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920521-1.x +++ /dev/null @@ -1,2 +0,0 @@ -set options "-S" -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/920529-1.c b/gcc/testsuite/gcc.c-torture/compile/920529-1.c deleted file mode 100644 index 0f50309a27c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920529-1.c +++ /dev/null @@ -1,21 +0,0 @@ -void -f (a, b, m, n) - unsigned short *a, *b; - int m, n; -{ - unsigned long acc; - int qn; - int j; - - abort (); - - acc = a[m - 1]; - a += 0; - for (j = qn - 1; j >= 0; j = j - 1) - { - acc = (acc << 16) | a[j]; - acc = acc % *b; - } - - return; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/920608-1.c b/gcc/testsuite/gcc.c-torture/compile/920608-1.c deleted file mode 100644 index cae1978e6c0..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920608-1.c +++ /dev/null @@ -1,25 +0,0 @@ -foo (p) - int *p; -{ - int x; - int a; - - a = p[0]; - x = a + 5; - a = -1; - p[0] = x - 5; - return a; -} - -bar (p) -{ - short x; - int a; - - x = ((short *) p)[1]; -#if INHIBIT_COMBINE - ((short *) p)[0] = x; -#endif - - return (x < 45); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/920611-2.c b/gcc/testsuite/gcc.c-torture/compile/920611-2.c deleted file mode 100644 index e54b1cda5fc..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920611-2.c +++ /dev/null @@ -1,53 +0,0 @@ -typedef unsigned char uchar; -typedef unsigned short ushort; -typedef unsigned int uint; -typedef unsigned long ulong; - -static unsigned long S[1][1]={0x00820200}; - -static int body(out0,out1,ks,Eswap0,Eswap1) -ulong *out0,*out1; -int *ks; -ulong Eswap0,Eswap1; -{ - register unsigned long l,r,t,u,v; - register unsigned long *s; - register int i,j; - register unsigned long E0,E1; - - l=0; - r=0; - - s=(ulong *)ks; - E0=Eswap0; - E1=Eswap1; - - for (i=0; i<(16 *2); i+=4) - { - v=(r^(r>>16)); - u=(v&E0); - v=(v&E1); - u=(u^(u<<16))^r^s[ i ]; - t=(v^(v<<16))^r^s[ i+1]; - t=(t>>4)|(t<<28); - l^=S[1][(t)&0x3f]| S[3][(t>> 8)&0x3f]| S[5][(t>>16)&0x3f]| S[7][(t>>24)&0x3f]| S[0][(u)&0x3f]| S[2][(u>> 8)&0x3f]| S[4][(u>>16)&0x3f]| S[6][(u>>24)&0x3f]; - v=(l^(l>>16)); - u=(v&E0); - v=(v&E1); - u=(u^(u<<16))^l^s[ i+2 ]; - t=(v^(v<<16))^l^s[ i+2+1]; - t=(t>>4)|(t<<28); - r^= S[1][(t )&0x3f]; - } - t=l; - l=r; - r=t; - - t=r; - r=(l>>1)|(l<<31); - l=(t>>1)|(t<<31); - - *out0=l; - *out1=r; - return(0); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/920615-1.c b/gcc/testsuite/gcc.c-torture/compile/920615-1.c deleted file mode 100644 index 9b1c6aceef3..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920615-1.c +++ /dev/null @@ -1,4 +0,0 @@ -f() -{ - int x[20] = {[0] = 5, [10] = 12}; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/920617-1.c b/gcc/testsuite/gcc.c-torture/compile/920617-1.c deleted file mode 100644 index 2d84e8d84f8..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920617-1.c +++ /dev/null @@ -1 +0,0 @@ -f(){double*xp,y;*xp++=sqrt(y);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920617-2.c b/gcc/testsuite/gcc.c-torture/compile/920617-2.c deleted file mode 100644 index 3a5450982c0..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920617-2.c +++ /dev/null @@ -1 +0,0 @@ -f(a,b,c,d)float a[],d;int b[],c;{} diff --git a/gcc/testsuite/gcc.c-torture/compile/920623-1.c b/gcc/testsuite/gcc.c-torture/compile/920623-1.c deleted file mode 100644 index 9b6ad51e102..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920623-1.c +++ /dev/null @@ -1,2 +0,0 @@ -int f(int c){return f(c--);} -g(){} diff --git a/gcc/testsuite/gcc.c-torture/compile/920624-1.c b/gcc/testsuite/gcc.c-torture/compile/920624-1.c deleted file mode 100644 index 8b4d2979d26..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920624-1.c +++ /dev/null @@ -1,2 +0,0 @@ -int B[],Q[]; -f(){int s;for(s=0;s<=1;s++)switch(s){case 2:case 3:++B[s];case 4:case 5:++Q[s];}} diff --git a/gcc/testsuite/gcc.c-torture/compile/920625-1.c b/gcc/testsuite/gcc.c-torture/compile/920625-1.c deleted file mode 100644 index 720d43fd42f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920625-1.c +++ /dev/null @@ -1,279 +0,0 @@ -typedef unsigned long int unsigned_word; -typedef signed long int signed_word; -typedef unsigned_word word; - -typedef enum { ADD, ADD_CI, ADD_CO, ADD_CIO, SUB, SUB_CI, SUB_CO, -SUB_CIO, ADC_CI, ADC_CO, ADC_CIO, AND, IOR, XOR, ANDC, IORC, EQV, -NAND, NOR, AND_RC, IOR_RC, XOR_RC, ANDC_RC, IORC_RC, EQV_RC, NAND_RC, -NOR_RC, AND_CC, IOR_CC, XOR_CC, ANDC_CC, IORC_CC, EQV_CC, NAND_CC, -NOR_CC, LSHIFTR, ASHIFTR, SHIFTL, LSHIFTR_CO, ASHIFTR_CO, SHIFTL_CO, -ROTATEL, ROTATEL_CO, ROTATEXL_CIO, ASHIFTR_CON, EXTS1, EXTS2, EXTU1, -EXTU2, CLZ, CTZ, FF1, FF0, ABSVAL, NABSVAL, CMP, CPEQ, CPGE, CPGEU, -CPGT, CPGTU, CPLE, CPLEU, CPLT, CPLTU, CPNEQ, CMPPAR, DOZ, COPY, -EXCHANGE, COMCY, } opcode_t; - -typedef struct -{ - opcode_t opcode:8; - unsigned int s1:8; - unsigned int s2:8; - unsigned int d:8; -} insn_t; - -enum prune_flags -{ - NO_PRUNE = 0, - CY_0 = 1, - CY_1 = 2, - CY_JUST_SET = 4, -}; - -int flag_use_carry = 1; - -inline -recurse(opcode_t opcode, - int d, - int s1, - int s2, - word v, - int cost, - insn_t *sequence, - int n_insns, - word *values, - int n_values, - const word goal_value, - int allowed_cost, - int cy, - int prune_flags) -{ - insn_t insn; - - allowed_cost -= cost; - - if (allowed_cost > 0) - { - word old_d; - - old_d = values[d]; - values[d] = v; - - insn.opcode = opcode; - insn.s1 = s1; - insn.s2 = s2; - insn.d = d; - sequence[n_insns] = insn; - - synth(sequence, n_insns + 1, values, n_values, - goal_value, allowed_cost, cy, prune_flags); - - values[d] = old_d; - } - else if (goal_value == v) - { - insn.opcode = opcode; - insn.s1 = s1; - insn.s2 = s2; - insn.d = d; - sequence[n_insns] = insn; - test_sequence(sequence, n_insns + 1); - } -} - -synth(insn_t *sequence, - int n_insns, - word *values, - int n_values, - word goal_value, - int allowed_cost, - int ci, - int prune_hint) -{ - int s1, s2; - word v, r1, r2; - int co; - int last_dest; - - if (n_insns > 0) - last_dest = sequence[n_insns - 1].d; - else - last_dest = -1; - if (ci >= 0 && flag_use_carry) - { - for (s1 = n_values - 1; s1 >= 0; s1--) - { - r1 = values[s1]; - for (s2 = s1 - 1; s2 >= 0; s2--) - { - r2 = values[s2]; - - if (allowed_cost <= 1 && (prune_hint & CY_JUST_SET) == 0) - { - if (last_dest >= 0 && s1 != last_dest && s2 != last_dest) - continue; - } - do { word __d = ( r1) + ( r2) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0); - recurse(ADD_CIO, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); - do { word __d = ( r1) + ( r2) + (( ci)); ( co) = ( ci); (v) = __d; } while (0); - recurse(ADD_CI, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - - do { word __d = ( r1) - ( r2) - (( ci)); ( co) = ( ci) ? __d >= ( r1) : __d > ( r1); (v) = __d; } while (0); - recurse(SUB_CIO, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); - do { word __d = ( r2) - ( r1) - (( ci)); ( co) = ( ci) ? __d >= ( r2) : __d > ( r2); (v) = __d; } while (0); - recurse(SUB_CIO, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); - - do { word __d = ( r1) - ( r2) - (( ci)); ( co) = ( ci); (v) = __d; } while (0); - recurse(SUB_CI, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - do { word __d = ( r2) - ( r1) - (( ci)); ( co) = ( ci); (v) = __d; } while (0); - recurse(SUB_CI, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - - } - } - } - for (s1 = n_values - 1; s1 >= 0; s1--) - { - r1 = values[s1]; - for (s2 = s1 - 1; s2 >= 0; s2--) - { - r2 = values[s2]; - - if (allowed_cost <= 1) - { - if (last_dest >= 0 && s1 != last_dest && s2 != last_dest) - continue; - } - - do { word __d = ( r1) + ( r2); ( co) = __d < ( r1); (v) = __d; } while (0); - recurse(ADD_CO, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); - - ((v) = ( r1) + ( r2), ( co) = ( ci)); - recurse(ADD, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - - do { word __d = ( r1) - ( r2); ( co) = __d > ( r1); (v) = __d; } while (0); - recurse(SUB_CO, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); - do { word __d = ( r2) - ( r1); ( co) = __d > ( r2); (v) = __d; } while (0); - recurse(SUB_CO, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); - ((v) = ( r1) - ( r2), ( co) = ( ci)); - recurse(SUB, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - ((v) = ( r2) - ( r1), ( co) = ( ci)); - recurse(SUB, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - - ((v) = ( r1) & ( r2), ( co) = ( ci)); - recurse(AND, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - - ((v) = ( r1) | ( r2), ( co) = ( ci)); - recurse(IOR, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - - ((v) = ( r1) ^ ( r2), ( co) = ( ci)); - recurse(XOR, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - - ((v) = ( r1) & ~( r2), ( co) = ( ci)); - recurse(ANDC, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - ((v) = ( r2) & ~( r1), ( co) = ( ci)); - recurse(ANDC, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - ((v) = ( r1) | ~( r2), ( co) = ( ci)); - recurse(IORC, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - ((v) = ( r2) | ~( r1), ( co) = ( ci)); - recurse(IORC, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - ((v) = ( r1) ^ ~( r2), ( co) = ( ci)); - recurse(EQV, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - - } - } - if (ci >= 0 && flag_use_carry) - { - for (s1 = n_values - 1; s1 >= 0; s1--) - { - r1 = values[s1]; - - if (allowed_cost <= 1 && (prune_hint & CY_JUST_SET) == 0) - { - - if (last_dest >= 0 && s1 != last_dest) - continue; - } - - do { word __d = ( r1) + ( r1) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0); - recurse(ADD_CIO, n_values, s1, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); - - do { word __d = ( r1) + ( r1) + (( ci)); ( co) = ( ci); (v) = __d; } while (0); - recurse(ADD_CI, n_values, s1, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - - do { word __d = ( r1) + ( -1 ) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0); - recurse(ADD_CIO, n_values, s1, (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); - - do { word __d = ( r1) + ( 0 ) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0); - recurse(ADD_CIO, n_values, s1, (0x20 + 0) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); - do { word __d = ( 0 ) - ( r1) - (( ci)); ( co) = ( ci) ? __d >= ( 0 ) : __d > ( 0 ); (v) = __d; } while (0); - recurse(SUB_CIO, n_values, (0x20 + 0) , s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); - - } - } - for (s1 = n_values - 1; s1 >= 0; s1--) - { - r1 = values[s1]; - - if (allowed_cost <= 1) - { - if (last_dest >= 0 && s1 != last_dest) - continue; - } - do { word __d = ( r1) + ( r1); ( co) = __d < ( r1); (v) = __d; } while (0); - recurse(ADD_CO, n_values, s1, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); - - ((v) = ( r1) & ( 1 ), ( co) = ( ci)); - recurse(AND, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - - ((v) = ( r1) ^ ( 1 ), ( co) = ( ci)); - recurse(XOR, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - - ((v) = ( -1 ) - ( r1), ( co) = ( ci)); - recurse(SUB, n_values, (0x20 + -1) , s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - do { word __d = ( r1) + ( 1 ); ( co) = __d < ( r1); (v) = __d; } while (0); - recurse(ADD_CO, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); - ((v) = ( r1) + ( 1 ), ( co) = ( ci)); - recurse(ADD, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - do { word __d = ( r1) + ( -1 ); ( co) = __d < ( r1); (v) = __d; } while (0); - recurse(ADD_CO, n_values, s1, (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); - do { word __d = ( r1) - ( 1 ); ( co) = __d > ( r1); (v) = __d; } while (0); - recurse(SUB_CO, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); - do { word __d = ( 0 ) - ( r1); ( co) = __d > ( 0 ); (v) = __d; } while (0); - recurse(SUB_CO, n_values, (0x20 + 0) , s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); - ((v) = ( 0 ) - ( r1), ( co) = ( ci)); - recurse(SUB, n_values, (0x20 + 0) , s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - ((v) = ((unsigned_word) ( r1) >> (( 1 ) & (32 - 1)) ), ( co) = ( ci)); - recurse(LSHIFTR, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - ((v) = ((signed_word) ( r1) >> (( 1 ) & (32 - 1)) ), ( co) = ( ci)); - recurse(ASHIFTR, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - ((v) = ((signed_word) ( r1) << (( 1 ) & (32 - 1)) ), ( co) = ( ci)); - recurse(SHIFTL, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - ((v) = ((unsigned_word) ( r1) >> (( 32 -1 ) & (32 - 1)) ), ( co) = ( ci)); - recurse(LSHIFTR, n_values, s1, (0x20 + 32 -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - ((v) = ((signed_word) ( r1) >> (( 32 -1 ) & (32 - 1)) ), ( co) = ( ci)); - recurse(ASHIFTR, n_values, s1, (0x20 + 32 -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - } - if (ci >= 0 && flag_use_carry - && (allowed_cost <= 1 ? ((prune_hint & CY_JUST_SET) != 0) : 1)) - { - do { word __d = ( 0 ) + ( 0 ) + (( ci)); ( co) = ( ci) ? __d <= ( 0 ) : __d < ( 0 ); (v) = __d; } while (0); - recurse(ADD_CIO, n_values, (0x20 + 0) , (0x20 + 0) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET | CY_0); - do { word __d = ( 0 ) - ( 0 ) - (( ci)); ( co) = ( ci) ? __d >= ( 0 ) : __d > ( 0 ); (v) = __d; } while (0); - recurse(SUB_CIO, n_values, (0x20 + 0) , (0x20 + 0) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - do { word __d = ( 0 ) - ( -1 ) - (( ci)); ( co) = ( ci) ? __d >= ( 0 ) : __d > ( 0 ); (v) = __d; } while (0); - recurse(SUB_CIO, n_values, (0x20 + 0) , (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET | CY_1); - do { word __d = ( 0 ) + ( -1 ) + (( ci)); ( co) = ( ci) ? __d <= ( 0 ) : __d < ( 0 ); (v) = __d; } while (0); - recurse(ADD_CIO, n_values, (0x20 + 0) , (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - - } - - if (allowed_cost > 1) - { - ((v) = ( 0x80000000 ), ( co) = ( ci)); - recurse(COPY, n_values, (0x20 - 2) , 0, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - - ((v) = ( -1 ), ( co) = ( ci)); - recurse(COPY, n_values, (0x20 + -1) , 0, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - - ((v) = ( 1 ), ( co) = ( ci)); - recurse(COPY, n_values, (0x20 + 1) , 0, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/920625-1.x b/gcc/testsuite/gcc.c-torture/compile/920625-1.x deleted file mode 100644 index 08a5f6771c7..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920625-1.x +++ /dev/null @@ -1,25 +0,0 @@ -# The problem on IA-64 is that if-conversion creates a sequence -# -# (p17) cmp.geu p6, p7 = r48, r15 -# (p16) cmp.gtu p6, p7 = r48, r15 -# -# where p16 and p17 are complemenary, but the assembler DV validation -# code doesn't recognize that p6 and p7 are complimentary, and so -# we end up warning for a later use -# -# (p6) addl r14 = 1, r0 -# (p7) mov r14 = r0 -# -# that appears to be a WAW violation. - -set torture_eval_before_compile { - - set compiler_conditional_xfail_data { - "missing .pred.rel.mutex directive" \ - "ia64-*-*" \ - { "-O1" "-O2" "-O3" "-Os" } \ - { "" } - } -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/920625-2.c b/gcc/testsuite/gcc.c-torture/compile/920625-2.c deleted file mode 100644 index 1466285f88e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920625-2.c +++ /dev/null @@ -1,103 +0,0 @@ -typedef char * caddr_t; -typedef unsigned Cursor; -typedef char *String; -typedef struct _WidgetRec *Widget; -typedef char Boolean; -typedef unsigned int Cardinal; -typedef struct _XedwListReturnStruct { - String string; - int xedwList_index; - struct _XedwListReturnStruct *next; -} XedwListReturnStruct; -static XedwListReturnStruct *return_list; -static String srcdir, dstdir; -char *strcpy(); - extern void setCursor(Cursor); - extern void query_dialog(String, Boolean); - extern Boolean directoryManagerNewDirectory(String); -trashQueryResult(Widget w, Boolean delete, caddr_t call_data) -{ - int execute(String, String, String, Boolean); - extern void destroy_button_dialog(void); - extern void changestate(Boolean); - - extern Cursor busy, left_ptr; - extern String cwd; - static void freeReturnStruct(void); - String rmstring; - int status; - XedwListReturnStruct *tmp; - setCursor(busy); - destroy_button_dialog(); - if (delete == 1) { - rmstring = (("rm -fr") != ((void *)0) ? (strcpy((char*)XtMalloc((unsigned)strlen("rm -fr") + 1), "rm -fr")) : ((void *)0)); - tmp = return_list; - while (tmp != ((void *)0)) { - rmstring = (String) XtRealloc (rmstring, sizeof(char) * - (strlen(rmstring) + - strlen(tmp->string) + 5)); - sprintf(rmstring, "%s '%s'", rmstring, tmp->string); - tmp = tmp->next; - } - if ((status = execute(((void *)0), "rm", rmstring, 1)) != 0) { - XBell(XtDisplay(w), 100); - query_dialog("Can't remove file", 0); - } - XtFree(rmstring); - - directoryManagerNewDirectory(cwd); - } else { - changestate(1); - } - setCursor(left_ptr); - freeReturnStruct(); -} - -copyQueryResult(Widget w, Boolean copy, caddr_t call_data) -{ - extern void destroy_button_dialog(); - extern void changestate(Boolean); - extern Cursor busy, left_ptr; - static void freeReturnStruct(void); - int execute(String, String, String, Boolean); - extern String cwd; - String copystring; - int status; - Cardinal srclen, dstlen; - XedwListReturnStruct *tmp; - destroy_button_dialog(); - setCursor(busy); - if (copy == 1) { - srclen = strlen(srcdir); - dstlen = strlen(dstdir); - copystring = (("cp -r") != ((void *)0) ? (strcpy((char*)XtMalloc((unsigned)strlen("cp -r") + 1), "cp -r")) : ((void *)0)); - tmp = return_list; - while (tmp != ((void *)0)) { - copystring = (String) XtRealloc (copystring, sizeof(char) * - (strlen(copystring) + - strlen(tmp->string) + - srclen + 6)); - sprintf(copystring, "%s '%s/%s'", copystring, srcdir, tmp->string); - tmp = tmp->next; - } - copystring = (String) XtRealloc (copystring, sizeof(char) * - (strlen(copystring) + - dstlen + 5)); - sprintf(copystring, "%s '%s'", copystring, dstdir); - if ((status = execute(((void *)0), "cp", copystring, 1)) != 0) { - XBell(XtDisplay(w), 100); - query_dialog("Can't copy file!", 0); - } - XtFree(copystring); - - directoryManagerNewDirectory(cwd); - } else { - changestate(1); - } - XtFree(srcdir); - XtFree(dstdir); - setCursor(left_ptr); - freeReturnStruct(); -} - -freeReturnStruct(){} diff --git a/gcc/testsuite/gcc.c-torture/compile/920626-1.c b/gcc/testsuite/gcc.c-torture/compile/920626-1.c deleted file mode 100644 index 54419866a1f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920626-1.c +++ /dev/null @@ -1 +0,0 @@ -f(x)unsigned x;{return x>>-5;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920701-1.c b/gcc/testsuite/gcc.c-torture/compile/920701-1.c deleted file mode 100644 index 4302f9ea331..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920701-1.c +++ /dev/null @@ -1 +0,0 @@ -f(char*c){extern char a[],b[];return a+(b-c);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920702-1.c b/gcc/testsuite/gcc.c-torture/compile/920702-1.c deleted file mode 100644 index 23a5395b0cd..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920702-1.c +++ /dev/null @@ -1,10 +0,0 @@ -int somevar; -void -yylex () -{ - register int result = 0; - int num_bits = -1; - - if (((result >> -1) & 1)) - somevar = 99; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/920706-1.c b/gcc/testsuite/gcc.c-torture/compile/920706-1.c deleted file mode 100644 index 13b0ff1e0ba..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920706-1.c +++ /dev/null @@ -1 +0,0 @@ -f(){float i[2],o[1];g(o);return*o;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920710-2.c b/gcc/testsuite/gcc.c-torture/compile/920710-2.c deleted file mode 100644 index dcaf1bea3cf..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920710-2.c +++ /dev/null @@ -1,36 +0,0 @@ -union u -{ - struct {unsigned h, l;} i; - double d; -}; - -foo (union u x) -{ - while (x.i.h++) - { - while (x.i.l-- > 0) - ; - while (x.d++ > 0) - ; - } -} - -union n -{ - long long unsigned i; - double d; -}; - -bar (union n x) -{ - int i; - for (i = 0; i < 100; i++) - { - while (--x.i > 0) - ; - while (++x.d > 0) - ; - } - return x.i; -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/920711-1.c b/gcc/testsuite/gcc.c-torture/compile/920711-1.c deleted file mode 100644 index a5aa7df1127..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920711-1.c +++ /dev/null @@ -1 +0,0 @@ -f(a){a=(1,1)/2;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920721-1.c b/gcc/testsuite/gcc.c-torture/compile/920721-1.c deleted file mode 100644 index 7ced611eb6f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920721-1.c +++ /dev/null @@ -1,11 +0,0 @@ -typedef struct{short ttype;float s;}T; -short t[8][8]; - -T f(T t2,T t1) -{ - T x; - if (t1.ttype == 1) - x.ttype = t[t2.ttype][t1.ttype], - x.s = 1; - return x; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/920723-1.c b/gcc/testsuite/gcc.c-torture/compile/920723-1.c deleted file mode 100644 index d8734a6796e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920723-1.c +++ /dev/null @@ -1,31 +0,0 @@ -#if defined(STACK_SIZE) && STACK_SIZE < 65536 -# define GITT_SIZE 75 -#endif - -#ifndef GITT_SIZE -# define GITT_SIZE 150 -#endif - -typedef struct { - double x, y; -} vector_t; -double sqrt(); -f(int count,vector_t*pos,double r,double *rho) -{ - int i, j, miny, maxy, hy; - float help, d; - int gitt[GITT_SIZE][GITT_SIZE]; - int *data = (int *)malloc(count*sizeof(int)); - for (i = 0; i < count; i++) - rho[i] = 0; - for (i = 1; i < count; i++) - for (hy = miny; hy<= maxy; hy++) - while(j >=0) { - d = pos[i].y - pos[j].y; - if ( d <= r) { - d = sqrt(d); - rho[i] += help; - } - } -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/920729-1.c b/gcc/testsuite/gcc.c-torture/compile/920729-1.c deleted file mode 100644 index de00be5af88..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920729-1.c +++ /dev/null @@ -1,2 +0,0 @@ -extern volatile int i; -f(){int j;for(;;)j = i;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920806-1.c b/gcc/testsuite/gcc.c-torture/compile/920806-1.c deleted file mode 100644 index 0928fe8a784..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920806-1.c +++ /dev/null @@ -1 +0,0 @@ -f(){short x=32000;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920808-1.c b/gcc/testsuite/gcc.c-torture/compile/920808-1.c deleted file mode 100644 index 17510a96821..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920808-1.c +++ /dev/null @@ -1 +0,0 @@ -f(i){for(i=1;i<=2;({;}),i++){({;}),g();}} diff --git a/gcc/testsuite/gcc.c-torture/compile/920809-1.c b/gcc/testsuite/gcc.c-torture/compile/920809-1.c deleted file mode 100644 index ad35e121003..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920809-1.c +++ /dev/null @@ -1 +0,0 @@ -f(x,y){memcpy (&x,&y,8192);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920817-1.c b/gcc/testsuite/gcc.c-torture/compile/920817-1.c deleted file mode 100644 index 31a57339ea9..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920817-1.c +++ /dev/null @@ -1 +0,0 @@ -int v;static inline f(){return 0;}g(){return f();}void h(){return v++;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920820-1.c b/gcc/testsuite/gcc.c-torture/compile/920820-1.c deleted file mode 100644 index 2bc0dbea07b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920820-1.c +++ /dev/null @@ -1 +0,0 @@ -long long f(double y){return y;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920821-1.c b/gcc/testsuite/gcc.c-torture/compile/920821-1.c deleted file mode 100644 index 40a8c178f10..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920821-1.c +++ /dev/null @@ -1 +0,0 @@ -/* empty */ diff --git a/gcc/testsuite/gcc.c-torture/compile/920821-2.c b/gcc/testsuite/gcc.c-torture/compile/920821-2.c deleted file mode 100644 index a69c0a901ba..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920821-2.c +++ /dev/null @@ -1,4 +0,0 @@ -typedef struct{int p[25];}t1; -struct{t1 x,y;}y; -t1 x[1]; -f(){y.x=*x;y.y=*x;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920825-1.c b/gcc/testsuite/gcc.c-torture/compile/920825-1.c deleted file mode 100644 index 514d63f977f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920825-1.c +++ /dev/null @@ -1,3 +0,0 @@ -#pragma pack(1) -struct{unsigned short f1:5;unsigned short f2:6;}x; -f(){x.f2=1;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920825-2.c b/gcc/testsuite/gcc.c-torture/compile/920825-2.c deleted file mode 100644 index 9834aac1783..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920825-2.c +++ /dev/null @@ -1,3 +0,0 @@ -f(double*a,int m){int j;for(j=0;j<m;j++)a[j]=1;} -g(double*a){int j;for(j=0;j<4;j++)a[j]=1;} - diff --git a/gcc/testsuite/gcc.c-torture/compile/920826-1.c b/gcc/testsuite/gcc.c-torture/compile/920826-1.c deleted file mode 100644 index d19eff2cec6..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920826-1.c +++ /dev/null @@ -1 +0,0 @@ -f(int*x){goto*(char)*x;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920828-1.c b/gcc/testsuite/gcc.c-torture/compile/920828-1.c deleted file mode 100644 index 4893173423b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920828-1.c +++ /dev/null @@ -1 +0,0 @@ -char a[]={4,5};f(n){return a[n<2?n:0];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920829-1.c b/gcc/testsuite/gcc.c-torture/compile/920829-1.c deleted file mode 100644 index 593400bac92..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920829-1.c +++ /dev/null @@ -1 +0,0 @@ -f(double x){double y;y=x/0.5;if(y<0.1)y=1.0;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920831-1.c b/gcc/testsuite/gcc.c-torture/compile/920831-1.c deleted file mode 100644 index ff2fd6360bf..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920831-1.c +++ /dev/null @@ -1 +0,0 @@ -f(x){goto*(char)x;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920902-1.c b/gcc/testsuite/gcc.c-torture/compile/920902-1.c deleted file mode 100644 index 6f6dcd5bf30..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920902-1.c +++ /dev/null @@ -1,2 +0,0 @@ -void f(int); -void f(x)unsigned char x;{} diff --git a/gcc/testsuite/gcc.c-torture/compile/920909-1.c b/gcc/testsuite/gcc.c-torture/compile/920909-1.c deleted file mode 100644 index 939aaf789e8..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920909-1.c +++ /dev/null @@ -1 +0,0 @@ -long long f(long long a,long long b){return a<<b;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920917-1.c b/gcc/testsuite/gcc.c-torture/compile/920917-1.c deleted file mode 100644 index ebe8200d48b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920917-1.c +++ /dev/null @@ -1,2 +0,0 @@ -inline f(x){switch(x){case 6:case 4:case 3:case 1:;}return x;} -g(){f(sizeof("xxxxxx"));} diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-1.c b/gcc/testsuite/gcc.c-torture/compile/920928-1.c deleted file mode 100644 index 137363dc120..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920928-1.c +++ /dev/null @@ -1,2 +0,0 @@ -struct{int c;}v; -static long i=((char*)&(v.c)-(char*)&v); diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-2.c b/gcc/testsuite/gcc.c-torture/compile/920928-2.c deleted file mode 100644 index a0964f90f44..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920928-2.c +++ /dev/null @@ -1,19 +0,0 @@ -typedef struct{struct{char*d;int b;}*i;}*t; -double f(); -g(p)t p; -{ - short x,y,delta,s,w,h,fx,fy,tx,ty; - int q1,q2,q3,q4; - h=f((ty-fy)/2.0+0.5); - s=(((int)((short)(tx-fx))<(int)((short)(ty-fy)))?((short)(tx-fx)):((short)(ty-fy)))%2; - delta=(((int)(w)<(int)(h))?(w):(h))-s; - for(x=0;x<=delta;x++) - for(y=1-s;y<=delta;y++){ - q1=((int)((*(p->i->d+(fx+w+x)/8+(fy+h+y)*p->i->b)&(1<<((fx+w+x)%8)))?1:0)); - q2=((int)((*(p->i->d+(fx+w+y)/8+(fy+h-s-x)*p->i->b)&(1<<((fx+w+y)%8)))?1:0)); - q3=((int)((*(p->i->d+(fx+w-s-x)/8+(fy+h-s-y)*p->i->b)&(1<<((fx+w-s-x)%8)))?1:0)); - q4=((int)((*(p->i->d+(fx+w-s-y)/8+(fy+h+x)*p->i->b)&(1<<((fx+w-s-y)%8)))?1:0)); - if(q4!=q1) - ff(p,fx+w-s-y,fy+h+x); - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-3.c b/gcc/testsuite/gcc.c-torture/compile/920928-3.c deleted file mode 100644 index 583dc69b74c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920928-3.c +++ /dev/null @@ -1,19 +0,0 @@ -f (int phaseone) -{ - typedef struct - { - unsigned char *p; - } - FILE; - FILE b[2]; - static unsigned char xchr[2]; - int j; - int for_end; - if (phaseone) - { - if (j <= for_end) - do - *(b[1].p) = xchr[j]; - while (j++ < 10); - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-4.c b/gcc/testsuite/gcc.c-torture/compile/920928-4.c deleted file mode 100644 index 348de654f30..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920928-4.c +++ /dev/null @@ -1,113 +0,0 @@ -typedef unsigned char unsigned8; -typedef unsigned short int unsigned16; -typedef unsigned long int unsigned32; -typedef char signed8; -typedef short int signed16; -typedef long int signed32; -typedef unsigned32 boolean32; -typedef unsigned long int error_status_t; -typedef struct { - unsigned32 time_low; - unsigned16 time_mid; - unsigned16 time_hi_and_version; - unsigned8 clock_seq_hi_and_reserved; - unsigned8 clock_seq_low; - unsigned char node[6]; -} uuid_t; - -typedef unsigned32 bitset; -typedef signed32 sec_timeval_sec_t; -typedef struct { - signed32 sec; - signed32 usec; -} sec_timeval_t; -typedef signed32 sec_timeval_period_t; -typedef signed32 sec_rgy_acct_key_t; - -typedef struct { - uuid_t source; - signed32 handle; - boolean32 valid; -} sec_rgy_cursor_t; -typedef unsigned char sec_rgy_pname_t[257]; -typedef unsigned char sec_rgy_name_t[1025]; - -typedef signed32 sec_rgy_override_t; -typedef signed32 sec_rgy_mode_resolve_t; -typedef unsigned char sec_rgy_unix_gecos_t[292]; -typedef unsigned char sec_rgy_unix_login_name_t[1025]; -typedef unsigned char sec_rgy_member_t[1025]; -typedef unsigned char sec_rgy_unix_passwd_buf_t[16]; -typedef struct sec_rgy_sid_t { - uuid_t person; - uuid_t group; - uuid_t org; -} sec_rgy_sid_t; -typedef struct { - signed32 person; - signed32 group; - signed32 org; -} sec_rgy_unix_sid_t; -typedef struct { - sec_rgy_unix_login_name_t name; - sec_rgy_unix_passwd_buf_t passwd; - signed32 uid; - signed32 gid; - signed32 oid; - sec_rgy_unix_gecos_t gecos; - sec_rgy_pname_t homedir; - sec_rgy_pname_t shell; -} sec_rgy_unix_passwd_t; -typedef unsigned char sec_rgy_member_buf_t[10250]; -typedef struct { - sec_rgy_name_t name; - signed32 gid; - sec_rgy_member_buf_t members; -} sec_rgy_unix_group_t; - -typedef struct { - uuid_t site_id; - sec_timeval_sec_t person_dtm; - sec_timeval_sec_t group_dtm; - sec_timeval_sec_t org_dtm; -} rs_cache_data_t; - -typedef enum { - rs_unix_query_name, - rs_unix_query_unix_num, - rs_unix_query_none -} rs_unix_query_t; - -typedef struct { - rs_unix_query_t query; - union { - struct { - long int name_len; - sec_rgy_name_t name; - } name; - long int unix_num; - } tagged_union; -} rs_unix_query_key_t; - -static unsigned long int IDL_offset_vec[] = -{ - 0, - sizeof(sec_rgy_unix_group_t), - (unsigned long int) ((unsigned char *) &((sec_rgy_unix_group_t *) 0)->name - (unsigned char *) 0), - (unsigned long int) ((unsigned char *) &((sec_rgy_unix_group_t *) 0)->gid - (unsigned char *) 0), - (unsigned long int) ((unsigned char *) &((sec_rgy_unix_group_t *) 0)->members - (unsigned char *) 0), - sizeof(rs_cache_data_t), - (unsigned long int) ((unsigned char *) &((rs_cache_data_t *) 0)->site_id.time_low - (unsigned char *) 0), - (unsigned long int) ((unsigned char *) &((rs_cache_data_t *) 0)->site_id.time_mid - (unsigned char *) 0), - (unsigned long int) ((unsigned char *) &((rs_cache_data_t *) 0)->site_id.time_hi_and_version - (unsigned char *) 0), - sizeof(sec_rgy_unix_passwd_t), - (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->source.clock_seq_hi_and_reserved - (unsigned char *) 0), - (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->source.clock_seq_low - (unsigned char *) 0), - (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->source.node - (unsigned char *) 0), - (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->handle - (unsigned char *) 0), - (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->valid - (unsigned char *) 0), - sizeof(struct {long int name_len; sec_rgy_name_t name;}), - (unsigned long int) ((unsigned char *) &((struct {long int name_len; sec_rgy_name_t name;} *)0)->name_len - - (unsigned char *) 0), - (unsigned long int) ((unsigned char *) &((struct {long int name_len; sec_rgy_name_t name;} *)0)->name - (unsigned char *) 0), -}; diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-5.c b/gcc/testsuite/gcc.c-torture/compile/920928-5.c deleted file mode 100644 index 8c975f0c051..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920928-5.c +++ /dev/null @@ -1,7 +0,0 @@ -/* REPRODUCED:CC1:SIGNAL MACHINE:m68k OPTIONS:-fpcc-struct-return */ -struct b{}; -f(struct b(*f)()) -{ -struct b d=f(); -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-6.c b/gcc/testsuite/gcc.c-torture/compile/920928-6.c deleted file mode 100644 index 692191b1245..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/920928-6.c +++ /dev/null @@ -1,2 +0,0 @@ -struct{int c;}v; -static short i=((char*)&(v.c)-(char*)&v); diff --git a/gcc/testsuite/gcc.c-torture/compile/921004-1.c b/gcc/testsuite/gcc.c-torture/compile/921004-1.c deleted file mode 100644 index a947229089f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921004-1.c +++ /dev/null @@ -1,6 +0,0 @@ -/* REPRODUCED:CC1:SIGNAL MACHINE:i386 OPTIONS: */ -long long f() -{ -long long*g,*s; -return*g+*s; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921011-1.c b/gcc/testsuite/gcc.c-torture/compile/921011-1.c deleted file mode 100644 index 6cc707dc74c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921011-1.c +++ /dev/null @@ -1,27 +0,0 @@ -void -fun (nb) - int nb; -{ - int th, h, em, nlwm, nlwS, nlw, sy; - - while (nb--) - while (h--) - { - nlw = nlwm; - while (nlw) - { - if (nlwS == 1) - { - } - else - if (nlwS == 1) - { - } - nlwS--; nlw--; - } - if (em) - nlwS--; - if (++sy == th) - sy = 0; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921011-2.c b/gcc/testsuite/gcc.c-torture/compile/921011-2.c deleted file mode 100644 index bf11dad979f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921011-2.c +++ /dev/null @@ -1,65 +0,0 @@ -extern int foobar1 (); - -typedef struct - { - unsigned long colormap; - unsigned long red_max; - unsigned long red_mult; - unsigned long green_max; - unsigned long green_mult; - unsigned long blue_max; - unsigned long blue_mult; - unsigned long base_pixel; - unsigned long visualid; - unsigned long killid; - } -frotz; - -int -foobar (stdcmap, count) - frotz **stdcmap; - int *count; -{ - register int i; - frotz *data = ((void *) 0); - - unsigned long nitems; - int ncmaps; - int old_style = 0; - unsigned long def_visual = 0L; - frotz *cmaps; - - - if ( foobar1 (&data) != 0) - return 0; - if (nitems < 10) - { - ncmaps = 1; - if (nitems < 9) - { - } - } - else - ncmaps = (nitems / 10); - - { - register frotz *map; - register frotz *prop; - - for (i = ncmaps, map = cmaps, prop = data; i > 0; i--, map++, prop++) - { - map->colormap = prop->colormap; - map->red_max = prop->red_max; - map->red_mult = prop->red_mult; - map->green_max = prop->green_max; - map->green_mult = prop->green_mult; - map->blue_max = prop->blue_max; - map->blue_mult = prop->blue_mult; - map->base_pixel = prop->base_pixel; - map->visualid = (def_visual ? def_visual : prop->visualid); - map->killid = (old_style ? 0L : prop->killid); - } - } - *stdcmap = cmaps; - *count = ncmaps; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921012-1.c b/gcc/testsuite/gcc.c-torture/compile/921012-1.c deleted file mode 100644 index 7b5cb6b9f17..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921012-1.c +++ /dev/null @@ -1,4 +0,0 @@ -f() -{ -g(({int x;0;})); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921012-2.c b/gcc/testsuite/gcc.c-torture/compile/921012-2.c deleted file mode 100644 index 6f4de779549..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921012-2.c +++ /dev/null @@ -1,7 +0,0 @@ -struct foo { -int a,b,c; -}; -f(struct foo*a,struct foo*b) -{ -*a=*b; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921013-1.c b/gcc/testsuite/gcc.c-torture/compile/921013-1.c deleted file mode 100644 index 0d14cbc6bb6..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921013-1.c +++ /dev/null @@ -1,4 +0,0 @@ -f(int x,short y) -{ -long z=y<0?x>0?x:0:y; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921019-1.c b/gcc/testsuite/gcc.c-torture/compile/921019-1.c deleted file mode 100644 index 227bdc276fa..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921019-1.c +++ /dev/null @@ -1,9 +0,0 @@ -struct -{ -int n:1,c:1; -}p; - -f() -{ -p.c=p.n=0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921021-1.c b/gcc/testsuite/gcc.c-torture/compile/921021-1.c deleted file mode 100644 index 18dffeb9dd3..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921021-1.c +++ /dev/null @@ -1,12 +0,0 @@ -void g(); - -f() -{ -int x=1; -while(x) -{ -x=h(); -if(x) -g(); -} -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921024-1.c b/gcc/testsuite/gcc.c-torture/compile/921024-1.c deleted file mode 100644 index e723246d6b2..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921024-1.c +++ /dev/null @@ -1,9 +0,0 @@ -long long f(s,r) -{ - return *(long long*)(s+r); -} - -g(s,r) -{ - *(long long*)(s+r)=0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921026-1.c b/gcc/testsuite/gcc.c-torture/compile/921026-1.c deleted file mode 100644 index 18238de8332..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921026-1.c +++ /dev/null @@ -1,4 +0,0 @@ -f(unsigned short*a) -{ -a[0]=65535; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921103-1.c b/gcc/testsuite/gcc.c-torture/compile/921103-1.c deleted file mode 100644 index 578e91aaf83..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921103-1.c +++ /dev/null @@ -1,12 +0,0 @@ -struct { - unsigned int f1, f2; -} s; - -f() -{ - unsigned x, y; - x = y = 0; - while (y % 4) - y++; - g(&s.f2, s.f1 + x, 4); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921109-1.c b/gcc/testsuite/gcc.c-torture/compile/921109-1.c deleted file mode 100644 index eda43451f25..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921109-1.c +++ /dev/null @@ -1,28 +0,0 @@ -typedef struct { double x, y; } p; -typedef struct { int s; float r; } t; -t *e, i; -int i1; - -f(t *op) -{ -int i2 = e->r; -p pt; -int c = g(); -t p; - -if (c) -{ -i = *e; -e -= 3; -return 8; -} -if (op > e) -return 1; -op->r = pt.x; -op->r = pt.y; -p = *e; -++e; -e->r = i1, e->s = i1; -*++e = p; -return 3; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921111-1.c b/gcc/testsuite/gcc.c-torture/compile/921111-1.c deleted file mode 100644 index 11b467460b3..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921111-1.c +++ /dev/null @@ -1,40 +0,0 @@ -int ps; -struct vp { - int wa; -}; -typedef struct vp *vpt; -typedef struct vc { - int o; - vpt py[8]; -} *vct; -struct n { - int a; -}; -struct nh { - int x; -}; -typedef struct np *npt; -struct np { - vct d; - int di; -}; -struct nh xhp; -struct n np[3]; - -f(dp) - npt dp; -{ - vpt *py; - int a, l, o = 0; - a = dp->d->o; - if (dp->di < 0) - l = ps; - - if ((int)o & 3) - g(); - - xhp.x = a; - py = &dp->d->py[dp->di]; - if (o + l > ps) - np[2].a = (int)(py[1])->wa; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921116-2.c b/gcc/testsuite/gcc.c-torture/compile/921116-2.c deleted file mode 100644 index 9eac91cb5c2..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921116-2.c +++ /dev/null @@ -1,9 +0,0 @@ -typedef struct { - long l[5]; -} t; - -f(size) -{ - t event; - g(&(event.l[2 + size]), (3 - size) * 4); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921118-1.c b/gcc/testsuite/gcc.c-torture/compile/921118-1.c deleted file mode 100644 index 857c74e74f1..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921118-1.c +++ /dev/null @@ -1,8 +0,0 @@ -inline f(i) -{ - h((long long) i * 2); -} -g() -{ - f(9); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921126-1.c b/gcc/testsuite/gcc.c-torture/compile/921126-1.c deleted file mode 100644 index a7b908b2ef0..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921126-1.c +++ /dev/null @@ -1,11 +0,0 @@ -f() -{ - long long a0, a1, a0s, val; - int width; - float d; - if (d) - ; - if (a0s & (1LL << width)) - ; - return a0 / a1; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921202-1.c b/gcc/testsuite/gcc.c-torture/compile/921202-1.c deleted file mode 100644 index 1287edc57b8..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921202-1.c +++ /dev/null @@ -1,22 +0,0 @@ -f () -{ - long dx[2055]; - long dy[2055]; - long s1[2055]; - int x, y; - int i; - long s; - - for (;;) - { - s = 2055; - g (s1, s); - for (i = 0; i < 1; i++); - dy[s] = 0x12345; - for (i = 0; i < 1; i++); - if (x != y || h (dx, dy, s) || dx[s] != 0x12345) - { - j (y);k (dy); - } - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921202-2.c b/gcc/testsuite/gcc.c-torture/compile/921202-2.c deleted file mode 100644 index 97d482b633c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921202-2.c +++ /dev/null @@ -1,8 +0,0 @@ -f(x, c) -{ - for (;;) - { - if (x << c) break; - x++; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921203-1.c b/gcc/testsuite/gcc.c-torture/compile/921203-1.c deleted file mode 100644 index 50fe3eb0b6f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921203-1.c +++ /dev/null @@ -1,5 +0,0 @@ -char dispstr[]; -f() -{ - strcpy(dispstr,"xxxxxxxxxxx"); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921203-2.c b/gcc/testsuite/gcc.c-torture/compile/921203-2.c deleted file mode 100644 index 929afb1bdde..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921203-2.c +++ /dev/null @@ -1,13 +0,0 @@ -typedef struct -{ - char x; -} s1; - -s1 f (int arg0,...) -{ - int args; - s1 back; - va_start (args, arg0); - va_end (args); - return back; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921206-1.c b/gcc/testsuite/gcc.c-torture/compile/921206-1.c deleted file mode 100644 index 10fa5ea6479..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921206-1.c +++ /dev/null @@ -1,28 +0,0 @@ -double sqrt(double),fabs(double),sin(double); -int sxs; -int sys; -f() -{ - int l; - int sm = -52, sx = 52; - char *smap; - for (l = 0; l < 9; l++) - { - double g; - int cx, cy, gx, gy, x, y; - gx = 2 > g / 3 ? 2 : g / 3; - gy = 2 > g / 3 ? 2 : g / 3; - for (y = 0 > cy - gy ? 0 : cy - gy; y <= (sys - 1 < cy + gy ? sys : cy + gy); y++) - { - int sx = 0 > cx - gx ? 0 : cx - gx; - short *ax = (short *) (y * sxs + sx); - - for (x = sx; x <= (sxs - 1 < cx + gx ? sxs - 1 : cx + gx); x++) - { - double c=2.25, z=sqrt(fabs(1-c)), cz=(c>1?0.0:-10)>z?c>1?0:1:z; - } - } - } - for (l = sm; l <= sx; l++) - smap[l] = l > 0 ? 1 + foo(sin(.1 * l / sx)) : 1 - foo(sin(.1 * l / sm)); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/921227-1.c b/gcc/testsuite/gcc.c-torture/compile/921227-1.c deleted file mode 100644 index a49750c81af..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/921227-1.c +++ /dev/null @@ -1,5 +0,0 @@ -#define k(a) #a -char *s = k(k(1,2)); -char *t = k(#) k(#undef k) k(x); - -f(){} diff --git a/gcc/testsuite/gcc.c-torture/compile/930109-1.c b/gcc/testsuite/gcc.c-torture/compile/930109-1.c deleted file mode 100644 index dbd15a1bd0a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930109-1.c +++ /dev/null @@ -1,12 +0,0 @@ -f(x) - unsigned x; -{ - static short c; - return x>>c; -} -g(x) - unsigned x; -{ - static char c; - return x>>c; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930109-2.c b/gcc/testsuite/gcc.c-torture/compile/930109-2.c deleted file mode 100644 index 61e3a4df99f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930109-2.c +++ /dev/null @@ -1,11 +0,0 @@ -f(r) -{ - int i; - for (i = 0; i < 2; i++) - { - r+= (4 >> i*2); - r+= (2 >> i*2); - r+= (1 >> i*2); - } - return r; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930111-1.c b/gcc/testsuite/gcc.c-torture/compile/930111-1.c deleted file mode 100644 index 28574191d13..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930111-1.c +++ /dev/null @@ -1,10 +0,0 @@ -/* 2.3.3 crashes on 386 with -traditional */ -f(a) - char *a; -{ - int d = strcmp(a,"-"); - - while (vfork() < 0) - ; - return d; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930117-1.c b/gcc/testsuite/gcc.c-torture/compile/930117-1.c deleted file mode 100644 index 83317cdd07b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930117-1.c +++ /dev/null @@ -1,4 +0,0 @@ -f(x) -{ - (*(void (*)())&x)(); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930118-1.c b/gcc/testsuite/gcc.c-torture/compile/930118-1.c deleted file mode 100644 index b29543c529e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930118-1.c +++ /dev/null @@ -1,6 +0,0 @@ -f() -{ -__label__ l; -l:p(); -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/930120-1.c b/gcc/testsuite/gcc.c-torture/compile/930120-1.c deleted file mode 100644 index 95ac43c07ed..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930120-1.c +++ /dev/null @@ -1,138 +0,0 @@ -union { - short I[2]; - long int L; - char C[4]; -} itolws; -char *errflg; -long int dot; -short dotinc; -long int expvf; - -char * -f(fcount,ifp,itype,ptype) - short fcount; - char *ifp; -{ - unsigned w; - long int savdot, wx; - char *fp; - char c, modifier, longpr; - union { - double dval; - struct { - int i1; - int i2; - } ival; - } dw; - union { - float fval; - int ival; - } fw; - int gotdot = 0; - while (fcount > 0) { - fp = ifp; - c = *fp; - longpr = ((c >= 'A') & (c <= 'Z') | (c == 'f') | (c == '4') | (c == 'p') | (c == 'i')); - if ((itype == 0) || (*fp == 'a')) { - wx = dot; - w = dot; - } else { - gotdot = 1; - wx = get((int)dot, itype); - if (!longpr) { - w = (itolws.L=(wx), itolws.I[((dot)&3)>>1]); - } - } - if (c == 'F') { - dw.ival.i1 = wx; - if (itype == 0) { - dw.ival.i2 = expvf; - } - } - - modifier = *fp++; - switch(modifier) { - case ' ' : - case '\t' : - break; - case 't': - case 'T': - printf("%T",fcount); - return(fp); - case 'r': - case 'R': - printf("%M",fcount); - return(fp); - case 'k': - printf("%k",w); - break; - case 'K': - printf("%K",wx); - break; - case 'a': - psymoff(dot,ptype,":%16t"); - dotinc = 0; - break; - case 'p': - psymoff(0,ptype,"%16t"); - break; - case 'u': - printf("%-8u",w); - break; - case 'U': - printf("%-16U",wx); break; - case 'c': - case 'C': - if (modifier == 'C') { - printesc((int)(itolws.L=(wx), itolws.C[(dot)&3])); - } else { - printc((char)(itolws.L=(wx), itolws.C[(dot)&3])); - } - dotinc = 1; - break; - case 'b': - printf("%-8x", (itolws.L=(wx), itolws.C[(dot)&3])); - dotinc = 1; - break; - case 'B': - printf("%-8o", (itolws.L=(wx), itolws.C[(dot)&3])); - dotinc = 1; - break; - case 's': - case 'S': - savdot = dot; - dotinc = 1; - while ((c = (itolws.L=(wx), itolws.C[(dot)&3])) && (errflg == 0)) { - dot = inkdot(1); - if (modifier == 'S') { - printesc(c); - } else { - printc(c); - } - endline(); - if (!(dot & 3)) - wx = get((int)dot, itype); - } - dotinc = dot - savdot + 1; - dot = savdot; - break; - case 'i': - if (gotdot) { - wx = get((int)(dot & ~3), itype); - } - iDasm((int)(wx), (unsigned int)0, (unsigned int)(dot&~3)); - printc('\n'); - break; - case 'f': - fw.ival = wx; - printf("%-16.9f", fw.fval); - dotinc = 4; - break; - case 'F': - printf("%-32.18F", dw.dval); - dotinc = 8; - break; - } - } - return(fp); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930126-1.c b/gcc/testsuite/gcc.c-torture/compile/930126-1.c deleted file mode 100644 index 8313c5c450b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930126-1.c +++ /dev/null @@ -1,74 +0,0 @@ -typedef unsigned T; -typedef char Tchar; -T mt (long, char *); -T ms (long, char *); -T mv (long, T, char); -T cons (T, T); -T decl (T * (*) (T *), char *); - -T*L92(T*),*L15(T*),*L14(T*),*L13(T*),*L12(T*),*L11(T*),*L10(T*),*L9(T*),*L8(T*),*L7(T*),*L6(T*),*L5(T*),*L4(T*),*L3(T*),*L2(T*),*L1(T*); - -static T * -Ldata (T * my_pc) -{ -int cc = (((* ((T *) (my_pc))) >> 16) & 0xFF); -T B92, B91, B90, B15, B14, B13, B12, B11, B10, B9, B8, B7, B6, B5, B4, B3, B2, B1, tO7, tO6, tO5, tO4, tO3, tO2, tO1, tO0; -T object = mv (168, 0, ((Tchar) 1)); -T * cb = (T *) (((T) (object & 0x3FF)) | 0x400); -tO0 = mv (92, 0, ((Tchar) 1)); -B92 = decl (L92, ""); -B15 = decl (L15, ""); -B14 = decl (L14, ""); -B13 = decl (L13, ""); -B12 = decl (L12, ""); -B11 = decl (L11, ""); -B10 = decl (L10, ""); -B9 = decl (L9, ""); -B8 = decl (L8, ""); -B7 = decl (L7, ""); -B6 = decl (L6, ""); -B5 = decl (L5, ""); -B4 = decl (L4, ""); -B3 = decl (L3, ""); -B2 = decl (L2, ""); -B1 = decl (L1, ""); -cb[19] = ((((cc) & 0xFF) << 16) | (9 & 0xFF)); -cb[21] = ((((cc) & 0xFF) << 16) | ((10) & 0xFF)); -cb[23] = ((((cc) & 0xFF) << 16) | (11 & 0xFF)); -cb[25] = ((((cc) & 0xFF) << 16) | (12 & 0xFF)); -cb[27] = ((((cc) & 0xFF) << 16) | (13 & 0xFF)); -cb[29] = ((((cc) & 0xFF) << 16) | (14 & 0xFF)); -cb[31] = ((((cc) & 0xFF) << 16) | (15 & 0xFF)); -cb[35] = ((((cc) & 0xFF) << 16) | (17 & 0xFF)); -cb[36] = ((0x1A) << 26) | (((0x39) << 26) | 1) & 0x3FF; -cb[39] = ms (24, ((char *) "")); -cb[41] = ((0x1A) << 26) | (((0x39) << 26) | 1) & 0x3FF; -cb[44] = 3; -cb[46] = 2; -cb[48] = 3; -cb[50] = 6; -cb[52] = 4; -cb[146] = tO0; -((T *) (((tO0 & 0x3FF)) | 0x400))[92] = B1; -((T *) (((tO0 & 0x3FF)) | 0x400))[91] = B2; -((T *) (((tO0 & 0x3FF)) | 0x400))[2] = B90; -((T *) (((tO0 & 0x3FF)) | 0x400))[2] = B91; -((T *) (((tO0 & 0x3FF)) | 0x400))[1] = B92; -cb[58] = 0x2800 | (T) ((T *) ((B6 & 0x3FF) | 0x400) + 3); -cb[57] = 0x2800 | (T) ((T *) ((B7 & 0x3FF) | 0x400) + 3) & ~0xC00; -cb[56] = 0x2800 | (T) ((T *) ((B8 & 0x3FF) | 0x400) + 3) & ~0xC00; -cb[55] = 0x2800 | (T) ((T *) ((B9 & 0x3FF) | 0x400) + 3) & ~0xC00; -tO7 = mv (8, 0, ((Tchar) 1)); -tO4 = ms (9, ((char *) "")); -tO3 = mv (58, 0, ((Tchar) 1)); -tO6 = ms (4, ((char *) "")); -tO2 = mv (4, 0, ((Tchar) 1)); -tO5 = ms (4, ((char *) "")); -tO1 = mv (28, 0, ((Tchar) 1)); -cb[165] = tO1; -cb[163] = cons (((ms (10, ((char *) "")))), (cons (tO5, 0))); -cb[162] = cons (1, (cons (2, 0))); -cb[150] = cons (1, (cons (2, (cons (3, (cons (4, (cons (5, (cons (6, 0))))))))))); -cb[148] = tO7; -return cb; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930210-1.c b/gcc/testsuite/gcc.c-torture/compile/930210-1.c deleted file mode 100644 index 47d2da2aca5..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930210-1.c +++ /dev/null @@ -1,11 +0,0 @@ -f() -{ - char c1, c2; - char *p1, *p2; - - do { - c1 = c2 = *p1++; - while (c1--) - *p2++ = *p1++; - } while (c2); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930217-1.c b/gcc/testsuite/gcc.c-torture/compile/930217-1.c deleted file mode 100644 index 70f4a4897c4..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930217-1.c +++ /dev/null @@ -1,14 +0,0 @@ -double g (); -typedef union { - struct { - unsigned s:1, e:8, f:23; - } u; - float f; -} s; - -f(x, n) - float x; -{ - ((s *)&x)->u.e -= n; - x = g((double)x, -n); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930222-1.c b/gcc/testsuite/gcc.c-torture/compile/930222-1.c deleted file mode 100644 index c6d6aa3b47d..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930222-1.c +++ /dev/null @@ -1,16 +0,0 @@ -typedef struct - { - long i; - double f; - } T; - -f (T *n1, T *n2) -{ - if (g (n2)) - return n1->i - n2->i; - else - { - double f = n1->f - n2->i; - return f == 0.0 ? 0 : (f > 0.0 ? 1 : -1); - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930325-1.c b/gcc/testsuite/gcc.c-torture/compile/930325-1.c deleted file mode 100644 index 24cea5027ab..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930325-1.c +++ /dev/null @@ -1,23 +0,0 @@ -typedef unsigned uint; - -inline -g (uint *s, uint *d, uint c) -{ - while (c != 0) - { - *--d = *--s; - c--; - } -} - -f (uint *p1, uint c, uint *p2) -{ - while (c > 0 && *p1 == 0) - { - p1++; - c--; - } - if (c == 0) - return 1; - g (p2, p1, c); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930326-1.c b/gcc/testsuite/gcc.c-torture/compile/930326-1.c deleted file mode 100644 index 97313d86aa9..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930326-1.c +++ /dev/null @@ -1,6 +0,0 @@ -struct -{ - char a, b, f[3]; -} s; - -long i = s.f-&s.b; diff --git a/gcc/testsuite/gcc.c-torture/compile/930411-1.c b/gcc/testsuite/gcc.c-torture/compile/930411-1.c deleted file mode 100644 index bb03c13fa07..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930411-1.c +++ /dev/null @@ -1,36 +0,0 @@ -int heap; - -g(){} - -f(int i1, int i2) -{ - i1 = *(int*)(i1 + 4); - if (i1 == 0) - goto L4; - else - goto L9; - L3: - i2 = heap - 8; - *(int*)i2 = 3; - *(int*)(i2 + 4) = i1; - heap -= 8; - return i2; - L4: - i1 = g(i2); - goto L5; - L5: - i1 = *(int*)(i1 + 4); - if (i1 == 0) - goto L7; - else - goto L8; - L7: - i1 = 0; - goto L3; - L8: - i1 = 1; - goto L3; - L9: - i1 = 1; - goto L3; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930421-1.c b/gcc/testsuite/gcc.c-torture/compile/930421-1.c deleted file mode 100644 index 01b465f7fec..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930421-1.c +++ /dev/null @@ -1,19 +0,0 @@ -double q(double); - -f (int **x, int *r, int *s, int a, int b, int c, int d) -{ - int i, j, k, m, e, f, g, z[1024], y[2]; - - e = g = 0; - for (i = 0; i < a; i++) - for (j = 0; j < b; j++) - if (x[i][j]) - for (k = 0; k < c; k++) - { - f = q(1.5) + q(2.5); - if (g < y[f]) - g = e; - } - for (m = 0; m < 1; m++) - z[0] = m*2*d/3.0 - d; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930427-2.c b/gcc/testsuite/gcc.c-torture/compile/930427-2.c deleted file mode 100644 index 53b633785ae..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930427-2.c +++ /dev/null @@ -1,9 +0,0 @@ -struct s { - int f; -}; - -f (w, v0, v1, v2, v3) - struct s *w; -{ - g (v0 ? 1 : w->f, v1 ? v3 : v2); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930503-1.c b/gcc/testsuite/gcc.c-torture/compile/930503-1.c deleted file mode 100644 index 6889e8b7aed..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930503-1.c +++ /dev/null @@ -1,8 +0,0 @@ -f (const char *s, char *d, unsigned l) -{ - if (0) - while (1); - else - while (--l >= 0) - *d++ = *s++; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930503-2.c b/gcc/testsuite/gcc.c-torture/compile/930503-2.c deleted file mode 100644 index 1b0ea34f038..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930503-2.c +++ /dev/null @@ -1,5 +0,0 @@ -f() -{ - struct { char x; } r; - g(r); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930506-1.c b/gcc/testsuite/gcc.c-torture/compile/930506-1.c deleted file mode 100644 index 8c26ea3670c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930506-1.c +++ /dev/null @@ -1,12 +0,0 @@ -long long -f (a) - double a; -{ - double b; - unsigned long long v; - - b = a / 2.0; - v = (unsigned) b; - a -= (double) v; - return v; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930506-2.c b/gcc/testsuite/gcc.c-torture/compile/930506-2.c deleted file mode 100644 index e11e62f026f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930506-2.c +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef NO_TRAMPOLINES -int f1() -{ - { int ___() { foo(1); } bar(___); } - return( { int ___() { foo(2); } bar(___);} ); -} - -int f2(int j) -{ - { int ___() { foo(j); } bar(___); } - return( { int ___() { foo(j); } bar(___);} ); -} -#else -int x; -#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/930510-1.c b/gcc/testsuite/gcc.c-torture/compile/930510-1.c deleted file mode 100644 index 8c46282626c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930510-1.c +++ /dev/null @@ -1,18 +0,0 @@ -typedef long time_t; -static __const int mon_lengths[2][12] = { - 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, - 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 -}; -static time_t -f (janfirst, year, rulep, offset) - __const time_t janfirst; - __const int year; - register __const struct rule * __const rulep; - __const long offset; -{ - register int leapyear; - register time_t value; - register int i; - - value += mon_lengths[leapyear][i] * ((long) (60 * 60) * 24); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930513-1.c b/gcc/testsuite/gcc.c-torture/compile/930513-1.c deleted file mode 100644 index 2e106ae43a9..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930513-1.c +++ /dev/null @@ -1,9 +0,0 @@ -struct s { - int f1 : 26; - int f2 : 8; -}; - -f (struct s *x) -{ - return x->f2++ == 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930513-2.c b/gcc/testsuite/gcc.c-torture/compile/930513-2.c deleted file mode 100644 index a7f508c8266..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930513-2.c +++ /dev/null @@ -1,9 +0,0 @@ -double g (); - -f (x) - double x; -{ - x = .85; - while (g () < x) - ; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930513-3.c b/gcc/testsuite/gcc.c-torture/compile/930513-3.c deleted file mode 100644 index f8d4e60341c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930513-3.c +++ /dev/null @@ -1,9 +0,0 @@ -test () -{ - short *p, q[3]; - int x; - - p = q; - for (x = 0; x < 3; x++) - *p++ = 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930523-1.c b/gcc/testsuite/gcc.c-torture/compile/930523-1.c deleted file mode 100644 index 5f2b5b5d7e3..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930523-1.c +++ /dev/null @@ -1,54 +0,0 @@ -int v; - -f () -{ - unsigned long *a1, *a2; - int vertex2; - int c, x1, x2, dx1, dx2, dy1, dy2, e1, e2, s2; - unsigned long m, b; - int n; - unsigned long r; - int aba; - - do - { - if (dx2 >= dy2) - dx2 = dx2 % dy2; - - if (dx2 >= dy2) - { - s2 = - (dx2 / dy2); - dx2 = dx2 % dy2; - } - } - while (vertex2 / 65536); - - for (;;) - { - c = x2; - a2 = a1; - if (v) - a2 = 0; - - if (c + n) - { - m = b << (c * 8); - *a2 = (*a2 & ~m) | (r & m); - n += c; - - while (--n) - { - { - } - } - } - - a1 = 0; - x1 += 0; - if (e1 += dx1) - e1 -= dy1; - x2 += s2; - if (e2 += dx2) - e2 -= dy2; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930525-1.c b/gcc/testsuite/gcc.c-torture/compile/930525-1.c deleted file mode 100644 index 00c2e263b82..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930525-1.c +++ /dev/null @@ -1,7 +0,0 @@ -typedef struct foo foo_t; -foo_t x; -struct foo { - int i; -}; - -foo_t x = { 10 }; diff --git a/gcc/testsuite/gcc.c-torture/compile/930527-1.c b/gcc/testsuite/gcc.c-torture/compile/930527-1.c deleted file mode 100644 index 53e00e65ed1..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930527-1.c +++ /dev/null @@ -1,16 +0,0 @@ -enum {e0, e1}; - -int x[] = -{ - [e0] = 0 -}; - -f () -{ - switch (1) - { - case e0: - case e1: - break; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930529-1.c b/gcc/testsuite/gcc.c-torture/compile/930529-1.c deleted file mode 100644 index 70b2cb8f90c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930529-1.c +++ /dev/null @@ -1,83 +0,0 @@ -struct r -{ - int d1, d2; -}; - -struct km -{ - int d; -}; - -struct f1 -{ - char *fn; - char *fd; - char *fs; - char *ic; - void (*ff) (); -}; - -int g (); - -int y; -struct r *bs; -int bv; - -void b (); -char *w (); - -struct km **q; -char **mns; -int nm; -struct f1 **z; - -f (char *km, char *h) -{ - struct f1 *t; - int map = midn(km, strlen(km)); - int V; - int c; - struct r r; - struct f1 *cm; - - if (!g(&V, &cm, h, strlen(h))) - { - c = (cm - z[V]); - goto L; - } - - for (c = 0; c < nm; c++) - if (!strcmp (h, mns[c])) - { - V = -1; - goto L; - } - - for (c = 0; c < y; c++) - { - if (!memcmp (&bs[c], &r, 8)) - goto L; - } - - h = w (&r); - if (!bv) - { - bs = g (8); - t = (struct f1 *)g (20); - } - else - { - bs = g (bs, y * 8); - z[bv] = cr (z[bv], (1 + y) * 20); - t = &z[bv][y - 1]; - } - bs[y - 1] = r; - t->fs[0] = sp (y - 1); - t->fs[1] = 0; - t->ic = 0; - t->fd = 0; - t->fn = cs (h); - t->ff = b; - L: - g (q[map], V, c); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930530-1.c b/gcc/testsuite/gcc.c-torture/compile/930530-1.c deleted file mode 100644 index 848e0400ece..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930530-1.c +++ /dev/null @@ -1,5 +0,0 @@ -f () -{ - struct { char a, b; } x; - g (x, x, x, x); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930602-1.c b/gcc/testsuite/gcc.c-torture/compile/930602-1.c deleted file mode 100644 index 5a0eb2189ba..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930602-1.c +++ /dev/null @@ -1,13 +0,0 @@ -typedef struct { - int f[8]; -} T; - -f (w, l, r) - T *w; - unsigned short l, r; -{ - int i; - - for (i = l; i < r; i++) - g (w->f[i]); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930603-1.c b/gcc/testsuite/gcc.c-torture/compile/930603-1.c deleted file mode 100644 index 643cc52d4c2..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930603-1.c +++ /dev/null @@ -1,10 +0,0 @@ -union u { union u *a; double d; }; -union u *s, g(); - -f() -{ - union u x = g(); - - s[0] = *x.a; - s[1] = g(); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930607-1.c b/gcc/testsuite/gcc.c-torture/compile/930607-1.c deleted file mode 100644 index 97c94b25ec3..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930607-1.c +++ /dev/null @@ -1,9 +0,0 @@ -typedef void f (); -typedef f *pf; -long long i; - -g () -{ - long long p = i; - ((pf) (long) p) (); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930611-1.c b/gcc/testsuite/gcc.c-torture/compile/930611-1.c deleted file mode 100644 index c216c096523..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930611-1.c +++ /dev/null @@ -1,7 +0,0 @@ -float -f (float a1) -{ - union { float f; int l; } fl1; - fl1.f = a1; - return fl1.l ? 1.0 : a1; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930618-1.c b/gcc/testsuite/gcc.c-torture/compile/930618-1.c deleted file mode 100644 index 74c21572550..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930618-1.c +++ /dev/null @@ -1,8 +0,0 @@ -f (s) -{ - int r; - - r = (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)); - - return r; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930621-1.c b/gcc/testsuite/gcc.c-torture/compile/930621-1.c deleted file mode 100644 index 4199bbe0870..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930621-1.c +++ /dev/null @@ -1,38 +0,0 @@ -#if defined(STACK_SIZE) && (STACK_SIZE < 65536) -# define BYTEMEM_SIZE 10000L -#endif - -#ifndef BYTEMEM_SIZE -# define BYTEMEM_SIZE 45000L -#endif - -int bytestart[5000 + 1]; -unsigned char modtext[400 + 1]; -unsigned char bytemem[2][BYTEMEM_SIZE + 1]; - -long -modlookup (int l) -{ - signed char c; - long j; - long k; - signed char w; - long p; - while (p != 0) - { - while ((k < bytestart[p + 2]) && (j <= l) && (modtext[j] == bytemem[w][k])) - { - k = k + 1; - j = j + 1; - } - if (k == bytestart[p + 2]) - if (j > l) - c = 1; - else c = 4; - else if (j > l) - c = 3; - else if (modtext[j] < bytemem[w][k]) - c = 0; - else c = 2; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930623-1.c b/gcc/testsuite/gcc.c-torture/compile/930623-1.c deleted file mode 100644 index 4b5b90bd848..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930623-1.c +++ /dev/null @@ -1,7 +0,0 @@ -g (a, b) {} - -f (xx) - void* xx; -{ - __builtin_apply ((void*)g, xx, 200); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930702-1.c b/gcc/testsuite/gcc.c-torture/compile/930702-1.c deleted file mode 100644 index 9f51dd876ee..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930702-1.c +++ /dev/null @@ -1,5 +0,0 @@ -f () -{ - {({});} - return 1; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930926-1.c b/gcc/testsuite/gcc.c-torture/compile/930926-1.c deleted file mode 100644 index fcfa4fbc499..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930926-1.c +++ /dev/null @@ -1,7 +0,0 @@ -int f () { return 0; } - -void -test () -{ - int j = { f() }; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/930927-1.c b/gcc/testsuite/gcc.c-torture/compile/930927-1.c deleted file mode 100644 index 81a4979f482..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/930927-1.c +++ /dev/null @@ -1,3 +0,0 @@ -#include <stddef.h> - -wchar_t s[5] = L"abcd"; diff --git a/gcc/testsuite/gcc.c-torture/compile/931003-1.c b/gcc/testsuite/gcc.c-torture/compile/931003-1.c deleted file mode 100644 index 922b14379c9..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/931003-1.c +++ /dev/null @@ -1,15 +0,0 @@ -f (n, a) - int n; - double a[]; -{ - double b[51]; - int i, j; - - i = 0; - - for (j = n - 1; j > 0; j--) - b[i++] = 0; - - if (b[0] > b[i - 1]) - a[i] = b[i - 1]; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/931004-1.c b/gcc/testsuite/gcc.c-torture/compile/931004-1.c deleted file mode 100644 index 0e741fd4ac0..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/931004-1.c +++ /dev/null @@ -1,8 +0,0 @@ -#define A "This is a long test that tests the structure initialization" -#define B A,A -#define C B,B,B,B -#define D C,C,C,C -int main() -{ - char *subs[]={ D, D, D, D, D, D, D, D, D, D, D, D, D, D, D}; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/931013-1.c b/gcc/testsuite/gcc.c-torture/compile/931013-1.c deleted file mode 100644 index c237c0b7341..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/931013-1.c +++ /dev/null @@ -1,10 +0,0 @@ -g (); - -f () -{ - long ldata[2]; - int seed; - - seed = (ldata[0]) + (ldata[1] << 16); - g (seed); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/931013-2.c b/gcc/testsuite/gcc.c-torture/compile/931013-2.c deleted file mode 100644 index 8fc0db492ab..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/931013-2.c +++ /dev/null @@ -1,20 +0,0 @@ -f (unsigned short Z[48]) -{ - int j; - unsigned short t1, t2, t3, T[48]; - unsigned short *p = T + 48; - - for (j = 1; j < 8; j++) - { - t1 = *Z++; - *--p = *Z++; - *--p = t1; - t1 = inv(*Z++); - t2 = -*Z++; - t3 = -*Z++; - *--p = inv(*Z++); - *--p = t2; - *--p = t3; - *--p = t1; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/931013-3.c b/gcc/testsuite/gcc.c-torture/compile/931013-3.c deleted file mode 100644 index e663b9acc1c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/931013-3.c +++ /dev/null @@ -1,11 +0,0 @@ -struct s -{ - int f; -}; - -struct s -f () -{ - int addr; - return *(struct s *) &addr; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/931018-1.c b/gcc/testsuite/gcc.c-torture/compile/931018-1.c deleted file mode 100644 index 7efe40ec094..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/931018-1.c +++ /dev/null @@ -1,14 +0,0 @@ -typedef struct -{ - int a, b; -} T; - -f (T *bs) -{ - long long x; - x = ({ - union { T s; long long l; } u; - u.s = *bs; - u.l; - }); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/931031-1.c b/gcc/testsuite/gcc.c-torture/compile/931031-1.c deleted file mode 100644 index 9015f54f7bf..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/931031-1.c +++ /dev/null @@ -1,9 +0,0 @@ -struct s -{ - int pad:1, no:1; -}; - -f (struct s *b, int c) -{ - char d = b->no && c; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/931102-1.c b/gcc/testsuite/gcc.c-torture/compile/931102-1.c deleted file mode 100644 index a039c26331c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/931102-1.c +++ /dev/null @@ -1,111 +0,0 @@ -char *e (); - -#define SET \ - if (d > *b++) d |= a; \ - if (b) b = e(b); - -xxx() -{ - int a, d; - char *b, *c; - - while (1) { - while (1) { - while (1) { - if (a) { - switch (a) { - case 1: - while (1) { - SET - do { - SET - } while (1); - } - case 2: - while (1) { - if (d) { - do { - SET - } while (1); - } - else { - do { - SET - } while (1); - } - } - case 3: - while (1) { - if (d) { - do { - SET - } while (1); - } - else { - do { - SET - } while (1); - } - } - case 4: - while (1) { - if (d) { - do { - SET - } while (1); - } - else { - do { - SET - } while (1); - } - } - } - } - else { - switch (a) { - case 2: - while (1) { - if (d) { - do { - SET - } while (1); - } - else { - do { - SET - } while (1); - } - } - case 3: - while (1) { - if (d) { - do { - SET - } while (1); - } - else { - do { - SET - } while (1); - } - } - case 4: - while (1) { - if (d) { - do { - SET - } while (1); - } - else { - do { - SET - } while (1); - } - } - } - } - } - } - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/931102-2.c b/gcc/testsuite/gcc.c-torture/compile/931102-2.c deleted file mode 100644 index f39b271645d..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/931102-2.c +++ /dev/null @@ -1,21 +0,0 @@ -typedef struct { - int a; -} VCR; - -typedef struct { - VCR vcr[8]; -} VCRC; - -typedef struct { - char vcr; -} OWN; - -OWN Own[16]; - -f (x, own) - VCRC *x; - OWN *own; -{ - x[own->vcr / 8].vcr[own->vcr % 8].a--; - x[own->vcr / 8].vcr[own->vcr % 8].a = x[own->vcr / 8].vcr[own->vcr % 8].a; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/931203-1.c b/gcc/testsuite/gcc.c-torture/compile/931203-1.c deleted file mode 100644 index 3007ff582e0..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/931203-1.c +++ /dev/null @@ -1,5 +0,0 @@ -v (a, i) - unsigned *a, i; -{ - a++[i] = 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/940611-1.c b/gcc/testsuite/gcc.c-torture/compile/940611-1.c deleted file mode 100644 index 90f72486ada..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/940611-1.c +++ /dev/null @@ -1,10 +0,0 @@ -f () -{ - do -L:; - while (0); - do - ; - while (0); - goto L; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/940712-1.c b/gcc/testsuite/gcc.c-torture/compile/940712-1.c deleted file mode 100644 index 10a6961dcb7..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/940712-1.c +++ /dev/null @@ -1,4 +0,0 @@ -f () -{ - return (*(volatile unsigned int *)8000) / 3; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/940718-1.c b/gcc/testsuite/gcc.c-torture/compile/940718-1.c deleted file mode 100644 index 505280fa91e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/940718-1.c +++ /dev/null @@ -1,7 +0,0 @@ -extern double log (double) __attribute__ ((const)); - -f (double x) -{ - for (;;) - exp(log(x)); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/941014-1.c b/gcc/testsuite/gcc.c-torture/compile/941014-1.c deleted file mode 100644 index d31701572fc..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/941014-1.c +++ /dev/null @@ -1,11 +0,0 @@ -f (to) - char *to; -{ - unsigned int wch; - register length; - unsigned char tmp; - unsigned int mult = 10; - - tmp = (wch>>(unsigned int)(length * mult)); - *to++ = (unsigned char)tmp; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/941014-2.c b/gcc/testsuite/gcc.c-torture/compile/941014-2.c deleted file mode 100644 index 01e9a672e88..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/941014-2.c +++ /dev/null @@ -1,37 +0,0 @@ -void -f (n, ppt, xrot) -{ - int tileWidth; - int nlwSrc; - int srcx; - int v3, v4; - register unsigned long ca1, cx1, ca2, cx2; - unsigned long *pSrcLine; - register unsigned long *pDst; - register unsigned long *pSrc; - register unsigned long b, tmp; - unsigned long tileEndMask; - int v1, v2; - int tileEndPart; - int needFirst; - tileEndPart = 0; - v1 = tileEndPart << 5; - v2 = 32 - v1; - while (n--) - { - if ((srcx = (ppt - xrot) % tileWidth) < 0) - if (needFirst) - if (nlwSrc == 1) - { - tmp = b; - if (tileEndPart) - b = (*pSrc & tileEndMask) | (*pSrcLine >> v1); - } - if (tileEndPart) - b = (tmp << v1) | (b >> v2); - if (v4 != 32) - *pDst = (*pDst & ((tmp << v3) | (b >> v4) & ca1 ^ cx1) - ^ (((tmp << v3) | (b >> v4)) & ca2 ^ cx2)); - *pDst = *pDst & tmp; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/941014-3.c b/gcc/testsuite/gcc.c-torture/compile/941014-3.c deleted file mode 100644 index 6dcb89395e3..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/941014-3.c +++ /dev/null @@ -1,72 +0,0 @@ -typedef unsigned char byte; -typedef unsigned int uint; -typedef unsigned long ulong; -typedef ulong gs_char; -typedef struct gs_show_enum_s gs_show_enum; -typedef struct gs_font_s gs_font; -typedef struct gx_font_stack_item_s { - gs_font *font; -} gx_font_stack_item; -typedef struct gx_font_stack_s { - gx_font_stack_item items[1 + 5 ]; -} gx_font_stack; -struct gs_show_enum_s { - gx_font_stack fstack; -}; -typedef enum { - ft_composite = 0, -} font_type; -struct gs_font_s { - font_type FontType; -}; -typedef enum { - fmap_escape = 3, - fmap_shift = 8 - } fmap_type; -typedef struct gs_type0_data_s { - fmap_type FMapType; -} gs_type0_data; -gs_type0_next_char(register gs_show_enum *penum) -{ - const byte *p; - int fdepth; - gs_font *pfont; - gs_type0_data *pdata; - uint fidx; - gs_char chr; - for (; pfont->FontType == ft_composite; ) - { - fmap_type fmt; - switch ( fmt ) - { - do {} while (0); - rdown: - continue; - case fmap_shift: - p++; - do {} while (0); - goto rdown; - } - break; - } - up: - while ( fdepth > 0 ) - { - switch ( pdata->FMapType ) - { - default: - continue; - case fmap_escape: - fidx = *++p; - do {} while (0); - if ( fidx == chr && fdepth > 1 ) - goto up; - down: - fdepth--; - do {} while (0); - } - break; - } - while ( (pfont = penum->fstack.items[fdepth].font)->FontType == ft_composite ) - ; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/941014-4.c b/gcc/testsuite/gcc.c-torture/compile/941014-4.c deleted file mode 100644 index 9e673f37833..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/941014-4.c +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef NO_LABEL_VALUES -f (int *re) -{ - int *loops = 0, *loope = 0; - unsigned dat0 = 0; - static void *debug = &&firstdebug; - - firstdebug: - g (loops, loope); - - if (dat0 & 1) - re[(dat0 >> 2) & 3] = 0; -} -#else -int x; -#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/941019-1.c b/gcc/testsuite/gcc.c-torture/compile/941019-1.c deleted file mode 100644 index 257b594c1b6..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/941019-1.c +++ /dev/null @@ -1 +0,0 @@ -__complex__ long double sub (__complex__ long double cld) { return cld; } diff --git a/gcc/testsuite/gcc.c-torture/compile/941111-1.c b/gcc/testsuite/gcc.c-torture/compile/941111-1.c deleted file mode 100644 index 3f0c28bef12..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/941111-1.c +++ /dev/null @@ -1,8 +0,0 @@ -main () -{ - struct S { int i; char c; } obj1, obj2; - - foo (); - if (obj1.c != obj2.c) - bar (); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/941113-1.c b/gcc/testsuite/gcc.c-torture/compile/941113-1.c deleted file mode 100644 index 5c2e0b68c56..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/941113-1.c +++ /dev/null @@ -1,12 +0,0 @@ -typedef void foo (void); - -f (x) -{ - if (x) - { - const foo* v; - (*v)(); - } - else - g (0); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/950122-1.c b/gcc/testsuite/gcc.c-torture/compile/950122-1.c deleted file mode 100644 index 8dea7905093..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950122-1.c +++ /dev/null @@ -1,5 +0,0 @@ -int -foo (int i, unsigned short j) -{ - return j *= i; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/950124-1.c b/gcc/testsuite/gcc.c-torture/compile/950124-1.c deleted file mode 100644 index e723954a0c1..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950124-1.c +++ /dev/null @@ -1,15 +0,0 @@ -f () -{ - if (g ()) - h (); - else - { - do - { - return 0; - break; - } - while (1); - } - return 1; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/950221-1.c b/gcc/testsuite/gcc.c-torture/compile/950221-1.c deleted file mode 100644 index 14147638668..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950221-1.c +++ /dev/null @@ -1,16 +0,0 @@ -short v = -1; - -typedef struct -{ - short network; -} atype; - -void f () -{ - static atype config; - atype *cp; - short net; - cp = &config; - cp->network = (v == -1) ? 100 : v; - net = cp->network; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/950329-1.c b/gcc/testsuite/gcc.c-torture/compile/950329-1.c deleted file mode 100644 index 7c047f5a59c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950329-1.c +++ /dev/null @@ -1,19 +0,0 @@ -f () -{ - int i; - for (i = 1;; i = 0) - { - if (h ()) - { - if (i) - g (); - g (h ()); - g (h ()); - } - else - { - g (); - break; - } - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/950512-1.c b/gcc/testsuite/gcc.c-torture/compile/950512-1.c deleted file mode 100644 index e43ec48d165..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950512-1.c +++ /dev/null @@ -1,6 +0,0 @@ -typedef unsigned short uint16; -f (unsigned char *w) -{ - w[2] = (uint16) ((((g (0) % 10000 + 42) & 0xFF) << 8) | (((g (0) % 10000 + 42) >> 8) & 0xFF)) & 0xFF, - w[3] = (uint16) ((((g (0) % 10000 + 42) & 0xFF) << 8) | (((g (0) % 10000 + 42) >> 8) & 0xFF)) >> 8; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/950530-1.c b/gcc/testsuite/gcc.c-torture/compile/950530-1.c deleted file mode 100644 index 2b714e059bc..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950530-1.c +++ /dev/null @@ -1,4 +0,0 @@ -f (int *s, int *t) -{ - return (t - s) / 2; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/950607-1.c b/gcc/testsuite/gcc.c-torture/compile/950607-1.c deleted file mode 100644 index 851defce34c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950607-1.c +++ /dev/null @@ -1,38 +0,0 @@ -typedef struct { - int component_id; - int component_index; - int h_samp_factor; - int v_samp_factor; -} jpeg_component_info; -struct jpeg_common_struct { - struct jpeg_error_mgr * err; -}; -typedef struct jpeg_common_struct * j_common_ptr; -typedef struct jpeg_compress_struct * j_compress_ptr; -struct jpeg_compress_struct { - struct jpeg_error_mgr * err; - int num_components; - jpeg_component_info * comp_info; - int max_h_samp_factor; - int max_v_samp_factor; -}; -struct jpeg_error_mgr { - int msg_code; -}; - -void -jinit_downsampler (j_compress_ptr cinfo) -{ - int ci; - jpeg_component_info * compptr; - - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - if (compptr->h_samp_factor == cinfo->max_h_samp_factor && - compptr->v_samp_factor == cinfo->max_v_samp_factor) { - } else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 && - (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) { - } else - cinfo->err->msg_code = 0; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/950610-1.c b/gcc/testsuite/gcc.c-torture/compile/950610-1.c deleted file mode 100644 index 16d0d0e60f5..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950610-1.c +++ /dev/null @@ -1 +0,0 @@ -f (int n, int a[2][n]) {} diff --git a/gcc/testsuite/gcc.c-torture/compile/950612-1.c b/gcc/testsuite/gcc.c-torture/compile/950612-1.c deleted file mode 100644 index cb3cb0a59d6..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950612-1.c +++ /dev/null @@ -1,134 +0,0 @@ -typedef enum -{ - LODI, - STO, - ADDI, - ADD, - SUBI, - SUB, - MULI, - MUL, - DIVI, - DIV, - INC, - DEC -} INSN; - -f (pc) - short *pc; -{ - long long stack[16], *sp = &stack[16], acc = 0; - - for (;;) - { - switch ((INSN)*pc++) - { - case LODI: - *--sp = acc; - acc = ((long long)*pc++) << 32; - break; - case STO: - return (acc >> 32) + (((((unsigned long long) acc) & 0xffffffff) & (1 << 31)) != 0); - break; - case ADDI: - acc += ((long long)*pc++) << 32; - break; - case ADD: - acc = *sp++ + acc; - break; - case SUBI: - acc -= ((long long)*pc++) << 32; - break; - case SUB: - acc = *sp++ - acc; - break; - case MULI: - acc *= *pc++; - break; - case MUL: - { - long long aux; - unsigned char minus; - - minus = 0; - aux = *sp++; - if (aux < 0) - { - minus = ~minus; - aux = -aux; - } - if (acc < 0) - { - minus = ~minus; - acc = -acc; - } - acc = ((((((unsigned long long) acc) & 0xffffffff) * (((unsigned long long) aux) & 0xffffffff)) >> 32) - + ((((unsigned long long) acc) >> 32) * (((unsigned long long) aux) & 0xffffffff) + (((unsigned long long) acc) & 0xffffffff) + (((unsigned long long) aux) >> 32)) - + (((((unsigned long long) acc) >> 32) * (((unsigned long long) aux) >> 32)) << 32)); - if (minus) - acc = -acc; - } - break; - case DIVI: - { - short aux; - - aux = *pc++; - acc = (acc + aux / 2) / aux; - } - break; - case DIV: - { - long long aux; - unsigned char minus; - - minus = 0; - aux = *sp++; - if (aux < 0) - { - minus = ~minus; - aux = -aux; - } - if (acc < 0) - { - minus = ~minus; - acc = -acc; - } - - if (((unsigned long long)acc) == 0) - acc = (unsigned long long)-1 / 2; - else if ((((unsigned long long) ((unsigned long long)acc)) & 0xffffffff) == 0) - acc = ((unsigned long long)aux) / (((unsigned long long) ((unsigned long long)acc)) >> 32); - else if ((((unsigned long long) ((unsigned long long)acc)) >> 32) == 0) - acc = ((((unsigned long long)aux) / ((unsigned long long)acc)) << 32) - + ((((unsigned long long)aux) % ((unsigned long long)acc)) << 32) / ((unsigned long long)acc); - else - { - unsigned char shift; - unsigned long hi; - - shift = 32; - hi = (((unsigned long long) ((unsigned long long)acc)) >> 32); - do { - if (hi & ((unsigned long)1 << (shift - 1))) - break; - } while (--shift != 0); - printf("shift = %d\n", shift); - acc = ((((unsigned long long)aux) / ((unsigned long long)acc)) << 32) - + (((((unsigned long long)aux) % ((unsigned long long)acc)) << (32 - shift)) + ((((unsigned long long)acc) >> shift) / 2)) / (((unsigned long long)acc) >> shift); - } - - if (minus) - acc = -acc; - } - break; - case INC: - acc += 1; - break; - case DEC: - acc -= 1; - break; - } - printf("%08lx.%08lx\n", (long)(((unsigned long long) acc) >> 32) , (long)(((unsigned long long) acc) & 0xffffffff)); - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/950613-1.c b/gcc/testsuite/gcc.c-torture/compile/950613-1.c deleted file mode 100644 index 8aa757f476c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950613-1.c +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef NO_LABEL_VALUES -f () -{ - long *sp; - long *pc; - - static void *dummy[] = - { - &&L1, - &&L2, - }; - - L1: - { - float val; - val = *(float *) sp; - val = -val; - *(float *) sp = val; - goto *pc++; - } - - L2: - { - float from; - *(long long *) sp = from; - goto *pc++; - } -} -#else -int x; -#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/950618-1.c b/gcc/testsuite/gcc.c-torture/compile/950618-1.c deleted file mode 100644 index 4229da4e9bf..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950618-1.c +++ /dev/null @@ -1,2 +0,0 @@ -static __inline__ int f () { return g (); } -int g () { return f (); } diff --git a/gcc/testsuite/gcc.c-torture/compile/950719-1.c b/gcc/testsuite/gcc.c-torture/compile/950719-1.c deleted file mode 100644 index d3277fada4e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950719-1.c +++ /dev/null @@ -1,11 +0,0 @@ -typedef struct -{ - int Header; - char data[4092]; -} t_node; - -f (unsigned short rid, unsigned short record_length) -{ - t_node tnode; - g (rid, tnode.data + rid * record_length); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/950729-1.c b/gcc/testsuite/gcc.c-torture/compile/950729-1.c deleted file mode 100644 index cfdbad9206f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950729-1.c +++ /dev/null @@ -1,39 +0,0 @@ -static const char * const lcset = "0123456789abcdef"; -static const char * const ucset = "0123456789ABCDEF"; - -char * -f (char *buffer, long long value, char type) -{ - int base, i; - - i = 128 - 1; - buffer[i--] = '\0'; - - switch (type) - { - case 'u': - case 'o': - case 'x': - case 'X': - if (type == 'u') - base = 10; - else if (type == 'o') - base = 8; - else - base = 16; - - while (i >= 0) - { - if (type == 'X') - buffer[i--] = ucset[((unsigned long long) value) % base]; - else - buffer[i--] = lcset[((unsigned long long) value) % base]; - - if ((value = ((unsigned long long) value) / base) == 0) - break; - } - break; - } - - return &buffer[++i]; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/950816-1.c b/gcc/testsuite/gcc.c-torture/compile/950816-1.c deleted file mode 100644 index da849bbad0a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950816-1.c +++ /dev/null @@ -1,7 +0,0 @@ -f () -{ - unsigned char b[2]; - float f; - b[0] = (unsigned char) f / 256; - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/950816-2.c b/gcc/testsuite/gcc.c-torture/compile/950816-2.c deleted file mode 100644 index 41e770d177d..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950816-2.c +++ /dev/null @@ -1,8 +0,0 @@ -f () -{ - int i; - float a,b,c; - unsigned char val[2]; - i = func (&c); - val[0] = c < a ? a : c >= 1.0 ? b : c; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/950816-3.c b/gcc/testsuite/gcc.c-torture/compile/950816-3.c deleted file mode 100644 index b3cb0fca377..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950816-3.c +++ /dev/null @@ -1,8 +0,0 @@ -f () -{ - int i; - short x, z; - for (i = 0; i <= 1; i++) - x = i; - return x + z; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/950910-1.c b/gcc/testsuite/gcc.c-torture/compile/950910-1.c deleted file mode 100644 index 1be2aa55e68..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950910-1.c +++ /dev/null @@ -1,22 +0,0 @@ -f (char *p) -{ - char c; - - c = *++p; - if (c != ' ') - return 0; - for (;;) - { - c = *p; - if (g (c)) - p++; - else - { - if (c == ' ') - break; - else - return 0; - } - } - return 1; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/950919-1.c b/gcc/testsuite/gcc.c-torture/compile/950919-1.c deleted file mode 100644 index 8320f6d025a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950919-1.c +++ /dev/null @@ -1,5 +0,0 @@ -#define empty -#if empty#cpu(m68k) -#endif - -f (){} diff --git a/gcc/testsuite/gcc.c-torture/compile/950921-1.c b/gcc/testsuite/gcc.c-torture/compile/950921-1.c deleted file mode 100644 index 371c7d569c5..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950921-1.c +++ /dev/null @@ -1,12 +0,0 @@ -f () -{ - union - { - signed char c; - double d; - } u; - - u.c = 1; - u.c = 1; - return u.c; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/950922-1.c b/gcc/testsuite/gcc.c-torture/compile/950922-1.c deleted file mode 100644 index 73574f33e68..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/950922-1.c +++ /dev/null @@ -1,68 +0,0 @@ -struct sw { - const void *x; - int r; -}; -struct sq { - struct sw *q_w; - int t; - int z; -}; - -int -f (int ch, char *fp, char *ap) -{ - register int n; - register char *cp; - register struct sw *p; - register int f; - int prec; - double _double; - int expt; - int ndig; - char expstr[7]; - unsigned long long _uquad; - struct sq q; - struct sw w[8]; - static char zeroes[16]; - - for (;;) { - switch (ch) { - case 'd': - _double = (double) (ap += 8, *((double *) (ap - 8))); - break; - case 'o': - goto nosign; - case 'u': - _uquad = (f & 0x020 ? (ap += 8, *((long long *) (ap - 8))) : f & 0x010 ? (ap += 4, *((long *) (ap - 4))) : f & 0x040 ? (long)(short)(ap += 4, *((int *) (ap - 4))) : (long)(ap += 4, *((int *) (ap - 4)))); - goto nosign; - case 'x': - _uquad = (f & 0x020 ? (ap += 8, *((long long *) (ap - 8))) : f & 0x010 ? (ap += 4, *((long *) (ap - 4))) : f & 0x040 ? (long)(unsigned short)(ap += 4, *((int *) (ap - 4))) : (long)(ap += 4, *((int *) (ap - 4)))); - nosign: - if (_uquad != 0 || prec != 0); - break; - default: - } - if ((f & 0x100) == 0) { - } else { - if (ch >= 'f') { - if (_double == 0) { - if (expt < ndig || (f & 0x001) != 0) { - { if ((n = (ndig - 1)) > 0) { while (n > 16) {{ p->x = (zeroes); p->r = 16; q.z += 16; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} n -= 16; }{ p->x = (zeroes); p->r = n; q.z += n; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }}}} - } - } else if (expt <= 0) { - { p->x = ("0"); p->r = 1; q.z += 1; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} - { p->x = 0; p->r = 1; q.z += 1; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} - { if ((n = (-expt)) > 0) { while (n > 16) {{ p->x = (zeroes); p->r = 16; q.z += 16; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} n -= 16; }{ p->x = (zeroes); p->r = n; q.z += n; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} }} - { p->x = cp; p->r = ndig; q.z += ndig; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} - } else { - { p->x = cp; p->r = expt; q.z += expt; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} - cp += expt; - { p->x = ("."); p->r = 1; q.z += 1; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} - { p->x = cp; p->r = (ndig-expt); q.z += (ndig-expt); p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} - } - } - } - } - - error: -} diff --git a/gcc/testsuite/gcc.c-torture/compile/951004-1.c b/gcc/testsuite/gcc.c-torture/compile/951004-1.c deleted file mode 100644 index 1ca60819cdd..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/951004-1.c +++ /dev/null @@ -1,23 +0,0 @@ -typedef struct -{ - short v, h; -} S; - -S a; - -f (S pnt) -{ - S mpnt, mtp; - - (&pnt)->v -= 1; - mpnt = pnt; - mtp = a; - if (mtp.v != mpnt.v) - { - S tpnt; - - tpnt = mtp; - mtp = mpnt; - mpnt = tpnt; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/951106-1.c b/gcc/testsuite/gcc.c-torture/compile/951106-1.c deleted file mode 100644 index 09cba20c1d0..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/951106-1.c +++ /dev/null @@ -1,4 +0,0 @@ -f (double a, double b) -{ - g (a, 0, b); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/951116-1.c b/gcc/testsuite/gcc.c-torture/compile/951116-1.c deleted file mode 100644 index 100d6902a72..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/951116-1.c +++ /dev/null @@ -1,9 +0,0 @@ -f () -{ - long long i; - int j; - long long k = i = j; - - int inner () {return j + i;} - return k; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/951128-1.c b/gcc/testsuite/gcc.c-torture/compile/951128-1.c deleted file mode 100644 index 5e4dc7093c8..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/951128-1.c +++ /dev/null @@ -1,5 +0,0 @@ -char a[]; -f (const int i) -{ - a[i] = 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/951220-1.c b/gcc/testsuite/gcc.c-torture/compile/951220-1.c deleted file mode 100644 index 33e98f6221e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/951220-1.c +++ /dev/null @@ -1,4 +0,0 @@ -f (char *x) -{ - return (*x & 2) || (*x & 3); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/951222-1.c b/gcc/testsuite/gcc.c-torture/compile/951222-1.c deleted file mode 100644 index b8246f5fe81..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/951222-1.c +++ /dev/null @@ -1,15 +0,0 @@ -extern long long foo (); - -long long -sub1 () -{ - char junk[10000]; - register long long a, b, c; - - b = foo (); - - setjmp (); - a = foo (); - c = a - b; - return c; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/960106-1.c b/gcc/testsuite/gcc.c-torture/compile/960106-1.c deleted file mode 100644 index c8228aab587..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/960106-1.c +++ /dev/null @@ -1,4 +0,0 @@ -f (a) -{ - return (a & 1) && !(a & 2 & 4); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/960130-1.c b/gcc/testsuite/gcc.c-torture/compile/960130-1.c deleted file mode 100644 index ed8dab45988..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/960130-1.c +++ /dev/null @@ -1,8 +0,0 @@ -int a[1]; - -int -main() -{ - extern int a[]; - return *a; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/960201-1.c b/gcc/testsuite/gcc.c-torture/compile/960201-1.c deleted file mode 100644 index adc462389d2..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/960201-1.c +++ /dev/null @@ -1,5 +0,0 @@ -union foo -{ - char a; - int x[2]; -} __attribute__ ((transparent_union)); diff --git a/gcc/testsuite/gcc.c-torture/compile/960218-1.c b/gcc/testsuite/gcc.c-torture/compile/960218-1.c deleted file mode 100644 index 46fbf778524..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/960218-1.c +++ /dev/null @@ -1,2 +0,0 @@ -#define X(x) x -int main() { return X(0/* *//* */); } diff --git a/gcc/testsuite/gcc.c-torture/compile/960220-1.c b/gcc/testsuite/gcc.c-torture/compile/960220-1.c deleted file mode 100644 index 766a066c449..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/960220-1.c +++ /dev/null @@ -1,6 +0,0 @@ -f () -{ - unsigned long long int a = 0, b; - while (b > a) - ; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/960221-1.c b/gcc/testsuite/gcc.c-torture/compile/960221-1.c deleted file mode 100644 index 0e02496c104..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/960221-1.c +++ /dev/null @@ -1,11 +0,0 @@ -struct s1 { int f1; }; - -struct s2 { - struct s1 a; - int f2; -}; - -foo (struct s2 *ptr) -{ - *ptr = (struct s2) {{}, 0}; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/960319-1.c b/gcc/testsuite/gcc.c-torture/compile/960319-1.c deleted file mode 100644 index f3d95ab6e8e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/960319-1.c +++ /dev/null @@ -1,10 +0,0 @@ -static void -f() -{ - long long a[2]; - int i; - if (g()) - if (h()) - ; - *a |= (long long)i << 65 ; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/960514-1.c b/gcc/testsuite/gcc.c-torture/compile/960514-1.c deleted file mode 100644 index 1d38cfd1a0b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/960514-1.c +++ /dev/null @@ -1,12 +0,0 @@ -struct s { - unsigned long long t[5]; -}; - -void -f (struct s *d, unsigned long long *l) -{ - int i; - - for (i = 0; i < 5; i++) - d->t[i] += l[i]; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/960704-1.c b/gcc/testsuite/gcc.c-torture/compile/960704-1.c deleted file mode 100644 index 5a9d35cfd9a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/960704-1.c +++ /dev/null @@ -1,10 +0,0 @@ -struct A { - double d; -}; - -struct A f (); - -main () -{ - struct A a = f(); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/960829-1.c b/gcc/testsuite/gcc.c-torture/compile/960829-1.c deleted file mode 100644 index 8c6163dfaf0..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/960829-1.c +++ /dev/null @@ -1,4 +0,0 @@ -f () -{ - g (0, 0.0, 0.0, 0.0, 0.0); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/961004-1.c b/gcc/testsuite/gcc.c-torture/compile/961004-1.c deleted file mode 100644 index 6407b625d66..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/961004-1.c +++ /dev/null @@ -1,37 +0,0 @@ -void -f1 (o1, o2, o3, i, j, k) - long long *o1, *o2, *o3; - int i, j, k; -{ - while (--i) - o1[i] = o2[j >>= 1] + o3[k >>= 1]; -} - -void -f2 (o1, o2, o3, i, j, k) - long long *o1, *o2, *o3; - int i, j, k; -{ - while (--i) - o1[i] = o2[j >>= 1] - o3[k >>= 1]; -} - -void -f3 (o1, o2, o3, i, j, k) - long long *o1, *o3; - unsigned *o2; - int i, j, k; -{ - while (--i) - o1[i] = o2[j >>= 1] + o3[k >>= 1]; -} - -void -f4 (o1, o2, o3, i, j, k) - long long *o1, *o2; - unsigned *o3; - int i, j, k; -{ - while (--i) - o1[i] = o2[j >>= 1] - o3[k >>= 1]; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/961010-1.c b/gcc/testsuite/gcc.c-torture/compile/961010-1.c deleted file mode 100644 index d6145bc4233..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/961010-1.c +++ /dev/null @@ -1 +0,0 @@ -double f (double x) { return x == 0 ? x : 0.0; } diff --git a/gcc/testsuite/gcc.c-torture/compile/961019-1.c b/gcc/testsuite/gcc.c-torture/compile/961019-1.c deleted file mode 100644 index 0ea6ec6e280..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/961019-1.c +++ /dev/null @@ -1,11 +0,0 @@ -char _hex_value[256]; - -void -hex_init () -{ - int i; - for (i = 0; i < 256; i++) - _hex_value[i] = 99; - for (i = 0; i < 10; i++) - _hex_value['0' + i] = i; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/961031-1.c b/gcc/testsuite/gcc.c-torture/compile/961031-1.c deleted file mode 100644 index ea8718f763b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/961031-1.c +++ /dev/null @@ -1,16 +0,0 @@ -struct s { - double d; -} sd; - -struct s g () __attribute__ ((const)); - -struct s -g () -{ - return sd; -} - -f () -{ - g (); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/961126-1.c b/gcc/testsuite/gcc.c-torture/compile/961126-1.c deleted file mode 100644 index f3b6af55595..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/961126-1.c +++ /dev/null @@ -1,107 +0,0 @@ -int *p; - -main() -{ - int i = sub (); - - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - i = -i; - if (*p != i) - goto quit; - - i = -i; -quit: - sub2 (i); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/961203-1.c b/gcc/testsuite/gcc.c-torture/compile/961203-1.c deleted file mode 100644 index 0f066ace617..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/961203-1.c +++ /dev/null @@ -1,14 +0,0 @@ -struct s { - char a[0x32100000]; - int x:30, y:30; -}; - -int -main () -{ - struct s* p; - - p = (struct s*) 0; - if (p->x == p->y) - exit (1); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/961203-1.x b/gcc/testsuite/gcc.c-torture/compile/961203-1.x deleted file mode 100644 index e705ffe167a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/961203-1.x +++ /dev/null @@ -1,17 +0,0 @@ -# The structure is too large for the xstormy16 - won't fit in 16 bits. - -if { [istarget "xstormy16-*-*"] } { - return 1; -} - -if { [istarget "h8300-*-*"] } { - return 1 -} - -# Array 'a' in this test is too large to fit in 64K. - -if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"]} { - return 1 -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/970206-1.c b/gcc/testsuite/gcc.c-torture/compile/970206-1.c deleted file mode 100644 index 95196cd6a54..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/970206-1.c +++ /dev/null @@ -1,13 +0,0 @@ -struct Rect -{ - int iA; - int iB; - int iC; - int iD; -}; - -void -f (int * const this, struct Rect arect) -{ - g (*this, arect); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/970214-1.c b/gcc/testsuite/gcc.c-torture/compile/970214-1.c deleted file mode 100644 index 508ea9e92b6..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/970214-1.c +++ /dev/null @@ -1,3 +0,0 @@ -#include <stddef.h> -#define L 264 -wchar_t c = L'X'; diff --git a/gcc/testsuite/gcc.c-torture/compile/980329-1.c b/gcc/testsuite/gcc.c-torture/compile/980329-1.c deleted file mode 100644 index d11b49b01c7..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/980329-1.c +++ /dev/null @@ -1,72 +0,0 @@ -typedef unsigned long int size_t; -struct re_pattern_buffer - { - unsigned char *buffer; - unsigned long int used; - }; -struct re_registers - { - int *start; - }; - -static const char **regstart, **regend; -static const char **old_regend; - -static int -re_match_2_internal (struct re_pattern_buffer *bufp, - struct re_registers *regs) -{ - unsigned char *p = bufp->buffer; - unsigned char *pend = p + bufp->used; - - for (;;) - { - int highest_active_reg = 1; - if (bufp) - { - int i; - for (i = 1;; i++) - regs->start[i] = 0; - } - - switch ((unsigned int) *p++) - { - case 1: - { - unsigned char r = *p; - if (r) - highest_active_reg = r; - } - if (p + 2 == pend) - { - char is_a_jump_n = 0; - int mcnt = 0; - unsigned char *p1; - - p1 = p + 2; - switch (*p1++) - { - case 2: - is_a_jump_n = 1; - case 1: - do { do { mcnt = *p1; } while (0); p1 += 2; } while (0); - if (is_a_jump_n) - p1 = 0; - } - - if (mcnt && *p1 == 0) - { - unsigned r; - for (r = 0; r < (unsigned) *p + (unsigned) *(p + 1); r++) - { - if (regend[0] >= regstart[r]) - regend[r] = old_regend[r]; - } - do { while (0 < highest_active_reg + 1) { } } while (0); - } - } - } - } - - return -1; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/980408-1.c b/gcc/testsuite/gcc.c-torture/compile/980408-1.c deleted file mode 100644 index 09bf430406e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/980408-1.c +++ /dev/null @@ -1,129 +0,0 @@ -typedef struct _RunlengthPacket -{ - unsigned short - red, - green, - blue, - length; - unsigned short - index; -} RunlengthPacket; -typedef struct _Image -{ - int - status, - temporary; - char - filename[1664 ]; - long int - filesize; - int - pipe; - char - magick[1664 ], - *comments, - *label, - *text; - unsigned int - matte; - unsigned int - columns, - rows, - depth; - unsigned int - scene, - number_scenes; - char - *montage, - *directory; - unsigned int - colors; - double - gamma; - float - x_resolution, - y_resolution; - unsigned int - mean_error_per_pixel; - double - normalized_mean_error, - normalized_maximum_error; - unsigned long - total_colors; - char - *signature; - unsigned int - packets, - runlength, - packet_size; - unsigned char - *packed_pixels; - long int - magick_time; - char - magick_filename[1664 ]; - unsigned int - magick_columns, - magick_rows; - char - *geometry, - *page; - unsigned int - dispose, - delay, - iterations; - unsigned int - orphan; - struct _Image - *previous, - *list, - *next; -} Image; - Image *MinifyImage(Image *image) -{ - Image - *minified_image; - register RunlengthPacket - *q, - *s, - *s0, - *s1, - *s2, - *s3; - register unsigned int - x; - unsigned int - blue, - green, - red; - unsigned long - total_matte, - total_blue, - total_green, - total_red; - unsigned short - index; - for (x=0; x < (image->columns-1); x+=2) - { - total_red=0; - total_green=0; - total_blue=0; - total_matte=0; - s=s0; - total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ; - s=s1; - total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; - s=s2; - total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; - s=s3; - total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ; - red=(unsigned short) ((total_red+63) >> 7); - green=(unsigned short) ((total_green+63) >> 7); - blue=(unsigned short) ((total_blue+63) >> 7); - index=(unsigned short) ((total_matte+63) >> 7); - if ((red == q->red) && (green == q->green) && (blue == q->blue) && - (index == q->index) && ((int) q->length < 65535L )) - q->length++; - } - return(minified_image); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/980504-1.c b/gcc/testsuite/gcc.c-torture/compile/980504-1.c deleted file mode 100644 index 7b757ccd2e8..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/980504-1.c +++ /dev/null @@ -1,28 +0,0 @@ -typedef struct _geom_elem { - double coeffs[6]; -} pGeomDefRec, *pGeomDefPtr; -typedef struct _mpgeombanddef { - int yOut; - int in_width; -} mpGeometryBandRec, *mpGeometryBandPtr; -typedef void *pointer; -typedef unsigned char CARD8; -typedef CARD8 BytePixel; -void BiGL_B (OUTP,srcimg,width,sline,pedpvt,pvtband) pointer OUTP; -pointer *srcimg; -register int width; -int sline; -pGeomDefPtr pedpvt; mpGeometryBandPtr pvtband; -{ - register float s, t, st; - register int isrcline,isrcpix; - register int srcwidth = pvtband->in_width - 1; - register BytePixel val; - register BytePixel *ptrIn, *ptrJn; - register double a = pedpvt->coeffs[0]; - register double c = pedpvt->coeffs[2]; - register double srcpix = a * ((double)(0.0000)) + pedpvt->coeffs[1] * (pvtband->yOut + ((double)(0.0000)) ) + pedpvt->coeffs[4]; - register double srcline = c * ((double)(0.0000)) + pedpvt->coeffs[3] * (pvtband->yOut + ((double)(0.0000)) ) + pedpvt->coeffs[5]; - if ( (isrcpix >= 0) && (isrcpix < srcwidth) ) - val = ptrIn[isrcpix] * ((float)1. - s - t + st) + ptrIn[isrcpix+1] * (s - st) + ptrJn[isrcpix] * (t - st) + ptrJn[isrcpix+1] * (st) + (float)0.5 ; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/980506-1.c b/gcc/testsuite/gcc.c-torture/compile/980506-1.c deleted file mode 100644 index 6ef7796261f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/980506-1.c +++ /dev/null @@ -1,63 +0,0 @@ -unsigned char TIFFFax2DMode[20][256]; -unsigned char TIFFFax2DNextState[20][256]; -unsigned char TIFFFaxUncompAction[20][256]; -unsigned char TIFFFaxUncompNextState[20][256]; -unsigned char TIFFFax1DAction[230][256]; -unsigned char TIFFFax1DNextState[230][256]; - -typedef struct tableentry { - unsigned short length; - unsigned short code; - short runlen; -} tableentry; - -extern tableentry TIFFFaxWhiteCodes[]; -extern tableentry TIFFFaxBlackCodes[]; - -static short sp_data, sp_bit; - -static unsigned char -fetchByte (inbuf) - -unsigned char **inbuf; - -{ - unsigned char byte = **inbuf; - (*inbuf)++; - return (byte); -} - -static int -decode_white_run (inbuf) - -unsigned char **inbuf; - -{ - short state = sp_bit; - short action; - int runlen = 0; - - for (;;) - { - if (sp_bit == 0) - { - nextbyte: - sp_data = fetchByte (inbuf); - } - - action = TIFFFax1DAction[state][sp_data]; - state = TIFFFax1DNextState[state][sp_data]; - if (action == 0 ) - goto nextbyte; - if (action == 1 ) - return (-1 ); - if (action == 210 ) - return (-3 ); - sp_bit = state; - action = (TIFFFaxWhiteCodes[ action - 2 ].runlen) ; - runlen += action; - if (action < 64) - return (runlen); - } -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/980506-1.x b/gcc/testsuite/gcc.c-torture/compile/980506-1.x deleted file mode 100644 index 133ed24d944..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/980506-1.x +++ /dev/null @@ -1,13 +0,0 @@ -# The arrays are too large for the xstormy16 - won't fit in 16 bits. -if { [istarget "xstormy16-*-*"] } { - return 1; -} - -if { [istarget "h8300-*-*"] } { - return 1; -} - -if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { - return 1 -} -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/980506-2.c b/gcc/testsuite/gcc.c-torture/compile/980506-2.c deleted file mode 100644 index 6f6fe19270c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/980506-2.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * inspired by glibc-2.0.6/sysdeps/libm-ieee754/s_nextafterf.c - * - * gcc -O2 -S -DOP=+ gives faddp %st(1),%st - * gcc -O2 -S -DOP=* gives fmulp %st(1),%st - * gcc -O2 -S -DOP=- gives fsubrp %st(1),%st - * gcc -O2 -S -DOP=/ gives fdivrp %st(1),%st - */ - -#ifndef OP -#define OP * -#endif - -typedef int int32_t __attribute__ ((__mode__ ( __SI__ ))) ; -typedef unsigned int u_int32_t __attribute__ ((__mode__ ( __SI__ ))) ; - -typedef union -{ - float value; - u_int32_t word; -} ieee_float_shape_type; - -float __nextafterf(float x, float y) -{ - int32_t hx,hy,ix,iy; - - { - ieee_float_shape_type gf_u; - gf_u.value = x; - hx = gf_u.word; - } - { - ieee_float_shape_type gf_u; - gf_u.value = y; - hy = gf_u.word; - } - ix = hx&0x7fffffff; - iy = hy&0x7fffffff; - - if ( ix > 0x7f800000 || iy > 0x7f800000 ) - return x+y; - if (x == y) return x; - if (ix == 0) - { - { - ieee_float_shape_type sf_u; - sf_u.word = (hy&0x80000000) | 1; - x = sf_u.value; - } - y = x*x; - if (y == x) return y; else return x; - } - if (hx >= 0) - { - if (hx > hy) - hx -= 1; - else - hx += 1; - } - else - { - if (hy >= 0 || hx > hy) - hx -= 1; - else - hx += 1; - } - hy = hx & 0x7f800000; - if (hy >= 0x7f800000) - return x+x; - if (hy < 0x00800000) - { - y = x OP x; - if (y != x) - { - ieee_float_shape_type sf_u; - sf_u.word = hx; - y = sf_u.value; - return y; - } - } - { - ieee_float_shape_type sf_u; - sf_u.word = hx; - x = sf_u.value; - } - return x; -} - - diff --git a/gcc/testsuite/gcc.c-torture/compile/980511-1.c b/gcc/testsuite/gcc.c-torture/compile/980511-1.c deleted file mode 100644 index f1bac0c434a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/980511-1.c +++ /dev/null @@ -1,20 +0,0 @@ -typedef unsigned int __kernel_dev_t; -typedef __kernel_dev_t dev_t; -struct ustat { -}; -typedef unsigned int kdev_t; -static inline kdev_t to_kdev_t(int dev) -{ - int major, minor; - major = (dev >> 8); - minor = (dev & 0xff); - return ((( major ) << 22 ) | ( minor )) ; -} -struct super_block { -}; -struct super_block * get_super (kdev_t dev); -int sys_ustat(dev_t dev, struct ustat * ubuf) -{ - struct super_block *s; - s = get_super(to_kdev_t(dev)); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/980701-1.c b/gcc/testsuite/gcc.c-torture/compile/980701-1.c deleted file mode 100644 index 82dd16d6be2..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/980701-1.c +++ /dev/null @@ -1,9 +0,0 @@ - -short -func(void) -{ - unsigned char x, y; - - return y | x << 8; -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/980706-1.c b/gcc/testsuite/gcc.c-torture/compile/980706-1.c deleted file mode 100644 index 214f36d5311..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/980706-1.c +++ /dev/null @@ -1,10 +0,0 @@ -void g(long long); - -long long f(long long v1, long long v2, long long v3, long long v4) -{ - g(v1); - g(v2); - g(v3); - g(v4); - return v1 && v2; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/980726-1.c b/gcc/testsuite/gcc.c-torture/compile/980726-1.c deleted file mode 100644 index 3d4daa203de..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/980726-1.c +++ /dev/null @@ -1,10 +0,0 @@ -static __inline__ unsigned char BCD(unsigned char binval) -{ - if (binval > 99) return 0x99; - return (((binval/10) << 4) | (binval%10)); -} - -void int1a(unsigned char i) -{ - (*((unsigned char *)1)) = BCD(i); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/980729-1.c b/gcc/testsuite/gcc.c-torture/compile/980729-1.c deleted file mode 100644 index 973372b2ea3..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/980729-1.c +++ /dev/null @@ -1,14 +0,0 @@ -static int -regex_compile () -{ - int c, c1; - char str[6 + 1]; - c1 = 0; - for (;;) - { - do { } while (0) ; - if (c1 == 6 ) - break; - str[c1++] = c; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/980816-1.c b/gcc/testsuite/gcc.c-torture/compile/980816-1.c deleted file mode 100644 index c56b6c9b92c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/980816-1.c +++ /dev/null @@ -1,51 +0,0 @@ -typedef unsigned int size_t; -typedef void *XtPointer; - -typedef struct _WidgetRec *Widget; -typedef struct _WidgetClassRec *WidgetClass; - -extern WidgetClass commandWidgetClass; - -typedef void (*XtCallbackProc)( - Widget , - XtPointer , - XtPointer -); - -extern const char XtStrings[]; - - -typedef struct -{ - char *Name, - *Label; - XtCallbackProc Callback; - XtPointer ClientData; - Widget W; -} DialogButtonType, *DialogButtonTypePtr; - - -Widget AddButtons(Widget Parent, Widget Top, - DialogButtonTypePtr Buttons, size_t Count) -{ - int i; - - for (i = 0; i < Count; i++) - { - if (!Buttons[i].Label) - continue; - Buttons[i].W = XtVaCreateManagedWidget(Buttons[i].Name, - commandWidgetClass, - Parent, - ((char*)&XtStrings[429]) , Buttons[i].Label, - "fromHoriz" , i ? Buttons[i-1].W : ((void *)0) , - "fromVert" , Top, - "resizable" , 1 , - ((void *)0) ); - - XtAddCallback(((char*)&XtStrings[136]), - Buttons[i].Callback, Buttons[i].ClientData); - } - return(Buttons[Count-1].W); -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/980821-1.c b/gcc/testsuite/gcc.c-torture/compile/980821-1.c deleted file mode 100644 index 9eb1ac4ca1c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/980821-1.c +++ /dev/null @@ -1,15 +0,0 @@ -typedef int __int32_t; -int __kernel_rem_pio2(int prec) -{ - __int32_t i, jz; - double fw, fq[20]; - switch(prec) { - case 2: - fw = 0.0; - case 3: - for (i=jz;i>0;i--) { - fw = fq[i-1] +fq[i]; - fq[i-1] = fw; - } - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/980825-1.c b/gcc/testsuite/gcc.c-torture/compile/980825-1.c deleted file mode 100644 index 34e35bf83c4..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/980825-1.c +++ /dev/null @@ -1,30 +0,0 @@ -typedef enum { FALSE, TRUE } boolean; -enum _errorTypes { FATAL = 1, WARNING = 2, PERROR = 4 }; -typedef struct _optionValues { - struct _include { - boolean classNames; - boolean defines; - boolean enumerators; - } include; -} optionValues; -extern optionValues Option; -static void applyTagInclusionList( list ) - const char *const list; -{ - boolean mode = TRUE; - const char *p; - for (p = list ; *p != '\0' ; ++p) - switch (*p) - { - case '=': - clearTagList(); - mode = TRUE; - break; - case '+': mode = TRUE; break; - case '-': mode = FALSE; break; - case 'c': Option.include.classNames = mode; break; - case 'd': Option.include.defines = mode; break; - case 'e': Option.include.enumerators = mode; break; - default: error(FATAL, "-i: Invalid tag option '%c'", *p); break; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/981001-1.c b/gcc/testsuite/gcc.c-torture/compile/981001-1.c deleted file mode 100644 index d7cf0dc64b0..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/981001-1.c +++ /dev/null @@ -1,18 +0,0 @@ -unsigned short code = 0x0000; -unsigned short low = 0x4000; -unsigned short high = 0xb000; - -int main (void) -{ - if ( - (high & 0x8000) != (low & 0x8000) - && ( low & 0x4000) == 0x4000 - && (high & 0x4000) == 0 - ) - { - code ^= 0x4000; - low |= 0x4000; - } - - exit (0); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/981001-2.c b/gcc/testsuite/gcc.c-torture/compile/981001-2.c deleted file mode 100644 index 9ade1d92aef..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/981001-2.c +++ /dev/null @@ -1,12 +0,0 @@ -#define weak_alias(func, aliasname) \ - extern __typeof (func) aliasname __attribute__ ((weak, alias (#func))); - -#define add3(d, m, c) ((d) + (m) + (c)) - -int -__add3(int d, int m, int c) -{ - return d + m + c; -} - -weak_alias (__add3, add3) diff --git a/gcc/testsuite/gcc.c-torture/compile/981001-3.c b/gcc/testsuite/gcc.c-torture/compile/981001-3.c deleted file mode 100644 index 5f6458757ac..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/981001-3.c +++ /dev/null @@ -1,14 +0,0 @@ -#define P(a, b) P1(a,b) -#define P1(a,b) a##b - -#define FLT_MIN_EXP (-125) -#define DBL_MIN_EXP (-1021) - -#define MIN_EXP P(FLT,_MIN_EXP) - -#define FLT FLT -int f1 = MIN_EXP; - -#undef FLT -#define FLT DBL -int f2 = MIN_EXP; diff --git a/gcc/testsuite/gcc.c-torture/compile/981001-4.c b/gcc/testsuite/gcc.c-torture/compile/981001-4.c deleted file mode 100644 index dd3df9cce4b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/981001-4.c +++ /dev/null @@ -1,14 +0,0 @@ -#define P(a,b) P1(a,b) -#define P1(a,b) a##b - -#define ONCE(x, y) (x ?: (x = y())) -#define PREFIX - -extern int P(PREFIX, init) (void); - -int -fun(void) -{ - static int memo; - return ONCE(memo, P(PREFIX, init)); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/981006-1.c b/gcc/testsuite/gcc.c-torture/compile/981006-1.c deleted file mode 100644 index 6af6d9a8ea5..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/981006-1.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Test that tablejump insns are correctly handled. If the compiler - loses track of the jump targets, it will report that x and y can be - used uninitialized. - - This is broken in egcs 1998/10/06 for mips in pic mode. */ -/* { dg-do compile } */ - -int foo (int a, int b) -{ - __label__ z; - int x; /* { dg-bogus "warning: `.' might be used uninitialized in this function" } */ - int y; /* { dg-bogus "warning: `.' might be used uninitialized in this function" } */ - static void *p; - - switch (a) { - case 2: - x = 4; - break; - case 4: - x = 6; - break; - case 8: case 10: case 13: case 11: case 17: case 19: - x = 7; - break; - default: - x = -1; - break; - } - switch (b) { - case 2: - y = 4; - break; - case 4: - y = 6; - break; - case 8: case 10: case 13: case 11: case 17: case 19: - y = 7; - break; - default: - y = -1; - break; - } - z: - p = &&z; - return x * y; -} -int main (int argc, char *argv[]) -{ - return 1 == foo (argc, argc + 1); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/981006-1.x b/gcc/testsuite/gcc.c-torture/compile/981006-1.x deleted file mode 100644 index a27a67bcaee..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/981006-1.x +++ /dev/null @@ -1,20 +0,0 @@ -# For MIPS at least, pic is needed to trigger the problem. -if { [istarget rs6000-*-aix*] - || [istarget powerpc*-*-aix*] - || [istarget arm*-*-*] - || [istarget xscale-*-*] - || [istarget strongarm*-*-*] - || [istarget fr30-*-*] - || [istarget sh-*-hms] - || [istarget sh-*-coff] - || [istarget h8300*-*-*] - || [istarget mn10200*-*-*] - || [istarget cris-*-elf*] - || [istarget cris-*-aout*] - || [istarget mmix-*-*] -} { - set options "-Wuninitialized -Werror" -} else { - set options "-Wuninitialized -Werror -fpic" -} -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/981007-1.c b/gcc/testsuite/gcc.c-torture/compile/981007-1.c deleted file mode 100644 index d41400b7832..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/981007-1.c +++ /dev/null @@ -1,21 +0,0 @@ -extern double fabs (double); -extern double sqrt (double); - -typedef struct complexm { - double re,im; -} complex; - -static complex -setCom (double r, double i) -{ - complex ct; - ct.re=fabs(r)<1E-300?0.0:r; - ct.im=fabs(i)<1E-300?0.0:i; - return ct; -} - -static complex -csqrt_crash (double x) -{ - return (x>=0) ? setCom(sqrt(x),0) : setCom(0,sqrt(-x)); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/981022-1.c b/gcc/testsuite/gcc.c-torture/compile/981022-1.c deleted file mode 100644 index 6256673804a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/981022-1.c +++ /dev/null @@ -1,9 +0,0 @@ -/* This tests a combination of two gcc extensions. Omitting the middle - operand of ?: and using ?: as an lvalue. */ -int x, y; - -int main () -{ - (x ?: y) = 0; - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/981022-1.x b/gcc/testsuite/gcc.c-torture/compile/981022-1.x deleted file mode 100644 index f41cdc29913..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/981022-1.x +++ /dev/null @@ -1,2 +0,0 @@ -set torture_compile_xfail "*-*-*" -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/981107-1.c b/gcc/testsuite/gcc.c-torture/compile/981107-1.c deleted file mode 100644 index 987ec180f9f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/981107-1.c +++ /dev/null @@ -1,9 +0,0 @@ -unsigned long seed(void) -{ - unsigned long u; - - call(); - - u = 26107 * (unsigned long)&u; - return u; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/981223-1.c b/gcc/testsuite/gcc.c-torture/compile/981223-1.c deleted file mode 100644 index d207ff10bb3..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/981223-1.c +++ /dev/null @@ -1,8 +0,0 @@ -__complex__ float -func (__complex__ float x) -{ - if (__real__ x == 0.0) - return 1.0; - else - return 0.0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/981223-1.x b/gcc/testsuite/gcc.c-torture/compile/981223-1.x deleted file mode 100644 index f8d2aa6f938..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/981223-1.x +++ /dev/null @@ -1,20 +0,0 @@ -# The problem on IA-64 is that the assembler emits -# -# Warning: Additional NOP may be necessary to workaround Itanium -# processor A/B step errata -# -# This can be fixed by adding "-mb-step" to the command line, which -# does in fact add the extra nop, if someone can tell me how to do -# that for a c-torture compile test. - -set torture_eval_before_compile { - - set compiler_conditional_xfail_data { - "need -mb-step" \ - "ia64-*-*" \ - { "-O2" "-O3" "-Os" } \ - { "" } - } -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/990107-1.c b/gcc/testsuite/gcc.c-torture/compile/990107-1.c deleted file mode 100644 index a123ce9cbf3..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/990107-1.c +++ /dev/null @@ -1,7 +0,0 @@ -static int -java_double_finite (d) - double d; -{ - long long *ip = (long long *) &d; - return (*ip & 0x7ff0000000000000LL ) != 0x7ff0000000000000LL ; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/990117-1.c b/gcc/testsuite/gcc.c-torture/compile/990117-1.c deleted file mode 100644 index dda52205988..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/990117-1.c +++ /dev/null @@ -1,13 +0,0 @@ -static void -__bb_init_prg () -{ - const char *p; - - { - unsigned long l; - - (__extension__ (__builtin_constant_p (p) && __builtin_constant_p (l) - ? 5 : 2)); - } - -} diff --git a/gcc/testsuite/gcc.c-torture/compile/990203-1.c b/gcc/testsuite/gcc.c-torture/compile/990203-1.c deleted file mode 100644 index 2c69a8fe086..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/990203-1.c +++ /dev/null @@ -1,7 +0,0 @@ -int -f (f) - float f; -{ - long long *ip = (long long *) &f; - return (*ip & 0x7ff0000000000000LL ) != 0x7ff0000000000000LL ; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/990517-1.c b/gcc/testsuite/gcc.c-torture/compile/990517-1.c deleted file mode 100644 index c738d4be760..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/990517-1.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Extracted from the sdm module in perl. */ -typedef struct { - char *dptr; - int dsize; -} datum; -extern long sdbm_hash (char *, int) ; -extern void sdbm__putpair (char *, datum, datum) ; -void -sdbm__splpage (char *pag, char *New, long int sbit) -{ - datum key; - datum val; - register int n; - register int off = 1024 ; - char cur[1024 ]; - register short *ino = (short *) cur; - (void) memcpy(cur, pag, 1024 ); - (void) ({ void *__s = ( pag ); __builtin_memset ( __s , '\0', 1024 ) ; __s; }); - (void) ({ void *__s = ( New ); __builtin_memset ( __s , '\0', 1024 ) ; __s; }); - n = ino[0]; - for (ino++; n > 0; ino += 2) { - key.dptr = cur + ino[0]; - key.dsize = off - ino[0]; - val.dptr = cur + ino[1]; - val.dsize = ino[0] - ino[1]; - (void) sdbm__putpair ((sdbm_hash(( key ).dptr, ( key ).dsize) & sbit) ? New : pag, key, val); - off = ino[1]; - n -= 2; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/990519-1.c b/gcc/testsuite/gcc.c-torture/compile/990519-1.c deleted file mode 100644 index 9c116178230..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/990519-1.c +++ /dev/null @@ -1,10 +0,0 @@ - typedef int gboolean; - - typedef struct{ - gboolean names : 1; - gboolean types : 1; - } ParamOptions; - - int p_param(ParamOptions* o){ - return o->types && o->names; - } diff --git a/gcc/testsuite/gcc.c-torture/compile/990523-1.c b/gcc/testsuite/gcc.c-torture/compile/990523-1.c deleted file mode 100644 index 5ab61f36c65..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/990523-1.c +++ /dev/null @@ -1,30 +0,0 @@ -extern float decwin[512+32]; - -int synth_1to1(float *bandPtr,int channel,unsigned char *out,int *pnt) -{ - static const int step = 2; - short *samples = (short *) (out+*pnt); - - float *b0; - int clip = 0; - int bo1; - - { - register int j; - float *window = decwin + 16 - bo1; - for (j=15;j;j--,b0-=0x20,window-=0x10,samples+=step) - { - float sum; - sum -= *(--window) * *b0++; - sum -= *(--window) * *b0++; - sum -= *(--window) * *b0++; - sum -= *(--window) * *b0++; - sum -= *(--window) * *b0++; - sum -= *(--window) * *b0++; - sum -= *(--window) * *b0++; - sum -= *(--window) * *b0++; - - if( ( sum ) > 32767.0) *( samples ) = 0x7fff; ( clip )++; ; - } - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/990527-1.c b/gcc/testsuite/gcc.c-torture/compile/990527-1.c deleted file mode 100644 index 4744030307a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/990527-1.c +++ /dev/null @@ -1,37 +0,0 @@ -typedef struct { - int dummy; - int width, height; -} XWindowAttributes; - -typedef struct { - short x, y; -} XPoint; - -extern unsigned int ya_random (void); -extern int XDrawPoints(XPoint*, int); - -static int iterations, offset; -static int xsym, ysym; - -static void -hurm (void) -{ - XWindowAttributes xgwa; - int xlim, ylim, x, y, i; - XPoint points [4]; - - - for (i = 0; i < iterations; i++) - { - int j = 0; - j++; - if (xsym) - { - points [j].x = xlim - x; - j++; - } - points [j].x = x; - j++; - } -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/990617-1.c b/gcc/testsuite/gcc.c-torture/compile/990617-1.c deleted file mode 100644 index 1404b793505..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/990617-1.c +++ /dev/null @@ -1,17 +0,0 @@ - -int main() -{ - do { - long l; - long *p = &l; - - *p = 0x0000000070000000L; - p += 2; - { - unsigned int *addr = (unsigned int *)0x70000000; - printf("%d, %d\n", addr[1], addr[0]); - } - - } while (1); -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/990617-1.x b/gcc/testsuite/gcc.c-torture/compile/990617-1.x deleted file mode 100644 index b326395523b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/990617-1.x +++ /dev/null @@ -1,7 +0,0 @@ -# 0x70000000 is too large a constant to become a pointer on xstormy16. - -if { [istarget "xstormy16-*-*"] } { - return 1; -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/990625-1.c b/gcc/testsuite/gcc.c-torture/compile/990625-1.c deleted file mode 100644 index 97a2331c7a5..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/990625-1.c +++ /dev/null @@ -1,12 +0,0 @@ -#define __USE_STRING_INLINES -#include <string.h> - -void test() -{ - char *p, *a; - const char *s; - - while ( (s = a) ) - p = strcpy(strcpy(p,"/"), s); -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/990625-2.c b/gcc/testsuite/gcc.c-torture/compile/990625-2.c deleted file mode 100644 index 92c33742b85..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/990625-2.c +++ /dev/null @@ -1,12 +0,0 @@ -void -broken030599(int *n) -{ - int i, x; - for (i = 0; i < 32; i++) { - x=0; - x++; - if (i & 4) - x++; - x++; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/990801-1.c b/gcc/testsuite/gcc.c-torture/compile/990801-1.c deleted file mode 100644 index d35ec87b948..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/990801-1.c +++ /dev/null @@ -1,26 +0,0 @@ -extern int getch(); -extern int class(); - -int -token() -{ - int state = 1; - - while (1) { - int c=0; - c = getch(); - switch (state) { - case 1: break; - case 4: break; - case 5: break; - case 6: - { - switch (class(c)) { - default: break; - } - } break; - case 7: break; - } - } -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/990801-2.c b/gcc/testsuite/gcc.c-torture/compile/990801-2.c deleted file mode 100644 index 0a575ea17aa..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/990801-2.c +++ /dev/null @@ -1,11 +0,0 @@ -void f() -{ - extern char* p; - int ch; - while (!(ch = 0)) { - if ((ch == 0) || (ch == 2)) { - break; - } - *p = 0; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/990829-1.c b/gcc/testsuite/gcc.c-torture/compile/990829-1.c deleted file mode 100644 index 2252821938e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/990829-1.c +++ /dev/null @@ -1,13 +0,0 @@ -struct x -{ - int a:16; - int b:16; - int c; -}; - -bar() -{ - struct x y; - y.b = 1 < y.a; - foo(&y); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/990913-1.c b/gcc/testsuite/gcc.c-torture/compile/990913-1.c deleted file mode 100644 index cad31a02203..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/990913-1.c +++ /dev/null @@ -1,10 +0,0 @@ - -int f() -{ - unsigned char hrs, min; - - min = ((min / 10) << 4) + min % 10; - hrs = ((hrs / 10) << 4) + hrs % 10; - - return hrs + min; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/990928-1.c b/gcc/testsuite/gcc.c-torture/compile/990928-1.c deleted file mode 100644 index 5658e360567..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/990928-1.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Make sure that debug information can be generated - for inline functions containing incomplete type - declarations. */ -inline int foo (void) -{ - struct imcomplete1 * ptr1; - union incomplete2 * ptr2; - enum incomplete3 * ptr3; - return 1; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/991008-1.c b/gcc/testsuite/gcc.c-torture/compile/991008-1.c deleted file mode 100644 index ba668fe25b2..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/991008-1.c +++ /dev/null @@ -1,23 +0,0 @@ -typedef struct { - int x; -} FILE; -extern void fputs (const char *, FILE *); - -int mView; -void foo (FILE * out, int aIndent) -{ - if (0 != mView) { - aIndent++; - aIndent--; - { - int __t = aIndent; - while (--__t >= 0) - fputs (" ", out); - } - - } { - int __t = aIndent; - while (--__t >= 0) - fputs (" ", out); - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/991026-1.c b/gcc/testsuite/gcc.c-torture/compile/991026-1.c deleted file mode 100644 index 191742112bd..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/991026-1.c +++ /dev/null @@ -1,13 +0,0 @@ -void something_f(float); - -int foo(void) -{ - union - { - float f; - double d; - } u, *pu = &u; - - u.f = 1.0; - something_f(u.f); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/991026-2.c b/gcc/testsuite/gcc.c-torture/compile/991026-2.c deleted file mode 100644 index bb358f411ec..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/991026-2.c +++ /dev/null @@ -1,33 +0,0 @@ -typedef int __pid_t; -extern __pid_t fork (void) ; -extern int printf (__const char *__restrict __format, ...) ; -extern char *strerror (int __errnum) ; -extern int errno; -extern int *__errno_location (void) __attribute__ ((__const__)); -extern void _exit (int __status) __attribute__ ((__noreturn__)); -extern void exit (int __status) __attribute__ ((__noreturn__)); -extern int close (int __fd) ; -extern int dup (int __fd) ; -extern int open (__const char *__file, int __oflag, ...) ; - - -char myname[]="foo"; - -detach() -{ - switch(fork()) { - case -1: - printf("%s: Error: fork - %s\n",myname, strerror((*__errno_location ()) )); - exit(255); - case 0: - - close(0); - close(1); - close(2); - dup(dup(open("/dev/null", 02 ))); - return; - default: - - _exit(0); - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/991127-1.c b/gcc/testsuite/gcc.c-torture/compile/991127-1.c deleted file mode 100644 index 86098d883a5..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/991127-1.c +++ /dev/null @@ -1,12 +0,0 @@ - -extern void foo (int *); - -static void bar (char *buf) -{ - int a; - foo (&a); - while (a > 0) { - *buf++ = '0'; - a--; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/991202-1.c b/gcc/testsuite/gcc.c-torture/compile/991202-1.c deleted file mode 100644 index cc4f478f520..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/991202-1.c +++ /dev/null @@ -1,18 +0,0 @@ -extern float A[], B[]; -extern float MAXNUMF; -float chbevlf(float, float *, int); -float expf(float), i1f(float), logf(float), sqrtf(float); - -float k1f(float xx) -{ - float x, y; - - x = xx; - if( x <= 2.0 ) - { - y = x * x - 2.0; - y = logf( 0.5f * x ) * i1f(x) + chbevlf( y, A, 7 ) / x; - return( y ); - } - return( expf(-x) * chbevlf( (float)(8.0/x - 2.0), B, 10 ) / sqrtf(x) ); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/991208-1.c b/gcc/testsuite/gcc.c-torture/compile/991208-1.c deleted file mode 100644 index 1bee1e84b37..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/991208-1.c +++ /dev/null @@ -1,4 +0,0 @@ -void fn (char *ptr) -{ - void *p = ptr - 8 - 4; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/991213-1.c b/gcc/testsuite/gcc.c-torture/compile/991213-1.c deleted file mode 100644 index 4803d13915f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/991213-1.c +++ /dev/null @@ -1,13 +0,0 @@ -typedef __complex__ double double_complex; - - - -void -p (const double_complex *t, int n) -{ - int i; - double s = ({ typeof ( t[n/2] ) arg = ( t[n/2] ); (__imag__ arg); }) ; - for (i = 1; i < n/2; i++) - s += 2* ({ typeof ( t[i] ) arg = ( t[i] ); (__imag__ arg); }) ; -} - diff --git a/gcc/testsuite/gcc.c-torture/compile/991213-2.c b/gcc/testsuite/gcc.c-torture/compile/991213-2.c deleted file mode 100644 index 98385d56263..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/991213-2.c +++ /dev/null @@ -1,15 +0,0 @@ -typedef long __kernel_time_t; -typedef __kernel_time_t time_t; -time2( - void (* const (funcp)(time_t)), - const long offset, int * const okayp) -{ - register int bits; - time_t t; - for (bits = 0, t = 1; t > 0; ++bits, t <<= 1) - ; - t = (t < 0) ? 0 : ((time_t) 1 << bits); - for ( ; ; ) { - (*funcp)((time_t)&t); - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/991213-3.c b/gcc/testsuite/gcc.c-torture/compile/991213-3.c deleted file mode 100644 index ce8347f5ddf..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/991213-3.c +++ /dev/null @@ -1,2 +0,0 @@ -int jump () { goto * (int (*) ()) 0xbabebec0; } - diff --git a/gcc/testsuite/gcc.c-torture/compile/991214-1.c b/gcc/testsuite/gcc.c-torture/compile/991214-1.c deleted file mode 100644 index 2748a15af84..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/991214-1.c +++ /dev/null @@ -1,11 +0,0 @@ -void foo(double bar[], double *zp, int n) -{ - int i, j; - - i = 0; - for(j = 0; j < n; j++) - { - i += j+1; - bar[i] *= (1.0 + *zp); - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/991214-2.c b/gcc/testsuite/gcc.c-torture/compile/991214-2.c deleted file mode 100644 index 3e18d215e13..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/991214-2.c +++ /dev/null @@ -1,28 +0,0 @@ -#if defined(STACK_SIZE) && (STACK_SIZE < 65536) -# define HISTO_SIZE 9 -#else -# define HISTO_SIZE 36 -#endif - -extern int N; -extern int nrows; -extern int or_num_angles; - -typedef struct -{ - double value; - int count; -}Histo; - -Histo add_histo[10][2][HISTO_SIZE][HISTO_SIZE]; - -void cmd_connection_statistics( ) -{ - int i,j,k,m; - - for(i=0; i<nrows; i++){ - for(j=0; j< 2; j++) - for(k=0; k< or_num_angles; k++) - ; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/991229-1.c b/gcc/testsuite/gcc.c-torture/compile/991229-1.c deleted file mode 100644 index d11fd91fcbd..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/991229-1.c +++ /dev/null @@ -1,23 +0,0 @@ -static int parse (int, int); -static int parseStmt (int, int); - -ejEval() -{ - int state; - state = parse(8 , 0x1 ); -} -static int parse(int state, int flags) -{ - switch (state) { - case 8 : - case 18 : - case 6 : - case 2 : - state = parseStmt(state, flags); - break; - } -} -static int parseStmt(int state, int flags) -{ - parse (2, flags); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/991229-2.c b/gcc/testsuite/gcc.c-torture/compile/991229-2.c deleted file mode 100644 index 0c562199f68..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/991229-2.c +++ /dev/null @@ -1,10 +0,0 @@ -void foo (); - -void update (double* r) -{ - foo (); - { - register double y1; - y1 = r[ 4] - r[11]; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/991229-3.c b/gcc/testsuite/gcc.c-torture/compile/991229-3.c deleted file mode 100644 index 710e4c99593..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/991229-3.c +++ /dev/null @@ -1,17 +0,0 @@ -int m[8],b[8]; - -int main(){ - int i; - - for(;;){ - m[0] = rand(); - if(m[0] == 0){ - for(i=0;i<8;i++){ - m[i] = b[i]; - } - break; - } - } -} - - diff --git a/gcc/testsuite/gcc.c-torture/compile/calls.c b/gcc/testsuite/gcc.c-torture/compile/calls.c deleted file mode 100644 index 1582c0e92fa..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/calls.c +++ /dev/null @@ -1,22 +0,0 @@ -typedef void *(*T)(void); -f1 () -{ - ((T) 0)(); -} -f2 () -{ - ((T) 1000)(); -} -f3 () -{ - ((T) 10000000)(); -} -f4 (r) -{ - ((T) r)(); -} -f5 () -{ - int (*r)() = f3; - ((T) r)(); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/cmpdi-1.c b/gcc/testsuite/gcc.c-torture/compile/cmpdi-1.c deleted file mode 100644 index 9e1b659c7cf..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/cmpdi-1.c +++ /dev/null @@ -1,15 +0,0 @@ -f (long long d) -{ - int i = 0; - if (d == 1) - i = 1; - return i; -} - -g (long long d) -{ - int i = 0; - if (d <= 0) - i = 1; - return i; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/combine-hang.c b/gcc/testsuite/gcc.c-torture/compile/combine-hang.c deleted file mode 100644 index 7cc57afe603..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/combine-hang.c +++ /dev/null @@ -1,26 +0,0 @@ -typedef union -{ - double value; - struct - { - unsigned long msw; - unsigned long lsw; - } parts; -} ieee_double_shape_type; - -double f (int iy) -{ - double z, t; - ieee_double_shape_type u, v; - - if (iy == 1) - return 0; - - u.parts.msw = iy; - u.parts.lsw = 0; - z = u.value; - v.parts.msw = iy; - v.parts.lsw = 0; - t = v.value; - return 1.0+z+t+t; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/compile.exp b/gcc/testsuite/gcc.c-torture/compile/compile.exp deleted file mode 100644 index 1b075a8b798..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/compile.exp +++ /dev/null @@ -1,35 +0,0 @@ -# Expect driver script for GCC Regression Tests -# Copyright (C) 1993, 1995, 1997 Free Software Foundation -# -# This file 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 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# These tests come from Torbjorn Granlund's (tege@cygnus.com) -# C torture test suite, and other contributors. - -if $tracelevel then { - strace $tracelevel -} - -# load support procs -load_lib c-torture.exp - -foreach testcase [glob -nocomplain $srcdir/$subdir/*.c] { - # If we're only testing specific files and this isn't one of them, skip it. - if ![runtest_file_p $runtests $testcase] then { - continue - } - - c-torture $testcase -} diff --git a/gcc/testsuite/gcc.c-torture/compile/cpp-1.c b/gcc/testsuite/gcc.c-torture/compile/cpp-1.c deleted file mode 100644 index 09d49bc61fd..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/cpp-1.c +++ /dev/null @@ -1,8 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation. - - by Alexandre Oliva <oliva@lsd.ic.unicamp.br> */ - -#define foo/**/1 -#if foo != 1 -# error "foo not properly defined" -#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/cpp-2.c b/gcc/testsuite/gcc.c-torture/compile/cpp-2.c deleted file mode 100644 index ae9425f09f4..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/cpp-2.c +++ /dev/null @@ -1,5 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation. - - by Alexandre Oliva <oliva@lsd.ic.unicamp.br> */ - -#pragma /* the token after #pragma is optional. */ diff --git a/gcc/testsuite/gcc.c-torture/compile/dll.c b/gcc/testsuite/gcc.c-torture/compile/dll.c deleted file mode 100644 index bf0d1544ad0..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/dll.c +++ /dev/null @@ -1,21 +0,0 @@ -__declspec (dllimport) int foo; -extern int (* import) (void) __attribute__((dllimport)); -int func2 (void) __attribute__((dllexport)); - -__declspec(dllexport) int -func1 (int a) -{ - return a + foo; -} - -static int -internal (void) -{ - return 77; -} - -int -func2 (void) -{ - return import (); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/dll.x b/gcc/testsuite/gcc.c-torture/compile/dll.x deleted file mode 100644 index 63a1e180e2c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/dll.x +++ /dev/null @@ -1,20 +0,0 @@ -# This test examines the attribute support for DLLs. -# Only COFF/PE formats support DLLs, (plus, as a special case -# the mcore-elf toolchain), so the code here tries to determine -# the file format and decide whether the test should be marked -# as unsupported. - -set torture_eval_before_compile { - - if ![istarget "mcore-*-elf"] { - - set objformat [gcc_target_object_format] - - if { $objformat != "pe" } { - unsupported "dll.c" - return 1 - } - } -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/funcptr-1.c b/gcc/testsuite/gcc.c-torture/compile/funcptr-1.c deleted file mode 100644 index 79687c9c005..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/funcptr-1.c +++ /dev/null @@ -1,19 +0,0 @@ -extern int (*gp)(const char*); - -int -g (const char* d) -{ - printf ("g"); - return 0; -} - -f () -{ - int errcnt=0; - - if (gp != g) - { - printf ("f"); - errcnt++; - } -} diff --git a/gcc/testsuite/gcc.c-torture/compile/goto-1.c b/gcc/testsuite/gcc.c-torture/compile/goto-1.c deleted file mode 100644 index caeed3aa0ba..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/goto-1.c +++ /dev/null @@ -1,16 +0,0 @@ -f () -{ - do - { - if (0) - { - L1:; - } - else - goto L2; - L2:; - } - while (0); - - goto L1; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/iftrap-1.c b/gcc/testsuite/gcc.c-torture/compile/iftrap-1.c deleted file mode 100644 index a0adc78cf82..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/iftrap-1.c +++ /dev/null @@ -1,99 +0,0 @@ -/* Verify that ifcvt doesn't crash under a number of interesting conditions. */ - -void f1(int p) -{ - if (p) - __builtin_trap(); -} - -void f2(int p) -{ - if (p) - __builtin_trap(); - else - bar(); -} - -void f3(int p) -{ - if (p) - bar(); - else - __builtin_trap(); -} - -void f4(int p, int q) -{ - if (p) - { - bar(); - if (q) - bar(); - } - else - __builtin_trap(); -} - -void f5(int p) -{ - if (p) - __builtin_trap(); - else - abort(); -} - -void f6(int p) -{ - if (p) - abort(); - else - __builtin_trap(); -} - -void f7(int p) -{ - if (p) - __builtin_trap(); - else - __builtin_trap(); -} - -void f8(int p) -{ - if (p) - __builtin_trap(); - else - { - bar(); - __builtin_trap(); - } -} - -void f9(int p) -{ - if (p) - { - bar(); - __builtin_trap(); - } - else - __builtin_trap(); -} - -void f10(int p) -{ - if (p) - __builtin_trap(); - while (1) - bar(); -} - -void f11(int p) -{ - if (p) - __builtin_trap(); - else - bar(); - while (1) - baz(); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/iftrap-2.c b/gcc/testsuite/gcc.c-torture/compile/iftrap-2.c deleted file mode 100644 index bb7bb5726b1..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/iftrap-2.c +++ /dev/null @@ -1,10 +0,0 @@ -void foo(int p, int q) -{ - if (p) - { - if (q) - __builtin_trap (); - } - else - bar(); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/init-1.c b/gcc/testsuite/gcc.c-torture/compile/init-1.c deleted file mode 100644 index 38db9ad87d9..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/init-1.c +++ /dev/null @@ -1,19 +0,0 @@ -typedef struct -{ - char *key; - char *value; -} T1; - -typedef struct -{ - long type; - char *value; -} T3; - -T1 a[] = -{ - { - "", - ((char *)&((T3) {1, (char *) 1})) - } -}; diff --git a/gcc/testsuite/gcc.c-torture/compile/init-2.c b/gcc/testsuite/gcc.c-torture/compile/init-2.c deleted file mode 100644 index 63a7f5849d6..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/init-2.c +++ /dev/null @@ -1,4 +0,0 @@ -struct -{ - int e1, e2; -} v = { e2: 0 }; diff --git a/gcc/testsuite/gcc.c-torture/compile/init-3.c b/gcc/testsuite/gcc.c-torture/compile/init-3.c deleted file mode 100644 index be3d9b49679..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/init-3.c +++ /dev/null @@ -1,11 +0,0 @@ -struct empty { }; -struct something { - int spacer; - struct empty foo; - int bar; -}; - -struct something X = { - foo: { }, - bar: 1, -}; diff --git a/gcc/testsuite/gcc.c-torture/compile/labels-1.c b/gcc/testsuite/gcc.c-torture/compile/labels-1.c deleted file mode 100644 index fae6ab8f400..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/labels-1.c +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef NO_LABEL_VALUES -f () -{ - void *x = &&L2; - if (&&L3 - &&L1 > 1) - abort(); - L1: return 1; - L2: abort (); - L3:; -} -#else -int x; -#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/labels-2.c b/gcc/testsuite/gcc.c-torture/compile/labels-2.c deleted file mode 100644 index cf4f116e6a8..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/labels-2.c +++ /dev/null @@ -1,10 +0,0 @@ -struct bp { void *v, *b, *e; }; -f () -{ - struct bp x = { &&L2 }; - if (&&L3 - &&L1 > 1) - abort (); -L1:return 1; -L2:abort (); -L3:; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/labels-3.c b/gcc/testsuite/gcc.c-torture/compile/labels-3.c deleted file mode 100644 index 51ac88380b8..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/labels-3.c +++ /dev/null @@ -1,12 +0,0 @@ -/* Verify that we can narrow the storage associated with label diffs. */ - -int foo (int a) -{ - static const short ar[] = { &&l1 - &&l1, &&l2 - &&l1 }; - void *p = &&l1 + ar[a]; - goto *p; - l1: - return 1; - l2: - return 2; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/labels-3.x b/gcc/testsuite/gcc.c-torture/compile/labels-3.x deleted file mode 100644 index e9b4118ff44..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/labels-3.x +++ /dev/null @@ -1,7 +0,0 @@ -# This test does not compile on mips-irix6 using the native assembler, -# though it does work with gas. See PR6200. Since we cannot (???) -# distinguish which assembler is being used, always pass -S for irix. - -if { [istarget "mips*-*-irix*"] } { set options "-S" } - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-1.c b/gcc/testsuite/gcc.c-torture/compile/mipscop-1.c deleted file mode 100644 index 13be5142d94..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/mipscop-1.c +++ /dev/null @@ -1,10 +0,0 @@ -register unsigned int cp0count asm ("$c0r1"); - -int -main (int argc, char *argv[]) -{ - unsigned int d; - - d = cp0count + 3; - printf ("%d\n", d); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-1.x b/gcc/testsuite/gcc.c-torture/compile/mipscop-1.x deleted file mode 100644 index 66601ea91f1..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/mipscop-1.x +++ /dev/null @@ -1,10 +0,0 @@ -global target_triplet - -if { ![istarget "*mips*"] } { - return 1 -} else { - set torture_compile_xfail "$target_triplet" -} - -return 0 - diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-2.c b/gcc/testsuite/gcc.c-torture/compile/mipscop-2.c deleted file mode 100644 index 88e95db12cc..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/mipscop-2.c +++ /dev/null @@ -1,16 +0,0 @@ -register unsigned int c3r1 asm ("$c3r1"); - -extern unsigned int b, c; - -void -foo () -{ - unsigned int a, d; - - c3r1 = a; - b = c3r1; - - c3r1 = c; - d = c3r1; - printf ("%d\n", d); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-2.x b/gcc/testsuite/gcc.c-torture/compile/mipscop-2.x deleted file mode 100644 index 66601ea91f1..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/mipscop-2.x +++ /dev/null @@ -1,10 +0,0 @@ -global target_triplet - -if { ![istarget "*mips*"] } { - return 1 -} else { - set torture_compile_xfail "$target_triplet" -} - -return 0 - diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-3.c b/gcc/testsuite/gcc.c-torture/compile/mipscop-3.c deleted file mode 100644 index eb602c8a54f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/mipscop-3.c +++ /dev/null @@ -1,16 +0,0 @@ -register unsigned int c3r1 asm ("$c3r1"), c3r2 asm ("$c3r2"); - -extern unsigned int b, c; - -void -foo () -{ - unsigned int a, d; - - c3r1 = a; - b = c3r1; - - c3r2 = c; - d = c3r1; - printf ("%d\n", d); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-3.x b/gcc/testsuite/gcc.c-torture/compile/mipscop-3.x deleted file mode 100644 index 66601ea91f1..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/mipscop-3.x +++ /dev/null @@ -1,10 +0,0 @@ -global target_triplet - -if { ![istarget "*mips*"] } { - return 1 -} else { - set torture_compile_xfail "$target_triplet" -} - -return 0 - diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-4.c b/gcc/testsuite/gcc.c-torture/compile/mipscop-4.c deleted file mode 100644 index 368db5e90dc..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/mipscop-4.c +++ /dev/null @@ -1,16 +0,0 @@ -register unsigned long c3r1 asm ("$c3r1"), c3r2 asm ("$c3r2"); - -extern unsigned long b, c; - -void -foo () -{ - unsigned long a, d; - - c3r1 = a; - b = c3r1; - - c3r2 = c; - d = c3r1; - printf ("%d\n", d); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-4.x b/gcc/testsuite/gcc.c-torture/compile/mipscop-4.x deleted file mode 100644 index 66601ea91f1..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/mipscop-4.x +++ /dev/null @@ -1,10 +0,0 @@ -global target_triplet - -if { ![istarget "*mips*"] } { - return 1 -} else { - set torture_compile_xfail "$target_triplet" -} - -return 0 - diff --git a/gcc/testsuite/gcc.c-torture/compile/packed-1.c b/gcc/testsuite/gcc.c-torture/compile/packed-1.c deleted file mode 100644 index 709fc3cb102..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/packed-1.c +++ /dev/null @@ -1,14 +0,0 @@ -struct s -{ - int e; -} x; - -struct rbuf -{ - struct s *p __attribute__ ((packed)); -} *b; - -f () -{ - b->p = &x; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-1.c b/gcc/testsuite/gcc.c-torture/compile/simd-1.c deleted file mode 100644 index c113bd4fa2d..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/simd-1.c +++ /dev/null @@ -1,7 +0,0 @@ -typedef int v2si __attribute__ ((mode(V2SI))); -typedef unsigned di __attribute__ ((mode(DI))); -void foo(unsigned long); -void bar() { - v2si x = { 1, 2 }; - foo((di) x); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-2.c b/gcc/testsuite/gcc.c-torture/compile/simd-2.c deleted file mode 100644 index 694e94f0105..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/simd-2.c +++ /dev/null @@ -1,17 +0,0 @@ -typedef float floatvect2 __attribute__((mode(V2SF))); - -typedef union -{ - floatvect2 vector; - float f[2]; -}resfloatvect2; - -void tempf(float *x, float *y) -{ - floatvect2 temp={x[0],x[1]}; - floatvect2 temp1={y[0],y[1]}; - resfloatvect2 temp2; - temp2.vector=temp+temp1; - x[0]=temp2.f[0]; - x[1]=temp2.f[1]; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-3.c b/gcc/testsuite/gcc.c-torture/compile/simd-3.c deleted file mode 100644 index f7dc54ebf8b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/simd-3.c +++ /dev/null @@ -1,23 +0,0 @@ -#include <float.h> - -/* If double is not wider than float, we probably don't have DFmode, - or at least it's not as wide as double. */ -#if DBL_MANT_DIG > FLT_MANT_DIG -typedef float floatvect2 __attribute__((mode(V2DF))); - -typedef union -{ - floatvect2 vector; - double f[2]; -}resfloatvect2; - -void tempf(double *x, double *y) -{ - floatvect2 temp={x[0],x[1]}; - floatvect2 temp1={y[0],y[1]}; - resfloatvect2 temp2; - temp2.vector=temp+temp1; - x[0]=temp2.f[0]; - x[1]=temp2.f[1]; -} -#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-4.c b/gcc/testsuite/gcc.c-torture/compile/simd-4.c deleted file mode 100644 index 6ede943c47d..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/simd-4.c +++ /dev/null @@ -1,15 +0,0 @@ -typedef float floatvect2 __attribute__((mode(V4SF))); - -typedef union -{ - floatvect2 vector; - float f[2]; -}resfloatvect2; - -void tempf(floatvect2 *x, floatvect2 *y) -{ - floatvect2 temp= *x; - floatvect2 temp1=*y; - resfloatvect2 temp2; - *x=temp+temp1; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-5.c b/gcc/testsuite/gcc.c-torture/compile/simd-5.c deleted file mode 100644 index 016cccd1e9f..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/simd-5.c +++ /dev/null @@ -1,12 +0,0 @@ -#define vector64 __attribute__((vector_size(8))) - -main(){ - - vector64 int c; -vector64 int a = {1, -1}; -vector64 int b = {2, -2}; -c = -a + b*b*(-1LL); -/* c is now {5, 3} */ - - printf("result is %llx\n", (long long)c); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-5.x b/gcc/testsuite/gcc.c-torture/compile/simd-5.x deleted file mode 100644 index b7612f78787..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/simd-5.x +++ /dev/null @@ -1,6 +0,0 @@ -# h8300 does not have long long -if { [istarget "h8300-*-*"] } { - return 1; -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/structs.c b/gcc/testsuite/gcc.c-torture/compile/structs.c deleted file mode 100644 index 356f0729f1e..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/structs.c +++ /dev/null @@ -1,263 +0,0 @@ -/* Copyright 1996, 1999 Free Software Foundation, Inc. - - 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 2 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - Please email any bugs, comments, and/or additions to this file to: - bug-gdb@prep.ai.mit.edu */ - -struct struct1 { char a;}; -struct struct2 { char a, b;}; -struct struct3 { char a, b, c; }; -struct struct4 { char a, b, c, d; }; -struct struct5 { char a, b, c, d, e; }; -struct struct6 { char a, b, c, d, e, f; }; -struct struct7 { char a, b, c, d, e, f, g; }; -struct struct8 { char a, b, c, d, e, f, g, h; }; -struct struct9 { char a, b, c, d, e, f, g, h, i; }; -struct struct10 { char a, b, c, d, e, f, g, h, i, j; }; -struct struct11 { char a, b, c, d, e, f, g, h, i, j, k; }; -struct struct12 { char a, b, c, d, e, f, g, h, i, j, k, l; }; -struct struct16 { char a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p; }; - -struct struct1 foo1 = {'1'}, L1; -struct struct2 foo2 = { 'a', 'b'}, L2; -struct struct3 foo3 = { 'A', 'B', 'C'}, L3; -struct struct4 foo4 = {'1', '2', '3', '4'}, L4; -struct struct5 foo5 = {'a', 'b', 'c', 'd', 'e'}, L5; -struct struct6 foo6 = {'A', 'B', 'C', 'D', 'E', 'F'}, L6; -struct struct7 foo7 = {'1', '2', '3', '4', '5', '6', '7'}, L7; -struct struct8 foo8 = {'1', '2', '3', '4', '5', '6', '7', '8'}, L8; -struct struct9 foo9 = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'}, L9; -struct struct10 foo10 = { - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'}, L10; -struct struct11 foo11 = { - '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B'}, L11; -struct struct12 foo12 = { - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L'}, L12; -struct struct16 foo16 = { - 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p'}, L16; - -struct struct1 fun1() -{ - return foo1; -} -struct struct2 fun2() -{ - return foo2; -} -struct struct3 fun3() -{ - return foo3; -} -struct struct4 fun4() -{ - return foo4; -} -struct struct5 fun5() -{ - return foo5; -} -struct struct6 fun6() -{ - return foo6; -} -struct struct7 fun7() -{ - return foo7; -} -struct struct8 fun8() -{ - return foo8; -} -struct struct9 fun9() -{ - return foo9; -} -struct struct10 fun10() -{ - return foo10; -} -struct struct11 fun11() -{ - return foo11; -} -struct struct12 fun12() -{ - return foo12; -} -struct struct16 fun16() -{ - return foo16; -} - -#ifdef PROTOTYPES -void Fun1(struct struct1 foo1) -#else -void Fun1(foo1) - struct struct1 foo1; -#endif -{ - L1 = foo1; -} -#ifdef PROTOTYPES -void Fun2(struct struct2 foo2) -#else -void Fun2(foo2) - struct struct2 foo2; -#endif -{ - L2 = foo2; -} -#ifdef PROTOTYPES -void Fun3(struct struct3 foo3) -#else -void Fun3(foo3) - struct struct3 foo3; -#endif -{ - L3 = foo3; -} -#ifdef PROTOTYPES -void Fun4(struct struct4 foo4) -#else -void Fun4(foo4) - struct struct4 foo4; -#endif -{ - L4 = foo4; -} -#ifdef PROTOTYPES -void Fun5(struct struct5 foo5) -#else -void Fun5(foo5) - struct struct5 foo5; -#endif -{ - L5 = foo5; -} -#ifdef PROTOTYPES -void Fun6(struct struct6 foo6) -#else -void Fun6(foo6) - struct struct6 foo6; -#endif -{ - L6 = foo6; -} -#ifdef PROTOTYPES -void Fun7(struct struct7 foo7) -#else -void Fun7(foo7) - struct struct7 foo7; -#endif -{ - L7 = foo7; -} -#ifdef PROTOTYPES -void Fun8(struct struct8 foo8) -#else -void Fun8(foo8) - struct struct8 foo8; -#endif -{ - L8 = foo8; -} -#ifdef PROTOTYPES -void Fun9(struct struct9 foo9) -#else -void Fun9(foo9) - struct struct9 foo9; -#endif -{ - L9 = foo9; -} -#ifdef PROTOTYPES -void Fun10(struct struct10 foo10) -#else -void Fun10(foo10) - struct struct10 foo10; -#endif -{ - L10 = foo10; -} -#ifdef PROTOTYPES -void Fun11(struct struct11 foo11) -#else -void Fun11(foo11) - struct struct11 foo11; -#endif -{ - L11 = foo11; -} -#ifdef PROTOTYPES -void Fun12(struct struct12 foo12) -#else -void Fun12(foo12) - struct struct12 foo12; -#endif -{ - L12 = foo12; -} -#ifdef PROTOTYPES -void Fun16(struct struct16 foo16) -#else -void Fun16(foo16) - struct struct16 foo16; -#endif -{ - L16 = foo16; -} - -int main() -{ -#ifdef usestubs - set_debug_traps(); - breakpoint(); -#endif - - /* TEST C FUNCTIONS */ - L1 = fun1(); - L2 = fun2(); - L3 = fun3(); - L4 = fun4(); - L5 = fun5(); - L6 = fun6(); - L7 = fun7(); - L8 = fun8(); - L9 = fun9(); - L10 = fun10(); - L11 = fun11(); - L12 = fun12(); - L16 = fun16(); - - foo1.a = foo2.a = foo3.a = foo4.a = foo5.a = foo6.a = foo7.a = foo8.a = - foo9.a = foo10.a = foo11.a = foo12.a = foo16.a = '$'; - - Fun1(foo1); - Fun2(foo2); - Fun3(foo3); - Fun4(foo4); - Fun5(foo5); - Fun6(foo6); - Fun7(foo7); - Fun8(foo8); - Fun9(foo9); - Fun10(foo10); - Fun11(foo11); - Fun12(foo12); - Fun16(foo16); - - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/trunctfdf.c b/gcc/testsuite/gcc.c-torture/compile/trunctfdf.c deleted file mode 100644 index 29d6ed0dc9a..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/trunctfdf.c +++ /dev/null @@ -1,14 +0,0 @@ -/* Sparc w/128-bit long double bombed on this because even though - the trunctfdf libcall passed the long double by reference, the - libcall was still marked as LCT_CONST instead of LCT_PURE. */ - -double *copy(long double *first, long double *last, double *result) -{ - int n; - for (n = last - first; n > 0; --n) { - *result = *first; - ++first; - ++result; - } - return result; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/widechar-1.c b/gcc/testsuite/gcc.c-torture/compile/widechar-1.c deleted file mode 100644 index 5d89f33a864..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/widechar-1.c +++ /dev/null @@ -1 +0,0 @@ -char *s = L"a" "b"; diff --git a/gcc/testsuite/gcc.c-torture/compile/zero-strct-1.c b/gcc/testsuite/gcc.c-torture/compile/zero-strct-1.c deleted file mode 100644 index d3db812691b..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/zero-strct-1.c +++ /dev/null @@ -1,7 +0,0 @@ -typedef struct { } empty_t; - -f () -{ - empty_t i; - bar (i); -} diff --git a/gcc/testsuite/gcc.dg/cpp/inc/foo.h b/gcc/testsuite/gcc.dg/cpp/inc/foo.h deleted file mode 100644 index ec770476c21..00000000000 --- a/gcc/testsuite/gcc.dg/cpp/inc/foo.h +++ /dev/null @@ -1 +0,0 @@ -extern int a; diff --git a/libjava/gnu/java/awt/peer/gtk/GdkFontMetrics.java b/libjava/gnu/java/awt/peer/gtk/GdkFontMetrics.java deleted file mode 100644 index 45690b06669..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GdkFontMetrics.java +++ /dev/null @@ -1,108 +0,0 @@ -/* GdkFontMetrics.java - Copyright (C) 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; - -import java.awt.*; - -public class GdkFontMetrics extends FontMetrics -{ - private final int native_state = GtkGenericPeer.getUniqueInteger(); - - private static final int ASCENT = 0, MAX_ASCENT = 1, - DESCENT = 2, MAX_DESCENT = 3, - MAX_ADVANCE = 4; - - private int[] metrics; - private native int[] initState (String xlfd, int pts); - - public GdkFontMetrics (Font font) - { - super (font); - metrics = initState (((GtkFontPeer)font.getPeer ()).getXLFD (), - font.getSize ()); - } - - native public int stringWidth (String str); - - public int charWidth (char ch) - { - return stringWidth (new String (new char[] { ch })); - } - - public int charsWidth (char data[], int off, int len) - { - return stringWidth (new String (data, off, len)); - } - - /* - Sun's Motif implementation always returns 0 or 1 here (???), but - going by the X11 man pages, it seems as though we should return - font.ascent + font.descent. - */ - public int getLeading () - { - return 1; -// return metrics[ASCENT] + metrics[DESCENT]; - } - - public int getAscent () - { - return metrics[ASCENT]; - } - - public int getMaxAscent () - { - return metrics[MAX_ASCENT]; - } - - public int getDescent () - { - return metrics[DESCENT]; - } - - public int getMaxDescent () - { - return metrics[MAX_DESCENT]; - } - - public int getMaxAdvance () - { - return metrics[MAX_ADVANCE]; - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GdkGraphics.java b/libjava/gnu/java/awt/peer/gtk/GdkGraphics.java deleted file mode 100644 index 24ea252d4dc..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GdkGraphics.java +++ /dev/null @@ -1,328 +0,0 @@ -/* GdkGraphics.java - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; - -import java.awt.*; -import java.awt.image.*; -import java.text.AttributedCharacterIterator; - -public class GdkGraphics extends Graphics -{ - private final int native_state = GtkGenericPeer.getUniqueInteger(); - - Color color, xorColor; - GtkComponentPeer component; - Font font; - Rectangle clip; - - int xOffset = 0; - int yOffset = 0; - - static final int GDK_COPY = 0, GDK_XOR = 2; - - native int[] initState (GtkComponentPeer component); - native void initState (int width, int height); - native void copyState (GdkGraphics g); - - GdkGraphics (GdkGraphics g) - { - color = g.color; - xorColor = g.xorColor; - font = g.font; - clip = new Rectangle (g.clip); - component = g.component; - - copyState (g); - } - - GdkGraphics (int width, int height) - { - initState (width, height); - color = Color.black; - clip = new Rectangle (0, 0, width, height); - font = new Font ("Dialog", Font.PLAIN, 10); - } - - GdkGraphics (GtkComponentPeer component) - { - this.component = component; - int rgb[] = initState (component); - color = new Color (rgb[0], rgb[1], rgb[2]); - font = new Font ("Dialog", Font.PLAIN, 10); - Dimension d = component.awtComponent.getSize (); - clip = new Rectangle (0, 0, d.width, d.height); - } - - public native void clearRect (int x, int y, int width, int height); - - public void clipRect (int x, int y, int width, int height) - { - clip = clip.intersection (new Rectangle (x, y, width, height)); - setClipRectangle (clip.x, clip.y, clip.width, clip.height); - } - - native public void copyArea (int x, int y, int width, int height, - int dx, int dy); - - public Graphics create () - { - return new GdkGraphics (this); - } - -// public Graphics create (int x, int y, int width, int height) -// { -// GdkGraphics g = new GdkGraphics (this); -// System.out.println ("translating by: " + x +" " + y); -// g.translate (x, y); -// g.clipRect (0, 0, width, height); - -// return g; -// } - - native public void dispose (); - - native void copyPixmap (Graphics g, int x, int y, int width, int height); - public boolean drawImage (Image img, int x, int y, - Color bgcolor, ImageObserver observer) - { - if (img instanceof GtkOffScreenImage) - { - copyPixmap (img.getGraphics (), - x, y, img.getWidth (null), img.getHeight (null)); - return true; - } - - GtkImage image = (GtkImage) img; - new GtkImagePainter (image, this, x, y, -1, -1, bgcolor); - return image.isLoaded (); - } - - public boolean drawImage (Image img, int x, int y, ImageObserver observer) - { - if (img instanceof GtkOffScreenImage) - { - copyPixmap (img.getGraphics (), - x, y, img.getWidth (null), img.getHeight (null)); - return true; - } - - return drawImage (img, x, y, component.getBackground (), observer); - } - - public boolean drawImage (Image img, int x, int y, int width, int height, - Color bgcolor, ImageObserver observer) - { - if (img instanceof GtkOffScreenImage) - { - throw new RuntimeException (); - } - - GtkImage image = (GtkImage) img; - new GtkImagePainter (image, this, x, y, width, height, bgcolor); - return image.isLoaded (); - } - - public boolean drawImage (Image img, int x, int y, int width, int height, - ImageObserver observer) - { - return drawImage (img, x, y, width, height, component.getBackground (), - observer); - } - - public boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, - Color bgcolor, ImageObserver observer) - { - if (img instanceof GtkOffScreenImage) - { - throw new RuntimeException (); - } - - GtkImage image = (GtkImage) img; - new GtkImagePainter (image, this, dx1, dy1, dx2, dy2, - sx1, sy1, sx2, sy2, bgcolor); - return image.isLoaded (); - } - - public boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, - ImageObserver observer) - { - return drawImage (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, - component.getBackground (), observer); - } - - native public void drawLine (int x1, int y1, int x2, int y2); - - native public void drawArc (int x, int y, int width, int height, - int startAngle, int arcAngle); - native public void fillArc (int x, int y, int width, int height, - int startAngle, int arcAngle); - native public void drawOval(int x, int y, int width, int height); - native public void fillOval(int x, int y, int width, int height); - - native public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints); - native public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints); - - native public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints); - - native public void drawRect(int x, int y, int width, int height); - native public void fillRect (int x, int y, int width, int height); - - native void drawString (String str, int x, int y, String fname, int size); - public void drawString (String str, int x, int y) - { - drawString (str, x, y, - ((GtkFontPeer)font.getPeer ()).getXLFD (), font.getSize ()); - } - - public void drawString (AttributedCharacterIterator ci, int x, int y) - { - throw new Error ("not implemented"); - } - - public void drawRoundRect(int x, int y, int width, int height, - int arcWidth, int arcHeight) - { - // System.out.println ("drawRoundRect called [UNIMPLEMENTED]"); - } - - public void fillRoundRect (int x, int y, int width, int height, - int arcWidth, int arcHeight) - { - // System.out.println ("fillRoundRect called [UNIMPLEMENTED]"); - } - - public Shape getClip () - { - return getClipBounds (); - } - - public Rectangle getClipBounds () - { -// System.out.println ("returning CLIP: " + clip); - return new Rectangle (clip.x, clip.y, clip.width, clip.height); - } - - public Color getColor () - { - return color; - } - - public Font getFont () - { - return font; - } - - public FontMetrics getFontMetrics (Font font) - { - return new GdkFontMetrics (font); - } - - native void setClipRectangle (int x, int y, int width, int height); - - public void setClip (int x, int y, int width, int height) - { - clip.x = x; - clip.y = y; - clip.width = width; - clip.height = height; - - setClipRectangle (x, y, width, height); - } - - public void setClip (Rectangle clip) - { - setClip (clip.x, clip.y, clip.width, clip.height); - } - - public void setClip (Shape clip) - { - setClip (clip.getBounds ()); - } - - native private void setFGColor (int red, int green, int blue); - - public void setColor (Color c) - { - color = c; - - if (xorColor == null) /* paint mode */ - setFGColor (color.getRed (), color.getGreen (), color.getBlue ()); - else /* xor mode */ - setFGColor (color.getRed () ^ xorColor.getRed (), - color.getGreen () ^ xorColor.getGreen (), - color.getBlue () ^ xorColor.getBlue ()); - } - - public void setFont (Font font) - { - this.font = font; - } - - native void setFunction (int gdk_func); - - public void setPaintMode () - { - xorColor = null; - - setFunction (GDK_COPY); - setFGColor (color.getRed (), color.getGreen (), color.getBlue ()); - } - - public void setXORMode (Color c) - { - xorColor = c; - - setFunction (GDK_XOR); - setFGColor (color.getRed () ^ xorColor.getRed (), - color.getGreen () ^ xorColor.getGreen (), - color.getBlue () ^ xorColor.getBlue ()); - } - - native public void translateNative (int x, int y); - - public void translate (int x, int y) - { - clip.x -= x; - clip.y -= y; - - translateNative (x, y); - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkArg.java b/libjava/gnu/java/awt/peer/gtk/GtkArg.java deleted file mode 100644 index 0491856849c..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkArg.java +++ /dev/null @@ -1,61 +0,0 @@ -/* GtkArg.java - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; - -public class GtkArg -{ - String name; - Object value; - - public GtkArg (String name, Object value) - { - this.name = name; - this.value = value; - } - - public String getName () - { - return name; - } - - public Object getValue () - { - return value; - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkArgList.java b/libjava/gnu/java/awt/peer/gtk/GtkArgList.java deleted file mode 100644 index c7770472e7e..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkArgList.java +++ /dev/null @@ -1,75 +0,0 @@ -/* GtkArgList.java - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.util.Vector; - -public class GtkArgList extends Vector -{ - void add (GtkArg arg) - { - addElement (arg); - } - - void add (String name, boolean value) - { - addElement (new GtkArg (name, new Boolean (value))); - } - - void add (String name, int value) - { - addElement (new GtkArg (name, new Integer (value))); - } - - void add (String name, float value) - { - addElement (new GtkArg (name, new Float (value))); - } - - void add (String name, Object value) - { - addElement (new GtkArg (name, value)); - } - - synchronized void setArgs (GtkComponentPeer cp) - { - for (int i = 0; i < elementCount; i++) - cp.set ((GtkArg)elementData[i]); - } -} - diff --git a/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java deleted file mode 100644 index a609f7ad818..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java +++ /dev/null @@ -1,96 +0,0 @@ -/* GtkButtonPeer.java -- Implements ButtonPeer with GTK - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.*; -import java.awt.event.MouseEvent; -import java.awt.event.KeyEvent; -import java.awt.peer.*; - -public class GtkButtonPeer extends GtkComponentPeer - implements ButtonPeer -{ - native void create (); - - native void gtkSetFont(String xlfd, int size); - - public GtkButtonPeer (Button b) - { - super (b); - } - - public void setLabel (String label) - { - set ("label", label); - } - - public void handleEvent (AWTEvent e) - { - if (e.getID () == MouseEvent.MOUSE_CLICKED && isEnabled () - && !modalHasGrab ()) - { - MouseEvent me = (MouseEvent) e; - if (!me.isConsumed () - && (me.getModifiers () & MouseEvent.BUTTON1_MASK) != 0) - postActionEvent (((Button)awtComponent).getActionCommand (), - me.getModifiers ()); - } - - if (e.getID () == KeyEvent.KEY_PRESSED) - { - KeyEvent ke = (KeyEvent) e; - if (!ke.isConsumed () && ke.getKeyCode () == KeyEvent.VK_SPACE) - postActionEvent (((Button)awtComponent).getActionCommand (), - ke.getModifiers ()); - } - - super.handleEvent (e); - } - - public void getArgs (Component component, GtkArgList args) - { - super.getArgs (component, args); - - args.add ("label", ((Button)component).getLabel ()); - } - - public void setFont (Font f) - { - gtkSetFont(((GtkFontPeer)f.getPeer()).getXLFD(), f.getSize()); - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkCanvasPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkCanvasPeer.java deleted file mode 100644 index 59c28f9fd5f..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkCanvasPeer.java +++ /dev/null @@ -1,92 +0,0 @@ -/* GtkCanvasPeer.java - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package gnu.java.awt.peer.gtk; -import java.awt.*; -import java.awt.event.PaintEvent; -import java.awt.peer.*; - -public class GtkCanvasPeer extends GtkComponentPeer implements CanvasPeer -{ - native void create (); - - public GtkCanvasPeer (Canvas c) - { - super (c); - } - - public Graphics getGraphics () - { - return new GdkGraphics (this); - } - - public void handleEvent (AWTEvent event) - { - int id = event.getID(); - - switch (id) - { - case PaintEvent.PAINT: - case PaintEvent.UPDATE: - { - try - { - Graphics g = getGraphics (); - g.setClip (((PaintEvent)event).getUpdateRect()); - - if (id == PaintEvent.PAINT) - awtComponent.paint (g); - else - awtComponent.update (g); - - g.dispose (); - } - catch (InternalError e) - { - System.err.println (e); - } - } - break; - } - } - - /* Preferred size for a drawing widget is always what the user requested */ - public Dimension getPreferredSize () - { - return awtComponent.getSize (); - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java deleted file mode 100644 index 9903c310425..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java +++ /dev/null @@ -1,86 +0,0 @@ -/* GtkCheckboxGroupPeer.java - Wrap a CheckboxGroup - Copyright (C) 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.*; -import java.awt.event.*; -import java.util.*; - -// Note that there is no peer interface for a CheckboxGroup. We -// introduce our own in order to make it easier to keep a piece of -// native state for each one. -public class GtkCheckboxGroupPeer extends GtkGenericPeer -{ - // This maps from a CheckboxGroup to the native peer. - private static WeakHashMap map = new WeakHashMap (); - - // Find the native peer corresponding to a CheckboxGroup. - public static synchronized GtkCheckboxGroupPeer - getCheckboxGroupPeer (CheckboxGroup group) - { - if (group == null) - return null; - GtkCheckboxGroupPeer nat = (GtkCheckboxGroupPeer) map.get (group); - if (nat == null) - { - nat = new GtkCheckboxGroupPeer (); - map.put (group, nat); - } - return nat; - } - - private GtkCheckboxGroupPeer () - { - // We don't need any special state here. Note that we can't store - // a reference to the java-side CheckboxGroup. That would mean - // they could never be collected. - super (null); - } - - // Dispose of our native resources. - public native void dispose (); - - // Remove a given checkbox from this group. - public native void remove (GtkCheckboxPeer box); - - // When collected, clean up the native state. - protected void finalize () - { - dispose (); - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java deleted file mode 100644 index 1bff7069602..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java +++ /dev/null @@ -1,56 +0,0 @@ -/* GtkCheckboxMenuItemPeer.java -- Implements CheckboxMenuItemPeer with GTK+ - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.*; -import java.awt.peer.CheckboxMenuItemPeer; -import java.awt.peer.MenuItemPeer; - -public class GtkCheckboxMenuItemPeer extends GtkMenuItemPeer - implements CheckboxMenuItemPeer -{ - native void create (String label); - - public GtkCheckboxMenuItemPeer (CheckboxMenuItem menu) - { - super (menu); - setState (menu.getState ()); - } - - native public void setState (boolean t); -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java deleted file mode 100644 index 48f8804007d..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java +++ /dev/null @@ -1,114 +0,0 @@ -/* GtkCheckboxPeer.java -- Implements CheckboxPeer with GTK - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.peer.*; -import java.awt.*; - -public class GtkCheckboxPeer extends GtkComponentPeer - implements CheckboxPeer -{ - // Group from last time it was set. - public GtkCheckboxGroupPeer old_group; - - public native void nativeCreate (GtkCheckboxGroupPeer group); - public native void nativeSetCheckboxGroup (GtkCheckboxGroupPeer group); - public native void connectHooks (); - - public GtkCheckboxPeer (Checkbox c) - { - super (c); - } - - // We can't fully use the ordinary getArgs code here, due to - // oddities of this particular widget. In particular we must be - // able to switch between a checkbutton and a radiobutton - // dynamically. - public void create () - { - CheckboxGroup g = ((Checkbox) awtComponent).getCheckboxGroup (); - old_group = GtkCheckboxGroupPeer.getCheckboxGroupPeer (g); - nativeCreate (old_group); - } - - public void setState (boolean state) - { - set ("active", state); - } - - public void setLabel (String label) - { - set ("label", label); - } - - public void setCheckboxGroup (CheckboxGroup group) - { - GtkCheckboxGroupPeer gp - = GtkCheckboxGroupPeer.getCheckboxGroupPeer (group); - if (gp != old_group) - { - if (old_group != null) - old_group.remove (this); - nativeSetCheckboxGroup (gp); - old_group = gp; - } - } - - public void getArgs (Component component, GtkArgList args) - { - super.getArgs (component, args); - args.add ("active", ((Checkbox) component).getState ()); - args.add ("label", ((Checkbox) component).getLabel ()); - } - - // Override the superclass postItemEvent so that the peer doesn't - // need information that we have. - public void postItemEvent (Object item, int stateChange) - { - super.postItemEvent (awtComponent, stateChange); - } - - public void dispose () - { - // Notify the group so that the native state can be cleaned up - // appropriately. - if (old_group != null) - old_group.remove (this); - super.dispose (); - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkChoicePeer.java b/libjava/gnu/java/awt/peer/gtk/GtkChoicePeer.java deleted file mode 100644 index afa90a56c3f..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkChoicePeer.java +++ /dev/null @@ -1,92 +0,0 @@ -/* GtkChoicePeer.java -- Implements ChoicePeer with GTK - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.peer.*; -import java.awt.*; -import java.awt.event.*; - -public class GtkChoicePeer extends GtkComponentPeer - implements ChoicePeer -{ - native void create (); - - public GtkChoicePeer (Choice c) - { - super (c); - - int count = c.getItemCount (); - if (count > 0) - { - String items[] = new String[count]; - for (int i = 0; i < count; i++) - items[i] = c.getItem (i); - - append (items); - } - } - - native void append (String items[]); - - native public void add (String item, int index); - native public void remove (int index); - native public void select (int position); - - public void removeAll () { } - - public void addItem (String item, int position) - { - add (item, position); - } - - /* - public void handleEvent (AWTEvent event) - { - if (event instanceof ItemEvent) - ((Choice) awtComponent).select ((String) ((ItemEvent)event).getItem ()); - super.handleEvent (event); - } - */ - - protected void postItemEvent (Object item, int stateChange) - { - if (stateChange == ItemEvent.SELECTED) - ((Choice) awtComponent).select ((String) item); - super.postItemEvent (item, stateChange); - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkClipboard.java b/libjava/gnu/java/awt/peer/gtk/GtkClipboard.java deleted file mode 100644 index d2587d970a1..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkClipboard.java +++ /dev/null @@ -1,167 +0,0 @@ -/* GtkClipboard.java - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package gnu.java.awt.peer.gtk; - -import java.awt.*; -import java.io.*; -import java.net.*; -import java.util.*; -import java.awt.datatransfer.*; -import java.awt.image.*; -import java.awt.peer.*; - -public class GtkClipboard extends Clipboard -{ - /* the number of milliseconds that we'll wait around for the - owner of the GDK_SELECTION_PRIMARY selection to convert - the requested data */ - final static int SELECTION_RECEIVED_TIMEOUT = 5000; - - /* We currently only support transferring of text between applications */ - static String selection; - static Object selectionLock = new Object (); - - static boolean hasSelection = false; - - protected - GtkClipboard () - { - super ("System Clipboard"); - initNativeState (); - } - - public Transferable - getContents (Object requestor) - { - synchronized (this) - { - if (hasSelection) - return contents; - } - - /* Java doesn't own the selection, so we need to ask X11 */ - synchronized (selectionLock) - { - requestStringConversion (); - try - { - selectionLock.wait (SELECTION_RECEIVED_TIMEOUT); - } - catch (InterruptedException e) - { - return null; - } - - return (selection == null) ? null : new StringSelection (selection); - } - } - - void - stringSelectionReceived (String newSelection) - { - synchronized (selectionLock) - { - selection = newSelection; - selectionLock.notify (); - } - } - - /* convert Java clipboard data into a String suitable for sending - to another application */ - synchronized String - stringSelectionHandler () throws IOException - { - String selection = null; - - try { - if (contents.isDataFlavorSupported (DataFlavor.stringFlavor)) - selection = (String)contents.getTransferData (DataFlavor.stringFlavor); - else if (contents.isDataFlavorSupported (DataFlavor.plainTextFlavor)) - { - StringBuffer sbuf = new StringBuffer (); - InputStreamReader reader; - char readBuf[] = new char[512]; - int numChars; - - reader = new InputStreamReader - ((InputStream) - contents.getTransferData (DataFlavor.plainTextFlavor), "UNICODE"); - - while (true) - { - numChars = reader.read (readBuf); - if (numChars == -1) - break; - sbuf.append (readBuf, 0, numChars); - } - - selection = new String (sbuf); - } - } catch (Exception e) { } - - return selection; - } - - public synchronized void - setContents (Transferable contents, ClipboardOwner owner) - { - selectionGet (); - - this.contents = contents; - this.owner = owner; - - hasSelection = true; - } - - synchronized - void selectionClear () - { - hasSelection = false; - - if (owner != null) - { - owner.lostOwnership (this, contents); - owner = null; - contents = null; - } - } - - native void initNativeState (); - native static void requestStringConversion (); - native static void selectionGet (); -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java deleted file mode 100644 index 779bc8b5d96..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java +++ /dev/null @@ -1,460 +0,0 @@ -/* GtkComponentPeer.java -- Implements ComponentPeer with GTK - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.*; -import java.awt.event.*; -import java.awt.image.*; -import java.awt.peer.ComponentPeer; - -public class GtkComponentPeer extends GtkGenericPeer - implements ComponentPeer -{ - Component awtComponent; - - /* this isEnabled differs from Component.isEnabled, in that it - knows if a parent is disabled. In that case Component.isEnabled - may return true, but our isEnabled will always return false */ - native boolean isEnabled (); - native static boolean modalHasGrab (); - - native int[] gtkWidgetGetForeground (); - native int[] gtkWidgetGetBackground (); - native void gtkWidgetSetVisible (boolean b); - native void gtkWidgetGetDimensions(int[] dim); - native void gtkWidgetGetLocationOnScreen(int[] point); - native void gtkWidgetSetCursor (int type); - - void create () - { - throw new RuntimeException (); - } - - native void connectHooks (); - - protected GtkComponentPeer (Component awtComponent) - { - super (awtComponent); - this.awtComponent = awtComponent; - - /* temporary try/catch block until all peers use this creation method */ - try { - create (); - - GtkArgList args = new GtkArgList (); - getArgs (awtComponent, args); - args.setArgs (this); - - connectHooks (); - - if (awtComponent.getForeground () == null) - awtComponent.setForeground (getForeground ()); - if (awtComponent.getBackground () == null) - awtComponent.setBackground (getBackground ()); - // if (c.getFont () == null) - // c.setFont (cp.getFont ()); - if (awtComponent.getFont() != null) - setFont(awtComponent.getFont()); - - if (! (awtComponent instanceof Window)) - { - setCursor (awtComponent.getCursor ()); - Rectangle bounds = awtComponent.getBounds (); - setBounds (bounds.x, bounds.y, bounds.width, bounds.height); - } - } catch (RuntimeException ex) { ; } - } - - public int checkImage (Image image, int width, int height, - ImageObserver observer) - { - GtkImage i = (GtkImage) image; - return i.checkImage (); - } - - public Image createImage (ImageProducer producer) - { - return new GtkImage (producer, null); - } - - public Image createImage (int width, int height) - { - GdkGraphics g = new GdkGraphics (width, height); - return new GtkOffScreenImage (null, g, width, height); - } - - public void disable () - { - setEnabled (false); - } - - public void enable () - { - setEnabled (true); - } - - public ColorModel getColorModel () - { - return ColorModel.getRGBdefault (); - } - - public FontMetrics getFontMetrics (Font font) - { - return new GdkFontMetrics (font); - } - - public Graphics getGraphics () - { - return null; - } - - public Point getLocationOnScreen () - { - int point[] = new int[2]; - gtkWidgetGetLocationOnScreen (point); - return new Point (point[0], point[1]); - } - - public Dimension getMinimumSize () - { - int dim[]=new int[2]; - gtkWidgetGetDimensions (dim); - Dimension d = new Dimension (dim[0],dim[1]); - return (d); - } - - public Dimension getPreferredSize () - { - int dim[]=new int[2]; - gtkWidgetGetDimensions (dim); - Dimension d = new Dimension (dim[0],dim[1]); - return (d); - } - - public Toolkit getToolkit () - { - return Toolkit.getDefaultToolkit(); - } - - public void handleEvent (AWTEvent event) - { - } - - public boolean isFocusTraversable () - { - return true; - } - - public Dimension minimumSize () - { - return getMinimumSize(); - } - - public void paint (Graphics g) - { - awtComponent.paint (g); - } - - public Dimension preferredSize() - { - return getPreferredSize(); - } - - public boolean prepareImage (Image image, int width, int height, - ImageObserver observer) - { - GtkImage i = (GtkImage) image; - - if (i.isLoaded ()) return true; - - class PrepareImage extends Thread - { - GtkImage image; - ImageObserver observer; - - PrepareImage (GtkImage image, ImageObserver observer) - { - this.image = image; - this.observer = observer; - } - - public void run () - { - // XXX: need to return data to image observer - image.source.startProduction (null); - } - } - - new PrepareImage (i, observer).start (); - return false; - } - - public void print (Graphics g) - { - throw new RuntimeException (); - } - - public void repaint (long tm, int x, int y, int width, int height) - { - q.postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE, - new Rectangle (x, y, width, height))); - } - - native public void requestFocus (); - - public void reshape (int x, int y, int width, int height) - { - setBounds (x, y, width, height); - } - - public void setBackground (Color c) - { - // System.out.println ("setBackground [UNIMPLEMENTED"); - } - - native public void setNativeBounds (int x, int y, int width, int height); - - public void setBounds (int x, int y, int width, int height) - { - Component parent = awtComponent.getParent (); - - if (parent instanceof Frame) - { - Insets insets = ((Frame)parent).getInsets (); - /* convert Java's coordinate space into GTK+'s coordinate space */ - setNativeBounds (x-insets.left, y-insets.top, width, height); - } - else - setNativeBounds (x, y, width, height); - } - - public void setCursor (Cursor cursor) - { - gtkWidgetSetCursor (cursor.getType ()); - } - - public void setEnabled (boolean b) - { - set ("sensitive", b); - } - - public void setFont (Font f) - { - // FIXME: This should really affect the widget tree below me. - // Currently this is only handled if the call is made directly on - // a text widget, which implements setFont() itself. - } - - public void setForeground (Color c) - { - // System.out.println ("setForeground [UNIMPLEMENTED"); - } - - public Color getForeground () - { - int rgb[] = gtkWidgetGetForeground (); - return new Color (rgb[0], rgb[1], rgb[2]); - } - - public Color getBackground () - { - int rgb[] = gtkWidgetGetBackground (); - return new Color (rgb[0], rgb[1], rgb[2]); - } - - public void setVisible (boolean b) - { - set ("visible", b); - } - - public void hide () - { - setVisible (false); - } - - public void show () - { - setVisible (true); - } - - protected void postMouseEvent(int id, long when, int mods, int x, int y, - int clickCount, boolean popupTrigger) - { - q.postEvent(new MouseEvent(awtComponent, id, when, mods, x, y, - clickCount, popupTrigger)); - } - - protected void postExposeEvent (int x, int y, int width, int height) - { - q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT, - new Rectangle (x, y, width, height))); - } - - protected void postKeyEvent (int id, long when, int mods, - int keyCode, char keyChar) - { - q.postEvent (new KeyEvent (awtComponent, id, when, mods, - keyCode, keyChar)); - } - - protected void postFocusEvent (int id, boolean temporary) - { - q.postEvent (new FocusEvent (awtComponent, id, temporary)); - } - - protected void postItemEvent (Object item, int stateChange) - { - q.postEvent (new ItemEvent ((ItemSelectable)awtComponent, - ItemEvent.ITEM_STATE_CHANGED, - item, stateChange)); - } - - public void getArgs (Component component, GtkArgList args) - { - args.add ("visible", component.isVisible ()); - args.add ("sensitive", component.isEnabled ()); - - ComponentPeer p; - - do - { - component = component.getParent (); - p = component.getPeer (); - } while (p instanceof java.awt.peer.LightweightPeer); - - if (p != null) - args.add ("parent", p); - } - - native void set (String name, String value); - native void set (String name, boolean value); - native void set (String name, int value); - native void set (String name, float value); - native void set (String name, Object value); - - void set (GtkArg arg) - { - String name = arg.getName (); - Object value = arg.getValue (); - - if (value instanceof Boolean) - set (name, ((Boolean)value).booleanValue ()); - else if (value instanceof Integer) - set (name, ((Integer)value).intValue ()); - else if (value instanceof Float) - set (name, ((Float)value).floatValue ()); - else if (value instanceof String) - set (name, ((String) value)); - else - set (name, value); - } - - public GraphicsConfiguration getGraphicsConfiguration () - { - // FIXME: just a stub for now. - return null; - } - - public void setEventMask (long mask) - { - // FIXME: just a stub for now. - } - - public boolean isFocusable () - { - return false; - } - - public boolean requestFocus (Component source, boolean b1, - boolean b2, long x) - { - return false; - } - - public boolean isObscured () - { - return false; - } - - public boolean canDetermineObscurity () - { - return false; - } - - public void coalescePaintEvent (PaintEvent e) - { - - } - - public void updateCursorImmediately () - { - - } - - public VolatileImage createVolatileImage (int width, int height) - { - return null; - } - - public boolean handlesWheelScrolling () - { - return false; - } - - public void createBuffers (int x, BufferCapabilities capabilities) - throws java.awt.AWTException - - { - - } - - public Image getBackBuffer () - { - return null; - } - - public void flip (BufferCapabilities.FlipContents contents) - { - - } - - public void destroyBuffers () - { - - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java deleted file mode 100644 index caf5dc37943..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java +++ /dev/null @@ -1,129 +0,0 @@ -/* GtkContainerPeer.java -- Implements ContainerPeer with GTK - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.*; -import java.awt.event.*; -import java.awt.peer.ContainerPeer; - -public class GtkContainerPeer extends GtkComponentPeer - implements ContainerPeer -{ - Insets insets; - Container c; - - public GtkContainerPeer(Container c) - { - super (c); - this.c = c; - insets = new Insets (0, 0, 0, 0); - } - - public void beginValidate() - { - } - - public void endValidate() - { -// q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT, -// new Rectangle (x, y, width, height))); -// Graphics gc = getGraphics (); -// if (gc != null) -// { -// awtComponent.update (gc); -// gc.dispose (); -// } -// System.out.println ("got here"); -// awtComponent.repaint (); - } - - public Insets getInsets() - { - return insets; - } - - public Insets insets() - { - return getInsets (); - } - - public void setBounds (int x, int y, int width, int height) - { - super.setBounds (x, y, width, height); - awtComponent.validate (); - } - - public Graphics getGraphics () - { - return new GdkGraphics (this); - } - - public void handleEvent (AWTEvent event) - { - int id = event.getID(); - - switch (id) - { - case PaintEvent.PAINT: - case PaintEvent.UPDATE: - { - try - { - Graphics g = getGraphics (); - g.setClip (((PaintEvent)event).getUpdateRect()); - - if (id == PaintEvent.PAINT) - awtComponent.paint (g); - else - awtComponent.update (g); - - g.dispose (); - } - catch (InternalError e) - { - System.err.println (e); - } - } - break; - } - } - - public void beginLayout () { } - public void endLayout () { } - public boolean isPaintPending () { return false; } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java deleted file mode 100644 index b47956d4f21..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java +++ /dev/null @@ -1,76 +0,0 @@ -/* GtkDialogPeer.java -- Implements DialogPeer with GTK - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.*; -import java.awt.peer.*; -import java.awt.event.*; - -public class GtkDialogPeer extends GtkWindowPeer - implements DialogPeer -{ - public GtkDialogPeer (Dialog dialog) - { - super (dialog); - } - - void create () - { - create (GTK_WINDOW_DIALOG); - } - - public void getArgs (Component component, GtkArgList args) - { - super.getArgs (component, args); - - Dialog dialog = (Dialog) component; - - args.add ("modal", dialog.isModal ()); - args.add ("allow_shrink", dialog.isResizable ()); - args.add ("allow_grow", dialog.isResizable ()); - } - - public void handleEvent (AWTEvent event) - { -// int id = event.getID(); - -// if (id == WindowEvent.WINDOW_CLOSING) -// System.out.println ("got a closing event"); - } - -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java deleted file mode 100644 index 3376787d2e5..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java +++ /dev/null @@ -1,70 +0,0 @@ -/* GtkFileDialogPeer.java -- Implements FileDialogPeer with GTK - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.io.FilenameFilter; -import java.awt.peer.*; -import java.awt.*; - -public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer -{ - native void create (); - - public GtkFileDialogPeer (FileDialog fd) - { - super (fd); - } - - public void setDirectory (String directory) - { - setFile (directory); - } - - public native void setFile (String file); - public native void connectHooks (); - - public void setFilenameFilter (FilenameFilter filter) - { - /* GTK has no filters. */ - } - - public Graphics getGraphics () - { - return null; - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java deleted file mode 100644 index d3130a905e9..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java +++ /dev/null @@ -1,94 +0,0 @@ -/* GtkFontPeer.java -- Implements FontPeer with GTK+ - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.peer.FontPeer; -import java.awt.Font; -import java.util.ResourceBundle; - -public class GtkFontPeer implements FontPeer -{ - private static ResourceBundle bundle; - - static - { - try - { - bundle = ResourceBundle.getBundle ("gnu.java.awt.peer.gtk.font"); - } - catch (Throwable ignored) - { - bundle = null; - } - } - - final private String Xname; // uses %d for font size. - - public GtkFontPeer (String name, int style) - { - if (bundle != null) - Xname = bundle.getString (name.toLowerCase () + "." + style); - else - { - String weight; - String slant; - String spacing; - - if (style == Font.ITALIC || (style == (Font.BOLD+Font.ITALIC))) - slant = "i"; - else - slant = "r"; - if (style == Font.BOLD || (style == (Font.BOLD+Font.ITALIC))) - weight = "bold"; - else - weight = "medium"; - if (name.equals("Serif") || name.equals("SansSerif") - || name.equals("Helvetica") || name.equals("Times")) - spacing = "p"; - else - spacing = "c"; - - Xname = "-*-*-" + weight + "-" + slant + "-normal-*-%d-*-*-*-" + spacing + "-*-*-*"; - } - } - - public String getXLFD () - { - return Xname; - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java b/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java deleted file mode 100644 index 6c6802d20ee..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java +++ /dev/null @@ -1,147 +0,0 @@ -/* GtkFramePeer.java -- Implements FramePeer with GTK - Copyright (C) 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.*; -import java.awt.peer.*; -import java.awt.event.*; - -public class GtkFramePeer extends GtkWindowPeer - implements FramePeer -{ - int menuBarHeight = 0; - native int getMenuBarHeight (); - - native public void setMenuBarPeer (MenuBarPeer bar); - - public void setMenuBar (MenuBar bar) - { - if (bar == null) - setMenuBarPeer (null); - else - setMenuBarPeer ((MenuBarPeer) bar.getPeer ()); - } - - public GtkFramePeer (Frame frame) - { - super (frame); - } - - void create () - { - create (GTK_WINDOW_TOPLEVEL); - } - - public void getArgs (Component component, GtkArgList args) - { - super.getArgs (component, args); - - Frame frame = (Frame) component; - - args.add ("title", frame.getTitle ()); - args.add ("allow_shrink", frame.isResizable ()); - args.add ("allow_grow", frame.isResizable ()); - } - public void setIconImage (Image image) - { - /* TODO: Waiting on Toolkit Image routines */ - } - - public Graphics getGraphics () - { - GdkGraphics g = new GdkGraphics (this); - g.translateNative (-insets.left, -insets.top); - return g; - } - - public void setBounds (int x, int y, int width, int height) - { - super.setBounds (0, 0, width - insets.left - insets.right, - height - insets.top - insets.bottom + menuBarHeight); - } - - protected void postConfigureEvent (int x, int y, int width, int height, - int top, int left, int bottom, int right) - { - if (((Frame)awtComponent).getMenuBar () != null) - { - menuBarHeight = getMenuBarHeight (); - top += menuBarHeight; - } - - super.postConfigureEvent (0, 0, - width + left + right, - height + top + bottom - menuBarHeight, - top, left, bottom, right); - } - - protected void postMouseEvent(int id, long when, int mods, int x, int y, - int clickCount, boolean popupTrigger) - { - super.postMouseEvent (id, when, mods, - x + insets.left, y + insets.top, - clickCount, popupTrigger); - } - - protected void postExposeEvent (int x, int y, int width, int height) - { -// System.out.println ("x + insets.left:" + (x + insets.left)); -// System.out.println ("y + insets.top :" + (y + insets.top)); - q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT, - new Rectangle (x + insets.left, - y + insets.top, - width, height))); - } - - public int getState () - { - return 0; - } - - public void setState (int state) - { - - } - - public void setMaximizedBounds (Rectangle r) - { - - } -} - - diff --git a/libjava/gnu/java/awt/peer/gtk/GtkGenericPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkGenericPeer.java deleted file mode 100644 index 914b7a6cdeb..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkGenericPeer.java +++ /dev/null @@ -1,84 +0,0 @@ -/* GtkGenericPeer.java - Has a hashcode. Yuck. - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.*; -import java.awt.event.*; - -public class GtkGenericPeer -{ - final int native_state = getUniqueInteger (); - - // Next native state value we will assign. - private static int next_native_state = 0; - - // The widget or other java-side object we wrap. - protected Object awtWidget; - - // Global event queue. - protected static EventQueue q = null; - - // Dispose of our native state. - public native void dispose (); - - protected GtkGenericPeer (Object awtWidget) - { - this.awtWidget = awtWidget; - } - - public static void enableQueue (EventQueue sq) - { - if (q == null) - q = sq; - } - - protected void postActionEvent (String command, int mods) - { - q.postEvent (new ActionEvent (awtWidget, ActionEvent.ACTION_PERFORMED, - command, mods)); - } - - // Return a unique integer for use in the native state mapping - // code. We can't use a hash code since that is not guaranteed to - // be unique. - static synchronized int getUniqueInteger () - { - // Let's assume this will never wrap. - return next_native_state++; - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkImage.java b/libjava/gnu/java/awt/peer/gtk/GtkImage.java deleted file mode 100644 index f0c8bf410ef..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkImage.java +++ /dev/null @@ -1,286 +0,0 @@ -/* GtkImage.java - Copyright (C) 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; - -import java.awt.*; -import java.util.*; -import java.awt.image.*; - -public class GtkImage extends Image implements ImageConsumer -{ - int width = -1, height = -1; - Hashtable props = null; - boolean isLoaded = false; - boolean isCacheable = true; - boolean loading = false; - - Vector widthObservers = new Vector (); - Vector heightObservers = new Vector (); - Vector propertyObservers = new Vector (); - - ImageProducer source; - Graphics g; - - /* Variables in which we stored cached data, if possible. - - An image is cached if the following properties are true: - 1. The ColorModel passed into setColorModel is the same ColorModel - passed to all invocations of setPixels. - 2. The image contains a single frame. - - */ - int[] pixelCache; - ColorModel model; - - public - GtkImage (ImageProducer producer, Graphics g) - { - source = producer; - this.g = g; - - source.addConsumer (this); - } - - public synchronized int - getWidth (ImageObserver observer) - { - if (width == -1) - widthObservers.addElement (observer); - - return width; - } - - public synchronized int - getHeight (ImageObserver observer) - { - if (height == -1) - heightObservers.addElement (observer); - - return height; - } - - public ImageProducer - getSource () - { - return source; - } - - public Graphics - getGraphics () - { - return g; - } - - public synchronized Object - getProperty (String name, ImageObserver observer) - { - if (props == null) - { - propertyObservers.addElement (observer); - return null; - } - - Object value = props.get (name); - return (value == null) ? UndefinedProperty : value; - } - - public synchronized void - flush () - { - isLoaded = false; - isCacheable = true; - width = height = -1; - props = null; - pixelCache = null; - model = null; - - source.removeConsumer (this); - source.addConsumer (this); - } - - public boolean - isLoaded () - { - return isLoaded; - } - - /* ImageConsumer methods */ - - public synchronized void - setDimensions (int width, int height) - { - pixelCache = new int[width*height]; - - this.width = width; - this.height = height; - - for (int i = 0; i < widthObservers.size (); i++) - { - ImageObserver io = (ImageObserver) widthObservers.elementAt (i); - io.imageUpdate (this, ImageObserver.WIDTH, -1, -1, width, height); - } - - for (int i = 0; i < heightObservers.size (); i++) - { - ImageObserver io = (ImageObserver) heightObservers.elementAt (i); - io.imageUpdate (this, ImageObserver.HEIGHT, -1, -1, width, height); - } - } - - public synchronized void - setProperties (Hashtable props) - { - this.props = props; - - for (int i = 0; i < propertyObservers.size (); i++) - { - ImageObserver io = (ImageObserver) propertyObservers.elementAt (i); - io.imageUpdate (this, ImageObserver.PROPERTIES, -1, -1, width, height); - } - } - - public synchronized void - setColorModel (ColorModel model) - { - if (this.model == null || this.model == model) - this.model = model; - else - isCacheable = false; - } - - public synchronized void - setHints (int flags) - { - } - - public synchronized void - setPixels (int x, int y, int width, int height, ColorModel cm, byte[] pixels, - int offset, int scansize) - { - setPixels (x, y, width, height, cm, convertPixels (pixels), offset, - scansize); - } - - public synchronized void - setPixels (int x, int y, int width, int height, ColorModel cm, int[] pixels, - int offset, int scansize) - { - loading = true; - - if (!isCacheable) - return; - - if (cm != model || pixelCache == null) - { - isCacheable = false; - return; - } - - if (scansize == width) - { - System.arraycopy (pixels, offset, - pixelCache, y * this.width + x, - pixels.length - offset); - } - else // skip over scansize-width for each row - { - for (int i = 0; i < height; i++) - System.arraycopy (pixels, offset + (i * scansize), - pixelCache, (y + i) * this.width + x, - width); - } - } - - public synchronized void - imageComplete (int status) - { - if (status == ImageConsumer.STATICIMAGEDONE && isCacheable) - isLoaded = true; - - if (status == ImageConsumer.SINGLEFRAMEDONE) - isCacheable = false; - - source.removeConsumer (this); - } - - public synchronized void - startProduction (GtkImagePainter painter) - { - if (isLoaded) - { - painter.setDimensions (width, height); - painter.setPixels (0, 0, width, height, model, pixelCache, 0, width); - } - else - { - source.startProduction (painter); - source.removeConsumer (painter); - } - } - - private int[] - convertPixels (byte[] pixels) - { - int ret[] = new int[pixels.length]; - - for (int i = 0; i < pixels.length; i++) - ret[i] = pixels[i]; - - return ret; - } - - synchronized int - checkImage () - { - int bits = 0; - - if (width != -1) - bits |= ImageObserver.WIDTH; - if (height != -1) - bits |= ImageObserver.HEIGHT; - if (props != null) - bits |= ImageObserver.PROPERTIES; - if (loading) - bits |= ImageObserver.SOMEBITS; - if (isLoaded) - bits |= ImageObserver.ALLBITS; - - return bits; - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkImagePainter.java b/libjava/gnu/java/awt/peer/gtk/GtkImagePainter.java deleted file mode 100644 index 3ea22cd25af..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkImagePainter.java +++ /dev/null @@ -1,239 +0,0 @@ -/* GtkImagePainter.java - Copyright (C) 1999, 2000 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package gnu.java.awt.peer.gtk; - -import java.awt.*; -import java.awt.image.*; -import java.util.*; - -public class GtkImagePainter implements Runnable, ImageConsumer -{ - GtkImage image; - GdkGraphics gc; - int startX, startY; - int redBG; - int greenBG; - int blueBG; - double affine[]; - int width, height; - boolean flipX, flipY; - Rectangle clip; - int s_width, s_height; - - public - GtkImagePainter (GtkImage image, GdkGraphics gc, int x, int y, - int width, int height, Color bgcolor) - { - this.image = image; - this.gc = (GdkGraphics) gc.create (); - startX = x; - startY = y; - redBG = bgcolor.getRed (); - greenBG = bgcolor.getGreen (); - blueBG = bgcolor.getBlue (); - this.width = width; - this.height = height; - flipX = flipY = false; - s_width = s_height = 0; - clip = null; - - new Thread (this).start (); - } - - public - GtkImagePainter (GtkImage image, GdkGraphics gc, - int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, - Color bgcolor) - { - this.image = image; - this.gc = (GdkGraphics) gc.create (); - startX = (dx1 < dx2) ? dx1 : dx2; - startY = dy1; - redBG = bgcolor.getRed (); - greenBG = bgcolor.getGreen (); - blueBG = bgcolor.getBlue (); - - this.width = Math.abs (dx2 - dx1); - this.height = Math.abs (dy2 - dy1); - - flipX = ((dx1 > dx2 && sx2 > sx1) - || (dx1 < dx2 && sx2 < sx1)); - - flipY = ((dy1 > dy2 && sy2 > sy1) - || (dy1 < dy2 && sy2 < sy1)); - - s_width = Math.abs (sx2 - sx1); - s_height = Math.abs (sy2 - sy1); - clip = new Rectangle (sx1, sy1, s_width, s_height); - - new Thread (this).start (); - } - - public void - run () - { - image.startProduction (this); - gc.dispose (); - } - - /* Convert pixel data into a format that gdkrgb can understand */ - static int[] - convertPixels (int[] pixels, ColorModel model) - { - if (model.equals (ColorModel.getRGBdefault ())) - return pixels; - - int ret[] = new int[pixels.length]; - - for (int i = 0; i < pixels.length; i++) - ret[i] = model.getRGB (pixels[i]); - - return ret; - } - - static int[] - convertPixels (byte[] pixels, ColorModel model) - { - int ret[] = new int[pixels.length]; - - for (int i = 0; i < pixels.length; i++) - ret[i] = model.getRGB (pixels[i]); - - return ret; - } - - native void - drawPixels (GdkGraphics gc, int bg_red, int bg_green, int bg_blue, - int x, int y, int width, int height, int[] pixels, int offset, - int scansize, double affine[]); - - - public void - setPixels (int x, int y, int width, int height, ColorModel model, - int[] pixels, int offset, int scansize) - { - if (clip != null) - { - Rectangle r; - r = clip.intersection (new Rectangle (x, y, width, height)); - if (r.width == 0 && r.height == 0) - return; - - offset += r.y * scansize + r.x; - - r.translate (-Math.abs (clip.x - startX), -Math.abs (clip.y - startY)); - - width = r.width; - height = r.height; - x = r.x; - y = r.y; - } - - drawPixels (gc, redBG, greenBG, blueBG, - startX + x, startY + y, - width, height, convertPixels (pixels, model), offset, - scansize, affine); - } - - public void - setPixels (int x, int y, int width, int height, ColorModel model, - byte[] pixels, int offset, int scansize) - { - setPixels (x, y, width, height, model, convertPixels (pixels, model), - offset, scansize); - } - - public void - setDimensions (int width, int height) - { - if (!flipX && !flipY && - ((this.width == -1 && this.height == -1) - || (this.width == width && this.height == height))) - return; - - affine = new double[6]; - affine[1] = affine[2] = affine[4] = affine[5] = 0; - - if (clip != null) - { - affine[0] = this.width / (double) s_width; - affine[3] = this.height / (double) s_height; - } - else - { - affine[0] = this.width / (double) width; - affine[3] = this.height / (double) height; - } - - if (flipX) - { - affine[0] = -affine[0]; - affine[4] = this.width; - } - - if (flipY) - { - affine[3] = -affine[3]; - affine[5] = this.height; - } - - if (affine[0] == 1 && affine[3] == 1) - affine = null; - } - - public void - setProperties (Hashtable props) - { - } - - public void - setColorModel (ColorModel model) - { - } - - public void - setHints (int flags) - { - } - - public void - imageComplete (int status) - { - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkLabelPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkLabelPeer.java deleted file mode 100644 index 5cd3fb7b327..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkLabelPeer.java +++ /dev/null @@ -1,88 +0,0 @@ -/* GtkLabelPeer.java -- Implements LabelPeer with GTK - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.*; -import java.awt.peer.*; - -public class GtkLabelPeer extends GtkComponentPeer - implements LabelPeer -{ - native void create (); - - public GtkLabelPeer (Label l) - { - super (l); - } - - public void setText (String text) - { - set ("label", text); - } - - public void setAlignment (int alignment) - { - set ("xalign", getGtkAlignment (alignment)); - } - - float getGtkAlignment (int alignment) - { - switch (alignment) - { - case Label.LEFT: - return 0.0f; - case Label.CENTER: - return 0.5f; - case Label.RIGHT: - return 1.0f; - } - - return 0.0f; - } - - public void getArgs (Component component, GtkArgList args) - { - super.getArgs (component, args); - - Label label = (Label) component; - - args.add ("label", label.getText ()); - args.add ("xalign", getGtkAlignment (label.getAlignment ())); - args.add ("yalign", 0.5f); - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java deleted file mode 100644 index 6686457ba42..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java +++ /dev/null @@ -1,126 +0,0 @@ -/* GtkListPeer.java -- Implements ListPeer with GTK - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.*; -import java.awt.peer.*; - -public class GtkListPeer extends GtkComponentPeer - implements ListPeer -{ -// native void create (ComponentPeer parent, String [] items, boolean mode); - - native void create (); - native void connectHooks (); - - native void getSize (int rows, int dims[]); - - public GtkListPeer (List list) - { - super (list); - - setMultipleMode (list.isMultipleMode ()); - - if (list.getItemCount () > 0) - append (list.getItems ()); - } - - native void append (String items[]); - - public native void add (String item, int index); - - public void addItem (String item, int index) - { - add (item, index); - } - - public void clear () - { - removeAll (); - } - - public native void delItems (int start, int end); - public native void deselect (int index); - - public Dimension getMinimumSize (int rows) - { - int dims[] = new int[2]; - - getSize (rows, dims); - return (new Dimension (dims[0], dims[1])); - } - - public Dimension getPreferredSize (int rows) - { - int dims[] = new int[2]; - - getSize (rows, dims); - return (new Dimension (dims[0], dims[1])); - } - - public native int[] getSelectedIndexes (); - public native void makeVisible (int index); - - public Dimension minimumSize (int rows) - { - return (getMinimumSize (rows)); - } - - public Dimension preferredSize (int rows) - { - return (getPreferredSize (rows)); - } - - public void removeAll () - { - delItems (0, -1); - } - - public native void select (int index); - public native void setMultipleMode (boolean b); - - public void setMultipleSelections (boolean b) - { - setMultipleMode (b); - } - - protected void postItemEvent (int item, int stateChange) - { - postItemEvent (new Integer (item), stateChange); - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMainThread.java b/libjava/gnu/java/awt/peer/gtk/GtkMainThread.java deleted file mode 100644 index 6efa8410197..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkMainThread.java +++ /dev/null @@ -1,80 +0,0 @@ -/* GtkMainThread.java -- Runs gtk_main() - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; - -public class GtkMainThread extends GtkGenericPeer implements Runnable -{ - private static Thread mainThread = null; - private static Object mainThreadLock = new Object(); - - static native void gtkInit(); - native void gtkMain(); - - public GtkMainThread() - { - super (null); - synchronized (mainThreadLock) - { - if (mainThread != null) - throw new IllegalStateException(); - mainThread = new Thread(this, "GtkMain"); - } - - synchronized (this) - { - mainThread.start(); - try { - wait(); - } catch (InterruptedException e) { } - } - } - - public void run() - { - synchronized (this) - { - gtkInit(); - notify(); - } - gtkMain(); - } -} - - - diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java deleted file mode 100644 index 6ceb8641481..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java +++ /dev/null @@ -1,69 +0,0 @@ -/* GtkMenuBarPeer.java -- Implements MenuBarPeer with GTK+ - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.*; -import java.awt.peer.MenuBarPeer; -import java.awt.peer.MenuPeer; - -public class GtkMenuBarPeer extends GtkMenuComponentPeer - implements MenuBarPeer -{ - - native void create (); - native void addMenu (MenuPeer menu); - - public GtkMenuBarPeer (MenuBar target) - { - super (target); - create (); - } - - /* In Gnome, help menus are no longer right flushed. */ - public void addHelpMenu (Menu menu) - { - addMenu (menu); - } - - public void addMenu (Menu menu) - { - addMenu ((MenuPeer) menu.getPeer ()); - } - - native public void delMenu (int index); -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java deleted file mode 100644 index e04ce999324..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java +++ /dev/null @@ -1,54 +0,0 @@ -/* GtkMenuComponentPeer.java -- Implements MenuComponentPeer with GTK+ - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.*; -import java.awt.peer.MenuComponentPeer; - -public class GtkMenuComponentPeer extends GtkGenericPeer - implements MenuComponentPeer -{ - public GtkMenuComponentPeer (Object awtWidget) - { - super (awtWidget); - } - - public void dispose () - { - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java deleted file mode 100644 index 1428011133b..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java +++ /dev/null @@ -1,92 +0,0 @@ -/* GtkMenuItemPeer.java -- Implements MenuItemPeer with GTK+ - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.*; -import java.awt.peer.MenuItemPeer; -import java.awt.peer.MenuComponentPeer; -import java.awt.peer.MenuBarPeer; -import java.awt.peer.MenuPeer; - -public class GtkMenuItemPeer extends GtkMenuComponentPeer - implements MenuItemPeer -{ - native void create (String label); - - public GtkMenuItemPeer (MenuItem item) - { - super (item); - create (item.getLabel ()); - setEnabled (item.isEnabled ()); - setParent (item); - } - - void setParent (MenuItem item) - { - // add ourself differently, based on what type of parent we have - // yes, the typecasting here is nasty. - Object parent = item.getParent (); - if (parent instanceof MenuBar) - { - ((GtkMenuBarPeer)((MenuBar)parent).getPeer ()).addMenu ((MenuPeer) this); - } - else // parent instanceof Menu - { - ((GtkMenuPeer)((Menu)parent).getPeer ()).addItem (this, - item.getShortcut ()); - } - } - - public void disable () - { - setEnabled (false); - } - - public void enable () - { - setEnabled (true); - } - - native public void setEnabled (boolean b); - native public void setLabel (String label); - - protected void postMenuActionEvent () - { - postActionEvent (((MenuItem)awtWidget).getActionCommand (), 0); - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMenuPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkMenuPeer.java deleted file mode 100644 index 51733a6f0b6..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkMenuPeer.java +++ /dev/null @@ -1,99 +0,0 @@ -/* GtkMenuPeer.java -- Implements MenuPeer with GTK+ - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.*; -import java.awt.peer.MenuPeer; -import java.awt.peer.MenuItemPeer; - -public class GtkMenuPeer extends GtkMenuItemPeer - implements MenuPeer -{ - native void create (String label); - native void addItem (MenuItemPeer item, int key, boolean shiftModifier); - native void setupAccelGroup (GtkGenericPeer container); - - public GtkMenuPeer (Menu menu) - { - super (menu); - - MenuContainer parent = menu.getParent (); - if (parent instanceof Menu) - setupAccelGroup ((GtkGenericPeer)((Menu)parent).getPeer ()); - else if (parent instanceof Component) - setupAccelGroup ((GtkGenericPeer)((Component)parent).getPeer ()); - else - setupAccelGroup (null); - } - - public void addItem (MenuItem item) - { - int key = 0; - boolean shiftModifier = false; - - MenuShortcut ms = item.getShortcut (); - if (ms != null) - { - key = ms.getKey (); - shiftModifier = ms.usesShiftModifier (); - } - - addItem ((MenuItemPeer) item.getPeer (), key, shiftModifier); - } - - public void addItem (MenuItemPeer item, MenuShortcut ms) - { - int key = 0; - boolean shiftModifier = false; - - if (ms != null) - { - key = ms.getKey (); - shiftModifier = ms.usesShiftModifier (); - } - - addItem (item, key, shiftModifier); - } - - public void addSeparator () - { - addItem (new MenuItem ("-")); - } - - native public void delItem (int index); -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkOffScreenImage.java b/libjava/gnu/java/awt/peer/gtk/GtkOffScreenImage.java deleted file mode 100644 index 135fbf627c3..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkOffScreenImage.java +++ /dev/null @@ -1,87 +0,0 @@ -/* GtkOffScreenImage.java - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package gnu.java.awt.peer.gtk; - -import java.awt.*; -import java.awt.image.*; - -public class GtkOffScreenImage extends Image -{ - int width, height; - ImageProducer source; - Graphics g; - - public GtkOffScreenImage (ImageProducer source, Graphics g, - int width, int height) - { - this.width = width; - this.height = height; - - this.source = source; - this.g = g; - } - - public int getWidth (ImageObserver observer) - { - return width; - } - - public int getHeight (ImageObserver observer) - { - return height; - } - - public ImageProducer getSource () - { - return source; - } - - public Graphics getGraphics () - { - return g; - } - - public Object getProperty (String name, ImageObserver observer) - { - return Image.UndefinedProperty; - } - - public void flush () - { - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkPanelPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkPanelPeer.java deleted file mode 100644 index 168e075b28b..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkPanelPeer.java +++ /dev/null @@ -1,53 +0,0 @@ -/* GtkPanelPeer.java -- Implements PanelPeer with GTK - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.peer.*; -import java.awt.*; - -public class GtkPanelPeer extends GtkContainerPeer - implements PanelPeer -{ - native void create (); - native void connectHooks (); - - public GtkPanelPeer (Panel p) - { - super (p); - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java deleted file mode 100644 index e29d749c791..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java +++ /dev/null @@ -1,70 +0,0 @@ -/* GtkPopupMenuPeer.java -- Implements PopupMenuPeer with GTK+ - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.*; -import java.awt.peer.ComponentPeer; -import java.awt.peer.PopupMenuPeer; - -public class GtkPopupMenuPeer extends GtkMenuPeer - implements PopupMenuPeer -{ - public GtkPopupMenuPeer (PopupMenu menu) - { - super (menu); - } - - native void setupAccelGroup (GtkGenericPeer container); - - void setParent (MenuItem item) - { - // we don't need to "add" ourselves to our parent - } - - native void show (int x, int y, long time); - public void show (Component origin, int x, int y) - { - Point abs = origin.getLocationOnScreen (); - show (abs.x + x, abs.y + y, 0); - } - - public void show (Event e) - { - - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java b/libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java deleted file mode 100644 index 9abde2ae44b..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java +++ /dev/null @@ -1,91 +0,0 @@ -/* GtkScrollPanePeer.java -- Implements ScrollPanePeer with GTK - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.peer.*; -import java.awt.*; - -public class GtkScrollPanePeer extends GtkContainerPeer - implements ScrollPanePeer -{ - native void create (); - - native void gtkScrolledWindowNew(ComponentPeer parent, - int policy, int w, int h, int[] dims); - native void gtkScrolledWindowSetScrollPosition(int x, int y); - native void gtkScrolledWindowSetHScrollIncrement (int u); - native void gtkScrolledWindowSetVScrollIncrement (int u); - native void gtkScrolledWindowSetSize(int w, int h); - - public GtkScrollPanePeer (ScrollPane sp) - { - super (sp); - - setPolicy (sp.getScrollbarDisplayPolicy ()); - } - - native void setPolicy (int policy); - native public void childResized (int width, int height); - native public int getHScrollbarHeight (); - native public int getVScrollbarWidth (); - native public void setScrollPosition (int x, int y); - -// public Dimension getPreferredSize () -// { -// return new Dimension (60, 60); -// } - - public void setUnitIncrement (Adjustable adj, int u) - { - if (adj.getOrientation()==Adjustable.HORIZONTAL) - gtkScrolledWindowSetHScrollIncrement (u); - else - gtkScrolledWindowSetVScrollIncrement (u); - } - - public void setValue (Adjustable adj, int v) - { -// System.out.println("SPP: setVal: "+adj+":"+v); -// Point p=myScrollPane.getScrollPosition (); -// if (adj.getOrientation()==Adjustable.HORIZONTAL) -// gtkScrolledWindowSetScrollPosition (v,p.y); -// else -// gtkScrolledWindowSetScrollPosition (p.x,v); -// adj.setValue(v); - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java deleted file mode 100644 index 07aee679158..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java +++ /dev/null @@ -1,78 +0,0 @@ -/* GtkScrollbarPeer.java -- Implements ScrollbarPeer with GTK+ - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.*; -import java.awt.peer.*; -import java.awt.event.AdjustmentEvent; - -public class GtkScrollbarPeer extends GtkComponentPeer - implements ScrollbarPeer -{ - void create () - { - Scrollbar sb = (Scrollbar) awtComponent; - - create (sb.getOrientation (), sb.getValue (), - sb.getMinimum (), sb.getMaximum (), - sb.getUnitIncrement (), sb.getBlockIncrement (), - sb.getVisibleAmount ()); - } - - native void create (int orientation, int value, - int min, int max, int stepIncr, int pageIncr, - int visibleAmount); - - native void connectHooks (); - - public GtkScrollbarPeer (Scrollbar s) - { - super (s); - } - - native public void setLineIncrement (int amount); - native public void setPageIncrement (int amount); - native public void setValues (int value, int visible, int min, int max); - - protected void postAdjustmentEvent (int type, int value) - { - q.postEvent (new AdjustmentEvent ((Adjustable)awtComponent, - AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, - type, value)); - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java deleted file mode 100644 index ad83008cb8a..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java +++ /dev/null @@ -1,109 +0,0 @@ -/* GtkTextAreaPeer.java -- Implements TextAreaPeer with GTK - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.peer.*; -import java.awt.*; - -public class GtkTextAreaPeer extends GtkTextComponentPeer - implements TextAreaPeer -{ - native void create (int scrollbarVisibility); - - native void gtkSetFont(String xlfd, int size); - - void create () - { - create (((TextArea)awtComponent).getScrollbarVisibility ()); - } - - // native void create (Object parent, String text, int scroll); - native void gtkTextGetSize (int rows, int cols, int dims[]); - - public GtkTextAreaPeer (TextArea ta) - { - super (ta); - } - - public native void insert (String str, int pos); - public native void replaceRange (String str, int start, int end); - - public Dimension getMinimumSize (int rows, int cols) - { - int dims[] = new int[2]; - - gtkTextGetSize (rows, cols, dims); - - return (new Dimension (dims[0], dims[1])); - } - - public Dimension getPreferredSize (int rows, int cols) - { - int dims[] = new int[2]; - - gtkTextGetSize (rows, cols, dims); - - return (new Dimension (dims[0], dims[1])); - } - - /* Deprecated */ - public Dimension minimumSize (int rows, int cols) - { - return getMinimumSize (rows, cols); - } - - public Dimension preferredSize (int rows, int cols) - { - return getPreferredSize (rows, cols); - } - - public void replaceText (String str, int start, int end) - { - replaceRange (str, start, end); - } - - public void insertText (String str, int pos) - { - insert (str, pos); - } - - public void setFont (Font f) - { - gtkSetFont(((GtkFontPeer)f.getPeer()).getXLFD(), f.getSize()); - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java deleted file mode 100644 index d9ebd40aa72..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java +++ /dev/null @@ -1,94 +0,0 @@ -/* GtkTextComponentPeer.java -- Implements TextComponentPeer with GTK - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.peer.*; -import java.awt.*; - -public class GtkTextComponentPeer extends GtkComponentPeer - implements TextComponentPeer -{ - GtkTextComponentPeer (TextComponent tc) - { - super (tc); - - setText (tc.getText ()); - } - - public native int getCaretPosition (); - public void setCaretPosition (int pos) - { - set ("text_position", pos); - } - public native int getSelectionStart (); - public native int getSelectionEnd (); - public native String getText (); - public native void select (int start, int end); - - public void setEditable (boolean state) - { - set ("editable", state); - } - - public native void setText (String text); - - public void getArgs (Component component, GtkArgList args) - { - super.getArgs (component, args); - - TextComponent tc = (TextComponent) component; - - args.add ("text_position", tc.getCaretPosition ()); - args.add ("editable", tc.isEditable ()); - } - - public int getIndexAtPoint(int x, int y) - { - return 0; // FIXME - } - - public Rectangle getCharacterBounds (int pos) - { - return null; - } - - public long filterEvents (long filter) - { - return filter; // FIXME - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java deleted file mode 100644 index 628cdd627ae..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java +++ /dev/null @@ -1,105 +0,0 @@ -/* GtkTextFieldPeer.java -- Implements TextFieldPeer with GTK - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.peer.*; -import java.awt.*; - -public class GtkTextFieldPeer extends GtkTextComponentPeer - implements TextFieldPeer -{ - -// native void create (ComponentPeer parent, String text); - - native void create (); - native void createHooks (); - - native void gtkEntryGetSize (int cols, int dims[]); - - native void gtkSetFont(String xlfd, int size); - - public GtkTextFieldPeer (TextField tf) - { - super (tf); - - if (tf.echoCharIsSet ()) - setEchoChar (tf.getEchoChar ()); - } - - public Dimension getMinimumSize (int cols) - { - int dims[] = new int[2]; - - gtkEntryGetSize (cols, dims); - - return (new Dimension (dims[0], dims[1])); - } - - public Dimension getPreferredSize (int cols) - { - int dims[] = new int[2]; - - gtkEntryGetSize (cols, dims); - - return (new Dimension (dims[0], dims[1])); - } - - public native void setEchoChar (char c); - - /* Deprecated */ - - public Dimension minimumSize (int cols) - { - return getMinimumSize (cols); - } - - public Dimension preferredSize (int cols) - { - return getPreferredSize (cols); - } - - public void setEchoCharacter (char c) - { - setEchoChar (c); - } - - public void setFont (Font f) - { - gtkSetFont(((GtkFontPeer)f.getPeer()).getXLFD(), f.getSize()); - } -} diff --git a/libjava/gnu/java/awt/peer/gtk/GtkToolkit.java b/libjava/gnu/java/awt/peer/gtk/GtkToolkit.java deleted file mode 100644 index ffdc910e8a2..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkToolkit.java +++ /dev/null @@ -1,329 +0,0 @@ -/* GtkToolkit.java -- Implements an AWT Toolkit using GTK for peers - Copyright (C) 1998, 1999, 2002, 2003 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; - -import java.awt.*; -import java.awt.datatransfer.*; -import java.awt.dnd.DragGestureEvent; -import java.awt.dnd.peer.DragSourceContextPeer; -import java.awt.im.InputMethodHighlight; -import java.awt.image.*; -import java.awt.peer.*; -import java.net.*; -import java.util.Hashtable; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.Properties; -import gnu.java.awt.image.*; -import gnu.classpath.Configuration; - -/* This class uses a deprecated method java.awt.peer.ComponentPeer.getPeer(). - This merits comment. We are basically calling Sun's bluff on this one. - We think Sun has deprecated it simply to discourage its use as it is - bad programming style. However, we need to get at a component's peer in - this class. If getPeer() ever goes away, we can implement a hash table - that will keep up with every window's peer, but for now this is faster. */ - -public class GtkToolkit extends java.awt.Toolkit -{ - GtkMainThread main; - Hashtable containers = new Hashtable(); - static EventQueue q = new EventQueue(); - static Clipboard systemClipboard; - - static - { - if (Configuration.INIT_LOAD_LIBRARY) - System.loadLibrary("gtkpeer"); - } - - public GtkToolkit () - { - main = new GtkMainThread (); - systemClipboard = new GtkClipboard (); - GtkGenericPeer.enableQueue (q); - } - - native public void beep (); - native private void getScreenSizeDimensions (int[] xy); - - public int checkImage (Image image, int width, int height, - ImageObserver observer) - { - return ImageObserver.ALLBITS; - -// GtkImage i = (GtkImage) image; -// return i.checkImage (); - } - - public Image createImage (String filename) - { - // FIXME - gcj local: GdkPixbufDecoder doesn't work. - // return new GtkImage (new GdkPixbufDecoder (filename), null); - return null; - } - - public Image createImage (URL url) - { - // FIXME - gcj local: GdkPixbufDecoder doesn't work. - // return new GtkImage (new GdkPixbufDecoder (url), null); - return null; - } - - public Image createImage (ImageProducer producer) - { - return new GtkImage (producer, null); - } - - public Image createImage (byte[] imagedata, int imageoffset, - int imagelength) - { - // System.out.println ("createImage byte[] NOT SUPPORTED"); - return null; - } - - public ColorModel getColorModel () - { - return ColorModel.getRGBdefault (); - } - - public String[] getFontList () - { - return (new String[] { "Dialog", - "DialogInput", - "Monospaced", - "Serif", - "SansSerif" }); - } - - public FontMetrics getFontMetrics (Font font) - { - return new GdkFontMetrics (font); - } - - public Image getImage (String filename) - { - // FIXME - gcj local: GdkPixbufDecoder doesn't work. - // return new GtkImage (new GdkPixbufDecoder (filename), null); - return null; - } - - public Image getImage (URL url) - { - // FIXME - gcj local: GdkPixbufDecoder doesn't work. - // return new GtkImage (new GdkPixbufDecoder (url), null); - return null; - } - - public PrintJob getPrintJob (Frame frame, String jobtitle, Properties props) - { - return null; - } - - native public int getScreenResolution(); - - public Dimension getScreenSize () { - int dim[] = new int[2]; - getScreenSizeDimensions(dim); - return new Dimension(dim[0], dim[1]); - } - - public Clipboard getSystemClipboard() - { - return systemClipboard; - } - - public boolean prepareImage (Image image, int width, int height, - ImageObserver observer) - { - return false; - } - - native public void sync (); - - protected void setComponentState (Component c, GtkComponentPeer cp) - { - /* Make the Component reflect Peer defaults */ - if (c.getForeground () == null) - c.setForeground (cp.getForeground ()); - if (c.getBackground () == null) - c.setBackground (cp.getBackground ()); - // if (c.getFont () == null) - // c.setFont (cp.getFont ()); - - /* Make the Peer reflect the state of the Component */ - if (! (c instanceof Window)) - { - cp.setCursor (c.getCursor ()); - - Rectangle bounds = c.getBounds (); - cp.setBounds (bounds.x, bounds.y, bounds.width, bounds.height); - cp.setVisible (c.isVisible ()); - } - } - - protected ButtonPeer createButton (Button b) - { - return new GtkButtonPeer (b); - } - - protected CanvasPeer createCanvas (Canvas c) - { - return new GtkCanvasPeer (c); - } - - protected CheckboxPeer createCheckbox (Checkbox cb) - { - return new GtkCheckboxPeer (cb); - } - - protected CheckboxMenuItemPeer createCheckboxMenuItem (CheckboxMenuItem cmi) - { - return new GtkCheckboxMenuItemPeer (cmi); - } - - protected ChoicePeer createChoice (Choice c) - { - return new GtkChoicePeer (c); - } - - protected DialogPeer createDialog (Dialog d) - { - return new GtkDialogPeer (d); - } - - protected FileDialogPeer createFileDialog (FileDialog fd) - { - return new GtkFileDialogPeer (fd); - } - - protected FramePeer createFrame (Frame f) - { - return new GtkFramePeer (f); - } - - protected LabelPeer createLabel (Label label) - { - return new GtkLabelPeer (label); - } - - protected ListPeer createList (List list) - { - return new GtkListPeer (list); - } - - protected MenuPeer createMenu (Menu m) - { - return new GtkMenuPeer (m); - } - - protected MenuBarPeer createMenuBar (MenuBar mb) - { - return new GtkMenuBarPeer (mb); - } - - protected MenuItemPeer createMenuItem (MenuItem mi) - { - return new GtkMenuItemPeer (mi); - } - - protected PanelPeer createPanel (Panel p) - { - return new GtkPanelPeer (p); - } - - protected PopupMenuPeer createPopupMenu (PopupMenu target) - { - return new GtkPopupMenuPeer (target); - } - - protected ScrollPanePeer createScrollPane (ScrollPane sp) - { - return new GtkScrollPanePeer (sp); - } - - protected ScrollbarPeer createScrollbar (Scrollbar sb) - { - return new GtkScrollbarPeer (sb); - } - - protected TextAreaPeer createTextArea (TextArea ta) - { - return new GtkTextAreaPeer (ta); - } - - protected TextFieldPeer createTextField (TextField tf) - { - return new GtkTextFieldPeer (tf); - } - - protected WindowPeer createWindow (Window w) - { - return new GtkWindowPeer (w); - } - - protected FontPeer getFontPeer (String name, int style) - { - try { - GtkFontPeer fp = new GtkFontPeer (name, style); - return fp; - } catch (MissingResourceException ex) { - return null; - } - } - - protected EventQueue getSystemEventQueueImpl() - { - return q; - } - - protected void loadSystemColors (int[] systemColors) - { - } - - public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent e) - { - throw new Error("not implemented"); - } - - public Map mapInputMethodHighlight(InputMethodHighlight highlight) - { - throw new Error("not implemented"); - } -} // class GtkToolkit diff --git a/libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java deleted file mode 100644 index 7ef667e50ea..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java +++ /dev/null @@ -1,111 +0,0 @@ -/* GtkWindowPeer.java -- Implements WindowPeer with GTK - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; -import java.awt.peer.*; -import java.awt.*; - -public class GtkWindowPeer extends GtkContainerPeer - implements WindowPeer -{ - static protected final int GTK_WINDOW_TOPLEVEL = 0; - static protected final int GTK_WINDOW_DIALOG = 1; - static protected final int GTK_WINDOW_POPUP = 2; - - native void create (int type); - - void create () - { - create (GTK_WINDOW_POPUP); - } - - native void connectHooks (); - - public GtkWindowPeer (Window window) - { - super (window); - - Dimension d = window.getSize (); - setBounds (0, 0, d.width, d.height); - } - - public void getArgs (Component component, GtkArgList args) - { - args.add ("visible", component.isVisible ()); - args.add ("sensitive", component.isEnabled ()); - } - - native public void toBack (); - native public void toFront (); - - native public void setBounds (int x, int y, int width, int height); - - public void setTitle (String title) - { - set ("title", title); - } - - native public void setResizable (boolean r); - - protected void postConfigureEvent (int x, int y, int width, int height, - int top, int left, int bottom, int right) - { - /* - If our borders change (which often happens when we opaque resize), - we need to make sure that a new layout will happen, since Sun - forgets to handle this case. - */ - if (insets.top != top - || insets.left != left - || insets.bottom != bottom - || insets.right != right) - { - awtComponent.invalidate (); - } - - insets.top = top; - insets.left = left; - insets.bottom = bottom; - insets.right = right; - - awtComponent.setBounds (x, y, width, height); - awtComponent.validate (); - } - - native public void setVisible (boolean b); -} diff --git a/libjava/gnu/java/awt/peer/gtk/Test.java b/libjava/gnu/java/awt/peer/gtk/Test.java deleted file mode 100644 index 7ecb593f125..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/Test.java +++ /dev/null @@ -1,299 +0,0 @@ -/* Test.java -- Tests the GTK Toolkit - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -import java.util.*; -import java.awt.*; -import java.awt.event.*; -import java.awt.peer.*; -import java.awt.datatransfer.*; -import gnu.java.awt.image.*; -import java.io.*; - -class Test -{ - static int xs = 5, ys = 5; - - public static void main(String args[]) - { - if (args.length == 0) - { - Properties prop=System.getProperties (); - prop.put ("awt.toolkit","gnu.java.awt.peer.gtk.GtkToolkit"); - } - - final Frame f=new Frame(); - f.setTitle ("Red Hat Classpath"); - -// f.addComponentListener (new ComponentAdapter() { -// public void componentMoved (ComponentEvent e) { -// System.out.println("component moved"); -// } -// public void componentResized (ComponentEvent e) { -// System.out.println("component resized"); -// } -// }); - f.setSize(200,200); - - Panel pan=new Panel(); - - final Label l = new Label ("Pithy Message:"); - l.setCursor (Cursor.getPredefinedCursor (Cursor.WAIT_CURSOR)); - pan.add (l); - - TextField tf = new TextField("Hello world!"); - pan.add(tf); - - final Image img; - img = Toolkit.getDefaultToolkit ().createImage (new XBMDecoder ("fvwm.xbm")); - - - final Canvas ch = new Canvas () { - - public void update (Graphics g) - { - System.out.println ("update called"); - super.update (g); - } - public void paint (Graphics g) { - g.drawString("Hello world!", xs+5, ys+10); - g.setColor (Color.blue); - g.drawLine (xs,ys,xs+20,ys+20); - -// System.out.println (TextArea.SCROLLBARS_BOTH); -// System.out.println (TextArea.SCROLLBARS_HORIZONTAL_ONLY); -// System.out.println (TextArea.SCROLLBARS_VERTICAL_ONLY); - -// Font f1 = new Font ("TimesRoman", Font.PLAIN, 10); -// System.out.println (f1.getName ()); -// System.out.println (f1.getFamily ()); - -// Font font = new Font ("Serif", Font.PLAIN, 18); -// g.setFont (font); -// g.setXORMode (Color.red); - - -// System.out.println (g.getFontMetrics (font).stringWidth ("foobar")); - -// System.out.println (g.drawImage (img, 0, 0, this)); - } - }; - - ch.setSize(60, 60); -// List ch=new List(); -// ch.add("Ding"); -// ch.add("September"); -// ch.add("Red"); -// ch.add("Quassia"); -// ch.add("Pterodactyl"); - -// ch.addMouseListener(new MouseAdapter() { -// public void mousePressed(MouseEvent e) { -// System.out.println("mouse pressed ch"); -// System.out.println("shift = " + e.isShiftDown()); -// System.out.println("meta = " + e.isMetaDown()); -// System.out.println("alt = " + e.isAltDown()); -// System.out.println("ctrl = " + e.isControlDown()); -// System.out.println("x = " + e.getX()); -// System.out.println("y = " + e.getY()); -// System.out.println("clickcount = " + e.getClickCount()); -// System.out.println("when = " + e.getWhen()); -// System.out.println(); -// } -// public void mouseReleased(MouseEvent e) { -// System.out.println("mouse released ch"); -// } -// public void mouseClicked(MouseEvent e) { -// System.out.println("mouse clicked ch"); -// } -// }); - - pan.add(ch); - f.add(pan,"North"); - - final ScrollPane sp=new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS); - System.out.println ("ALWAYS HERE: " + ScrollPane.SCROLLBARS_ALWAYS); - System.out.println ("ALWAYS" + ScrollPane.SCROLLBARS_ALWAYS); - System.out.println ("NEEDED" + ScrollPane.SCROLLBARS_AS_NEEDED); - System.out.println ("NEVER " + ScrollPane.SCROLLBARS_NEVER); - - - final Panel p=new Panel(); - System.out.println ("PREFERED: " + p.getPreferredSize ()); - p.add(new Button("Stop")); - System.out.println ("PREFERED: " + p.getPreferredSize ()); - p.add(new Button("evil")); - System.out.println ("PREFERED: " + p.getPreferredSize ()); - p.add(new Button("hoarders")); - p.add(new Button("use")); - p.add(new Button("GNU")); - p.add(new Scrollbar(Scrollbar.HORIZONTAL)); - System.out.println ("PREFERED: " + p.getPreferredSize ()); - - sp.add(p); - f.add(sp,"South"); - - Panel east_panel = new Panel(); - east_panel.setLayout(new GridLayout (0,1)); - -// CheckboxGroup group = new CheckboxGroup(); - -// Checkbox cb=new Checkbox("one", group, true); -// east_panel.add(cb); -// cb=new Checkbox("two", group, false); -// east_panel.add(cb); - -// cb.addMouseListener(new MouseAdapter() { -// public void mousePressed(MouseEvent e) { -// System.out.println("mouse pressed cb"); -// System.out.println("shift = " + e.isShiftDown()); -// System.out.println("meta = " + e.isMetaDown()); -// System.out.println("alt = " + e.isAltDown()); -// System.out.println("ctrl = " + e.isControlDown()); -// System.out.println("x = " + e.getX()); -// System.out.println("y = " + e.getY()); -// System.out.println("clickcount = " + e.getClickCount()); -// System.out.println("when = " + e.getWhen()); -// System.out.println(); -// } -// public void mouseReleased(MouseEvent e) { -// System.out.println("mouse released cb"); -// } -// public void mouseClicked(MouseEvent e) { -// System.out.println("mouse clicked cb"); -// } -// public void mouseEntered(MouseEvent e) { -// System.out.println("mouse entered cb"); -// } -// public void mouseExited(MouseEvent e) { -// System.out.println("mouse exited cb"); -// } -// }); - - f.add(east_panel,"East"); - - final Button wb=new Button(); - wb.setLabel("Destroy Frame on Click"); - wb.addActionListener (new ActionListener () { - public void actionPerformed (ActionEvent e) { - ScrollPanePeer peer = (ScrollPanePeer)sp.getPeer (); - if (peer != null) - { - System.out.println (peer.getHScrollbarHeight ()); - System.out.println (peer.getVScrollbarWidth ()); - } - - l.setText ("Hello World!"); - System.out.println ("PREFERED: " + p.getPreferredSize ()); - - final Dialog d = new Dialog (f); - d.setModal (true); - Button b = new Button ("foobar"); - b.addMouseListener (new MouseAdapter () { - public void mousePressed (MouseEvent me) { - System.out.println ("I got called"); - d.hide (); - -// System.out.println (ScrollPane.SCROLLBARS_ALWAYS); -// System.out.println (ScrollPane.SCROLLBARS_AS_NEEDED); -// System.out.println (ScrollPane.SCROLLBARS_NEVER); - } - }); - d.add (b); - d.pack (); - d.show (); - System.out.println ("hello world"); -// System.out.println ("action listener on wb called"); -// Clipboard clip = Toolkit.getDefaultToolkit ().getSystemClipboard (); -// StringSelection ss = new StringSelection("123456789"); -// clip.setContents (ss, ss); -// Transferable t = clip.getContents (this); -// try { -// System.out.println (t.getTransferData (DataFlavor.stringFlavor)); -// } catch (Exception ex) { -// ex.printStackTrace (); -// } -// System.exit (0); - } - }); - - wb.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent e) { - System.out.println("mouse pressed wb"); - xs++; - ys++; - ch.repaint (); - } - public void mouseReleased(MouseEvent e) { - System.out.println("mouse released wb"); - } - public void mouseClicked(MouseEvent e) { - System.out.println("mouse clicked wb"); - } - public void mouseEntered(MouseEvent e) { - System.out.println("mouse entered wb"); - } - public void mouseExited(MouseEvent e) { - System.out.println("mouse exited wb"); - } - }); - - f.add(wb,"West"); - - f.pack(); - f.show(); - - sp.setScrollPosition (10,0); - - Toolkit t = Toolkit.getDefaultToolkit(); - /* t.beep(); */ - System.out.println("screen size: " + t.getScreenSize()); - System.out.println("resolution : " + t.getScreenResolution()); -// try { -// Thread.sleep (5000); -// } catch (InterruptedException e) {} -// f.setSize(500,500); - - System.out.println ("background of canvas: " + ch.getBackground ()); - System.out.println ("foreground of canvas: " + ch.getForeground ()); - - System.out.println("done"); - } -} - - - diff --git a/libjava/gnu/java/awt/peer/gtk/TestAWT.java b/libjava/gnu/java/awt/peer/gtk/TestAWT.java deleted file mode 100644 index 48cdce1a1fe..00000000000 --- a/libjava/gnu/java/awt/peer/gtk/TestAWT.java +++ /dev/null @@ -1,571 +0,0 @@ -/* TestAWT.java -- Tests the AWT like testgtk - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -import java.awt.List; -import java.util.*; -import java.awt.*; -import java.awt.event.*; -import java.awt.peer.*; - -class TestAWT -{ - public static void main(String args[]) - { - if (args.length==0) - { - Properties prop = System.getProperties (); - prop.put ("awt.toolkit", "gnu.java.awt.peer.gtk.GtkToolkit"); - } - MainWindow f = new MainWindow(); - System.out.println(f.isDisplayable()); - f.show(); - System.out.println(f.isDisplayable()); - } -} - -interface SubWindow -{ - public void init (); -} - -class PrettyPanel extends Panel -{ - Insets myInsets; - - public PrettyPanel () - { - myInsets = new Insets (10, 10, 10, 10); - } - public Insets getInsets () - { - return myInsets; - } -} - -abstract class PrettyFrame extends Frame -{ - public PrettyFrame () - { - ((BorderLayout) getLayout ()).setHgap (5); - ((BorderLayout) getLayout ()).setVgap (5); - } - -// public Insets getInsets() -// { -// Insets oldInsets = super.getInsets (); -// return new Insets (oldInsets.top+10, -// oldInsets.left+10, -// oldInsets.bottom+10, -// oldInsets.right+10); -// } -} - -abstract class SubFrame extends PrettyFrame implements SubWindow -{ - boolean initted = false; - - public void setVisible (boolean visible) - { - if (!initted && visible) - init(); - super.setVisible (visible); - } -} - -class MainWindow extends PrettyFrame implements ActionListener -{ - Button closeButton; - - Hashtable windows; - Vector buttons; - - void addSubWindow (String name, SubWindow w) - { - Button b = new Button (name); - b.addActionListener (this); - - buttons.addElement (b); - windows.put (b, w); - } - - MainWindow () - { - MenuBar mb = new MenuBar (); - Menu menu = new Menu ("File"); - Menu submenu = new Menu ("Testing"); - submenu.add (new CheckboxMenuItem ("Foobar")); - menu.add (submenu); - mb.add (menu); - - setMenuBar (mb); - - add (new Label ("Classpath v0.0.0"), "North"); - - closeButton = new Button ("Close"); - closeButton.addActionListener (this); - closeButton.setFont (new Font ("Serif", Font.BOLD | Font.ITALIC, 18)); - add (closeButton, "South"); - - windows = new Hashtable (); - buttons = new Vector (); - - addSubWindow ("Buttons", new ButtonsWindow ()); - addSubWindow ("Cursors", new CursorsWindow ()); - addSubWindow ("Dialog", new DialogWindow (this)); - addSubWindow ("File", new FileWindow (this)); - addSubWindow ("Labels", new LabelWindow ()); - addSubWindow ("List", new ListWindow ()); - addSubWindow ("Radio Buttons", new RadioWindow ()); - addSubWindow ("TextField", new TextFieldWindow ()); - - Panel sp = new Panel(); - PrettyPanel p = new PrettyPanel(); - p.setLayout (new GridLayout (windows.size(), 1)); - - for (Enumeration e = buttons.elements (); e.hasMoreElements (); ) - { - p.add ((Button) e.nextElement ()); - } - - sp.add (p); - add (sp, "Center"); - - setSize (200, 86 + (windows.size ()*22)); - setTitle ("TestAWT"); - } - - public void actionPerformed (ActionEvent evt) - { - Button source = (Button) evt.getSource (); - - if (source==closeButton) - { - System.getProperties ().list (System.out); - dispose(); - System.exit (0); - } - - Window w = (Window) windows.get (source); - if (w.isVisible ()) - w.dispose (); - else - { - w.setVisible (true); - w.show(); - } - } -} - -class ButtonsWindow extends SubFrame implements ActionListener -{ - Button b[] = new Button [9]; - - public void init () - { - initted = true; - Panel p = new Panel (); - p.setLayout (new GridLayout (0, 3, 5, 5)); - - for (int i=0; i<9; i++) - { - b[i]=new Button ("button" + (i+1)); - b[i].addActionListener (this); - } - - p.add (b[0]); - p.add (b[6]); - p.add (b[4]); - p.add (b[8]); - p.add (b[1]); - p.add (b[7]); - p.add (b[3]); - p.add (b[5]); - p.add (b[2]); - - add (p, "North"); - - Button cb = new Button ("close"); - cb.addActionListener(new ActionListener () { - public void actionPerformed (ActionEvent e) { - dispose(); - } - }); - add (cb, "South"); - setTitle ("Buttons"); - } - - public void actionPerformed (ActionEvent evt) - { - Button source = (Button) evt.getSource (); - - for (int i=0; i<9; i++) - { - if (source == b[i]) - { - int i2=((i+1)==9)?0:(i+1); - if (b[i2].isVisible()) - b[i2].setVisible(false); - else - b[i2].setVisible(true); - } - } - } -} - - -class DialogWindow extends Dialog implements SubWindow -{ - Label text; - boolean initted = false; - - public DialogWindow (Frame f) - { - super (f, true); - } - - public void setVisible (boolean visible) - { - if (!initted && visible) - init(); - super.setVisible (visible); - } - - public void init () - { - text = new Label ("Dialog Test"); - text.setAlignment (Label.CENTER); - - add (text, "North"); - text.setVisible (false); - - Panel p = new PrettyPanel(); - - Button cb = new Button ("OK"); - cb.addActionListener(new ActionListener () { - public void actionPerformed (ActionEvent e) - { - dispose(); - } - }); - - p.setLayout (new GridLayout (1, 2)); - ((GridLayout) p.getLayout ()).setHgap (5); - ((GridLayout) p.getLayout ()).setVgap (5); - p.add (cb); - - Button toggle = new Button ("Toggle"); - p.add (toggle); - - toggle.addActionListener(new ActionListener () { - public void actionPerformed (ActionEvent e) - { - if (text.isVisible ()) - text.setVisible (false); - else - text.setVisible (true); - doLayout(); - } - }); - - add (p, "South"); - setTitle ("Dialog"); - setSize (130, 70); - } -} - -class CursorsWindow extends SubFrame implements ItemListener -{ - Choice cursorChoice; - Canvas cursorCanvas; - - public void init () - { - cursorChoice = new Choice(); - cursorChoice.add ("Default"); - cursorChoice.add ("Crosshair"); - cursorChoice.add ("Text"); - cursorChoice.add ("Wait"); - cursorChoice.add ("Southwest Resize"); - cursorChoice.add ("Southeast Resize"); - cursorChoice.add ("Northwest Resize"); - cursorChoice.add ("Northeast Resize"); - cursorChoice.add ("North Resize"); - cursorChoice.add ("South Resize"); - cursorChoice.add ("West Resize"); - cursorChoice.add ("East Resize"); - cursorChoice.add ("Hand"); - cursorChoice.add ("Move"); - - cursorChoice.addItemListener(this); - - add (cursorChoice, "North"); - - cursorCanvas = new Canvas () - { - public void paint (Graphics g) - { - Dimension d = this.getSize(); - g.setColor (Color.white); - g.fillRect (0, 0, d.width, d.height/2); - g.setColor (Color.black); - g.fillRect (0, d.height/2, d.width, d.height/2); - g.setColor (this.getBackground()); - g.fillRect (d.width/3, d.height/3, d.width/3, - d.height/3); - } - }; - - cursorCanvas.setSize (80,80); - - add (cursorCanvas, "Center"); - - Button cb = new Button ("Close"); - cb.addActionListener(new ActionListener () { - public void actionPerformed (ActionEvent e) { - dispose(); - } - }); - - add (cb, "South"); - setTitle ("Cursors"); - setSize (160, 180); - } - - public void itemStateChanged (ItemEvent e) - { - cursorCanvas.setCursor (Cursor.getPredefinedCursor (cursorChoice.getSelectedIndex())); - } -} - -class TextFieldWindow extends SubFrame implements ItemListener -{ - Checkbox editable, visible, sensitive; - TextField text; - - public void init () - { - initted = true; - text = new TextField ("hello world"); - add (text, "North"); - - Panel p = new Panel(); - p.setLayout (new GridLayout (3, 1)); - ((GridLayout) p.getLayout ()).setHgap (5); - ((GridLayout) p.getLayout ()).setVgap (5); - - editable = new Checkbox("Editable", true); - p.add (editable); - editable.addItemListener (this); - - visible = new Checkbox("Visible", true); - p.add (visible); - visible.addItemListener (this); - - sensitive = new Checkbox("Sensitive", true); - p.add (sensitive); - sensitive.addItemListener (this); - - add (p, "Center"); - - Button cb = new Button ("Close"); - cb.addActionListener(new ActionListener () { - public void actionPerformed (ActionEvent e) { - dispose(); - } - }); - - add (cb, "South"); - setTitle ("TextField"); - setSize (160, 180); - } - - public void itemStateChanged (ItemEvent e) - { - boolean on=true; - - if (e.getStateChange () == ItemEvent.DESELECTED) - on=false; - if (e.getSource() == editable) - text.setEditable (on); - if (e.getSource() == visible) - if (on) - text.setEchoChar ((char) 0); - else - text.setEchoChar ('*'); - if (e.getSource() == sensitive) - text.setEnabled (on); - - } -} - -class FileWindow extends FileDialog implements SubWindow -{ - boolean initted = false; - - public FileWindow (MainWindow mw) - { - super (mw); - } - - public void setVisible (boolean visible) - { - if (!initted && visible) - init(); - super.setVisible (visible); - } - - public void init() - { - initted = true; - } -} - -class LabelWindow extends SubFrame -{ - public void init () - { - initted = true; - - Panel p = new Panel(); - p.setLayout (new GridLayout (3, 1)); - ((GridLayout) p.getLayout ()).setHgap (5); - ((GridLayout) p.getLayout ()).setVgap (5); - - p.add (new Label ("left justified label", Label.LEFT)); - p.add (new Label ("center justified label", Label.CENTER)); - p.add (new Label ("right justified label", Label.RIGHT)); - - add (p, "Center"); - - Button cb = new Button ("Close"); - cb.addActionListener(new ActionListener () { - public void actionPerformed (ActionEvent e) { - dispose(); - } - }); - - add (cb, "South"); - setTitle ("Labels"); - setSize (160, 180); - } -} - -class ListWindow extends SubFrame -{ - public void init () - { - initted = true; - - Panel p = new Panel (); - p.setLayout (new GridLayout (3, 1)); - - List l = new List (5, true); - for (int i = 0; i < 10; i++) - l.add ("added item " + i); - - p.add (l); - - add (p, "Center"); - - Button cb = new Button ("Close"); - cb.addActionListener(new ActionListener () { - public void actionPerformed (ActionEvent e) { - dispose(); - } - }); - - add (cb, "South"); - setTitle ("List"); - setSize (85, 167); - } -} - - -class RadioWindow extends SubFrame -{ - public void init () - { - initted = true; - - Panel p = new Panel(); - p.setLayout (new GridLayout (3, 1)); - ((GridLayout) p.getLayout ()).setHgap (5); - ((GridLayout) p.getLayout ()).setVgap (5); - - final CheckboxGroup cg = new CheckboxGroup(); - final Checkbox[] boxes = new Checkbox[3]; - for (int i = 0; i < 3; ++i) - { - boxes[i] = new Checkbox("button" + i, cg, i == 0); - p.add(boxes[i]); - } - - add (p, "North"); - - p = new Panel(); - p.setLayout (new GridLayout (1, 3)); - ((GridLayout) p.getLayout ()).setHgap (5); - ((GridLayout) p.getLayout ()).setVgap (5); - - for (int i = 0; i < 3; ++i) - { - final int val = i; - Button tweak = new Button ("Set " + i); - tweak.addActionListener(new ActionListener () - { - public void actionPerformed (ActionEvent e) - { - cg.setSelectedCheckbox(boxes[val]); - } - }); - p.add(tweak); - } - - add (p, "Center"); - - Button cb = new Button ("Close"); - cb.addActionListener(new ActionListener () { - public void actionPerformed (ActionEvent e) { - dispose(); - } - }); - - add (cb, "South"); - setTitle ("Radio Buttons"); - setSize (85, 167); - } -} diff --git a/libjava/gnu/java/util/prefs/FileBasedFactory.java b/libjava/gnu/java/util/prefs/FileBasedFactory.java deleted file mode 100644 index fc6085feeb5..00000000000 --- a/libjava/gnu/java/util/prefs/FileBasedFactory.java +++ /dev/null @@ -1,57 +0,0 @@ -/* FileBasedFactory - Default Classpath implementation of a PreferencesFactory - Copyright (C) 2001 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package gnu.java.util.prefs; - -import java.util.prefs.*; - -/** - * Default Classpath implementation of a PreferencesFactory. - * Returns system and user root Preferences nodes that are read from files. - * - * @author Mark Wielaard (mark@klomp.org) - */ -public class FileBasedFactory implements PreferencesFactory { - - public Preferences systemRoot() { - return null; - } - - public Preferences userRoot() { - return null; - } -} diff --git a/libjava/gnu/java/util/prefs/MemoryBasedFactory.java b/libjava/gnu/java/util/prefs/MemoryBasedFactory.java deleted file mode 100644 index ff21066d393..00000000000 --- a/libjava/gnu/java/util/prefs/MemoryBasedFactory.java +++ /dev/null @@ -1,64 +0,0 @@ -/* MemoryBasedFactory - Memory based PreferencesFactory usefull for testing - Copyright (C) 2001 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package gnu.java.util.prefs; - -import java.util.prefs.*; - -/** - * Memory based PreferencesFactory usefull for testing. - * Returns completely empty Preferences for system and user roots. - * All changes are only backed by the current instances in memory. - * - * @author Mark Wielaard (mark@klomp.org) - */ -public class MemoryBasedFactory implements PreferencesFactory { - - // Static fields containing the preferences root nodes - private static final Preferences systemPreferences - = new MemoryBasedPreferences(null, "", false); - private static final Preferences userPreferences - = new MemoryBasedPreferences(null, "", true); - - public Preferences systemRoot() { - return systemPreferences; - } - - public Preferences userRoot() { - return userPreferences; - } -} diff --git a/libjava/gnu/java/util/prefs/MemoryBasedPreferences.java b/libjava/gnu/java/util/prefs/MemoryBasedPreferences.java deleted file mode 100644 index c1d59c7b1c9..00000000000 --- a/libjava/gnu/java/util/prefs/MemoryBasedPreferences.java +++ /dev/null @@ -1,144 +0,0 @@ -/* MemoryBasedPreferences - A Preference node which holds all entries in memory - Copyright (C) 2001 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package gnu.java.util.prefs; - -import java.util.HashMap; - -import java.util.prefs.*; - -/** - * A Preference node which holds all entries in memory - * - * @author Mark Wielaard (mark@klomp.org) - */ -public class MemoryBasedPreferences extends AbstractPreferences { - - /** True if this is a preference node in the user tree, false otherwise. */ - private final boolean isUser; - - /** Contains all the preference entries of this node. */ - private HashMap entries = new HashMap(); - - /** - * Creates a new preferences node with the given name and parent. - * When isUser is true it will be user node otherwise it will be a system - * node. It will always set the <code>newNode</code> field to true - * since there is no real backing store, so all nodes are new. - */ - public MemoryBasedPreferences(MemoryBasedPreferences parent, - String name, - boolean isUser) { - super(parent, name); - this.isUser = isUser; - - // Since we do not have a real backing store all nodes are new - newNode = true; - } - - /** - * Returns true if this node was created as a user node. - */ - public boolean isUserNode() { - return isUser; - } - - /** - * Returns an empty array since all children names are always already - * chached. - */ - protected String[] childrenNamesSpi() throws BackingStoreException { - return new String[0]; - } - - /** - * Returns a new node with the given name with as parent this node and - * with the <code>isUser</code> flag set to the same value as this node. - */ - protected AbstractPreferences childSpi(String childName) { - return new MemoryBasedPreferences(this, childName, isUser); - } - - /** - * Returns a (possibly empty) array of keys of the preferences entries of - * this node. - */ - protected String[] keysSpi() throws BackingStoreException { - return (String[]) entries.keySet().toArray(new String[entries.size()]); - } - - /** - * Returns the associated value from this nodes preferences entries or - * null when the key has not been set. - */ - protected String getSpi(String key) { - return (String) entries.get(key); - } - - /** - * Sets the value for the given key. - */ - protected void putSpi(String key, String value) { - entries.put(key, value); - } - - /** - * Removes the entry with the given key. - */ - protected void removeSpi(String key) { - entries.remove(key); - } - - /** - * Does nothing since we do not have any backing store. - */ - protected void flushSpi() { - } - - /** - * Does nothing since we do not have any backing store. - */ - protected void syncSpi() { - } - - /** - * Just removes the entries map of this node. - */ - protected void removeNodeSpi() { - entries = null; - } -} diff --git a/libjava/gnu/java/util/prefs/NodeReader.java b/libjava/gnu/java/util/prefs/NodeReader.java deleted file mode 100644 index 6c9fdc9ec06..00000000000 --- a/libjava/gnu/java/util/prefs/NodeReader.java +++ /dev/null @@ -1,223 +0,0 @@ -/* NodeReader - Reads and imports preferences nodes from files - Copyright (C) 2001 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package gnu.java.util.prefs; - -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; - -import java.util.prefs.*; - -/** - * Reads and imports preferences nodes from files. - * - * @author Mark Wielaard (mark@klomp.org) - */ -public class NodeReader { - - private final BufferedReader br; - private String line = ""; - - private final PreferencesFactory factory; - - public NodeReader(Reader r, PreferencesFactory factory) { - if(r instanceof BufferedReader) { - br = (BufferedReader) r; - } else { - br = new BufferedReader(r); - } - this.factory = factory; - } - - public NodeReader(InputStream is, PreferencesFactory factory) { - this(new InputStreamReader(is), factory); - } - - public void importPreferences() - throws InvalidPreferencesFormatException, IOException - { - readPreferences(); - } - - private void readPreferences() - throws InvalidPreferencesFormatException, IOException - { - // Begin starting tag - skipTill("<preferences"); - - readRoot(); - - // Ending tag - skipTill("</preferences>"); - } - - private void readRoot() - throws InvalidPreferencesFormatException, IOException - { - // Begin starting tag - skipTill("<root"); - - // type attribute - skipTill("type=\""); - String type = readTill("\""); - Preferences root; - if ("user".equals(type)) { - root = factory.userRoot(); - } else if ("system".equals(type)) { - root = factory.systemRoot(); - } else { - throw new InvalidPreferencesFormatException("Unknown type: " - + type); - } - - // Read root map and subnodes - readMap(root); - readNodes(root); - - // Ending tag - skipTill("</root>"); - } - - private void readNodes(Preferences node) - throws InvalidPreferencesFormatException, IOException - { - while ("node".equals(nextTag())) { - skipTill("<node"); - skipTill("name=\""); - String name = readTill("\""); - Preferences subnode = node.node(name); - System.out.println("Found subnode: " + subnode.absolutePath()); - readMap(subnode); - readNodes(subnode); - skipTill("</node>"); - } - - } - - private void readMap(Preferences node) - throws InvalidPreferencesFormatException, IOException - { - // Begin map tag - skipTill("<map"); - - // Empty map? - if (line.startsWith("/>")) { - line = line.substring(2); - return; - } - - // Map entries - readEntries(node); - - // Ending tag - skipTill("</map>"); - } - - private void readEntries(Preferences node) - throws InvalidPreferencesFormatException, IOException - { - while ("entry".equals(nextTag())) { - skipTill("<entry"); - skipTill("key=\""); - String key = readTill("\""); - skipTill("value=\""); - String value = readTill("\""); - System.out.println("Key: " + key + " Value: " + value); - node.put(key, value); - } - } - - private void skipTill(String s) - throws InvalidPreferencesFormatException, IOException - { - while(true) { - if (line == null) - throw new InvalidPreferencesFormatException(s + " not found"); - - int index = line.indexOf(s); - if (index == -1) { - line = br.readLine(); - } else { - line = line.substring(index+s.length()); - return; - } - } - } - - private String readTill(String s) - throws InvalidPreferencesFormatException - { - int index = line.indexOf(s); - if (index == -1) - throw new InvalidPreferencesFormatException(s + " not found"); - - String read = line.substring(0, index); - line = line.substring(index+s.length()); - - return read; - } - - private String nextTag() - throws InvalidPreferencesFormatException, IOException - { - while(true) { - if (line == null) - throw new InvalidPreferencesFormatException("unexpected EOF"); - - int start = line.indexOf("<"); - if (start == -1) { - line = br.readLine(); - } else { - // Find end of tag - int end = start+1; - while (end != line.length() - && " \t\r\n".indexOf(line.charAt(end)) == -1) { - end++; - } - // Line now starts at the found tag - String tag = line.substring(start+1,end); - line = line.substring(start); - return tag; - } - } - } - -} diff --git a/libjava/gnu/java/util/prefs/NodeWriter.java b/libjava/gnu/java/util/prefs/NodeWriter.java deleted file mode 100644 index d570d99af60..00000000000 --- a/libjava/gnu/java/util/prefs/NodeWriter.java +++ /dev/null @@ -1,315 +0,0 @@ -/* NodeWriter - Writes and exports preferences nodes to files - Copyright (C) 2001 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package gnu.java.util.prefs; - -import java.io.BufferedWriter; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Writer; - -import java.util.StringTokenizer; - -import java.util.prefs.*; - -/** - * Writes and exports preferences nodes to files - * - * @author Mark Wielaard (mark@klomp.org) - */ -public class NodeWriter { - - /** The Preferences node to write. */ - private final Preferences prefs; - - /** The bufferedWriter to write the node to. */ - private final BufferedWriter bw; - - /** - * True if the complete sub tree should be written, - * false if only the node should be written. - */ - private boolean subtree; - - /** - * Creates a new NodeWriter for the given preferences node and writer. - */ - public NodeWriter(Preferences prefs, Writer w) { - this.prefs = prefs; - if (w instanceof BufferedWriter) { - this.bw = (BufferedWriter) w; - } else { - this.bw = new BufferedWriter(w); - } - } - - /** - * Creates a new NodeWriter for the given preferences node and - * outputstream. Creates a new OutputStreamWriter. - */ - public NodeWriter(Preferences prefs, OutputStream os) { - this(prefs, new OutputStreamWriter(os)); - } - - /** - * Writes the preference node plus the complete subtree. - */ - public void writePrefsTree() throws BackingStoreException, IOException { - subtree = true; - writeHeader(); - writePreferences(); - bw.flush(); - } - - /** - * Writes only the preference node. - */ - public void writePrefs() throws BackingStoreException, IOException { - subtree = false; - writeHeader(); - writePreferences(); - bw.flush(); - } - - /** - * Writes the standard header. - */ - private void writeHeader() throws BackingStoreException, IOException { - bw.write("<?xml version=\"1.0\"?>"); - bw.newLine(); - bw.newLine(); - bw.write("<!-- GNU Classpath java.util.prefs Preferences "); - - if (prefs.isUserNode()) { - bw.write("user"); - } else { - bw.write("system"); - } - - // root node? - if (prefs.parent() == null) { - bw.write(" root"); - } - - if (subtree) { - bw.write(" tree"); - } else { - bw.write(" node"); - } - - // no root? - if (prefs.parent() != null) { - bw.newLine(); - bw.write(" '"); - bw.write(prefs.absolutePath()); - bw.write('\''); - bw.newLine(); - } - bw.write(" -->"); - bw.newLine(); - bw.newLine(); - } - - /** - * Write the preferences tag and the root. - */ - private void writePreferences() throws BackingStoreException, IOException { - bw.write("<preferences>"); - bw.newLine(); - writeRoot(); - bw.write("</preferences>"); - bw.newLine(); - } - - private void writeRoot() throws BackingStoreException, IOException { - bw.write(" <root type=\""); - if (prefs.isUserNode()) { - bw.write("user"); - } else { - bw.write("system"); - } - bw.write("\"/>"); - - writeRootMap(); - writeNode(); - - bw.write(" </root>"); - bw.newLine(); - } - - private void writeRootMap() throws BackingStoreException, IOException { - // Is it a root node? - if(prefs.parent() == null && prefs.keys().length > 0) { - bw.newLine(); - writeMap(prefs, 2); - } else { - bw.write("<map/>"); - bw.newLine(); - } - } - - /** - * Writes all the parents of the preferences node without any entries. - * Returns the number of parents written, which has to be used as - * argument to <code>writeCloseParents()</code> after writing the node - * itself. - */ - private int writeParents() throws IOException { - int parents; - String path = prefs.absolutePath(); - int lastslash = path.lastIndexOf("/"); - if (lastslash > 0) { - path = path.substring(1, lastslash); - StringTokenizer st = new StringTokenizer(path); - parents = st.countTokens(); - - System.out.println("path: " + path); - System.out.println("parents: " + parents); - - for (int i=0; i<parents; i++) { - String name = st.nextToken(); - indent(i+2); - bw.write("<node name=\"" + name + "\">"); - bw.write("<map/>"); - bw.write("</node>"); - bw.newLine(); - } - } else { - parents = 0; - } - - return parents; - } - - private void writeCloseParents(int parents) throws IOException { - while(parents > 0) { - indent(parents+1); - bw.write("</node>"); - bw.newLine(); - parents--; - } - } - - private void writeNode() throws BackingStoreException, IOException { - int parents = writeParents(); - // root? - int indent; - if (prefs.parent() == null) { - indent = parents+1; - } else { - indent = parents+2; - } - writeNode(prefs, indent); - writeCloseParents(parents); - } - - private void writeNode(Preferences node, int indent) - throws BackingStoreException, IOException - { - // not root? - if (node.parent() != null) { - indent(indent); - bw.write("<node name=\"" + node.name() + "\">"); - if (node.keys().length > 0) { - bw.newLine(); - } - writeMap(node, indent+1); - } - - if (subtree) { - String[] children = node.childrenNames(); - for (int i=0; i<children.length; i++) { - Preferences child = node.node(children[i]); - writeNode(child, indent+1); - } - } - - // not root? - if (node.parent() != null) { - indent(indent); - bw.write("</node>"); - bw.newLine(); - } - } - - private void writeMap(Preferences node, int indent) - throws BackingStoreException, IOException - { - // construct String used for indentation - StringBuffer indentBuffer = new StringBuffer(2*indent); - for (int i=0; i < indent; i++) - indentBuffer.append(" "); - String indentString = indentBuffer.toString(); - - if (node.keys().length > 0) { - bw.write(indentString); - bw.write("<map>"); - bw.newLine(); - writeEntries(node, indentString + " "); - bw.write(indentString); - bw.write("</map>"); - } else { - bw.write("<map/>"); - } - bw.newLine(); - } - - private void writeEntries(Preferences node, String indent) - throws BackingStoreException, IOException - { - String[] keys = node.keys(); - for(int i = 0; i < keys.length; i++) { - String value = node.get(keys[i], null); - if (value == null) { - throw new BackingStoreException("null value for key '" - + keys[i] + "'"); - } - - bw.write(indent); - bw.write("<entry key=\"" + keys[i] + "\"" - + " value=\"" + value + "\"/>"); - bw.newLine(); - } - } - - private void indent(int x) throws IOException { - for (int i=0; i<x; i++) { - bw.write(" "); - } - } -} diff --git a/libjava/java/util/prefs/AbstractPreferences.java b/libjava/java/util/prefs/AbstractPreferences.java deleted file mode 100644 index d192c1f6717..00000000000 --- a/libjava/java/util/prefs/AbstractPreferences.java +++ /dev/null @@ -1,1261 +0,0 @@ -/* AbstractPreferences - Partial implementation of a Preference node - Copyright (C) 2001, 2003 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package java.util.prefs; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import java.util.Iterator; -import java.util.HashMap; -import java.util.TreeSet; - -import gnu.java.util.prefs.NodeWriter; - -/** - * Partial implementation of a Preference node. - * - * @since 1.4 - * @author Mark Wielaard (mark@klomp.org) - */ -public abstract class AbstractPreferences extends Preferences { - - // protected fields - - /** - * Object used to lock this preference node. Any thread only locks nodes - * downwards when it has the lock on the current node. No method should - * synchronize on the lock of any of its parent nodes while holding the - * lock on the current node. - */ - protected final Object lock = new Object(); - - /** - * Set to true in the contructor if the node did not exist in the backing - * store when this preference node object was created. Should be set in - * the contructor of a subclass. Defaults to false. Used to fire node - * changed events. - */ - protected boolean newNode = false; - - // private fields - - /** - * The parent preferences node or null when this is the root node. - */ - private final AbstractPreferences parent; - - /** - * The name of this node. - * Only when this is a root node (parent == null) the name is empty. - * It has a maximum of 80 characters and cannot contain any '/' characters. - */ - private final String name; - - /** True when this node has been remove, false otherwise. */ - private boolean removed = false; - - /** - * Holds all the child names and nodes of this node that have been - * accessed by earlier <code>getChild()</code> or <code>childSpi()</code> - * invocations and that have not been removed. - */ - private HashMap childCache = new HashMap(); - - // constructor - - /** - * Creates a new AbstractPreferences node with the given parent and name. - * - * @param parent the parent of this node or null when this is the root node - * @param name the name of this node, can not be null, only 80 characters - * maximum, must be empty when parent is null and cannot - * contain any '/' characters - * @exception IllegalArgumentException when name is null, greater then 80 - * characters, not the empty string but parent is null or - * contains a '/' character - */ - protected AbstractPreferences(AbstractPreferences parent, String name) { - if ( (name == null) // name should be given - || (name.length() > MAX_NAME_LENGTH) // 80 characters max - || (parent == null && name.length() != 0) // root has no name - || (parent != null && name.length() == 0) // all other nodes do - || (name.indexOf('/') != -1)) // must not contain '/' - throw new IllegalArgumentException("Illegal name argument '" - + name - + "' (parent is " - + parent == null ? "" : "not " - + "null)"); - this.parent = parent; - this.name = name; - } - - // identification methods - - /** - * Returns the absolute path name of this preference node. - * The absolute path name of a node is the path name of its parent node - * plus a '/' plus its own name. If the node is the root node and has no - * parent then its path name is "" and its absolute path name is "/". - */ - public String absolutePath() { - if (parent == null) - return "/"; - else - return parent.path() + '/' + name; - } - - /** - * Private helper method for absolutePath. Returns the empty string for a - * root node and otherwise the parentPath of its parent plus a '/'. - */ - private String path() { - if (parent == null) - return ""; - else - return parent.path() + '/' + name; - } - - /** - * Returns true if this node comes from the user preferences tree, false - * if it comes from the system preferences tree. - */ - public boolean isUserNode() { - AbstractPreferences root = this; - while (root.parent != null) - root = root.parent; - return root == Preferences.userRoot(); - } - - /** - * Returns the name of this preferences node. The name of the node cannot - * be null, can be mostly 80 characters and cannot contain any '/' - * characters. The root node has as name "". - */ - public String name() { - return name; - } - - /** - * Returns the String given by - * <code> - * (isUserNode() ? "User":"System") + " Preference Node: " + absolutePath() - * </code> - */ - public String toString() { - return (isUserNode() ? "User":"System") - + " Preference Node: " - + absolutePath(); - } - - /** - * Returns all the direct sub nodes of this preferences node. - * Needs access to the backing store to give a meaningfull answer. - * <p> - * This implementation locks this node, checks if the node has not yet - * been removed and throws an <code>IllegalStateException</code> when it - * has been. Then it creates a new <code>TreeSet</code> and adds any - * already cached child nodes names. To get any uncached names it calls - * <code>childrenNamesSpi()</code> and adds the result to the set. Finally - * it calls <code>toArray()</code> on the created set. When the call to - * <code>childrenNamesSpi</code> thows an <code>BackingStoreException</code> - * this method will not catch that exception but propagate the exception - * to the caller. - * - * @exception BackingStoreException when the backing store cannot be - * reached - * @exception IllegalStateException when this node has been removed - */ - public String[] childrenNames() throws BackingStoreException { - synchronized(lock) { - if (isRemoved()) - throw new IllegalStateException("Node removed"); - - TreeSet childrenNames = new TreeSet(); - - // First get all cached node names - childrenNames.addAll(childCache.keySet()); - - // Then add any others - String names[] = childrenNamesSpi(); - for (int i = 0; i < names.length; i++) { - childrenNames.add(names[i]); - } - - // And return the array of names - String[] children = new String[childrenNames.size()]; - childrenNames.toArray(children); - return children; - - } - } - - /** - * Returns a sub node of this preferences node if the given path is - * relative (does not start with a '/') or a sub node of the root - * if the path is absolute (does start with a '/'). - * <p> - * This method first locks this node and checks if the node has not been - * removed, if it has been removed it throws an exception. Then if the - * path is relative (does not start with a '/') it checks if the path is - * legal (does not end with a '/' and has no consecutive '/' characters). - * Then it recursively gets a name from the path, gets the child node - * from the child-cache of this node or calls the <code>childSpi()</code> - * method to create a new child sub node. This is done recursively on the - * newly created sub node with the rest of the path till the path is empty. - * If the path is absolute (starts with a '/') the lock on this node is - * droped and this method is called on the root of the preferences tree - * with as argument the complete path minus the first '/'. - * - * @exception IllegalStateException if this node has been removed - * @exception IllegalArgumentException if the path contains two or more - * consecutive '/' characters, ends with a '/' charactor and is not the - * string "/" (indicating the root node) or any name on the path is more - * then 80 characters long - */ - public Preferences node(String path) { - synchronized(lock) { - if (isRemoved()) - throw new IllegalStateException("Node removed"); - - // Is it a relative path? - if (!path.startsWith("/")) { - - // Check if it is a valid path - if (path.indexOf("//") != -1 || path.endsWith("/")) - throw new IllegalArgumentException(path); - - return getNode(path); - } - } - - // path started with a '/' so it is absolute - // we drop the lock and start from the root (omitting the first '/') - Preferences root = isUserNode() ? userRoot() : systemRoot(); - return root.node(path.substring(1)); - - } - - /** - * Private helper method for <code>node()</code>. Called with this node - * locked. Returns this node when path is the empty string, if it is not - * empty the next node name is taken from the path (all chars till the - * next '/' or end of path string) and the node is either taken from the - * child-cache of this node or the <code>childSpi()</code> method is called - * on this node with the name as argument. Then this method is called - * recursively on the just constructed child node with the rest of the - * path. - * - * @param path should not end with a '/' character and should not contain - * consecutive '/' characters - * @exception IllegalArgumentException if path begins with a name that is - * larger then 80 characters. - */ - private Preferences getNode(String path) { - // if mark is dom then goto end - - // Empty String "" indicates this node - if (path.length() == 0) - return this; - - // Calculate child name and rest of path - String childName; - String childPath; - int nextSlash = path.indexOf('/'); - if (nextSlash == -1) { - childName = path; - childPath = ""; - } else { - childName = path.substring(0, nextSlash); - childPath = path.substring(nextSlash+1); - } - - // Get the child node - AbstractPreferences child; - child = (AbstractPreferences)childCache.get(childName); - if (child == null) { - - if (childName.length() > MAX_NAME_LENGTH) - throw new IllegalArgumentException(childName); - - // Not in childCache yet so create a new sub node - child = childSpi(childName); - // XXX - check if node is new - childCache.put(childName, child); - } - - // Lock the child and go down - synchronized(child.lock) { - return child.getNode(childPath); - } - } - - /** - * Returns true if the node that the path points to exists in memory or - * in the backing store. Otherwise it returns false or an exception is - * thrown. When this node is removed the only valid parameter is the - * empty string (indicating this node), the return value in that case - * will be false. - * - * @exception BackingStoreException when the backing store cannot be - * reached - * @exception IllegalStateException if this node has been removed - * and the path is not the empty string (indicating this node) - * @exception IllegalArgumentException if the path contains two or more - * consecutive '/' characters, ends with a '/' charactor and is not the - * string "/" (indicating the root node) or any name on the path is more - * then 80 characters long - */ - public boolean nodeExists(String path) throws BackingStoreException { - synchronized(lock) { - if (isRemoved() && path.length() != 0) - throw new IllegalStateException("Node removed"); - - // Is it a relative path? - if (!path.startsWith("/")) { - - // Check if it is a valid path - if (path.indexOf("//") != -1 || path.endsWith("/")) - throw new IllegalArgumentException(path); - - return existsNode(path); - } - } - - // path started with a '/' so it is absolute - // we drop the lock and start from the root (omitting the first '/') - Preferences root = isUserNode() ? userRoot() : systemRoot(); - return root.nodeExists(path.substring(1)); - - } - - private boolean existsNode(String path) throws BackingStoreException { - - // Empty String "" indicates this node - if (path.length() == 0) - return(!isRemoved()); - - // Calculate child name and rest of path - String childName; - String childPath; - int nextSlash = path.indexOf('/'); - if (nextSlash == -1) { - childName = path; - childPath = ""; - } else { - childName = path.substring(0, nextSlash); - childPath = path.substring(nextSlash+1); - } - - // Get the child node - AbstractPreferences child; - child = (AbstractPreferences)childCache.get(childName); - if (child == null) { - - if (childName.length() > MAX_NAME_LENGTH) - throw new IllegalArgumentException(childName); - - // Not in childCache yet so create a new sub node - child = getChild(childName); - - if (child == null) - return false; - - childCache.put(childName, child); - } - - // Lock the child and go down - synchronized(child.lock) { - return child.existsNode(childPath); - } - } - - /** - * Returns the child sub node if it exists in the backing store or null - * if it does not exist. Called (indirectly) by <code>nodeExists()</code> - * when a child node name can not be found in the cache. - * <p> - * Gets the lock on this node, calls <code>childrenNamesSpi()</code> to - * get an array of all (possibly uncached) children and compares the - * given name with the names in the array. If the name is found in the - * array <code>childSpi()</code> is called to get an instance, otherwise - * null is returned. - * - * @exception BackingStoreException when the backing store cannot be - * reached - */ - protected AbstractPreferences getChild(String name) - throws BackingStoreException - { - synchronized(lock) { - // Get all the names (not yet in the cache) - String[] names = childrenNamesSpi(); - for (int i=0; i < names.length; i++) - if (name.equals(names[i])) - return childSpi(name); - - // No child with that name found - return null; - } - } - - /** - * Returns true if this node has been removed with the - * <code>removeNode()</code> method, false otherwise. - * <p> - * Gets the lock on this node and then returns a boolean field set by - * <code>removeNode</code> methods. - */ - protected boolean isRemoved() { - synchronized(lock) { - return removed; - } - } - - /** - * Returns the parent preferences node of this node or null if this is - * the root of the preferences tree. - * <p> - * Gets the lock on this node, checks that the node has not been removed - * and returns the parent given to the constructor. - * - * @exception IllegalStateException if this node has been removed - */ - public Preferences parent() { - synchronized(lock) { - if (isRemoved()) - throw new IllegalStateException("Node removed"); - - return parent; - } - } - - // export methods - - /** - * XXX - */ - public void exportNode(OutputStream os) - throws BackingStoreException, - IOException - { - NodeWriter nodeWriter = new NodeWriter(this, os); - nodeWriter.writePrefs(); - } - - /** - * XXX - */ - public void exportSubtree(OutputStream os) - throws BackingStoreException, - IOException - { - NodeWriter nodeWriter = new NodeWriter(this, os); - nodeWriter.writePrefsTree(); - } - - // preference entry manipulation methods - - /** - * Returns an (possibly empty) array with all the keys of the preference - * entries of this node. - * <p> - * This method locks this node and checks if the node has not been - * removed, if it has been removed it throws an exception, then it returns - * the result of calling <code>keysSpi()</code>. - * - * @exception BackingStoreException when the backing store cannot be - * reached - * @exception IllegalStateException if this node has been removed - */ - public String[] keys() throws BackingStoreException { - synchronized(lock) { - if (isRemoved()) - throw new IllegalStateException("Node removed"); - - return keysSpi(); - } - } - - - /** - * Returns the value associated with the key in this preferences node. If - * the default value of the key cannot be found in the preferences node - * entries or something goes wrong with the backing store the supplied - * default value is returned. - * <p> - * Checks that key is not null and not larger then 80 characters, - * locks this node, and checks that the node has not been removed. - * Then it calls <code>keySpi()</code> and returns - * the result of that method or the given default value if it returned - * null or throwed an exception. - * - * @exception IllegalArgumentException if key is larger then 80 characters - * @exception IllegalStateException if this node has been removed - * @exception NullPointerException if key is null - */ - public String get(String key, String defaultVal) { - if (key.length() > MAX_KEY_LENGTH) - throw new IllegalArgumentException(key); - - synchronized(lock) { - if (isRemoved()) - throw new IllegalStateException("Node removed"); - - String value; - try { - value = getSpi(key); - } catch (Throwable t) { - value = null; - } - - if (value != null) { - return value; - } else { - return defaultVal; - } - } - } - - /** - * Convenience method for getting the given entry as a boolean. - * When the string representation of the requested entry is either - * "true" or "false" (ignoring case) then that value is returned, - * otherwise the given default boolean value is returned. - * - * @exception IllegalArgumentException if key is larger then 80 characters - * @exception IllegalStateException if this node has been removed - * @exception NullPointerException if key is null - */ - public boolean getBoolean(String key, boolean defaultVal) { - String value = get(key, null); - - if ("true".equalsIgnoreCase(value)) - return true; - - if ("false".equalsIgnoreCase(value)) - return false; - - return defaultVal; - } - - /** - * Convenience method for getting the given entry as a byte array. - * When the string representation of the requested entry is a valid - * Base64 encoded string (without any other characters, such as newlines) - * then the decoded Base64 string is returned as byte array, - * otherwise the given default byte array value is returned. - * - * @exception IllegalArgumentException if key is larger then 80 characters - * @exception IllegalStateException if this node has been removed - * @exception NullPointerException if key is null - */ - public byte[] getByteArray(String key, byte[] defaultVal) { - String value = get(key, null); - - byte[] b = null; - if (value != null) { - b = decode64(value); - } - - if (b != null) - return b; - else - return defaultVal; - } - - /** - * Helper method for decoding a Base64 string as an byte array. - * Returns null on encoding error. This method does not allow any other - * characters present in the string then the 65 special base64 chars. - */ - private static byte[] decode64(String s) { - ByteArrayOutputStream bs = new ByteArrayOutputStream((s.length()/4)*3); - char[] c = new char[s.length()]; - s.getChars(0, s.length(), c, 0); - - // Convert from base64 chars - int endchar = -1; - for(int j = 0; j < c.length && endchar == -1; j++) { - if (c[j] >= 'A' && c[j] <= 'Z') { - c[j] -= 'A'; - } else if (c[j] >= 'a' && c[j] <= 'z') { - c[j] = (char) (c[j] + 26 - 'a'); - } else if (c[j] >= '0' && c[j] <= '9') { - c[j] = (char) (c[j] + 52 - '0'); - } else if (c[j] == '+') { - c[j] = 62; - } else if (c[j] == '/') { - c[j] = 63; - } else if (c[j] == '=') { - endchar = j; - } else { - return null; // encoding exception - } - } - - int remaining = endchar == -1 ? c.length : endchar; - int i = 0; - while (remaining > 0) { - // Four input chars (6 bits) are decoded as three bytes as - // 000000 001111 111122 222222 - - byte b0 = (byte) (c[i] << 2); - if (remaining >= 2) { - b0 += (c[i+1] & 0x30) >> 4; - } - bs.write(b0); - - if (remaining >= 3) { - byte b1 = (byte) ((c[i+1] & 0x0F) << 4); - b1 += (byte) ((c[i+2] & 0x3C) >> 2); - bs.write(b1); - } - - if (remaining >= 4) { - byte b2 = (byte) ((c[i+2] & 0x03) << 6); - b2 += c[i+3]; - bs.write(b2); - } - - i += 4; - remaining -= 4; - } - - return bs.toByteArray(); - } - - /** - * Convenience method for getting the given entry as a double. - * When the string representation of the requested entry can be decoded - * with <code>Double.parseDouble()</code> then that double is returned, - * otherwise the given default double value is returned. - * - * @exception IllegalArgumentException if key is larger then 80 characters - * @exception IllegalStateException if this node has been removed - * @exception NullPointerException if key is null - */ - public double getDouble(String key, double defaultVal) { - String value = get(key, null); - - if (value != null) { - try { - return Double.parseDouble(value); - } catch (NumberFormatException nfe) { /* ignore */ } - } - - return defaultVal; - } - - /** - * Convenience method for getting the given entry as a float. - * When the string representation of the requested entry can be decoded - * with <code>Float.parseFloat()</code> then that float is returned, - * otherwise the given default float value is returned. - * - * @exception IllegalArgumentException if key is larger then 80 characters - * @exception IllegalStateException if this node has been removed - * @exception NullPointerException if key is null - */ - public float getFloat(String key, float defaultVal) { - String value = get(key, null); - - if (value != null) { - try { - return Float.parseFloat(value); - } catch (NumberFormatException nfe) { /* ignore */ } - } - - return defaultVal; - } - - /** - * Convenience method for getting the given entry as an integer. - * When the string representation of the requested entry can be decoded - * with <code>Integer.parseInt()</code> then that integer is returned, - * otherwise the given default integer value is returned. - * - * @exception IllegalArgumentException if key is larger then 80 characters - * @exception IllegalStateException if this node has been removed - * @exception NullPointerException if key is null - */ - public int getInt(String key, int defaultVal) { - String value = get(key, null); - - if (value != null) { - try { - return Integer.parseInt(value); - } catch (NumberFormatException nfe) { /* ignore */ } - } - - return defaultVal; - } - - /** - * Convenience method for getting the given entry as a long. - * When the string representation of the requested entry can be decoded - * with <code>Long.parseLong()</code> then that long is returned, - * otherwise the given default long value is returned. - * - * @exception IllegalArgumentException if key is larger then 80 characters - * @exception IllegalStateException if this node has been removed - * @exception NullPointerException if key is null - */ - public long getLong(String key, long defaultVal) { - String value = get(key, null); - - if (value != null) { - try { - return Long.parseLong(value); - } catch (NumberFormatException nfe) { /* ignore */ } - } - - return defaultVal; - } - - /** - * Sets the value of the given preferences entry for this node. - * Key and value cannot be null, the key cannot exceed 80 characters - * and the value cannot exceed 8192 characters. - * <p> - * The result will be immediatly visible in this VM, but may not be - * immediatly written to the backing store. - * <p> - * Checks that key and value are valid, locks this node, and checks that - * the node has not been removed. Then it calls <code>putSpi()</code>. - * - * @exception NullPointerException if either key or value are null - * @exception IllegalArgumentException if either key or value are to large - * @exception IllegalStateException when this node has been removed - */ - public void put(String key, String value) { - if (key.length() > MAX_KEY_LENGTH - || value.length() > MAX_VALUE_LENGTH) - throw new IllegalArgumentException("key (" - + key.length() + ")" - + " or value (" - + value.length() + ")" - + " to large"); - synchronized(lock) { - if (isRemoved()) - throw new IllegalStateException("Node removed"); - - putSpi(key, value); - - // XXX - fire events - } - - } - - /** - * Convenience method for setting the given entry as a boolean. - * The boolean is converted with <code>Boolean.toString(value)</code> - * and then stored in the preference entry as that string. - * - * @exception NullPointerException if key is null - * @exception IllegalArgumentException if the key length is to large - * @exception IllegalStateException when this node has been removed - */ - public void putBoolean(String key, boolean value) { - put(key, String.valueOf(value)); - // XXX - Use when using 1.4 compatible Boolean - // put(key, Boolean.toString(value)); - } - - /** - * Convenience method for setting the given entry as an array of bytes. - * The byte array is converted to a Base64 encoded string - * and then stored in the preference entry as that string. - * <p> - * Note that a byte array encoded as a Base64 string will be about 1.3 - * times larger then the original length of the byte array, which means - * that the byte array may not be larger about 6 KB. - * - * @exception NullPointerException if either key or value are null - * @exception IllegalArgumentException if either key or value are to large - * @exception IllegalStateException when this node has been removed - */ - public void putByteArray(String key, byte[] value) { - put(key, encode64(value)); - } - - /** - * Helper method for encoding an array of bytes as a Base64 String. - */ - private static String encode64(byte[] b) { - StringBuffer sb = new StringBuffer((b.length/3)*4); - - int i = 0; - int remaining = b.length; - char c[] = new char[4]; - while (remaining > 0) { - // Three input bytes are encoded as four chars (6 bits) as - // 00000011 11112222 22333333 - - c[0] = (char) ((b[i] & 0xFC) >> 2); - c[1] = (char) ((b[i] & 0x03) << 4); - if (remaining >= 2) { - c[1] += (char) ((b[i+1] & 0xF0) >> 4); - c[2] = (char) ((b[i+1] & 0x0F) << 2); - if (remaining >= 3) { - c[2] += (char) ((b[i+2] & 0xC0) >> 6); - c[3] = (char) (b[i+2] & 0x3F); - } else { - c[3] = 64; - } - } else { - c[2] = 64; - c[3] = 64; - } - - // Convert to base64 chars - for(int j = 0; j < 4; j++) { - if (c[j] < 26) { - c[j] += 'A'; - } else if (c[j] < 52) { - c[j] = (char) (c[j] - 26 + 'a'); - } else if (c[j] < 62) { - c[j] = (char) (c[j] - 52 + '0'); - } else if (c[j] == 62) { - c[j] = '+'; - } else if (c[j] == 63) { - c[j] = '/'; - } else { - c[j] = '='; - } - } - - sb.append(c); - i += 3; - remaining -= 3; - } - - return sb.toString(); - } - - /** - * Convenience method for setting the given entry as a double. - * The double is converted with <code>Double.toString(double)</code> - * and then stored in the preference entry as that string. - * - * @exception NullPointerException if the key is null - * @exception IllegalArgumentException if the key length is to large - * @exception IllegalStateException when this node has been removed - */ - public void putDouble(String key, double value) { - put(key, Double.toString(value)); - } - - /** - * Convenience method for setting the given entry as a float. - * The float is converted with <code>Float.toString(float)</code> - * and then stored in the preference entry as that string. - * - * @exception NullPointerException if the key is null - * @exception IllegalArgumentException if the key length is to large - * @exception IllegalStateException when this node has been removed - */ - public void putFloat(String key, float value) { - put(key, Float.toString(value)); - } - - /** - * Convenience method for setting the given entry as an integer. - * The integer is converted with <code>Integer.toString(int)</code> - * and then stored in the preference entry as that string. - * - * @exception NullPointerException if the key is null - * @exception IllegalArgumentException if the key length is to large - * @exception IllegalStateException when this node has been removed - */ - public void putInt(String key, int value) { - put(key, Integer.toString(value)); - } - - /** - * Convenience method for setting the given entry as a long. - * The long is converted with <code>Long.toString(long)</code> - * and then stored in the preference entry as that string. - * - * @exception NullPointerException if the key is null - * @exception IllegalArgumentException if the key length is to large - * @exception IllegalStateException when this node has been removed - */ - public void putLong(String key, long value) { - put(key, Long.toString(value)); - } - - /** - * Removes the preferences entry from this preferences node. - * <p> - * The result will be immediatly visible in this VM, but may not be - * immediatly written to the backing store. - * <p> - * This implementation checks that the key is not larger then 80 - * characters, gets the lock of this node, checks that the node has - * not been removed and calls <code>removeSpi</code> with the given key. - * - * @exception NullPointerException if the key is null - * @exception IllegalArgumentException if the key length is to large - * @exception IllegalStateException when this node has been removed - */ - public void remove(String key) { - if (key.length() > MAX_KEY_LENGTH) - throw new IllegalArgumentException(key); - - synchronized(lock) { - if (isRemoved()) - throw new IllegalStateException("Node removed"); - - removeSpi(key); - } - } - - /** - * Removes all entries from this preferences node. May need access to the - * backing store to get and clear all entries. - * <p> - * The result will be immediatly visible in this VM, but may not be - * immediatly written to the backing store. - * <p> - * This implementation locks this node, checks that the node has not been - * removed and calls <code>keys()</code> to get a complete array of keys - * for this node. For every key found <code>removeSpi()</code> is called. - * - * @exception BackingStoreException when the backing store cannot be - * reached - * @exception IllegalStateException if this node has been removed - */ - public void clear() throws BackingStoreException { - synchronized(lock) { - if (isRemoved()) - throw new IllegalStateException("Node Removed"); - - String[] keys = keys(); - for (int i = 0; i < keys.length; i++) { - removeSpi(keys[i]); - } - } - } - - /** - * Writes all preference changes on this and any subnode that have not - * yet been written to the backing store. This has no effect on the - * preference entries in this VM, but it makes sure that all changes - * are visible to other programs (other VMs might need to call the - * <code>sync()</code> method to actually see the changes to the backing - * store. - * <p> - * Locks this node, calls the <code>flushSpi()</code> method, gets all - * the (cached - already existing in this VM) subnodes and then calls - * <code>flushSpi()</code> on every subnode with this node unlocked and - * only that particular subnode locked. - * - * @exception BackingStoreException when the backing store cannot be - * reached - */ - public void flush() throws BackingStoreException { - flushNode(false); - } - - /** - * Writes and reads all preference changes to and from this and any - * subnodes. This makes sure that all local changes are written to the - * backing store and that all changes to the backing store are visible - * in this preference node (and all subnodes). - * <p> - * Checks that this node is not removed, locks this node, calls the - * <code>syncSpi()</code> method, gets all the subnodes and then calls - * <code>syncSpi()</code> on every subnode with this node unlocked and - * only that particular subnode locked. - * - * @exception BackingStoreException when the backing store cannot be - * reached - * @exception IllegalStateException if this node has been removed - */ - public void sync() throws BackingStoreException { - flushNode(true); - } - - - /** - * Private helper method that locks this node and calls either - * <code>flushSpi()</code> if <code>sync</code> is false, or - * <code>flushSpi()</code> if <code>sync</code> is true. Then it gets all - * the currently cached subnodes. For every subnode it calls this method - * recursively with this node no longer locked. - * <p> - * Called by either <code>flush()</code> or <code>sync()</code> - */ - private void flushNode(boolean sync) throws BackingStoreException { - String[] keys = null; - synchronized(lock) { - if (sync) { - syncSpi(); - } else { - flushSpi(); - } - keys = (String[]) childCache.keySet().toArray(); - } - - if (keys != null) { - for (int i = 0; i < keys.length; i++) { - // Have to lock this node again to access the childCache - AbstractPreferences subNode; - synchronized(this) { - subNode = (AbstractPreferences) childCache.get(keys[i]); - } - - // The child could already have been removed from the cache - if (subNode != null) { - subNode.flushNode(sync); - } - } - } - } - - /** - * Removes this and all subnodes from the backing store and clears all - * entries. After removal this instance will not be useable (except for - * a few methods that don't throw a <code>InvalidStateException</code>), - * even when a new node with the same path name is created this instance - * will not be usable again. - * <p> - * Checks that this is not a root node. If not it locks the parent node, - * then locks this node and checks that the node has not yet been removed. - * Then it makes sure that all subnodes of this node are in the child cache, - * by calling <code>childSpi()</code> on any children not yet in the cache. - * Then for all children it locks the subnode and removes it. After all - * subnodes have been purged the child cache is cleared, this nodes removed - * flag is set and any listeners are called. Finally this node is removed - * from the child cache of the parent node. - * - * @exception BackingStoreException when the backing store cannot be - * reached - * @exception IllegalStateException if this node has already been removed - * @exception UnsupportedOperationException if this is a root node - */ - public void removeNode() throws BackingStoreException { - // Check if it is a root node - if (parent == null) - throw new UnsupportedOperationException("Cannot remove root node"); - - synchronized(parent) { - synchronized(this) { - if (isRemoved()) - throw new IllegalStateException("Node Removed"); - - purge(); - } - parent.childCache.remove(name); - } - } - - /** - * Private helper method used to completely remove this node. - * Called by <code>removeNode</code> with the parent node and this node - * locked. - * <p> - * Makes sure that all subnodes of this node are in the child cache, - * by calling <code>childSpi()</code> on any children not yet in the - * cache. Then for all children it locks the subnode and calls this method - * on that node. After all subnodes have been purged the child cache is - * cleared, this nodes removed flag is set and any listeners are called. - */ - private void purge() throws BackingStoreException - { - // Make sure all children have an AbstractPreferences node in cache - String children[] = childrenNamesSpi(); - for (int i = 0; i < children.length; i++) { - if (childCache.get(children[i]) == null) - childCache.put(children[i], childSpi(children[i])); - } - - // purge all children - Iterator i = childCache.values().iterator(); - while (i.hasNext()) { - AbstractPreferences node = (AbstractPreferences) i.next(); - synchronized(node) { - node.purge(); - } - } - - // Cache is empty now - childCache.clear(); - - // remove this node - removeNodeSpi(); - removed = true; - - // XXX - check for listeners - } - - // listener methods - - /** - * XXX - */ - public void addNodeChangeListener(NodeChangeListener listener) { - // XXX - } - - public void addPreferenceChangeListener(PreferenceChangeListener listener) { - // XXX - } - - public void removeNodeChangeListener(NodeChangeListener listener) { - // XXX - } - - public void removePreferenceChangeListener - (PreferenceChangeListener listener) - { - // XXX - } - - // abstract spi methods - - /** - * Returns the names of the sub nodes of this preference node. - * This method only has to return any not yet cached child names, - * but may return all names if that is easier. It must not return - * null when there are no children, it has to return an empty array - * in that case. Since this method must consult the backing store to - * get all the sub node names it may throw a BackingStoreException. - * <p> - * Called by <code>childrenNames()</code> with this node locked. - */ - protected abstract String[] childrenNamesSpi() throws BackingStoreException; - - /** - * Returns a child note with the given name. - * This method is called by the <code>node()</code> method (indirectly - * through the <code>getNode()</code> helper method) with this node locked - * if a sub node with this name does not already exist in the child cache. - * If the child node did not aleady exist in the backing store the boolean - * field <code>newNode</code> of the returned node should be set. - * <p> - * Note that this method should even return a non-null child node if the - * backing store is not available since it may not throw a - * <code>BackingStoreException</code>. - */ - protected abstract AbstractPreferences childSpi(String name); - - /** - * Returns an (possibly empty) array with all the keys of the preference - * entries of this node. - * <p> - * Called by <code>keys()</code> with this node locked if this node has - * not been removed. May throw an exception when the backing store cannot - * be accessed. - * - * @exception BackingStoreException when the backing store cannot be - * reached - */ - abstract protected String[] keysSpi() throws BackingStoreException; - - /** - * Returns the value associated with the key in this preferences node or - * null when the key does not exist in this preferences node. - * <p> - * Called by <code>key()</code> with this node locked after checking that - * key is valid, not null and that the node has not been removed. - * <code>key()</code> will catch any exceptions that this method throws. - */ - abstract protected String getSpi(String key); - - /** - * Sets the value of the given preferences entry for this node. - * The implementation is not required to propagate the change to the - * backing store immediatly. It may not throw an exception when it tries - * to write to the backing store and that operation fails, the failure - * should be registered so a later invocation of <code>flush()</code> - * or <code>sync()</code> can signal the failure. - * <p> - * Called by <code>put()</code> with this node locked after checking that - * key and value are valid and non-null. - */ - abstract protected void putSpi(String key, String value); - - /** - * Removes the given key entry from this preferences node. - * The implementation is not required to propagate the change to the - * backing store immediatly. It may not throw an exception when it tries - * to write to the backing store and that operation fails, the failure - * should be registered so a later invocation of <code>flush()</code> - * or <code>sync()</code> can signal the failure. - * <p> - * Called by <code>remove()</code> with this node locked after checking - * that the key is valid and non-null. - */ - abstract protected void removeSpi(String key); - - /** - * Writes all entries of this preferences node that have not yet been - * written to the backing store and possibly creates this node in the - * backing store, if it does not yet exist. Should only write changes to - * this node and not write changes to any subnodes. - * Note that the node can be already removed in this VM. To check if - * that is the case the implementation can call <code>isRemoved()</code>. - * <p> - * Called (indirectly) by <code>flush()</code> with this node locked. - */ - abstract protected void flushSpi() throws BackingStoreException; - - /** - * Writes all entries of this preferences node that have not yet been - * written to the backing store and reads any entries that have changed - * in the backing store but that are not yet visible in this VM. - * Should only sync this node and not change any of the subnodes. - * Note that the node can be already removed in this VM. To check if - * that is the case the implementation can call <code>isRemoved()</code>. - * <p> - * Called (indirectly) by <code>sync()</code> with this node locked. - */ - abstract protected void syncSpi() throws BackingStoreException; - - /** - * Clears this node from this VM and removes it from the backing store. - * After this method has been called the node is marked as removed. - * <p> - * Called (indirectly) by <code>removeNode()</code> with this node locked - * after all the sub nodes of this node have already been removed. - */ - abstract protected void removeNodeSpi() throws BackingStoreException; -} diff --git a/libjava/java/util/prefs/BackingStoreException.java b/libjava/java/util/prefs/BackingStoreException.java deleted file mode 100644 index f2c6b4c8b31..00000000000 --- a/libjava/java/util/prefs/BackingStoreException.java +++ /dev/null @@ -1,104 +0,0 @@ -/* BackingStoreException.java - chained exception thrown when backing store - fails - Copyright (C) 2001, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package java.util.prefs; - -import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; -import java.io.NotSerializableException; - -/** - * Chained exception thrown when backing store fails. This exception is - * only thrown from methods that actually have to access the backing store, - * such as <code>clear(), keys(), childrenNames(), nodeExists(), removeNode(), - * flush(), sync(), exportNode(), exportSubTree()</code>; normal operations - * do not throw BackingStoreExceptions. - * - * <p>Note that although this class inherits the Serializable interface, an - * attempt to serialize will fail with a <code>NotSerializableException</code>. - * - * @author Mark Wielaard <mark@klomp.org> - * @since 1.4 - * @status updated to 1.4 - */ -public class BackingStoreException extends Exception -{ - static final long serialVersionUID = 859796500401108469L; - - /** - * Creates a new exception with a descriptive message. - * - * @param message the message - */ - public BackingStoreException(String message) - { - super(message); - } - - /** - * Create a new exception with the given cause. - * - * @param cause the cause - */ - public BackingStoreException(Throwable cause) - { - super(cause); - } - - /** - * This class should not be serialized. - * - * @param o the output stream - */ - private void writeObject(ObjectOutputStream o) throws NotSerializableException - { - throw new NotSerializableException - ("java.util.prefs.BackingStoreException"); - } - - /** - * This class should not be serialized. - * - * @param i the input stream - */ - private void readObject(ObjectInputStream i) throws NotSerializableException - { - throw new NotSerializableException - ("java.util.prefs.BackingStoreException"); - } -} diff --git a/libjava/java/util/prefs/InvalidPreferencesFormatException.java b/libjava/java/util/prefs/InvalidPreferencesFormatException.java deleted file mode 100644 index e375db7ab1f..00000000000 --- a/libjava/java/util/prefs/InvalidPreferencesFormatException.java +++ /dev/null @@ -1,115 +0,0 @@ -/* InvalidPreferencesFormatException - indicates reading prefs from stream - failed - Copyright (C) 2001, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package java.util.prefs; - -import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; -import java.io.NotSerializableException; - -/** - * Indicates reading prefs from stream failed. Thrown by the - * <code>importPreferences()</code> method when the supplied input stream - * could not be read because it was not in the correct XML format. - * - * <p>Note that although this class inherits the Serializable interface, an - * attempt to serialize will fail with a <code>NotSerializableException</code>. - * - * @author Mark Wielaard <mark@klomp.org> - * @see Preferences - * @since 1.4 - * @status updated to 1.4 - */ -public class InvalidPreferencesFormatException extends Exception -{ - static final long serialVersionUID = -791715184232119669L; - - /** - * Creates a new exception with a descriptive message. The cause remains - * uninitialized. - * - * @param message the message - */ - public InvalidPreferencesFormatException(String message) - { - super(message); - } - - /** - * Creates a new exception with the given cause. - * - * @param cause the cause - */ - public InvalidPreferencesFormatException(Throwable cause) - { - super(cause); - } - - /** - * Creates a new exception with a descriptive message and a cause. - * - * @param message the message - * @param cause the cause - */ - public InvalidPreferencesFormatException(String message, Throwable cause) - { - super(message, cause); - } - - /** - * This class should not be serialized. - * - * @param o the output stream - */ - private void writeObject(ObjectOutputStream o) throws NotSerializableException - { - throw new NotSerializableException - ("java.util.prefs.InvalidPreferencesFormatException"); - } - - /** - * This class should not be serialized. - * - * @param i the input stream - */ - private void readObject(ObjectInputStream i) throws NotSerializableException - { - throw new NotSerializableException - ("java.util.prefs.InvalidPreferencesFormatException"); - } -} diff --git a/libjava/java/util/prefs/NodeChangeEvent.java b/libjava/java/util/prefs/NodeChangeEvent.java deleted file mode 100644 index a919c464ab2..00000000000 --- a/libjava/java/util/prefs/NodeChangeEvent.java +++ /dev/null @@ -1,91 +0,0 @@ -/* NodeChangeEvent - ObjectEvent fired when a Preference node is added/removed - Copyright (C) 2001 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package java.util.prefs; - -import java.util.EventObject; - -/** - * ObjectEvent fired when a Preference node is added/removed. - * This event is only generated when a new subnode is added or a subnode is - * removed from a preference node. Changes in the entries of a preference node - * are indicated with a <code>PreferenceChangeEvent</code>. - * - * @since 1.4 - * @author Mark Wielaard (mark@klomp.org) - */ -public class NodeChangeEvent extends EventObject { - - private static final long serialVersionUID =8068949086596572957L; - - /** - * The sub node that was added or removed. - * Defined transient just like <code>EventObject.source</code> since - * this object should be serializable, but Preferences is in general not - * serializable. - */ - private final transient Preferences child; - - /** - * Creates a new NodeChangeEvent. - * - * @param parentNode The source preference node from which a subnode was - * added or removed - * @param childNode The preference node that was added or removed - */ - public NodeChangeEvent(Preferences parentNode, Preferences childNode) { - super(parentNode); - child = childNode; - } - - /** - * Returns the source parent preference node from which a subnode was - * added or removed. - */ - public Preferences getParent() { - return (Preferences) source; - } - - /** - * Returns the child preference subnode that was added or removed. - * To see wether it is still a valid preference node one has to call - * <code>event.getChild().nodeExists("")</code>. - */ - public Preferences getChild() { - return child; - } -} diff --git a/libjava/java/util/prefs/NodeChangeListener.java b/libjava/java/util/prefs/NodeChangeListener.java deleted file mode 100644 index 04e8dc1412e..00000000000 --- a/libjava/java/util/prefs/NodeChangeListener.java +++ /dev/null @@ -1,64 +0,0 @@ -/* NodeChangeListener - EventListener for Preferences node addition/removal - Copyright (C) 2001 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package java.util.prefs; - -import java.util.EventListener; - -/** - * EventListener for Preferences node addition/removal. - * <p> - * Note that these events are only generated for the addition and removal - * of sub nodes from the preference node. Entry changes in the preference - * node can be monitored with a <code>PreferenceChangeListener</code>. - * - * @since 1.4 - * @author Mark Wielaard (mark@klomp.org) - */ -public interface NodeChangeListener extends EventListener { - - /** - * Fired when a sub node is added to the preference node. - */ - void childAdded(NodeChangeEvent event); - - /** - * Fired when a sub node is removed from the preference node. - */ - void childRemoved(NodeChangeEvent event); - -} diff --git a/libjava/java/util/prefs/PreferenceChangeEvent.java b/libjava/java/util/prefs/PreferenceChangeEvent.java deleted file mode 100644 index de98dbb3181..00000000000 --- a/libjava/java/util/prefs/PreferenceChangeEvent.java +++ /dev/null @@ -1,105 +0,0 @@ -/* PreferenceChangeEvent - ObjectEvent fired when a Preferences entry changes - Copyright (C) 2001 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package java.util.prefs; - -import java.util.EventObject; - -/** - * ObjectEvent fired when a Preferences entry changes. - * This event is generated when a entry is added, changed or removed. - * When an entry is removed then <code>getNewValue</code> will return null. - * <p> - * Preference change events are only generated for entries in one particular - * preference node. Notification of subnode addition/removal is given by a - * <code>NodeChangeEvent</code>. - * - * @since 1.4 - * @author Mark Wielaard (mark@klomp.org) - */ -public class PreferenceChangeEvent extends EventObject { - - private static final long serialVersionUID = 793724513368024975L; - - /** - * The key of the changed entry. - */ - private final String key; - - /** - * The new value of the changed entry, or null when the entry was removed. - */ - private final String newValue; - - /** - * Creates a new PreferenceChangeEvent. - * - * @param node The source preference node for which an entry was added, - * changed or removed - * @param key The key of the entry that was added, changed or removed - * @param value The new value of the entry that was added or changed, or - * null when the entry was removed - */ - public PreferenceChangeEvent(Preferences node, String key, String value) { - super(node); - this.key = key; - this.newValue = value; - } - - /** - * Returns the source Preference node from which an entry was added, - * changed or removed. - */ - public Preferences getNode() { - return (Preferences) source; - } - - /** - * Returns the key of the entry that was added, changed or removed. - */ - public String getKey() { - return key; - } - - /** - * Returns the new value of the entry that was added or changed, or - * returns null when the entry was removed. - */ - public String getNewValue() { - return newValue; - } -} diff --git a/libjava/java/util/prefs/PreferenceChangeListener.java b/libjava/java/util/prefs/PreferenceChangeListener.java deleted file mode 100644 index 26e17274cb7..00000000000 --- a/libjava/java/util/prefs/PreferenceChangeListener.java +++ /dev/null @@ -1,60 +0,0 @@ -/* PreferenceChangeListener - EventListener for Preferences entry changes - Copyright (C) 2001 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package java.util.prefs; - -import java.util.EventListener; - -/** - * EventListener for Preferences entry addition, change or removal. - * <p> - * Preference change events are only generated for entries in one particular - * preference node. Notification of subnode addition/removal can be monitored - * with a <code>NodeChangeListener</code>. - * - * @since 1.4 - * @author Mark Wielaard (mark@klomp.org) - */ -public interface PreferenceChangeListener extends EventListener { - - /** - * Fired when a entry has been added, changed or removed from the - * preference node. - */ - void preferenceChange(PreferenceChangeEvent event); - -} diff --git a/libjava/java/util/prefs/Preferences.java b/libjava/java/util/prefs/Preferences.java deleted file mode 100644 index 8705b77191c..00000000000 --- a/libjava/java/util/prefs/Preferences.java +++ /dev/null @@ -1,665 +0,0 @@ -/* Preferences - Preference node containing key value entries and subnodes - Copyright (C) 2001 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package java.util.prefs; - -import java.io.InputStream; -import java.io.OutputStream; -import java.io.IOException; - -import java.security.AccessController; -import java.security.Permission; -import java.security.PrivilegedAction; - -import gnu.java.util.prefs.*; - -/** - * Preference node containing key value entries and subnodes. - * <p> - * There are two preference node trees, a system tree which can be accessed - * by calling <code>systemRoot()</code> containing system preferences usefull - * for all users, and a user tree that can be accessed by calling - * <code>userRoot()</code> containing preferences that can differ between - * different users. How different users are identified is implementation - * depended. It can be determined by Thread, Access Control Context or Subject. - * <p> - * This implementation uses the "java.util.prefs.PreferencesFactory" system - * property to find a class that implement <code>PreferencesFactory</code> - * and initialized that class (if it has a public no arguments contructor) - * to get at the actual system or user root. If the system property is not set, - * or the class cannot be initialized it uses the default implementation - * <code>gnu.java.util.prefs.FileBasedFactory</code>. - * <p> - * Besides the two static method above to get the roots of the system and user - * preference node trees there are also two convenience methods to access the - * default preference node for a particular package an object is in. These are - * <code>userNodeForPackage()</code> and <code>systemNodeForPackage()</code>. - * Both methods take an Object as an argument so accessing preferences values - * can be as easy as calling <code>Preferences.userNodeForPackage(this)</code>. - * <p> - * Note that if a security manager is installed all static methods check for - * <code>RuntimePermission("preferences")</code>. But if this permission is - * given to the code then it can access and change all (user) preference nodes - * and entries. So you should be carefull not to store to sensitive information - * or make security decissions based on preference values since there is no - * more fine grained control over what preference values can be changed once - * code has been given the correct runtime permission. - * <p> - * XXX - * - * @since 1.4 - * @author Mark Wielaard (mark@klomp.org) - */ -public abstract class Preferences { - - // Static Fields - - /** - * Default PreferencesFactory class used when the system property - * "java.util.prefs.PreferencesFactory" is not set. - * <p> - * XXX - Currently set to MemoryBasedPreferencesFactory, should be changed - * when FileBasedPreferences backend works. - */ - private static final String defaultFactoryClass - = "gnu.java.util.prefs.MemoryBasedPreferencesFactory"; - - /** Permission needed to access system or user root. */ - private static final Permission prefsPermission - = new RuntimePermission("preferences"); - - /** - * The preferences factory object that supplies the system and user root. - * Set and returned by the getFactory() method. - */ - private static PreferencesFactory factory; - - /** Maximum node name length. 80 characters. */ - public static final int MAX_NAME_LENGTH = 80; - - /** Maximum entry key length. 80 characters. */ - public static final int MAX_KEY_LENGTH = 80; - - /** Maximum entry value length. 8192 characters. */ - public static final int MAX_VALUE_LENGTH = 8192; - - // Constructors - - /** - * Creates a new Preferences node. Can only be used by subclasses. - * Empty implementation. - */ - protected Preferences() {} - - // Static methods - - /** - * Returns the system preferences root node containing usefull preferences - * for all users. It is save to cache this value since it should always - * return the same preference node. - * - * @return the root system preference node - * @exception SecurityException when a security manager is installed and - * the caller does not have <code>RuntimePermission("preferences")</code>. - */ - public static Preferences systemRoot() throws SecurityException { - // Get the preferences factory and check for permission - PreferencesFactory factory = getFactory(); - - return factory.systemRoot(); - } - - /** - * Returns the user preferences root node containing preferences for the - * the current user. How different users are identified is implementation - * depended. It can be determined by Thread, Access Control Context or - * Subject. - * - * @return the root user preference node - * @exception SecurityException when a security manager is installed and - * the caller does not have <code>RuntimePermission("preferences")</code>. - */ - public static Preferences userRoot() throws SecurityException { - // Get the preferences factory and check for permission - PreferencesFactory factory = getFactory(); - return factory.userRoot(); - } - - /** - * Private helper method for <code>systemRoot()</code> and - * <code>userRoot()</code>. Checks security permission and instantiates the - * correct factory if it has not yet been set. - * <p> - * When the preferences factory has not yet been set this method first - * tries to get the system propery "java.util.prefs.PreferencesFactory" - * and tries to initializes that class. If the system property is not set - * or initialization fails it returns an instance of the default factory - * <code>gnu.java.util.prefs.FileBasedPreferencesFactory</code>. - * - * @return the preferences factory to use - * @exception SecurityException when a security manager is installed and - * the caller does not have <code>RuntimePermission("preferences")</code>. - */ - private static PreferencesFactory getFactory() throws SecurityException { - - // First check for permission - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(prefsPermission); - } - - // Get the factory - if (factory == null) { - // Caller might not have enough permissions - factory = (PreferencesFactory) AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - PreferencesFactory pf = null; - String className = System.getProperty - ("java.util.prefs.PreferencesFactory"); - if (className != null) { - try { - Class fc = Class.forName(className); - Object o = fc.newInstance(); - pf = (PreferencesFactory) o; - } catch (ClassNotFoundException cnfe) - {/*ignore*/} - catch (InstantiationException ie) - {/*ignore*/} - catch (IllegalAccessException iae) - {/*ignore*/} - catch (ClassCastException cce) - {/*ignore*/} - } - return pf; - } - }); - - // Still no factory? Use our default. - if (factory == null) { - try { - Object o = Class.forName(defaultFactoryClass); - factory = (PreferencesFactory) o; - } catch (ClassNotFoundException cnfe) { - throw new RuntimeException("Couldn't load default factory" - + " '"+ defaultFactoryClass +"'"); - // XXX - when using 1.4 compatible throwables add cause - } - } - - } - return factory; - } - - /** - * Returns the system preferences node for the package of an object. - * The package node name of the object is determined by dropping the - * class name of the object of the fully quallified class name and - * replacing all '.' to '/' in the package name. If the class of the - * object has no package then the package node name is "<unnamed>". - * The returened node is <code>systemRoot().node(packageNodeName)</code>. - * - * @param o Object whose default system preference node is requested - * @returns system preferences node that should be used by object o - * @exception SecurityException when a security manager is installed and - * the caller does not have <code>RuntimePermission("preferences")</code>. - */ - public static Preferences systemNodeForPackage(Object o) - throws SecurityException - { - return nodeForPackage(o, systemRoot()); - } - - /** - * Returns the user preferences node for the package of an object. - * The package node name of the object is determined by dropping the - * class name of the object of the fully quallified class name and - * replacing all '.' to '/' in the package name. If the class of the - * object has no package then the package node name is "<unnamed>". - * The returened node is <code>userRoot().node(packageNodeName)</code>. - * - * @param o Object whose default user preference node is requested - * @returns user preferences node that should be used by object o - * @exception SecurityException when a security manager is installed and - * the caller does not have <code>RuntimePermission("preferences")</code>. - */ - public static Preferences userNodeForPackage(Object o) - throws SecurityException - { - return nodeForPackage(o, userRoot()); - } - - /** - * Private helper method for <code>systemNodeForPackage()</code> and - * <code>userNodeForPackage()</code>. Given the correct system or user - * root it returns the correct Preference node for the package node name - * of the given object. - */ - private static Preferences nodeForPackage(Object o, Preferences root) { - // Get the package path - String className = o.getClass().getName(); - String packagePath; - int index = className.lastIndexOf('.'); - if(index == -1) { - packagePath = "<unnamed>"; - } else { - packagePath = className.substring(0,index).replace('.','/'); - } - - return root.node(packagePath); - } - - /** - * XXX - */ - public static void importPreferences(InputStream is) - throws InvalidPreferencesFormatException, - IOException - { - PreferencesFactory factory = getFactory(); - NodeReader reader = new NodeReader(is, factory); - reader.importPreferences(); - } - - // abstract methods (identification) - - /** - * Returns the absolute path name of this preference node. - * The absolute path name of a node is the path name of its parent node - * plus a '/' plus its own name. If the node is the root node and has no - * parent then its name is "" and its absolute path name is "/". - */ - abstract public String absolutePath(); - - /** - * Returns true if this node comes from the user preferences tree, false - * if it comes from the system preferences tree. - */ - abstract public boolean isUserNode(); - - /** - * Returns the name of this preferences node. The name of the node cannot - * be null, can be mostly 80 characters and cannot contain any '/' - * characters. The root node has as name "". - */ - abstract public String name(); - - /** - * Returns the String given by - * <code> - * (isUserNode() ? "User":"System") + " Preference Node: " + absolutePath() - * </code> - */ - abstract public String toString(); - - // abstract methods (navigation) - - /** - * Returns all the direct sub nodes of this preferences node. - * Needs access to the backing store to give a meaningfull answer. - * - * @exception BackingStoreException when the backing store cannot be - * reached - * @exception IllegalStateException when this node has been removed - */ - abstract public String[] childrenNames() throws BackingStoreException; - - /** - * Returns a sub node of this preferences node if the given path is - * relative (does not start with a '/') or a sub node of the root - * if the path is absolute (does start with a '/'). - * - * @exception IllegalStateException if this node has been removed - * @exception IllegalArgumentException if the path contains two or more - * consecutive '/' characters, ends with a '/' charactor and is not the - * string "/" (indicating the root node) or any name on the path is more - * then 80 characters long - */ - abstract public Preferences node(String path); - - /** - * Returns true if the node that the path points to exists in memory or - * in the backing store. Otherwise it returns false or an exception is - * thrown. When this node is removed the only valid parameter is the - * empty string (indicating this node), the return value in that case - * will be false. - * - * @exception BackingStoreException when the backing store cannot be - * reached - * @exception IllegalStateException if this node has been removed - * and the path is not the empty string (indicating this node) - * @exception IllegalArgumentException if the path contains two or more - * consecutive '/' characters, ends with a '/' charactor and is not the - * string "/" (indicating the root node) or any name on the path is more - * then 80 characters long - */ - abstract public boolean nodeExists(String path) - throws BackingStoreException; - - /** - * Returns the parent preferences node of this node or null if this is - * the root of the preferences tree. - * - * @exception IllegalStateException if this node has been removed - */ - abstract public Preferences parent(); - - // abstract methods (export) - - /** - * XXX - */ - abstract public void exportNode(OutputStream os) - throws BackingStoreException, - IOException; - - /** - * XXX - */ - abstract public void exportSubtree(OutputStream os) - throws BackingStoreException, - IOException; - - // abstract methods (preference entry manipulation) - - /** - * Returns an (possibly empty) array with all the keys of the preference - * entries of this node. - * - * @exception BackingStoreException when the backing store cannot be - * reached - * @exception IllegalStateException if this node has been removed - */ - abstract public String[] keys() throws BackingStoreException; - - /** - * Returns the value associated with the key in this preferences node. If - * the default value of the key cannot be found in the preferences node - * entries or something goes wrong with the backing store the supplied - * default value is returned. - * - * @exception IllegalArgumentException if key is larger then 80 characters - * @exception IllegalStateException if this node has been removed - * @exception NullPointerException if key is null - */ - abstract public String get(String key, String defaultVal); - - /** - * Convenience method for getting the given entry as a boolean. - * When the string representation of the requested entry is either - * "true" or "false" (ignoring case) then that value is returned, - * otherwise the given default boolean value is returned. - * - * @exception IllegalArgumentException if key is larger then 80 characters - * @exception IllegalStateException if this node has been removed - * @exception NullPointerException if key is null - */ - abstract public boolean getBoolean(String key, boolean defaultVal); - - /** - * Convenience method for getting the given entry as a byte array. - * When the string representation of the requested entry is a valid - * Base64 encoded string (without any other characters, such as newlines) - * then the decoded Base64 string is returned as byte array, - * otherwise the given default byte array value is returned. - * - * @exception IllegalArgumentException if key is larger then 80 characters - * @exception IllegalStateException if this node has been removed - * @exception NullPointerException if key is null - */ - abstract public byte[] getByteArray(String key, byte[] defaultVal); - - /** - * Convenience method for getting the given entry as a double. - * When the string representation of the requested entry can be decoded - * with <code>Double.parseDouble()</code> then that double is returned, - * otherwise the given default double value is returned. - * - * @exception IllegalArgumentException if key is larger then 80 characters - * @exception IllegalStateException if this node has been removed - * @exception NullPointerException if key is null - */ - abstract public double getDouble(String key, double defaultVal); - - /** - * Convenience method for getting the given entry as a float. - * When the string representation of the requested entry can be decoded - * with <code>Float.parseFloat()</code> then that float is returned, - * otherwise the given default float value is returned. - * - * @exception IllegalArgumentException if key is larger then 80 characters - * @exception IllegalStateException if this node has been removed - * @exception NullPointerException if key is null - */ - abstract public float getFloat(String key, float defaultVal); - - /** - * Convenience method for getting the given entry as an integer. - * When the string representation of the requested entry can be decoded - * with <code>Integer.parseInt()</code> then that integer is returned, - * otherwise the given default integer value is returned. - * - * @exception IllegalArgumentException if key is larger then 80 characters - * @exception IllegalStateException if this node has been removed - * @exception NullPointerException if key is null - */ - abstract public int getInt(String key, int defaultVal); - - /** - * Convenience method for getting the given entry as a long. - * When the string representation of the requested entry can be decoded - * with <code>Long.parseLong()</code> then that long is returned, - * otherwise the given default long value is returned. - * - * @exception IllegalArgumentException if key is larger then 80 characters - * @exception IllegalStateException if this node has been removed - * @exception NullPointerException if key is null - */ - abstract public long getLong(String key, long defaultVal); - - /** - * Sets the value of the given preferences entry for this node. - * Key and value cannot be null, the key cannot exceed 80 characters - * and the value cannot exceed 8192 characters. - * <p> - * The result will be immediatly visible in this VM, but may not be - * immediatly written to the backing store. - * - * @exception NullPointerException if either key or value are null - * @exception IllegalArgumentException if either key or value are to large - * @exception IllegalStateException when this node has been removed - */ - abstract public void put(String key, String value); - - /** - * Convenience method for setting the given entry as a boolean. - * The boolean is converted with <code>Boolean.toString(value)</code> - * and then stored in the preference entry as that string. - * - * @exception NullPointerException if key is null - * @exception IllegalArgumentException if the key length is to large - * @exception IllegalStateException when this node has been removed - */ - abstract public void putBoolean(String key, boolean value); - - /** - * Convenience method for setting the given entry as an array of bytes. - * The byte array is converted to a Base64 encoded string - * and then stored in the preference entry as that string. - * <p> - * Note that a byte array encoded as a Base64 string will be about 1.3 - * times larger then the original length of the byte array, which means - * that the byte array may not be larger about 6 KB. - * - * @exception NullPointerException if either key or value are null - * @exception IllegalArgumentException if either key or value are to large - * @exception IllegalStateException when this node has been removed - */ - abstract public void putByteArray(String key, byte[] value); - - /** - * Convenience method for setting the given entry as a double. - * The double is converted with <code>Double.toString(double)</code> - * and then stored in the preference entry as that string. - * - * @exception NullPointerException if the key is null - * @exception IllegalArgumentException if the key length is to large - * @exception IllegalStateException when this node has been removed - */ - abstract public void putDouble(String key, double value); - - /** - * Convenience method for setting the given entry as a float. - * The float is converted with <code>Float.toString(float)</code> - * and then stored in the preference entry as that string. - * - * @exception NullPointerException if the key is null - * @exception IllegalArgumentException if the key length is to large - * @exception IllegalStateException when this node has been removed - */ - abstract public void putFloat(String key, float value); - - /** - * Convenience method for setting the given entry as an integer. - * The integer is converted with <code>Integer.toString(int)</code> - * and then stored in the preference entry as that string. - * - * @exception NullPointerException if the key is null - * @exception IllegalArgumentException if the key length is to large - * @exception IllegalStateException when this node has been removed - */ - abstract public void putInt(String key, int value); - - /** - * Convenience method for setting the given entry as a long. - * The long is converted with <code>Long.toString(long)</code> - * and then stored in the preference entry as that string. - * - * @exception NullPointerException if the key is null - * @exception IllegalArgumentException if the key length is to large - * @exception IllegalStateException when this node has been removed - */ - abstract public void putLong(String key, long value); - - /** - * Removes the preferences entry from this preferences node. - * <p> - * The result will be immediatly visible in this VM, but may not be - * immediatly written to the backing store. - * - * @exception NullPointerException if the key is null - * @exception IllegalArgumentException if the key length is to large - * @exception IllegalStateException when this node has been removed - */ - abstract public void remove(String key); - - // abstract methods (preference node manipulation) - - /** - * Removes all entries from this preferences node. May need access to the - * backing store to get and clear all entries. - * <p> - * The result will be immediatly visible in this VM, but may not be - * immediatly written to the backing store. - * - * @exception BackingStoreException when the backing store cannot be - * reached - * @exception IllegalStateException if this node has been removed - */ - abstract public void clear() throws BackingStoreException; - - /** - * Writes all preference changes on this and any subnode that have not - * yet been written to the backing store. This has no effect on the - * preference entries in this VM, but it makes sure that all changes - * are visible to other programs (other VMs might need to call the - * <code>sync()</code> method to actually see the changes to the backing - * store. - * - * @exception BackingStoreException when the backing store cannot be - * reached - * @exception IllegalStateException if this node has been removed - */ - abstract public void flush() throws BackingStoreException; - - /** - * Writes and reads all preference changes to and from this and any - * subnodes. This makes sure that all local changes are written to the - * backing store and that all changes to the backing store are visible - * in this preference node (and all subnodes). - * - * @exception BackingStoreException when the backing store cannot be - * reached - * @exception IllegalStateException if this node has been removed - */ - abstract public void sync() throws BackingStoreException; - - /** - * Removes this and all subnodes from the backing store and clears all - * entries. After removal this instance will not be useable (except for - * a few methods that don't throw a <code>InvalidStateException</code>), - * even when a new node with the same path name is created this instance - * will not be usable again. The root (system or user) may never be removed. - * <p> - * Note that according to the specification an implementation may delay - * removal of the node from the backing store till the <code>flush()</code> - * method is called. But the <code>flush()</code> method may throw a - * <code>IllegalStateException</code> when the node has been removed. - * So most implementations will actually remove the node and any subnodes - * from the backing store immediatly. - * - * @exception BackingStoreException when the backing store cannot be - * reached - * @exception IllegalStateException if this node has already been removed - * @exception UnsupportedOperationException if this is a root node - */ - abstract public void removeNode() throws BackingStoreException; - - // abstract methods (listeners) - - abstract public void addNodeChangeListener(NodeChangeListener listener); - - abstract public void addPreferenceChangeListener - (PreferenceChangeListener listener); - - abstract public void removeNodeChangeListener(NodeChangeListener listener); - - abstract public void removePreferenceChangeListener - (PreferenceChangeListener listener); - -} - diff --git a/libjava/java/util/prefs/PreferencesFactory.java b/libjava/java/util/prefs/PreferencesFactory.java deleted file mode 100644 index f43497894f1..00000000000 --- a/libjava/java/util/prefs/PreferencesFactory.java +++ /dev/null @@ -1,66 +0,0 @@ -/* PreferencesFactory - Preferences system and user root factory interface - Copyright (C) 2001 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package java.util.prefs; - -import java.util.EventListener; - -/** - * Preferences system and user root factory interface. Defines how to get - * to the system and user root preferences objects. Should be implemented by - * new preferences backends. - * - * @since 1.4 - * @author Mark Wielaard (mark@klomp.org) - */ -public interface PreferencesFactory { - - /** - * Returns the system root preferences node. Should always return the - * same object. - */ - Preferences systemRoot(); - - /** - * Returns the user root preferences node. May return different objects - * depending on the user that called this method. The user may for example - * be determined by the current Thread or the Subject associated with the - * current AccessControllContext. - */ - Preferences userRoot(); - -} diff --git a/libjava/javax/print/attribute/Attribute.java b/libjava/javax/print/attribute/Attribute.java deleted file mode 100644 index babf200651c..00000000000 --- a/libjava/javax/print/attribute/Attribute.java +++ /dev/null @@ -1,50 +0,0 @@ -/* Attribute.java -- - Copyright (C) 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package javax.print.attribute; - -import java.io.Serializable; - -/** - * @author Michael Koch - */ -public interface Attribute extends Serializable -{ - public Class getCategory (); - - public String getName (); -} diff --git a/libjava/javax/print/attribute/AttributeSet.java b/libjava/javax/print/attribute/AttributeSet.java deleted file mode 100644 index 325251a1dd7..00000000000 --- a/libjava/javax/print/attribute/AttributeSet.java +++ /dev/null @@ -1,77 +0,0 @@ -/* AttributeSet.java -- - Copyright (C) 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package javax.print.attribute; - -/** - * @author Michael Koch - */ -public interface AttributeSet -{ - /** - * Adds the specified attribute value to this attribute set - * if it is not already present. - */ - public boolean add (Attribute attribute); - - /** - * Adds all of the elements in the specified set to this attribute. - */ - public boolean addAll (AttributeSet attributes); - - public void clear (); - - public boolean containsKey (Class category); - - public boolean containsValue (Attribute attribute); - - public boolean equals (Object obj); - - public Attribute get (Class Category); - - public int hashCode (); - - public boolean isEmpty (); - - public boolean remove (Attribute attribute); - - public boolean remove (Class category); - - public int size (); - - public Attribute[] toArray (); -} diff --git a/libjava/javax/print/attribute/PrintRequestAttributeSet.java b/libjava/javax/print/attribute/PrintRequestAttributeSet.java deleted file mode 100644 index f8f6dba2d49..00000000000 --- a/libjava/javax/print/attribute/PrintRequestAttributeSet.java +++ /dev/null @@ -1,55 +0,0 @@ -/* PrintRequestAttributeSet.java -- - Copyright (C) 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package javax.print.attribute; - -/** - * @author Michael Koch - */ -public interface PrintRequestAttributeSet extends AttributeSet -{ - /** - * Adds the specified attribute value to this attribute set - * if it is not already present. - */ - public boolean add (Attribute attribute); - - /** - * Adds all of the elements in the specified set to this attribute. - */ - public boolean addAll (AttributeSet attributes); -} diff --git a/libjava/jni/classpath/jcl.c b/libjava/jni/classpath/jcl.c deleted file mode 100644 index 66c756e0ffd..00000000000 --- a/libjava/jni/classpath/jcl.c +++ /dev/null @@ -1,134 +0,0 @@ -/* jcl.c - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -#include <stdio.h> -#include <jcl.h> -#include <malloc.h> - -static char errstr[4098]; // this way the memory is pre-allocated, so that we do not have to worry if we are out of memory. - -JNIEXPORT void JNICALL JCL_ThrowException(JNIEnv * env, char * className, char * errMsg) { - jclass excClass; - if((*env)->ExceptionOccurred(env)) { - (*env)->ExceptionClear(env); - } - excClass = (*env)->FindClass(env, className); - if(excClass == NULL) { - jclass errExcClass; - errExcClass = (*env)->FindClass(env, "java/lang/ClassNotFoundException"); - if(errExcClass == NULL) { - errExcClass = (*env)->FindClass(env, "java/lang/InternalError"); - if(errExcClass == NULL) { - sprintf(errstr,"JCL: Utterly failed to throw exeption %s with message %s.",className,errMsg); - fprintf(stderr, errstr); - return; - } - } - sprintf(errstr,"JCL: Failed to throw exception %s with message %s: could not find exception class.", className, errMsg); - (*env)->ThrowNew(env, errExcClass, errstr); - } - (*env)->ThrowNew(env, excClass, errMsg); -} - -JNIEXPORT void * JNICALL JCL_malloc(JNIEnv * env, size_t size) { - void * mem = malloc(size); - if(mem == NULL) { - JCL_ThrowException(env, "java/lang/OutOfMemoryError", "malloc() failed."); - return NULL; - } - return mem; -} - -JNIEXPORT void * JNICALL JCL_realloc(JNIEnv *env, void *ptr, size_t size) -{ - ptr = realloc(ptr, size); - if (ptr == 0) - { - JCL_ThrowException(env, "java/lang/OutOfMemoryError", - "malloc() failed."); - return NULL; - } - return(ptr); -} - -JNIEXPORT void JNICALL JCL_free(JNIEnv * env, void * p) { - if(p != NULL) { - free(p); - } -} - -JNIEXPORT char * JNICALL JCL_jstring_to_cstring(JNIEnv * env, jstring s) { - char* cstr; - if(s == NULL) { - JCL_ThrowException(env, "java/lang/NullPointerException","Null string"); - return NULL; - } - cstr = (char*)(*env)->GetStringUTFChars(env, s, NULL); - if(cstr == NULL) { - JCL_ThrowException(env, "java/lang/InternalError", "GetStringUTFChars() failed."); - return NULL; - } - return cstr; -} - -JNIEXPORT void JNICALL JCL_free_cstring(JNIEnv * env, jstring s, char * cstr) { - (*env)->ReleaseStringUTFChars(env, s, cstr); -} - -JNIEXPORT jint JNICALL JCL_MonitorEnter(JNIEnv * env, jobject o) { - jint retval = (*env)->MonitorEnter(env,o); - if(retval != 0) { - JCL_ThrowException(env, "java/lang/InternalError", "MonitorEnter() failed."); - } - return retval; -} - -JNIEXPORT jint JNICALL JCL_MonitorExit(JNIEnv * env, jobject o) { - jint retval = (*env)->MonitorExit(env,o); - if(retval != 0) { - JCL_ThrowException(env, "java/lang/InternalError", "MonitorExit() failed."); - } - return retval; -} - -JNIEXPORT jclass JNICALL JCL_FindClass(JNIEnv * env, char * className) { - jclass retval = (*env)->FindClass(env,className); - if(retval == NULL) { - JCL_ThrowException(env, "java/lang/ClassNotFoundException", className); - } - return retval; -} diff --git a/libjava/jni/classpath/jcl.h b/libjava/jni/classpath/jcl.h deleted file mode 100644 index a7d00b47cd3..00000000000 --- a/libjava/jni/classpath/jcl.h +++ /dev/null @@ -1,64 +0,0 @@ -/* jcl.h - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -#ifndef __JCL_H__ -#define __JCL_H__ - -#include <stddef.h> -#include <jni.h> -#include <config.h> - -JNIEXPORT jclass JNICALL JCL_FindClass(JNIEnv * env, char * className); -JNIEXPORT void JNICALL JCL_ThrowException(JNIEnv * env, char * className, char * errMsg); -JNIEXPORT void * JNICALL JCL_malloc(JNIEnv *env, size_t size); -JNIEXPORT void * JNICALL JCL_realloc(JNIEnv *env, void *ptr, size_t size); -JNIEXPORT void JNICALL JCL_free(JNIEnv *env, void * p); -JNIEXPORT char * JNICALL JCL_jstring_to_cstring(JNIEnv *env, jstring s); -JNIEXPORT void JNICALL JCL_free_cstring(JNIEnv *env, jstring s, char * cstr); -JNIEXPORT jint JNICALL JCL_MonitorEnter(JNIEnv *env, jobject o); -JNIEXPORT jint JNICALL JCL_MonitorExit(JNIEnv *env, jobject o); - -#define JCL_RETHROW_EXCEPTION(env) if((*(env))->ExceptionOccurred((env)) != NULL) return NULL; - -/* Simple debug macro */ -#ifdef DEBUG -#define DBG(x) fprintf(stderr, (x)); -#else -#define DBG(x) -#endif - -#endif diff --git a/libjava/jni/classpath/jnilink.c b/libjava/jni/classpath/jnilink.c deleted file mode 100644 index 0c244f285af..00000000000 --- a/libjava/jni/classpath/jnilink.c +++ /dev/null @@ -1,117 +0,0 @@ -/* JNILINK 1.1: JNI version. - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "jnilink.h" -#include <string.h> -#include <jcl.h> - -#include <malloc.h> - -#define GETCLASS(c) *(jclass*)(c) - -JNIEXPORT jclass JNICALL -LINK_RelinkClass (JNIEnv * env, linkedClass * c, char * name) { - jclass found; - LINK_UnlinkClass(env,*c); - - found = (*env)->FindClass(env,name); - if(found == NULL) - return NULL; - - *c = JCL_malloc(env,sizeof(jclass)); - if(*c == NULL) - return NULL; - - GETCLASS(*c) = (*env)->NewGlobalRef(env,found); - return GETCLASS(*c); -} - -JNIEXPORT jclass JNICALL -LINK_RelinkKnownClass(JNIEnv * env, linkedClass * c, jclass newClass) { - LINK_UnlinkClass(env,*c); - - *c = JCL_malloc(env,sizeof(jclass)); - if(*c == NULL) - return NULL; - - GETCLASS(*c) = (*env)->NewGlobalRef(env,newClass); - return newClass; -} - -JNIEXPORT jmethodID JNICALL -LINK_RelinkMethod (JNIEnv * env, jmethodID * m, linkedClass c, - char * name, char * sig) { - *m = (*env)->GetMethodID(env,GETCLASS(c),name,sig); - return *m; -} - -JNIEXPORT jmethodID JNICALL -LINK_RelinkStaticMethod(JNIEnv * env, jmethodID * m, linkedClass c, - char * name, char * sig) { - *m = (*env)->GetStaticMethodID(env,GETCLASS(c),name,sig); - return *m; -} - -JNIEXPORT jfieldID JNICALL -LINK_RelinkField (JNIEnv * env, jfieldID * f, linkedClass c, - char * name, char * sig) { - *f = (*env)->GetFieldID(env,GETCLASS(c),name,sig); - return *f; -} - -JNIEXPORT jfieldID JNICALL -LINK_RelinkStaticField (JNIEnv * env, jfieldID * f, linkedClass c, - char * name, char * sig) { - *f = (*env)->GetStaticFieldID(env,GETCLASS(c),name,sig); - return *f; -} - - -/* These are for when the class referencing the symbols is unloaded; it -destroys any object references - * the linker might have kept around. - */ -JNIEXPORT void JNICALL LINK_UnlinkClass (JNIEnv * env, linkedClass * c) { - if(*c != NULL) { - if(GETCLASS(*c) != NULL) - (*env)->DeleteGlobalRef(env,GETCLASS(*c)); - JCL_free(env,*c); - *c = NULL; - } -} - diff --git a/libjava/jni/classpath/jnilink.h b/libjava/jni/classpath/jnilink.h deleted file mode 100644 index 448e2b5dfdd..00000000000 --- a/libjava/jni/classpath/jnilink.h +++ /dev/null @@ -1,86 +0,0 @@ -/* JNILINK 1.1: JNI version. - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#ifndef __JNILINK_H__ -#define __JNILINK_H__ - -#include <jni.h> - -typedef void* linkedClass; - -#define LINK_LinkClass(env,c,name) ((c)==NULL ? LINK_ReallyLinkClass((env),&(c),(name)) : (c)) -#define LINK_LinkKnownClass(env,c,newClass) ((c)==NULL ? LINK_ReallyLinkKnownClass((env),&(c),(newClass)) : (c)) -#define LINK_LinkMethod(env,m,c,name,sig) ((m)==NULL ? LINK_RelinkMethod((env),&(m),(c),(name),(sig)) : (m)) -#define LINK_LinkStaticMethod(env,m,c,name,sig) ((m)==NULL ? LINK_RelinkStaticMethod((env),&(m),(c),(name),(sig)) : (m)) -#define LINK_LinkField(env,f,c,name,sig) ((m)==NULL ? LINK_RelinkField((env),&(f),(c),(name),(sig)) : (f)) -#define LINK_LinkStaticField(env,f,c,name,sig) ((m)==NULL ? LINK_RelinkStaticField((env),&(f),(c),(name),(sig)) : (f)) - -#define LINK_LinkConstructor(env,m,c,sig) ((m)==NULL ? LINK_RelinkMethod((env),&(m),(c),"<init>",(sig)) : (m)) - -JNIEXPORT jclass JNICALL -LINK_ReallyLinkClass (JNIEnv * env, linkedClass * c, - char * name); -JNIEXPORT jclass JNICALL -LINK_ReallyLinkKnownClass(JNIEnv * env, linkedClass * c, - jclass newClass); -JNIEXPORT jclass JNICALL -LINK_RelinkClass (JNIEnv * env, linkedClass * c, - char * name); -JNIEXPORT jclass JNICALL -LINK_RelinkKnownClass (JNIEnv * env, linkedClass * c, - jclass newClass); -JNIEXPORT jmethodID JNICALL -LINK_RelinkMethod (JNIEnv * env, jmethodID * m, linkedClass c, - char * name, char * sig); -JNIEXPORT jmethodID JNICALL -LINK_RelinkStaticMethod(JNIEnv * env, jmethodID * m, linkedClass c, - char * name, char * sig); -JNIEXPORT jfieldID JNICALL -LINK_RelinkField (JNIEnv * env, jfieldID * f, linkedClass c, - char * name, char * sig); -JNIEXPORT jfieldID JNICALL -LINK_RelinkStaticField (JNIEnv * env, jfieldID * f, linkedClass c, - char * name, char * sig); - -/* These are for when the class referencing the symbols is unloaded; it -destroys any object references - * the linker might have kept around. - */ -JNIEXPORT void JNICALL LINK_UnlinkClass (JNIEnv * env, linkedClass * c); - -#endif diff --git a/libjava/jni/classpath/native_state.c b/libjava/jni/classpath/native_state.c deleted file mode 100644 index 746686edd97..00000000000 --- a/libjava/jni/classpath/native_state.c +++ /dev/null @@ -1,247 +0,0 @@ -/* Magical NSA API -- Associate a C ptr with an instance of an object - Copyright (C) 1998, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -#include <stdlib.h> -#include <jni.h> -#include "native_state.h" - -#define DEFAULT_TABLE_SIZE 97 - -struct state_table * -init_state_table_with_size (JNIEnv *env, jclass clazz, jint size) -{ - struct state_table *table; - jfieldID hash; - jclass clazz_g; - - hash = (*env)->GetFieldID (env, clazz, "native_state", "I"); - if (hash == NULL) - return NULL; - - clazz_g = (*env)->NewGlobalRef (env, clazz); - if (clazz_g == NULL) - return NULL; - - table = (struct state_table *) malloc (sizeof (struct state_table)); - table->size = size; - table->head = (struct state_node **) calloc (sizeof (struct state_node *), - table->size); - table->hash = hash; - table->clazz = clazz_g; - - return table; -} - -struct state_table * -init_state_table (JNIEnv *env, jclass clazz) -{ - return init_state_table_with_size (env, clazz, DEFAULT_TABLE_SIZE); -} - -static void * -remove_node (struct state_node **head, jint obj_id) -{ - struct state_node *back_ptr = NULL; - struct state_node *node = *head; - - while (node != NULL) - { - if (node->key == obj_id) - { - void *return_value; - if (back_ptr == NULL) - *head = node->next; - else - back_ptr->next = node->next; - return_value = node->c_state; - free (node); - return return_value; - } - back_ptr = node; - node = node->next; - } - - return NULL; -} - -static void * -get_node (struct state_node **head, jint obj_id) -{ - struct state_node *back_ptr = NULL; - struct state_node *node = *head; - - while (node != NULL) - { - if (node->key == obj_id) - { - /* Move the node we found to the front of the list. */ - if (back_ptr != NULL) - { - back_ptr->next = node->next; - node->next = *head; - *head = node; - } - - /* Return the match. */ - return node->c_state; - } - - back_ptr = node; - node = node->next; - } - - return NULL; -} - -static void -add_node (struct state_node **head, jint obj_id, void *state) -{ - struct state_node *node = *head; - struct state_node *back_ptr = NULL; - - struct state_node *new_node; - - if (node != NULL) - { - while (node->next != NULL && obj_id != node->key) - { - back_ptr = node; - node = node->next; - } - - if (node->key == obj_id) - { - /* If we're updating a node, move it to the front of the - list. */ - if (back_ptr != NULL) - { - back_ptr->next = node->next; - node->next = *head; - } - node->c_state = state; - return; - } - } - - new_node = (struct state_node *) malloc (sizeof (struct state_node)); - new_node->key = obj_id; - new_node->c_state = state; - new_node->next = *head; - *head = new_node; -} - -void -set_state_oid (JNIEnv *env, jobject lock, struct state_table *table, - jint obj_id, void *state) -{ - jint hash; - - hash = obj_id % table->size; - - (*env)->MonitorEnter (env, lock); - add_node (&table->head[hash], obj_id, state); - (*env)->MonitorExit (env, lock); -} - -void * -get_state_oid (JNIEnv *env, jobject lock, struct state_table *table, - jint obj_id) -{ - jint hash; - void *return_value; - - hash = obj_id % table->size; - - (*env)->MonitorEnter (env, lock); - return_value = get_node (&table->head[hash], obj_id); - (*env)->MonitorExit (env, lock); - - return return_value; -} - -void * -remove_state_oid (JNIEnv *env, jobject lock, struct state_table *table, - jint obj_id) -{ - jint hash; - void *return_value; - - hash = obj_id % table->size; - - (*env)->MonitorEnter (env, lock); - return_value = remove_node (&table->head[hash], obj_id); - (*env)->MonitorExit (env, lock); - - return return_value; -} - -int -set_state (JNIEnv *env, jobject obj, struct state_table *table, void *state) -{ - jint obj_id; - obj_id = (*env)->GetIntField (env, obj, table->hash); - - if ((*env)->ExceptionOccurred (env) != NULL) - return -1; - - set_state_oid (env, table->clazz, table, obj_id, state); - return 0; -} - -void * -get_state (JNIEnv *env, jobject obj, struct state_table *table) -{ - jint obj_id; - obj_id = (*env)->GetIntField (env, obj, table->hash); - - if ((*env)->ExceptionOccurred (env) != NULL) - return NULL; - - return get_state_oid (env, table->clazz, table, obj_id); -} - -void * -remove_state_slot (JNIEnv *env, jobject obj, struct state_table *table) -{ - jint obj_id; - obj_id = (*env)->GetIntField (env, obj, table->hash); - - if ((*env)->ExceptionOccurred (env) != NULL) - return NULL; - - return remove_state_oid (env, table->clazz, table, obj_id); -} diff --git a/libjava/jni/classpath/native_state.h b/libjava/jni/classpath/native_state.h deleted file mode 100644 index 25ef6b546f1..00000000000 --- a/libjava/jni/classpath/native_state.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Magical NSA API -- Associate a C ptr with an instance of an object - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -#ifndef JCL_NATIVE_STATE -#define JCL_NATIVE_STATE - -#include <jni.h> - -struct state_table -{ - jint size; /* number of slots, should be prime */ - jfieldID hash; /* field containing System.identityHashCode(this) */ - jclass clazz; /* lock aquired for reading/writing nodes */ - struct state_node **head; -}; - -struct state_node -{ - jint key; - void *c_state; - struct state_node *next; -}; - -struct state_table * init_state_table_with_size (JNIEnv *, jclass, jint); -struct state_table * init_state_table (JNIEnv *, jclass); - -/* lowlevel api */ -void set_state_oid (JNIEnv *, jobject, struct state_table *, jint, void *); -void * get_state_oid (JNIEnv *, jobject, struct state_table *, jint); -void * remove_state_oid (JNIEnv *, jobject, struct state_table *, jint); - -/* highlevel api */ -int set_state (JNIEnv *, jobject, struct state_table *, void *); -void * get_state (JNIEnv *, jobject, struct state_table *); -void * remove_state_slot (JNIEnv *, jobject, struct state_table *); - -#endif diff --git a/libjava/jni/classpath/primlib.c b/libjava/jni/classpath/primlib.c deleted file mode 100644 index c7396e2a9a7..00000000000 --- a/libjava/jni/classpath/primlib.c +++ /dev/null @@ -1,463 +0,0 @@ -/* primlib.c - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -#include <jnilink.h> -#include <primlib.h> -#include <jcl.h> - -static jclass nativeWrapClass[PRIMLIB_NUMTYPES] = {NULL,NULL,NULL, NULL,NULL,NULL, - NULL,NULL,NULL, NULL,NULL,NULL}; - -static jclass nativeTypeClass[PRIMLIB_NUMTYPES] = {NULL,NULL,NULL, NULL,NULL,NULL, - NULL,NULL,NULL, NULL,NULL,NULL}; - -static jmethodID nativeWrapClassConstructor[PRIMLIB_NUMTYPES] = {NULL,NULL,NULL, NULL,NULL,NULL, - NULL,NULL,NULL, NULL,NULL,NULL}; - -static jmethodID nativeWrapClassAccessor[PRIMLIB_NUMTYPES] = {NULL,NULL,NULL, NULL,NULL,NULL, - NULL,NULL,NULL, NULL,NULL,NULL}; - -static char * nativeWrapClassName[PRIMLIB_NUMTYPES] = { - NULL, - NULL, - "java/lang/Boolean", - "java/lang/Byte", - "java/lang/Character", - "java/lang/Short", - "java/lang/Integer", - "java/lang/Long", - "java/lang/Float", - "java/lang/Double", - "java/lang/Void", - NULL - }; - -static char * nativeWrapClassConstructorSig[PRIMLIB_NUMTYPES] = { - NULL, - NULL, - "(Z)V", - "(B)V", - "(C)V", - "(S)V", - "(I)V", - "(J)V", - "(F)V", - "(D)V", - "()V", - NULL - }; - -static char * nativeWrapClassAccessorName[PRIMLIB_NUMTYPES] = { - NULL, - NULL, - "booleanValue", - "byteValue", - "charValue", - "shortValue", - "intValue", - "longValue", - "floatValue", - "doubleValue", - NULL, - NULL -}; - -static char * nativeWrapClassAccessorSig[PRIMLIB_NUMTYPES] = { - NULL, - NULL, - "()Z", - "()B", - "()C", - "()S", - "()I", - "()J", - "()F", - "()D", - NULL, - NULL -}; - - -JNIEXPORT jclass JNICALL PRIMLIB_GetNativeWrapClass(JNIEnv * env, int reflectType) { - return LINK_LinkClass(env,nativeWrapClass[reflectType],nativeWrapClassName[reflectType]); -} - -static jclass ActuallyGetNativeTypeClass(JNIEnv * env, int reflectType) { - jclass wrapClass; - jfieldID typeField; - - wrapClass = PRIMLIB_GetNativeWrapClass(env, reflectType); - if(wrapClass == NULL) - return NULL; - typeField = (*env)->GetStaticFieldID(env, wrapClass, "TYPE", "Ljava/lang/Class"); - if(typeField == NULL) - return NULL; - return (*env)->GetStaticObjectField(env, wrapClass, typeField); -} - -JNIEXPORT jclass JNICALL PRIMLIB_GetNativeTypeClass(JNIEnv * env, int reflectType) { - return LINK_LinkKnownClass(env, nativeTypeClass[reflectType], ActuallyGetNativeTypeClass(env,reflectType)); -} - -JNIEXPORT jmethodID JNICALL PRIMLIB_GetNativeWrapClassConstructor(JNIEnv * env, int reflectType) { - PRIMLIB_GetNativeWrapClass(env,reflectType); - return LINK_LinkConstructor(env, nativeWrapClassConstructor[reflectType], nativeWrapClass[reflectType], nativeWrapClassConstructorSig[reflectType]); -} - -JNIEXPORT jmethodID JNICALL PRIMLIB_GetNativeWrapClassAccessor(JNIEnv * env, int reflectType) { - PRIMLIB_GetNativeWrapClass(env,reflectType); - return LINK_LinkMethod(env, nativeWrapClassAccessor[reflectType], nativeWrapClass[reflectType], nativeWrapClassAccessorName[reflectType], nativeWrapClassAccessorSig[reflectType]); -} - - - -JNIEXPORT jobject JNICALL PRIMLIB_WrapBoolean(JNIEnv * env, jboolean b) { - jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_BOOLEAN); - JCL_RETHROW_EXCEPTION(env); - return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BOOLEAN), construct, b); -} - -JNIEXPORT jobject JNICALL PRIMLIB_WrapByte (JNIEnv * env, jbyte b) { - jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_BYTE); - JCL_RETHROW_EXCEPTION(env); - return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE), construct, b); -} - -JNIEXPORT jobject JNICALL PRIMLIB_WrapChar (JNIEnv * env, jchar c) { - jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_CHAR); - JCL_RETHROW_EXCEPTION(env); - return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR), construct, c); -} - -JNIEXPORT jobject JNICALL PRIMLIB_WrapShort (JNIEnv * env, jshort s) { - jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_SHORT); - JCL_RETHROW_EXCEPTION(env); - return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT), construct, s); -} - -JNIEXPORT jobject JNICALL PRIMLIB_WrapInt (JNIEnv * env, jint i) { - jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_INT); - JCL_RETHROW_EXCEPTION(env); - return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_INT), construct, i); -} - -JNIEXPORT jobject JNICALL PRIMLIB_WrapLong (JNIEnv * env, jlong l) { - jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_LONG); - JCL_RETHROW_EXCEPTION(env); - return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_LONG), construct, l); -} - -JNIEXPORT jobject JNICALL PRIMLIB_WrapFloat (JNIEnv * env, jfloat f) { - jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_FLOAT); - JCL_RETHROW_EXCEPTION(env); - return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_FLOAT), construct, f); -} - -JNIEXPORT jobject JNICALL PRIMLIB_WrapDouble (JNIEnv * env, jdouble d) { - jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_DOUBLE); - JCL_RETHROW_EXCEPTION(env); - return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_DOUBLE), construct, d); -} - - -JNIEXPORT jboolean JNICALL PRIMLIB_UnwrapBoolean(JNIEnv * env, jobject obj) { - if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BOOLEAN))) { - return PRIMLIB_GetBooleanObjectValue(env, obj); - } else { - JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type."); - return JNI_FALSE; - } -} - -JNIEXPORT jbyte JNICALL PRIMLIB_UnwrapByte(JNIEnv * env, jobject obj) { - if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE))) { - return PRIMLIB_GetByteObjectValue(env, obj); - } else { - JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type."); - return 0; - } -} - -JNIEXPORT jshort JNICALL PRIMLIB_UnwrapShort(JNIEnv * env, jobject obj) { - if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT))) { - return PRIMLIB_GetShortObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE))) { - return (jshort)PRIMLIB_GetByteObjectValue(env, obj); - } else { - JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type."); - return 0; - } -} - -JNIEXPORT jchar JNICALL PRIMLIB_UnwrapChar(JNIEnv * env, jobject obj) { - if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR))) { - return PRIMLIB_GetCharObjectValue(env, obj); - } else { - JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type."); - return 0; - } -} - -JNIEXPORT jint JNICALL PRIMLIB_UnwrapInt(JNIEnv * env, jobject obj) { - if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_INT))) { - return PRIMLIB_GetIntObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT))) { - return (jint)PRIMLIB_GetShortObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR))) { - return (jint)PRIMLIB_GetCharObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE))) { - return (jint)PRIMLIB_GetByteObjectValue(env, obj); - } else { - JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type."); - return 0; - } -} - -JNIEXPORT jlong JNICALL PRIMLIB_UnwrapLong(JNIEnv * env, jobject obj) { - if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_LONG))) { - return PRIMLIB_GetLongObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_INT))) { - return (jlong)PRIMLIB_GetIntObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT))) { - return (jlong)PRIMLIB_GetShortObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR))) { - return (jlong)PRIMLIB_GetCharObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE))) { - return (jlong)PRIMLIB_GetByteObjectValue(env, obj); - } else { - JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type."); - return 0; - } -} - -JNIEXPORT jfloat JNICALL PRIMLIB_UnwrapFloat(JNIEnv * env, jobject obj) { - if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_FLOAT))) { - return PRIMLIB_GetFloatObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_LONG))) { - return (jfloat)PRIMLIB_GetLongObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_INT))) { - return (jfloat)PRIMLIB_GetIntObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT))) { - return (jfloat)PRIMLIB_GetShortObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR))) { - return (jfloat)PRIMLIB_GetCharObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE))) { - return (jfloat)PRIMLIB_GetByteObjectValue(env, obj); - } else { - JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type."); - return 0; - } -} - -JNIEXPORT jdouble JNICALL PRIMLIB_UnwrapDouble(JNIEnv * env, jobject obj) { - if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_DOUBLE))) { - return PRIMLIB_GetDoubleObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_FLOAT))) { - return (jdouble)PRIMLIB_GetFloatObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_LONG))) { - return (jdouble)PRIMLIB_GetLongObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_INT))) { - return (jdouble)PRIMLIB_GetIntObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT))) { - return (jdouble)PRIMLIB_GetShortObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR))) { - return (jdouble)PRIMLIB_GetCharObjectValue(env, obj); - } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE))) { - return (jdouble)PRIMLIB_GetByteObjectValue(env, obj); - } else { - JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type."); - return 0; - } -} - -JNIEXPORT jint JNICALL PRIMLIB_GetReflectiveWrapperType(JNIEnv * env, jobject obj) { - jclass typeClass; - if(obj == NULL) { - return PRIMLIB_NULL; - } - - typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_DOUBLE); - if((*env)->IsInstanceOf(env, obj, typeClass)) { - return PRIMLIB_DOUBLE; - } - typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_FLOAT); - if((*env)->IsInstanceOf(env, obj, typeClass)) { - return PRIMLIB_FLOAT; - } - typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_LONG); - if((*env)->IsInstanceOf(env, obj, typeClass)) { - return PRIMLIB_LONG; - } - typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_INT); - if((*env)->IsInstanceOf(env, obj, typeClass)) { - return PRIMLIB_INT; - } - typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR); - if((*env)->IsInstanceOf(env, obj, typeClass)) { - return PRIMLIB_CHAR; - } - typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT); - if((*env)->IsInstanceOf(env, obj, typeClass)) { - return PRIMLIB_SHORT; - } - typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE); - if((*env)->IsInstanceOf(env, obj, typeClass)) { - return PRIMLIB_BYTE; - } - typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BOOLEAN); - if((*env)->IsInstanceOf(env, obj, typeClass)) { - return PRIMLIB_BOOLEAN; - } - typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_VOID); - if((*env)->IsInstanceOf(env, obj, typeClass)) { - return PRIMLIB_VOID; - } - return PRIMLIB_OBJECT; -} - -JNIEXPORT jint JNICALL PRIMLIB_GetReflectiveType(JNIEnv * env, jclass returnType) { - jclass typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_DOUBLE); - if((*env)->IsAssignableFrom(env, returnType, typeClass)) { - return PRIMLIB_DOUBLE; - } - typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_FLOAT); - if((*env)->IsAssignableFrom(env, returnType, typeClass)) { - return PRIMLIB_FLOAT; - } - typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_LONG); - if((*env)->IsAssignableFrom(env, returnType, typeClass)) { - return PRIMLIB_LONG; - } - typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_INT); - if((*env)->IsAssignableFrom(env, returnType, typeClass)) { - return PRIMLIB_INT; - } - typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_CHAR); - if((*env)->IsAssignableFrom(env, returnType, typeClass)) { - return PRIMLIB_CHAR; - } - typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_SHORT); - if((*env)->IsAssignableFrom(env, returnType, typeClass)) { - return PRIMLIB_SHORT; - } - typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_BYTE); - if((*env)->IsAssignableFrom(env, returnType, typeClass)) { - return PRIMLIB_BYTE; - } - typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_BOOLEAN); - if((*env)->IsAssignableFrom(env, returnType, typeClass)) { - return PRIMLIB_BOOLEAN; - } - typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_VOID); - if((*env)->IsAssignableFrom(env, returnType, typeClass)) { - return PRIMLIB_VOID; - } - return PRIMLIB_OBJECT; -} - - -JNIEXPORT jboolean JNICALL PRIMLIB_GetBooleanObjectValue(JNIEnv * env, jobject obj) { - jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_BOOLEAN); - return (*env)->CallBooleanMethod(env, obj, acc); -} - -JNIEXPORT jbyte JNICALL PRIMLIB_GetByteObjectValue(JNIEnv * env, jobject obj) { - jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_BYTE); - return (*env)->CallByteMethod(env, obj, acc); -} - -JNIEXPORT jshort JNICALL PRIMLIB_GetShortObjectValue(JNIEnv * env, jobject obj) { - jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_SHORT); - return (*env)->CallShortMethod(env, obj, acc); -} - -JNIEXPORT jchar JNICALL PRIMLIB_GetCharObjectValue(JNIEnv * env, jobject obj) { - jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_CHAR); - return (*env)->CallCharMethod(env, obj, acc); -} - -JNIEXPORT jint JNICALL PRIMLIB_GetIntObjectValue(JNIEnv * env, jobject obj) { - jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_INT); - return (*env)->CallIntMethod(env, obj, acc); -} - -JNIEXPORT jlong JNICALL PRIMLIB_GetLongObjectValue(JNIEnv * env, jobject obj) { - jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_LONG); - return (*env)->CallLongMethod(env, obj, acc); -} - -JNIEXPORT jfloat JNICALL PRIMLIB_GetFloatObjectValue(JNIEnv * env, jobject obj) { - jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_FLOAT); - return (*env)->CallFloatMethod(env, obj, acc); -} - -JNIEXPORT jdouble JNICALL PRIMLIB_GetDoubleObjectValue(JNIEnv * env, jobject obj) { - jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_DOUBLE); - return (*env)->CallDoubleMethod(env, obj, acc); -} - - - -JNIEXPORT jvalue JNICALL PRIMLIB_UnwrapJValue(JNIEnv* env, jobject obj, jclass classType) { - jvalue retval; - jint objType = PRIMLIB_GetReflectiveType(env, classType); - if(objType == PRIMLIB_BOOLEAN) { - retval.z = PRIMLIB_UnwrapBoolean(env,obj); - } else if(objType == PRIMLIB_BYTE) { - retval.b = PRIMLIB_UnwrapByte(env,obj); - } else if(objType == PRIMLIB_CHAR) { - retval.c = PRIMLIB_UnwrapChar(env,obj); - } else if(objType == PRIMLIB_SHORT) { - retval.s = PRIMLIB_UnwrapShort(env,obj); - } else if(objType == PRIMLIB_INT) { - retval.i = PRIMLIB_UnwrapInt(env,obj); - } else if(objType == PRIMLIB_LONG) { - retval.j = PRIMLIB_UnwrapLong(env,obj); - } else if(objType == PRIMLIB_FLOAT) { - retval.f = PRIMLIB_UnwrapFloat(env,obj); - } else if(objType == PRIMLIB_DOUBLE) { - retval.d = PRIMLIB_UnwrapDouble(env,obj); - } else { - if(obj != NULL && !(*env)->IsInstanceOf(env, obj, classType)) { - JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct object type."); - return retval; - } - retval.l = obj; - } - return retval; -} - diff --git a/libjava/jni/classpath/primlib.h b/libjava/jni/classpath/primlib.h deleted file mode 100644 index 12f3bae9185..00000000000 --- a/libjava/jni/classpath/primlib.h +++ /dev/null @@ -1,102 +0,0 @@ -/* primlib.h - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -#ifndef __PRIMLIB_H__ -#define __PRIMLIB_H__ - -#include <jni.h> - -#define PRIMLIB_UNKNOWN 0 -#define PRIMLIB_OBJECT 1 -#define PRIMLIB_BOOLEAN 2 -#define PRIMLIB_BYTE 3 -#define PRIMLIB_CHAR 4 -#define PRIMLIB_SHORT 5 -#define PRIMLIB_INT 6 -#define PRIMLIB_LONG 7 -#define PRIMLIB_FLOAT 8 -#define PRIMLIB_DOUBLE 9 -#define PRIMLIB_VOID 10 -#define PRIMLIB_NULL 11 -#define PRIMLIB_NUMTYPES 12 - -/* Low-level primitive class accessor functions. */ -JNIEXPORT jclass JNICALL PRIMLIB_GetNativeWrapClass(JNIEnv * env, int reflectType); -JNIEXPORT jclass JNICALL PRIMLIB_GetNativeTypeClass(JNIEnv * env, int reflectType); -JNIEXPORT jmethodID JNICALL PRIMLIB_GetNativeWrapClassConstructor(JNIEnv * env, int reflectType); -JNIEXPORT jmethodID JNICALL PRIMLIB_GetNativeWrapClassAccessor(JNIEnv * env, int reflectType); - -/* Type discovery functions: WrapperType finds out j.l.Boolean/Byte/etc., and - Type finds out j.l.Boolean.TYPE, etc. -*/ -JNIEXPORT jint JNICALL PRIMLIB_GetReflectiveWrapperType(JNIEnv * env, jobject obj); -JNIEXPORT jint JNICALL PRIMLIB_GetReflectiveType(JNIEnv * env, jclass returnType); - -/* Constructor functions. */ -JNIEXPORT jobject JNICALL PRIMLIB_WrapBoolean(JNIEnv * env, jboolean b); -JNIEXPORT jobject JNICALL PRIMLIB_WrapByte (JNIEnv * env, jbyte b); -JNIEXPORT jobject JNICALL PRIMLIB_WrapChar (JNIEnv * env, jchar c); -JNIEXPORT jobject JNICALL PRIMLIB_WrapShort (JNIEnv * env, jshort s); -JNIEXPORT jobject JNICALL PRIMLIB_WrapInt (JNIEnv * env, jint i); -JNIEXPORT jobject JNICALL PRIMLIB_WrapLong (JNIEnv * env, jlong l); -JNIEXPORT jobject JNICALL PRIMLIB_WrapFloat (JNIEnv * env, jfloat f); -JNIEXPORT jobject JNICALL PRIMLIB_WrapDouble (JNIEnv * env, jdouble d); - -/* Widening conversion unwrapping functions. */ -JNIEXPORT jboolean JNICALL PRIMLIB_UnwrapBoolean(JNIEnv * env, jobject obj); -JNIEXPORT jbyte JNICALL PRIMLIB_UnwrapByte (JNIEnv * env, jobject obj); -JNIEXPORT jshort JNICALL PRIMLIB_UnwrapShort (JNIEnv * env, jobject obj); -JNIEXPORT jchar JNICALL PRIMLIB_UnwrapChar (JNIEnv * env, jobject obj); -JNIEXPORT jint JNICALL PRIMLIB_UnwrapInt (JNIEnv * env, jobject obj); -JNIEXPORT jlong JNICALL PRIMLIB_UnwrapLong (JNIEnv * env, jobject obj); -JNIEXPORT jfloat JNICALL PRIMLIB_UnwrapFloat (JNIEnv * env, jobject obj); -JNIEXPORT jdouble JNICALL PRIMLIB_UnwrapDouble (JNIEnv * env, jobject obj); - -/* Simple unwrapping functions. Objects *must* be of correct type. */ -JNIEXPORT jboolean JNICALL PRIMLIB_GetBooleanObjectValue(JNIEnv * env, jobject obj); -JNIEXPORT jbyte JNICALL PRIMLIB_GetByteObjectValue (JNIEnv * env, jobject obj); -JNIEXPORT jshort JNICALL PRIMLIB_GetShortObjectValue (JNIEnv * env, jobject obj); -JNIEXPORT jchar JNICALL PRIMLIB_GetCharObjectValue (JNIEnv * env, jobject obj); -JNIEXPORT jint JNICALL PRIMLIB_GetIntObjectValue (JNIEnv * env, jobject obj); -JNIEXPORT jlong JNICALL PRIMLIB_GetLongObjectValue (JNIEnv * env, jobject obj); -JNIEXPORT jfloat JNICALL PRIMLIB_GetFloatObjectValue (JNIEnv * env, jobject obj); -JNIEXPORT jdouble JNICALL PRIMLIB_GetDoubleObjectValue (JNIEnv * env, jobject obj); - -/* jvalue conversion: Unwrap obj to the type of classType, with widening conversion. */ -JNIEXPORT jvalue JNICALL PRIMLIB_UnwrapJValue(JNIEnv* env, jobject obj, jclass classType); - -#endif diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c deleted file mode 100644 index 03c1e4925d7..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c +++ /dev/null @@ -1,102 +0,0 @@ -/* gdkfontmetrics.c - Copyright (C) 1999, 2003 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GdkFontMetrics.h" -#include <gdk/gdkx.h> - -#define ASCENT 0 -#define MAX_ASCENT 1 -#define DESCENT 2 -#define MAX_DESCENT 3 -#define MAX_ADVANCE 4 -#define NUM_METRICS 5 - -JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GdkFontMetrics_initState - (JNIEnv *env, jobject obj, jstring fname, jint size) -{ - jintArray array; - jint *metrics; - const char *cfname; - char *xlfd; - GdkFont *font; - XFontStruct *xfont; - - cfname = (*env)->GetStringUTFChars (env, fname, NULL); - xlfd = g_strdup_printf (cfname, (size * 10)); - (*env)->ReleaseStringUTFChars (env, fname, cfname); - - array = (*env)->NewIntArray (env, NUM_METRICS); - metrics = (*env)->GetIntArrayElements (env, array, NULL); - - gdk_threads_enter (); - font = gdk_font_load (xlfd); - xfont = GDK_FONT_XFONT (font); - - metrics[ASCENT] = font->ascent; - metrics[MAX_ASCENT] = xfont->max_bounds.ascent; - metrics[DESCENT] = font->descent; - metrics[MAX_DESCENT] = xfont->max_bounds.descent; - metrics[MAX_ADVANCE] = xfont->max_bounds.width; - gdk_threads_leave (); - - g_free (xlfd); - (*env)->ReleaseIntArrayElements (env, array, metrics, 0); - - NSA_SET_PTR (env, obj, font); - - return array; -} - -JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GdkFontMetrics_stringWidth - (JNIEnv *env, jobject obj, jstring str) -{ - GdkFont *font; - const char *cstr; - jint width; - - font = (GdkFont *) NSA_GET_PTR (env, obj); - cstr = (*env)->GetStringUTFChars (env, str, NULL); - - gdk_threads_enter (); - width = gdk_string_width (font, cstr); - gdk_threads_leave (); - - (*env)->ReleaseStringUTFChars (env, str, cstr); - - return width; -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c deleted file mode 100644 index 41e9db6b8fa..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c +++ /dev/null @@ -1,498 +0,0 @@ -/* gdkgraphics.c - Copyright (C) 1999, 2003 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GdkGraphics.h" -#include <gdk/gdkprivate.h> -#include <gdk/gdkx.h> - -#define GDK_STABLE_IS_PIXMAP(d) (((GdkWindowPrivate *)d)->window_type == GDK_WINDOW_PIXMAP) - -GdkPoint * -translate_points (JNIEnv *env, jintArray xpoints, jintArray ypoints, - jint npoints, jint x_offset, jint y_offset); - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyState - (JNIEnv *env, jobject obj, jobject old) -{ - struct graphics *g, *g_old; - - g = (struct graphics *) malloc (sizeof (struct graphics)); - g_old = (struct graphics *) NSA_GET_PTR (env, old); - - *g = *g_old; - - gdk_threads_enter (); - - g->gc = gdk_gc_new (g->drawable); - gdk_gc_copy (g->gc, g_old->gc); - - if (GDK_STABLE_IS_PIXMAP (g->drawable)) - gdk_pixmap_ref (g->drawable); - else /* GDK_IS_WINDOW (g->drawable) */ - gdk_window_ref (g->drawable); - - gdk_colormap_ref (g->cm); - - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, g); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II - (JNIEnv *env, jobject obj, jint width, jint height) -{ - struct graphics *g; - - g = (struct graphics *) malloc (sizeof (struct graphics)); - g->x_offset = g->y_offset = 0; - - gdk_threads_enter (); - g->drawable = (GdkDrawable *) gdk_pixmap_new (NULL, width, height, - gdk_rgb_get_visual ()->depth); - g->cm = gdk_rgb_get_cmap (); - gdk_colormap_ref (g->cm); - g->gc = gdk_gc_new (g->drawable); - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, g); -} - -/* copy the native state of the peer (GtkWidget *) to the native state - of the graphics object */ -JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2 - (JNIEnv *env, jobject obj, jobject peer) -{ - struct graphics *g = (struct graphics *) malloc (sizeof (struct graphics)); - void *ptr; - GtkWidget *widget; - GdkColor color; - jintArray array; - jint *rgb; - - ptr = NSA_GET_PTR (env, peer); - g->x_offset = g->y_offset = 0; - - gdk_threads_enter (); - - widget = GTK_WIDGET (ptr); - - if (GTK_IS_WINDOW (widget)) - { - g->drawable = find_gtk_layout (widget)->bin_window; - } - else if (GTK_IS_LAYOUT (widget)) - { - g->drawable = (GdkDrawable *) GTK_LAYOUT (widget)->bin_window; - } - else - { - g->drawable = (GdkDrawable *) widget->window; - } - - gdk_window_ref (g->drawable); - g->cm = gtk_widget_get_colormap (widget); - gdk_colormap_ref (g->cm); - g->gc = gdk_gc_new (g->drawable); - gdk_gc_copy (g->gc, widget->style->fg_gc[GTK_STATE_NORMAL]); - color = widget->style->fg[GTK_STATE_NORMAL]; - - gdk_threads_leave (); - - array = (*env)->NewIntArray (env, 3); - rgb = (*env)->GetIntArrayElements (env, array, NULL); - rgb[0] = color.red >> 8; - rgb[1] = color.green >> 8; - rgb[2] = color.blue >> 8; - (*env)->ReleaseIntArrayElements (env, array, rgb, 0); - - NSA_SET_PTR (env, obj, g); - - return array; -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_dispose - (JNIEnv *env, jobject obj) -{ - struct graphics *g; - - g = (struct graphics *) NSA_DEL_PTR (env, obj); - - if (!g) return; /* dispose has been called more than once */ - - gdk_threads_enter (); - XFlush (GDK_DISPLAY ()); - - gdk_gc_destroy (g->gc); - - if (GDK_STABLE_IS_PIXMAP (g->drawable)) - gdk_pixmap_unref (g->drawable); - else /* GDK_IS_WINDOW (g->drawable) */ - gdk_window_unref (g->drawable); - - gdk_colormap_unref (g->cm); - - gdk_threads_leave (); - - free (g); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_translateNative - (JNIEnv *env, jobject obj, jint x, jint y) -{ - struct graphics *g; - - g = (struct graphics *) NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - - g->x_offset += x; - g->y_offset += y; - - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawString - (JNIEnv *env, jobject obj, jstring str, jint x, jint y, - jstring fname, jint size) -{ - struct graphics *g; - const char *cfname, *cstr; - gchar *xlfd; - - g = (struct graphics *) NSA_GET_PTR (env, obj); - - cfname = (*env)->GetStringUTFChars (env, fname, NULL); - xlfd = g_strdup_printf (cfname, (size * 10)); - (*env)->ReleaseStringUTFChars (env, fname, cfname); - - cstr = (*env)->GetStringUTFChars (env, str, NULL); - - gdk_threads_enter (); - gdk_draw_string (g->drawable, gdk_font_load (xlfd), g->gc, - x + g->x_offset, y + g->y_offset, cstr); - gdk_threads_leave (); - - (*env)->ReleaseStringUTFChars (env, str, cstr); - g_free (xlfd); -} - - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawLine - (JNIEnv *env, jobject obj, jint x, jint y, jint x2, jint y2) -{ - struct graphics *g; - - g = (struct graphics *) NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gdk_draw_line (g->drawable, g->gc, - x + g->x_offset, y + g->y_offset, - x2 + g->x_offset, y2 + g->y_offset); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillRect - (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height) -{ - struct graphics *g; - - g = (struct graphics *) NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gdk_draw_rectangle (g->drawable, g->gc, TRUE, - x + g->x_offset, y + g->y_offset, width, height); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawRect - (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height) -{ - struct graphics *g; - - g = (struct graphics *) NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gdk_draw_rectangle (g->drawable, g->gc, FALSE, - x + g->x_offset, y + g->y_offset, width, height); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyArea - (JNIEnv *env, jobject obj, jint x, jint y, - jint width, jint height, jint dx, jint dy) -{ - struct graphics *g; - - g = (struct graphics *) NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gdk_window_copy_area ((GdkWindow *)g->drawable, - g->gc, - x + g->x_offset + dx, y + g->y_offset + dy, - (GdkWindow *)g->drawable, - x + g->x_offset, y + g->y_offset, - width, height); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyPixmap - (JNIEnv *env, jobject obj, jobject offscreen, - jint x, jint y, jint width, jint height) -{ - struct graphics *g1, *g2; - - g1 = (struct graphics *) NSA_GET_PTR (env, obj); - g2 = (struct graphics *) NSA_GET_PTR (env, offscreen); - - gdk_threads_enter (); - gdk_window_copy_area ((GdkWindow *)g1->drawable, - g1->gc, - x + g1->x_offset, y + g1->y_offset, - (GdkWindow *)g2->drawable, - 0 + g2->x_offset, 0 + g2->y_offset, - width, height); - gdk_threads_leave (); -} - - - - - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect - (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height) -{ - struct graphics *g; - - g = (struct graphics *) NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gdk_window_clear_area ((GdkWindow *)g->drawable, - x + g->x_offset, y + g->y_offset, width, height); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setFunction - (JNIEnv *env, jobject obj, jint func) -{ - struct graphics *g; - g = (struct graphics *) NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gdk_gc_set_function (g->gc, func); - gdk_threads_leave (); -} - - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setFGColor - (JNIEnv *env, jobject obj, jint red, jint green, jint blue) -{ - GdkColor color; - struct graphics *g; - - color.red = red << 8; - color.green = green << 8; - color.blue = blue << 8; - - g = (struct graphics *) NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gdk_color_alloc (g->cm, &color); - gdk_gc_set_foreground (g->gc, &color); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawArc - (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height, - jint angle1, jint angle2) -{ - struct graphics *g; - - g = (struct graphics *) NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gdk_draw_arc (g->drawable, g->gc, FALSE, - x + g->x_offset, y + g->y_offset, - width, height, angle1 << 6, angle2 << 6); - gdk_threads_leave (); -} - -GdkPoint * -translate_points (JNIEnv *env, jintArray xpoints, jintArray ypoints, - jint npoints, jint x_offset, jint y_offset) -{ - GdkPoint *points; - jint *x, *y; - int i; - - /* allocate one more point than necessary, in case we need to tack - on an extra due to the semantics of Java polygons. */ - points = g_malloc (sizeof (GdkPoint) * (npoints + 1)); - - x = (*env)->GetIntArrayElements (env, xpoints, NULL); - y = (*env)->GetIntArrayElements (env, ypoints, NULL); - - for (i = 0; i < npoints; i++) - { - points[i].x = x[i] + x_offset; - points[i].y = y[i] + y_offset; - } - - (*env)->ReleaseIntArrayElements (env, xpoints, x, JNI_ABORT); - (*env)->ReleaseIntArrayElements (env, ypoints, y, JNI_ABORT); - - return points; -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolyline - (JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints, - jint npoints) -{ - struct graphics *g; - GdkPoint *points; - - g = (struct graphics *) NSA_GET_PTR (env, obj); - points = translate_points (env, xpoints, ypoints, npoints, - g->x_offset, g->y_offset); - - gdk_threads_enter (); - gdk_draw_lines (g->drawable, g->gc, points, npoints); - gdk_threads_leave (); - - g_free (points); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolygon - (JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints, - jint npoints) -{ - struct graphics *g; - GdkPoint *points; - - g = (struct graphics *) NSA_GET_PTR (env, obj); - points = translate_points (env, xpoints, ypoints, npoints, - g->x_offset, g->y_offset); - - /* make sure the polygon is closed, per Java semantics. - if it's not, we close it. */ - if (points[0].x != points[npoints-1].x || points[0].y != points[npoints-1].y) - points[npoints++] = points[0]; - - gdk_threads_enter (); - gdk_draw_lines (g->drawable, g->gc, points, npoints); - gdk_threads_leave (); - - g_free (points); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillPolygon - (JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints, - jint npoints) -{ - struct graphics *g; - GdkPoint *points; - - g = (struct graphics *) NSA_GET_PTR (env, obj); - points = translate_points (env, xpoints, ypoints, npoints, - g->x_offset, g->y_offset); - gdk_threads_enter (); - gdk_draw_polygon (g->drawable, g->gc, TRUE, points, npoints); - gdk_threads_leave (); - - g_free (points); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillArc - (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height, - jint angle1, jint angle2) -{ - struct graphics *g; - - g = (struct graphics *) NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gdk_draw_arc (g->drawable, g->gc, TRUE, - x + g->x_offset, y + g->y_offset, - width, height, angle1 << 6, angle2 << 6); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawOval - (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height) -{ - struct graphics *g; - - g = (struct graphics *) NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gdk_draw_arc (g->drawable, g->gc, FALSE, - x + g->x_offset, y + g->y_offset, - width, height, 0, 23040); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillOval - (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height) -{ - struct graphics *g; - - g = (struct graphics *) NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gdk_draw_arc (g->drawable, g->gc, TRUE, - x + g->x_offset, y + g->y_offset, - width, height, 0, 23040); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setClipRectangle - (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height) -{ - struct graphics *g; - GdkRectangle rectangle; - - g = (struct graphics *) NSA_GET_PTR (env, obj); - - rectangle.x = x + g->x_offset; - rectangle.y = y + g->y_offset; - rectangle.width = width; - rectangle.height = height; - - gdk_threads_enter (); - gdk_gc_set_clip_rectangle (g->gc, &rectangle); - gdk_threads_leave (); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c deleted file mode 100644 index e33aff046fc..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c +++ /dev/null @@ -1,88 +0,0 @@ -/* gtkbuttonpeer.c -- Native implementation of GtkButtonPeer - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkButtonPeer.h" - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_create - (JNIEnv *env, jobject obj) -{ - gpointer widget; - - gdk_threads_enter (); - widget = gtk_type_new (gtk_button_get_type ()); - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, widget); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkSetFont - (JNIEnv *env, jobject obj, jstring jname, jint size) -{ - const char *xlfd; -# define FBUFSZ 200 - char buf[FBUFSZ]; - void *ptr; - GdkFont * new_font; - GtkStyle * style; - GtkWidget * button; - GtkWidget * label; - - ptr = NSA_GET_PTR (env, obj); - button = GTK_WIDGET (ptr); - label = GTK_BIN(button)->child; - - if (label == NULL) return; - xlfd = (*env)->GetStringUTFChars (env, jname, NULL); - snprintf(buf, FBUFSZ, xlfd, size); - (*env)->ReleaseStringUTFChars (env, jname, xlfd); - gdk_threads_enter(); - new_font = gdk_font_load (buf); /* FIXME: deprecated. Replacement? */ - if (new_font == NULL) - { - /* Fail quietly for now. */ - gdk_threads_leave(); - return; - } - style = gtk_style_copy (gtk_widget_get_style (label)); - style -> font = new_font; - gtk_widget_set_style (label, style); - /* FIXME: Documentation varies as to whether we should unref style. */ - gdk_threads_leave(); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c deleted file mode 100644 index cc7cfb8fd30..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c +++ /dev/null @@ -1,54 +0,0 @@ -/* gtkcanvaspeer.c -- Native implementation of GtkCanvasPeer - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkCanvasPeer.h" - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_create - (JNIEnv *env, jobject obj) -{ - gpointer widget; - - gdk_threads_enter (); - widget = gtk_type_new (gtk_drawing_area_get_type ()); - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, widget); -} - - diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c deleted file mode 100644 index 94b13666776..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c +++ /dev/null @@ -1,73 +0,0 @@ -/* gtkmenuitempeer.c -- Native implementation of GtkMenuItemPeer - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkMenuItemPeer.h" - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_create - (JNIEnv *env, jobject obj, jstring label) -{ - GtkWidget *widget; - const char *str; - - str = (*env)->GetStringUTFChars (env, label, NULL); - - gdk_threads_enter (); - widget = gtk_check_menu_item_new_with_label (str); - gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (widget), 1); - gtk_widget_show (widget); - gdk_threads_leave (); - - (*env)->ReleaseStringUTFChars (env, label, str); - - NSA_SET_PTR (env, obj, widget); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_setState - (JNIEnv *env, jobject obj, jboolean state) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (ptr), state); - gdk_threads_leave (); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c deleted file mode 100644 index 09fa7ef21b5..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c +++ /dev/null @@ -1,175 +0,0 @@ -/* gtkcheckboxpeer.c -- Native implementation of GtkCheckboxPeer - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkCheckboxPeer.h" -#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h" - -static void item_toggled (GtkToggleButton *item, jobject peer); - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_dispose - (JNIEnv *env, jobject obj) -{ - /* The actual underlying widget is owned by a different class. So - we just clean up the hash table here. */ - NSA_DEL_PTR (env, obj); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_remove - (JNIEnv *env, jobject obj, jobject checkbox) -{ - GtkRadioButton *button; - void *ptr; - GSList *list; - - ptr = NSA_GET_PTR (env, checkbox); - gdk_threads_enter (); - button = GTK_RADIO_BUTTON (ptr); - - /* Update the group to point to some other widget in the group. We - have to do this because Gtk doesn't have a separate object to - represent a radio button's group. */ - for (list = gtk_radio_button_group (button); list != NULL; - list = list->next) - { - if (list->data != button) - break; - } - - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, list ? list->data : NULL); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeCreate - (JNIEnv *env, jobject obj, jobject group) -{ - GtkWidget *button; - - gdk_threads_enter (); - - if (group == NULL) - button = gtk_check_button_new_with_label (""); - else - { - void *native_group = NSA_GET_PTR (env, group); - button = gtk_radio_button_new_with_label_from_widget (native_group, ""); - if (native_group == NULL) - { - /* Set the native group so we can use the correct value the - next time around. FIXME: this doesn't work! */ - NSA_SET_PTR (env, group, button); - } - } - - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, button); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_connectHooks - (JNIEnv *env, jobject obj) -{ - void *ptr = NSA_GET_PTR (env, obj); - jobject peer; - - gdk_threads_enter (); - - peer = (*env)->NewGlobalRef (env, obj); - - /* FIXME: when the widget goes away, we should get rid of the global - reference. */ - gtk_signal_connect (GTK_OBJECT (ptr), "toggled", - GTK_SIGNAL_FUNC (item_toggled), peer); - - gdk_threads_leave (); - - /* Connect the superclass hooks. */ - Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectHooks (env, obj); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeSetCheckboxGroup - (JNIEnv *env, jobject obj, jobject group) -{ - GtkRadioButton *button; - void *native_group, *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - - /* FIXME: we can't yet switch between a checkbutton and a - radiobutton. However, AWT requires this. For now we just - crash. */ - - button = GTK_RADIO_BUTTON (ptr); - - native_group = NSA_GET_PTR (env, group); - if (native_group == NULL) - gtk_radio_button_set_group (button, NULL); - else - gtk_radio_button_set_group (button, - gtk_radio_button_group - (GTK_RADIO_BUTTON (native_group))); - - gdk_threads_leave (); - - /* If the native group wasn't set on the new CheckboxGroup, then set - it now so that the right thing will happen with the next - radiobutton. The native state for a CheckboxGroup is a pointer - to one of the widgets in the group. We are careful to keep this - always pointing at a live widget; whenever a widget is destroyed - (or otherwise removed from the group), the CheckboxGroup peer is - notified. */ - if (native_group == NULL) - NSA_SET_PTR (env, group, native_group); -} - -static void -item_toggled (GtkToggleButton *item, jobject peer) -{ - (*gdk_env)->CallVoidMethod (gdk_env, peer, - postItemEventID, - peer, - item->active ? - (jint) AWT_ITEM_SELECTED : - (jint) AWT_ITEM_DESELECTED); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c deleted file mode 100644 index b3eee27f4c6..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c +++ /dev/null @@ -1,204 +0,0 @@ -/* gtkchoicepeer.c -- Native implementation of GtkChoicePeer - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkChoicePeer.h" - -static void connect_choice_item_selectable_hook (JNIEnv *env, - jobject peer_obj, - GtkItem *item, - jobject item_obj); -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkChoicePeer_create - (JNIEnv *env, jobject obj) -{ - GtkWidget *menu; - GtkOptionMenu *option_menu; - GtkRequisition child_requisition; - - gdk_threads_enter (); - option_menu = GTK_OPTION_MENU (gtk_option_menu_new ()); - menu = gtk_menu_new (); - gtk_widget_show (menu); - - gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu); - - gtk_widget_size_request (gtk_menu_item_new_with_label (""), - &child_requisition); - option_menu->width = child_requisition.width; - option_menu->height = child_requisition.height; - - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, option_menu); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkChoicePeer_append - (JNIEnv *env, jobject obj, jobjectArray items) -{ - gpointer ptr; - GtkMenu *menu; - jsize count, i; - int need_set_history = 0; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - menu = GTK_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (ptr))); - - if (!gtk_container_children (GTK_CONTAINER (menu))) - need_set_history = 1; - - count = (*env)->GetArrayLength (env, items); - - for (i = 0; i < count; i++) - { - jobject item; - const char *label; - GtkWidget *menuitem; - - item = (*env)->GetObjectArrayElement (env, items, i); - label = (*env)->GetStringUTFChars (env, item, NULL); - - menuitem = gtk_menu_item_new_with_label (label); - - (*env)->ReleaseStringUTFChars (env, item, label); - - gtk_menu_append (menu, menuitem); - gtk_widget_show (menuitem); - - connect_choice_item_selectable_hook (env, obj, - GTK_ITEM (menuitem), item); - } - - if (need_set_history) - gtk_option_menu_set_history (GTK_OPTION_MENU (ptr), 0); - - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkChoicePeer_add - (JNIEnv *env, jobject obj, jstring item, jint index) -{ - void *ptr; - const char *label; - GtkWidget *menu, *menuitem; - int need_set_history = 0; - - ptr = NSA_GET_PTR (env, obj); - - label = (*env)->GetStringUTFChars (env, item, 0); - - gdk_threads_enter (); - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (ptr)); - - if (!gtk_container_children (GTK_CONTAINER (menu))) - need_set_history = 1; - - menuitem = gtk_menu_item_new_with_label (label); - gtk_menu_insert (GTK_MENU (menu), menuitem, index); - gtk_widget_show (menuitem); - connect_choice_item_selectable_hook (env, obj, GTK_ITEM (menuitem), item); - - if (need_set_history) - gtk_option_menu_set_history (GTK_OPTION_MENU (ptr), 0); - - gdk_threads_leave (); - - (*env)->ReleaseStringUTFChars (env, item, label); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkChoicePeer_remove - (JNIEnv *env, jobject obj, jint index) -{ - void *ptr; - GtkContainer *menu; - GList *children; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - menu = GTK_CONTAINER (gtk_option_menu_get_menu (GTK_OPTION_MENU (ptr))); - children = gtk_container_children (menu); - gtk_container_remove (menu, GTK_WIDGET (g_list_nth (children, index)->data)); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkChoicePeer_select - (JNIEnv *env, jobject obj, jint index) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gtk_option_menu_set_history (GTK_OPTION_MENU (ptr), index); - gdk_threads_leave (); -} - - -static void -item_activate (GtkItem *item, struct item_event_hook_info *ie) -{ - gdk_threads_leave (); - (*gdk_env)->CallVoidMethod (gdk_env, ie->peer_obj, - postItemEventID, - ie->item_obj, - (jint) AWT_ITEM_SELECTED); - gdk_threads_enter (); -} - -static void -connect_choice_item_selectable_hook (JNIEnv *env, jobject peer_obj, - GtkItem *item, jobject item_obj) -{ - struct item_event_hook_info *ie; - - ie = (struct item_event_hook_info *) - malloc (sizeof (struct item_event_hook_info)); - - ie->peer_obj = (*env)->NewGlobalRef (env, peer_obj); - ie->item_obj = (*env)->NewGlobalRef (env, item_obj); - - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (item_activate), ie); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c deleted file mode 100644 index 7c6beecf1b1..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c +++ /dev/null @@ -1,180 +0,0 @@ -/* gtkclipboard.c - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkClipboard.h" - -jmethodID stringSelectionReceivedID; -jmethodID stringSelectionHandlerID; -jmethodID selectionClearID; - -void selection_received (GtkWidget *, GtkSelectionData *, guint, gpointer); -void selection_get (GtkWidget *, GtkSelectionData *, guint, guint, gpointer); -gint selection_clear (GtkWidget *, GdkEventSelection *); - -GtkWidget *clipboard; -jobject cb_obj; - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkClipboard_initNativeState (JNIEnv *env, - jobject obj) -{ - if (!stringSelectionReceivedID) - { - jclass gtkclipboard; - - gtkclipboard = (*env)->FindClass (env, - "gnu/java/awt/peer/gtk/GtkClipboard"); - stringSelectionReceivedID = (*env)->GetMethodID (env, gtkclipboard, - "stringSelectionReceived", - "(Ljava/lang/String;)V"); - stringSelectionHandlerID = (*env)->GetMethodID (env, gtkclipboard, - "stringSelectionHandler", - "()Ljava/lang/String;"); - selectionClearID = (*env)->GetMethodID (env, gtkclipboard, - "selectionClear", "()V"); - } - - cb_obj = (*env)->NewGlobalRef (env, obj); - - gdk_threads_enter (); - clipboard = gtk_window_new (GTK_WINDOW_TOPLEVEL); - - gtk_signal_connect (GTK_OBJECT(clipboard), "selection_received", - GTK_SIGNAL_FUNC (selection_received), NULL); - - gtk_signal_connect (GTK_OBJECT(clipboard), "selection_clear_event", - GTK_SIGNAL_FUNC (selection_clear), NULL); - - gtk_selection_add_target (clipboard, GDK_SELECTION_PRIMARY, - GDK_TARGET_STRING, GDK_TARGET_STRING); - - gtk_signal_connect (GTK_OBJECT(clipboard), "selection_get", - GTK_SIGNAL_FUNC (selection_get), NULL); - - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkClipboard_requestStringConversion (JNIEnv *env, - jclass clazz) -{ - gdk_threads_enter (); - gtk_selection_convert (clipboard, GDK_SELECTION_PRIMARY, - GDK_TARGET_STRING, GDK_CURRENT_TIME); - gdk_threads_leave (); -} - -void -selection_received (GtkWidget *widget, GtkSelectionData *selection_data, - guint time, gpointer data) -{ - /* Check to see if retrieval succeeded */ - if (selection_data->length < 0 - || selection_data->type != GDK_SELECTION_TYPE_STRING) - { - (*gdk_env)->CallVoidMethod (gdk_env, cb_obj, stringSelectionReceivedID, - NULL); - } - else - { - char *str = (char *) selection_data->data; - - (*gdk_env)->CallVoidMethod (gdk_env, cb_obj, stringSelectionReceivedID, - (*gdk_env)->NewStringUTF (gdk_env, str)); - } - - return; -} - -void -selection_get (GtkWidget *widget, - GtkSelectionData *selection_data, - guint info, - guint time, - gpointer data) -{ - jstring jstr; - const char *utf; - jsize utflen; - - jstr = (*gdk_env)->CallObjectMethod (gdk_env, cb_obj, - stringSelectionHandlerID); - - if (!jstr) - { - gtk_selection_data_set (selection_data, - GDK_TARGET_STRING, 8, NULL, 0); - return; - } - - utflen = (*gdk_env)->GetStringUTFLength (gdk_env, jstr); - utf = (*gdk_env)->GetStringUTFChars (gdk_env, jstr, NULL); - - gtk_selection_data_set (selection_data, GDK_TARGET_STRING, 8, - (char *)utf, utflen); - - (*gdk_env)->ReleaseStringUTFChars (gdk_env, jstr, utf); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkClipboard_selectionGet (JNIEnv *env, - jclass clazz) -{ - GdkWindow *owner; - - gdk_threads_enter (); - - /* if we already own the clipboard, we need to tell the old data object - that we're no longer going to be using him */ - owner = gdk_selection_owner_get (GDK_SELECTION_PRIMARY); - if (owner && owner == clipboard->window) - (*env)->CallVoidMethod (env, cb_obj, selectionClearID); - - gtk_selection_owner_set (clipboard, GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME); - - gdk_threads_leave (); -} - -gint -selection_clear (GtkWidget *widget, GdkEventSelection *event) -{ - (*gdk_env)->CallVoidMethod (gdk_env, cb_obj, selectionClearID); - - return TRUE; -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c deleted file mode 100644 index 5522354e35d..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c +++ /dev/null @@ -1,649 +0,0 @@ -/* gtkcomponentpeer.c -- Native implementation of GtkComponentPeer - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h" -#include <gtk/gtkprivate.h> - -#define GTK_OBJECT_SETV(ptr, arg) \ - gdk_threads_enter (); \ - { \ - GtkArgInfo *info = NULL; \ - char *error; \ - \ - error = gtk_object_arg_get_info (GTK_OBJECT_TYPE (ptr), arg.name, &info); \ - if (error) \ - { \ - /* assume the argument is destined for the container's only child */ \ - ptr = gtk_container_children (GTK_CONTAINER (ptr))->data; \ - } \ - gtk_object_setv (GTK_OBJECT (ptr), 1, &arg); \ - } \ - gdk_threads_leave (); \ - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose - (JNIEnv *env, jobject obj) -{ - void *ptr; - - ptr = NSA_DEL_PTR (env, obj); - - /* For now the native state for any object must be a widget. - However, a subclass could override dispose() if required. */ - gdk_threads_enter (); - gtk_widget_destroy (GTK_WIDGET (ptr)); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursor - (JNIEnv *env, jobject obj, jint type) -{ - void *ptr; - GtkWidget *widget; - GdkCursorType gdk_cursor_type; - GdkCursor *gdk_cursor; - - ptr = NSA_GET_PTR (env, obj); - - switch (type) - { - case AWT_CROSSHAIR_CURSOR: - gdk_cursor_type = GDK_CROSSHAIR; - break; - case AWT_TEXT_CURSOR: - gdk_cursor_type = GDK_XTERM; - break; - case AWT_WAIT_CURSOR: - gdk_cursor_type = GDK_WATCH; - break; - case AWT_SW_RESIZE_CURSOR: - gdk_cursor_type = GDK_BOTTOM_LEFT_CORNER; - break; - case AWT_SE_RESIZE_CURSOR: - gdk_cursor_type = GDK_BOTTOM_RIGHT_CORNER; - break; - case AWT_NW_RESIZE_CURSOR: - gdk_cursor_type = GDK_TOP_LEFT_CORNER; - break; - case AWT_NE_RESIZE_CURSOR: - gdk_cursor_type = GDK_TOP_RIGHT_CORNER; - break; - case AWT_N_RESIZE_CURSOR: - gdk_cursor_type = GDK_TOP_SIDE; - break; - case AWT_S_RESIZE_CURSOR: - gdk_cursor_type = GDK_BOTTOM_SIDE; - break; - case AWT_W_RESIZE_CURSOR: - gdk_cursor_type = GDK_LEFT_SIDE; - break; - case AWT_E_RESIZE_CURSOR: - gdk_cursor_type = GDK_RIGHT_SIDE; - break; - case AWT_HAND_CURSOR: - gdk_cursor_type = GDK_HAND2; - break; - case AWT_MOVE_CURSOR: - gdk_cursor_type = GDK_FLEUR; - break; - default: - gdk_cursor_type = GDK_LEFT_PTR; - } - - gdk_threads_enter (); - - widget = GTK_WIDGET(ptr); - - gdk_cursor = gdk_cursor_new (gdk_cursor_type); - gdk_window_set_cursor (widget->window, gdk_cursor); - gdk_cursor_destroy (gdk_cursor); - - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_requestFocus - (JNIEnv *env, jobject obj) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gtk_widget_grab_focus (GTK_WIDGET (ptr)); - gdk_threads_leave (); -} - - -/* - * Show a widget (NO LONGER USED) - */ -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setVisible - (JNIEnv *env, jobject obj, jboolean visible) -{ - GtkWidget *widget; - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - widget = GTK_WIDGET (ptr); - - if (visible) - gtk_widget_show (widget); - else - gtk_widget_hide (widget); - - gdk_flush (); - gdk_threads_leave (); -} - -/* - * Find the origin of a widget's window. - */ -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetLocationOnScreen - (JNIEnv * env, jobject obj, jintArray jpoint) -{ - void *ptr; - jint *point; - - ptr = NSA_GET_PTR (env, obj); - point = (*env)->GetIntArrayElements (env, jpoint, 0); - - gdk_threads_enter (); - gdk_window_get_origin (GTK_WIDGET (ptr)->window, point, point+1); - gdk_threads_leave (); - - (*env)->ReleaseIntArrayElements(env, jpoint, point, 0); -} - -/* - * Find the preferred size of a widget. - */ -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetDimensions - (JNIEnv *env, jobject obj, jintArray jdims) -{ - void *ptr; - jint *dims; - GtkRequisition req; - - ptr = NSA_GET_PTR (env, obj); - dims = (*env)->GetIntArrayElements (env, jdims, 0); - - gdk_threads_enter (); - - gtk_signal_emit_by_name (GTK_OBJECT (ptr), "size_request", &req); - - dims[0] = req.width; - dims[1] = req.height; - - gdk_threads_leave (); - - (*env)->ReleaseIntArrayElements(env, jdims, dims, 0); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetUsize (JNIEnv *env, - jobject obj, jint w, jint h) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gtk_widget_set_usize (GTK_WIDGET (ptr), w, h); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkFixedNew (JNIEnv *env, - jobject obj, jint width, jint height, jboolean visible) -{ - GtkWidget *layout; - - gdk_threads_enter (); - layout = gtk_layout_new (NULL, NULL); - gtk_widget_realize (layout); - connect_awt_hook (env, obj, 1, GTK_LAYOUT (layout)->bin_window); - set_visible (layout, visible); - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, layout); -} - -/* - * Place a widget on the layout widget. - */ -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkFixedPut - (JNIEnv *env, jobject obj, jobject container, jint x, jint y) -{ - GList *child; - GtkWidget *fix; - void *containerptr=NULL; - void *objptr=NULL; - - /* We hawe a container which, if it is a window, will have - this component added to its fixed. If it is a fixed, we add the - component to it. */ - - containerptr=NSA_GET_PTR (env, container); - objptr=NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - if (GTK_IS_WINDOW(GTK_OBJECT(containerptr))) - { - child=gtk_container_children (GTK_CONTAINER(containerptr)); - - while (child && !GTK_IS_FIXED(child->data)) - { - child=g_list_next(child); - } - - fix=GTK_WIDGET(child->data); - g_list_free(child); - } - else - if (GTK_IS_SCROLLED_WINDOW(GTK_OBJECT(containerptr))) - { - child=gtk_container_children (GTK_CONTAINER (GTK_BIN(containerptr)->child)); - - while (child && !GTK_IS_FIXED(child->data)) - { - child=g_list_next(child); - } - - fix=GTK_WIDGET(child->data); - - g_list_free(child); - } - else - { - fix=GTK_WIDGET(containerptr); - } - - gtk_fixed_put(GTK_FIXED(fix),GTK_WIDGET(objptr),x,y); - gtk_widget_realize (GTK_WIDGET (objptr)); - gtk_widget_show (GTK_WIDGET (objptr)); - - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkFixedMove (JNIEnv *env, - jobject obj, jint x, jint y) -{ - GtkWidget *widget; - void *ptr=NULL; - - /* For some reason, ScrolledWindow tries to scroll its contents - by moving them using this function. Since we want to use GTK's - nice fast scrolling, we try to second guess it here. This - might cause problems later. */ - - if (x >= 0 && y >= 0) - { - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - widget=GTK_WIDGET (ptr); - if (!GTK_IS_WINDOW (widget)) - gtk_fixed_move (GTK_FIXED (widget->parent), widget, x, y); - gdk_threads_leave (); - } -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setNativeBounds - (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height) -{ - GtkWidget *widget; - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - - widget = GTK_WIDGET (ptr); - if (GTK_IS_VIEWPORT (widget->parent)) - { - gtk_widget_set_usize (widget, width, height); - } - else - { - gtk_widget_set_usize (widget, width, height); - gtk_layout_move (GTK_LAYOUT (widget->parent), widget, x, y); - } - - gdk_threads_leave (); -} - -JNIEXPORT jintArray JNICALL -Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetBackground - (JNIEnv *env, jobject obj) -{ - void *ptr; - jintArray array; - int *rgb; - GdkColor bg; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - bg = GTK_WIDGET (ptr)->style->bg[GTK_STATE_NORMAL]; - gdk_threads_leave (); - - array = (*env)->NewIntArray (env, 3); - rgb = (*env)->GetIntArrayElements (env, array, NULL); - /* convert color data from 16 bit values down to 8 bit values */ - rgb[0] = bg.red >> 8; - rgb[1] = bg.green >> 8; - rgb[2] = bg.blue >> 8; - (*env)->ReleaseIntArrayElements (env, array, rgb, 0); - - return array; -} - -JNIEXPORT jintArray JNICALL -Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetForeground - (JNIEnv *env, jobject obj) -{ - void *ptr; - jintArray array; - jint *rgb; - GdkColor fg; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - fg = GTK_WIDGET (ptr)->style->fg[GTK_STATE_NORMAL]; - gdk_threads_leave (); - - array = (*env)->NewIntArray (env, 3); - rgb = (*env)->GetIntArrayElements (env, array, NULL); - /* convert color data from 16 bit values down to 8 bit values */ - rgb[0] = fg.red >> 8; - rgb[1] = fg.green >> 8; - rgb[2] = fg.blue >> 8; - (*env)->ReleaseIntArrayElements (env, array, rgb, 0); - - return array; -} - -void -set_visible (GtkWidget *widget, jboolean visible) -{ - if (visible) - gtk_widget_show (widget); - else - gtk_widget_hide (widget); -} - -GtkLayout * -find_gtk_layout (GtkWidget *parent) -{ - if (GTK_IS_WINDOW (parent)) - { - GList *children = gtk_container_children - (GTK_CONTAINER (GTK_BIN (parent)->child)); - - if (GTK_IS_MENU_BAR (children->data)) - return GTK_LAYOUT (children->next->data); - else /* GTK_IS_LAYOUT (children->data) */ - return GTK_LAYOUT (children->data); - } - - return NULL; -} - -#define WIDGET_CLASS(w) GTK_WIDGET_CLASS (GTK_OBJECT (w)->klass) - -void -set_parent (GtkWidget *widget, GtkContainer *parent) -{ - if (GTK_IS_WINDOW (parent)) - { - GList *children = gtk_container_children - (GTK_CONTAINER (GTK_BIN (parent)->child)); - - if (GTK_IS_MENU_BAR (children->data)) - gtk_layout_put (GTK_LAYOUT (children->next->data), widget, 0, 0); - else /* GTK_IS_LAYOUT (children->data) */ - gtk_layout_put (GTK_LAYOUT (children->data), widget, 0, 0); - } - else - if (GTK_IS_SCROLLED_WINDOW (parent)) - { -/* if (WIDGET_CLASS (widget)->set_scroll_adjustments_signal) */ -/* gtk_container_add (GTK_CONTAINER (parent), widget); */ -/* else */ -/* { */ - gtk_scrolled_window_add_with_viewport - (GTK_SCROLLED_WINDOW (parent), widget); - gtk_viewport_set_shadow_type (GTK_VIEWPORT (widget->parent), - GTK_SHADOW_NONE); -/* } */ - - } -/* gtk_layout_put */ -/* (GTK_LAYOUT (GTK_BIN (parent)->child), widget, 0, 0); */ - -/* if (GTK_IS_SCROLLED_WINDOW (parent)) */ -/* gtk_layout_put */ -/* (GTK_LAYOUT (GTK_BIN (GTK_BIN (parent)->child)->child), widget, 0, 0); */ - else - gtk_layout_put (GTK_LAYOUT (parent), widget, 0, 0); -} - -JNIEXPORT jboolean JNICALL -Java_gnu_java_awt_peer_gtk_GtkComponentPeer_isEnabled - (JNIEnv *env, jobject obj) -{ - void *ptr; - jboolean ret_val; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - ret_val = GTK_WIDGET_IS_SENSITIVE (GTK_WIDGET (ptr)); - gdk_threads_leave (); - - return ret_val; -} - -JNIEXPORT jboolean JNICALL -Java_gnu_java_awt_peer_gtk_GtkComponentPeer_modalHasGrab - (JNIEnv *env, jclass clazz) -{ - GtkWidget *widget; - jboolean retval; - - gdk_threads_enter (); - widget = gtk_grab_get_current (); - retval = (widget && GTK_IS_WINDOW (widget) && GTK_WINDOW (widget)->modal); - gdk_threads_leave (); - - return retval; -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Ljava_lang_String_2 - (JNIEnv *env, jobject obj, jstring jname, jstring jvalue) -{ - const char *name; - const char *value; - void *ptr; - GtkArg arg; - - ptr = NSA_GET_PTR (env, obj); - name = (*env)->GetStringUTFChars (env, jname, NULL); - value = (*env)->GetStringUTFChars (env, jvalue, NULL); - - arg.type = GTK_TYPE_STRING; - arg.name = (char *) name; - GTK_VALUE_STRING (arg) = (char *) value; - - GTK_OBJECT_SETV (ptr, arg); - - (*env)->ReleaseStringUTFChars (env, jname, name); - (*env)->ReleaseStringUTFChars (env, jvalue, value); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Z - (JNIEnv *env, jobject obj, jstring jname, jboolean value) -{ - const char *name; - void *ptr; - GtkArg arg; - - ptr = NSA_GET_PTR (env, obj); - name = (*env)->GetStringUTFChars (env, jname, NULL); - - arg.type = GTK_TYPE_BOOL; - arg.name = (char *) name; - GTK_VALUE_BOOL (arg) = value; - - GTK_OBJECT_SETV (ptr, arg); - - (*env)->ReleaseStringUTFChars (env, jname, name); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2I - (JNIEnv *env, jobject obj, jstring jname, jint value) -{ - const char *name; - void *ptr; - GtkArg arg; - - ptr = NSA_GET_PTR (env, obj); - name = (*env)->GetStringUTFChars (env, jname, NULL); - - arg.type = GTK_TYPE_INT; - arg.name = (char *) name; - GTK_VALUE_INT (arg) = value; - - GTK_OBJECT_SETV (ptr, arg); - - (*env)->ReleaseStringUTFChars (env, jname, name); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2F - (JNIEnv *env, jobject obj, jstring jname, jfloat value) -{ - const char *name; - void *ptr; - GtkArg arg; - - ptr = NSA_GET_PTR (env, obj); - name = (*env)->GetStringUTFChars (env, jname, NULL); - - arg.type = GTK_TYPE_FLOAT; - arg.name = (char *) name; - GTK_VALUE_FLOAT (arg) = value; - - GTK_OBJECT_SETV (ptr, arg); - - (*env)->ReleaseStringUTFChars (env, jname, name); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Ljava_lang_Object_2 - (JNIEnv *env, jobject obj1, jstring jname, jobject obj2) -{ - const char *name; - void *ptr1, *ptr2; - GtkArg arg; - - ptr1 = NSA_GET_PTR (env, obj1); - ptr2 = NSA_GET_PTR (env, obj2); - - name = (*env)->GetStringUTFChars (env, jname, NULL); - - /* special case to catch where we need to set the parent */ - if (!strcmp (name, "parent")) - { - gdk_threads_enter (); - set_parent (GTK_WIDGET (ptr1), GTK_CONTAINER (ptr2)); - gdk_threads_leave (); - - (*env)->ReleaseStringUTFChars (env, jname, name); - return; - } - - arg.type = GTK_TYPE_OBJECT; - arg.name = (char *) name; - GTK_VALUE_OBJECT (arg) = GTK_OBJECT (ptr2); - - GTK_OBJECT_SETV (ptr1, arg); - - (*env)->ReleaseStringUTFChars (env, jname, name); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_create - (JNIEnv *env, jobject obj, jstring jtypename) -{ - const char *typename; - gpointer widget; - - typename = (*env)->GetStringUTFChars (env, jtypename, NULL); - - gdk_threads_enter (); - gtk_button_get_type (); - widget = gtk_object_newv (gtk_type_from_name (typename), - 0, NULL); -/* widget = gtk_type_new (gtk_type_from_name (typename)); */ - gdk_threads_leave (); - - (*env)->ReleaseStringUTFChars (env, jtypename, typename); - NSA_SET_PTR (env, obj, widget); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectHooks - (JNIEnv *env, jobject obj) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gtk_widget_realize (GTK_WIDGET (ptr)); - connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window); - gdk_threads_leave (); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c deleted file mode 100644 index 99ca0934c3d..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c +++ /dev/null @@ -1,552 +0,0 @@ -/* gtkevents.c -- GDK/GTK event handlers - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include <X11/Xlib.h> -#include <gdk/gdkkeysyms.h> -#include <stdarg.h> -#include <assert.h> - -/* A widget can be composed of multipled windows, so we need to hook - events on all of them. */ -struct event_hook_info -{ - jobject *peer_obj; - int nwindows; - GdkWindow ***windows; /* array of pointers to (GdkWindow *) */ -}; - -static jint -button_to_awt_mods (int button) -{ - switch (button) - { - case 1: - return AWT_BUTTON1_MASK; - case 2: - return AWT_BUTTON2_MASK; - case 3: - return AWT_BUTTON3_MASK; - } - - return 0; -} - -static jint -state_to_awt_mods (int mods) -{ - jint result = 0; - - if (mods & (GDK_SHIFT_MASK | GDK_LOCK_MASK)) - result |= AWT_SHIFT_MASK; - if (mods & GDK_CONTROL_MASK) - result |= AWT_CTRL_MASK; - - return result; -} - -#ifdef __GNUC__ -__inline -#endif -static jint -keysym_to_awt_keycode (guint keyval) -{ - guint vk; - - vk = gdk_keyval_to_upper (keyval); - - if (vk <= 0x41 && vk <= 0x5A) /* VK_A through VK_Z */ - return vk; - - if (vk <= 0x30 && vk <= 39) /* VK_0 through VK_9 */ - return vk; - - switch (vk) - { - case GDK_Alt_L: - case GDK_Alt_R: - return VK_ALT; - case GDK_BackSpace: - return VK_BACK_SPACE; - case GDK_Cancel: - return VK_CANCEL; - case GDK_Caps_Lock: - return VK_CAPS_LOCK; - case GDK_Clear: - return VK_CLEAR; - case GDK_bracketright: - return VK_CLOSE_BRACKET; - case GDK_comma: - return VK_COMMA; - case GDK_Control_L: - case GDK_Control_R: - return VK_CONTROL; - case GDK_KP_Decimal: - return VK_DECIMAL; - case GDK_Delete: - return VK_DELETE; - case GDK_KP_Divide: - return VK_DIVIDE; - case GDK_Down: - return VK_DOWN; - case GDK_End: - return VK_END; - case GDK_Return: - return VK_ENTER; - case GDK_Escape: - return VK_ESCAPE; - case GDK_F1: - return VK_F1; - case GDK_F2: - return VK_F2; - case GDK_F3: - return VK_F3; - case GDK_F4: - return VK_F4; - case GDK_F5: - return VK_F5; - case GDK_F6: - return VK_F6; - case GDK_F7: - return VK_F7; - case GDK_F8: - return VK_F8; - case GDK_F9: - return VK_F9; - case GDK_F10: - return VK_F10; - case GDK_F11: - return VK_F11; - case GDK_F12: - return VK_F12; - case GDK_Help: - return VK_HELP; - case GDK_Home: - return VK_HOME; - case GDK_Insert: - return VK_INSERT; - case GDK_Kanji: - return VK_KANJI; - case GDK_Left: - return VK_LEFT; - case GDK_Meta_L: - case GDK_Meta_R: - return VK_META; - case GDK_KP_Multiply: - return VK_MULTIPLY; - case GDK_Num_Lock: - return VK_NUM_LOCK; - case GDK_KP_0: - return VK_NUMPAD0; - case GDK_KP_1: - return VK_NUMPAD1; - case GDK_KP_2: - return VK_NUMPAD2; - case GDK_KP_3: - return VK_NUMPAD3; - case GDK_KP_4: - return VK_NUMPAD4; - case GDK_KP_5: - return VK_NUMPAD5; - case GDK_KP_6: - return VK_NUMPAD6; - case GDK_KP_7: - return VK_NUMPAD7; - case GDK_KP_8: - return VK_NUMPAD8; - case GDK_KP_9: - return VK_NUMPAD9; - case GDK_bracketleft: - return VK_OPEN_BRACKET; - case GDK_Page_Down: - return VK_PAGE_DOWN; - case GDK_Page_Up: - return VK_PAGE_UP; - case GDK_Pause: - return VK_PAUSE; - case GDK_period: - return VK_PERIOD; - case GDK_Print: - return VK_PRINTSCREEN; - case GDK_quoteright: - return VK_QUOTE; - case GDK_Right: - return VK_RIGHT; - case GDK_Scroll_Lock: - return VK_SCROLL_LOCK; - case GDK_semicolon: - return VK_SEMICOLON; - case GDK_KP_Separator: - return VK_SEPARATOR; - case GDK_Shift_L: - case GDK_Shift_R: - return VK_SHIFT; - case GDK_slash: - return VK_SLASH; - case GDK_space: - return VK_SPACE; - case GDK_KP_Subtract: - return VK_SUBTRACT; - case GDK_Tab: - return VK_TAB; - case GDK_Up: - return VK_UP; - - default: - return VK_UNDEFINED; - } -} - -void -awt_event_handler (GdkEvent *event) -{ - jobject *obj_ptr; - static guint32 button_click_time = 0; - static GdkWindow *button_window = NULL; - static guint button_number = -1; - static jint click_count = 1; - - /* keep synthetic AWT events from being processed recursively */ - if (event->type & SYNTHETIC_EVENT_MASK && event->type != GDK_NOTHING) - { - event->type ^= SYNTHETIC_EVENT_MASK; - gtk_main_do_event (event); - return; - } - - /* keep track of clickCount ourselves, since the AWT allows more - than a triple click to occur */ - if (event->type == GDK_BUTTON_PRESS) - { - if ((event->button.time < (button_click_time + MULTI_CLICK_TIME)) - && (event->button.window == button_window) - && (event->button.button == button_number)) - click_count++; - else - click_count = 1; - - button_click_time = event->button.time; - button_window = event->button.window; - button_number = event->button.button; - } - - /* for all input events, which have a window with a jobject attached, - send the input event off to Java before GTK has a chance to process - the event */ - if ((event->type == GDK_BUTTON_PRESS - || event->type == GDK_BUTTON_RELEASE - || event->type == GDK_ENTER_NOTIFY - || event->type == GDK_LEAVE_NOTIFY - || event->type == GDK_CONFIGURE - || event->type == GDK_EXPOSE - || event->type == GDK_KEY_PRESS - || event->type == GDK_FOCUS_CHANGE - || event->type == GDK_MOTION_NOTIFY) - && gdk_property_get (event->any.window, - gdk_atom_intern ("_GNU_GTKAWT_ADDR", FALSE), - gdk_atom_intern ("CARDINAL", FALSE), - 0, - sizeof (jobject), - FALSE, - NULL, - NULL, - NULL, - (guchar **)&obj_ptr)) - { - switch (event->type) - { - case GDK_BUTTON_PRESS: - (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID, - AWT_MOUSE_PRESSED, - (jlong)event->button.time, - state_to_awt_mods (event->button.state) | - button_to_awt_mods (event->button.button), - (jint)event->button.x, - (jint)event->button.y, - click_count, - (event->button.button == 3) ? JNI_TRUE : - JNI_FALSE); - - /* grab_counter++; - gdk_pointer_grab (event->any.window, - FALSE, - GDK_POINTER_MOTION_MASK | - GDK_BUTTON_MOTION_MASK | - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | - GDK_ENTER_NOTIFY_MASK | - GDK_LEAVE_NOTIFY_MASK, - NULL, - NULL, - event->button.time);*/ - break; - case GDK_BUTTON_RELEASE: - { - int width, height; - - /* only ungrab if no other buttons are pressed down */ - /* if (--grab_counter == 0) - gdk_pointer_ungrab (event->button.time); - */ - (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID, - AWT_MOUSE_RELEASED, - (jlong)event->button.time, - state_to_awt_mods (event->button.state) | - button_to_awt_mods (event->button.button), - (jint)event->button.x, - (jint)event->button.y, - click_count, JNI_FALSE); - - /* check to see if the release occured in the window it was pressed - in, and if so, generate an AWT click event */ - gdk_window_get_size (event->any.window, &width, &height); - if (event->button.x >= 0 - && event->button.y >= 0 - && event->button.x <= width - && event->button.y <= height) - (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID, - AWT_MOUSE_CLICKED, - (jlong)event->button.time, - state_to_awt_mods (event->button.state) | - button_to_awt_mods (event->button.button), - (jint)event->button.x, - (jint)event->button.y, - click_count, JNI_FALSE); - - } - break; - case GDK_MOTION_NOTIFY: - (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID, - AWT_MOUSE_MOVED, - (jlong)event->motion.time, - state_to_awt_mods (event->motion.state), - (jint)event->motion.x, - (jint)event->motion.y, - 0, JNI_FALSE); - - if (event->motion.state & (GDK_BUTTON1_MASK - | GDK_BUTTON2_MASK - | GDK_BUTTON3_MASK - | GDK_BUTTON4_MASK - | GDK_BUTTON5_MASK)) - { - (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID, - AWT_MOUSE_DRAGGED, - (jlong)event->motion.time, - state_to_awt_mods (event->motion.state), - (jint)event->motion.x, - (jint)event->motion.y, - 0, JNI_FALSE); - } - break; - case GDK_ENTER_NOTIFY: - (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID, - AWT_MOUSE_ENTERED, - (jlong)event->crossing.time, - state_to_awt_mods (event->crossing.state), - (jint)event->crossing.x, - (jint)event->crossing.y, - 0, JNI_FALSE); - break; - case GDK_LEAVE_NOTIFY: - if (event->crossing.mode == GDK_CROSSING_NORMAL) - (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID, - AWT_MOUSE_EXITED, - (jlong)event->crossing.time, - state_to_awt_mods (event->crossing.state), - (jint)event->crossing.x, - (jint)event->crossing.y, - 0, JNI_FALSE); - break; - case GDK_CONFIGURE: - { - GtkWidget *widget; - - gdk_window_get_user_data (event->any.window, (void **) &widget); - - if (widget && GTK_WIDGET_TOPLEVEL (widget)) - { - gint top, left, right, bottom; - gint x, y, w, h, wb, d; - - /* calculate our insets */ - gdk_window_get_root_geometry (event->any.window, - &x, &y, &w, &h, &wb, &d); - - /* We used to compute these based on the configure - event's fields. However, that gives strange and - apparently incorrect results. */ - top = left = bottom = right = 0; - - /* configure events are not posted to the AWT event queue, - and as such, gdk/gtk will be called back before - postConfigureEvent returns */ - gdk_threads_leave (); - (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, - postConfigureEventID, - (jint)event->configure.x, - (jint)event->configure.y, - (jint)event->configure.width, - (jint)event->configure.height, - (jint)top, - (jint)left, - (jint)bottom, - (jint)right); - gdk_threads_enter (); - } - } - break; - case GDK_EXPOSE: - { - (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, - postExposeEventID, - (jint)event->expose.area.x, - (jint)event->expose.area.y, - (jint)event->expose.area.width, - (jint)event->expose.area.height); - } - break; - - case GDK_KEY_PRESS: - { - GtkWidget *widget; - GtkWindow *window; - - gdk_window_get_user_data (event->any.window, (void **) &widget); - - window = GTK_WINDOW (gtk_widget_get_ancestor (widget, - GTK_TYPE_WINDOW)); - if (window - && GTK_WIDGET_IS_SENSITIVE (window) - && window->focus_widget - && GTK_WIDGET_IS_SENSITIVE (window->focus_widget) - && window->focus_widget->window) - { - gtk_widget_activate (window->focus_widget); - gdk_property_get (window->focus_widget->window, - gdk_atom_intern ("_GNU_GTKAWT_ADDR", FALSE), - gdk_atom_intern ("CARDINAL", FALSE), - 0, - sizeof (jobject), - FALSE, - NULL, - NULL, - NULL, - (guchar **)&obj_ptr); - - /* if (grab && GTK_WIDGET_HAS_DEFAULT (widget) ) */ - /* { */ - (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, - postKeyEventID, - (jint) AWT_KEY_PRESSED, - (jlong) event->key.time, - state_to_awt_mods (event->key.state), - keysym_to_awt_keycode (event->key.keyval), - (jchar) (event->key.length) ? - event->key.string[0] : - AWT_KEY_CHAR_UNDEFINED); - if (event->key.length) - (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, - postKeyEventID, - (jint) AWT_KEY_TYPED, - (jlong) event->key.time, - state_to_awt_mods (event->key.state), - VK_UNDEFINED, - (jchar) event->key.string[0]); - } - } - break; - case GDK_FOCUS_CHANGE: - (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, - postFocusEventID, - (jint) (event->focus_change.in) ? - AWT_FOCUS_GAINED : AWT_FOCUS_LOST, - JNI_FALSE); - break; - default: - } - g_free (obj_ptr); - } - - gtk_main_do_event (event); -} - -static void -attach_jobject (GdkWindow *window, jobject *obj) -{ - GdkAtom addr_atom = gdk_atom_intern ("_GNU_GTKAWT_ADDR", FALSE); - GdkAtom type_atom = gdk_atom_intern ("CARDINAL", FALSE); - - gdk_window_set_events (window, - gdk_window_get_events (window) - | GDK_POINTER_MOTION_MASK - | GDK_BUTTON_MOTION_MASK - | GDK_BUTTON_PRESS_MASK - | GDK_BUTTON_RELEASE_MASK - | GDK_KEY_PRESS_MASK - | GDK_KEY_RELEASE_MASK - | GDK_ENTER_NOTIFY_MASK - | GDK_LEAVE_NOTIFY_MASK - | GDK_STRUCTURE_MASK - | GDK_KEY_PRESS_MASK - | GDK_FOCUS_CHANGE_MASK); - - gdk_property_change (window, - addr_atom, - type_atom, - 8, - GDK_PROP_MODE_REPLACE, - (guchar *)obj, - sizeof (jobject)); -} - -void -connect_awt_hook (JNIEnv *env, jobject peer_obj, int nwindows, ...) -{ - int i; - va_list ap; - jobject *obj; - - obj = (jobject *) malloc (sizeof (jobject)); - *obj = (*env)->NewGlobalRef (env, peer_obj); - - va_start (ap, nwindows); - for (i = 0; i < nwindows; i++) - attach_jobject (va_arg (ap, GdkWindow *), obj); - va_end (ap); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c deleted file mode 100644 index 2308d1100ed..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c +++ /dev/null @@ -1,92 +0,0 @@ -/* gtkfiledialogpeer.c -- Native implementation of GtkFileDialogPeer - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkFileDialogPeer.h" - -/* - * Make a new file selection dialog - */ - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_create - (JNIEnv *env, jobject obj) -{ - gpointer widget; - - gdk_threads_enter (); - widget = gtk_type_new (gtk_file_selection_get_type ()); - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, widget); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_connectHooks - (JNIEnv *env, jobject obj) -{ - void *ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - - /* NOTE: we don't call the superclass connect method here. */ - gtk_widget_realize (GTK_WIDGET (ptr)); - connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window); - - gdk_threads_leave (); -} - -/* - * Set the filename in the file selection dialog. - */ - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_gtkFileSelectionSetFilename - (JNIEnv *env, jobject obj, jstring filename) -{ - void *ptr; - const char *str; - - ptr = NSA_GET_PTR (env, obj); - - str = (*env)->GetStringUTFChars (env, filename, 0); - gdk_threads_enter (); - gtk_file_selection_set_filename (GTK_FILE_SELECTION (ptr), str); - gdk_threads_leave (); - (*env)->ReleaseStringUTFChars (env, filename, str); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c deleted file mode 100644 index dd446c89489..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c +++ /dev/null @@ -1,160 +0,0 @@ -/* gtkimagepainter.c - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkImagePainter.h" -#include <libart_lgpl/art_misc.h> -#include <libart_lgpl/art_rgb_affine.h> - -#define SWAPU32(w) \ - (((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24)) - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkImagePainter_drawPixels -(JNIEnv *env, jobject obj, jobject gc_obj, jint bg_red, jint bg_green, - jint bg_blue, jint x, jint y, jint width, jint height, jintArray jpixels, - jint offset, jint scansize, jdoubleArray jaffine) -{ - struct graphics *g; - jint *pixels, *elems; - guchar *packed; - int i; - jsize num_pixels; - guchar *j_rgba, *c_rgb; - - g = (struct graphics *) NSA_GET_PTR (env, gc_obj); - - elems = (*env)->GetIntArrayElements (env, jpixels, NULL); - num_pixels = (*env)->GetArrayLength (env, jpixels); - - /* get a copy of the pixel data so we can modify it */ - pixels = malloc (sizeof (jint) * num_pixels); - memcpy (pixels, elems, sizeof (jint) * num_pixels); - - (*env)->ReleaseIntArrayElements (env, jpixels, elems, 0); - -#ifndef WORDS_BIGENDIAN - /* convert pixels from 0xBBGGRRAA to 0xAARRGGBB */ - for (i = 0; i < num_pixels; i++) - pixels[i] = SWAPU32 ((unsigned)pixels[i]); -#endif - - packed = (guchar *) malloc (sizeof (guchar) * 3 * num_pixels); - j_rgba = (guchar *) pixels; - c_rgb = packed; - - /* copy over pixels in DirectColorModel format to 24 bit RGB image data, - and process the alpha channel */ - for (i = 0; i < num_pixels; i++) - { - jint ialpha = *j_rgba++; - - switch (ialpha) - { - case 0: /* full transparency */ - *c_rgb++ = bg_red; - *c_rgb++ = bg_green; - *c_rgb++ = bg_blue; - j_rgba += 3; - break; - case 255: /* opaque */ - *c_rgb++ = *j_rgba++; - *c_rgb++ = *j_rgba++; - *c_rgb++ = *j_rgba++; - break; - default: /* compositing required */ - { - jfloat alpha = ialpha / 255.0; - jfloat comp_alpha = 1.0 - alpha; - - *c_rgb++ = *j_rgba++ * alpha + bg_red * comp_alpha; - *c_rgb++ = *j_rgba++ * alpha + bg_green * comp_alpha; - *c_rgb++ = *j_rgba++ * alpha + bg_blue * comp_alpha; - } - break; - } - } - - if (jaffine) - { - jdouble *affine; - ArtAlphaGamma *alphagamma = NULL; - art_u8 *dst; - int new_width, new_height; - int i; - - affine = (*env)->GetDoubleArrayElements (env, jaffine, NULL); - - new_width = abs (width * affine[0]); - new_height = abs (height * affine[3]); - - dst = (art_u8 *) malloc (sizeof (art_u8) * 3 * (new_width * new_height)); - - art_rgb_affine (dst, - 0, 0, - new_width, new_height, - new_width * 3, - (art_u8 *) packed + offset * 3, - width, height, - scansize * 3, - affine, - ART_FILTER_NEAREST, - alphagamma); - - (*env)->ReleaseDoubleArrayElements (env, jaffine, affine, JNI_ABORT); - - free (packed); - packed = (guchar *) dst; - - width = scansize = new_width; - height = new_height; - offset = 0; - } - - gdk_threads_enter (); - - gdk_draw_rgb_image (g->drawable, - g->gc, - x + g->x_offset, - y + g->y_offset, - width, height, GDK_RGB_DITHER_NORMAL, - packed + offset * 3, scansize * 3); - - gdk_threads_leave (); - - free (pixels); - free (packed); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c deleted file mode 100644 index 9313a8a815b..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c +++ /dev/null @@ -1,57 +0,0 @@ -/* gtklabelpeer.c -- Native implementation of GtkLabelPeer - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkLabelPeer.h" - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkLabelPeer_create - (JNIEnv *env, jobject obj) -{ - GtkWidget *label; - GtkContainer *ebox; - - gdk_threads_enter (); - ebox = GTK_CONTAINER (gtk_type_new (gtk_event_box_get_type ())); - label = GTK_WIDGET (gtk_type_new (gtk_label_get_type ())); - gtk_container_add (ebox, label); - gtk_widget_show (label); - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, ebox); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c deleted file mode 100644 index 5787ce5083e..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c +++ /dev/null @@ -1,381 +0,0 @@ -/* gtklistpeer.c -- Native implementation of GtkListPeer - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkListPeer.h" - -static void -connect_selectable_hook (JNIEnv *env, jobject peer_obj, GtkCList *list); - -#define CLIST_FROM_SW(obj) (GTK_CLIST(GTK_SCROLLED_WINDOW (obj)->container.child)) - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkListPeer_create - (JNIEnv *env, jobject obj) -{ - GtkWidget *list, *sw; - - gdk_threads_enter (); - list = gtk_clist_new (1); - gtk_widget_show (list); - sw = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (sw), list); - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, sw); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkListPeer_connectHooks - (JNIEnv *env, jobject obj) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gtk_widget_realize (GTK_WIDGET (ptr)); - connect_selectable_hook (env, obj, CLIST_FROM_SW (ptr)); - connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkListPeer_append - (JNIEnv *env, jobject obj, jobjectArray items) -{ - void *ptr; - GtkCList *list; - jint count, i; - - ptr = NSA_GET_PTR (env, obj); - - count = (*env)->GetArrayLength (env, items); - - gdk_threads_enter (); - list = CLIST_FROM_SW (ptr); - for (i = 0; i < count; i++) - { - const char *text; - jobject item; - - item = (*env)->GetObjectArrayElement (env, items, i); - - text = (*env)->GetStringUTFChars (env, item, NULL); - gtk_clist_append (list, (char **)&text); - (*env)->ReleaseStringUTFChars (env, item, text); - } - - gtk_clist_columns_autosize (list); - gdk_threads_leave (); -} - - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkListPeer_old_create - (JNIEnv *env, jobject obj, jobject parent_obj, - jobjectArray items, jboolean mode) -{ - GtkWidget *list, *sw, *parent; - jsize count, i; - - parent = NSA_GET_PTR (env, parent_obj); - - count = (*env)->GetArrayLength (env, items); - - gdk_threads_enter (); - - list = gtk_clist_new (1); - gtk_widget_show (list); - - sw = gtk_scrolled_window_new (NULL, NULL); - set_parent (sw, GTK_CONTAINER (parent)); - gtk_widget_realize (sw); - - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (sw), list); - - connect_selectable_hook (env, obj, GTK_CLIST (list)); - connect_awt_hook (env, obj, 1, list->window); - - gtk_clist_set_selection_mode (GTK_CLIST (list), - mode ? GTK_SELECTION_MULTIPLE : - GTK_SELECTION_SINGLE); - - for (i = 0; i < count; i++) - { - const char *text; - jobject item; - - item = (*env)->GetObjectArrayElement (env, items, i); - - text = (*env)->GetStringUTFChars (env, item, NULL); - gtk_clist_append (GTK_CLIST (list), (char **)&text); - (*env)->ReleaseStringUTFChars (env, item, text); - } - - gtk_clist_columns_autosize (GTK_CLIST (list)); - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, sw); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkListPeer_add - (JNIEnv *env, jobject obj, jstring text, jint index) -{ - void *ptr; - const char *str; - - ptr = NSA_GET_PTR (env, obj); - str = (*env)->GetStringUTFChars (env, text, NULL); - - gdk_threads_enter (); - gtk_clist_insert (CLIST_FROM_SW (ptr), index, (char **)&str); - gdk_threads_leave (); - - (*env)->ReleaseStringUTFChars (env, text, str); -} - - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkListPeer_delItems - (JNIEnv *env, jobject obj, jint start, jint end) -{ - void *ptr; - GtkCList *list; - jint i; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - list = CLIST_FROM_SW (ptr); - - if (end == -1) /* special case for removing all rows */ - end = list->rows; - - gtk_clist_freeze (list); - for (i = start; i < end; i++) - gtk_clist_remove (list, i); - gtk_clist_thaw (list); - - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkListPeer_select - (JNIEnv *env, jobject obj, jint index) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gtk_clist_select_row (CLIST_FROM_SW (ptr), index, 0); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkListPeer_deselect - (JNIEnv *env, jobject obj, jint index) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gtk_clist_unselect_row (CLIST_FROM_SW (ptr), index, 0); - gdk_threads_leave (); -} - -/* FIXME: magic mojo (that doesn't seem to do anything) */ -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkListPeer_getSize - (JNIEnv *env, jobject obj, jint rows, jintArray jdims) -{ - void *ptr; - jint *dims; - GtkWidget *list; - GtkScrolledWindow *sw; - GtkRequisition myreq; - - dims = (*env)->GetIntArrayElements (env, jdims, NULL); - dims[0] = dims[1] = 0; - - if (rows < 3) - rows = 3; - - ptr = NSA_GET_PTR (env, obj); - gdk_threads_enter (); - - list = GTK_WIDGET (CLIST_FROM_SW (ptr)); - sw = GTK_SCROLLED_WINDOW (ptr); - - /* - gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->hscrollbar), - &myreq); - dims[1]=myreq.height+GTK_SCROLLED_WINDOW_CLASS - (GTK_OBJECT (sw)->klass)->scrollbar_spacing; - */ - - gtk_signal_emit_by_name (GTK_OBJECT (GTK_SCROLLED_WINDOW(sw)->vscrollbar), - "size_request", &myreq); - /* - - gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->vscrollbar), - &myreq); - */ - - dims[0]=myreq.width+GTK_SCROLLED_WINDOW_CLASS - (GTK_OBJECT (sw)->klass)->scrollbar_spacing; - - gtk_signal_emit_by_name (GTK_OBJECT (list), "size_request", &myreq); - - // gtk_widget_size_request(GTK_WIDGET (list), &myreq); - - dims[0] += myreq.width + gdk_char_width (list->style->font, 'W'); - - dims[1] += ((rows * (gdk_char_height (list->style->font, 'W')+7)) - + (2 * (list->style->klass->ythickness))); - - - gdk_threads_leave (); - - (*env)->ReleaseIntArrayElements (env, jdims, dims, 0); -} - - -JNIEXPORT jintArray JNICALL -Java_gnu_java_awt_peer_gtk_GtkListPeer_getSelectedIndexes - (JNIEnv *env, jobject obj) -{ - void *ptr; - GtkCList *list; - jintArray selection; - jint *sel; - GList *child; - jint count, i; - - ptr = NSA_GET_PTR (env, obj); - gdk_threads_enter (); - - list = CLIST_FROM_SW (ptr); - count = g_list_length (list->selection); - - selection = (*env)->NewIntArray (env, count); - sel = (*env)->GetIntArrayElements (env, selection, NULL); - - for (i = 0, child = list->selection; i < count; i++) - { - sel[i] = GPOINTER_TO_INT (child->data); - child = g_list_next (child); - } - gdk_threads_leave (); - - (*env)->ReleaseIntArrayElements (env, selection, sel, 0); - - return selection; -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkListPeer_makeVisible - (JNIEnv *env, jobject obj, jint index) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gtk_clist_moveto (CLIST_FROM_SW (ptr), index, 0, 0.5, 0.5); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkListPeer_setMultipleMode - (JNIEnv *env, jobject obj, jboolean mode) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gtk_clist_set_selection_mode (CLIST_FROM_SW (ptr), - mode ? GTK_SELECTION_MULTIPLE : - GTK_SELECTION_SINGLE); - gdk_threads_leave (); -} - -static void -item_select (GtkCList *list, int row, int col, GdkEventButton *event, - jobject *peer_obj) -{ - (*gdk_env)->CallVoidMethod (gdk_env, *peer_obj, - postListItemEventID, - row, - (jint) AWT_ITEM_SELECTED); -} - -static void -item_unselect (GtkCList *list, int row, int col, GdkEventButton *event, - jobject *peer_obj) -{ - (*gdk_env)->CallVoidMethod (gdk_env, *peer_obj, - postListItemEventID, - row, - (jint) AWT_ITEM_DESELECTED); -} - -static void -connect_selectable_hook (JNIEnv *env, jobject peer_obj, GtkCList *list) -{ - jobject *obj; - - obj = (jobject *) malloc (sizeof (jobject)); - *obj = (*env)->NewGlobalRef (env, peer_obj); - - gtk_signal_connect (GTK_OBJECT (list), "select_row", - GTK_SIGNAL_FUNC (item_select), obj); - - gtk_signal_connect (GTK_OBJECT (list), "unselect_row", - GTK_SIGNAL_FUNC (item_unselect), obj); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c deleted file mode 100644 index af14f0be8a9..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c +++ /dev/null @@ -1,163 +0,0 @@ -/* gtkmainthread.c -- Native implementation of GtkMainThread - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkMainThread.h" -#include "gthread-jni.h" - -#ifdef JVM_SUN - struct state_table *native_state_table; -#endif - -jmethodID postActionEventID; -jmethodID postMenuActionEventID; -jmethodID postMouseEventID; -jmethodID postConfigureEventID; -jmethodID postExposeEventID; -jmethodID postKeyEventID; -jmethodID postFocusEventID; -jmethodID postAdjustmentEventID; -jmethodID postItemEventID; -jmethodID postListItemEventID; -JNIEnv *gdk_env; - -/* - * Call gtk_init. It is very important that this happen before any other - * gtk calls. - */ - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkInit (JNIEnv *env, jclass clazz) -{ - int argc = 1; - char **argv; - char *homedir, *rcpath = NULL; -/* jclass gtkgenericpeer; */ - jclass gtkcomponentpeer, gtkwindowpeer, gtkscrollbarpeer, gtklistpeer, gtkmenuitempeer; - - NSA_INIT (env, clazz); - - /* GTK requires a program's argc and argv variables, and requires that they - be valid. */ - - argv = (char **) malloc (sizeof (char *) * 2); - argv[0] = ""; - argv[1] = NULL; - - /* until we have JDK 1.2 JNI, assume we have a VM with threads that - match what GLIB was compiled for */ - g_thread_init (NULL); - - gtk_init (&argc, &argv); - - gdk_rgb_init (); - gtk_widget_set_default_colormap (gdk_rgb_get_cmap ()); - gtk_widget_set_default_visual (gdk_rgb_get_visual ()); - - /* Make sure queued calls don't get sent to GTK/GDK while - we're shutting down. */ - atexit (gdk_threads_enter); - - gdk_env = env; - gdk_event_handler_set ((GdkEventFunc)awt_event_handler, NULL, NULL); - - if ((homedir = getenv ("HOME"))) - { - rcpath = (char *) malloc (strlen (homedir) + strlen (RC_FILE) + 2); - sprintf (rcpath, "%s/%s", homedir, RC_FILE); - } - - gtk_rc_parse ((rcpath) ? rcpath : RC_FILE); - - if (rcpath) - free (rcpath); - - free (argv); - - /* setup cached IDs for posting GTK events to Java */ -/* gtkgenericpeer = (*env)->FindClass (env, */ -/* "gnu/java/awt/peer/gtk/GtkGenericPeer"); */ - gtkcomponentpeer = (*env)->FindClass (env, - "gnu/java/awt/peer/gtk/GtkComponentPeer"); - gtkwindowpeer = (*env)->FindClass (env, - "gnu/java/awt/peer/gtk/GtkWindowPeer"); - gtkscrollbarpeer = (*env)->FindClass (env, - "gnu/java/awt/peer/gtk/GtkScrollbarPeer"); - gtklistpeer = (*env)->FindClass (env, "gnu/java/awt/peer/gtk/GtkListPeer"); - gtkmenuitempeer = (*env)->FindClass (env, "gnu/java/awt/peer/gtk/GtkMenuItemPeer"); -/* gdkColor = (*env)->FindClass (env, */ -/* "gnu/java/awt/peer/gtk/GdkColor"); */ -/* gdkColorID = (*env)->GetMethodID (env, gdkColor, "<init>", "(III)V"); */ -/* postActionEventID = (*env)->GetMethodID (env, gtkgenericpeer, */ -/* "postActionEvent", */ -/* "(Ljava/lang/String;I)V"); */ - - postMenuActionEventID = (*env)->GetMethodID (env, gtkmenuitempeer, - "postMenuActionEvent", - "()V"); - postMouseEventID = (*env)->GetMethodID (env, gtkcomponentpeer, - "postMouseEvent", "(IJIIIIZ)V"); - postConfigureEventID = (*env)->GetMethodID (env, gtkwindowpeer, - "postConfigureEvent", "(IIIIIIII)V"); - postExposeEventID = (*env)->GetMethodID (env, gtkcomponentpeer, - "postExposeEvent", "(IIII)V"); - postKeyEventID = (*env)->GetMethodID (env, gtkcomponentpeer, - "postKeyEvent", "(IJIIC)V"); - postFocusEventID = (*env)->GetMethodID (env, gtkcomponentpeer, - "postFocusEvent", "(IZ)V"); - postAdjustmentEventID = (*env)->GetMethodID (env, gtkscrollbarpeer, - "postAdjustmentEvent", - "(II)V"); - postItemEventID = (*env)->GetMethodID (env, gtkcomponentpeer, - "postItemEvent", - "(Ljava/lang/Object;I)V"); - postListItemEventID = (*env)->GetMethodID (env, gtklistpeer, - "postItemEvent", - "(II)V"); -} - -/* - * Run gtk_main and block. - */ -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkMain (JNIEnv *env, jobject obj) -{ - gdk_threads_enter (); - gtk_main (); - gdk_threads_leave (); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c deleted file mode 100644 index 89818e05fb1..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c +++ /dev/null @@ -1,81 +0,0 @@ -/* gtkmenubarpeer.c -- Native implementation of GtkMenuBarPeer - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkMenuBarPeer.h" - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_create - (JNIEnv *env, jobject obj) -{ - GtkWidget *widget; - - gdk_threads_enter (); - widget = gtk_menu_bar_new (); - gtk_widget_show (widget); - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, widget); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_addMenu - (JNIEnv *env, jobject obj, jobject menupeer) -{ - void *mbar, *menu; - - mbar = NSA_GET_PTR (env, obj); - menu = NSA_GET_PTR (env, menupeer); - - gdk_threads_enter (); - gtk_menu_bar_append (GTK_MENU_BAR (mbar), GTK_WIDGET (menu)); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_delMenu - (JNIEnv *env, jobject obj, jint index) -{ - void *ptr; - GList *list; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - list = gtk_container_children (GTK_CONTAINER (ptr)); - list = g_list_nth (list, index); - gtk_container_remove (GTK_CONTAINER (ptr), GTK_WIDGET (list->data)); - gdk_threads_leave (); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c deleted file mode 100644 index ee3920867a8..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c +++ /dev/null @@ -1,120 +0,0 @@ -/* gtkmenuitempeer.c -- Native implementation of GtkMenuItemPeer - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkMenuItemPeer.h" -#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h" - -static void -connect_activate_hook (JNIEnv *, jobject, GtkMenuItem *); - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create - (JNIEnv *env, jobject obj, jstring label) -{ - GtkWidget *widget; - const char *str; - - str = (*env)->GetStringUTFChars (env, label, NULL); - - gdk_threads_enter (); - - if (strcmp (str, "-") == 0) /* "-" signals that we need a separator */ - widget = gtk_menu_item_new (); - else - widget = gtk_menu_item_new_with_label (str); - - connect_activate_hook (env, obj, GTK_MENU_ITEM (widget)); - gtk_widget_show (widget); - gdk_threads_leave (); - - (*env)->ReleaseStringUTFChars (env, label, str); - - NSA_SET_PTR (env, obj, widget); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel - (JNIEnv *env, jobject obj, jstring label) -{ - void *ptr; - const char *str; - - ptr = NSA_GET_PTR (env, obj); - - str = (*env)->GetStringUTFChars (env, label, NULL); - - gdk_threads_enter (); - - if (strcmp (str, "-") == 0) /* "-" signals that we need a separator */ - gtk_container_remove (GTK_CONTAINER (ptr), GTK_BIN (ptr)->child); - else - { - GtkAccelLabel *accel_label = GTK_ACCEL_LABEL (GTK_BIN (ptr)->child); - - gtk_label_set_text (GTK_LABEL (accel_label), str); - gtk_accel_label_refetch (accel_label); - } - - gdk_threads_leave (); - - (*env)->ReleaseStringUTFChars (env, label, str); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setEnabled - (JNIEnv *env, jobject obj, jboolean enabled) -{ -/* Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setEnabled (env, obj, enabled); */ -} - -static void -item_activate (GtkMenuItem *item, jobject *peer_obj) -{ - (*gdk_env)->CallVoidMethod (gdk_env, *peer_obj, - postMenuActionEventID); -} - -static void -connect_activate_hook (JNIEnv *env, jobject peer_obj, GtkMenuItem *item) -{ - jobject *obj; - - obj = (jobject *) malloc (sizeof (jobject)); - *obj = (*env)->NewGlobalRef (env, peer_obj); - - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (item_activate), obj); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c deleted file mode 100644 index ec8154276cd..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c +++ /dev/null @@ -1,152 +0,0 @@ -/* gtkmenupeer.c -- Native implementation of GtkMenuPeer - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkMenuPeer.h" - -static void -accel_attach (GtkMenuItem *menu_item, gpointer *user_data) -{ - GtkAccelGroup *accel; - - accel = gtk_menu_get_accel_group (GTK_MENU (menu_item->submenu)); - gtk_accel_group_attach (accel, - GTK_OBJECT (gtk_widget_get_toplevel (GTK_WIDGET(menu_item)))); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_setupAccelGroup - (JNIEnv *env, jobject obj, jobject parent) -{ - void *ptr1, *ptr2; - - ptr1 = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - if (!parent) - { - gtk_menu_set_accel_group (GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu), - gtk_accel_group_new ()); - - if (GTK_WIDGET_REALIZED (GTK_WIDGET (ptr1))) - accel_attach (GTK_MENU_ITEM (ptr1), NULL); - else - gtk_signal_connect (GTK_OBJECT (ptr1), - "realize", - GTK_SIGNAL_FUNC (accel_attach), - NULL); - } - else - { - GtkAccelGroup *parent_accel; - - ptr2 = NSA_GET_PTR (env, parent); - parent_accel = gtk_menu_get_accel_group (GTK_MENU (GTK_MENU_ITEM (ptr2)->submenu)); - - gtk_menu_set_accel_group (GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu), - parent_accel); - } - - gdk_threads_leave (); -} - - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_create - (JNIEnv *env, jobject obj, jstring label) -{ - GtkWidget *menu_title, *menu; - const char *str; - - str = (*env)->GetStringUTFChars (env, label, NULL); - - gdk_threads_enter (); - menu = gtk_menu_new (); - - menu_title = gtk_menu_item_new_with_label (str); - gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_title), menu); - - gtk_widget_show (menu); - gtk_widget_show (menu_title); - - NSA_SET_PTR (env, obj, menu_title); - gdk_threads_leave (); - - (*env)->ReleaseStringUTFChars (env, label, str); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addItem - (JNIEnv *env, jobject obj, jobject menuitempeer, jint key, jboolean shift) -{ - void *ptr1, *ptr2; - GtkMenu *menu; - - ptr1 = NSA_GET_PTR (env, obj); - ptr2 = NSA_GET_PTR (env, menuitempeer); - - gdk_threads_enter (); - - menu = GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu); - gtk_menu_append (menu, GTK_WIDGET (ptr2)); - - if (key) - { - gtk_widget_add_accelerator (GTK_WIDGET (ptr2), "activate", - gtk_menu_get_accel_group (menu), key, - (GDK_CONTROL_MASK - | ((shift) ? GDK_SHIFT_MASK : 0)), - GTK_ACCEL_VISIBLE); - } - - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_delItem - (JNIEnv *env, jobject obj, jint index) -{ - void *ptr; - GList *list; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - list = gtk_container_children (GTK_CONTAINER (ptr)); - list = g_list_nth (list, index); - gtk_container_remove (GTK_CONTAINER (ptr), GTK_WIDGET (list->data)); - gdk_threads_leave (); -} - - diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c deleted file mode 100644 index b52c75d5311..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c +++ /dev/null @@ -1,137 +0,0 @@ -/* gtkpanelpeer.c -- Native implementation of GtkPanelPeer - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkPanelPeer.h" - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkPanelPeer_create - (JNIEnv *env, jobject obj) -{ - gpointer widget; - - gdk_threads_enter (); - widget = gtk_layout_new (NULL, NULL); - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, widget); -} - -typedef struct _GtkLayoutChild GtkLayoutChild; - -struct _GtkLayoutChild { - GtkWidget *widget; - gint x; - gint y; -}; - -static -void sr (GtkWidget *widget, GtkRequisition *requisition, gpointer user_data) -{ - GtkLayout *layout; - GtkLayoutChild *child; - GList *children; - - layout = GTK_LAYOUT (widget); - requisition->width = GTK_WIDGET (widget)->allocation.width; - requisition->height = GTK_WIDGET (widget)->allocation.height; - - children = layout->children; - while (children) - { - child = children->data; - children = children->next; - - if (GTK_WIDGET_VISIBLE (child->widget)) - { - requisition->height = MAX (requisition->height, - child->y + - child->widget->allocation.height); - requisition->width = MAX (requisition->width, - child->x + - child->widget->allocation.width); - } - } - - requisition->height += GTK_CONTAINER (layout)->border_width * 2; - requisition->width += GTK_CONTAINER (layout)->border_width * 2; -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkPanelPeer_connectHooks - (JNIEnv *env, jobject obj) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gtk_widget_realize (GTK_WIDGET (ptr)); - connect_awt_hook (env, obj, 1, GTK_LAYOUT (ptr)->bin_window); - -/* gtk_signal_connect (GTK_OBJECT (ptr), "size_request", GTK_SIGNAL_FUNC (sr), */ -/* NULL); */ - gdk_threads_leave (); -} - -/* - * Make a new panel. - */ -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkPanelPeer_gtkPanelNew - (JNIEnv *env, jobject obj, jobject parent_obj) -{ - GtkWidget *layout; - void *parent; - - parent = NSA_GET_PTR (env, parent_obj); - - gdk_threads_enter (); - layout = gtk_layout_new (NULL, NULL); - - set_parent (layout, GTK_CONTAINER (parent)); - - gtk_widget_realize (layout); - connect_awt_hook (env, obj, 1, GTK_LAYOUT (layout)->bin_window); - set_visible (layout, 1); - - NSA_SET_PTR (env, obj, layout); - gdk_threads_leave (); -} - - diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c deleted file mode 100644 index 66affcff255..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c +++ /dev/null @@ -1,93 +0,0 @@ -/* gtkpopupmenupeer.c -- Native implementation of GtkPopupMenuPeer - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkPopupMenuPeer.h" - -struct pos -{ - gint x; - gint y; -}; - -void -menu_pos (GtkMenu *menu, gint *x, gint *y, gpointer user_data) -{ - struct pos *p = (struct pos *) user_data; - - *x = p->x; - *y = p->y; -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_show - (JNIEnv *env, jobject obj, jint x, jint y, jlong time) -{ - void *ptr; - struct pos *p; - - ptr = NSA_GET_PTR (env, obj); - - p = g_malloc (sizeof (struct pos)); - p->x = x; - p->y = y; - - gdk_threads_enter (); - gtk_menu_popup (GTK_MENU (GTK_MENU_ITEM (ptr)->submenu), - NULL, NULL, menu_pos, p, 3, time); - gdk_threads_leave (); - - g_free (p); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_setupAccelGroup - (JNIEnv *env, jobject obj, jobject parent) -{ - void *ptr1, *ptr2; - GtkMenu *menu; - - ptr1 = NSA_GET_PTR (env, obj); - ptr2 = NSA_GET_PTR (env, parent); - - gdk_threads_enter (); - menu = GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu); - gtk_menu_set_accel_group (menu, gtk_accel_group_new ()); - gtk_accel_group_attach (gtk_menu_get_accel_group (menu), - GTK_OBJECT (gtk_widget_get_toplevel (ptr2))); - gdk_threads_leave (); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c deleted file mode 100644 index 9237a01b5a8..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c +++ /dev/null @@ -1,184 +0,0 @@ -/* gtkscrollbarpeer.c -- Native implementation of GtkScrollbarPeer - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkScrollbarPeer.h" - -struct range_scrollbar -{ - GtkRange *range; - jobject *scrollbar; -}; - -static void -post_adjustment_event (GtkAdjustment *adj, struct range_scrollbar *rs) -{ - jint type; - - switch (rs->range->scroll_type) - { - case GTK_SCROLL_STEP_FORWARD: - type = AWT_ADJUSTMENT_UNIT_INCREMENT; - break; - case GTK_SCROLL_STEP_BACKWARD: - type = AWT_ADJUSTMENT_UNIT_DECREMENT; - break; - case GTK_SCROLL_PAGE_FORWARD: - type = AWT_ADJUSTMENT_BLOCK_INCREMENT; - break; - case GTK_SCROLL_PAGE_BACKWARD: - type = AWT_ADJUSTMENT_BLOCK_DECREMENT; - break; - case GTK_SCROLL_JUMP: - case GTK_SCROLL_NONE: /* Apparently generated when slider is dragged. */ - type = AWT_ADJUSTMENT_TRACK; - break; - default: /* Can this happen? If so, is this right? */ - return; - } - - (*gdk_env)->CallVoidMethod (gdk_env, *(rs->scrollbar), postAdjustmentEventID, - type, (jint) adj->value); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_create -(JNIEnv *env, jobject obj, jint orientation, jint value, - jint min, jint max, jint step_incr, jint page_incr, jint visible_amount) -{ - GtkWidget *sb; - GtkObject *adj; - - gdk_threads_enter (); - adj = gtk_adjustment_new (value, min, max, - step_incr, page_incr, - visible_amount); - - sb = (orientation) ? gtk_vscrollbar_new (GTK_ADJUSTMENT (adj)) : - gtk_hscrollbar_new (GTK_ADJUSTMENT (adj)); - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, sb); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_connectHooks - (JNIEnv *env, jobject obj) -{ - void *ptr; - struct range_scrollbar *rs; - - rs = (struct range_scrollbar *) malloc (sizeof (struct range_scrollbar)); - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gtk_widget_realize (GTK_WIDGET (ptr)); - - rs->range = GTK_RANGE (ptr); - rs->scrollbar = (jobject *) malloc (sizeof (jobject)); - *(rs->scrollbar) = (*env)->NewGlobalRef (env, obj); - gtk_signal_connect (GTK_OBJECT (GTK_RANGE (ptr)->adjustment), - "value_changed", - GTK_SIGNAL_FUNC (post_adjustment_event), rs); - - connect_awt_hook (env, obj, 4, - GTK_RANGE (ptr)->trough, - GTK_RANGE (ptr)->slider, - GTK_RANGE (ptr)->step_forw, - GTK_RANGE (ptr)->step_back); - gdk_threads_leave (); -} - - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setLineIncrement - (JNIEnv *env, jobject obj, jint amount) -{ - void *ptr; - GtkAdjustment *adj; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - - adj = GTK_RANGE (ptr)->adjustment; - adj->step_increment = amount; - gtk_adjustment_changed (adj); - - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setPageIncrement - (JNIEnv *env, jobject obj, jint amount) -{ - void *ptr; - GtkAdjustment *adj; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - - adj = GTK_RANGE (ptr)->adjustment; - adj->page_increment = amount; - gtk_adjustment_changed (adj); - - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setValues - (JNIEnv *env, jobject obj, jint value, jint visible, jint min, jint max) -{ - void *ptr; - GtkAdjustment *adj; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - - adj = GTK_RANGE (ptr)->adjustment; - adj->value = value; - adj->page_size = visible; - adj->lower = min; - adj->upper = max; - gtk_adjustment_changed (adj); - - gdk_threads_leave (); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c deleted file mode 100644 index 499b3124d88..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c +++ /dev/null @@ -1,190 +0,0 @@ -/* gtkscrollpanepeer.c -- Native implementation of GtkScrollPanePeer - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkScrollPanePeer.h" - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_create - (JNIEnv *env, jobject obj) -{ - gpointer window; - GtkWidget *layout; - - gdk_threads_enter (); - window = gtk_scrolled_window_new (NULL, NULL); - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, window); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_setScrollPosition - (JNIEnv *env, jobject obj, jint x, jint y) -{ - GtkAdjustment *hadj, *vadj; - GtkScrolledWindow *sw; - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - sw = GTK_SCROLLED_WINDOW (ptr); - - hadj = gtk_scrolled_window_get_hadjustment (sw); - vadj = gtk_scrolled_window_get_vadjustment (sw); - - gtk_adjustment_set_value (hadj, x); - gtk_adjustment_set_value (vadj, y); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_gtkScrolledWindowSetHScrollIncrement - (JNIEnv *env, jobject obj, jint u) -{ - GtkAdjustment *hadj; - GtkScrolledWindow *sw; - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - sw = GTK_SCROLLED_WINDOW(ptr); - - hadj = gtk_scrolled_window_get_hadjustment (sw); - hadj->step_increment = u; - - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_gtkScrolledWindowSetVScrollIncrement - (JNIEnv *env, jobject obj, jint u) -{ - GtkAdjustment *vadj; - GtkScrolledWindow *sw; - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - sw = GTK_SCROLLED_WINDOW(ptr); - - vadj = gtk_scrolled_window_get_hadjustment (sw); - vadj->step_increment = u; - - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_childResized - (JNIEnv *env, jobject obj, jint width, jint height) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - return; - - gdk_threads_enter (); - gtk_widget_set_usize (GTK_BIN (ptr)->child, width, height); - gdk_threads_leave (); -} - -JNIEXPORT jint JNICALL -Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_getHScrollbarHeight - (JNIEnv *env, jobject obj) -{ - void *ptr; - GtkScrolledWindow *sw; - jint height; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - sw = GTK_SCROLLED_WINDOW (ptr); - height = (sw->hscrollbar_visible) ? sw->hscrollbar->allocation.height : 0; - gdk_threads_leave (); - - return height; -} - -JNIEXPORT jint JNICALL -Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_getVScrollbarWidth - (JNIEnv *env, jobject obj) -{ - void *ptr; - GtkScrolledWindow *sw; - jint width; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - sw = GTK_SCROLLED_WINDOW (ptr); - width = (sw->vscrollbar_visible) ? sw->vscrollbar->allocation.width : 0; - gdk_threads_leave (); - - return width; -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_setPolicy - (JNIEnv *env, jobject obj, jint policy) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - switch (policy) - { - case AWT_SCROLLPANE_SCROLLBARS_AS_NEEDED: - policy = GTK_POLICY_AUTOMATIC; - break; - case AWT_SCROLLPANE_SCROLLBARS_ALWAYS: - policy = GTK_POLICY_ALWAYS; - break; - case AWT_SCROLLPANE_SCROLLBARS_NEVER: - policy = GTK_POLICY_NEVER; - break; - } - - gdk_threads_enter (); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (ptr), policy, policy); - gdk_threads_leave (); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c deleted file mode 100644 index 27f27461518..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c +++ /dev/null @@ -1,246 +0,0 @@ -/* gtktextareapeer.c -- Native implementation of GtkTextAreaPeer - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkTextAreaPeer.h" - -#define TEXT_FROM_SW(obj) (GTK_TEXT(GTK_SCROLLED_WINDOW (obj)->container.child)) -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_create - (JNIEnv *env, jobject obj, jint scroll) -{ - GtkWidget *text, *sw; - - gdk_threads_enter (); - text = gtk_text_new (NULL, NULL); - gtk_widget_show (text); - - sw = gtk_scrolled_window_new (NULL, NULL); - gtk_container_add (GTK_CONTAINER (sw), text); - - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), - - /* horizontal scrollbar */ - (scroll == AWT_TEXTAREA_SCROLLBARS_BOTH - || scroll == AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY) ? - GTK_POLICY_ALWAYS : GTK_POLICY_NEVER, - - /* vertical scrollbar */ - (scroll == AWT_TEXTAREA_SCROLLBARS_BOTH - || scroll == AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY) ? - GTK_POLICY_ALWAYS : GTK_POLICY_NEVER); - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, sw); -} - - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_old_create - (JNIEnv *env, jobject obj, jobject parent_obj, - jstring contents, jint scroll) -{ - GtkWidget *text, *sw; - const char *str; - int pos=0; - void *parent; - - parent = NSA_GET_PTR (env, parent_obj); - str = (*env)->GetStringUTFChars (env, contents, NULL); - - gdk_threads_enter (); - - text = gtk_text_new (NULL, NULL); - gtk_text_set_editable (GTK_TEXT (text), TRUE); - - gtk_editable_insert_text (GTK_EDITABLE (text), str, - strlen (str), &pos); - - sw = gtk_scrolled_window_new (NULL, NULL); - gtk_container_add (GTK_CONTAINER (sw), text); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), - - /* horizontal scrollbar */ - (scroll == AWT_TEXTAREA_SCROLLBARS_BOTH - || scroll == AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY) ? - GTK_POLICY_ALWAYS : GTK_POLICY_NEVER, - - /* vertical scrollbar */ - (scroll == AWT_TEXTAREA_SCROLLBARS_BOTH - || scroll == AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY) ? - GTK_POLICY_ALWAYS : GTK_POLICY_NEVER); - - set_visible (text, TRUE); - set_parent (sw, GTK_CONTAINER (parent)); - - gdk_threads_leave (); - - (*env)->ReleaseStringUTFChars (env, contents, str); - - NSA_SET_PTR (env, obj, sw); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkTextGetSize - (JNIEnv *env, jobject obj, jint rows, jint cols, jintArray jdims) -{ - void *ptr; - jint *dims; - GtkWidget *text; - GtkScrolledWindow *sw; - GtkRequisition myreq; - - ptr = NSA_GET_PTR (env, obj); - - dims = (*env)->GetIntArrayElements (env, jdims, 0); - dims[0] = dims[1] = 0; - - gdk_threads_enter (); - - text = GTK_WIDGET (TEXT_FROM_SW (ptr)); - sw = GTK_SCROLLED_WINDOW (ptr); - - gtk_signal_emit_by_name (GTK_OBJECT (GTK_SCROLLED_WINDOW(sw)->vscrollbar), - "size_request", &myreq); - //gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->hscrollbar), - // &myreq); - dims[0]=myreq.width+GTK_SCROLLED_WINDOW_CLASS - (GTK_OBJECT (sw)->klass)->scrollbar_spacing; - - gtk_signal_emit_by_name (GTK_OBJECT (GTK_SCROLLED_WINDOW(sw)->hscrollbar), - "size_request", &myreq); - //gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->vscrollbar), - // &myreq); - dims[1]=myreq.height+GTK_SCROLLED_WINDOW_CLASS - (GTK_OBJECT (sw)->klass)->scrollbar_spacing; - - /* The '1' in the following assignments is from - #define TEXT_BORDER_ROOM 1 - in gtktext.c */ - - /* Gtk text seems to wrap slightly prematurely. Compensate. */ - ++cols; - ++dims[0]; - - dims[0] += ((cols * gdk_char_width (text->style->font, 'W')) - + (2 * (text->style->klass->xthickness + 1))); - /* Guess at the height. Is there a better way? */ - dims[1] += ((rows * gdk_string_height (text->style->font, "Wg")) - + (2 * (text->style->klass->ythickness + 1))); - - gdk_threads_leave (); - - (*env)->ReleaseIntArrayElements (env, jdims, dims, 0); -} - - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_insert - (JNIEnv *env, jobject obj, jstring contents, jint position) -{ - void *ptr; - const char *str; - int pos=position; - - ptr = NSA_GET_PTR (env, obj); - str = (*env)->GetStringUTFChars (env, contents, NULL); - - gdk_threads_enter (); - gtk_editable_insert_text (GTK_EDITABLE (TEXT_FROM_SW (ptr)), - str, strlen (str), &pos); - gdk_threads_leave (); - - (*env)->ReleaseStringUTFChars (env, contents, str); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_replaceRange - (JNIEnv *env, jobject obj, jstring contents, jint start, jint end) -{ - void *ptr; - GtkEditable *text; - const char *str; - int pos = start; - - ptr = NSA_GET_PTR (env, obj); - str = (*env)->GetStringUTFChars (env, contents, NULL); - - gdk_threads_enter (); - - text = GTK_EDITABLE (TEXT_FROM_SW (ptr)); - gtk_text_freeze (GTK_TEXT (text)); - gtk_editable_delete_text (text, start, end); - gtk_editable_insert_text (text, str, strlen (str), &pos); - gtk_text_thaw (GTK_TEXT (text)); - - gdk_threads_leave (); - (*env)->ReleaseStringUTFChars (env, contents, str); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkSetFont - (JNIEnv *env, jobject obj, jstring jname, jint size) -{ - const char *xlfd; -# define FBUFSZ 200 - char buf[FBUFSZ]; - void *ptr; - GdkFont * new_font; - GtkStyle * style; - GtkWidget * text; - - ptr = NSA_GET_PTR (env, obj); - text = GTK_WIDGET (TEXT_FROM_SW (ptr)); - - xlfd = (*env)->GetStringUTFChars (env, jname, NULL); - snprintf(buf, FBUFSZ, xlfd, size); - (*env)->ReleaseStringUTFChars (env, jname, xlfd); - gdk_threads_enter(); - new_font = gdk_font_load (buf); /* FIXME: deprecated. Replacement? */ - if (new_font == NULL) - { - /* Fail quietly for now. */ - gdk_threads_leave(); - return; - } - style = gtk_style_copy (gtk_widget_get_style (text)); - style -> font = new_font; - gtk_widget_set_style (text , style); - /* FIXME: Documentation varies as to whether we should unref style. */ - gdk_threads_leave(); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c deleted file mode 100644 index 0b6db8f1840..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c +++ /dev/null @@ -1,180 +0,0 @@ -/* gtktextcomponentpeer.c -- Native implementation of GtkTextComponentPeer - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkTextComponentPeer.h" - -#define GET_EDITABLE(obj) (GTK_IS_EDITABLE (obj) ? GTK_EDITABLE (obj) : \ - GTK_EDITABLE (GTK_SCROLLED_WINDOW (obj)->container.child)) - -JNIEXPORT jint JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getCaretPosition - (JNIEnv *env, jobject obj) -{ - void *ptr; - int pos; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - pos = gtk_editable_get_position (GET_EDITABLE (ptr)); - gdk_threads_leave (); - - return pos; -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_setCaretPosition - (JNIEnv *env, jobject obj, jint pos) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gtk_editable_set_position (GET_EDITABLE (ptr), pos); - gdk_threads_leave (); -} - -JNIEXPORT jint JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getSelectionStart - (JNIEnv *env, jobject obj) -{ - void *ptr; - int pos; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - pos = GET_EDITABLE (ptr)->selection_start_pos; - gdk_threads_leave (); - - return pos; -} - -JNIEXPORT jint JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getSelectionEnd - (JNIEnv *env, jobject obj) -{ - void *ptr; - int pos; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - pos = GET_EDITABLE (ptr)->selection_end_pos; - gdk_threads_leave (); - - return pos; -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_select - (JNIEnv *env, jobject obj, jint start, jint end) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gtk_editable_select_region (GET_EDITABLE (ptr), start, end); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_setEditable - (JNIEnv *env, jobject obj, jboolean state) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gtk_editable_set_editable (GET_EDITABLE (ptr), state); - gdk_threads_leave (); -} - -JNIEXPORT jstring JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getText - (JNIEnv *env, jobject obj) -{ - void *ptr; - char *contents; - jstring jcontents; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - contents = gtk_editable_get_chars (GET_EDITABLE (ptr), 0, -1); - gdk_threads_leave (); - - jcontents = (*env)->NewStringUTF (env, contents); - g_free (contents); - - return jcontents; -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_setText - (JNIEnv *env, jobject obj, jstring contents) -{ - void *ptr; - GtkEditable *text; - const char *str; - int pos = 0; - - ptr = NSA_GET_PTR (env, obj); - str = (*env)->GetStringUTFChars (env, contents, NULL); - - gdk_threads_enter (); - - text = GET_EDITABLE (ptr); - - if (GTK_IS_TEXT (text)) - gtk_text_freeze (GTK_TEXT (text)); - - gtk_editable_delete_text (text, 0, -1); - gtk_editable_insert_text (text, str, strlen (str), &pos); - - if (GTK_IS_TEXT (text)) - gtk_text_thaw (GTK_TEXT (text)); - - gdk_threads_leave (); - - (*env)->ReleaseStringUTFChars (env, contents, str); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c deleted file mode 100644 index 658c8639bb7..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c +++ /dev/null @@ -1,183 +0,0 @@ -/* gtktextfieldpeer.c -- Native implementation of GtkTextFieldPeer - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkTextFieldPeer.h" - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_create - (JNIEnv *env, jobject obj) -{ - gpointer widget; - - gdk_threads_enter (); - widget = gtk_type_new (gtk_entry_get_type ()); - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, widget); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_connectHooks - (JNIEnv *env, jobject obj) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gtk_widget_realize (GTK_WIDGET (ptr)); - connect_awt_hook (env, obj, 2, - GTK_WIDGET (ptr)->window, - GTK_ENTRY (ptr)->text_area); - gdk_threads_leave (); -} - - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_old_create - (JNIEnv *env, jobject obj, jobject parent_obj, jstring text) -{ - GtkWidget *entry; - const char *str; - void *parent; - - parent = NSA_GET_PTR (env, parent_obj); - - str = (*env)->GetStringUTFChars (env, text, NULL); - gdk_threads_enter (); - - entry = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (entry), str); - - set_parent (entry, GTK_CONTAINER (parent)); - - gtk_widget_realize (entry); - connect_awt_hook (env, obj, 2, - entry->window, GTK_ENTRY (entry)->text_area); - - NSA_SET_PTR (env, obj, entry); - - gdk_threads_leave (); - (*env)->ReleaseStringUTFChars (env, text, str); -} - - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkEntryGetSize - (JNIEnv *env, jobject obj, jint cols, jintArray jdims) -{ - void *ptr; - jint *dims; - GtkRequisition myreq; - GtkEntry *entry; - - ptr = NSA_GET_PTR (env, obj); - dims = (*env)->GetIntArrayElements (env, jdims, 0); - - gdk_threads_enter (); - entry = GTK_ENTRY (ptr); - - gtk_signal_emit_by_name (GTK_OBJECT (entry), "size_request", &myreq); - - dims[0]=myreq.width-150 + (cols * - gdk_char_width (GTK_WIDGET (entry)->style->font, - 'W')); - dims[1]=myreq.height; - - gdk_threads_leave (); - - (*env)->ReleaseIntArrayElements (env, jdims, dims, 0); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_setEchoChar - (JNIEnv *env, jobject obj, jchar c) -{ - void *ptr; - GtkEntry *entry; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - - entry = GTK_ENTRY (ptr); - - if (c!=0) - { -/* gtk_entry_set_echo_char (entry, c); */ - gtk_entry_set_visibility (entry, FALSE); - } - else - gtk_entry_set_visibility (entry, TRUE); - - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkSetFont - (JNIEnv *env, jobject obj, jstring jname, jint size) -{ - const char *xlfd; -# define FBUFSZ 200 - char buf[FBUFSZ]; - void *ptr; - GdkFont * new_font; - GtkStyle * style; - GtkWidget * text; - - ptr = NSA_GET_PTR (env, obj); - text = GTK_WIDGET (ptr); - - xlfd = (*env)->GetStringUTFChars (env, jname, NULL); - snprintf(buf, FBUFSZ, xlfd, size); - (*env)->ReleaseStringUTFChars (env, jname, xlfd); - gdk_threads_enter(); - new_font = gdk_font_load(buf); /* FIXME: deprecated. Replacement? */ - if (new_font == NULL) - { - /* Fail quietly for now. */ - gdk_threads_leave(); - return; - } - style = gtk_style_copy (gtk_widget_get_style (text)); - style -> font = new_font; - gtk_widget_set_style (text , style); - /* FIXME: Documentation varies as to whether we should unref style. */ - gdk_threads_leave(); -} diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c deleted file mode 100644 index 1436badea5a..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c +++ /dev/null @@ -1,87 +0,0 @@ -/* gtktoolkit.c -- Native portion of GtkToolkit - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkToolkit.h" - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkToolkit_beep (JNIEnv *env, jobject obj) -{ - gdk_threads_enter (); - gdk_beep (); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkToolkit_sync (JNIEnv *env, jobject obj) -{ - gdk_threads_enter (); - gdk_flush (); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkToolkit_getScreenSizeDimensions -(JNIEnv *env, jobject obj, jintArray jdims) -{ - jint *dims = (*env)->GetIntArrayElements (env, jdims, 0); - - gdk_threads_enter (); - - dims[0] = gdk_screen_width (); - dims[1] = gdk_screen_height (); - - gdk_threads_leave (); - - (*env)->ReleaseIntArrayElements(env, jdims, dims, 0); -} - -JNIEXPORT jint JNICALL -Java_gnu_java_awt_peer_gtk_GtkToolkit_getScreenResolution (JNIEnv *env, - jobject obj) -{ - jint res; - - gdk_threads_enter (); - - res = gdk_screen_width () / (gdk_screen_width_mm () / 25.4); - - gdk_threads_leave (); - return res; -} - diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c deleted file mode 100644 index 3b7c06bf057..00000000000 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c +++ /dev/null @@ -1,365 +0,0 @@ -/* gtkwindowpeer.c -- Native implementation of GtkWindowPeer - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkWindowPeer.h" -#include "gnu_java_awt_peer_gtk_GtkFramePeer.h" -#include <gdk/gdkprivate.h> -#include <gdk/gdkx.h> - -static void setBounds (GtkWidget *, jint, jint, jint, jint); - -/* - * Make a new window (any type) - */ - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create - (JNIEnv *env, jobject obj, jint type) -{ - gpointer window; - GtkWidget *vbox, *layout; - - gdk_threads_enter (); - window = gtk_window_new (type); - - vbox = gtk_vbox_new (0, 0); - layout = gtk_layout_new (NULL, NULL); - gtk_box_pack_end (GTK_BOX (vbox), layout, 1, 1, 0); - gtk_container_add (GTK_CONTAINER (window), vbox); - - gtk_widget_show (layout); - gtk_widget_show (vbox); - - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, window); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setVisible - (JNIEnv *env, jobject obj, jboolean visible) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - - if (visible) - gtk_widget_show (GTK_WIDGET (ptr)); - else - gtk_widget_hide (GTK_WIDGET (ptr)); - - XFlush (GDK_DISPLAY ()); - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectHooks - (JNIEnv *env, jobject obj) -{ - void *ptr; - GtkWidget *layout; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - layout = GTK_WIDGET (gtk_container_children (GTK_CONTAINER (GTK_BIN (ptr)->child))->data); - gtk_widget_realize (layout); - connect_awt_hook (env, obj, 1, GTK_LAYOUT (layout)->bin_window); - - gtk_widget_realize (GTK_WIDGET (ptr)); - connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window); - gdk_threads_leave (); -} - -void -setup_window (JNIEnv *env, jobject obj, GtkWidget *window, jint width, - jint height, jboolean visible) -{ - GtkWidget *layout, *vbox; - gint x, y; - - gtk_window_set_policy (GTK_WINDOW (window), 1, 1, 0); - gtk_widget_set_usize (window, width, height); - - vbox = gtk_vbox_new (0, 0); - layout = gtk_layout_new (NULL, NULL); - gtk_box_pack_end (GTK_BOX (vbox), layout, 1, 1, 0); - gtk_container_add (GTK_CONTAINER (window), vbox); - gtk_widget_realize (layout); - connect_awt_hook (env, obj, 1, GTK_LAYOUT(layout)->bin_window); - gtk_widget_show (layout); - gtk_widget_show (vbox); - - gtk_widget_realize (window); -/* setBounds (window, x, y, width, height); */ - - connect_awt_hook (env, obj, 1, window->window); - set_visible (window, visible); -} - -/* - * Set a frame's title - */ - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setTitle - (JNIEnv *env, jobject obj, jstring title) -{ - void *ptr; - const char *str; - - ptr = NSA_GET_PTR (env, obj); - - str = (*env)->GetStringUTFChars (env, title, NULL); - - gdk_threads_enter (); - gtk_window_set_title (GTK_WINDOW (ptr), str); - gdk_threads_leave (); - - (*env)->ReleaseStringUTFChars (env, title, str); -} - -/* - * Set a window's resizing policy - */ - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setResizable - (JNIEnv *env, jobject obj, jboolean resize) -{ - void *ptr; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gtk_window_set_policy (GTK_WINDOW (ptr), resize, resize, 0); - gdk_threads_leave (); -} - - -/* - * Lower the z-level of a window. - */ - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toBack (JNIEnv *env, - jobject obj) -{ - void *ptr; - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gdk_window_lower (GTK_WIDGET (ptr)->window); - - XFlush (GDK_DISPLAY ()); - gdk_threads_leave (); -} - -/* - * Raise the z-level of a window. - */ - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toFront (JNIEnv *env, - jobject obj) -{ - void *ptr; - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - gdk_window_raise (GTK_WIDGET (ptr)->window); - - XFlush (GDK_DISPLAY ()); - gdk_threads_leave (); -} - -static void -setBounds (GtkWidget *widget, jint x, jint y, jint width, jint height) -{ - gint current_x, current_y; - gint origin_x, origin_y; - -/* gdk_window_get_root_origin (widget->window, ¤t_x, ¤t_y); */ - -/* if (current_x != x || current_y != y) */ -/* { */ -/* gdk_window_set_hints (widget->window, x, y, 0, 0, 0, 0, GDK_HINT_POS); */ -/* gdk_window_move (widget->window, x, y); */ -/* } */ - - gtk_widget_set_usize (widget, width, height); -} - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setBounds - (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height) -{ - void *ptr; - GtkWidget *widget; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - - widget = GTK_WIDGET (ptr); - setBounds (widget, x, y, width, height); - - gdk_threads_leave (); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarPeer - (JNIEnv *env, jobject obj, jobject menubar) -{ - void *wptr, *mptr; - GtkBox *box; - - if (!menubar) return; - - wptr = NSA_GET_PTR (env, obj); - mptr = NSA_GET_PTR (env, menubar); - - if (!mptr) return; /* this case should remove a menu */ - - gdk_threads_enter (); - box = GTK_BOX (GTK_BIN (wptr)->child); - gtk_box_pack_start (box, GTK_WIDGET (mptr), 0, 0, 0); - gdk_threads_leave (); -} - -JNIEXPORT jint JNICALL -Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight - (JNIEnv *env, jobject obj) -{ - void *ptr; - GList *children; - jint height = 0; - - ptr = NSA_GET_PTR (env, obj); - - gdk_threads_enter (); - children = gtk_container_children (GTK_CONTAINER (GTK_BIN (ptr)->child)); - if (g_list_length (children) == 2) - { - GtkWidget *menubar = GTK_WIDGET (children->data); - height = menubar->allocation.height; - - } - gdk_threads_leave (); - - return height; -} - - -void -gdk_window_get_root_geometry (GdkWindow *window, - gint *x, - gint *y, - gint *width, - gint *height, - gint *border, - gint *depth) -{ - GdkWindowPrivate *private; - Window xwindow; - Window xparent; - Window root; - Window *children; - unsigned int nchildren; - - g_return_if_fail (window != NULL); - - private = (GdkWindowPrivate*) window; - if (x) - *x = 0; - if (y) - *y = 0; - if (width) - *width = 0; - if (height) - *height = 0; - if (border) - *border = 0; - if (depth) - *depth = 0; - - if (private->destroyed) - return; - - while (private->parent && ((GdkWindowPrivate*) private->parent)->parent) - private = (GdkWindowPrivate*) private->parent; - if (private->destroyed) - return; - - xparent = private->xwindow; - do - { - xwindow = xparent; - if (!XQueryTree (private->xdisplay, xwindow, - &root, &xparent, - &children, &nchildren)) - return; - - if (children) - XFree (children); - } - while (xparent != root); - - if (xparent == root) - { - unsigned int ww, wh, wb, wd; - int wx, wy; - - if (XGetGeometry (private->xdisplay, xwindow, &root, &wx, &wy, &ww, &wh, &wb, &wd)) - { - if (x) - *x = wx; - if (y) - *y = wy; - if (width) - *width = ww; - if (height) - *height = wh; - if (border) - *border = wb; - if (depth) - *depth = wd; - } - } -} - diff --git a/libjava/jni/gtk-peer/gthread-jni.c b/libjava/jni/gtk-peer/gthread-jni.c deleted file mode 100644 index 9409720f9ac..00000000000 --- a/libjava/jni/gtk-peer/gthread-jni.c +++ /dev/null @@ -1,169 +0,0 @@ -/* gthread-jni.c -- JNI threading routines for GLIB - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include "gthread-jni.h" - -/* - * This code has been written specifically to be used with GTK+ 1.2. - * `Real' GLIB threading is not supported. We fake things where necessary. - * Once we know we're running on a 1.2 VM, we can write a real implementation. - */ - -static GMutex * -g_mutex_new_jni_impl (void) -{ - jclass obj_class; - jobject *mutex; - - obj_class = (*gdk_env)->FindClass (gdk_env, "java/lang/Object"); - if (obj_class == NULL) - return NULL; - - mutex = (jobject *) g_malloc (sizeof (jobject)); - *mutex = (*gdk_env)->AllocObject (gdk_env, obj_class); - if (*mutex == NULL) - { - g_free (mutex); - return NULL; - } - *mutex = (*gdk_env)->NewGlobalRef (gdk_env, *mutex); - - return (GMutex *) mutex; -} - -static void -g_mutex_lock_jni_impl (GMutex *mutex) -{ - if (mutex && mutex == gdk_threads_mutex) - (*gdk_env)->MonitorEnter (gdk_env, *((jobject *)mutex)); -} - -static gboolean -g_mutex_trylock_jni_impl (GMutex *mutex) -{ - return FALSE; -} - -static void -g_mutex_unlock_jni_impl (GMutex *mutex) -{ - if (mutex && mutex == gdk_threads_mutex) - (*gdk_env)->MonitorExit (gdk_env, *((jobject *)mutex)); -} - -static void -g_mutex_free_jni_impl (GMutex *mutex) -{ - if (mutex && mutex == gdk_threads_mutex) - { - (*gdk_env)->DeleteGlobalRef (gdk_env, *((jobject *)mutex)); - g_free (mutex); - } -} - -static GPrivate * -g_private_new_jni_impl (GDestroyNotify notify) -{ - return NULL; -} - -static gpointer -g_private_get_jni_impl (GPrivate *private) -{ - return NULL; -} - -static void -g_private_set_jni_impl (GPrivate *private, gpointer data) -{ -} - -static GCond * -g_cond_new_jni_impl () -{ - return NULL; -} - -static void -g_cond_signal_jni_impl (GCond *cond) -{ -} - -static void -g_cond_broadcast_jni_impl (GCond *cond) -{ -} - -static void -g_cond_wait_jni_impl (GCond *cond, GMutex *mutex) -{ -} - -static gboolean -g_cond_timed_wait_jni_impl (GCond *cond, GMutex *mutex) -{ - return FALSE; -} - -static void -g_cond_free_jni_impl (GCond *cond) -{ -} - -GThreadFunctions g_thread_jni_functions = -{ - g_mutex_new_jni_impl, /* mutex_new */ - g_mutex_lock_jni_impl, /* mutex_lock */ - g_mutex_trylock_jni_impl, /* mutex_try_lock */ - g_mutex_unlock_jni_impl, /* mutex_unlock */ - g_mutex_free_jni_impl, /* mutex_free */ - g_cond_new_jni_impl, /* cond_new */ - g_cond_signal_jni_impl, /* cond_signal */ - g_cond_broadcast_jni_impl, /* cond_broadcast */ - g_cond_wait_jni_impl, /* cond_wait */ - g_cond_timed_wait_jni_impl, /* cond_timed_wait */ - g_cond_free_jni_impl, /* cond_free */ - g_private_new_jni_impl, /* private_new */ - g_private_get_jni_impl, /* private_get */ - g_private_set_jni_impl /* private_set */ -}; - -void -gdk_threads_wake () -{ -} diff --git a/libjava/jni/gtk-peer/gthread-jni.h b/libjava/jni/gtk-peer/gthread-jni.h deleted file mode 100644 index 0bb5a56f1d8..00000000000 --- a/libjava/jni/gtk-peer/gthread-jni.h +++ /dev/null @@ -1,47 +0,0 @@ -/* gthread-jni.h - Copyright (C) 1998, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -#ifndef __GTHREADJNI_H__ -#define __GTHREADJNI_H__ - -#include <jni.h> -#include <glib.h> -#include "gtkpeer.h" - -extern GThreadFunctions g_thread_jni_functions; - -#endif /* __GTHREADJNI_H__ */ diff --git a/libjava/jni/gtk-peer/gtkpeer.h b/libjava/jni/gtk-peer/gtkpeer.h deleted file mode 100644 index fa1f19b5a1d..00000000000 --- a/libjava/jni/gtk-peer/gtkpeer.h +++ /dev/null @@ -1,299 +0,0 @@ -/* gtkpeer.h -- Some global variables and #defines - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -#include <gtk/gtk.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <config.h> -#include "native_state.h" - -#include <jni.h> - -#define RC_FILE ".classpath-gtkrc" -#define JVM_SUN -/* - #define JVM_JAPHAR -*/ - -#ifndef __GTKPEER_H__ -#define __GTKPEER_H__ - -#ifdef JVM_SUN - -extern struct state_table *native_state_table; - -#define NSA_INIT(env, clazz) \ - native_state_table = init_state_table (env, clazz) - -#define NSA_GET_PTR(env, obj) \ - get_state (env, obj, native_state_table) - -#define NSA_SET_PTR(env, obj, ptr) \ - set_state (env, obj, native_state_table, (void *)ptr) - -#define NSA_DEL_PTR(env, obj) \ - remove_state_slot (env, obj, native_state_table) - -#endif /* JVM_SUN */ - -struct graphics -{ - GdkDrawable *drawable; - GdkGC *gc; - GdkColormap *cm; - jint x_offset, y_offset; -}; - -#define AWT_DEFAULT_CURSOR 0 -#define AWT_CROSSHAIR_CURSOR 1 -#define AWT_TEXT_CURSOR 2 -#define AWT_WAIT_CURSOR 3 -#define AWT_SW_RESIZE_CURSOR 4 -#define AWT_SE_RESIZE_CURSOR 5 -#define AWT_NW_RESIZE_CURSOR 6 -#define AWT_NE_RESIZE_CURSOR 7 -#define AWT_N_RESIZE_CURSOR 8 -#define AWT_S_RESIZE_CURSOR 9 -#define AWT_W_RESIZE_CURSOR 10 -#define AWT_E_RESIZE_CURSOR 11 -#define AWT_HAND_CURSOR 12 -#define AWT_MOVE_CURSOR 13 - -#define SYNTHETIC_EVENT_MASK (1 << 10) - -#define AWT_SHIFT_MASK (1 << 0) -#define AWT_CTRL_MASK (1 << 1) -#define AWT_META_MASK (1 << 2) -#define AWT_ALT_MASK (1 << 3) - -#define AWT_BUTTON1_MASK (1 << 4) -#define AWT_BUTTON2_MASK AWT_ALT_MASK -#define AWT_BUTTON3_MASK AWT_META_MASK - -#define MULTI_CLICK_TIME 250 -/* as opposed to a MULTI_PASS_TIME :) */ - -#define AWT_MOUSE_CLICKED 500 -#define AWT_MOUSE_PRESSED 501 -#define AWT_MOUSE_RELEASED 502 -#define AWT_MOUSE_MOVED 503 -#define AWT_MOUSE_ENTERED 504 -#define AWT_MOUSE_EXITED 505 -#define AWT_MOUSE_DRAGGED 506 - -#define AWT_ADJUSTMENT_UNIT_INCREMENT 1 -#define AWT_ADJUSTMENT_UNIT_DECREMENT 2 -#define AWT_ADJUSTMENT_BLOCK_DECREMENT 3 -#define AWT_ADJUSTMENT_BLOCK_INCREMENT 4 -#define AWT_ADJUSTMENT_TRACK 5 - -#define AWT_SCROLLPANE_SCROLLBARS_AS_NEEDED 0 -#define AWT_SCROLLPANE_SCROLLBARS_ALWAYS 1 -#define AWT_SCROLLPANE_SCROLLBARS_NEVER 2 - -#define AWT_LABEL_LEFT 0 -#define AWT_LABEL_CENTER 1 -#define AWT_LABEL_RIGHT 2 - -#define AWT_TEXTAREA_SCROLLBARS_BOTH 0 -#define AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY 1 -#define AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY 2 - -#define AWT_ITEM_SELECTED 1 -#define AWT_ITEM_DESELECTED 2 - -#define AWT_KEY_TYPED 400 -#define AWT_KEY_PRESSED 401 -#define AWT_KEY_RELEASED 402 - -#define VK_UNDEFINED 0 -#define AWT_KEY_CHAR_UNDEFINED 0 - -#define VK_0 48 -#define VK_1 49 -#define VK_2 50 -#define VK_3 51 -#define VK_4 52 -#define VK_5 53 -#define VK_6 54 -#define VK_7 55 -#define VK_8 56 -#define VK_9 57 -#define VK_A 65 -#define VK_ACCEPT 30 -#define VK_ADD 107 -#define VK_ALT 18 -#define VK_B 66 -#define VK_BACK_QUOTE 192 -#define VK_BACK_SLASH 92 -#define VK_BACK_SPACE 8 -#define VK_C 67 -#define VK_CANCEL 3 -#define VK_CAPS_LOCK 20 -#define VK_CLEAR 12 -#define VK_CLOSE_BRACKET 93 -#define VK_COMMA 44 -#define VK_CONTROL 17 -#define VK_CONVERT 28 -#define VK_D 68 -#define VK_DECIMAL 110 -#define VK_DELETE 127 -#define VK_DIVIDE 111 -#define VK_DOWN 40 -#define VK_E 69 -#define VK_END 35 -#define VK_ENTER 10 -#define VK_ESCAPE 27 -#define VK_F 70 -#define VK_F1 112 -#define VK_F10 121 -#define VK_F11 122 -#define VK_F12 123 -#define VK_F2 113 -#define VK_F3 114 -#define VK_F4 115 -#define VK_F5 116 -#define VK_F6 117 -#define VK_F7 118 -#define VK_F8 119 -#define VK_F9 120 -#define VK_FINAL 24 -#define VK_G 71 -#define VK_H 72 -#define VK_HELP 156 -#define VK_HOME 36 -#define VK_I 73 -#define VK_INSERT 155 -#define VK_J 74 -#define VK_K 75 -#define VK_KANA 21 -#define VK_KANJI 25 -#define VK_L 76 -#define VK_LEFT 37 -#define VK_M 77 -#define VK_META 157 -#define VK_MODECHANGE 31 -#define VK_MULTIPLY 106 -#define VK_N 78 -#define VK_NONCONVERT 29 -#define VK_NUM_LOCK 144 -#define VK_NUMPAD0 96 -#define VK_NUMPAD1 97 -#define VK_NUMPAD2 98 -#define VK_NUMPAD3 99 -#define VK_NUMPAD4 100 -#define VK_NUMPAD5 101 -#define VK_NUMPAD6 102 -#define VK_NUMPAD7 103 -#define VK_NUMPAD8 104 -#define VK_NUMPAD9 105 -#define VK_O 79 -#define VK_OPEN_BRACKET 91 -#define VK_P 80 -#define VK_PAGE_DOWN 34 -#define VK_PAGE_UP 33 -#define VK_PAUSE 19 -#define VK_PERIOD 46 -#define VK_PRINTSCREEN 154 -#define VK_Q 81 -#define VK_QUOTE 222 -#define VK_R 82 -#define VK_RIGHT 39 -#define VK_S 83 -#define VK_SCROLL_LOCK 145 -#define VK_SEMICOLON 59 -#define VK_SEPARATOR 108 -#define VK_SHIFT 16 -#define VK_SLASH 47 -#define VK_SPACE 32 -#define VK_SUBTRACT 109 -#define VK_T 84 -#define VK_TAB 9 -#define VK_U 85 -#define VK_UP 38 -#define VK_V 86 -#define VK_W 87 -#define VK_X 88 -#define VK_Y 89 -#define VK_Z 90 - -#define AWT_FOCUS_LOST 1004 -#define AWT_FOCUS_GAINED 1005 - -extern jmethodID postActionEventID; -extern jmethodID postMenuActionEventID; -extern jmethodID postMouseEventID; -extern jmethodID postConfigureEventID; -extern jmethodID postExposeEventID; -extern jmethodID postKeyEventID; -extern jmethodID postFocusEventID; -extern jmethodID postAdjustmentEventID; -extern jmethodID postItemEventID; -extern jmethodID postListItemEventID; -extern jmethodID syncAttrsID; -extern jclass gdkColor; -extern jmethodID gdkColorID; -extern JNIEnv *gdk_env; - -void -gdk_window_get_root_geometry (GdkWindow *window, - gint *x, - gint *y, - gint *width, - gint *height, - gint *border, - gint *depth); - -void awt_event_handler (GdkEvent *event); - -void connect_awt_hook (JNIEnv *env, jobject peer_obj, int nwindows, ...); - -void set_visible (GtkWidget *widget, jboolean visible); -void set_parent (GtkWidget *widget, GtkContainer *parent); -GtkLayout *find_gtk_layout (GtkWidget *parent); -void setup_window (JNIEnv *env, jobject obj, GtkWidget *window, jint width, - jint height, jboolean visible); - -struct item_event_hook_info -{ - jobject peer_obj; - jobject item_obj; -}; - -#endif /* __GTKPEER_H */ diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/append/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/append/char/1.cc deleted file mode 100644 index a7fc70e7a04..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/append/char/1.cc +++ /dev/null @@ -1,164 +0,0 @@ -// 1999-07-08 bkoz - -// Copyright (C) 1999, 2003 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. - -// 21.3.5.3 basic_string::assign - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -bool test01(void) -{ - bool test = true; - typedef std::string::size_type csize_type; - typedef std::string::const_reference cref; - typedef std::string::reference ref; - csize_type npos = std::string::npos; - csize_type csz01, csz02; - - const char str_lit01[] = "point bolivar, texas"; - const std::string str01(str_lit01); - const std::string str02("corpus, "); - const std::string str03; - std::string str05; - - - // string& append(const string&) - str05 = str02; - str05.append(str05); - VERIFY( str05 == "corpus, corpus, " ); - str05.append(str01); - VERIFY( str05 == "corpus, corpus, point bolivar, texas" ); - str05.append(str03); - VERIFY( str05 == "corpus, corpus, point bolivar, texas" ); - std::string str06; - str06.append(str05); - VERIFY( str06 == str05 ); - - - // string& append(const string&, size_type pos, size_type n) - str05.erase(); - str06.erase(); - csz01 = str03.size(); - try { - str06.append(str03, csz01 + 1, 0); - VERIFY( false ); - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - csz01 = str01.size(); - try { - str06.append(str01, csz01 + 1, 0); - VERIFY( false ); - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - str05 = str02; - str05.append(str01, 0, std::string::npos); - VERIFY( str05 == "corpus, point bolivar, texas" ); - VERIFY( str05 != str02 ); - - str06 = str02; - str06.append(str01, 15, std::string::npos); - VERIFY( str06 == "corpus, texas" ); - VERIFY( str02 != str06 ); - - - // string& append(const char* s) - str05.erase(); - str06.erase(); - str05.append(""); - VERIFY( str05 == str03 ); - - str05.append(str_lit01); - VERIFY( str05 == str01 ); - - str06 = str02; - str06.append("corpus, "); - VERIFY( str06 == "corpus, corpus, " ); - - - // string& append(const char* s, size_type n) - str05.erase(); - str06.erase(); - str05.append("", 0); - VERIFY( str05.size() == 0 ); - VERIFY( str05 == str03 ); - - str05.append(str_lit01, sizeof(str_lit01) - 1); - VERIFY( str05 == str01 ); - - str06 = str02; - str06.append("corpus, ", 6); - VERIFY( str06 == "corpus, corpus" ); - - str06 = str02; - str06.append("corpus, ", 12); - VERIFY( str06 != "corpus, corpus, " ); - - - // string& append(size_type n, char c) - str05.erase(); - str06.erase(); - str05.append(0, 'a'); - VERIFY( str05 == str03 ); - str06.append(8, '.'); - VERIFY( str06 == "........" ); - - - // template<typename InputIter> - // string& append(InputIter first, InputIter last) - str05.erase(); - str06.erase(); - str05.append(str03.begin(), str03.end()); - VERIFY( str05 == str03 ); - - str06 = str02; - str06.append(str01.begin(), str01.begin() + str01.find('r')); - VERIFY( str06 == "corpus, point boliva" ); - VERIFY( str06 != str01 ); - VERIFY( str06 != str02 ); - - str05 = str01; - str05.append(str05.begin(), str05.begin() + str05.find('r')); - VERIFY( str05 == "point bolivar, texaspoint boliva" ); - VERIFY( str05 != str01 ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/append/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/append/wchar_t/1.cc deleted file mode 100644 index ea8cd17b954..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/append/wchar_t/1.cc +++ /dev/null @@ -1,164 +0,0 @@ -// 1999-07-08 bkoz - -// Copyright (C) 1999, 2003 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. - -// 21.3.5.3 basic_string::assign - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -bool test01(void) -{ - bool test = true; - typedef std::wstring::size_type csize_type; - typedef std::wstring::const_reference cref; - typedef std::wstring::reference ref; - csize_type npos = std::wstring::npos; - csize_type csz01, csz02; - - const wchar_t str_lit01[] = L"point bolivar, texas"; - const std::wstring str01(str_lit01); - const std::wstring str02(L"corpus, "); - const std::wstring str03; - std::wstring str05; - - - // wstring& append(const wstring&) - str05 = str02; - str05.append(str05); - VERIFY( str05 == L"corpus, corpus, " ); - str05.append(str01); - VERIFY( str05 == L"corpus, corpus, point bolivar, texas" ); - str05.append(str03); - VERIFY( str05 == L"corpus, corpus, point bolivar, texas" ); - std::wstring str06; - str06.append(str05); - VERIFY( str06 == str05 ); - - - // wstring& append(const wstring&, size_type pos, size_type n) - str05.erase(); - str06.erase(); - csz01 = str03.size(); - try { - str06.append(str03, csz01 + 1, 0); - VERIFY( false ); - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - csz01 = str01.size(); - try { - str06.append(str01, csz01 + 1, 0); - VERIFY( false ); - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - str05 = str02; - str05.append(str01, 0, std::wstring::npos); - VERIFY( str05 == L"corpus, point bolivar, texas" ); - VERIFY( str05 != str02 ); - - str06 = str02; - str06.append(str01, 15, std::wstring::npos); - VERIFY( str06 == L"corpus, texas" ); - VERIFY( str02 != str06 ); - - - // wstring& append(const wchar_t* s) - str05.erase(); - str06.erase(); - str05.append(L""); - VERIFY( str05 == str03 ); - - str05.append(str_lit01); - VERIFY( str05 == str01 ); - - str06 = str02; - str06.append(L"corpus, "); - VERIFY( str06 == L"corpus, corpus, " ); - - - // wstring& append(const wchar_t* s, size_type n) - str05.erase(); - str06.erase(); - str05.append(L"", 0); - VERIFY( str05.size() == 0 ); - VERIFY( str05 == str03 ); - - str05.append(str_lit01, sizeof(str_lit01) - 1); - VERIFY( str05 == str01 ); - - str06 = str02; - str06.append(L"corpus, ", 6); - VERIFY( str06 == L"corpus, corpus" ); - - str06 = str02; - str06.append(L"corpus, ", 12); - VERIFY( str06 != L"corpus, corpus, " ); - - - // wstring& append(size_type n, char c) - str05.erase(); - str06.erase(); - str05.append(0, L'a'); - VERIFY( str05 == str03 ); - str06.append(8, L'.'); - VERIFY( str06 == L"........" ); - - - // template<typename InputIter> - // wstring& append(InputIter first, InputIter last) - str05.erase(); - str06.erase(); - str05.append(str03.begin(), str03.end()); - VERIFY( str05 == str03 ); - - str06 = str02; - str06.append(str01.begin(), str01.begin() + str01.find(L'r')); - VERIFY( str06 == L"corpus, point boliva" ); - VERIFY( str06 != str01 ); - VERIFY( str06 != str02 ); - - str05 = str01; - str05.append(str05.begin(), str05.begin() + str05.find(L'r')); - VERIFY( str05 == L"point bolivar, texaspoint boliva" ); - VERIFY( str05 != str01 ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/assign/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/assign/char/1.cc deleted file mode 100644 index 735c61c86e0..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/assign/char/1.cc +++ /dev/null @@ -1,53 +0,0 @@ -// 2001-10-30 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 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. - -// 21.3.5 string modifiers - -#include <string> -#include <cstdio> -#include <testsuite_hooks.h> - -void -test01() -{ - bool test = true; - - using namespace std; - - const char* strlit = "../the long pier/Hanalei Bay/Kauai/Hawaii"; - string aux = strlit; - string::size_type i = aux.rfind("/"); - if (i != string::npos) - aux.assign(aux, i + 1, string::npos); - VERIFY(aux == "Hawaii"); - - aux = strlit; - i = aux.rfind("r/"); - if (i != string::npos) - aux.assign(aux, i + 1, string::npos); - VERIFY(aux.c_str()[9] == 'B'); - VERIFY(aux == "/Hanalei Bay/Kauai/Hawaii"); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/assign/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/assign/char/2.cc deleted file mode 100644 index 9783c45202c..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/assign/char/2.cc +++ /dev/null @@ -1,59 +0,0 @@ -// 2001-10-30 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 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. - -// 21.3.5 string modifiers - -#include <string> -#include <cstdio> -#include <testsuite_hooks.h> - -// assign(const basic_string& __str, size_type __pos, size_type __n) -void -test02() -{ - bool test = true; - - using namespace std; - - string one = "Selling England by the pound"; - string two = one; - string three = "Brilliant trees"; - - one.assign(one, 8, 100); - VERIFY( one == "England by the pound" ); - - one.assign(one, 8, 0); - VERIFY( one == "" ); - - one.assign(two, 8, 7); - VERIFY( one == "England" ); - - one.assign(three, 10, 100); - VERIFY( one == "trees" ); - - three.assign(one, 0, 3); - VERIFY( three == "tre" ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/assign/char/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/assign/char/3.cc deleted file mode 100644 index cfc35545da4..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/assign/char/3.cc +++ /dev/null @@ -1,61 +0,0 @@ -// 2001-10-30 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 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. - -// 21.3.5 string modifiers - -#include <string> -#include <cstdio> -#include <testsuite_hooks.h> - -// assign(const _CharT* __s, size_type __n) -// assign(const _CharT* __s) -void -test03() -{ - bool test = true; - - using namespace std; - - string one; - string two; - string three = two; - const char * source = "Selling England by the pound"; - - one.assign(source); - VERIFY( one == "Selling England by the pound" ); - - one.assign(source, 28); - VERIFY( one == "Selling England by the pound" ); - - two.assign(source, 7); - VERIFY( two == "Selling" ); - - one.assign(one.c_str() + 8, 20); - VERIFY( one == "England by the pound" ); - - one.assign(one.c_str() + 8, 6); - VERIFY( one == "by the" ); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/assign/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/assign/wchar_t/1.cc deleted file mode 100644 index 5f110598bb9..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/assign/wchar_t/1.cc +++ /dev/null @@ -1,53 +0,0 @@ -// 2001-10-30 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 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. - -// 21.3.5 string modifiers - -#include <string> -#include <cstdio> -#include <testsuite_hooks.h> - -void -test01() -{ - bool test = true; - - using namespace std; - - const wchar_t* strlit = L"../the long pier/Hanalei Bay/Kauai/Hawaii"; - wstring aux = strlit; - wstring::size_type i = aux.rfind(L"/"); - if (i != wstring::npos) - aux.assign(aux, i + 1, wstring::npos); - VERIFY(aux == L"Hawaii"); - - aux = strlit; - i = aux.rfind(L"r/"); - if (i != wstring::npos) - aux.assign(aux, i + 1, wstring::npos); - VERIFY(aux.c_str()[9] == L'B'); - VERIFY(aux == L"/Hanalei Bay/Kauai/Hawaii"); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/assign/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/assign/wchar_t/2.cc deleted file mode 100644 index 458204c522e..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/assign/wchar_t/2.cc +++ /dev/null @@ -1,59 +0,0 @@ -// 2001-10-30 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 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. - -// 21.3.5 string modifiers - -#include <string> -#include <cstdio> -#include <testsuite_hooks.h> - -// assign(const basic_string& __str, size_type __pos, size_type __n) -void -test02() -{ - bool test = true; - - using namespace std; - - wstring one = L"Selling England by the pound"; - wstring two = one; - wstring three = L"Brilliant trees"; - - one.assign(one, 8, 100); - VERIFY( one == L"England by the pound" ); - - one.assign(one, 8, 0); - VERIFY( one == L"" ); - - one.assign(two, 8, 7); - VERIFY( one == L"England" ); - - one.assign(three, 10, 100); - VERIFY( one == L"trees" ); - - three.assign(one, 0, 3); - VERIFY( three == L"tre" ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/assign/wchar_t/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/assign/wchar_t/3.cc deleted file mode 100644 index fc9b5a21eea..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/assign/wchar_t/3.cc +++ /dev/null @@ -1,61 +0,0 @@ -// 2001-10-30 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 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. - -// 21.3.5 string modifiers - -#include <string> -#include <cstdio> -#include <testsuite_hooks.h> - -// assign(const _CharT* __s, size_type __n) -// assign(const _CharT* __s) -void -test03() -{ - bool test = true; - - using namespace std; - - wstring one; - wstring two; - wstring three = two; - const wchar_t* source = L"Selling England by the pound"; - - one.assign(source); - VERIFY( one == L"Selling England by the pound" ); - - one.assign(source, 28); - VERIFY( one == L"Selling England by the pound" ); - - two.assign(source, 7); - VERIFY( two == L"Selling" ); - - one.assign(one.c_str() + 8, 20); - VERIFY( one == L"England by the pound" ); - - one.assign(one.c_str() + 8, 6); - VERIFY( one == L"by the" ); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/1.cc deleted file mode 100644 index 0a50ee7d9ed..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/1.cc +++ /dev/null @@ -1,199 +0,0 @@ -// 1999-05-11 bkoz - -// Copyright (C) 1999, 2002, 2003 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. - -// 21.3.3 string capacity - -#include <string> -#include <testsuite_hooks.h> - -template<typename T> - struct A { }; - -template<typename T> - bool - operator==(const A<T>& a, const A<T>& b) { return true; } - -template<typename T> - bool - operator<(const A<T>& a, const A<T>& b) { return true; } - -struct B { }; - -// char_traits specialization -namespace std -{ - template<> - struct char_traits<A<B> > - { - typedef A<B> char_type; - // Unsigned as wint_t in unsigned. - typedef unsigned long int_type; - typedef streampos pos_type; - typedef streamoff off_type; - typedef mbstate_t state_type; - - static void - assign(char_type& __c1, const char_type& __c2) - { __c1 = __c2; } - - static bool - eq(const char_type& __c1, const char_type& __c2) - { return __c1 == __c2; } - - static bool - lt(const char_type& __c1, const char_type& __c2) - { return __c1 < __c2; } - - static int - compare(const char_type* __s1, const char_type* __s2, size_t __n) - { - for (size_t __i = 0; __i < __n; ++__i) - if (!eq(__s1[__i], __s2[__i])) - return lt(__s1[__i], __s2[__i]) ? -1 : 1; - return 0; - } - - static size_t - length(const char_type* __s) - { - const char_type* __p = __s; - while (__p) - ++__p; - return (__p - __s); - } - - static const char_type* - find(const char_type* __s, size_t __n, const char_type& __a) - { - for (const char_type* __p = __s; size_t(__p - __s) < __n; ++__p) - if (*__p == __a) return __p; - return 0; - } - - static char_type* - move(char_type* __s1, const char_type* __s2, size_t __n) - { return (char_type*) memmove(__s1, __s2, __n * sizeof(char_type)); } - - static char_type* - copy(char_type* __s1, const char_type* __s2, size_t __n) - { return (char_type*) memcpy(__s1, __s2, __n * sizeof(char_type)); } - - static char_type* - assign(char_type* __s, size_t __n, char_type __a) - { - for (char_type* __p = __s; __p < __s + __n; ++__p) - assign(*__p, __a); - return __s; - } - - static char_type - to_char_type(const int_type& __c) - { return char_type(); } - - static int_type - to_int_type(const char_type& __c) { return int_type(); } - - static bool - eq_int_type(const int_type& __c1, const int_type& __c2) - { return __c1 == __c2; } - - static int_type - eof() { return static_cast<int_type>(-1); } - - static int_type - not_eof(const int_type& __c) - { return eq_int_type(__c, eof()) ? int_type(0) : __c; } - }; -} // namespace std - -void test01() -{ - bool test = true; - - // non POD types : resize, capacity, reserve - std::basic_string< A<B> > str02; - typedef std::basic_string< A<B> >::size_type size_type_o; - size_type_o sz03; - size_type_o sz04; - - sz03 = str02.capacity(); - str02.reserve(100); - sz04 = str02.capacity(); - VERIFY( sz04 >= sz03 ); - VERIFY( sz04 >= 100 ); - str02.reserve(); - sz03 = str02.capacity(); - VERIFY( sz03 >= 0 ); - - sz03 = str02.size() + 5; - str02.resize(sz03); - sz04 = str02.size(); - VERIFY( sz03 == sz04 ); - - sz03 = str02.size() - 5; - str02.resize(sz03); - sz04 = str02.size(); - VERIFY( sz03 == sz04 ); - - A<B> inst_obj; - std::basic_string<A<B> > str07(30, inst_obj); - std::basic_string<A<B> > str08 = str07; - str07 = str08 + str07; - VERIFY( str07.capacity() >= str07.size() ); - VERIFY( str08.capacity() >= str08.size() ); - - // non-POD types: size, length, max_size, clear(), empty() - bool b01 = str02.empty(); - VERIFY( b01 == true ); - sz03 = str02.size(); - sz04 = str02.length(); - VERIFY( sz03 == sz04 ); - str02.c_str(); - sz03 = str02.size(); - sz04 = str02.length(); - VERIFY( sz03 == sz04 ); - - sz03 = str02.max_size(); - VERIFY( sz03 >= sz04 ); - - sz03 = str02.size(); - str02.clear(); - b01 = str02.empty(); - VERIFY( b01 == true ); - sz04 = str02.size(); - VERIFY( sz03 >= sz04 ); -} - -#if !__GXX_WEAK__ -// Explicitly instantiate for systems with no COMDAT or weak support. -template - std::basic_string< A<B> >::size_type - std::basic_string< A<B> >::_Rep::_S_max_size; - -template - A<B> - std::basic_string< A<B> >::_Rep::_S_terminal; -#endif - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/1.cc deleted file mode 100644 index 6072898318a..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/1.cc +++ /dev/null @@ -1,102 +0,0 @@ -// 1999-05-11 bkoz - -// Copyright (C) 1999, 2002, 2003 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. - -// 21.3.3 string capacity - -#include <string> -#include <testsuite_hooks.h> - -void test01() -{ - // POD types : resize, capacity, reserve - bool test = true; - std::string str01; - typedef std::string::size_type size_type_s; - - size_type_s sz01 = str01.capacity(); - str01.reserve(100); - size_type_s sz02 = str01.capacity(); - VERIFY( sz02 >= sz01 ); - VERIFY( sz02 >= 100 ); - str01.reserve(); - sz01 = str01.capacity(); - VERIFY( sz01 >= 0 ); - - sz01 = str01.size() + 5; - str01.resize(sz01); - sz02 = str01.size(); - VERIFY( sz01 == sz02 ); - - sz01 = str01.size() - 5; - str01.resize(sz01); - sz02 = str01.size(); - VERIFY( sz01 == sz02 ); - - std::string str05(30, 'q'); - std::string str06 = str05; - str05 = str06 + str05; - VERIFY( str05.capacity() >= str05.size() ); - VERIFY( str06.capacity() >= str06.size() ); - - // POD types: size, length, max_size, clear(), empty() - bool b01; - std::string str011; - b01 = str01.empty(); - VERIFY( b01 == true ); - sz01 = str01.size(); - sz02 = str01.length(); - VERIFY( sz01 == sz02 ); - str01.c_str(); - sz01 = str01.size(); - sz02 = str01.length(); - VERIFY( sz01 == sz02 ); - - sz01 = str01.length(); - str01.c_str(); - str011 = str01 + "_addendum_"; - str01.c_str(); - sz02 = str01.length(); - VERIFY( sz01 == sz02 ); - sz02 = str011.length(); - VERIFY( sz02 > sz01 ); - - // trickster allocator issues involved with these: - std::string str3 = "8-chars_8-chars_"; - const char* p3 = str3.c_str(); - std::string str4 = str3 + "7-chars"; - const char* p4 = str3.c_str(); - - sz01 = str01.size(); - sz02 = str01.max_size(); - VERIFY( sz02 >= sz01 ); - - sz01 = str01.size(); - str01.clear(); - b01 = str01.empty(); - VERIFY( b01 == true ); - sz02 = str01.size(); - VERIFY( sz01 >= sz02 ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/2.cc deleted file mode 100644 index 731a9187065..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/2.cc +++ /dev/null @@ -1,43 +0,0 @@ -// 1999-05-11 bkoz - -// Copyright (C) 1999, 2002, 2003 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. - -// 21.3.3 string capacity - -#include <string> -#include <testsuite_hooks.h> - -// libstdc++/4548 -// http://gcc.gnu.org/ml/libstdc++/2001-11/msg00150.html -void test02() -{ - bool test = true; - - std::string str01 = "twelve chars"; - // str01 becomes shared - std::string str02 = str01; - str01.reserve(1); - VERIFY( str01.capacity() == 12 ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/1.cc deleted file mode 100644 index 18af608d7d1..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/1.cc +++ /dev/null @@ -1,102 +0,0 @@ -// 1999-05-11 bkoz - -// Copyright (C) 1999, 2002, 2003 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. - -// 21.3.3 string capacity - -#include <string> -#include <testsuite_hooks.h> - -void test01() -{ - // POD types : resize, capacity, reserve - bool test = true; - std::wstring str01; - typedef std::wstring::size_type size_type_s; - - size_type_s sz01 = str01.capacity(); - str01.reserve(100); - size_type_s sz02 = str01.capacity(); - VERIFY( sz02 >= sz01 ); - VERIFY( sz02 >= 100 ); - str01.reserve(); - sz01 = str01.capacity(); - VERIFY( sz01 >= 0 ); - - sz01 = str01.size() + 5; - str01.resize(sz01); - sz02 = str01.size(); - VERIFY( sz01 == sz02 ); - - sz01 = str01.size() - 5; - str01.resize(sz01); - sz02 = str01.size(); - VERIFY( sz01 == sz02 ); - - std::wstring str05(30, L'q'); - std::wstring str06 = str05; - str05 = str06 + str05; - VERIFY( str05.capacity() >= str05.size() ); - VERIFY( str06.capacity() >= str06.size() ); - - // POD types: size, length, max_size, clear(), empty() - bool b01; - std::wstring str011; - b01 = str01.empty(); - VERIFY( b01 == true ); - sz01 = str01.size(); - sz02 = str01.length(); - VERIFY( sz01 == sz02 ); - str01.c_str(); - sz01 = str01.size(); - sz02 = str01.length(); - VERIFY( sz01 == sz02 ); - - sz01 = str01.length(); - str01.c_str(); - str011 = str01 + L"_addendum_"; - str01.c_str(); - sz02 = str01.length(); - VERIFY( sz01 == sz02 ); - sz02 = str011.length(); - VERIFY( sz02 > sz01 ); - - // trickster allocator issues involved with these: - std::wstring str3 = L"8-chars_8-chars_"; - const wchar_t* p3 = str3.c_str(); - std::wstring str4 = str3 + L"7-chars"; - const wchar_t* p4 = str3.c_str(); - - sz01 = str01.size(); - sz02 = str01.max_size(); - VERIFY( sz02 >= sz01 ); - - sz01 = str01.size(); - str01.clear(); - b01 = str01.empty(); - VERIFY( b01 == true ); - sz02 = str01.size(); - VERIFY( sz01 >= sz02 ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/2.cc deleted file mode 100644 index 08aa2294bfa..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/2.cc +++ /dev/null @@ -1,43 +0,0 @@ -// 1999-05-11 bkoz - -// Copyright (C) 1999, 2002, 2003 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. - -// 21.3.3 string capacity - -#include <string> -#include <testsuite_hooks.h> - -// libstdc++/4548 -// http://gcc.gnu.org/ml/libstdc++/2001-11/msg00150.html -void test02() -{ - bool test = true; - - std::wstring str01 = L"twelve chars"; - // str01 becomes shared - std::wstring str02 = str01; - str01.reserve(1); - VERIFY( str01.capacity() == 12 ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/compare/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/compare/char/1.cc deleted file mode 100644 index 02b6b79037b..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/compare/char/1.cc +++ /dev/null @@ -1,136 +0,0 @@ -// 980930 bkoz work with libstdc++v3 - -// Copyright (C) 1998, 1999, 2003 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. - -// 21.3.6.8 basic_string::compare -// int compare(const basic_string& str) const; -// int compare(size_type pos1, size_type n1, const basic_string& str) const; -// int compare(size_type pos1, size_type n1, const basic_string& str, -// size_type pos2, size_type n2) const; -// int compare(const charT* s) const; -// int compare(size_type pos1, size_type n1, -// const charT* s, size_type n2 = npos) const; - -// NB compare should be thought of as a lexographical compare, ie how -// things would be sorted in a dictionary. - -#include <string> -#include <testsuite_hooks.h> - -enum want_value {lt=0, z=1, gt=2}; - -int -test_value(int result, want_value expected); - -int -test_value(int result, want_value expected) -{ - bool pass = false; - - switch (expected) { - case lt: - if (result < 0) - pass = true; - break; - case z: - if (!result) - pass = true; - break; - case gt: - if (result > 0) - pass = true; - break; - default: - pass = false; //should not get here - } - -#ifdef DEBUG_ASSERT - assert(pass); -#endif - - return 0; -} - - -int -test01() -{ - using namespace std; - - string str_0("costa rica"); - string str_1("costa marbella"); - string str_2; - - //sanity check - test_value(strcmp("costa marbella", "costa rica"), lt); - test_value(strcmp("costa rica", "costa rica"), z); - test_value(strcmp(str_1.data(), str_0.data()), lt); - test_value(strcmp(str_0.data(), str_1.data()), gt); - test_value(strncmp(str_1.data(), str_0.data(), 6), z); - test_value(strncmp(str_1.data(), str_0.data(), 14), lt); - test_value(memcmp(str_1.data(), str_0.data(), 6), z); - test_value(memcmp(str_1.data(), str_0.data(), 14), lt); - test_value(memcmp("costa marbella", "costa rica", 14), lt); - - // int compare(const basic_string& str) const; - test_value(str_0.compare(str_1), gt); //because r>m - test_value(str_1.compare(str_0), lt); //because m<r - str_2 = str_0; - test_value(str_2.compare(str_0), z); - str_2 = "cost"; - test_value(str_2.compare(str_0), lt); - str_2 = "costa ricans"; - test_value(str_2.compare(str_0), gt); - - // int compare(size_type pos1, size_type n1, const basic_string& str) const; - test_value(str_1.compare(0, 6, str_0), lt); - str_2 = "cost"; - test_value(str_1.compare(0, 4, str_2), z); - test_value(str_1.compare(0, 5, str_2), gt); - - // int compare(size_type pos1, size_type n1, const basic_string& str, - // size_type pos2, size_type n2) const; - test_value(str_1.compare(0, 6, str_0, 0, 6), z); - test_value(str_1.compare(0, 7, str_0, 0, 7), lt); - test_value(str_0.compare(0, 7, str_1, 0, 7), gt); - - // int compare(const charT* s) const; - test_value(str_0.compare("costa marbella"), gt); - test_value(str_1.compare("costa rica"), lt); - str_2 = str_0; - test_value(str_2.compare("costa rica"), z); - test_value(str_2.compare("cost"), gt); - test_value(str_2.compare("costa ricans"), lt); - - // int compare(size_type pos, size_type n1, const charT* str, - // size_type n2 = npos) const; - test_value(str_1.compare(0, 6, "costa rica", 0, 6), z); - test_value(str_1.compare(0, 7, "costa rica", 0, 7), lt); - test_value(str_0.compare(0, 7, "costa marbella", 0, 7), gt); - - return 0; -} - - -int -main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/compare/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/compare/wchar_t/1.cc deleted file mode 100644 index 25f8abdab97..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/compare/wchar_t/1.cc +++ /dev/null @@ -1,136 +0,0 @@ -// 980930 bkoz work with libstdc++v3 - -// Copyright (C) 1998, 1999, 2003 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. - -// 21.3.6.8 basic_string::compare -// int compare(const basic_string& str) const; -// int compare(size_type pos1, size_type n1, const basic_string& str) const; -// int compare(size_type pos1, size_type n1, const basic_string& str, -// size_type pos2, size_type n2) const; -// int compare(const charT* s) const; -// int compare(size_type pos1, size_type n1, -// const charT* s, size_type n2 = npos) const; - -// NB compare should be thought of as a lexographical compare, ie how -// things would be sorted in a dictionary. - -#include <string> -#include <testsuite_hooks.h> - -enum want_value {lt=0, z=1, gt=2}; - -int -test_value(int result, want_value expected); - -int -test_value(int result, want_value expected) -{ - bool pass = false; - - switch (expected) { - case lt: - if (result < 0) - pass = true; - break; - case z: - if (!result) - pass = true; - break; - case gt: - if (result > 0) - pass = true; - break; - default: - pass = false; //should not get here - } - -#ifdef DEBUG_ASSERT - assert(pass); -#endif - - return 0; -} - - -int -test01() -{ - using namespace std; - - wstring str_0(L"costa rica"); - wstring str_1(L"costa marbella"); - wstring str_2; - - //sanity check - test_value(wcscmp(L"costa marbella", L"costa rica"), lt); - test_value(wcscmp(L"costa rica", L"costa rica"), z); - test_value(wcscmp(str_1.data(), str_0.data()), lt); - test_value(wcscmp(str_0.data(), str_1.data()), gt); - test_value(wcsncmp(str_1.data(), str_0.data(), 6), z); - test_value(wcsncmp(str_1.data(), str_0.data(), 14), lt); - test_value(wmemcmp(str_1.data(), str_0.data(), 6), z); - test_value(wmemcmp(str_1.data(), str_0.data(), 14), lt); - test_value(wmemcmp(L"costa marbella", L"costa rica", 14), lt); - - // int compare(const basic_string& str) const; - test_value(str_0.compare(str_1), gt); //because r>m - test_value(str_1.compare(str_0), lt); //because m<r - str_2 = str_0; - test_value(str_2.compare(str_0), z); - str_2 = L"cost"; - test_value(str_2.compare(str_0), lt); - str_2 = L"costa ricans"; - test_value(str_2.compare(str_0), gt); - - // int compare(size_type pos1, size_type n1, const basic_string& str) const; - test_value(str_1.compare(0, 6, str_0), lt); - str_2 = L"cost"; - test_value(str_1.compare(0, 4, str_2), z); - test_value(str_1.compare(0, 5, str_2), gt); - - // int compare(size_type pos1, size_type n1, const basic_string& str, - // size_type pos2, size_type n2) const; - test_value(str_1.compare(0, 6, str_0, 0, 6), z); - test_value(str_1.compare(0, 7, str_0, 0, 7), lt); - test_value(str_0.compare(0, 7, str_1, 0, 7), gt); - - // int compare(const charT* s) const; - test_value(str_0.compare(L"costa marbella"), gt); - test_value(str_1.compare(L"costa rica"), lt); - str_2 = str_0; - test_value(str_2.compare(L"costa rica"), z); - test_value(str_2.compare(L"cost"), gt); - test_value(str_2.compare(L"costa ricans"), lt); - - // int compare(size_type pos, size_type n1, const charT* str, - // size_type n2 = npos) const; - test_value(str_1.compare(0, 6, L"costa rica", 0, 6), z); - test_value(str_1.compare(0, 7, L"costa rica", 0, 7), lt); - test_value(str_0.compare(0, 7, L"costa marbella", 0, 7), gt); - - return 0; -} - - -int -main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/1.cc deleted file mode 100644 index 3c92910f312..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/1.cc +++ /dev/null @@ -1,161 +0,0 @@ -// 1999-06-04 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.1 basic_string constructors. - -#include <new> -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -void test01(void) -{ - bool test = true; - typedef std::string::size_type csize_type; - typedef std::string::iterator citerator; - csize_type npos = std::string::npos; - csize_type csz01, csz02; - - const char str_lit01[] = "rodeo beach, marin"; - const std::string str01(str_lit01); - const std::string str02("baker beach, san francisco"); - - // basic_string(const string&, size_type pos = 0, siz_type n = npos, alloc) - csz01 = str01.size(); - try { - std::string str03(str01, csz01 + 1); - VERIFY( false ); - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - try { - std::string str03(str01, csz01); - VERIFY( str03.size() == 0 ); - VERIFY( str03.size() <= str03.capacity() ); - } - catch(...) { - VERIFY( false ); - } - - // basic_string(const char* s, size_type n, alloc) - csz01 = str01.max_size(); - // NB: As strlen(str_lit01) != csz01, this test is undefined. It - // should not crash, but what gets constructed is a bit arbitrary. - try { - std::string str03(str_lit01, csz01 + 1); - VERIFY( true ); - } - catch(std::length_error& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - // NB: As strlen(str_lit01) != csz01, this test is undefined. It - // should not crash, but what gets constructed is a bit arbitrary. - // The "maverick's" of all string objects. - try { - std::string str04(str_lit01, npos); - VERIFY( true ); - } - catch(std::length_error& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - // Build a maxsize - 1 lengthed string consisting of all A's - try { - std::string str03(csz01 - 1, 'A'); - VERIFY( str03.size() == csz01 - 1 ); - VERIFY( str03.size() <= str03.capacity() ); - } - // NB: bad_alloc is regrettable but entirely kosher for - // out-of-memory situations. - catch(std::bad_alloc& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - // basic_string(const char* s, const allocator& a = allocator()) - std::string str04(str_lit01); - VERIFY( str01 == str04 ); - - - // basic_string(size_type n, char c, const allocator& a = allocator()) - csz01 = str01.max_size(); - try { - std::string str03(csz01 + 1, 'z'); - VERIFY( false ); - } - catch(std::length_error& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - try { - std::string str04(npos, 'b'); // the "maverick's" of all string objects. - VERIFY( false ); - } - catch(std::length_error& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - try { - std::string str03(csz01 - 1, 'z'); - VERIFY( str03.size() != 0 ); - VERIFY( str03.size() <= str03.capacity() ); - } - // NB: bad_alloc is regrettable but entirely kosher for - // out-of-memory situations. - catch(std::bad_alloc& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - - // template<typename _InputIter> - // basic_string(_InputIter begin, _InputIter end, const allocator& a) - std::string str06(str01.begin(), str01.end()); - VERIFY( str06 == str01 ); -} - -int main() -{ - __gnu_cxx_test::set_memory_limits(); - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/2.cc deleted file mode 100644 index d6458a96712..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/2.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 1999-06-04 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.1 basic_string constructors. - -#include <string> -#include <testsuite_hooks.h> - -void test02() -{ - bool test = true; - - // template<typename _InputIter> - // basic_string(_InputIter begin, _InputIter end, const allocator& a) - // where _InputIter is integral [21.3.1 para 15] - std::string s(10,0); - VERIFY( s.size() == 10 ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/3.cc deleted file mode 100644 index 6f40dda1833..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/3.cc +++ /dev/null @@ -1,69 +0,0 @@ -// 1999-06-04 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.1 basic_string constructors. - -#include <new> -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -void test03() -{ - bool test = true; - const char* with_nulls = "This contains \0 a zero byte."; - - // These are tests to see how basic_string handles data with NUL - // bytes. Obviously basic_string(char*) will halt at the first one, but - // nothing else should. - std::string s1 (with_nulls, 28); - VERIFY( s1.size() == 28 ); - std::string s2 (s1); - VERIFY( s2.size() == 28 ); - - // Not defined, but libstdc++ throws an exception. - const char* bogus = 0; - try - { - std::string str1(bogus); - VERIFY( false ); - } - catch(std::exception& fail) - { - VERIFY( true ); - } - - // Not defined, but libstdc++ throws an exception. - try - { - std::string str2(bogus, 5); - VERIFY( false ); - } - catch(std::exception& fail) - { - VERIFY( true ); - } -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/4.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/4.cc deleted file mode 100644 index fe2f3213215..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/4.cc +++ /dev/null @@ -1,43 +0,0 @@ -// 1999-06-04 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.1 basic_string constructors. - -#include <string> -#include <testsuite_hooks.h> - -// http://gcc.gnu.org/ml/libstdc++/2002-06/msg00025.html -void test04() -{ - bool test = true; - - std::string str01("portofino"); - - std::string::reverse_iterator i1 = str01.rbegin(); - std::string::reverse_iterator i2 = str01.rend(); - std::string str02(i1, i2); - VERIFY( str02 == "onifotrop" ); -} - -int main() -{ - test04(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/5.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/5.cc deleted file mode 100644 index 4b2f4015854..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/5.cc +++ /dev/null @@ -1,44 +0,0 @@ -// 1999-06-04 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.1 basic_string constructors. - -#include <string> -#include <vector> -#include <testsuite_hooks.h> - -// libstdc++/8347 -void test05() -{ - bool test = true; - - std::vector<char> empty; - std::string empty2(empty.begin(), empty.end()); - - // libstdc++/8716 (same underlying situation, same fix) - char const * s = NULL; - std::string zero_length_built_with_NULL(s,0); -} - -int main() -{ - test05(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/1.cc deleted file mode 100644 index eeb3516d236..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/1.cc +++ /dev/null @@ -1,161 +0,0 @@ -// 1999-06-04 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.1 basic_string constructors. - -#include <new> -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -void test01(void) -{ - bool test = true; - typedef std::wstring::size_type csize_type; - typedef std::wstring::iterator citerator; - csize_type npos = std::wstring::npos; - csize_type csz01, csz02; - - const wchar_t str_lit01[] = L"rodeo beach, marin"; - const std::wstring str01(str_lit01); - const std::wstring str02(L"baker beach, san francisco"); - - // basic_string(const wstring&, size_type pos = 0, siz_type n = npos, alloc) - csz01 = str01.size(); - try { - std::wstring str03(str01, csz01 + 1); - VERIFY( false ); - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - try { - std::wstring str03(str01, csz01); - VERIFY( str03.size() == 0 ); - VERIFY( str03.size() <= str03.capacity() ); - } - catch(...) { - VERIFY( false ); - } - - // basic_string(const wchar_t* s, size_type n, alloc) - csz01 = str01.max_size(); - // NB: As strlen(str_lit01) != csz01, this test is undefined. It - // should not crash, but what gets constructed is a bit arbitrary. - try { - std::wstring str03(str_lit01, csz01 + 1); - VERIFY( true ); - } - catch(std::length_error& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - // NB: As strlen(str_lit01) != csz01, this test is undefined. It - // should not crash, but what gets constructed is a bit arbitrary. - // The "maverick's" of all string objects. - try { - std::wstring str04(str_lit01, npos); - VERIFY( true ); - } - catch(std::length_error& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - // Build a maxsize - 1 lengthed string consisting of all A's - try { - std::wstring str03(csz01 - 1, 'A'); - VERIFY( str03.size() == csz01 - 1 ); - VERIFY( str03.size() <= str03.capacity() ); - } - // NB: bad_alloc is regrettable but entirely kosher for - // out-of-memory situations. - catch(std::bad_alloc& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - // basic_string(const wchar_t* s, const allocator& a = allocator()) - std::wstring str04(str_lit01); - VERIFY( str01 == str04 ); - - - // basic_string(size_type n, char c, const allocator& a = allocator()) - csz01 = str01.max_size(); - try { - std::wstring str03(csz01 + 1, L'z'); - VERIFY( false ); - } - catch(std::length_error& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - try { - std::wstring str04(npos, L'b'); // the "maverick's" of all string objects. - VERIFY( false ); - } - catch(std::length_error& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - try { - std::wstring str03(csz01 - 1, L'z'); - VERIFY( str03.size() != 0 ); - VERIFY( str03.size() <= str03.capacity() ); - } - // NB: bad_alloc is regrettable but entirely kosher for - // out-of-memory situations. - catch(std::bad_alloc& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - - // template<typename _InputIter> - // basic_string(_InputIter begin, _InputIter end, const allocator& a) - std::wstring str06(str01.begin(), str01.end()); - VERIFY( str06 == str01 ); -} - -int main() -{ - __gnu_cxx_test::set_memory_limits(); - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/2.cc deleted file mode 100644 index 9eaf4ce2700..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/2.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 1999-06-04 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.1 basic_string constructors. - -#include <string> -#include <testsuite_hooks.h> - -void test02() -{ - bool test = true; - - // template<typename _InputIter> - // basic_string(_InputIter begin, _InputIter end, const allocator& a) - // where _InputIter is integral [21.3.1 para 15] - std::wstring s(10, 0); - VERIFY( s.size() == 10 ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/3.cc deleted file mode 100644 index 46b7287b0e0..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/3.cc +++ /dev/null @@ -1,69 +0,0 @@ -// 1999-06-04 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.1 basic_string constructors. - -#include <new> -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -void test03() -{ - bool test = true; - const wchar_t* with_nulls = L"This contains \0 a zero byte."; - - // These are tests to see how basic_string handles data with NUL - // bytes. Obviously basic_string(char*) will halt at the first one, but - // nothing else should. - std::wstring s1 (with_nulls, 28); - VERIFY( s1.size() == 28 ); - std::wstring s2 (s1); - VERIFY( s2.size() == 28 ); - - // Not defined, but libstdc++ throws an exception. - const wchar_t* bogus = 0; - try - { - std::wstring str1(bogus); - VERIFY( false ); - } - catch(std::exception& fail) - { - VERIFY( true ); - } - - // Not defined, but libstdc++ throws an exception. - try - { - std::wstring str2(bogus, 5); - VERIFY( false ); - } - catch(std::exception& fail) - { - VERIFY( true ); - } -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/4.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/4.cc deleted file mode 100644 index 87dab121eab..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/4.cc +++ /dev/null @@ -1,43 +0,0 @@ -// 1999-06-04 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.1 basic_string constructors. - -#include <string> -#include <testsuite_hooks.h> - -// http://gcc.gnu.org/ml/libstdc++/2002-06/msg00025.html -void test04() -{ - bool test = true; - - std::wstring str01(L"portofino"); - - std::wstring::reverse_iterator i1 = str01.rbegin(); - std::wstring::reverse_iterator i2 = str01.rend(); - std::wstring str02(i1, i2); - VERIFY( str02 == L"onifotrop" ); -} - -int main() -{ - test04(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/5.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/5.cc deleted file mode 100644 index d02dc9c8f4b..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/5.cc +++ /dev/null @@ -1,44 +0,0 @@ -// 1999-06-04 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.1 basic_string constructors. - -#include <string> -#include <vector> -#include <testsuite_hooks.h> - -// libstdc++/8347 -void test05() -{ - bool test = true; - - std::vector<wchar_t> empty; - std::wstring empty2(empty.begin(), empty.end()); - - // libstdc++/8716 (same underlying situation, same fix) - wchar_t const * s = NULL; - std::wstring zero_length_built_with_NULL(s,0); -} - -int main() -{ - test05(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/1.cc deleted file mode 100644 index 069aa278680..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/1.cc +++ /dev/null @@ -1,94 +0,0 @@ -// 1999-06-08 bkoz - -// Copyright (C) 1999, 2003 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. - -// 21.3.4 basic_string element access - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -bool test01(void) -{ - bool test = true; - typedef std::string::size_type csize_type; - typedef std::string::const_reference cref; - typedef std::string::reference ref; - csize_type npos = std::string::npos; - csize_type csz01, csz02; - - const std::string str01("tamarindo, costa rica"); - std::string str02("41st street beach, capitola, california"); - std::string str03; - - // const_reference operator[] (size_type pos) const; - csz01 = str01.size(); - cref cref1 = str01[csz01 - 1]; - VERIFY( cref1 == 'a' ); - cref cref2 = str01[csz01]; - VERIFY( cref2 == char() ); - - // reference operator[] (size_type pos); - csz02 = str02.size(); - ref ref1 = str02[csz02 - 1]; - VERIFY( ref1 == 'a' ); - ref ref2 = str02[1]; - VERIFY( ref2 == '1' ); - - // const_reference at(size_type pos) const; - csz01 = str01.size(); - cref cref3 = str01.at(csz01 - 1); - VERIFY( cref3 == 'a' ); - try { - cref cref4 = str01.at(csz01); - VERIFY( false ); // Should not get here, as exception thrown. - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - // reference at(size_type pos); - csz01 = str02.size(); - ref ref3 = str02.at(csz02 - 1); - VERIFY( ref3 == 'a' ); - try { - ref ref4 = str02.at(csz02); - VERIFY( false ); // Should not get here, as exception thrown. - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/2.cc deleted file mode 100644 index fbfa0136b67..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/2.cc +++ /dev/null @@ -1,115 +0,0 @@ -// 1999-06-08 bkoz - -// Copyright (C) 1999, 2003 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. - -// 21.3 template class basic_string - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -// Do a quick sanity check on known problems with element access and -// ref-counted strings. These should all pass, regardless of the -// underlying string implementation, of course. -bool test01(void) -{ - bool test = true; - typedef std::string::size_type csize_type; - typedef std::string::iterator siterator; - typedef std::string::reverse_iterator sriterator; - csize_type npos = std::string::npos; - csize_type csz01, csz02; - siterator it1; - sriterator rit1; - - std::string str01("montara beach, half moon bay"); - const std::string str02("ocean beach, san francisco"); - std::string str03; - - // 21.3 p 5 - - // References, pointers, and iterators referring to the elements of - // a basic_string may be invalidated by the following uses of that - // basic_string object: - - // ... - - // Susequent to any of the above uses except the forms of insert() - // and erase() which return iterators, the first call to non-const - // member functions operator[](), at(), begin(), rbegin(), end(), or - // rend() - - str03 = str01; - it1 = str01.begin(); - *it1 = 'x'; - VERIFY( str01[0] == 'x' ); - VERIFY( str03[0] == 'm' ); - - str03 = str01; - csz01 = str01.size(); - rit1 = str01.rbegin(); // NB: Pointing at one-past the end, so ... - *rit1 = 'z'; // ... but it's taken care of here - VERIFY( str01[csz01 - 1] == 'z' ); - VERIFY( str03[csz01 - 1] == 'y' ); - - str03 = str01; - csz01 = str01.size(); - std::string::reference r1 = str01.at(csz01 - 2); - VERIFY( str03 == str01 ); - r1 = 'd'; - VERIFY( str01[csz01 - 2] == 'd' ); - VERIFY( str03[csz01 - 2] == 'a' ); - - str03 = str01; - csz01 = str01.size(); - std::string::reference r2 = str01[csz01 - 3]; - VERIFY( str03 == str01 ); - r2 = 'w'; - VERIFY( str01[csz01 - 3] == 'w' ); - VERIFY( str03[csz01 - 3] == 'b' ); - - str03 = str01; - csz02 = str01.size(); - it1 = str01.end(); - VERIFY( str03 == str01 ); - --it1; - *it1 = 'q'; - VERIFY( str01[csz02 - 1] == 'q' ); - VERIFY( str03[csz02 - 1] == 'z' ); - - str03 = str01; - rit1 = str01.rend(); - VERIFY( str03 == str01 ); - --rit1; - *rit1 = 'p'; - VERIFY( str01[0] == 'p' ); - VERIFY( str03[0] == 'x' ); - - // need to also test for const begin/const end -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/3.cc deleted file mode 100644 index 426d0e39638..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/3.cc +++ /dev/null @@ -1,90 +0,0 @@ -// 1999-06-08 bkoz - -// Copyright (C) 1999, 2003 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. - -// 21.3 template class basic_string - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -// Do another sanity check, this time for member functions that return -// iterators, namely insert and erase. -bool test02(void) -{ - bool test = true; - typedef std::string::size_type csize_type; - typedef std::string::iterator siterator; - typedef std::string::reverse_iterator sriterator; - csize_type npos = std::string::npos; - csize_type csz01, csz02; - siterator it1; - sriterator rit1; - - const std::string str01("its beach, santa cruz"); - - std::string str02 = str01; - std::string str05 = str02; // optional, so that begin below causes a mutate - std::string::iterator p = str02.insert(str02.begin(), ' '); - std::string str03 = str02; - VERIFY( str03 == str02 ); - *p = '!'; - VERIFY( *str03.c_str() == ' ' ); - str03[0] = '@'; - VERIFY( str02[0] == '!' ); - VERIFY( *p == '!' ); - VERIFY( str02 != str05 ); - VERIFY( str02 != str03 ); - - std::string str10 = str01; - std::string::iterator p2 = str10.insert(str10.begin(), 'a'); - std::string str11 = str10; - *p2 = 'e'; - VERIFY( str11 != str10 ); - - std::string str06 = str01; - std::string str07 = str06; // optional, so that begin below causes a mutate - p = str06.erase(str06.begin()); - std::string str08 = str06; - VERIFY( str08 == str06 ); - *p = '!'; - VERIFY( *str08.c_str() == 't' ); - str08[0] = '@'; - VERIFY( str06[0] == '!' ); - VERIFY( *p == '!' ); - VERIFY( str06 != str07 ); - VERIFY( str06 != str08 ); - - std::string str12 = str01; - p2 = str12.erase(str12.begin(), str12.begin() + str12.size() - 1); - std::string str13 = str12; - *p2 = 'e'; - VERIFY( str12 != str13 ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/1.cc deleted file mode 100644 index 00394cf36c8..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/1.cc +++ /dev/null @@ -1,94 +0,0 @@ -// 1999-06-08 bkoz - -// Copyright (C) 1999, 2003 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. - -// 21.3.4 basic_string element access - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -bool test01(void) -{ - bool test = true; - typedef std::wstring::size_type csize_type; - typedef std::wstring::const_reference cref; - typedef std::wstring::reference ref; - csize_type npos = std::wstring::npos; - csize_type csz01, csz02; - - const std::wstring str01(L"tamarindo, costa rica"); - std::wstring str02(L"41st street beach, capitola, california"); - std::wstring str03; - - // const_reference operator[] (size_type pos) const; - csz01 = str01.size(); - cref cref1 = str01[csz01 - 1]; - VERIFY( cref1 == L'a' ); - cref cref2 = str01[csz01]; - VERIFY( cref2 == wchar_t() ); - - // reference operator[] (size_type pos); - csz02 = str02.size(); - ref ref1 = str02[csz02 - 1]; - VERIFY( ref1 == L'a' ); - ref ref2 = str02[1]; - VERIFY( ref2 == L'1' ); - - // const_reference at(size_type pos) const; - csz01 = str01.size(); - cref cref3 = str01.at(csz01 - 1); - VERIFY( cref3 == L'a' ); - try { - cref cref4 = str01.at(csz01); - VERIFY( false ); // Should not get here, as exception thrown. - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - // reference at(size_type pos); - csz01 = str02.size(); - ref ref3 = str02.at(csz02 - 1); - VERIFY( ref3 == L'a' ); - try { - ref ref4 = str02.at(csz02); - VERIFY( false ); // Should not get here, as exception thrown. - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/2.cc deleted file mode 100644 index 37aec1c93ce..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/2.cc +++ /dev/null @@ -1,115 +0,0 @@ -// 1999-06-08 bkoz - -// Copyright (C) 1999, 2003 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. - -// 21.3 template class basic_string - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -// Do a quick sanity check on known problems with element access and -// ref-counted strings. These should all pass, regardless of the -// underlying string implementation, of course. -bool test01(void) -{ - bool test = true; - typedef std::wstring::size_type csize_type; - typedef std::wstring::iterator siterator; - typedef std::wstring::reverse_iterator sriterator; - csize_type npos = std::wstring::npos; - csize_type csz01, csz02; - siterator it1; - sriterator rit1; - - std::wstring str01(L"montara beach, half moon bay"); - const std::wstring str02(L"ocean beach, san francisco"); - std::wstring str03; - - // 21.3 p 5 - - // References, pointers, and iterators referring to the elements of - // a basic_string may be invalidated by the following uses of that - // basic_string object: - - // ... - - // Susequent to any of the above uses except the forms of insert() - // and erase() which return iterators, the first call to non-const - // member functions operator[](), at(), begin(), rbegin(), end(), or - // rend() - - str03 = str01; - it1 = str01.begin(); - *it1 = L'x'; - VERIFY( str01[0] == L'x' ); - VERIFY( str03[0] == L'm' ); - - str03 = str01; - csz01 = str01.size(); - rit1 = str01.rbegin(); // NB: Pointing at one-past the end, so ... - *rit1 = L'z'; // ... but it's taken care of here - VERIFY( str01[csz01 - 1] == L'z' ); - VERIFY( str03[csz01 - 1] == L'y' ); - - str03 = str01; - csz01 = str01.size(); - std::wstring::reference r1 = str01.at(csz01 - 2); - VERIFY( str03 == str01 ); - r1 = L'd'; - VERIFY( str01[csz01 - 2] == L'd' ); - VERIFY( str03[csz01 - 2] == L'a' ); - - str03 = str01; - csz01 = str01.size(); - std::wstring::reference r2 = str01[csz01 - 3]; - VERIFY( str03 == str01 ); - r2 = L'w'; - VERIFY( str01[csz01 - 3] == L'w' ); - VERIFY( str03[csz01 - 3] == L'b' ); - - str03 = str01; - csz02 = str01.size(); - it1 = str01.end(); - VERIFY( str03 == str01 ); - --it1; - *it1 = L'q'; - VERIFY( str01[csz02 - 1] == L'q' ); - VERIFY( str03[csz02 - 1] == L'z' ); - - str03 = str01; - rit1 = str01.rend(); - VERIFY( str03 == str01 ); - --rit1; - *rit1 = L'p'; - VERIFY( str01[0] == L'p' ); - VERIFY( str03[0] == L'x' ); - - // need to also test for const begin/const end -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/3.cc deleted file mode 100644 index b7710382ca8..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/3.cc +++ /dev/null @@ -1,90 +0,0 @@ -// 1999-06-08 bkoz - -// Copyright (C) 1999, 2003 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. - -// 21.3 template class basic_string - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -// Do another sanity check, this time for member functions that return -// iterators, namely insert and erase. -bool test02(void) -{ - bool test = true; - typedef std::wstring::size_type csize_type; - typedef std::wstring::iterator siterator; - typedef std::wstring::reverse_iterator sriterator; - csize_type npos = std::wstring::npos; - csize_type csz01, csz02; - siterator it1; - sriterator rit1; - - const std::wstring str01(L"its beach, santa cruz"); - - std::wstring str02 = str01; - std::wstring str05 = str02; // optional, so that begin below causes a mutate - std::wstring::iterator p = str02.insert(str02.begin(), L' '); - std::wstring str03 = str02; - VERIFY( str03 == str02 ); - *p = L'!'; - VERIFY( *str03.c_str() == L' ' ); - str03[0] = L'@'; - VERIFY( str02[0] == L'!' ); - VERIFY( *p == L'!' ); - VERIFY( str02 != str05 ); - VERIFY( str02 != str03 ); - - std::wstring str10 = str01; - std::wstring::iterator p2 = str10.insert(str10.begin(), L'a'); - std::wstring str11 = str10; - *p2 = L'e'; - VERIFY( str11 != str10 ); - - std::wstring str06 = str01; - std::wstring str07 = str06; // optional, so that begin below causes a mutate - p = str06.erase(str06.begin()); - std::wstring str08 = str06; - VERIFY( str08 == str06 ); - *p = L'!'; - VERIFY( *str08.c_str() == L't' ); - str08[0] = L'@'; - VERIFY( str06[0] == L'!' ); - VERIFY( *p == L'!' ); - VERIFY( str06 != str07 ); - VERIFY( str06 != str08 ); - - std::wstring str12 = str01; - p2 = str12.erase(str12.begin(), str12.begin() + str12.size() - 1); - std::wstring str13 = str12; - *p2 = L'e'; - VERIFY( str12 != str13 ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/find/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/find/char/1.cc deleted file mode 100644 index e59f577374a..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/find/char/1.cc +++ /dev/null @@ -1,198 +0,0 @@ -// 1999-06-09 bkoz - -// Copyright (C) 1994, 1999, 2000, 2003 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. - -// 21.3.6.1 basic_string find - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -bool test01(void) -{ - bool test = true; - typedef std::string::size_type csize_type; - typedef std::string::const_reference cref; - typedef std::string::reference ref; - csize_type npos = std::string::npos; - csize_type csz01, csz02; - - const char str_lit01[] = "mave"; - const std::string str01("mavericks, santa cruz"); - std::string str02(str_lit01); - std::string str03("s, s"); - std::string str04; - - // size_type find(const string&, size_type pos = 0) const; - csz01 = str01.find(str01); - VERIFY( csz01 == 0 ); - csz01 = str01.find(str01, 4); - VERIFY( csz01 == npos ); - csz01 = str01.find(str02, 0); - VERIFY( csz01 == 0 ); - csz01 = str01.find(str02, 3); - VERIFY( csz01 == npos ); - csz01 = str01.find(str03, 0); - VERIFY( csz01 == 8 ); - csz01 = str01.find(str03, 3); - VERIFY( csz01 == 8 ); - csz01 = str01.find(str03, 12); - VERIFY( csz01 == npos ); - - // An empty string consists of no characters - // therefore it should be found at every point in a string, - // except beyond the end - csz01 = str01.find(str04, 0); - VERIFY( csz01 == 0 ); - csz01 = str01.find(str04, 5); - VERIFY( csz01 == 5 ); - csz01 = str01.find(str04, str01.size()); - VERIFY( csz01 == str01.size() ); - csz01 = str01.find(str04, str01.size()+1); - VERIFY( csz01 == npos ); - - // size_type find(const char* s, size_type pos, size_type n) const; - csz01 = str01.find(str_lit01, 0, 3); - VERIFY( csz01 == 0 ); - csz01 = str01.find(str_lit01, 3, 0); - VERIFY( csz01 == 3 ); - - // size_type find(const char* s, size_type pos = 0) const; - csz01 = str01.find(str_lit01); - VERIFY( csz01 == 0 ); - csz01 = str01.find(str_lit01, 3); - VERIFY( csz01 == npos ); - - // size_type find(char c, size_type pos = 0) const; - csz01 = str01.find('z'); - csz02 = str01.size() - 1; - VERIFY( csz01 == csz02 ); - csz01 = str01.find('/'); - VERIFY( csz01 == npos ); - - // size_type find_first_of(const string&, size_type pos = 0) const; - std::string str05("xena rulez"); - csz01 = str01.find_first_of(str01); - VERIFY( csz01 == 0 ); - csz01 = str01.find_first_of(str01, 4); - VERIFY( csz01 == 4 ); - csz01 = str01.find_first_of(str02, 0); - VERIFY( csz01 == 0 ); - csz01 = str01.find_first_of(str02, 3); - VERIFY( csz01 == 3 ); - csz01 = str01.find_first_of(str03, 0); - VERIFY( csz01 == 8 ); - csz01 = str01.find_first_of(str03, 3); - VERIFY( csz01 == 8 ); - csz01 = str01.find_first_of(str03, 12); - VERIFY( csz01 == 16 ); - csz01 = str01.find_first_of(str05, 0); - VERIFY( csz01 == 1 ); - csz01 = str01.find_first_of(str05, 4); - VERIFY( csz01 == 4 ); - - // An empty string consists of no characters - // therefore it should be found at every point in a string, - // except beyond the end - // However, str1.find_first_of(str2,pos) finds the first character in - // str1 (starting at pos) that exists in str2, which is none for empty str2 - csz01 = str01.find_first_of(str04, 0); - VERIFY( csz01 == npos ); - csz01 = str01.find_first_of(str04, 5); - VERIFY( csz01 == npos ); - - // size_type find_first_of(const char* s, size_type pos, size_type n) const; - csz01 = str01.find_first_of(str_lit01, 0, 3); - VERIFY( csz01 == 0 ); - csz01 = str01.find_first_of(str_lit01, 3, 0); - VERIFY( csz01 == npos ); - - // size_type find_first_of(const char* s, size_type pos = 0) const; - csz01 = str01.find_first_of(str_lit01); - VERIFY( csz01 == 0 ); - csz01 = str01.find_first_of(str_lit01, 3); - VERIFY( csz01 == 3 ); - - // size_type find_first_of(char c, size_type pos = 0) const; - csz01 = str01.find_first_of('z'); - csz02 = str01.size() - 1; - VERIFY( csz01 == csz02 ); - - // size_type find_last_of(const string& str, size_type pos = 0) const; - // size_type find_last_of(const char* s, size_type pos, size_type n) const; - // size_type find_last_of(const char* s, size_type pos = 0) const; - // size_type find_last_of(char c, size_type pos = 0) const; - -#if 1 -// from tstring.cc, from jason merrill, et. al. - std::string x; - std::string::size_type pos; - pos = x.find_last_not_of('X'); - VERIFY( pos == npos ); - pos = x.find_last_not_of("XYZ"); - VERIFY( pos == npos ); - - std::string y("a"); - pos = y.find_last_not_of('X'); - VERIFY( pos == 0 ); - pos = y.find_last_not_of('a'); - VERIFY( pos == npos ); - pos = y.find_last_not_of("XYZ"); - VERIFY( pos == 0 ); - pos = y.find_last_not_of("a"); - VERIFY( pos == npos ); - - std::string z("ab"); - pos = z.find_last_not_of('X'); - VERIFY( pos == 1 ); - pos = z.find_last_not_of("XYZ"); - VERIFY( pos == 1 ); - pos = z.find_last_not_of('b'); - VERIFY( pos == 0 ); - pos = z.find_last_not_of("Xb"); - VERIFY( pos == 0 ); - pos = z.find_last_not_of("Xa"); - VERIFY( pos == 1 ); - pos = z.find_last_of("ab"); - VERIFY( pos == 1 ); - pos = z.find_last_of("Xa"); - VERIFY( pos == 0 ); - pos = z.find_last_of("Xb"); - VERIFY( pos == 1 ); - pos = z.find_last_of("XYZ"); - VERIFY( pos == std::string::npos ); - pos = z.find_last_of('a'); - VERIFY( pos == 0 ); - pos = z.find_last_of('b'); - VERIFY( pos == 1 ); - pos = z.find_last_of('X'); - VERIFY( pos == std::string::npos ); -#endif - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/find/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/find/wchar_t/1.cc deleted file mode 100644 index 4cd643ebcf5..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/find/wchar_t/1.cc +++ /dev/null @@ -1,198 +0,0 @@ -// 1999-06-09 bkoz - -// Copyright (C) 1994, 1999, 2000, 2003 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. - -// 21.3.6.1 basic_string find - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -bool test01(void) -{ - bool test = true; - typedef std::wstring::size_type csize_type; - typedef std::wstring::const_reference cref; - typedef std::wstring::reference ref; - csize_type npos = std::wstring::npos; - csize_type csz01, csz02; - - const wchar_t str_lit01[] = L"mave"; - const std::wstring str01(L"mavericks, santa cruz"); - std::wstring str02(str_lit01); - std::wstring str03(L"s, s"); - std::wstring str04; - - // size_type find(const wstring&, size_type pos = 0) const; - csz01 = str01.find(str01); - VERIFY( csz01 == 0 ); - csz01 = str01.find(str01, 4); - VERIFY( csz01 == npos ); - csz01 = str01.find(str02, 0); - VERIFY( csz01 == 0 ); - csz01 = str01.find(str02, 3); - VERIFY( csz01 == npos ); - csz01 = str01.find(str03, 0); - VERIFY( csz01 == 8 ); - csz01 = str01.find(str03, 3); - VERIFY( csz01 == 8 ); - csz01 = str01.find(str03, 12); - VERIFY( csz01 == npos ); - - // An empty string consists of no characters - // therefore it should be found at every point in a string, - // except beyond the end - csz01 = str01.find(str04, 0); - VERIFY( csz01 == 0 ); - csz01 = str01.find(str04, 5); - VERIFY( csz01 == 5 ); - csz01 = str01.find(str04, str01.size()); - VERIFY( csz01 == str01.size() ); - csz01 = str01.find(str04, str01.size()+1); - VERIFY( csz01 == npos ); - - // size_type find(const wchar_t* s, size_type pos, size_type n) const; - csz01 = str01.find(str_lit01, 0, 3); - VERIFY( csz01 == 0 ); - csz01 = str01.find(str_lit01, 3, 0); - VERIFY( csz01 == 3 ); - - // size_type find(const wchar_t* s, size_type pos = 0) const; - csz01 = str01.find(str_lit01); - VERIFY( csz01 == 0 ); - csz01 = str01.find(str_lit01, 3); - VERIFY( csz01 == npos ); - - // size_type find(wchar_t c, size_type pos = 0) const; - csz01 = str01.find(L'z'); - csz02 = str01.size() - 1; - VERIFY( csz01 == csz02 ); - csz01 = str01.find(L'/'); - VERIFY( csz01 == npos ); - - // size_type find_first_of(const wstring&, size_type pos = 0) const; - std::wstring str05(L"xena rulez"); - csz01 = str01.find_first_of(str01); - VERIFY( csz01 == 0 ); - csz01 = str01.find_first_of(str01, 4); - VERIFY( csz01 == 4 ); - csz01 = str01.find_first_of(str02, 0); - VERIFY( csz01 == 0 ); - csz01 = str01.find_first_of(str02, 3); - VERIFY( csz01 == 3 ); - csz01 = str01.find_first_of(str03, 0); - VERIFY( csz01 == 8 ); - csz01 = str01.find_first_of(str03, 3); - VERIFY( csz01 == 8 ); - csz01 = str01.find_first_of(str03, 12); - VERIFY( csz01 == 16 ); - csz01 = str01.find_first_of(str05, 0); - VERIFY( csz01 == 1 ); - csz01 = str01.find_first_of(str05, 4); - VERIFY( csz01 == 4 ); - - // An empty string consists of no characters - // therefore it should be found at every point in a string, - // except beyond the end - // However, str1.find_first_of(str2,pos) finds the first character in - // str1 (starting at pos) that exists in str2, which is none for empty str2 - csz01 = str01.find_first_of(str04, 0); - VERIFY( csz01 == npos ); - csz01 = str01.find_first_of(str04, 5); - VERIFY( csz01 == npos ); - - // size_type find_first_of(const wchar_t* s, size_type pos, size_type n) const; - csz01 = str01.find_first_of(str_lit01, 0, 3); - VERIFY( csz01 == 0 ); - csz01 = str01.find_first_of(str_lit01, 3, 0); - VERIFY( csz01 == npos ); - - // size_type find_first_of(const char* s, size_type pos = 0) const; - csz01 = str01.find_first_of(str_lit01); - VERIFY( csz01 == 0 ); - csz01 = str01.find_first_of(str_lit01, 3); - VERIFY( csz01 == 3 ); - - // size_type find_first_of(wchar_t c, size_type pos = 0) const; - csz01 = str01.find_first_of(L'z'); - csz02 = str01.size() - 1; - VERIFY( csz01 == csz02 ); - - // size_type find_last_of(const wstring& str, size_type pos = 0) const; - // size_type find_last_of(const wchar_t* s, size_type pos, size_type n) const; - // size_type find_last_of(const wchar_t* s, size_type pos = 0) const; - // size_type find_last_of(wchar_t c, size_type pos = 0) const; - -#if 1 -// from tstring.cc, from jason merrill, et. al. - std::wstring x; - std::wstring::size_type pos; - pos = x.find_last_not_of(L'X'); - VERIFY( pos == npos ); - pos = x.find_last_not_of(L"XYZ"); - VERIFY( pos == npos ); - - std::wstring y(L"a"); - pos = y.find_last_not_of(L'X'); - VERIFY( pos == 0 ); - pos = y.find_last_not_of(L'a'); - VERIFY( pos == npos ); - pos = y.find_last_not_of(L"XYZ"); - VERIFY( pos == 0 ); - pos = y.find_last_not_of(L"a"); - VERIFY( pos == npos ); - - std::wstring z(L"ab"); - pos = z.find_last_not_of(L'X'); - VERIFY( pos == 1 ); - pos = z.find_last_not_of(L"XYZ"); - VERIFY( pos == 1 ); - pos = z.find_last_not_of(L'b'); - VERIFY( pos == 0 ); - pos = z.find_last_not_of(L"Xb"); - VERIFY( pos == 0 ); - pos = z.find_last_not_of(L"Xa"); - VERIFY( pos == 1 ); - pos = z.find_last_of(L"ab"); - VERIFY( pos == 1 ); - pos = z.find_last_of(L"Xa"); - VERIFY( pos == 0 ); - pos = z.find_last_of(L"Xb"); - VERIFY( pos == 1 ); - pos = z.find_last_of(L"XYZ"); - VERIFY( pos == std::wstring::npos ); - pos = z.find_last_of(L'a'); - VERIFY( pos == 0 ); - pos = z.find_last_of(L'b'); - VERIFY( pos == 1 ); - pos = z.find_last_of(L'X'); - VERIFY( pos == std::wstring::npos ); -#endif - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/insert/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/insert/char/1.cc deleted file mode 100644 index a6052e2170b..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/insert/char/1.cc +++ /dev/null @@ -1,195 +0,0 @@ -// 1999-06-03 bkoz - -// Copyright (C) 1999, 2003 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. - -// 21.3.5.4 basic_string::insert - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -int test01(void) -{ - bool test = true; - typedef std::string::size_type csize_type; - typedef std::string::iterator citerator; - csize_type npos = std::string::npos; - csize_type csz01, csz02; - - const std::string str01("rodeo beach, marin"); - const std::string str02("baker beach, san francisco"); - std::string str03; - - // string& insert(size_type p1, const string& str, size_type p2, size_type n) - // requires: - // 1) p1 <= size() - // 2) p2 <= str.size() - // 3) rlen = min(n, str.size() - p2) - // throws: - // 1) out_of_range if p1 > size() || p2 > str.size() - // 2) length_error if size() >= npos - rlen - // effects: - // replaces *this with new string of length size() + rlen such that - // nstr[0] to nstr[p1] == thisstr[0] to thisstr[p1] - // nstr[p1 + 1] to nstr[p1 + rlen] == str[p2] to str[p2 + rlen] - // nstr[p1 + 1 + rlen] to nstr[...] == thisstr[p1 + 1] to thisstr[...] - str03 = str01; - csz01 = str03.size(); - csz02 = str02.size(); - try { - str03.insert(csz01 + 1, str02, 0, 5); - VERIFY( false ); - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - str03 = str01; - csz01 = str03.size(); - csz02 = str02.size(); - try { - str03.insert(0, str02, csz02 + 1, 5); - VERIFY( false ); - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - csz01 = str01.max_size(); - try { - std::string str04(csz01, 'b'); - str03 = str04; - csz02 = str02.size(); - try { - str03.insert(0, str02, 0, 5); - VERIFY( false ); - } - catch(std::length_error& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - } - catch(std::bad_alloc& failure){ - VERIFY( true ); - } - catch(std::exception& failure){ - VERIFY( false ); - } - - str03 = str01; - csz01 = str03.size(); - csz02 = str02.size(); - str03.insert(13, str02, 0, 12); - VERIFY( str03 == "rodeo beach, baker beach,marin" ); - - str03 = str01; - csz01 = str03.size(); - csz02 = str02.size(); - str03.insert(0, str02, 0, 12); - VERIFY( str03 == "baker beach,rodeo beach, marin" ); - - str03 = str01; - csz01 = str03.size(); - csz02 = str02.size(); - str03.insert(csz01, str02, 0, csz02); - VERIFY( str03 == "rodeo beach, marinbaker beach, san francisco" ); - - // string& insert(size_type __p, const string& string); - // insert(p1, str, 0, npos) - str03 = str01; - csz01 = str03.size(); - csz02 = str02.size(); - str03.insert(csz01, str02); - VERIFY( str03 == "rodeo beach, marinbaker beach, san francisco" ); - - str03 = str01; - csz01 = str03.size(); - csz02 = str02.size(); - str03.insert(0, str02); - VERIFY( str03 == "baker beach, san franciscorodeo beach, marin" ); - - // string& insert(size_type __p, const char* s, size_type n); - // insert(p1, string(s,n)) - str03 = str02; - csz01 = str03.size(); - str03.insert(0, "-break at the bridge", 20); - VERIFY( str03 == "-break at the bridgebaker beach, san francisco" ); - - // string& insert(size_type __p, const char* s); - // insert(p1, string(s)) - str03 = str02; - str03.insert(0, "-break at the bridge"); - VERIFY( str03 == "-break at the bridgebaker beach, san francisco" ); - - // string& insert(size_type __p, size_type n, char c) - // insert(p1, string(n,c)) - str03 = str02; - csz01 = str03.size(); - str03.insert(csz01, 5, 'z'); - VERIFY( str03 == "baker beach, san franciscozzzzz" ); - - // iterator insert(iterator p, char c) - // inserts a copy of c before the character referred to by p - str03 = str02; - citerator cit01 = str03.begin(); - str03.insert(cit01, 'u'); - VERIFY( str03 == "ubaker beach, san francisco" ); - - // iterator insert(iterator p, size_type n, char c) - // inserts n copies of c before the character referred to by p - str03 = str02; - cit01 = str03.begin(); - str03.insert(cit01, 5, 'u'); - VERIFY( str03 == "uuuuubaker beach, san francisco" ); - - // template<inputit> - // void - // insert(iterator p, inputit first, inputit, last) - // ISO-14882: defect #7 part 1 clarifies this member function to be: - // insert(p - begin(), string(first,last)) - str03 = str02; - csz01 = str03.size(); - str03.insert(str03.begin(), str01.begin(), str01.end()); - VERIFY( str03 == "rodeo beach, marinbaker beach, san francisco" ); - - str03 = str02; - csz01 = str03.size(); - str03.insert(str03.end(), str01.begin(), str01.end()); - VERIFY( str03 == "baker beach, san franciscorodeo beach, marin" ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - __gnu_cxx_test::set_memory_limits(); - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/insert/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/insert/char/2.cc deleted file mode 100644 index 80b0cee58b7..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/insert/char/2.cc +++ /dev/null @@ -1,87 +0,0 @@ -// 1999-06-03 bkoz - -// Copyright (C) 1999, 2003 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. - -// 21.3.5.4 basic_string::insert - -#include <string> -#include <testsuite_hooks.h> - -// More -// string& insert(size_type __p, const char* s, size_type n); -// string& insert(size_type __p, const char* s); -// but now s points inside the _Rep -int test02(void) -{ - bool test = true; - - std::string str01; - const char* title = "Everything was beautiful, and nothing hurt"; - // Increasing size: str01 is reallocated every time. - str01 = title; - str01.insert(0, str01.c_str() + str01.size() - 4, 4); - VERIFY( str01 == "hurtEverything was beautiful, and nothing hurt" ); - str01 = title; - str01.insert(0, str01.c_str(), 5); - VERIFY( str01 == "EveryEverything was beautiful, and nothing hurt" ); - str01 = title; - str01.insert(10, str01.c_str() + 4, 6); - VERIFY( str01 == "Everythingything was beautiful, and nothing hurt" ); - str01 = title; - str01.insert(15, str01.c_str(), 10); - VERIFY( str01 == "Everything was Everythingbeautiful, and nothing hurt" ); - str01 = title; - str01.insert(15, str01.c_str() + 11, 13); - VERIFY( str01 == "Everything was was beautifulbeautiful, and nothing hurt" ); - str01 = title; - str01.insert(0, str01.c_str()); - VERIFY( str01 == "Everything was beautiful, and nothing hurt" - "Everything was beautiful, and nothing hurt"); - // Again: no reallocations. - str01 = title; - str01.insert(0, str01.c_str() + str01.size() - 4, 4); - VERIFY( str01 == "hurtEverything was beautiful, and nothing hurt" ); - str01 = title; - str01.insert(0, str01.c_str(), 5); - VERIFY( str01 == "EveryEverything was beautiful, and nothing hurt" ); - str01 = title; - str01.insert(10, str01.c_str() + 4, 6); - VERIFY( str01 == "Everythingything was beautiful, and nothing hurt" ); - str01 = title; - str01.insert(15, str01.c_str(), 10); - VERIFY( str01 == "Everything was Everythingbeautiful, and nothing hurt" ); - str01 = title; - str01.insert(15, str01.c_str() + 11, 13); - VERIFY( str01 == "Everything was was beautifulbeautiful, and nothing hurt" ); - str01 = title; - str01.insert(0, str01.c_str()); - VERIFY( str01 == "Everything was beautiful, and nothing hurt" - "Everything was beautiful, and nothing hurt"); - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/insert/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/insert/wchar_t/1.cc deleted file mode 100644 index 96f71b0839e..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/insert/wchar_t/1.cc +++ /dev/null @@ -1,195 +0,0 @@ -// 1999-06-03 bkoz - -// Copyright (C) 1999, 2003 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. - -// 21.3.5.4 basic_string::insert - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -int test01(void) -{ - bool test = true; - typedef std::wstring::size_type csize_type; - typedef std::wstring::iterator citerator; - csize_type npos = std::wstring::npos; - csize_type csz01, csz02; - - const std::wstring str01(L"rodeo beach, marin"); - const std::wstring str02(L"baker beach, san francisco"); - std::wstring str03; - - // wstring& insert(size_type p1, const wstring& str, size_type p2, size_type n) - // requires: - // 1) p1 <= size() - // 2) p2 <= str.size() - // 3) rlen = min(n, str.size() - p2) - // throws: - // 1) out_of_range if p1 > size() || p2 > str.size() - // 2) length_error if size() >= npos - rlen - // effects: - // replaces *this with new wstring of length size() + rlen such that - // nstr[0] to nstr[p1] == thisstr[0] to thisstr[p1] - // nstr[p1 + 1] to nstr[p1 + rlen] == str[p2] to str[p2 + rlen] - // nstr[p1 + 1 + rlen] to nstr[...] == thisstr[p1 + 1] to thisstr[...] - str03 = str01; - csz01 = str03.size(); - csz02 = str02.size(); - try { - str03.insert(csz01 + 1, str02, 0, 5); - VERIFY( false ); - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - str03 = str01; - csz01 = str03.size(); - csz02 = str02.size(); - try { - str03.insert(0, str02, csz02 + 1, 5); - VERIFY( false ); - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - csz01 = str01.max_size(); - try { - std::wstring str04(csz01, L'b'); - str03 = str04; - csz02 = str02.size(); - try { - str03.insert(0, str02, 0, 5); - VERIFY( false ); - } - catch(std::length_error& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - } - catch(std::bad_alloc& failure){ - VERIFY( true ); - } - catch(std::exception& failure){ - VERIFY( false ); - } - - str03 = str01; - csz01 = str03.size(); - csz02 = str02.size(); - str03.insert(13, str02, 0, 12); - VERIFY( str03 == L"rodeo beach, baker beach,marin" ); - - str03 = str01; - csz01 = str03.size(); - csz02 = str02.size(); - str03.insert(0, str02, 0, 12); - VERIFY( str03 == L"baker beach,rodeo beach, marin" ); - - str03 = str01; - csz01 = str03.size(); - csz02 = str02.size(); - str03.insert(csz01, str02, 0, csz02); - VERIFY( str03 == L"rodeo beach, marinbaker beach, san francisco" ); - - // wstring& insert(size_type __p, const wstring& wstr); - // insert(p1, str, 0, npos) - str03 = str01; - csz01 = str03.size(); - csz02 = str02.size(); - str03.insert(csz01, str02); - VERIFY( str03 == L"rodeo beach, marinbaker beach, san francisco" ); - - str03 = str01; - csz01 = str03.size(); - csz02 = str02.size(); - str03.insert(0, str02); - VERIFY( str03 == L"baker beach, san franciscorodeo beach, marin" ); - - // wstring& insert(size_type __p, const wchar_t* s, size_type n); - // insert(p1, wstring(s,n)) - str03 = str02; - csz01 = str03.size(); - str03.insert(0, L"-break at the bridge", 20); - VERIFY( str03 == L"-break at the bridgebaker beach, san francisco" ); - - // wstring& insert(size_type __p, const wchar_t* s); - // insert(p1, wstring(s)) - str03 = str02; - str03.insert(0, L"-break at the bridge"); - VERIFY( str03 == L"-break at the bridgebaker beach, san francisco" ); - - // wstring& insert(size_type __p, size_type n, wchar_t c) - // insert(p1, wstring(n,c)) - str03 = str02; - csz01 = str03.size(); - str03.insert(csz01, 5, L'z'); - VERIFY( str03 == L"baker beach, san franciscozzzzz" ); - - // iterator insert(iterator p, wchar_t c) - // inserts a copy of c before the character referred to by p - str03 = str02; - citerator cit01 = str03.begin(); - str03.insert(cit01, L'u'); - VERIFY( str03 == L"ubaker beach, san francisco" ); - - // iterator insert(iterator p, size_type n, wchar_t c) - // inserts n copies of c before the character referred to by p - str03 = str02; - cit01 = str03.begin(); - str03.insert(cit01, 5, L'u'); - VERIFY( str03 == L"uuuuubaker beach, san francisco" ); - - // template<inputit> - // void - // insert(iterator p, inputit first, inputit, last) - // ISO-14882: defect #7 part 1 clarifies this member function to be: - // insert(p - begin(), wstring(first,last)) - str03 = str02; - csz01 = str03.size(); - str03.insert(str03.begin(), str01.begin(), str01.end()); - VERIFY( str03 == L"rodeo beach, marinbaker beach, san francisco" ); - - str03 = str02; - csz01 = str03.size(); - str03.insert(str03.end(), str01.begin(), str01.end()); - VERIFY( str03 == L"baker beach, san franciscorodeo beach, marin" ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - __gnu_cxx_test::set_memory_limits(); - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/insert/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/insert/wchar_t/2.cc deleted file mode 100644 index 04cc454e14b..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/insert/wchar_t/2.cc +++ /dev/null @@ -1,87 +0,0 @@ -// 1999-06-03 bkoz - -// Copyright (C) 1999, 2003 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. - -// 21.3.5.4 basic_string::insert - -#include <string> -#include <testsuite_hooks.h> - -// More -// wstring& insert(size_type __p, const wchar_t* s, size_type n); -// wstring& insert(size_type __p, const wchar_t* s); -// but now s points inside the _Rep -int test02(void) -{ - bool test = true; - - std::wstring str01; - const wchar_t* title = L"Everything was beautiful, and nothing hurt"; - // Increasing size: str01 is reallocated every time. - str01 = title; - str01.insert(0, str01.c_str() + str01.size() - 4, 4); - VERIFY( str01 == L"hurtEverything was beautiful, and nothing hurt" ); - str01 = title; - str01.insert(0, str01.c_str(), 5); - VERIFY( str01 == L"EveryEverything was beautiful, and nothing hurt" ); - str01 = title; - str01.insert(10, str01.c_str() + 4, 6); - VERIFY( str01 == L"Everythingything was beautiful, and nothing hurt" ); - str01 = title; - str01.insert(15, str01.c_str(), 10); - VERIFY( str01 == L"Everything was Everythingbeautiful, and nothing hurt" ); - str01 = title; - str01.insert(15, str01.c_str() + 11, 13); - VERIFY( str01 == L"Everything was was beautifulbeautiful, and nothing hurt" ); - str01 = title; - str01.insert(0, str01.c_str()); - VERIFY( str01 == L"Everything was beautiful, and nothing hurt" - L"Everything was beautiful, and nothing hurt"); - // Again: no reallocations. - str01 = title; - str01.insert(0, str01.c_str() + str01.size() - 4, 4); - VERIFY( str01 == L"hurtEverything was beautiful, and nothing hurt" ); - str01 = title; - str01.insert(0, str01.c_str(), 5); - VERIFY( str01 == L"EveryEverything was beautiful, and nothing hurt" ); - str01 = title; - str01.insert(10, str01.c_str() + 4, 6); - VERIFY( str01 == L"Everythingything was beautiful, and nothing hurt" ); - str01 = title; - str01.insert(15, str01.c_str(), 10); - VERIFY( str01 == L"Everything was Everythingbeautiful, and nothing hurt" ); - str01 = title; - str01.insert(15, str01.c_str() + 11, 13); - VERIFY( str01 == L"Everything was was beautifulbeautiful, and nothing hurt" ); - str01 = title; - str01.insert(0, str01.c_str()); - VERIFY( str01 == L"Everything was beautiful, and nothing hurt" - L"Everything was beautiful, and nothing hurt"); - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/1.cc deleted file mode 100644 index 4b862322653..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/1.cc +++ /dev/null @@ -1,171 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.7.9 inserters and extractors - -// NB: This file is predicated on sstreams, istreams, and ostreams -// working, not to mention other major details like char_traits, and -// all of the string class. - -#include <string> -#include <stdexcept> -#include <sstream> -#include <fstream> -#include <iostream> -#include <testsuite_hooks.h> - -bool test01(void) -{ - bool test = true; - typedef std::string::size_type csize_type; - typedef std::string::const_reference cref; - typedef std::string::reference ref; - csize_type npos = std::string::npos; - csize_type csz01, csz02; - - const std::string str01("sailing grand traverse bay\n" - "\t\t\t from Elk Rapids to the point reminds me of miles"); - const std::string str02("sailing"); - const std::string str03("grand"); - const std::string str04("traverse"); - const std::string str05; - std::string str10; - - // istream& operator>>(istream&, string&) - std::istringstream istrs01(str01); - istrs01 >> str10; - VERIFY( str10 == str02 ); - try - { - std::istringstream::int_type i01 = istrs01.peek(); //a-boo - VERIFY( std::istringstream::traits_type::to_char_type(i01) == ' ' ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - istrs01.clear(); - istrs01 >> str10; - VERIFY( str10 == str03 ); - istrs01.clear(); - istrs01 >> str10; - VERIFY( str10 == str04 ); // sentry picks out the white spaces. . - - std::istringstream istrs02(str05); // empty - istrs02 >> str10; - VERIFY( str10 == str04 ); - - // istream& getline(istream&, string&, char) - // istream& getline(istream&, string&) - try - { - istrs01.clear(); - getline(istrs01, str10); - VERIFY( !istrs01.fail() ); - VERIFY( !istrs01.eof() ); - VERIFY( istrs01.good() ); - VERIFY( str10 == " bay" ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - try - { - istrs01.clear(); - getline(istrs01, str10,'\t'); - VERIFY( !istrs01.fail() ); - VERIFY( !istrs01.eof() ); - VERIFY( istrs01.good() ); - VERIFY( str10 == str05 ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - try - { - istrs01.clear(); - getline(istrs01, str10,'\t'); - VERIFY( !istrs01.fail() ); - VERIFY( !istrs01.eof() ); - VERIFY( istrs01.good() ); - VERIFY( str10 == str05 ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - try - { - istrs01.clear(); - getline(istrs01, str10, '.'); - VERIFY( !istrs01.fail() ); - VERIFY( istrs01.eof() ); - VERIFY( !istrs01.good() ); - VERIFY( str10 == "\t from Elk Rapids to the point reminds me of miles" ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - try - { - getline(istrs02, str10); - VERIFY( istrs02.fail() ); - VERIFY( istrs02.eof() ); - VERIFY( str10 =="\t from Elk Rapids to the point reminds me of miles" ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - // ostream& operator<<(ostream&, const basic_string&) - std::ostringstream ostrs01; - try - { - ostrs01 << str01; - VERIFY( ostrs01.str() == str01 ); - } - catch(std::exception& fail) - { - VERIFY( false ); - } - - std::string hello_world; - std::cout << hello_world; - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/4.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/4.cc deleted file mode 100644 index 55eecc19a28..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/4.cc +++ /dev/null @@ -1,69 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.7.9 inserters and extractors - -// NB: This file is predicated on sstreams, istreams, and ostreams -// working, not to mention other major details like char_traits, and -// all of the string class. - -#include <string> -#include <sstream> -#include <testsuite_hooks.h> - -// testing basic_stringbuf::xsputn via stress testing with large strings -// based on a bug report libstdc++ 9 -void test04(int size) -{ - bool test = true; - std::string str(size, 's'); - int expected_size = 2 * (size + 1); - std::ostringstream oss(str); - - // sanity checks - VERIFY( str.size() == size ); - VERIFY( oss.good() ); - - // stress test - oss << str << std::endl; - if (!oss.good()) - test = false; - - oss << str << std::endl; - if (!oss.good()) - test = false; - - VERIFY( str.size() == size ); - VERIFY( oss.good() ); - std::string str_tmp = oss.str(); - VERIFY( str_tmp.size() == expected_size ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif -} - -int main() -{ - test04(1); // expected_size == 4 - test04(1000); // expected_size == 2002 - test04(10000); // expected_size == 20002 - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/5.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/5.cc deleted file mode 100644 index 8e24f5b55b7..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/5.cc +++ /dev/null @@ -1,90 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.7.9 inserters and extractors - -// NB: This file is predicated on sstreams, istreams, and ostreams -// working, not to mention other major details like char_traits, and -// all of the string class. - -#include <string> -#include <fstream> -#include <iostream> -#include <testsuite_hooks.h> - -// testing basic_filebuf::xsputn via stress testing with large strings -// based on a bug report libstdc++ 9 -// mode == out -void test05(int size) -{ - bool test = true; - const char filename[] = "inserters_extractors-1.txt"; - const char fillc = 'f'; - std::ofstream ofs(filename); - std::string str(size, fillc); - - // sanity checks - VERIFY( str.size() == size ); - VERIFY( ofs.good() ); - - // stress test - ofs << str << std::endl; - if (!ofs.good()) - test = false; - - ofs << str << std::endl; - if (!ofs.good()) - test = false; - - VERIFY( str.size() == size ); - VERIFY( ofs.good() ); - - ofs.close(); - - // sanity check on the written file - std::ifstream ifs(filename); - int count = 0; - char c; - while (count <= (2 * size) + 4) - { - ifs >> c; - if (ifs.good() && c == fillc) - { - ++count; - c = '0'; - } - else - break; - } - - VERIFY( count == 2 * size ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif -} - -int main() -{ - test05(1); - test05(1000); - test05(10000); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/6.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/6.cc deleted file mode 100644 index 5d426259752..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/6.cc +++ /dev/null @@ -1,65 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.7.9 inserters and extractors - -// NB: This file is predicated on sstreams, istreams, and ostreams -// working, not to mention other major details like char_traits, and -// all of the string class. - -#include <string> -#include <sstream> -#include <testsuite_hooks.h> - -// istringstream/stringbuf extractor properly size buffer based on -// actual, not allocated contents (string.size() vs. string.capacity()). -// http://gcc.gnu.org/ml/libstdc++/1999-q4/msg00049.html -void test06(void) -{ - bool test = true; - - typedef std::string::size_type size_type; - std::string str01("@silent"); - size_type i01 = str01.size(); - size_type i02 = str01.capacity(); - str01.erase(0, 1); - size_type i03 = str01.size(); - size_type i04 = str01.capacity(); - VERIFY( i01 - 1 == i03 ); - VERIFY( i02 >= i04 ); - - std::istringstream is(str01); - std::string str02; - is >> str02 >> std::ws; - size_type i05 = str02.size(); - size_type i06 = str02.capacity(); - VERIFY( i05 == i03 ); - VERIFY( i06 <= i04 ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif -} - -int main() -{ - test06(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/7.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/7.cc deleted file mode 100644 index 7e6116ec148..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/7.cc +++ /dev/null @@ -1,57 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.7.9 inserters and extractors - -// NB: This file is predicated on sstreams, istreams, and ostreams -// working, not to mention other major details like char_traits, and -// all of the string class. - -#include <string> -#include <sstream> -#include <testsuite_hooks.h> - -// http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00085.html -// istream::operator>>(string) -// sets failbit -// NB: this is a defect in the standard. -void test07(void) -{ - bool test = true; - const std::string name("z6.cc"); - std::istringstream iss (name); - int i = 0; - std::string s; - while (iss >> s) - ++i; - - VERIFY( i < 3 ); - VERIFY( static_cast<bool>(iss.rdstate() & std::ios_base::failbit) ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif -} - -int main() -{ - test07(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/8.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/8.cc deleted file mode 100644 index bdc848e8055..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/8.cc +++ /dev/null @@ -1,53 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.7.9 inserters and extractors - -// NB: This file is predicated on sstreams, istreams, and ostreams -// working, not to mention other major details like char_traits, and -// all of the string class. - -#include <string> -#include <sstream> -#include <iomanip> -#include <testsuite_hooks.h> - -// libstdc++/1019 -void test08() -{ - using namespace std; - - bool test = true; - istringstream istrm("enero:2001"); - int year; - char sep; - string month; - - istrm >> setw(5) >> month >> sep >> year; - VERIFY( month.size() == 5 ); - VERIFY( sep == ':' ); - VERIFY( year == 2001 ); -} - -int main() -{ - test08(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/9.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/9.cc deleted file mode 100644 index fb201c26929..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/9.cc +++ /dev/null @@ -1,56 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.7.9 inserters and extractors - -// NB: This file is predicated on sstreams, istreams, and ostreams -// working, not to mention other major details like char_traits, and -// all of the string class. - -#include <string> -#include <sstream> -#include <iomanip> -#include <testsuite_hooks.h> - -// libstdc++/2830 -void test09() -{ - bool test = true; - std::string blanks( 3, '\0'); - std::string foo = "peace"; - foo += blanks; - foo += "& love"; - - std::ostringstream oss1; - oss1 << foo; - VERIFY( oss1.str() == foo ); - - std::ostringstream oss2; - oss2.width(20); - oss2 << foo; - VERIFY( oss2.str() != foo ); - VERIFY( oss2.str().size() == 20 ); -} - -int main() -{ - test09(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/1.cc deleted file mode 100644 index 5297958c453..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/1.cc +++ /dev/null @@ -1,171 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.7.9 inserters and extractors - -// NB: This file is predicated on sstreams, istreams, and ostreams -// working, not to mention other major details like char_traits, and -// all of the string class. - -#include <string> -#include <stdexcept> -#include <sstream> -#include <fstream> -#include <iostream> -#include <testsuite_hooks.h> - -bool test01(void) -{ - bool test = true; - typedef std::wstring::size_type csize_type; - typedef std::wstring::const_reference cref; - typedef std::wstring::reference ref; - csize_type npos = std::wstring::npos; - csize_type csz01, csz02; - - const std::wstring str01(L"sailing grand traverse bay\n" - L"\t\t\t from Elk Rapids to the point reminds me of miles"); - const std::wstring str02(L"sailing"); - const std::wstring str03(L"grand"); - const std::wstring str04(L"traverse"); - const std::wstring str05; - std::wstring str10; - - // istream& operator>>(istream&, string&) - std::wistringstream istrs01(str01); - istrs01 >> str10; - VERIFY( str10 == str02 ); - try - { - std::wistringstream::int_type i01 = istrs01.peek(); //a-boo - VERIFY( std::wistringstream::traits_type::to_char_type(i01) == L' ' ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - istrs01.clear(); - istrs01 >> str10; - VERIFY( str10 == str03 ); - istrs01.clear(); - istrs01 >> str10; - VERIFY( str10 == str04 ); // sentry picks out the white spaces. . - - std::wistringstream istrs02(str05); // empty - istrs02 >> str10; - VERIFY( str10 == str04 ); - - // istream& getline(istream&, string&, char) - // istream& getline(istream&, string&) - try - { - istrs01.clear(); - getline(istrs01, str10); - VERIFY( !istrs01.fail() ); - VERIFY( !istrs01.eof() ); - VERIFY( istrs01.good() ); - VERIFY( str10 == L" bay" ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - try - { - istrs01.clear(); - getline(istrs01, str10, L'\t'); - VERIFY( !istrs01.fail() ); - VERIFY( !istrs01.eof() ); - VERIFY( istrs01.good() ); - VERIFY( str10 == str05 ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - try - { - istrs01.clear(); - getline(istrs01, str10, L'\t'); - VERIFY( !istrs01.fail() ); - VERIFY( !istrs01.eof() ); - VERIFY( istrs01.good() ); - VERIFY( str10 == str05 ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - try - { - istrs01.clear(); - getline(istrs01, str10, L'.'); - VERIFY( !istrs01.fail() ); - VERIFY( istrs01.eof() ); - VERIFY( !istrs01.good() ); - VERIFY( str10 == L"\t from Elk Rapids to the point reminds me of miles" ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - try - { - getline(istrs02, str10); - VERIFY( istrs02.fail() ); - VERIFY( istrs02.eof() ); - VERIFY( str10 == L"\t from Elk Rapids to the point reminds me of miles" ); - } - catch(std::exception& fail) - { - VERIFY( false ); // shouldn't throw - } - - // ostream& operator<<(ostream&, const basic_string&) - std::wostringstream ostrs01; - try - { - ostrs01 << str01; - VERIFY( ostrs01.str() == str01 ); - } - catch(std::exception& fail) - { - VERIFY( false ); - } - - std::wstring hello_world; - std::wcout << hello_world; - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/4.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/4.cc deleted file mode 100644 index f47d8da43aa..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/4.cc +++ /dev/null @@ -1,69 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.7.9 inserters and extractors - -// NB: This file is predicated on sstreams, istreams, and ostreams -// working, not to mention other major details like char_traits, and -// all of the string class. - -#include <string> -#include <sstream> -#include <testsuite_hooks.h> - -// testing basic_stringbuf::xsputn via stress testing with large strings -// based on a bug report libstdc++ 9 -void test04(int size) -{ - bool test = true; - std::wstring str(size, L's'); - int expected_size = 2 * (size + 1); - std::wostringstream oss(str); - - // sanity checks - VERIFY( str.size() == size ); - VERIFY( oss.good() ); - - // stress test - oss << str << std::endl; - if (!oss.good()) - test = false; - - oss << str << std::endl; - if (!oss.good()) - test = false; - - VERIFY( str.size() == size ); - VERIFY( oss.good() ); - std::wstring str_tmp = oss.str(); - VERIFY( str_tmp.size() == expected_size ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif -} - -int main() -{ - test04(1); // expected_size == 4 - test04(1000); // expected_size == 2002 - test04(10000); // expected_size == 20002 - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/5.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/5.cc deleted file mode 100644 index e9a701e8c52..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/5.cc +++ /dev/null @@ -1,90 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.7.9 inserters and extractors - -// NB: This file is predicated on sstreams, istreams, and ostreams -// working, not to mention other major details like char_traits, and -// all of the string class. - -#include <string> -#include <fstream> -#include <iostream> -#include <testsuite_hooks.h> - -// testing basic_filebuf::xsputn via stress testing with large strings -// based on a bug report libstdc++ 9 -// mode == out -void test05(int size) -{ - bool test = true; - const char filename[] = "inserters_extractors-1.txt"; - const wchar_t fillc = L'f'; - std::wofstream ofs(filename); - std::wstring str(size, fillc); - - // sanity checks - VERIFY( str.size() == size ); - VERIFY( ofs.good() ); - - // stress test - ofs << str << std::endl; - if (!ofs.good()) - test = false; - - ofs << str << std::endl; - if (!ofs.good()) - test = false; - - VERIFY( str.size() == size ); - VERIFY( ofs.good() ); - - ofs.close(); - - // sanity check on the written file - std::wifstream ifs(filename); - int count = 0; - wchar_t c; - while (count <= (2 * size) + 4) - { - ifs >> c; - if (ifs.good() && c == fillc) - { - ++count; - c = '0'; - } - else - break; - } - - VERIFY( count == 2 * size ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif -} - -int main() -{ - test05(1); - test05(1000); - test05(10000); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/6.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/6.cc deleted file mode 100644 index aedcdb26391..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/6.cc +++ /dev/null @@ -1,65 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.7.9 inserters and extractors - -// NB: This file is predicated on sstreams, istreams, and ostreams -// working, not to mention other major details like char_traits, and -// all of the string class. - -#include <string> -#include <sstream> -#include <testsuite_hooks.h> - -// istringstream/stringbuf extractor properly size buffer based on -// actual, not allocated contents (string.size() vs. string.capacity()). -// http://gcc.gnu.org/ml/libstdc++/1999-q4/msg00049.html -void test06(void) -{ - bool test = true; - - typedef std::wstring::size_type size_type; - std::wstring str01(L"@silent"); - size_type i01 = str01.size(); - size_type i02 = str01.capacity(); - str01.erase(0, 1); - size_type i03 = str01.size(); - size_type i04 = str01.capacity(); - VERIFY( i01 - 1 == i03 ); - VERIFY( i02 >= i04 ); - - std::wistringstream is(str01); - std::wstring str02; - is >> str02 >> std::ws; - size_type i05 = str02.size(); - size_type i06 = str02.capacity(); - VERIFY( i05 == i03 ); - VERIFY( i06 <= i04 ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif -} - -int main() -{ - test06(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/7.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/7.cc deleted file mode 100644 index 4028924674b..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/7.cc +++ /dev/null @@ -1,57 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.7.9 inserters and extractors - -// NB: This file is predicated on sstreams, istreams, and ostreams -// working, not to mention other major details like char_traits, and -// all of the string class. - -#include <string> -#include <sstream> -#include <testsuite_hooks.h> - -// http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00085.html -// istream::operator>>(string) -// sets failbit -// NB: this is a defect in the standard. -void test07(void) -{ - bool test = true; - const std::wstring name(L"z6.cc"); - std::wistringstream iss(name); - int i = 0; - std::wstring s; - while (iss >> s) - ++i; - - VERIFY( i < 3 ); - VERIFY( static_cast<bool>(iss.rdstate() & std::ios_base::failbit) ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif -} - -int main() -{ - test07(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/8.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/8.cc deleted file mode 100644 index d43d818633f..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/8.cc +++ /dev/null @@ -1,53 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.7.9 inserters and extractors - -// NB: This file is predicated on sstreams, istreams, and ostreams -// working, not to mention other major details like char_traits, and -// all of the string class. - -#include <string> -#include <sstream> -#include <iomanip> -#include <testsuite_hooks.h> - -// libstdc++/1019 -void test08() -{ - using namespace std; - - bool test = true; - wistringstream istrm(L"enero:2001"); - int year; - wchar_t sep; - wstring month; - - istrm >> setw(5) >> month >> sep >> year; - VERIFY( month.size() == 5 ); - VERIFY( sep == ':' ); - VERIFY( year == 2001 ); -} - -int main() -{ - test08(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/9.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/9.cc deleted file mode 100644 index 726dacc9816..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/9.cc +++ /dev/null @@ -1,56 +0,0 @@ -// 1999-07-01 bkoz - -// Copyright (C) 1999, 2000, 2001, 2002, 2003 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. - -// 21.3.7.9 inserters and extractors - -// NB: This file is predicated on sstreams, istreams, and ostreams -// working, not to mention other major details like char_traits, and -// all of the string class. - -#include <string> -#include <sstream> -#include <iomanip> -#include <testsuite_hooks.h> - -// libstdc++/2830 -void test09() -{ - bool test = true; - std::wstring blanks(3, L'\0'); - std::wstring foo = L"peace"; - foo += blanks; - foo += L"& love"; - - std::wostringstream oss1; - oss1 << foo; - VERIFY( oss1.str() == foo ); - - std::wostringstream oss2; - oss2.width(20); - oss2 << foo; - VERIFY( oss2.str() != foo ); - VERIFY( oss2.str().size() == 20 ); -} - -int main() -{ - test09(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/1.cc deleted file mode 100644 index da8b30638ff..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/1.cc +++ /dev/null @@ -1,56 +0,0 @@ -// 1999-05-07 bkoz - -// Copyright (C) 1999, 2003 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. - -// 21.3.6 string operations - -#include <string> -#include <cstdio> -#include <testsuite_hooks.h> - -int test01(void) -{ - bool test = true; - - std::string str1; - std::string str2; - - // Should get this: - // 1:8-chars_8-chars_ - // 2:8-chars_8-chars_ - str1 = std::string("8-chars_") + "8-chars_"; - const char* p1 = str1.c_str(); - // printf("1:%s\n", str1.c_str()); - str2 = str1 + "7-chars"; - // printf("2:%s\n", str1.c_str()); //str1 is gone - const char* p2 = str1.c_str(); - return 0; - -#ifdef DEBUG_ASSERT - assert(test); -#endif - - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/2.cc deleted file mode 100644 index c41ac68ffe2..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/2.cc +++ /dev/null @@ -1,300 +0,0 @@ -// 1998-10-01, 1999-06-25 bkoz - -// Copyright (C) 1998, 1999, 2003 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. - -// 21.3.7.1 basic_string non-member functions - -// 21.3.7.2 operator== -/* -template<class charT, class traits, class Allocator> - bool operator==(const basic_string<charT,traits,Allocator>& lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - bool operator==(const charT* lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - bool operator==(const basic_string<charT,traits,Allocator>& lhs, - const charT* rhs); -*/ - -// 21.3.7.3 operator!= -/* -template<class charT, class traits, class Allocator> - bool operator!=(const basic_string<charT,traits,Allocator>& lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - bool operator!=(const charT* lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - bool operator!=(const basic_string<charT,traits,Allocator>& lhs, - const charT* rhs); -*/ - -// 21.3.7.4 operator< -/* -template<class charT, class traits, class Allocator> - bool operator< (const basic_string<charT,traits,Allocator>& lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - bool operator< (const basic_string<charT,traits,Allocator>& lhs, - const charT* rhs); - -template<class charT, class traits, class Allocator> - bool operator< (const charT* lhs, - const basic_string<charT,traits,Allocator>& rhs); -*/ - -// 21.3.7.5 operator> -/* -template<class charT, class traits, class Allocator> - bool operator> (const basic_string<charT,traits,Allocator>& lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - bool operator> (const basic_string<charT,traits,Allocator>& lhs, - const charT* rhs); - -template<class charT, class traits, class Allocator> - bool operator> (const charT* lhs, - const basic_string<charT,traits,Allocator>& rhs); -*/ - -//21.3.7.6 operator<= -/* -template<class charT, class traits, class Allocator> - bool operator<=(const basic_string<charT,traits,Allocator>& lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - bool operator<=(const basic_string<charT,traits,Allocator>& lhs, - const charT* rhs); - -template<class charT, class traits, class Allocator> - bool operator<=(const charT* lhs, - const basic_string<charT,traits,Allocator>& rhs); -*/ - -// 21.3.7.7 operator>= -/* -template<class charT, class traits, class Allocator> - bool operator>=(const basic_string<charT,traits,Allocator>& lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - bool operator>=(const basic_string<charT,traits,Allocator>& lhs, - const charT* rhs); - -template<class charT, class traits, class Allocator> - bool operator>=(const charT* lhs, - const basic_string<charT,traits,Allocator>& rhs); -*/ - -#include <string> -#include <testsuite_hooks.h> - -int test01(void) -{ - bool test = true; - std::string str_0("costa rica"); - std::string str_1("costa marbella"); - std::string str_2("cost"); - std::string str_3("costa ricans"); - std::string str_4; - - str_4 = str_0; - //comparisons between string objects - VERIFY( !(str_0 == str_1) ); - VERIFY( !(str_0 == str_2) ); - VERIFY( !(str_0 == str_3) ); - VERIFY( !(str_1 == str_0) ); - VERIFY( !(str_2 == str_0) ); - VERIFY( !(str_3 == str_0) ); - VERIFY( str_4 == str_0 ); - VERIFY( str_0 == str_4 ); - - VERIFY( str_0 != str_1 ); - VERIFY( str_0 != str_2 ); - VERIFY( str_0 != str_3 ); - VERIFY( str_1 != str_0 ); - VERIFY( str_2 != str_0 ); - VERIFY( str_3 != str_0 ); - VERIFY( !(str_0 != str_4) ); - VERIFY( !(str_4 != str_0) ); - - VERIFY( str_0 > str_1 ); //true cuz r>m - VERIFY( str_0 > str_2 ); - VERIFY( !(str_0 > str_3) ); - VERIFY( !(str_1 > str_0) ); //false cuz m<r - VERIFY( !(str_2 > str_0) ); - VERIFY( str_3 > str_0 ); - VERIFY( !(str_0 > str_4) ); - VERIFY( !(str_4 > str_0) ); - - VERIFY( !(str_0 < str_1) ); //false cuz r>m - VERIFY( !(str_0 < str_2) ); - VERIFY( str_0 < str_3 ); - VERIFY( str_1 < str_0 ); //true cuz m<r - VERIFY( str_2 < str_0 ); - VERIFY( !(str_3 < str_0) ); - VERIFY( !(str_0 < str_4) ); - VERIFY( !(str_4 < str_0) ); - - VERIFY( str_0 >= str_1 ); //true cuz r>m - VERIFY( str_0 >= str_2 ); - VERIFY( !(str_0 >= str_3) ); - VERIFY( !(str_1 >= str_0) );//false cuz m<r - VERIFY( !(str_2 >= str_0) ); - VERIFY( str_3 >= str_0 ); - VERIFY( str_0 >= str_4 ); - VERIFY( str_4 >= str_0 ); - - VERIFY( !(str_0 <= str_1) );//false cuz r>m - VERIFY( !(str_0 <= str_2) ); - VERIFY( str_0 <= str_3 ); - VERIFY( str_1 <= str_0 );//true cuz m<r - VERIFY( str_2 <= str_0 ); - VERIFY( !(str_3 <= str_0) ); - VERIFY( str_0 <= str_4 ); - VERIFY( str_4 <= str_0 ); - - //comparisons between string object and string literal - VERIFY( !(str_0 == "costa marbella") ); - VERIFY( !(str_0 == "cost") ); - VERIFY( !(str_0 == "costa ricans") ); - VERIFY( !("costa marbella" == str_0) ); - VERIFY( !("cost" == str_0) ); - VERIFY( !("costa ricans" == str_0) ); - VERIFY( "costa rica" == str_0 ); - VERIFY( str_0 == "costa rica" ); - - VERIFY( str_0 != "costa marbella" ); - VERIFY( str_0 != "cost" ); - VERIFY( str_0 != "costa ricans" ); - VERIFY( "costa marbella" != str_0 ); - VERIFY( "cost" != str_0 ); - VERIFY( "costa ricans" != str_0 ); - VERIFY( !("costa rica" != str_0) ); - VERIFY( !(str_0 != "costa rica") ); - - VERIFY( str_0 > "costa marbella" ); //true cuz r>m - VERIFY( str_0 > "cost" ); - VERIFY( !(str_0 > "costa ricans") ); - VERIFY( !("costa marbella" > str_0) );//false cuz m<r - VERIFY( !("cost" > str_0) ); - VERIFY( "costa ricans" > str_0 ); - VERIFY( !("costa rica" > str_0) ); - VERIFY( !(str_0 > "costa rica") ); - - VERIFY( !(str_0 < "costa marbella") );//false cuz r>m - VERIFY( !(str_0 < "cost") ); - VERIFY( str_0 < "costa ricans" ); - VERIFY( "costa marbella" < str_0 );//true cuz m<r - VERIFY( "cost" < str_0 ); - VERIFY( !("costa ricans" < str_0) ); - VERIFY( !("costa rica" < str_0) ); - VERIFY( !(str_0 < "costa rica") ); - - VERIFY( str_0 >= "costa marbella" );//true cuz r>m - VERIFY( str_0 >= "cost" ); - VERIFY( !(str_0 >= "costa ricans") ); - VERIFY( !("costa marbella" >= str_0) );//false cuz m<r - VERIFY( !("cost" >= str_0) ); - VERIFY( "costa ricans" >= str_0 ); - VERIFY( "costa rica" >= str_0 ); - VERIFY( str_0 >= "costa rica" ); - - VERIFY( !(str_0 <= "costa marbella") );//false cuz r>m - VERIFY( !(str_0 <= "cost") ); - VERIFY( str_0 <= "costa ricans" ); - VERIFY( "costa marbella" <= str_0 );//true cuz m<r - VERIFY( "cost" <= str_0 ); - VERIFY( !("costa ricans" <= str_0) ); - VERIFY( "costa rica" <= str_0 ); - VERIFY( str_0 <= "costa rica" ); - - // 21.3.7.1 operator+ -/* -template<class charT, class traits, class Allocator> - basic_string<charT,traits,Allocator> - operator+(const basic_string<charT,traits,Allocator>& lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - basic_string<charT,traits,Allocator> - operator+(const charT* lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - basic_string<charT,traits,Allocator> - operator+(const basic_string<charT,traits,Allocator>& lhs, - const charT* rhs); - -template<class charT, class traits, class Allocator> - basic_string<charT,traits,Allocator> - operator+(charT lhs, const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - basic_string<charT,traits,Allocator> - operator+(const basic_string<charT,traits,Allocator>& lhs, charT rhs); -*/ - - str_4 = str_0 + "ns"; - VERIFY( str_4 == str_3 ); - - const std::string str_5(" marbella"); - str_4 = "costa" + str_5; - VERIFY( str_4 == str_1 ); - - std::string str_6("ns"); - str_4 = str_0 + str_6; - VERIFY( str_4 == str_3 ); - - str_4 = str_0 + 'n'; - str_4 = str_4 + 's'; - VERIFY( str_4 == str_3 ); - - str_4 = 'a' + str_6; - str_4 = 'c' + str_4; - str_4 = 'i' + str_4; - str_4 = 'r' + str_4; - str_4 = ' ' + str_4; - str_4 = 'a' + str_4; - str_4 = 't' + str_4; - str_4 = 's' + str_4; - str_4 = 'o' + str_4; - str_4 = 'c' + str_4; - VERIFY( str_4 == str_3 ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif - - return 0; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/1.cc deleted file mode 100644 index cd8f18bf663..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/1.cc +++ /dev/null @@ -1,56 +0,0 @@ -// 1999-05-07 bkoz - -// Copyright (C) 1999, 2003 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. - -// 21.3.6 string operations - -#include <string> -#include <cstdio> -#include <testsuite_hooks.h> - -int test01(void) -{ - bool test = true; - - std::wstring str1; - std::wstring str2; - - // Should get this: - // 1:8-chars_8-chars_ - // 2:8-chars_8-chars_ - str1 = std::wstring(L"8-chars_") + L"8-chars_"; - const wchar_t* p1 = str1.c_str(); - // wprintf("1:%s\n", str1.c_str()); - str2 = str1 + L"7-chars"; - // wprintf("2:%s\n", str1.c_str()); //str1 is gone - const wchar_t* p2 = str1.c_str(); - return 0; - -#ifdef DEBUG_ASSERT - assert(test); -#endif - - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/2.cc deleted file mode 100644 index 11e63f70e93..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/2.cc +++ /dev/null @@ -1,300 +0,0 @@ -// 1998-10-01, 1999-06-25 bkoz - -// Copyright (C) 1998, 1999, 2003 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. - -// 21.3.7.1 basic_string non-member functions - -// 21.3.7.2 operator== -/* -template<class charT, class traits, class Allocator> - bool operator==(const basic_string<charT,traits,Allocator>& lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - bool operator==(const charT* lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - bool operator==(const basic_string<charT,traits,Allocator>& lhs, - const charT* rhs); -*/ - -// 21.3.7.3 operator!= -/* -template<class charT, class traits, class Allocator> - bool operator!=(const basic_string<charT,traits,Allocator>& lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - bool operator!=(const charT* lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - bool operator!=(const basic_string<charT,traits,Allocator>& lhs, - const charT* rhs); -*/ - -// 21.3.7.4 operator< -/* -template<class charT, class traits, class Allocator> - bool operator< (const basic_string<charT,traits,Allocator>& lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - bool operator< (const basic_string<charT,traits,Allocator>& lhs, - const charT* rhs); - -template<class charT, class traits, class Allocator> - bool operator< (const charT* lhs, - const basic_string<charT,traits,Allocator>& rhs); -*/ - -// 21.3.7.5 operator> -/* -template<class charT, class traits, class Allocator> - bool operator> (const basic_string<charT,traits,Allocator>& lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - bool operator> (const basic_string<charT,traits,Allocator>& lhs, - const charT* rhs); - -template<class charT, class traits, class Allocator> - bool operator> (const charT* lhs, - const basic_string<charT,traits,Allocator>& rhs); -*/ - -//21.3.7.6 operator<= -/* -template<class charT, class traits, class Allocator> - bool operator<=(const basic_string<charT,traits,Allocator>& lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - bool operator<=(const basic_string<charT,traits,Allocator>& lhs, - const charT* rhs); - -template<class charT, class traits, class Allocator> - bool operator<=(const charT* lhs, - const basic_string<charT,traits,Allocator>& rhs); -*/ - -// 21.3.7.7 operator>= -/* -template<class charT, class traits, class Allocator> - bool operator>=(const basic_string<charT,traits,Allocator>& lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - bool operator>=(const basic_string<charT,traits,Allocator>& lhs, - const charT* rhs); - -template<class charT, class traits, class Allocator> - bool operator>=(const charT* lhs, - const basic_string<charT,traits,Allocator>& rhs); -*/ - -#include <string> -#include <testsuite_hooks.h> - -int test01(void) -{ - bool test = true; - std::wstring str_0(L"costa rica"); - std::wstring str_1(L"costa marbella"); - std::wstring str_2(L"cost"); - std::wstring str_3(L"costa ricans"); - std::wstring str_4; - - str_4 = str_0; - //comparisons between string objects - VERIFY( !(str_0 == str_1) ); - VERIFY( !(str_0 == str_2) ); - VERIFY( !(str_0 == str_3) ); - VERIFY( !(str_1 == str_0) ); - VERIFY( !(str_2 == str_0) ); - VERIFY( !(str_3 == str_0) ); - VERIFY( str_4 == str_0 ); - VERIFY( str_0 == str_4 ); - - VERIFY( str_0 != str_1 ); - VERIFY( str_0 != str_2 ); - VERIFY( str_0 != str_3 ); - VERIFY( str_1 != str_0 ); - VERIFY( str_2 != str_0 ); - VERIFY( str_3 != str_0 ); - VERIFY( !(str_0 != str_4) ); - VERIFY( !(str_4 != str_0) ); - - VERIFY( str_0 > str_1 ); //true cuz r>m - VERIFY( str_0 > str_2 ); - VERIFY( !(str_0 > str_3) ); - VERIFY( !(str_1 > str_0) ); //false cuz m<r - VERIFY( !(str_2 > str_0) ); - VERIFY( str_3 > str_0 ); - VERIFY( !(str_0 > str_4) ); - VERIFY( !(str_4 > str_0) ); - - VERIFY( !(str_0 < str_1) ); //false cuz r>m - VERIFY( !(str_0 < str_2) ); - VERIFY( str_0 < str_3 ); - VERIFY( str_1 < str_0 ); //true cuz m<r - VERIFY( str_2 < str_0 ); - VERIFY( !(str_3 < str_0) ); - VERIFY( !(str_0 < str_4) ); - VERIFY( !(str_4 < str_0) ); - - VERIFY( str_0 >= str_1 ); //true cuz r>m - VERIFY( str_0 >= str_2 ); - VERIFY( !(str_0 >= str_3) ); - VERIFY( !(str_1 >= str_0) );//false cuz m<r - VERIFY( !(str_2 >= str_0) ); - VERIFY( str_3 >= str_0 ); - VERIFY( str_0 >= str_4 ); - VERIFY( str_4 >= str_0 ); - - VERIFY( !(str_0 <= str_1) );//false cuz r>m - VERIFY( !(str_0 <= str_2) ); - VERIFY( str_0 <= str_3 ); - VERIFY( str_1 <= str_0 );//true cuz m<r - VERIFY( str_2 <= str_0 ); - VERIFY( !(str_3 <= str_0) ); - VERIFY( str_0 <= str_4 ); - VERIFY( str_4 <= str_0 ); - - //comparisons between string object and string literal - VERIFY( !(str_0 == L"costa marbella") ); - VERIFY( !(str_0 == L"cost") ); - VERIFY( !(str_0 == L"costa ricans") ); - VERIFY( !(L"costa marbella" == str_0) ); - VERIFY( !(L"cost" == str_0) ); - VERIFY( !(L"costa ricans" == str_0) ); - VERIFY( L"costa rica" == str_0 ); - VERIFY( str_0 == L"costa rica" ); - - VERIFY( str_0 != L"costa marbella" ); - VERIFY( str_0 != L"cost" ); - VERIFY( str_0 != L"costa ricans" ); - VERIFY( L"costa marbella" != str_0 ); - VERIFY( L"cost" != str_0 ); - VERIFY( L"costa ricans" != str_0 ); - VERIFY( !(L"costa rica" != str_0) ); - VERIFY( !(str_0 != L"costa rica") ); - - VERIFY( str_0 > L"costa marbella" ); //true cuz r>m - VERIFY( str_0 > L"cost" ); - VERIFY( !(str_0 > L"costa ricans") ); - VERIFY( !(L"costa marbella" > str_0) );//false cuz m<r - VERIFY( !(L"cost" > str_0) ); - VERIFY( L"costa ricans" > str_0 ); - VERIFY( !(L"costa rica" > str_0) ); - VERIFY( !(str_0 > L"costa rica") ); - - VERIFY( !(str_0 < L"costa marbella") );//false cuz r>m - VERIFY( !(str_0 < L"cost") ); - VERIFY( str_0 < L"costa ricans" ); - VERIFY( L"costa marbella" < str_0 );//true cuz m<r - VERIFY( L"cost" < str_0 ); - VERIFY( !(L"costa ricans" < str_0) ); - VERIFY( !(L"costa rica" < str_0) ); - VERIFY( !(str_0 < L"costa rica") ); - - VERIFY( str_0 >= L"costa marbella" );//true cuz r>m - VERIFY( str_0 >= L"cost" ); - VERIFY( !(str_0 >= L"costa ricans") ); - VERIFY( !(L"costa marbella" >= str_0) );//false cuz m<r - VERIFY( !(L"cost" >= str_0) ); - VERIFY( L"costa ricans" >= str_0 ); - VERIFY( L"costa rica" >= str_0 ); - VERIFY( str_0 >= L"costa rica" ); - - VERIFY( !(str_0 <= L"costa marbella") );//false cuz r>m - VERIFY( !(str_0 <= L"cost") ); - VERIFY( str_0 <= L"costa ricans" ); - VERIFY( L"costa marbella" <= str_0 );//true cuz m<r - VERIFY( L"cost" <= str_0 ); - VERIFY( !(L"costa ricans" <= str_0) ); - VERIFY( L"costa rica" <= str_0 ); - VERIFY( str_0 <= L"costa rica" ); - - // 21.3.7.1 operator+ -/* -template<class charT, class traits, class Allocator> - basic_string<charT,traits,Allocator> - operator+(const basic_string<charT,traits,Allocator>& lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - basic_string<charT,traits,Allocator> - operator+(const charT* lhs, - const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - basic_string<charT,traits,Allocator> - operator+(const basic_string<charT,traits,Allocator>& lhs, - const charT* rhs); - -template<class charT, class traits, class Allocator> - basic_string<charT,traits,Allocator> - operator+(charT lhs, const basic_string<charT,traits,Allocator>& rhs); - -template<class charT, class traits, class Allocator> - basic_string<charT,traits,Allocator> - operator+(const basic_string<charT,traits,Allocator>& lhs, charT rhs); -*/ - - str_4 = str_0 + L"ns"; - VERIFY( str_4 == str_3 ); - - const std::wstring str_5(L" marbella"); - str_4 = L"costa" + str_5; - VERIFY( str_4 == str_1 ); - - std::wstring str_6(L"ns"); - str_4 = str_0 + str_6; - VERIFY( str_4 == str_3 ); - - str_4 = str_0 + L'n'; - str_4 = str_4 + L's'; - VERIFY( str_4 == str_3 ); - - str_4 = L'a' + str_6; - str_4 = L'c' + str_4; - str_4 = L'i' + str_4; - str_4 = L'r' + str_4; - str_4 = L' ' + str_4; - str_4 = L'a' + str_4; - str_4 = L't' + str_4; - str_4 = L's' + str_4; - str_4 = L'o' + str_4; - str_4 = L'c' + str_4; - VERIFY( str_4 == str_3 ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif - - return 0; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/1.cc deleted file mode 100644 index 7145d4c7840..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/1.cc +++ /dev/null @@ -1,87 +0,0 @@ -// 1999-06-10 bkoz - -// Copyright (C) 1994, 1999, 2001, 2002, 2003 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. - -// 21.3.5.6 basic_string::replace - -#include <string> -#include <testsuite_hooks.h> - -bool test01(void) -{ - bool test = true; - typedef std::string::size_type csize_type; - typedef std::string::const_reference cref; - typedef std::string::reference ref; - csize_type npos = std::string::npos; - csize_type csz01, csz02; - - const char str_lit01[] = "ventura, california"; - const std::string str01(str_lit01); - std::string str02("del mar, california"); - std::string str03(" and "); - std::string str05; - - // string& replace(size_type pos, size_type n, const string& string) - // string& replace(size_type pos1, size_type n1, const string& string, - // size_type pos2, size_type n2) - // string& replace(size_type pos, size_type n1, const char* s, size_type n2) - // string& replace(size_type pos, size_type n1, const char* s) - // string& replace(size_type pos, size_type n1, size_type n2, char c) - // string& replace(iterator it1, iterator it2, const string& str) - // string& replace(iterator it1, iterator it2, const chat* s, size_type n) - // string& replace(iterator it1, iterator it2, const chat* s) - // string& replace(iterator it1, iterator it2, size_type n, char c) - // template<typename InputIter> - // string& replace(iterator it1, iterator it2, InputIter j1, InputIter j2) - - // with mods, from tstring.cc, from jason merrill, et. al. - std::string X = "Hello"; - std::string x = X; - - char ch = x[0]; - VERIFY( ch == 'H' ); - - std::string z = x.substr(2, 3); - VERIFY( z == "llo" ); - - x.replace(2, 2, "r"); - VERIFY( x == "Hero" ); - - x = X; - x.replace(0, 1, "j"); - VERIFY( x == "jello" ); - - int ar[] = { 'H', 'e', 'l', 'l', 'o' }; - x.replace(std::find(x.begin(), x.end(), 'l'), - std::find(x.rbegin(), x.rend(), 'l').base(), ar, - ar + sizeof(ar) / sizeof(ar[0])); - VERIFY( x == "jeHelloo" ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/2.cc deleted file mode 100644 index 7731edd37a4..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/2.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 1999-06-10 bkoz - -// Copyright (C) 1994, 1999, 2001, 2002, 2003 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. - -// 21.3.5.6 basic_string::replace - -#include <string> -#include <testsuite_hooks.h> - -void -test02() -{ - bool test = true; - const char* strlit = "../the long pier/Hanalei Bay/Kauai/Hawaii"; - std::string aux = strlit; - aux.replace(aux.begin()+5, aux.begin()+20, - aux.begin()+10, aux.begin()+15); - VERIFY(aux == "../thg piealei Bay/Kauai/Hawaii"); - - aux = strlit; - aux.replace(aux.begin() + 10, aux.begin() + 15, - aux.begin() + 5, aux.begin() + 20); - VERIFY(aux == "../the lone long pier/Hanr/Hanalei Bay/Kauai/Hawaii"); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/3.cc deleted file mode 100644 index a04d13d4024..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/3.cc +++ /dev/null @@ -1,74 +0,0 @@ -// 1999-06-10 bkoz - -// Copyright (C) 1994, 1999, 2001, 2002, 2003 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. - -// 21.3.5.6 basic_string::replace - -#include <string> -#include <testsuite_hooks.h> - -// Some more miscellaneous tests -void -test03() -{ - bool test = true; - const char* title01 = "nine types of ambiguity"; - const char* title02 = "ultra"; - std::string str01 = title01; - std::string str02 = title02; - - str01.replace(0, 4, str02); - VERIFY(str01 == "ultra types of ambiguity"); - - str01.replace(15, 9, str02, 2, 2); - VERIFY(str01 == "ultra types of tr"); - - str01 = title01; - str02.replace(0, 0, str01, 0, std::string::npos); - VERIFY(str02 == "nine types of ambiguityultra"); - - str02.replace(11, 2, title02, 5); - VERIFY(str02 == "nine types ultra ambiguityultra"); - - str02.replace(11, 5, title01, 2); - VERIFY(str02 == "nine types ni ambiguityultra"); - - str01.replace(str01.size(), 0, title02); - VERIFY(str01 == "nine types of ambiguityultra"); - - str01 = title01; - str02 = title02; - str01.replace(str01.begin(), str01.end(), str02); - VERIFY(str01 == "ultra"); - - str01.replace(str01.begin(), str01.begin(), title01, 4); - VERIFY(str01 == "nineultra"); - - str01.replace(str01.end(), str01.end(), title01 + 5, 5); - VERIFY(str01 == "nineultratypes"); - - str01.replace(str01.begin(), str01.end(), title02); - VERIFY(str01 == "ultra"); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/4.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/4.cc deleted file mode 100644 index 47cf335daa0..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/4.cc +++ /dev/null @@ -1,67 +0,0 @@ -// 1999-06-10 bkoz - -// Copyright (C) 1994, 1999, 2001, 2002, 2003 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. - -// 21.3.5.6 basic_string::replace - -#include <string> -#include <testsuite_hooks.h> - -// Some more tests for -// template<typename InputIter> -// string& replace(iterator it1, iterator it2, InputIter j1, InputIter j2) -void -test04() -{ - bool test = true; - std::string str01 = "geogaddi"; - std::string str02; - - typedef std::string::iterator iterator; - typedef std::string::const_iterator const_iterator; - - iterator it1 = str01.begin(); - iterator it2 = str01.end(); - str02.replace(str02.begin(), str02.end(), it1, it2); - VERIFY(str02 == "geogaddi"); - - str02 = "boards"; - const_iterator c_it1 = str01.begin(); - const_iterator c_it2 = str01.end(); - str02.replace(str02.begin(), str02.end(), c_it1, c_it2); - VERIFY(str02 == "geogaddi"); - - str02 = "boards"; - const char* c_ptr1 = str01.c_str(); - const char* c_ptr2 = str01.c_str() + 8; - str02.replace(str02.begin(), str02.end(), c_ptr1, c_ptr2); - VERIFY(str02 == "geogaddi"); - - str02 = "boards"; - char* ptr1 = &*str01.begin(); - char* ptr2 = &*str01.end(); - str02.replace(str02.begin(), str02.end(), ptr1, ptr2); - VERIFY(str02 == "geogaddi"); -} - -int main() -{ - test04(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/5.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/5.cc deleted file mode 100644 index 8c112c545ed..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/5.cc +++ /dev/null @@ -1,43 +0,0 @@ -// 1999-06-10 bkoz - -// Copyright (C) 1994, 1999, 2001, 2002, 2003 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. - -// 21.3.5.6 basic_string::replace - -#include <string> -#include <testsuite_hooks.h> - -// We wrongly used __n1 instead of __foldn1 in the length_error -// check at the beginning of replace(__pos, __n1, __s, __n2) -void -test05() -{ - bool test = true; - std::string str01 = "londinium"; - std::string str02 = "cydonia"; - - str01.replace(0, 20, str02.c_str(), 3); - VERIFY(str01 == "cyd"); -} - -int main() -{ - test05(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/1.cc deleted file mode 100644 index fd0967a86fe..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/1.cc +++ /dev/null @@ -1,87 +0,0 @@ -// 1999-06-10 bkoz - -// Copyright (C) 1994, 1999, 2001, 2002, 2003 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. - -// 21.3.5.6 basic_string::replace - -#include <string> -#include <testsuite_hooks.h> - -bool test01(void) -{ - bool test = true; - typedef std::wstring::size_type csize_type; - typedef std::wstring::const_reference cref; - typedef std::wstring::reference ref; - csize_type npos = std::wstring::npos; - csize_type csz01, csz02; - - const wchar_t str_lit01[] = L"ventura, california"; - const std::wstring str01(str_lit01); - std::wstring str02(L"del mar, california"); - std::wstring str03(L" and "); - std::wstring str05; - - // wstring& replace(size_type pos, size_type n, const wstring& string) - // wstring& replace(size_type pos1, size_type n1, const wstring& string, - // size_type pos2, size_type n2) - // wstring& replace(size_type pos, size_type n1, const wchar_t* s, size_type n2) - // wstring& replace(size_type pos, size_type n1, const wchar_t* s) - // wstring& replace(size_type pos, size_type n1, size_type n2, wchar_t c) - // wstring& replace(iterator it1, iterator it2, const wstring& str) - // wstring& replace(iterator it1, iterator it2, const wchar_t* s, size_type n) - // wstring& replace(iterator it1, iterator it2, const wchar_t* s) - // wstring& replace(iterator it1, iterator it2, size_type n, char c) - // template<typename InputIter> - // wstring& replace(iterator it1, iterator it2, InputIter j1, InputIter j2) - - // with mods, from tstring.cc, from jason merrill, et. al. - std::wstring X = L"Hello"; - std::wstring x = X; - - wchar_t ch = x[0]; - VERIFY( ch == L'H' ); - - std::wstring z = x.substr(2, 3); - VERIFY( z == L"llo" ); - - x.replace(2, 2, L"r"); - VERIFY( x == L"Hero" ); - - x = X; - x.replace(0, 1, L"j"); - VERIFY( x == L"jello" ); - - wchar_t ar[] = { L'H', L'e', L'l', L'l', L'o' }; - x.replace(std::find(x.begin(), x.end(), L'l'), - std::find(x.rbegin(), x.rend(), L'l').base(), ar, - ar + sizeof(ar) / sizeof(ar[0])); - VERIFY( x == L"jeHelloo" ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/2.cc deleted file mode 100644 index da9678a338f..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/2.cc +++ /dev/null @@ -1,47 +0,0 @@ -// 1999-06-10 bkoz - -// Copyright (C) 1994, 1999, 2001, 2002, 2003 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. - -// 21.3.5.6 basic_string::replace - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -void -test02() -{ - bool test = true; - const wchar_t* strlit = L"../the long pier/Hanalei Bay/Kauai/Hawaii"; - std::wstring aux = strlit; - aux.replace(aux.begin()+5, aux.begin()+20, - aux.begin()+10, aux.begin()+15); - VERIFY(aux == L"../thg piealei Bay/Kauai/Hawaii"); - - aux = strlit; - aux.replace(aux.begin() + 10, aux.begin() + 15, - aux.begin() + 5, aux.begin() + 20); - VERIFY(aux == L"../the lone long pier/Hanr/Hanalei Bay/Kauai/Hawaii"); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/3.cc deleted file mode 100644 index 2ff6ef28294..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/3.cc +++ /dev/null @@ -1,74 +0,0 @@ -// 1999-06-10 bkoz - -// Copyright (C) 1994, 1999, 2001, 2002, 2003 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. - -// 21.3.5.6 basic_string::replace - -#include <string> -#include <testsuite_hooks.h> - -// Some more miscellaneous tests -void -test03() -{ - bool test = true; - const wchar_t* title01 = L"nine types of ambiguity"; - const wchar_t* title02 = L"ultra"; - std::wstring str01 = title01; - std::wstring str02 = title02; - - str01.replace(0, 4, str02); - VERIFY(str01 == L"ultra types of ambiguity"); - - str01.replace(15, 9, str02, 2, 2); - VERIFY(str01 == L"ultra types of tr"); - - str01 = title01; - str02.replace(0, 0, str01, 0, std::wstring::npos); - VERIFY(str02 == L"nine types of ambiguityultra"); - - str02.replace(11, 2, title02, 5); - VERIFY(str02 == L"nine types ultra ambiguityultra"); - - str02.replace(11, 5, title01, 2); - VERIFY(str02 == L"nine types ni ambiguityultra"); - - str01.replace(str01.size(), 0, title02); - VERIFY(str01 == L"nine types of ambiguityultra"); - - str01 = title01; - str02 = title02; - str01.replace(str01.begin(), str01.end(), str02); - VERIFY(str01 == L"ultra"); - - str01.replace(str01.begin(), str01.begin(), title01, 4); - VERIFY(str01 == L"nineultra"); - - str01.replace(str01.end(), str01.end(), title01 + 5, 5); - VERIFY(str01 == L"nineultratypes"); - - str01.replace(str01.begin(), str01.end(), title02); - VERIFY(str01 == L"ultra"); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/4.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/4.cc deleted file mode 100644 index bc827d03282..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/4.cc +++ /dev/null @@ -1,67 +0,0 @@ -// 1999-06-10 bkoz - -// Copyright (C) 1994, 1999, 2001, 2002, 2003 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. - -// 21.3.5.6 basic_string::replace - -#include <string> -#include <testsuite_hooks.h> - -// Some more tests for -// template<typename InputIter> -// wstring& replace(iterator it1, iterator it2, InputIter j1, InputIter j2) -void -test04() -{ - bool test = true; - std::wstring str01 = L"geogaddi"; - std::wstring str02; - - typedef std::wstring::iterator iterator; - typedef std::wstring::const_iterator const_iterator; - - iterator it1 = str01.begin(); - iterator it2 = str01.end(); - str02.replace(str02.begin(), str02.end(), it1, it2); - VERIFY(str02 == L"geogaddi"); - - str02 = L"boards"; - const_iterator c_it1 = str01.begin(); - const_iterator c_it2 = str01.end(); - str02.replace(str02.begin(), str02.end(), c_it1, c_it2); - VERIFY(str02 == L"geogaddi"); - - str02 = L"boards"; - const wchar_t* c_ptr1 = str01.c_str(); - const wchar_t* c_ptr2 = str01.c_str() + 8; - str02.replace(str02.begin(), str02.end(), c_ptr1, c_ptr2); - VERIFY(str02 == L"geogaddi"); - - str02 = L"boards"; - wchar_t* ptr1 = &*str01.begin(); - wchar_t* ptr2 = &*str01.end(); - str02.replace(str02.begin(), str02.end(), ptr1, ptr2); - VERIFY(str02 == L"geogaddi"); -} - -int main() -{ - test04(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/5.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/5.cc deleted file mode 100644 index f54cfb9a2e7..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/5.cc +++ /dev/null @@ -1,43 +0,0 @@ -// 1999-06-10 bkoz - -// Copyright (C) 1994, 1999, 2001, 2002, 2003 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. - -// 21.3.5.6 basic_string::replace - -#include <string> -#include <testsuite_hooks.h> - -// We wrongly used __n1 instead of __foldn1 in the length_error -// check at the beginning of replace(__pos, __n1, __s, __n2) -void -test05() -{ - bool test = true; - std::wstring str01 = L"londinium"; - std::wstring str02 = L"cydonia"; - - str01.replace(0, 20, str02.c_str(), 3); - VERIFY(str01 == L"cyd"); -} - -int main() -{ - test05(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/rfind/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/rfind/char/1.cc deleted file mode 100644 index 5b9a4181b91..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/rfind/char/1.cc +++ /dev/null @@ -1,97 +0,0 @@ -// 2000-06-22 -=dbv=- (shamelessy copied from bkoz' find.cc) - -// Copyright (C) 2000, 2003 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. - -#include <string> -#include <testsuite_hooks.h> - -// 21.3.6.2 basic_string rfind -bool test01(void) -{ - bool test = true; - typedef std::string::size_type csize_type; - typedef std::string::const_reference cref; - typedef std::string::reference ref; - csize_type npos = std::string::npos; - csize_type csz01, csz02; - - const char str_lit01[] = "mave"; - const std::string str01("mavericks, santa cruz"); - std::string str02(str_lit01); - std::string str03("s, s"); - std::string str04; - - // size_type rfind(const string&, size_type pos = 0) const; - csz01 = str01.rfind(str01); - VERIFY( csz01 == 0 ); - csz01 = str01.rfind(str01, 4); - VERIFY( csz01 == 0 ); - csz01 = str01.rfind(str02,3); - VERIFY( csz01 == 0 ); - csz01 = str01.rfind(str02); - VERIFY( csz01 == 0 ); - csz01 = str01.rfind(str03); - VERIFY( csz01 == 8 ); - csz01 = str01.rfind(str03, 3); - VERIFY( csz01 == npos ); - csz01 = str01.rfind(str03, 12); - VERIFY( csz01 == 8 ); - - // An empty string consists of no characters - // therefore it should be found at every point in a string, - // except beyond the end - csz01 = str01.rfind(str04, 0); - VERIFY( csz01 == 0 ); - csz01 = str01.rfind(str04, 5); - VERIFY( csz01 == 5 ); - csz01 = str01.rfind(str04, str01.size()); - VERIFY( csz01 == str01.size() ); - csz01 = str01.rfind(str04, str01.size()+1); - VERIFY( csz01 == str01.size() ); - - // size_type rfind(const char* s, size_type pos, size_type n) const; - csz01 = str01.rfind(str_lit01, 0, 3); - VERIFY( csz01 == 0 ); - csz01 = str01.rfind(str_lit01, 3, 0); - VERIFY( csz01 == 3 ); - - // size_type rfind(const char* s, size_type pos = 0) const; - csz01 = str01.rfind(str_lit01); - VERIFY( csz01 == 0 ); - csz01 = str01.rfind(str_lit01, 3); - VERIFY( csz01 == 0 ); - - // size_type rfind(char c, size_type pos = 0) const; - csz01 = str01.rfind('z'); - csz02 = str01.size() - 1; - VERIFY( csz01 == csz02 ); - csz01 = str01.rfind('/'); - VERIFY( csz01 == npos ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/rfind/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/rfind/char/2.cc deleted file mode 100644 index 9b905df9065..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/rfind/char/2.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2000-06-22 -=dbv=- (shamelessy copied from bkoz' find.cc) - -// Copyright (C) 2000, 2003 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. - -#include <string> -#include <testsuite_hooks.h> - -// 21.3.6.4 basic_string::find_last_of -bool test02() -{ - bool test = true; - - // test find_last_of - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/rfind/char/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/rfind/char/3.cc deleted file mode 100644 index d8b6c8136ab..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/rfind/char/3.cc +++ /dev/null @@ -1,40 +0,0 @@ -// 2000-06-22 -=dbv=- (shamelessy copied from bkoz' find.cc) - -// Copyright (C) 2000, 2003 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. - -#include <string> -#include <testsuite_hooks.h> - -// 21.3.6.6 basic_string::find_last_not_of -bool test03() -{ - bool test = true; - - // test find_last_not_of - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/1.cc deleted file mode 100644 index 9681bf4c8e4..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/1.cc +++ /dev/null @@ -1,97 +0,0 @@ -// 2000-06-22 -=dbv=- (shamelessy copied from bkoz' find.cc) - -// Copyright (C) 2000, 2003 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. - -#include <string> -#include <testsuite_hooks.h> - -// 21.3.6.2 basic_string rfind -bool test01(void) -{ - bool test = true; - typedef std::wstring::size_type csize_type; - typedef std::wstring::const_reference cref; - typedef std::wstring::reference ref; - csize_type npos = std::wstring::npos; - csize_type csz01, csz02; - - const wchar_t str_lit01[] = L"mave"; - const std::wstring str01(L"mavericks, santa cruz"); - std::wstring str02(str_lit01); - std::wstring str03(L"s, s"); - std::wstring str04; - - // size_type rfind(const wstring&, size_type pos = 0) const; - csz01 = str01.rfind(str01); - VERIFY( csz01 == 0 ); - csz01 = str01.rfind(str01, 4); - VERIFY( csz01 == 0 ); - csz01 = str01.rfind(str02,3); - VERIFY( csz01 == 0 ); - csz01 = str01.rfind(str02); - VERIFY( csz01 == 0 ); - csz01 = str01.rfind(str03); - VERIFY( csz01 == 8 ); - csz01 = str01.rfind(str03, 3); - VERIFY( csz01 == npos ); - csz01 = str01.rfind(str03, 12); - VERIFY( csz01 == 8 ); - - // An empty string consists of no characters - // therefore it should be found at every point in a string, - // except beyond the end - csz01 = str01.rfind(str04, 0); - VERIFY( csz01 == 0 ); - csz01 = str01.rfind(str04, 5); - VERIFY( csz01 == 5 ); - csz01 = str01.rfind(str04, str01.size()); - VERIFY( csz01 == str01.size() ); - csz01 = str01.rfind(str04, str01.size()+1); - VERIFY( csz01 == str01.size() ); - - // size_type rfind(const wchar_t* s, size_type pos, size_type n) const; - csz01 = str01.rfind(str_lit01, 0, 3); - VERIFY( csz01 == 0 ); - csz01 = str01.rfind(str_lit01, 3, 0); - VERIFY( csz01 == 3 ); - - // size_type rfind(const wchar_t* s, size_type pos = 0) const; - csz01 = str01.rfind(str_lit01); - VERIFY( csz01 == 0 ); - csz01 = str01.rfind(str_lit01, 3); - VERIFY( csz01 == 0 ); - - // size_type rfind(wchar_t c, size_type pos = 0) const; - csz01 = str01.rfind(L'z'); - csz02 = str01.size() - 1; - VERIFY( csz01 == csz02 ); - csz01 = str01.rfind(L'/'); - VERIFY( csz01 == npos ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/2.cc deleted file mode 100644 index 9b905df9065..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/2.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2000-06-22 -=dbv=- (shamelessy copied from bkoz' find.cc) - -// Copyright (C) 2000, 2003 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. - -#include <string> -#include <testsuite_hooks.h> - -// 21.3.6.4 basic_string::find_last_of -bool test02() -{ - bool test = true; - - // test find_last_of - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/3.cc deleted file mode 100644 index d8b6c8136ab..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/3.cc +++ /dev/null @@ -1,40 +0,0 @@ -// 2000-06-22 -=dbv=- (shamelessy copied from bkoz' find.cc) - -// Copyright (C) 2000, 2003 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. - -#include <string> -#include <testsuite_hooks.h> - -// 21.3.6.6 basic_string::find_last_not_of -bool test03() -{ - bool test = true; - - // test find_last_not_of - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/substr/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/substr/char/1.cc deleted file mode 100644 index be2a379c581..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/substr/char/1.cc +++ /dev/null @@ -1,80 +0,0 @@ -// 1999-06-10 bkoz - -// Copyright (C) 1999, 2003 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. - -// 21.3.6.7 basic_string::substr - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -bool test01(void) -{ - bool test = true; - typedef std::string::size_type csize_type; - typedef std::string::const_reference cref; - typedef std::string::reference ref; - csize_type npos = std::string::npos; - csize_type csz01, csz02; - - const char str_lit01[] = "rockaway, pacifica"; - const std::string str01(str_lit01); - std::string str02; - - // basic_string<charT, _Traits, _Alloc> - // substr(size_type pos = 0, size_type n = npos) const; - csz01 = str01.size(); - str02 = str01.substr(0, 1); - VERIFY( str02 == "r" ); - str02 = str01.substr(10); - VERIFY( str02 == "pacifica" ); - - try { - str02 = str01.substr(csz01 + 1); - VERIFY( false ); - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - try { - str02 = str01.substr(csz01); - VERIFY( str02.size() == 0 ); - } - catch(std::out_of_range& fail) { - VERIFY( false ); - } - catch(...) { - VERIFY( false ); - } - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/substr/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/substr/wchar_t/1.cc deleted file mode 100644 index 843ebb6861a..00000000000 --- a/libstdc++-v3/testsuite/21_strings/basic_string/substr/wchar_t/1.cc +++ /dev/null @@ -1,80 +0,0 @@ -// 1999-06-10 bkoz - -// Copyright (C) 1999, 2003 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. - -// 21.3.6.7 basic_string::substr - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -bool test01(void) -{ - bool test = true; - typedef std::wstring::size_type csize_type; - typedef std::wstring::const_reference cref; - typedef std::wstring::reference ref; - csize_type npos = std::wstring::npos; - csize_type csz01, csz02; - - const wchar_t str_lit01[] = L"rockaway, pacifica"; - const std::wstring str01(str_lit01); - std::wstring str02; - - // basic_string<charT, _Traits, _Alloc> - // substr(size_type pos = 0, size_type n = npos) const; - csz01 = str01.size(); - str02 = str01.substr(0, 1); - VERIFY( str02 == L"r" ); - str02 = str01.substr(10); - VERIFY( str02 == L"pacifica" ); - - try { - str02 = str01.substr(csz01 + 1); - VERIFY( false ); - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - try { - str02 = str01.substr(csz01); - VERIFY( str02.size() == 0 ); - } - catch(std::out_of_range& fail) { - VERIFY( false ); - } - catch(...) { - VERIFY( false ); - } - -#ifdef DEBUG_ASSERT - assert(test); -#endif - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/c_strings/char/1.cc b/libstdc++-v3/testsuite/21_strings/c_strings/char/1.cc deleted file mode 100644 index 7dfe6c24cf2..00000000000 --- a/libstdc++-v3/testsuite/21_strings/c_strings/char/1.cc +++ /dev/null @@ -1,70 +0,0 @@ -// 2001-04-02 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 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. - -// 21.4: null-terminiated sequence utilities - -#include <string> -#include <cstring> - -void test01() -{ - bool test = true; - char c = 'a'; - const char cc = 'b'; - char* c1 = &c; - const char* cc1 = &cc; - const char* ccarray1 = "san francisco roof garden inspectors"; - const char* ccarray2 = "san francisco sunny-day park inspectors"; - char carray[50]; - std::strcpy(carray, ccarray1); - void* v = carray; - const void* cv = ccarray1; - - // const char* strchr(const char* s, int c); - // char* strchr(char* s, int c); - cc1 = std::strchr(ccarray1, 'c'); - c1 = std::strchr(carray, 'c'); - - // const char* strpbrk(const char* s1, const char* s2); - // char* strpbrk(char* s1, const char* s2); - cc1 = std::strpbrk(ccarray1, ccarray2); - c1 = std::strpbrk(carray, ccarray2); - - // const char* strrchr(const char* s, int c); - // char* strrchr(char* s, int c); - cc1 = std::strrchr(ccarray1, 'c'); - c1 = std::strrchr(carray, 'c'); - - // const char* strstr(const char* s1, const char* s2); - // char* strstr(char* s1, const char* s2); - cc1 = std::strstr(ccarray1, ccarray2); - c1 = std::strstr(carray, carray); - - // const void* memchr(const void* s, int c, size_t n); - // void* memchr( void* s, int c, size_t n); - cv = std::memchr(cv, 'a', 3); - v = std::memchr(v, 'a', 3); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/c_strings/char/2.cc b/libstdc++-v3/testsuite/21_strings/c_strings/char/2.cc deleted file mode 100644 index 7ec0561b887..00000000000 --- a/libstdc++-v3/testsuite/21_strings/c_strings/char/2.cc +++ /dev/null @@ -1,48 +0,0 @@ -// 2001-04-02 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 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. - -// 21.4: null-terminiated sequence utilities - -#include <string> -#include <cstring> - -void test02() -{ - using namespace std; - - const char* ccarray1 = "san francisco roof garden inspectors"; - const char* ccarray2 = "san francisco sunny-day park inspectors"; - char carray[50]; - strcpy(carray, ccarray1); - void* v = carray; - const void* cv = ccarray1; - - memchr(cv, '/', 3); - strchr(ccarray1, '/'); - strpbrk(ccarray1, ccarray2); - strrchr(ccarray1, 'c'); - strstr(carray, carray); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/1.cc deleted file mode 100644 index 3ad6aed1e0a..00000000000 --- a/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/1.cc +++ /dev/null @@ -1,69 +0,0 @@ -// 2001-04-02 Benjamin Kosnik <bkoz@redhat.com> - -// 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. - -// 21.4: null-terminiated sequence utilities - -#include <string> -#include <cstring> -#include <cwchar> - -void test01() -{ - bool test = true; - wchar_t c = L'a'; - const wchar_t cc = L'b'; - wchar_t* c1 = &c; - const wchar_t* cc1 = &cc; - const wchar_t* ccarray1 = L"san francisco roof garden inspectors"; - const wchar_t* ccarray2 = L"san francisco sunny-day park inspectors"; - wchar_t carray[50]; - std::wcscpy(carray, ccarray1); - - // const wchar_t* wcschr(const wchar_t* s, wchar_t c); - // wchar_t* wcschr(wchar_t* s, wchar_t c); - cc1 = std::wcschr(ccarray1, L'c'); - c1 = std::wcschr(carray, L'c'); - - // const char* wcspbrk(const wchar_t* s1, const wchar_t* s2); - // char* wcspbrk(wchar_t* s1, const wchar_t* s2); - cc1 = std::wcspbrk(ccarray1, ccarray2); - c1 = std::wcspbrk(carray, ccarray2); - - // const wchar_t* strrchr(const wchar_t* s, wchar_t c); - // wchar_t* strrchr(wchar_t* s, wchar_t c); - cc1 = std::wcsrchr(ccarray1, L'c'); - c1 = std::wcsrchr(carray, L'c'); - - // const wchar_t* strstr(const wchar_t* s1, const wchar_t* s2); - // wchar_t* strstr(wchar_t* s1, const wchar_t* s2); - cc1 = std::wcsstr(ccarray1, ccarray2); - c1 = std::wcsstr(carray, carray); - - // const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n); - // wchar_t* wmemchr( wchar_t* s, wchar_t c, size_t n); - cc1 = std::wmemchr(ccarray1, L'a', 3); - c1 = std::wmemchr(carray, L'a', 3); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/2.cc deleted file mode 100644 index 3a8f77cd335..00000000000 --- a/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/2.cc +++ /dev/null @@ -1,47 +0,0 @@ -// 2001-04-02 Benjamin Kosnik <bkoz@redhat.com> - -// 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. - -// 21.4: null-terminiated sequence utilities - -#include <string> -#include <cstring> -#include <cwchar> - -void test02() -{ - using namespace std; - - const wchar_t* ccarray1 = L"san francisco roof garden inspectors"; - const wchar_t* ccarray2 = L"san francisco sunny-day park inspectors"; - wchar_t carray[50]; - wcscpy(carray, ccarray1); - - wmemchr(ccarray1, L'/', 3); - wcschr(ccarray1, L'/'); - wcspbrk(ccarray1, ccarray2); - wcsrchr(ccarray1, L'c'); - wcsstr(carray, carray); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/1.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/1.cc deleted file mode 100644 index 29322b24457..00000000000 --- a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/1.cc +++ /dev/null @@ -1,109 +0,0 @@ -// 1999-06-03 bkoz - -// Copyright (C) 1999, 2000, 2001, 2003 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. - -// 21.1.1 Characher traits requirements - -#include <string> -#include <testsuite_hooks.h> - -void test01(void) -{ - bool test = true; - const std::wstring str_01(L"zuma beach"); - const std::wstring str_02(L"montara and ocean beach"); - - // 21.1.1 character traits requirements - - // Key for decoding what function signatures really mean: - // X == char_traits<_CharT> - // [c,d] == _CharT - // [p,q] == const _CharT* - // s == _CharT* - // [n,i,j] == size_t - // f == X::int_type - // pos == X::pos_type - // state == X::state_type - - // void X::assign(wchar_t c, wchar_t d) - // assigns c = d; - wchar_t c1 = L'z'; - wchar_t c2 = L'u'; - VERIFY( c1 != c2 ); - std::char_traits<wchar_t>::assign(c1,c2); - VERIFY( c1 == L'u' ); - - // char* X::move(char* s, const char* p, size_t n) - // for each i in [0,n) performs X::assign(s[i], p[i]). Copies - // correctly even where p is in [s, s + n), and yields s. - wchar_t array1[] = {L'z', L'u', L'm', L'a', L' ', L'b', L'e', L'a', L'c', L'h', 0}; - const wchar_t str_lit1[] = L"montara and ocean beach"; - int len = sizeof(str_lit1) + sizeof(array1) - 1; // two terminating chars - wchar_t array2[len]; - - VERIFY( str_lit1[0] == 'm' ); - c1 = array2[0]; - c2 = str_lit1[0]; - wchar_t c3 = array2[1]; - wchar_t c4 = str_lit1[1]; - std::char_traits<wchar_t>::move(array2, str_lit1, 0); - VERIFY( array2[0] == c1 ); - VERIFY( str_lit1[0] == c2 ); - std::char_traits<wchar_t>::move(array2, str_lit1, 1); - VERIFY( array2[0] == c2 ); - VERIFY( str_lit1[0] == c2 ); - VERIFY( array2[1] == c3 ); - VERIFY( str_lit1[1] == c4 ); - std::char_traits<wchar_t>::move(array2, str_lit1, 2); - VERIFY( array2[0] == c2 ); - VERIFY( str_lit1[0] == c2 ); - VERIFY( array2[1] == c4 ); - VERIFY( str_lit1[1] == c4 ); - - wchar_t* pc1 = array1 + 1; - c1 = pc1[0]; - c2 = array1[0]; - VERIFY( c1 != c2 ); - wchar_t* pc2 = std::char_traits<wchar_t>::move(array1, pc1, 0); - c3 = pc1[0]; - c4 = array1[0]; - VERIFY( c1 == c3 ); - VERIFY( c2 == c4 ); - VERIFY( pc2 == array1 ); - - c1 = pc1[0]; - c2 = array1[0]; - wchar_t* pc3 = pc1; - pc2 = std::char_traits<wchar_t>::move(array1, pc1, 10); - c3 = pc1[0]; - c4 = array1[0]; - VERIFY( c1 != c3 ); // underlying wchar_t array changed. - VERIFY( c4 != c3 ); - VERIFY( pc2 == array1 ); - VERIFY( pc3 == pc1 ); // but pointers o-tay - c1 = *(str_01.data()); - c2 = array1[0]; - VERIFY( c1 != c2 ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/1.cc deleted file mode 100644 index a93d2f50f2e..00000000000 --- a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/1.cc +++ /dev/null @@ -1,109 +0,0 @@ -// 1999-06-03 bkoz - -// Copyright (C) 1999, 2000, 2001, 2003 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. - -// 21.1.1 Characher traits requirements - -#include <string> -#include <testsuite_hooks.h> - -void test02(void) -{ - bool test = true; - const std::wstring str_01(L"zuma beach"); - const std::wstring str_02(L"montara and ocean beach"); - - // 21.1.1 character traits requirements - - // Key for decoding what function signatures really mean: - // X == char_traits<_CharT> - // [c,d] == _CharT - // [p,q] == const _CharT* - // s == _CharT* - // [n,i,j] == size_t - // f == X::int_type - // pos == X::pos_type - // state == X::state_type - - // void X::assign(wchar_t c, wchar_t d) - // assigns c = d; - wchar_t c1 = L'z'; - wchar_t c2 = L'u'; - VERIFY( c1 != c2 ); - std::char_traits<wchar_t>::assign(c1,c2); - VERIFY( c1 == L'u' ); - - // char* X::move(char* s, const char* p, size_t n) - // for each i in [0,n) performs X::assign(s[i], p[i]). Copies - // correctly even where p is in [s, s + n), and yields s. - wchar_t array1[] = {L'z', L'u', L'm', L'a', L' ', L'b', L'e', L'a', L'c', L'h', 0}; - const wchar_t str_lit1[] = L"montara and ocean beach"; - int len = sizeof(str_lit1) + sizeof(array1) - 1; // two terminating chars - wchar_t array2[len]; - - VERIFY( str_lit1[0] == 'm' ); - c1 = array2[0]; - c2 = str_lit1[0]; - wchar_t c3 = array2[1]; - wchar_t c4 = str_lit1[1]; - std::char_traits<wchar_t>::move(array2, str_lit1, 0); - VERIFY( array2[0] == c1 ); - VERIFY( str_lit1[0] == c2 ); - std::char_traits<wchar_t>::move(array2, str_lit1, 1); - VERIFY( array2[0] == c2 ); - VERIFY( str_lit1[0] == c2 ); - VERIFY( array2[1] == c3 ); - VERIFY( str_lit1[1] == c4 ); - std::char_traits<wchar_t>::move(array2, str_lit1, 2); - VERIFY( array2[0] == c2 ); - VERIFY( str_lit1[0] == c2 ); - VERIFY( array2[1] == c4 ); - VERIFY( str_lit1[1] == c4 ); - - wchar_t* pc1 = array1 + 1; - c1 = pc1[0]; - c2 = array1[0]; - VERIFY( c1 != c2 ); - wchar_t* pc2 = std::char_traits<wchar_t>::move(array1, pc1, 0); - c3 = pc1[0]; - c4 = array1[0]; - VERIFY( c1 == c3 ); - VERIFY( c2 == c4 ); - VERIFY( pc2 == array1 ); - - c1 = pc1[0]; - c2 = array1[0]; - wchar_t* pc3 = pc1; - pc2 = std::char_traits<wchar_t>::move(array1, pc1, 10); - c3 = pc1[0]; - c4 = array1[0]; - VERIFY( c1 != c3 ); // underlying wchar_t array changed. - VERIFY( c4 != c3 ); - VERIFY( pc2 == array1 ); - VERIFY( pc3 == pc1 ); // but pointers o-tay - c1 = *(str_01.data()); - c2 = array1[0]; - VERIFY( c1 != c2 ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/typedefs/char/1.cc b/libstdc++-v3/testsuite/21_strings/char_traits/typedefs/char/1.cc deleted file mode 100644 index 4f2d061fb09..00000000000 --- a/libstdc++-v3/testsuite/21_strings/char_traits/typedefs/char/1.cc +++ /dev/null @@ -1,34 +0,0 @@ -// 2001-02-11 gdr -// Origin: Craig Rodrigues <rodrigc@mediaone.net> - -// Copyright (C) 2001, 2003 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. - -// 21.1.2: char_traits typedefs - -#include <string> - -int main() -{ - // 21.1.3: char_traits<char>::int_type == int - // dg-options -ansi -pedantic-err - std::char_traits<char>::int_type* p = 0; - int* q = p; // dg-do compile - - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/1.cc deleted file mode 100644 index fa285752871..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/1.cc +++ /dev/null @@ -1,44 +0,0 @@ -// { dg-do compile } -// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 Template class codecvt - -#include <locale> - -void test01() -{ - // Check for required base class. - typedef std::codecvt<char, char, mbstate_t> test_type; - typedef std::locale::facet base_type; - const test_type& obj = std::use_facet<test_type>(std::locale()); - const base_type* base = &obj; - - // Check for required typedefs - typedef test_type::intern_type intern_type; - typedef test_type::extern_type extern_type; - typedef test_type::state_type state_type; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/2.cc b/libstdc++-v3/testsuite/22_locale/codecvt/2.cc deleted file mode 100644 index 9811239b5ed..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/2.cc +++ /dev/null @@ -1,39 +0,0 @@ -// { dg-do compile } -// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 Template class codecvt - -#include <locale> - -// Should be able to instantiate this for other types besides char, wchar_t -class gnu_codecvt: public std::codecvt<unsigned char, unsigned long, char> -{ }; - -void test02() -{ - gnu_codecvt facet01; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/1.cc deleted file mode 100644 index 523322ece87..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/1.cc +++ /dev/null @@ -1,61 +0,0 @@ -// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation, degenerate conversion. -// codecvt<char, char, mbstate_t> -void test01() -{ - using namespace std; - typedef codecvt_base::result result; - typedef codecvt<char, char, mbstate_t> c_codecvt; - - bool test = true; - const char* c_lit = "black pearl jasmine tea"; - const char* from_next; - int size = 25; - char* c_arr = new char[size]; - char* c_ref = new char[size]; - char* to_next; - - locale loc = locale::classic(); - c_codecvt::state_type state; - const c_codecvt* cvt = &use_facet<c_codecvt>(loc); - - // According to the resolution of DR19 (see also libstd++/9168), in - // case of degenerate conversion ('noconv'), "there are no changes to - // the values in [to, to_limit)." - memset(c_ref, 'X', size); - - VERIFY( cvt->always_noconv() ); - - delete [] c_arr; - delete [] c_ref; -} - -int main () -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/char/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/1.cc deleted file mode 100644 index 6b57c89232f..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/1.cc +++ /dev/null @@ -1,44 +0,0 @@ -// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test01() -{ - using namespace std; - bool test = true; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - - locale loc; - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - VERIFY( !cvt->always_noconv() ); -} - -int main () -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/2.cc deleted file mode 100644 index 07b3a2dabd0..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/2.cc +++ /dev/null @@ -1,47 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// Baseline test in ISO-8859-1 locale -void test02() -{ - using namespace std; - bool test = true; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - - locale loc ("en_US.ISO-8859-1"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - VERIFY( !cvt->always_noconv() ); -} - -int main () -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/3.cc deleted file mode 100644 index b44e86f7079..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/3.cc +++ /dev/null @@ -1,47 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// Baseline test in ISO-8859-15 locale -void test03() -{ - using namespace std; - bool test = true; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - - locale loc ("en_US.ISO-8859-15"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - VERIFY( !cvt->always_noconv() ); -} - -int main () -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/4.cc deleted file mode 100644 index 15a8546c3d7..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/4.cc +++ /dev/null @@ -1,47 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// Baseline test in UTF-8 locale -void test04() -{ - using namespace std; - bool test = true; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - - locale loc ("en_US.UTF-8"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - VERIFY( !cvt->always_noconv() ); -} - -int main () -{ - test04(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/always_noconv/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/1.cc deleted file mode 100644 index 9ac07c5f044..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/1.cc +++ /dev/null @@ -1,62 +0,0 @@ -// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation, degenerate conversion. -// codecvt<char, char, mbstate_t> -void test01() -{ - using namespace std; - typedef codecvt_base::result result; - typedef codecvt<char, char, mbstate_t> c_codecvt; - - bool test = true; - const char* c_lit = "black pearl jasmine tea"; - const char* from_next; - int size = 25; - char* c_arr = new char[size]; - char* c_ref = new char[size]; - char* to_next; - - locale loc = locale::classic(); - c_codecvt::state_type state; - const c_codecvt* cvt = &use_facet<c_codecvt>(loc); - - // According to the resolution of DR19 (see also libstd++/9168), in - // case of degenerate conversion ('noconv'), "there are no changes to - // the values in [to, to_limit)." - memset(c_ref, 'X', size); - - int i = cvt->encoding(); - VERIFY( i == 1 ); - - delete [] c_arr; - delete [] c_ref; -} - -int main () -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/char/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/1.cc deleted file mode 100644 index d2fa938e892..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/1.cc +++ /dev/null @@ -1,45 +0,0 @@ -// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test01() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - bool test = true; - - locale loc_c = locale::classic(); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc_c); - - int i = cvt->encoding(); - VERIFY( i == 1 ); // Depends both on target and locale. -} - -int main () -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/2.cc deleted file mode 100644 index 9c7f5d040e6..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/2.cc +++ /dev/null @@ -1,48 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// Test do_encoding with ISO-8859-1 locale. -void test02() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - bool test = true; - - locale loc ("en_US.ISO-8859-1"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - int i = cvt->encoding(); - VERIFY( i == 1 ); // ISO-8859-1 is a single-byte encoding -} - -int main () -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/3.cc deleted file mode 100644 index 98a8961113e..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/3.cc +++ /dev/null @@ -1,48 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// Test do_encoding with ISO-8859-15 locale. -void test03() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - bool test = true; - - locale loc ("en_US.ISO-8859-15"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - int i = cvt->encoding(); - VERIFY( i == 1 ); // ISO-8859-15 is a single-byte encoding -} - -int main () -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/4.cc deleted file mode 100644 index f2ada106694..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/4.cc +++ /dev/null @@ -1,48 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// Test do_encoding with UTF-8 locale. -void test04() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - bool test = true; - - locale loc ("en_US.UTF-8"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - int i = cvt->encoding(); - VERIFY( i == 0 ); // UTF-8 is a stateless multibyte encoding -} - -int main () -{ - test04(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/encoding/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/char/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/char/1.cc deleted file mode 100644 index 71f6ac77498..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/char/1.cc +++ /dev/null @@ -1,68 +0,0 @@ -// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation, degenerate conversion. -// codecvt<char, char, mbstate_t> -void test01() -{ - using namespace std; - typedef codecvt_base::result result; - typedef codecvt<char, char, mbstate_t> c_codecvt; - - bool test = true; - const char* c_lit = "black pearl jasmine tea"; - const char* from_next; - int size = 25; - char* c_arr = new char[size]; - char* c_ref = new char[size]; - char* to_next; - - locale loc = locale::classic(); - c_codecvt::state_type state; - const c_codecvt* cvt = &use_facet<c_codecvt>(loc); - - // According to the resolution of DR19 (see also libstd++/9168), in - // case of degenerate conversion ('noconv'), "there are no changes to - // the values in [to, to_limit)." - memset(c_ref, 'X', size); - - // in - memset(c_arr, 'X', size); - result r1 = cvt->in(state, c_lit, c_lit + size, from_next, - c_arr, c_arr + size, to_next); - VERIFY( r1 == codecvt_base::noconv ); - VERIFY( !memcmp(c_arr, c_ref, size) ); - VERIFY( from_next == c_lit ); - VERIFY( to_next == c_arr ); - - delete [] c_arr; - delete [] c_ref; -} - -int main () -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/char/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/char/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/char/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/char/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/1.cc deleted file mode 100644 index d5a410a7741..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/1.cc +++ /dev/null @@ -1,85 +0,0 @@ -// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// Baseline test for "C" locale -void test01() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<wchar_t> int_traits; - - bool test = true; - const ext_type* e_lit = "black pearl jasmine tea"; - const ext_type* efrom_next; - const int_type* i_lit = L"black pearl jasmine tea"; - int size = strlen(e_lit); - int_type* i_arr = new int_type[size + 1]; - int_type* i_ref = new int_type[size + 1]; - wmemset(i_arr, 0xdeadbeef, size + 1); - wmemset(i_ref, 0xdeadbeef, size + 1); - int_type* ito_next; - - locale loc; - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // in - w_codecvt::state_type state01; - zero_state(state01); - result r1 = cvt->in(state01, e_lit, e_lit + size, efrom_next, - i_arr, i_arr + size, ito_next); - VERIFY( r1 == codecvt_base::ok ); - VERIFY( efrom_next == e_lit + size ); - VERIFY( ito_next == i_arr + size ); - VERIFY( !int_traits::compare(i_arr, i_lit, size) ); - VERIFY( !int_traits::compare(ito_next, i_ref, 1) ); - - delete [] i_arr; - delete [] i_ref; -} - -int main () -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/2.cc deleted file mode 100644 index d9e55ef3858..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/2.cc +++ /dev/null @@ -1,114 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// Baseline test for ISO-8859-1. Converts entire charset. -void test02() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<wchar_t> int_traits; - - bool test = true; - const ext_type* e_lit = - "\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13" - "\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20!\"#$%&" - "'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`" - "abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86" - "\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95" - "\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4" - "\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3" - "\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2" - "\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1" - "\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0" - "\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe" - "\xff"; - - const ext_type* efrom_next; - const int_type* i_lit = - L"\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13" - L"\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20!\"#$%&" - L"'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`" - L"abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86" - L"\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95" - L"\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4" - L"\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3" - L"\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2" - L"\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1" - L"\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0" - L"\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - L"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe" - L"\xff"; - - int size = strlen(e_lit); - int_type* i_arr = new int_type[size + 1]; - int_type* i_ref = new int_type[size + 1]; - wmemset(i_arr, 0xdeadbeef, size + 1); - wmemset(i_ref, 0xdeadbeef, size + 1); - int_type* ito_next; - - locale loc ("en_US.ISO-8859-1"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // in - w_codecvt::state_type state01; - zero_state(state01); - result r1 = cvt->in(state01, e_lit, e_lit + size, efrom_next, - i_arr, i_arr + size, ito_next); - VERIFY( r1 == codecvt_base::ok ); - VERIFY( efrom_next == e_lit + size ); - VERIFY( ito_next == i_arr + size ); - VERIFY( !int_traits::compare(i_arr, i_lit, size) ); - VERIFY( !int_traits::compare(ito_next, i_ref, 1) ); - - delete [] i_arr; - delete [] i_ref; -} - -int main () -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/3.cc deleted file mode 100644 index 152e7e9fe4f..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/3.cc +++ /dev/null @@ -1,128 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// Baseline test for ISO-8859-15. Converts entire charset. -void test03() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<wchar_t> int_traits; - - bool test = true; - const ext_type* e_lit = - "\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13" - "\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20!\"#$%&" - "'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`" - "abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86" - "\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95" - "\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4" - "\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3" - "\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2" - "\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1" - "\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0" - "\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe" - "\xff"; - - const ext_type* efrom_next; - const int_type i_lit[] = { - 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, - 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, L'!', - L'"', L'#', L'$', L'%', L'&', L'\'', L'(', L')', L'*', L'+', - L',', L'-', L'.', L'/', L'0', L'1', L'2', L'3', L'4', L'5', - L'6', L'7', L'8', L'9', L':', L';', L'<', L'=', L'>', L'?', - L'@', L'A', L'B', L'C', L'D', L'E', L'F', L'G', L'H', L'I', - L'J', L'K', L'L', L'M', L'N', L'O', L'P', L'Q', L'R', L'S', - L'T', L'U', L'V', L'W', L'X', L'Y', L'Z', L'[', L'\\', L']', - L'^', L'_', L'`', L'a', L'b', L'c', L'd', L'e', L'f', L'g', - L'h', L'i', L'j', L'k', L'l', L'm', L'n', L'o', L'p', L'q', - L'r', L's', L't', L'u', L'v', L'w', L'x', L'y', L'z', L'{', - L'|', L'}', L'~', 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, - 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, - 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, - 0x20ac, 0xa5, 0x160, 0xa7, 0x161, 0xa9, 0xaa, 0xab, 0xac, 0xad, - 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0x17d, 0xb5, 0xb6, 0xb7, - 0x17e, 0xb9, 0xba, 0xbb, 0x152, 0x153, 0x178, 0xbf, 0xc0, 0xc1, - 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, - 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, - 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, - 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, - 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, - 0xfe, 0xff, 0x0 - }; - - int size = strlen(e_lit); - int_type* i_arr = new int_type[size + 1]; - int_type* i_ref = new int_type[size + 1]; - wmemset(i_arr, 0xdeadbeef, size + 1); - wmemset(i_ref, 0xdeadbeef, size + 1); - int_type* ito_next; - - locale loc ("en_US.ISO-8859-15"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // in - w_codecvt::state_type state01; - zero_state(state01); - result r1 = cvt->in(state01, e_lit, e_lit + size, efrom_next, - i_arr, i_arr + size, ito_next); - VERIFY( r1 == codecvt_base::ok ); - VERIFY( efrom_next == e_lit + size ); - VERIFY( ito_next == i_arr + size ); - VERIFY( !int_traits::compare(i_arr, i_lit, size) ); - VERIFY( !int_traits::compare(ito_next, i_ref, 1) ); - - delete [] i_arr; - delete [] i_ref; -} - -int main () -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/4.cc deleted file mode 100644 index c916a16b6c9..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/4.cc +++ /dev/null @@ -1,136 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// Baseline test for UTF-8. Converts a selection of characters into -// an array that is known to be of the exact needed size. -void test04() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<wchar_t> int_traits; - - bool test = true; - const ext_type* e_lit = - "\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13" - "\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20!\"#$%&" - "'()*+,-./0123456789:;<=>?@}~\x7f\xc2\x80\xc2\x81\xc2\x82\xc2" - "\x83\xc2\x84\xc2\x85\xc2\x86\xc2\x87\xc2\x88\xc2\x89\xc2\x8a" - "\xc2\x8b\xc2\x8c\xc2\x8d\xc2\x8e\xc2\x8f\xc2\x90\xc2\x91\xc2" - "\x92\xc2\x93\xc2\x94\xc2\x95\xc2\x96\xc2\x97\xc2\x98\xc2\x99" - "\xc2\x9a\xc2\x9b\xc2\x9c\xc3\xba\xc3\xbb\xc3\xbc\xc3\xbd\xc3" - "\xbe\xc3\xbf\xc4\x80\xc4\x81\xc4\x82\xc4\x83\xc4\x84\xc4\x85" - "\xc4\x86\xc4\x87\xc4\x88\xc4\x89\xc4\x8a\xc4\x8b\xc4\x8c\xc4" - "\x8d\xc4\x8e\xc4\x8f\xc4\x90\xc4\x91\xc4\x92\xc4\x93\xc4\x94" - "\xc4\x95\xc4\x96\xc4\x97\xc4\x98\xc4\x99\xdf\xb8\xdf\xb9\xdf" - "\xba\xdf\xbb\xdf\xbc\xdf\xbd\xdf\xbe\xdf\xbf\xe0\xa0\x80\xe0" - "\xa0\x81\xe0\xa0\x82\xe0\xa0\x83\xe0\xa0\x84\xe0\xa0\x85\xe0" - "\xa0\x86\xe0\xa0\x87\xe0\xa0\x88\xe0\xa0\x89\xe0\xa0\x8a\xe0" - "\xa0\x8b\xe0\xa0\x8c\xe0\xa0\x8d\xe0\xa0\x8e\xe0\xa0\x8f\xe0" - "\xa0\x90\xe0\xa0\x91\xe0\xa0\x92\xe0\xa0\x93\xe0\xa0\x94\xe0" - "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" - "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" - "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; - - const ext_type* efrom_next; - const int_type i_lit[] = { - 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, - 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, L'!', - L'"', L'#', L'$', L'%', L'&', L'\'', L'(', L')', L'*', L'+', - L',', L'-', L'.', L'/', L'0', L'1', L'2', L'3', L'4', L'5', - L'6', L'7', L'8', L'9', L':', L';', L'<', L'=', L'>', L'?', - L'@', L'}', L'~', 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, - 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, - 0x9a, 0x9b, 0x9c, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0x100, - 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107, 0x108, 0x109, - 0x10a, 0x10b, 0x10c, 0x10d, 0x10e, 0x10f, 0x110, 0x111, 0x112, - 0x113, 0x114, 0x115, 0x116, 0x117, 0x118, 0x119, 0x7f8, 0x7f9, - 0x7fa, 0x7fb, 0x7fc, 0x7fd, 0x7fe, 0x7ff, 0x800, 0x801, 0x802, - 0x803, 0x804, 0x805, 0x806, 0x807, 0x808, 0x809, 0x80a, 0x80b, - 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, - 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', - 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 - }; - - int esize = strlen(e_lit); - int isize = wcslen(i_lit); - int_type* i_arr = new int_type[esize + 1]; - int_type* i_ref = new int_type[esize + 1]; - wmemset(i_arr, 0xdeadbeef, esize + 1); - wmemset(i_ref, 0xdeadbeef, esize + 1); - int_type* ito_next; - - locale loc ("en_US.UTF-8"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // in - w_codecvt::state_type state01; - zero_state(state01); - result r1 = cvt->in(state01, e_lit, e_lit + esize, efrom_next, - i_arr, i_arr + isize, ito_next); - VERIFY( r1 == codecvt_base::ok ); - VERIFY( efrom_next == e_lit + esize ); - VERIFY( ito_next == i_arr + isize ); - VERIFY( !int_traits::compare(i_arr, i_lit, isize) ); - VERIFY( !int_traits::compare(ito_next, i_ref, esize + 1 - isize) ); - - delete [] i_arr; - delete [] i_ref; -} - -int main () -{ - test04(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/5.cc deleted file mode 100644 index ec65f60c692..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/5.cc +++ /dev/null @@ -1,86 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// Test handling of '\0' characters in input -// libstdc++/9246 -void test05() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<wchar_t> int_traits; - - bool test = true; - const ext_type e_lit[] = { '\0', '\0', 'f', '\0' }; - const ext_type* efrom_next; - const int_type i_lit[] = { L'\0', L'\0', L'f', L'\0' }; - int size = sizeof(e_lit); - int_type* i_arr = new int_type[size + 1]; - int_type* i_ref = new int_type[size + 1]; - wmemset(i_arr, 0xdeadbeef, size + 1); - wmemset(i_ref, 0xdeadbeef, size + 1); - int_type* ito_next; - - locale loc; - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // in - w_codecvt::state_type state01; - zero_state(state01); - result r1 = cvt->in(state01, e_lit, e_lit + size, efrom_next, - i_arr, i_arr + size, ito_next); - VERIFY( r1 == codecvt_base::ok ); - VERIFY( efrom_next == e_lit + size ); - VERIFY( ito_next == i_arr + size ); - VERIFY( !int_traits::compare(i_arr, i_lit, size) ); - VERIFY( !int_traits::compare(ito_next, i_ref, 1) ); - - delete [] i_arr; - delete [] i_ref; -} - -int main () -{ - test05(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/6.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/6.cc deleted file mode 100644 index 1be30323b8b..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/6.cc +++ /dev/null @@ -1,86 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// Test handling of output buffer that is too small. -// libstdc++/9247 -void test06() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<wchar_t> int_traits; - - bool test = true; - const ext_type* e_lit = "black pearl jasmine tea"; - const ext_type* efrom_next; - const int_type* i_lit = L"black pearl jasmine tea"; - int size = strlen(e_lit); - int_type* i_arr = new int_type[size + 1]; - int_type* i_ref = new int_type[size + 1]; - wmemset(i_arr, 0xdeadbeef, size + 1); - wmemset(i_ref, 0xdeadbeef, size + 1); - int_type* ito_next; - - locale loc; - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // in - w_codecvt::state_type state01; - zero_state(state01); - result r1 = cvt->in(state01, e_lit, e_lit + size, efrom_next, - i_arr, i_arr + 1, ito_next); - VERIFY( r1 == codecvt_base::partial ); - VERIFY( efrom_next == e_lit + 1 ); - VERIFY( ito_next == i_arr + 1 ); - VERIFY( !int_traits::compare(i_arr, i_lit, 1) ); - VERIFY( !int_traits::compare(ito_next, i_ref, size) ); - - delete [] i_arr; - delete [] i_ref; -} - -int main () -{ - test06(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/7.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/7.cc deleted file mode 100644 index f692e9cee6e..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/7.cc +++ /dev/null @@ -1,86 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// Test handling of illegal input sequence in UTF-8. -void test07() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<wchar_t> int_traits; - - bool test = true; - const ext_type* e_lit = "a\xc0\xff"; - const ext_type* efrom_next; - const int_type* i_lit = L"a"; - int size = strlen(e_lit); - int_type* i_arr = new int_type[size + 1]; - int_type* i_ref = new int_type[size + 1]; - wmemset(i_arr, 0xdeadbeef, size + 1); - wmemset(i_ref, 0xdeadbeef, size + 1); - int_type* ito_next; - - locale loc ("en_US.UTF-8"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // in - w_codecvt::state_type state01; - zero_state(state01); - result r1 = cvt->in(state01, e_lit, e_lit + size, efrom_next, - i_arr, i_arr + size, ito_next); - VERIFY( r1 == codecvt_base::error ); - VERIFY( efrom_next == e_lit + 1 ); - VERIFY( ito_next == i_arr + 1 ); - VERIFY( !int_traits::compare(i_arr, i_lit, 1) ); - VERIFY( !int_traits::compare(ito_next, i_ref, size) ); - - delete [] i_arr; - delete [] i_ref; -} - -int main () -{ - test07(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/8.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/8.cc deleted file mode 100644 index 28b1fa04f80..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/8.cc +++ /dev/null @@ -1,135 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// Test UTF-8 with output buffer larger than needed. -void test08() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<wchar_t> int_traits; - - bool test = true; - const ext_type* e_lit = - "\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13" - "\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20!\"#$%&" - "'()*+,-./0123456789:;<=>?@}~\x7f\xc2\x80\xc2\x81\xc2\x82\xc2" - "\x83\xc2\x84\xc2\x85\xc2\x86\xc2\x87\xc2\x88\xc2\x89\xc2\x8a" - "\xc2\x8b\xc2\x8c\xc2\x8d\xc2\x8e\xc2\x8f\xc2\x90\xc2\x91\xc2" - "\x92\xc2\x93\xc2\x94\xc2\x95\xc2\x96\xc2\x97\xc2\x98\xc2\x99" - "\xc2\x9a\xc2\x9b\xc2\x9c\xc3\xba\xc3\xbb\xc3\xbc\xc3\xbd\xc3" - "\xbe\xc3\xbf\xc4\x80\xc4\x81\xc4\x82\xc4\x83\xc4\x84\xc4\x85" - "\xc4\x86\xc4\x87\xc4\x88\xc4\x89\xc4\x8a\xc4\x8b\xc4\x8c\xc4" - "\x8d\xc4\x8e\xc4\x8f\xc4\x90\xc4\x91\xc4\x92\xc4\x93\xc4\x94" - "\xc4\x95\xc4\x96\xc4\x97\xc4\x98\xc4\x99\xdf\xb8\xdf\xb9\xdf" - "\xba\xdf\xbb\xdf\xbc\xdf\xbd\xdf\xbe\xdf\xbf\xe0\xa0\x80\xe0" - "\xa0\x81\xe0\xa0\x82\xe0\xa0\x83\xe0\xa0\x84\xe0\xa0\x85\xe0" - "\xa0\x86\xe0\xa0\x87\xe0\xa0\x88\xe0\xa0\x89\xe0\xa0\x8a\xe0" - "\xa0\x8b\xe0\xa0\x8c\xe0\xa0\x8d\xe0\xa0\x8e\xe0\xa0\x8f\xe0" - "\xa0\x90\xe0\xa0\x91\xe0\xa0\x92\xe0\xa0\x93\xe0\xa0\x94\xe0" - "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" - "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" - "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; - - const ext_type* efrom_next; - const int_type i_lit[] = { - 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, - 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, L'!', - L'"', L'#', L'$', L'%', L'&', L'\'', L'(', L')', L'*', L'+', - L',', L'-', L'.', L'/', L'0', L'1', L'2', L'3', L'4', L'5', - L'6', L'7', L'8', L'9', L':', L';', L'<', L'=', L'>', L'?', - L'@', L'}', L'~', 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, - 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, - 0x9a, 0x9b, 0x9c, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0x100, - 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107, 0x108, 0x109, - 0x10a, 0x10b, 0x10c, 0x10d, 0x10e, 0x10f, 0x110, 0x111, 0x112, - 0x113, 0x114, 0x115, 0x116, 0x117, 0x118, 0x119, 0x7f8, 0x7f9, - 0x7fa, 0x7fb, 0x7fc, 0x7fd, 0x7fe, 0x7ff, 0x800, 0x801, 0x802, - 0x803, 0x804, 0x805, 0x806, 0x807, 0x808, 0x809, 0x80a, 0x80b, - 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, - 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', - 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 - }; - - int esize = strlen(e_lit); - int isize = wcslen(i_lit); - int_type* i_arr = new int_type[esize + 1]; - int_type* i_ref = new int_type[esize + 1]; - wmemset(i_arr, 0xdeadbeef, esize + 1); - wmemset(i_ref, 0xdeadbeef, esize + 1); - int_type* ito_next; - - locale loc ("en_US.UTF-8"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // in - w_codecvt::state_type state01; - zero_state(state01); - result r1 = cvt->in(state01, e_lit, e_lit + esize, efrom_next, - i_arr, i_arr + esize, ito_next); - VERIFY( r1 == codecvt_base::ok ); - VERIFY( efrom_next == e_lit + esize ); - VERIFY( ito_next == i_arr + isize ); - VERIFY( !int_traits::compare(i_arr, i_lit, isize) ); - VERIFY( !int_traits::compare(ito_next, i_ref, esize + 1 - isize) ); - - delete [] i_arr; - delete [] i_ref; -} - -int main () -{ - test08(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/9.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/9.cc deleted file mode 100644 index 0ddebc771a9..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/9.cc +++ /dev/null @@ -1,158 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// Test one source character at a time for UTF-8 -void test09() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<wchar_t> int_traits; - - bool test = true; - const ext_type* e_lit = - "\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13" - "\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20!\"#$%&" - "'()*+,-./0123456789:;<=>?@}~\x7f\xc2\x80\xc2\x81\xc2\x82\xc2" - "\x83\xc2\x84\xc2\x85\xc2\x86\xc2\x87\xc2\x88\xc2\x89\xc2\x8a" - "\xc2\x8b\xc2\x8c\xc2\x8d\xc2\x8e\xc2\x8f\xc2\x90\xc2\x91\xc2" - "\x92\xc2\x93\xc2\x94\xc2\x95\xc2\x96\xc2\x97\xc2\x98\xc2\x99" - "\xc2\x9a\xc2\x9b\xc2\x9c\xc3\xba\xc3\xbb\xc3\xbc\xc3\xbd\xc3" - "\xbe\xc3\xbf\xc4\x80\xc4\x81\xc4\x82\xc4\x83\xc4\x84\xc4\x85" - "\xc4\x86\xc4\x87\xc4\x88\xc4\x89\xc4\x8a\xc4\x8b\xc4\x8c\xc4" - "\x8d\xc4\x8e\xc4\x8f\xc4\x90\xc4\x91\xc4\x92\xc4\x93\xc4\x94" - "\xc4\x95\xc4\x96\xc4\x97\xc4\x98\xc4\x99\xdf\xb8\xdf\xb9\xdf" - "\xba\xdf\xbb\xdf\xbc\xdf\xbd\xdf\xbe\xdf\xbf\xe0\xa0\x80\xe0" - "\xa0\x81\xe0\xa0\x82\xe0\xa0\x83\xe0\xa0\x84\xe0\xa0\x85\xe0" - "\xa0\x86\xe0\xa0\x87\xe0\xa0\x88\xe0\xa0\x89\xe0\xa0\x8a\xe0" - "\xa0\x8b\xe0\xa0\x8c\xe0\xa0\x8d\xe0\xa0\x8e\xe0\xa0\x8f\xe0" - "\xa0\x90\xe0\xa0\x91\xe0\xa0\x92\xe0\xa0\x93\xe0\xa0\x94\xe0" - "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" - "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" - "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; - - const ext_type* efrom = e_lit; - const ext_type* efrom_next; - const int_type i_lit[] = { - 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, - 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, L'!', - L'"', L'#', L'$', L'%', L'&', L'\'', L'(', L')', L'*', L'+', - L',', L'-', L'.', L'/', L'0', L'1', L'2', L'3', L'4', L'5', - L'6', L'7', L'8', L'9', L':', L';', L'<', L'=', L'>', L'?', - L'@', L'}', L'~', 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, - 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, - 0x9a, 0x9b, 0x9c, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0x100, - 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107, 0x108, 0x109, - 0x10a, 0x10b, 0x10c, 0x10d, 0x10e, 0x10f, 0x110, 0x111, 0x112, - 0x113, 0x114, 0x115, 0x116, 0x117, 0x118, 0x119, 0x7f8, 0x7f9, - 0x7fa, 0x7fb, 0x7fc, 0x7fd, 0x7fe, 0x7ff, 0x800, 0x801, 0x802, - 0x803, 0x804, 0x805, 0x806, 0x807, 0x808, 0x809, 0x80a, 0x80b, - 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, - 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', - 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 - }; - - int esize = strlen(e_lit); - int isize = wcslen(i_lit); - int_type* i_arr = new int_type[esize + 1]; - int_type* i_ref = new int_type[esize + 1]; - wmemset(i_arr, 0xdeadbeef, esize + 1); - wmemset(i_ref, 0xdeadbeef, esize + 1); - int_type* ito = i_arr; - int_type* ito_next; - - locale loc ("en_US.UTF-8"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // in - w_codecvt::state_type state01; - zero_state(state01); - result r1; - - for (int i = 0; i <= esize; ++i) - { - r1 = cvt->in(state01, efrom, e_lit + i, efrom_next, - ito, i_arr + esize, ito_next); - - printf("%d %d %d %x %x\n", efrom - e_lit, i, efrom_next - e_lit, - efrom[-1], ito[-1]); - - // It it not clear if partial should ever be returned here - // (see DR 382). - VERIFY( r1 == codecvt_base::ok || r1 == codecvt_base::partial ); - VERIFY( efrom_next >= efrom ); - VERIFY( efrom_next <= e_lit + i ); - VERIFY( ito_next >= ito ); - VERIFY( ito_next <= i_arr + isize ); - VERIFY( !int_traits::compare(i_arr, i_lit, ito_next - i_arr) ); - VERIFY( !int_traits::compare(ito_next, i_ref, - i_arr + esize + 1 - ito_next) ); - - efrom = efrom_next; - ito = ito_next; - } - - VERIFY( r1 == codecvt_base::ok ); - VERIFY( efrom_next == e_lit + esize ); - VERIFY( ito_next == i_arr + isize ); - - delete [] i_arr; - delete [] i_ref; -} - -int main () -{ - test09(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/char/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/char/1.cc deleted file mode 100644 index 3ea244dcbb0..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/length/char/1.cc +++ /dev/null @@ -1,50 +0,0 @@ -// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation, degenerate conversion. -// codecvt<char, char, mbstate_t> -void test01() -{ - using namespace std; - typedef codecvt_base::result result; - typedef codecvt<char, char, mbstate_t> c_codecvt; - - bool test = true; - const char* c_lit = "black pearl jasmine tea"; - int size = 25; - - locale loc = locale::classic(); - c_codecvt::state_type state; - const c_codecvt* cvt = &use_facet<c_codecvt>(loc); - - int j = cvt->length(state, c_lit, c_lit + size, 5); - VERIFY( j == 5 ); -} - -int main () -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/char/2.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/char/2.cc deleted file mode 100644 index 6e0a7e96f2e..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/length/char/2.cc +++ /dev/null @@ -1,69 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -bool length_called = false; - -class length_codecvt : public std::codecvt<char, char, std::mbstate_t> -{ - typedef std::codecvt<char, char, std::mbstate_t> c_codecvt; - -public: - // DR75: type of first argument of do_length is state_type& - virtual int do_length(state_type& state, const extern_type* from, - const extern_type* end, std::size_t max) const - { - length_called = true; - return c_codecvt::do_length(state, from, end, max); - } -}; - -// Required instantiation, degenerate conversion. -// codecvt<char, char, mbstate_t> -// -// libstdc++/9224 -void test02() -{ - using namespace std; - typedef codecvt_base::result result; - typedef codecvt<char, char, mbstate_t> c_codecvt; - - bool test = true; - const char* c_lit = "black pearl jasmine tea"; - int size = 25; - - locale loc (locale::classic(), new length_codecvt); - c_codecvt::state_type state; - const c_codecvt* cvt = &use_facet<c_codecvt>(loc); - - length_called = false; - cvt->length(state, c_lit, c_lit + size, 5); - VERIFY( length_called ); -} - -int main () -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/char/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/length/char/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/char/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/length/char/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/1.cc deleted file mode 100644 index 100de8567fc..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/1.cc +++ /dev/null @@ -1,64 +0,0 @@ -// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test01() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef char ext_type; - - bool test = true; - const ext_type* e_lit = "black pearl jasmine tea"; - int size = strlen(e_lit); - - locale loc; - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - w_codecvt::state_type state04; - zero_state(state04); - int j = cvt->length(state04, e_lit, e_lit + size, 5); - VERIFY( j == 5 ); -} - -int main () -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/2.cc deleted file mode 100644 index 0e90fbdc833..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/2.cc +++ /dev/null @@ -1,88 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test02() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef char ext_type; - - bool test = true; - const ext_type* e_lit = - "\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13" - "\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20!\"#$%&" - "'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`" - "abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86" - "\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95" - "\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4" - "\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3" - "\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2" - "\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1" - "\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0" - "\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe" - "\xff"; - int size = strlen(e_lit); - - locale loc ("en_US.ISO-8859-1"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - w_codecvt::state_type state01; - zero_state(state01); - int i = cvt->length(state01, e_lit, e_lit + size, 5); - VERIFY( i == 5 ); - - w_codecvt::state_type state02; - zero_state(state02); - int j = cvt->length(state02, e_lit, e_lit + size, size); - VERIFY( j == size ); - - w_codecvt::state_type state03; - zero_state(state03); - int k = cvt->length(state03, e_lit, e_lit + size, size * 2); - VERIFY( k == size ); -} - -int main () -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/3.cc deleted file mode 100644 index 8031c3edee0..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/3.cc +++ /dev/null @@ -1,88 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test03() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef char ext_type; - - bool test = true; - const ext_type* e_lit = - "\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13" - "\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20!\"#$%&" - "'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`" - "abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86" - "\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95" - "\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4" - "\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3" - "\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2" - "\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1" - "\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0" - "\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe" - "\xff"; - int size = strlen(e_lit); - - locale loc ("en_US.ISO-8859-15"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - w_codecvt::state_type state01; - zero_state(state01); - int i = cvt->length(state01, e_lit, e_lit + size, 5); - VERIFY( i == 5 ); - - w_codecvt::state_type state02; - zero_state(state02); - int j = cvt->length(state02, e_lit, e_lit + size, size); - VERIFY( j == size ); - - w_codecvt::state_type state03; - zero_state(state03); - int k = cvt->length(state03, e_lit, e_lit + size, size * 2); - VERIFY( k == size ); -} - -int main () -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/4.cc deleted file mode 100644 index 6a802bd2856..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/4.cc +++ /dev/null @@ -1,127 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test04() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef wchar_t int_type; - typedef char ext_type; - - bool test = true; - const ext_type* e_lit = - "\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13" - "\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20!\"#$%&" - "'()*+,-./0123456789:;<=>?@}~\x7f\xc2\x80\xc2\x81\xc2\x82\xc2" - "\x83\xc2\x84\xc2\x85\xc2\x86\xc2\x87\xc2\x88\xc2\x89\xc2\x8a" - "\xc2\x8b\xc2\x8c\xc2\x8d\xc2\x8e\xc2\x8f\xc2\x90\xc2\x91\xc2" - "\x92\xc2\x93\xc2\x94\xc2\x95\xc2\x96\xc2\x97\xc2\x98\xc2\x99" - "\xc2\x9a\xc2\x9b\xc2\x9c\xc3\xba\xc3\xbb\xc3\xbc\xc3\xbd\xc3" - "\xbe\xc3\xbf\xc4\x80\xc4\x81\xc4\x82\xc4\x83\xc4\x84\xc4\x85" - "\xc4\x86\xc4\x87\xc4\x88\xc4\x89\xc4\x8a\xc4\x8b\xc4\x8c\xc4" - "\x8d\xc4\x8e\xc4\x8f\xc4\x90\xc4\x91\xc4\x92\xc4\x93\xc4\x94" - "\xc4\x95\xc4\x96\xc4\x97\xc4\x98\xc4\x99\xdf\xb8\xdf\xb9\xdf" - "\xba\xdf\xbb\xdf\xbc\xdf\xbd\xdf\xbe\xdf\xbf\xe0\xa0\x80\xe0" - "\xa0\x81\xe0\xa0\x82\xe0\xa0\x83\xe0\xa0\x84\xe0\xa0\x85\xe0" - "\xa0\x86\xe0\xa0\x87\xe0\xa0\x88\xe0\xa0\x89\xe0\xa0\x8a\xe0" - "\xa0\x8b\xe0\xa0\x8c\xe0\xa0\x8d\xe0\xa0\x8e\xe0\xa0\x8f\xe0" - "\xa0\x90\xe0\xa0\x91\xe0\xa0\x92\xe0\xa0\x93\xe0\xa0\x94\xe0" - "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" - "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" - "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; - - const ext_type* efrom_next; - const int_type i_lit[] = { - 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, - 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, L'!', - L'"', L'#', L'$', L'%', L'&', L'\'', L'(', L')', L'*', L'+', - L',', L'-', L'.', L'/', L'0', L'1', L'2', L'3', L'4', L'5', - L'6', L'7', L'8', L'9', L':', L';', L'<', L'=', L'>', L'?', - L'@', L'}', L'~', 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, - 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, - 0x9a, 0x9b, 0x9c, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0x100, - 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107, 0x108, 0x109, - 0x10a, 0x10b, 0x10c, 0x10d, 0x10e, 0x10f, 0x110, 0x111, 0x112, - 0x113, 0x114, 0x115, 0x116, 0x117, 0x118, 0x119, 0x7f8, 0x7f9, - 0x7fa, 0x7fb, 0x7fc, 0x7fd, 0x7fe, 0x7ff, 0x800, 0x801, 0x802, - 0x803, 0x804, 0x805, 0x806, 0x807, 0x808, 0x809, 0x80a, 0x80b, - 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, - 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', - 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 - }; - - int esize = strlen(e_lit); - int isize = wcslen(i_lit); - - locale loc ("en_US.UTF-8"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - w_codecvt::state_type state01; - zero_state(state01); - int i = cvt->length(state01, e_lit, e_lit + esize, 5); - VERIFY( i == 5 ); - - w_codecvt::state_type state02; - zero_state(state02); - int j = cvt->length(state02, e_lit, e_lit + esize, isize); - VERIFY( j == esize ); - - w_codecvt::state_type state03; - zero_state(state03); - int k = cvt->length(state03, e_lit, e_lit + esize, esize * 2); - VERIFY( k == esize ); -} - -int main () -{ - test04(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/5.cc deleted file mode 100644 index 284233e7b6b..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/5.cc +++ /dev/null @@ -1,64 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test05() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef char ext_type; - - bool test = true; - const ext_type e_lit[] = { '\0', '\0', 'f', '\0' }; - int size = sizeof(e_lit); - - locale loc; - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - w_codecvt::state_type state04; - zero_state(state04); - int j = cvt->length(state04, e_lit, e_lit + size, 5); - VERIFY( j == size ); -} - -int main () -{ - test05(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/6.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/6.cc deleted file mode 100644 index 76c151edf05..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/6.cc +++ /dev/null @@ -1,84 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -bool length_called = false; - -class length_codecvt : public std::codecvt<wchar_t, char, std::mbstate_t> -{ - typedef std::codecvt<wchar_t, char, std::mbstate_t> w_codecvt; - -public: - // DR75: type of first argument of do_length is state_type& - virtual int do_length(state_type& state, const extern_type* from, - const extern_type* end, std::size_t max) const - { - length_called = true; - return w_codecvt::do_length(state, from, end, max); - } -}; - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// libstdc++/9224 -void test06() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef char ext_type; - - bool test = true; - const ext_type* e_lit = "black pearl jasmine tea"; - int size = strlen(e_lit); - - locale loc; - loc = locale(loc, new length_codecvt); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - w_codecvt::state_type state04; - zero_state(state04); - length_called = false; - cvt->length(state04, e_lit, e_lit + size, 5); - VERIFY( length_called ); -} - -int main () -{ - test06(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/7.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/7.cc deleted file mode 100644 index 8a275e35a37..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/7.cc +++ /dev/null @@ -1,79 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// Test handling of illegal input sequence in UTF-8. -void test07() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef wchar_t int_type; - typedef char ext_type; - - bool test = true; - const ext_type* e_lit = "a\xc0\xff"; - const ext_type* efrom_next; - int size = strlen(e_lit); - - locale loc ("en_US.UTF-8"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - w_codecvt::state_type state01; - zero_state(state01); - int i = cvt->length(state01, e_lit, e_lit + size, 1); - VERIFY( i == 1 ); - - w_codecvt::state_type state02; - zero_state(state02); - int j = cvt->length(state02, e_lit, e_lit + size, size); - VERIFY( j == 1 ); - - w_codecvt::state_type state03; - zero_state(state03); - int k = cvt->length(state03, e_lit, e_lit + size, size * 2); - VERIFY( k == 1 ); -} - -int main () -{ - test07(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/1.cc deleted file mode 100644 index 789007ae905..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/1.cc +++ /dev/null @@ -1,62 +0,0 @@ -// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation, degenerate conversion. -// codecvt<char, char, mbstate_t> -void test01() -{ - using namespace std; - typedef codecvt_base::result result; - typedef codecvt<char, char, mbstate_t> c_codecvt; - - bool test = true; - const char* c_lit = "black pearl jasmine tea"; - const char* from_next; - int size = 25; - char* c_arr = new char[size]; - char* c_ref = new char[size]; - char* to_next; - - locale loc = locale::classic(); - c_codecvt::state_type state; - const c_codecvt* cvt = &use_facet<c_codecvt>(loc); - - // According to the resolution of DR19 (see also libstd++/9168), in - // case of degenerate conversion ('noconv'), "there are no changes to - // the values in [to, to_limit)." - memset(c_ref, 'X', size); - - int k = cvt->max_length(); - VERIFY( k == 1 ); - - delete [] c_arr; - delete [] c_ref; -} - -int main () -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/char/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/1.cc deleted file mode 100644 index 5ecc99e0c6a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/1.cc +++ /dev/null @@ -1,45 +0,0 @@ -// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test01() -{ - using namespace std; - bool test = true; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - - locale loc_c = locale::classic(); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc_c); - - int k = cvt->max_length(); - VERIFY( k == 1 ); -} - -int main () -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/2.cc deleted file mode 100644 index 9c76752d611..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/2.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test02() -{ - using namespace std; - bool test = true; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - - locale loc ("en_US.ISO-8859-1"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - int k = cvt->max_length(); - VERIFY( k == 1 ); // ISO-8859-1 is a single-byte encoding -} - -int main () -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/3.cc deleted file mode 100644 index 2d312bddc31..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/3.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test03() -{ - using namespace std; - bool test = true; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - - locale loc ("en_US.ISO-8859-15"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - int k = cvt->max_length(); - VERIFY( k == 1 ); // ISO-8859-15 is a single-byte encoding -} - -int main () -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/4.cc deleted file mode 100644 index cd4d08d5733..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/4.cc +++ /dev/null @@ -1,48 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test04() -{ - using namespace std; - bool test = true; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - - locale loc ("en_US.UTF-8"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - int k = cvt->max_length(); - // Each UCS-4 wide character can be converted to at most 6 narrow - // characters in the UTF-8 encoding. - VERIFY( k == 6 ); -} - -int main () -{ - test04(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/max_length/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/char/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/char/1.cc deleted file mode 100644 index f0ef0a5da63..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/out/char/1.cc +++ /dev/null @@ -1,68 +0,0 @@ -// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation, degenerate conversion. -// codecvt<char, char, mbstate_t> -void test01() -{ - using namespace std; - typedef codecvt_base::result result; - typedef codecvt<char, char, mbstate_t> c_codecvt; - - bool test = true; - const char* c_lit = "black pearl jasmine tea"; - const char* from_next; - int size = 25; - char* c_arr = new char[size]; - char* c_ref = new char[size]; - char* to_next; - - locale loc = locale::classic(); - c_codecvt::state_type state; - const c_codecvt* cvt = &use_facet<c_codecvt>(loc); - - // According to the resolution of DR19 (see also libstd++/9168), in - // case of degenerate conversion ('noconv'), "there are no changes to - // the values in [to, to_limit)." - memset(c_ref, 'X', size); - - // out - memset(c_arr, 'X', size); - result r2 = cvt->out(state, c_lit, c_lit + size, from_next, - c_arr, c_arr + size, to_next); - VERIFY( r2 == codecvt_base::noconv ); - VERIFY( !memcmp(c_arr, c_ref, size) ); - VERIFY( from_next == c_lit ); - VERIFY( to_next == c_arr ); - - delete [] c_arr; - delete [] c_ref; -} - -int main () -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/char/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/out/char/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/char/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/out/char/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/1.cc deleted file mode 100644 index 82a57c6fdbd..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/1.cc +++ /dev/null @@ -1,83 +0,0 @@ -// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test01() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<char> ext_traits; - - bool test = true; - const ext_type* e_lit = "black pearl jasmine tea"; - const int_type* i_lit = L"black pearl jasmine tea"; - const int_type* ifrom_next; - int size = strlen(e_lit); - ext_type* e_arr = new ext_type[size + 1]; - ext_type* e_ref = new ext_type[size + 1]; - memset(e_arr, 0xf0, size + 1); - memset(e_ref, 0xf0, size + 1); - ext_type* eto_next; - - locale loc; - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // out - w_codecvt::state_type state02; - zero_state(state02); - result r2 = cvt->out(state02, i_lit, i_lit + size, ifrom_next, - e_arr, e_arr + size, eto_next); - VERIFY( r2 == codecvt_base::ok ); - VERIFY( ifrom_next == i_lit + size ); - VERIFY( eto_next == e_arr + size ); - VERIFY( !ext_traits::compare(e_arr, e_lit, size) ); - VERIFY( !ext_traits::compare(eto_next, e_ref, 1) ); - - delete [] e_arr; - delete [] e_ref; -} - -int main () -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/2.cc deleted file mode 100644 index c2e807da594..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/2.cc +++ /dev/null @@ -1,112 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test02() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<char> ext_traits; - - bool test = true; - const ext_type* e_lit = - "\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13" - "\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20!\"#$%&" - "'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`" - "abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86" - "\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95" - "\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4" - "\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3" - "\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2" - "\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1" - "\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0" - "\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe" - "\xff"; - - const int_type* i_lit = - L"\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13" - L"\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20!\"#$%&" - L"'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`" - L"abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86" - L"\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95" - L"\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4" - L"\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3" - L"\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2" - L"\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1" - L"\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0" - L"\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - L"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe" - L"\xff"; - - const int_type* ifrom_next; - int size = strlen(e_lit); - ext_type* e_arr = new ext_type[size + 1]; - ext_type* e_ref = new ext_type[size + 1]; - memset(e_arr, 0xf0, size + 1); - memset(e_ref, 0xf0, size + 1); - ext_type* eto_next; - - locale loc ("en_US.ISO-8859-1"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // out - w_codecvt::state_type state02; - zero_state(state02); - result r2 = cvt->out(state02, i_lit, i_lit + size, ifrom_next, - e_arr, e_arr + size, eto_next); - VERIFY( r2 == codecvt_base::ok ); - VERIFY( ifrom_next == i_lit + size ); - VERIFY( eto_next == e_arr + size ); - VERIFY( !ext_traits::compare(e_arr, e_lit, size) ); - VERIFY( !ext_traits::compare(eto_next, e_ref, 1) ); - - delete [] e_arr; - delete [] e_ref; -} - -int main () -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/3.cc deleted file mode 100644 index d92e01c7d2b..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/3.cc +++ /dev/null @@ -1,126 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test03() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<char> ext_traits; - - bool test = true; - const ext_type* e_lit = - "\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13" - "\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20!\"#$%&" - "'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`" - "abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86" - "\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95" - "\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4" - "\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3" - "\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2" - "\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1" - "\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0" - "\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe" - "\xff"; - - const int_type i_lit[] = { - 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, - 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, L'!', - L'"', L'#', L'$', L'%', L'&', L'\'', L'(', L')', L'*', L'+', - L',', L'-', L'.', L'/', L'0', L'1', L'2', L'3', L'4', L'5', - L'6', L'7', L'8', L'9', L':', L';', L'<', L'=', L'>', L'?', - L'@', L'A', L'B', L'C', L'D', L'E', L'F', L'G', L'H', L'I', - L'J', L'K', L'L', L'M', L'N', L'O', L'P', L'Q', L'R', L'S', - L'T', L'U', L'V', L'W', L'X', L'Y', L'Z', L'[', L'\\', L']', - L'^', L'_', L'`', L'a', L'b', L'c', L'd', L'e', L'f', L'g', - L'h', L'i', L'j', L'k', L'l', L'm', L'n', L'o', L'p', L'q', - L'r', L's', L't', L'u', L'v', L'w', L'x', L'y', L'z', L'{', - L'|', L'}', L'~', 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, - 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, - 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, - 0x20ac, 0xa5, 0x160, 0xa7, 0x161, 0xa9, 0xaa, 0xab, 0xac, 0xad, - 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0x17d, 0xb5, 0xb6, 0xb7, - 0x17e, 0xb9, 0xba, 0xbb, 0x152, 0x153, 0x178, 0xbf, 0xc0, 0xc1, - 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, - 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, - 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, - 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, - 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, - 0xfe, 0xff, 0x0 - }; - - const int_type* ifrom_next; - int size = strlen(e_lit); - ext_type* e_arr = new ext_type[size + 1]; - ext_type* e_ref = new ext_type[size + 1]; - memset(e_arr, 0xf0, size + 1); - memset(e_ref, 0xf0, size + 1); - ext_type* eto_next; - - locale loc ("en_US.ISO-8859-15"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // out - w_codecvt::state_type state02; - zero_state(state02); - result r2 = cvt->out(state02, i_lit, i_lit + size, ifrom_next, - e_arr, e_arr + size, eto_next); - VERIFY( r2 == codecvt_base::ok ); - VERIFY( ifrom_next == i_lit + size ); - VERIFY( eto_next == e_arr + size ); - VERIFY( !ext_traits::compare(e_arr, e_lit, size) ); - VERIFY( !ext_traits::compare(eto_next, e_ref, 1) ); - - delete [] e_arr; - delete [] e_ref; -} - -int main () -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/4.cc deleted file mode 100644 index 626ff70efe4..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/4.cc +++ /dev/null @@ -1,133 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test04() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<char> ext_traits; - - bool test = true; - const ext_type* e_lit = - "\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13" - "\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20!\"#$%&" - "'()*+,-./0123456789:;<=>?@}~\x7f\xc2\x80\xc2\x81\xc2\x82\xc2" - "\x83\xc2\x84\xc2\x85\xc2\x86\xc2\x87\xc2\x88\xc2\x89\xc2\x8a" - "\xc2\x8b\xc2\x8c\xc2\x8d\xc2\x8e\xc2\x8f\xc2\x90\xc2\x91\xc2" - "\x92\xc2\x93\xc2\x94\xc2\x95\xc2\x96\xc2\x97\xc2\x98\xc2\x99" - "\xc2\x9a\xc2\x9b\xc2\x9c\xc3\xba\xc3\xbb\xc3\xbc\xc3\xbd\xc3" - "\xbe\xc3\xbf\xc4\x80\xc4\x81\xc4\x82\xc4\x83\xc4\x84\xc4\x85" - "\xc4\x86\xc4\x87\xc4\x88\xc4\x89\xc4\x8a\xc4\x8b\xc4\x8c\xc4" - "\x8d\xc4\x8e\xc4\x8f\xc4\x90\xc4\x91\xc4\x92\xc4\x93\xc4\x94" - "\xc4\x95\xc4\x96\xc4\x97\xc4\x98\xc4\x99\xdf\xb8\xdf\xb9\xdf" - "\xba\xdf\xbb\xdf\xbc\xdf\xbd\xdf\xbe\xdf\xbf\xe0\xa0\x80\xe0" - "\xa0\x81\xe0\xa0\x82\xe0\xa0\x83\xe0\xa0\x84\xe0\xa0\x85\xe0" - "\xa0\x86\xe0\xa0\x87\xe0\xa0\x88\xe0\xa0\x89\xe0\xa0\x8a\xe0" - "\xa0\x8b\xe0\xa0\x8c\xe0\xa0\x8d\xe0\xa0\x8e\xe0\xa0\x8f\xe0" - "\xa0\x90\xe0\xa0\x91\xe0\xa0\x92\xe0\xa0\x93\xe0\xa0\x94\xe0" - "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" - "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" - "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; - - const int_type i_lit[] = { - 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, - 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, L'!', - L'"', L'#', L'$', L'%', L'&', L'\'', L'(', L')', L'*', L'+', - L',', L'-', L'.', L'/', L'0', L'1', L'2', L'3', L'4', L'5', - L'6', L'7', L'8', L'9', L':', L';', L'<', L'=', L'>', L'?', - L'@', L'}', L'~', 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, - 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, - 0x9a, 0x9b, 0x9c, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0x100, - 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107, 0x108, 0x109, - 0x10a, 0x10b, 0x10c, 0x10d, 0x10e, 0x10f, 0x110, 0x111, 0x112, - 0x113, 0x114, 0x115, 0x116, 0x117, 0x118, 0x119, 0x7f8, 0x7f9, - 0x7fa, 0x7fb, 0x7fc, 0x7fd, 0x7fe, 0x7ff, 0x800, 0x801, 0x802, - 0x803, 0x804, 0x805, 0x806, 0x807, 0x808, 0x809, 0x80a, 0x80b, - 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, - 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', - 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 - }; - - const int_type* ifrom_next; - int esize = strlen(e_lit); - int isize = wcslen(i_lit); - ext_type* e_arr = new ext_type[esize + 1]; - ext_type* e_ref = new ext_type[esize + 1]; - memset(e_arr, 0xf0, esize + 1); - memset(e_ref, 0xf0, esize + 1); - ext_type* eto_next; - - locale loc ("en_US.UTF-8"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // out - w_codecvt::state_type state02; - zero_state(state02); - result r2 = cvt->out(state02, i_lit, i_lit + isize, ifrom_next, - e_arr, e_arr + esize, eto_next); - VERIFY( r2 == codecvt_base::ok ); - VERIFY( ifrom_next == i_lit + isize ); - VERIFY( eto_next == e_arr + esize ); - VERIFY( !ext_traits::compare(e_arr, e_lit, esize) ); - VERIFY( !ext_traits::compare(eto_next, e_ref, 1) ); - - delete [] e_arr; - delete [] e_ref; -} - -int main () -{ - test04(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/5.cc deleted file mode 100644 index 13ca4b28719..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/5.cc +++ /dev/null @@ -1,86 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// Test handling of '\0' characters in input -// libstdc++/9246 -void test05() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<char> ext_traits; - - bool test = true; - const ext_type e_lit[] = { '\0', '\0', 'f', '\0' }; - const int_type i_lit[] = { L'\0', L'\0', L'f', L'\0' }; - const int_type* ifrom_next; - int size = sizeof(e_lit); - ext_type* e_arr = new ext_type[size + 1]; - ext_type* e_ref = new ext_type[size + 1]; - memset(e_arr, 0xf0, size + 1); - memset(e_ref, 0xf0, size + 1); - ext_type* eto_next; - - locale loc; - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // out - w_codecvt::state_type state02; - zero_state(state02); - result r2 = cvt->out(state02, i_lit, i_lit + size, ifrom_next, - e_arr, e_arr + size, eto_next); - VERIFY( r2 == codecvt_base::ok ); - VERIFY( ifrom_next == i_lit + size ); - VERIFY( eto_next == e_arr + size ); - VERIFY( !ext_traits::compare(e_arr, e_lit, size) ); - VERIFY( !ext_traits::compare(eto_next, e_ref, 1) ); - - delete [] e_arr; - delete [] e_ref; -} - -int main () -{ - test05(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/6.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/6.cc deleted file mode 100644 index 9ee2770bafd..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/6.cc +++ /dev/null @@ -1,86 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -// -// Test handling of output buffer that is too small. -// libstdc++/9247 -void test06() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<char> ext_traits; - - bool test = true; - const ext_type* e_lit = "black pearl jasmine tea"; - const int_type* i_lit = L"black pearl jasmine tea"; - const int_type* ifrom_next; - int size = strlen(e_lit); - ext_type* e_arr = new ext_type[size + 1]; - ext_type* e_ref = new ext_type[size + 1]; - memset(e_arr, 0xf0, size + 1); - memset(e_ref, 0xf0, size + 1); - ext_type* eto_next; - - locale loc; - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // out - w_codecvt::state_type state02; - zero_state(state02); - result r2 = cvt->out(state02, i_lit, i_lit + size, ifrom_next, - e_arr, e_arr + 1, eto_next); - VERIFY( r2 == codecvt_base::partial ); - VERIFY( ifrom_next == i_lit + 1 ); - VERIFY( eto_next == e_arr + 1 ); - VERIFY( !ext_traits::compare(e_arr, e_lit, 1) ); - VERIFY( !ext_traits::compare(eto_next, e_ref, size) ); - - delete [] e_arr; - delete [] e_ref; -} - -int main () -{ - test06(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/7.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/7.cc deleted file mode 100644 index 3ea57c05c03..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/7.cc +++ /dev/null @@ -1,84 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test03() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<char> ext_traits; - - bool test = true; - const ext_type* e_lit = "a"; - const int_type i_lit[] = { L'a', 0x20ac, 0x0 }; - const int_type* ifrom_next; - int size = wcslen(i_lit); - ext_type* e_arr = new ext_type[size + 1]; - ext_type* e_ref = new ext_type[size + 1]; - memset(e_arr, 0xf0, size + 1); - memset(e_ref, 0xf0, size + 1); - ext_type* eto_next; - - locale loc ("en_US.ISO-8859-1"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // out - w_codecvt::state_type state02; - zero_state(state02); - result r2 = cvt->out(state02, i_lit, i_lit + size, ifrom_next, - e_arr, e_arr + size, eto_next); - VERIFY( r2 == codecvt_base::error ); - VERIFY( ifrom_next == i_lit + 1 ); - VERIFY( eto_next == e_arr + 1 ); - VERIFY( !ext_traits::compare(e_arr, e_lit, 1) ); - VERIFY( !ext_traits::compare(eto_next, e_ref, size) ); - - delete [] e_arr; - delete [] e_ref; -} - -int main () -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/unicode/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unicode/1.cc deleted file mode 100644 index b96b22c5991..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/unicode/1.cc +++ /dev/null @@ -1,147 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - - - -#ifdef _GLIBCPP_USE___ENC_TRAITS - -// Need some char_traits specializations for this to work. -typedef unsigned short unicode_t; - -namespace std -{ - template<> - struct char_traits<unicode_t> - { - typedef unicode_t char_type; - // Unsigned as wint_t is unsigned. - typedef unsigned long int_type; - typedef streampos pos_type; - typedef streamoff off_type; - typedef mbstate_t state_type; - - static void - assign(char_type& __c1, const char_type& __c2); - - static bool - eq(const char_type& __c1, const char_type& __c2); - - static bool - lt(const char_type& __c1, const char_type& __c2); - - static int - compare(const char_type* __s1, const char_type* __s2, size_t __n) - { return memcmp(__s1, __s2, __n); } - - static size_t - length(const char_type* __s); - - static const char_type* - find(const char_type* __s, size_t __n, const char_type& __a); - - static char_type* - move(char_type* __s1, const char_type* __s2, size_t __n); - - static char_type* - copy(char_type* __s1, const char_type* __s2, size_t __n) - { return static_cast<char_type*>(memcpy(__s1, __s2, __n)); } - - static char_type* - assign(char_type* __s, size_t __n, char_type __a); - - static char_type - to_char_type(const int_type& __c); - - static int_type - to_int_type(const char_type& __c); - - static bool - eq_int_type(const int_type& __c1, const int_type& __c2); - - static int_type - eof(); - - static int_type - not_eof(const int_type& __c); - }; -} - -void -initialize_state(std::__enc_traits& state) -{ state._M_init(); } - -bool length_called = false; - -class length_codecvt : public std::codecvt<unicode_t, char, std::__enc_traits> -{ - typedef std::codecvt<unicode_t, char, std::__enc_traits> unicode_codecvt; - -public: - // DR75: type of first argument of do_length is state_type& - virtual int do_length(state_type& state, const extern_type* from, - const extern_type* end, std::size_t max) const - { - length_called = true; - return unicode_codecvt::do_length(state, from, end, max); - } -}; - -// Partial specialization using __enc_traits. -// codecvt<unicode_t, char, __enc_traits> -// UNICODE - UCS2 (big endian) -void test01() -{ - using namespace std; - typedef unicode_t int_type; - typedef char ext_type; - typedef __enc_traits enc_type; - typedef codecvt<int_type, ext_type, enc_type> unicode_codecvt; - - bool test = true; - const ext_type* e_lit = "black pearl jasmine tea"; - int size = strlen(e_lit); - - // construct a locale object with the specialized facet. - locale loc(locale::classic(), new length_codecvt); - // sanity check the constructed locale has the specialized facet. - VERIFY( has_facet<unicode_codecvt>(loc) ); - const unicode_codecvt& cvt = use_facet<unicode_codecvt>(loc); - - unicode_codecvt::state_type state04("UCS-2BE", "ISO-8859-15", 0xfeff, 0); - initialize_state(state04); - length_called = false; - cvt.length(state04, e_lit, e_lit + size, 5); - VERIFY( length_called ); -} -#endif // _GLIBCPP_USE___ENC_TRAITS - -int main () -{ -#if _GLIBCPP_USE___ENC_TRAITS - test01(); -#endif - - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/unicode/char.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unicode/char.cc deleted file mode 100644 index 51bf9b9600a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/unicode/char.cc +++ /dev/null @@ -1,303 +0,0 @@ -// 2000-08-22 Benjamin Kosnik <bkoz@cygnus.com> - -// Copyright (C) 2000, 2001, 2002 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - - - -#ifdef _GLIBCPP_USE___ENC_TRAITS - -// Need some char_traits specializations for this to work. -typedef unsigned short unicode_t; - -namespace std -{ - template<> - struct char_traits<unicode_t> - { - typedef unicode_t char_type; - // Unsigned as wint_t is unsigned. - typedef unsigned long int_type; - typedef streampos pos_type; - typedef streamoff off_type; - typedef mbstate_t state_type; - - static void - assign(char_type& __c1, const char_type& __c2); - - static bool - eq(const char_type& __c1, const char_type& __c2); - - static bool - lt(const char_type& __c1, const char_type& __c2); - - static int - compare(const char_type* __s1, const char_type* __s2, size_t __n) - { return memcmp(__s1, __s2, __n); } - - static size_t - length(const char_type* __s); - - static const char_type* - find(const char_type* __s, size_t __n, const char_type& __a); - - static char_type* - move(char_type* __s1, const char_type* __s2, size_t __n); - - static char_type* - copy(char_type* __s1, const char_type* __s2, size_t __n) - { return static_cast<char_type*>(memcpy(__s1, __s2, __n)); } - - static char_type* - assign(char_type* __s, size_t __n, char_type __a); - - static char_type - to_char_type(const int_type& __c); - - static int_type - to_int_type(const char_type& __c); - - static bool - eq_int_type(const int_type& __c1, const int_type& __c2); - - static int_type - eof(); - - static int_type - not_eof(const int_type& __c); - }; -} - -/* -> how do I check that these conversions are correct? -Very easy. Since all the characters are from ASCII you simply -zero-extend the values. - -drepper$ echo 'black pearl jasmine tea' | od -t x1 -0000000 62 6c 61 63 6b 20 70 65 61 72 6c 20 6a 61 73 6d -0000020 69 6e 65 20 74 65 61 0a - -So the UCS-2 string is - -0x0062, 0x006c, 0x0061, ... - -You get the idea. With iconv() you have to take care of the -byte-order, though. UCS-2 can mean little- or big endian. Looking at -your result - -> $9 = 25856 - -it shows that the other byte-order is used (25856 == 0x6500). -*/ - - -void -initialize_state(std::__enc_traits& state) -{ state._M_init(); } - -// Partial specialization using __enc_traits. -// codecvt<unicode_t, char, __enc_traits> -// UNICODE - UCS2 (big endian) -void test01() -{ - using namespace std; - typedef codecvt_base::result result; - typedef unicode_t int_type; - typedef char ext_type; - typedef __enc_traits enc_type; - typedef codecvt<int_type, ext_type, enc_type> unicode_codecvt; - typedef char_traits<int_type> int_traits; - typedef char_traits<ext_type> ext_traits; - - bool test = true; - const ext_type* e_lit = "black pearl jasmine tea"; - int size = strlen(e_lit); - - char i_lit_base[50] __attribute__((aligned(__alignof__(int_type)))) = - { - 0x00, 0x62, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x63, 0x00, 0x6b, 0x00, 0x20, - 0x00, 0x70, 0x00, 0x65, 0x00, 0x61, 0x00, 0x72, 0x00, 0x6c, 0x00, 0x20, - 0x00, 0x6a, 0x00, 0x61, 0x00, 0x73, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x6e, - 0x00, 0x65, 0x00, 0x20, 0x00, 0x74, 0x00, 0x65, 0x00, 0x61, 0x00, 0xa0 - }; - const int_type* i_lit = reinterpret_cast<int_type*>(i_lit_base); - - const ext_type* efrom_next; - const int_type* ifrom_next; - ext_type* e_arr = new ext_type[size + 1]; - ext_type* eto_next; - int_type* i_arr = new int_type[size + 1]; - int_type* ito_next; - - // construct a locale object with the specialized facet. - locale loc(locale::classic(), new unicode_codecvt); - // sanity check the constructed locale has the specialized facet. - VERIFY( has_facet<unicode_codecvt>(loc) ); - const unicode_codecvt& cvt = use_facet<unicode_codecvt>(loc); - - // in - unicode_codecvt::state_type state01("UCS-2BE", "ISO-8859-15", 0xfeff, 0); - initialize_state(state01); - // internal encoding is bigger because of bom - result r1 = cvt.in(state01, e_lit, e_lit + size, efrom_next, - i_arr, i_arr + size + 1, ito_next); - VERIFY( r1 == codecvt_base::ok ); - VERIFY( !int_traits::compare(i_arr, i_lit, size) ); - VERIFY( efrom_next == e_lit + size ); - VERIFY( ito_next == i_arr + size ); - - // out - unicode_codecvt::state_type state02("UCS-2BE", "ISO-8859-15", 0xfeff, 0); - initialize_state(state02); - result r2 = cvt.out(state02, i_lit, i_lit + size, ifrom_next, - e_arr, e_arr + size, eto_next); - VERIFY( r2 == codecvt_base::ok ); - VERIFY( !ext_traits::compare(e_arr, e_lit, size) ); - VERIFY( ifrom_next == i_lit + size ); - VERIFY( eto_next == e_arr + size ); - - // unshift - ext_traits::copy(e_arr, e_lit, size); - unicode_codecvt::state_type state03("UCS-2BE", "ISO-8859-15", 0xfeff, 0); - initialize_state(state03); - result r3 = cvt.unshift(state03, e_arr, e_arr + size, eto_next); - VERIFY( r3 == codecvt_base::noconv ); - VERIFY( !ext_traits::compare(e_arr, e_lit, size) ); - VERIFY( eto_next == e_arr ); - - int i = cvt.encoding(); - VERIFY( i == 2 ); // Target-dependent. - - VERIFY( !cvt.always_noconv() ); - - unicode_codecvt::state_type state04("UCS-2BE", "ISO-8859-15", 0xfeff, 0); - initialize_state(state04); - int j = cvt.length(state03, e_lit, e_lit + size, 5); - VERIFY( j == 5 ); - - int k = cvt.max_length(); - VERIFY( k == 1 ); - - delete [] e_arr; - delete [] i_arr; -} - -// Partial specialization using __enc_traits. -// codecvt<unicode_t, char, __enc_traits> -// UNICODE - UCS2 (little endian) -void test02() -{ - using namespace std; - typedef codecvt_base::result result; - typedef unsigned short unicode_t; - typedef unicode_t int_type; - typedef char ext_type; - typedef __enc_traits enc_type; - typedef codecvt<int_type, ext_type, enc_type> unicode_codecvt; - typedef char_traits<int_type> int_traits; - typedef char_traits<ext_type> ext_traits; - - bool test = true; - const ext_type* e_lit = "black pearl jasmine tea"; - int size = strlen(e_lit); - - char i_lit_base[50] __attribute__((aligned(__alignof__(int_type)))) = - { - 0x62, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x63, 0x00, 0x6b, 0x00, 0x20, 0x00, - 0x70, 0x00, 0x65, 0x00, 0x61, 0x00, 0x72, 0x00, 0x6c, 0x00, 0x20, 0x00, - 0x6a, 0x00, 0x61, 0x00, 0x73, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x6e, 0x00, - 0x65, 0x00, 0x20, 0x00, 0x74, 0x00, 0x65, 0x00, 0x61, 0x00, 0xa0, 0x00 - }; - const int_type* i_lit = reinterpret_cast<int_type*>(i_lit_base); - - const ext_type* efrom_next; - const int_type* ifrom_next; - ext_type* e_arr = new ext_type[size + 1]; - ext_type* eto_next; - int_type* i_arr = new int_type[size + 1]; - int_type* ito_next; - - // construct a locale object with the specialized facet. - locale loc(locale::classic(), new unicode_codecvt); - // sanity check the constructed locale has the specialized facet. - VERIFY( has_facet<unicode_codecvt>(loc) ); - const unicode_codecvt& cvt = use_facet<unicode_codecvt>(loc); - - // in - unicode_codecvt::state_type state01("UCS-2LE", "ISO-8859-15", 0xfeff, 0); - initialize_state(state01); - // internal encoding is bigger because of bom - result r1 = cvt.in(state01, e_lit, e_lit + size, efrom_next, - i_arr, i_arr + size + 1, ito_next); - VERIFY( r1 == codecvt_base::ok ); - VERIFY( !int_traits::compare(i_arr, i_lit, size) ); - VERIFY( efrom_next == e_lit + size ); - VERIFY( ito_next == i_arr + size ); - - // out - unicode_codecvt::state_type state02("UCS-2LE", "ISO-8859-15", 0xfeff, 0); - initialize_state(state02); - result r2 = cvt.out(state02, i_lit, i_lit + size, ifrom_next, - e_arr, e_arr + size, eto_next); - VERIFY( r2 == codecvt_base::ok ); - VERIFY( !ext_traits::compare(e_arr, e_lit, size) ); - VERIFY( ifrom_next == i_lit + size ); - VERIFY( eto_next == e_arr + size ); - - // unshift - ext_traits::copy(e_arr, e_lit, size); - unicode_codecvt::state_type state03("UCS-2LE", "ISO-8859-15", 0xfeff, 0); - initialize_state(state03); - result r3 = cvt.unshift(state03, e_arr, e_arr + size, eto_next); - VERIFY( r3 == codecvt_base::noconv ); - VERIFY( !ext_traits::compare(e_arr, e_lit, size) ); - VERIFY( eto_next == e_arr ); - - int i = cvt.encoding(); - VERIFY( i == 2 ); // Target-dependent. - - VERIFY( !cvt.always_noconv() ); - - unicode_codecvt::state_type state04("UCS-2LE", "ISO-8859-15", 0xfeff, 0); - initialize_state(state04); - int j = cvt.length(state03, e_lit, e_lit + size, 5); - VERIFY( j == 5 ); - - int k = cvt.max_length(); - VERIFY( k == 1 ); - - delete [] e_arr; - delete [] i_arr; -} - -#endif // _GLIBCPP_USE___ENC_TRAITS - -int main () -{ -#if _GLIBCPP_USE___ENC_TRAITS - test01(); - test02(); -#endif - - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/unicode/wchar_t.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unicode/wchar_t.cc deleted file mode 100644 index c944865b08f..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/unicode/wchar_t.cc +++ /dev/null @@ -1,201 +0,0 @@ -// 2000-08-23 Benjamin Kosnik <bkoz@cygnus.com> - -// Copyright (C) 2000, 2001, 2002 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -#ifdef _GLIBCPP_USE___ENC_TRAITS -#ifdef _GLIBCPP_USE_WCHAR_T - -// Need some char_traits specializations for this to work. -typedef unsigned short unicode_t; - -namespace std -{ - template<> - struct char_traits<unicode_t> - { - typedef unicode_t char_type; - // Unsigned as wint_t is unsigned. - typedef unsigned long int_type; - typedef streampos pos_type; - typedef streamoff off_type; - typedef mbstate_t state_type; - - static void - assign(char_type& __c1, const char_type& __c2); - - static bool - eq(const char_type& __c1, const char_type& __c2); - - static bool - lt(const char_type& __c1, const char_type& __c2); - - static int - compare(const char_type* __s1, const char_type* __s2, size_t __n) - { return memcmp(__s1, __s2, __n); } - - static size_t - length(const char_type* __s); - - static const char_type* - find(const char_type* __s, size_t __n, const char_type& __a); - - static char_type* - move(char_type* __s1, const char_type* __s2, size_t __n); - - static char_type* - copy(char_type* __s1, const char_type* __s2, size_t __n) - { return static_cast<char_type*>(memcpy(__s1, __s2, __n)); } - - static char_type* - assign(char_type* __s, size_t __n, char_type __a); - - static char_type - to_char_type(const int_type& __c); - - static int_type - to_int_type(const char_type& __c); - - static bool - eq_int_type(const int_type& __c1, const int_type& __c2); - - static int_type - eof(); - - static int_type - not_eof(const int_type& __c); - }; -} - -void -initialize_state(std::__enc_traits& state) -{ state._M_init(); } - -// Partial specialization using __enc_traits. -// codecvt<unicode_t, wchar_t, __enc_traits> -void test01() -{ - using namespace std; - typedef codecvt_base::result result; - typedef unicode_t int_type; - typedef wchar_t ext_type; - typedef __enc_traits enc_type; - typedef codecvt<int_type, ext_type, enc_type> unicode_codecvt; - typedef char_traits<int_type> int_traits; - typedef char_traits<ext_type> ext_traits; - - bool test = true; - int size = 23; - char e_lit_base[96] __attribute__((aligned(__alignof__(ext_type)))) = - { - 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x61, - 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x20, - 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x61, - 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x20, - 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x73, - 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x6e, - 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x74, - 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0xa0 - }; - const ext_type* e_lit = reinterpret_cast<ext_type*>(e_lit_base); - - char i_lit_base[48] __attribute__((aligned(__alignof__(int_type)))) = - { - 0x00, 0x62, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x63, 0x00, 0x6b, 0x00, 0x20, - 0x00, 0x70, 0x00, 0x65, 0x00, 0x61, 0x00, 0x72, 0x00, 0x6c, 0x00, 0x20, - 0x00, 0x6a, 0x00, 0x61, 0x00, 0x73, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x6e, - 0x00, 0x65, 0x00, 0x20, 0x00, 0x74, 0x00, 0x65, 0x00, 0x61, 0x00, 0xa0 - }; - const int_type* i_lit = reinterpret_cast<int_type*>(i_lit_base); - - const ext_type* efrom_next; - const int_type* ifrom_next; - ext_type* e_arr = new ext_type[size + 1]; - ext_type* eto_next; - int_type* i_arr = new int_type[size + 1]; - int_type* ito_next; - - // construct a locale object with the specialized facet. - locale loc(locale::classic(), new unicode_codecvt); - // sanity check the constructed locale has the specialized facet. - VERIFY( has_facet<unicode_codecvt>(loc) ); - const unicode_codecvt& cvt = use_facet<unicode_codecvt>(loc); - - // in - unicode_codecvt::state_type state01("UCS-2BE", "UCS-4BE", 0xfeff, 0); - initialize_state(state01); - result r1 = cvt.in(state01, e_lit, e_lit + size, efrom_next, - i_arr, i_arr + size + 1, ito_next); - VERIFY( r1 == codecvt_base::ok ); - VERIFY( !int_traits::compare(i_arr, i_lit, size) ); - VERIFY( efrom_next == e_lit + size ); - VERIFY( ito_next == i_arr + size ); - - // out - unicode_codecvt::state_type state02("UCS-2BE", "UCS-4BE", 0xfeff, 0); - initialize_state(state02); - result r2 = cvt.out(state02, i_lit, i_lit + size, ifrom_next, - e_arr, e_arr + size, eto_next); - // XXX VERIFY( r2 == codecvt_base::ok ); - VERIFY( !ext_traits::compare(e_arr, e_lit, size) ); - VERIFY( ifrom_next == i_lit + size ); - VERIFY( eto_next == e_arr + size ); - - // unshift - ext_traits::copy(e_arr, e_lit, size); - unicode_codecvt::state_type state03("UCS-2BE", "UCS-4BE", 0xfeff, 0); - initialize_state(state03); - result r3 = cvt.unshift(state03, e_arr, e_arr + size, eto_next); - VERIFY( r3 == codecvt_base::noconv ); - VERIFY( !ext_traits::compare(e_arr, e_lit, size) ); - VERIFY( eto_next == e_arr ); - - int i = cvt.encoding(); - VERIFY( i == 0 ); - - VERIFY( !cvt.always_noconv() ); - - unicode_codecvt::state_type state04("UCS-2BE", "UCS-4BE", 0xfeff, 0); - initialize_state(state04); - int j = cvt.length(state03, e_lit, e_lit + size, 5); - VERIFY( j == 5 ); - - int k = cvt.max_length(); - VERIFY( k == 1 ); - - delete [] e_arr; - delete [] i_arr; -} -#endif // _GLIBCPP_USE_WCHAR_T -#endif // _GLIBCPP_USE___ENC_TRAITS - -int main () -{ -#ifdef _GLIBCPP_USE___ENC_TRAITS -#ifdef _GLIBCPP_USE_WCHAR_T - test01(); -#endif -#endif - return 0; -} - diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/1.cc deleted file mode 100644 index 1a6eadd82fe..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/1.cc +++ /dev/null @@ -1,84 +0,0 @@ -// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Required instantiation, degenerate conversion. -// codecvt<char, char, mbstate_t> -void test01() -{ - using namespace std; - typedef codecvt_base::result result; - typedef codecvt<char, char, mbstate_t> c_codecvt; - - bool test = true; - const char* c_lit = "black pearl jasmine tea"; - const char* from_next; - int size = 25; - char* c_arr = new char[size]; - char* c_ref = new char[size]; - char* to_next; - - locale loc = locale::classic(); - c_codecvt::state_type state; - const c_codecvt* cvt = &use_facet<c_codecvt>(loc); - - // According to the resolution of DR19 (see also libstd++/9168), in - // case of degenerate conversion ('noconv'), "there are no changes to - // the values in [to, to_limit)." - memset(c_ref, 'X', size); - - // in - memset(c_arr, 'X', size); - result r1 = cvt->in(state, c_lit, c_lit + size, from_next, - c_arr, c_arr + size, to_next); - VERIFY( r1 == codecvt_base::noconv ); - VERIFY( !memcmp(c_arr, c_ref, size) ); - VERIFY( from_next == c_lit ); - VERIFY( to_next == c_arr ); - - // out - memset(c_arr, 'X', size); - result r2 = cvt->out(state, c_lit, c_lit + size, from_next, - c_arr, c_arr + size, to_next); - VERIFY( r2 == codecvt_base::noconv ); - VERIFY( !memcmp(c_arr, c_ref, size) ); - VERIFY( from_next == c_lit ); - VERIFY( to_next == c_arr ); - - // unshift - strcpy(c_arr, c_lit); - result r3 = cvt->unshift(state, c_arr, c_arr + size, to_next); - VERIFY( r3 == codecvt_base::noconv ); - VERIFY( !strcmp(c_arr, c_lit) ); - VERIFY( to_next == c_arr ); - - delete [] c_arr; - delete [] c_ref; -} - -int main () -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/1.cc deleted file mode 100644 index 65aaea05056..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/1.cc +++ /dev/null @@ -1,74 +0,0 @@ -// 2000-08-17 Benjamin Kosnik <bkoz@cygnus.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test01() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - - bool test = true; - const ext_type* e_lit = "black pearl jasmine tea"; - int size = strlen(e_lit); - ext_type* e_arr = new ext_type[size + 1]; - ext_type* eto_next; - - locale loc; - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // unshift - strcpy(e_arr, e_lit); - w_codecvt::state_type state03; - zero_state(state03); - result r3 = cvt->unshift(state03, e_arr, e_arr + size, eto_next); - VERIFY( r3 == codecvt_base::noconv ); - VERIFY( !strcmp(e_arr, e_lit) ); - VERIFY( eto_next == e_arr ); - - delete [] e_arr; -} - -int main () -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/2.cc deleted file mode 100644 index 77e3b9292dd..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/2.cc +++ /dev/null @@ -1,107 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test02() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<char> ext_traits; - - bool test = true; - const int_type* i_lit = - L"\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13" - L"\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20!\"#$%&" - L"'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`" - L"abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86" - L"\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95" - L"\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4" - L"\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3" - L"\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2" - L"\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1" - L"\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0" - L"\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - L"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe" - L"\xff"; - - const int_type* ifrom_next; - int size = wcslen(i_lit); - ext_type* e_arr = new ext_type[size + 1]; - ext_type* e_ref = new ext_type[size + 1]; - memset(e_arr, 0xf0, size + 1); - memset(e_ref, 0xf0, size + 1); - ext_type* eto_next; - - locale loc ("en_US.ISO-8859-1"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // unshift - w_codecvt::state_type state01; - zero_state(state01); - result r1 = cvt->unshift(state01, e_arr, e_arr + size, eto_next); - VERIFY( r1 == codecvt_base::noconv ); - VERIFY( !ext_traits::compare(e_arr, e_ref, size + 1) ); - VERIFY( eto_next == e_arr ); - - for (int i = 0; i < size; ++i) - { - w_codecvt::state_type state02; - zero_state(state02); - cvt->out(state02, i_lit + i, i_lit + i + 1, ifrom_next, - e_arr, e_arr + size, eto_next); - memset(e_arr, 0xf0, size + 1); - result r2 = cvt->unshift(state02, e_arr, e_arr + size, eto_next); - VERIFY( r2 == codecvt_base::noconv ); - VERIFY( !ext_traits::compare(e_arr, e_ref, size + 1) ); - VERIFY( eto_next == e_arr ); - } - - delete [] e_arr; - delete [] e_ref; -} - -int main () -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/3.cc deleted file mode 100644 index a828090b14d..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/3.cc +++ /dev/null @@ -1,121 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test03() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<char> ext_traits; - - bool test = true; - const int_type i_lit[] = { - 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, - 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, L'!', - L'"', L'#', L'$', L'%', L'&', L'\'', L'(', L')', L'*', L'+', - L',', L'-', L'.', L'/', L'0', L'1', L'2', L'3', L'4', L'5', - L'6', L'7', L'8', L'9', L':', L';', L'<', L'=', L'>', L'?', - L'@', L'A', L'B', L'C', L'D', L'E', L'F', L'G', L'H', L'I', - L'J', L'K', L'L', L'M', L'N', L'O', L'P', L'Q', L'R', L'S', - L'T', L'U', L'V', L'W', L'X', L'Y', L'Z', L'[', L'\\', L']', - L'^', L'_', L'`', L'a', L'b', L'c', L'd', L'e', L'f', L'g', - L'h', L'i', L'j', L'k', L'l', L'm', L'n', L'o', L'p', L'q', - L'r', L's', L't', L'u', L'v', L'w', L'x', L'y', L'z', L'{', - L'|', L'}', L'~', 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, - 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, - 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, - 0x20ac, 0xa5, 0x160, 0xa7, 0x161, 0xa9, 0xaa, 0xab, 0xac, 0xad, - 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0x17d, 0xb5, 0xb6, 0xb7, - 0x17e, 0xb9, 0xba, 0xbb, 0x152, 0x153, 0x178, 0xbf, 0xc0, 0xc1, - 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, - 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, - 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, - 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, - 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, - 0xfe, 0xff, 0x0 - }; - - const int_type* ifrom_next; - int size = wcslen(i_lit); - ext_type* e_arr = new ext_type[size + 1]; - ext_type* e_ref = new ext_type[size + 1]; - memset(e_arr, 0xf0, size + 1); - memset(e_ref, 0xf0, size + 1); - ext_type* eto_next; - - locale loc ("en_US.ISO-8859-15"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // unshift - w_codecvt::state_type state01; - zero_state(state01); - result r1 = cvt->unshift(state01, e_arr, e_arr + size, eto_next); - VERIFY( r1 == codecvt_base::noconv ); - VERIFY( !ext_traits::compare(e_arr, e_ref, size + 1) ); - VERIFY( eto_next == e_arr ); - - for (int i = 0; i < size; ++i) - { - w_codecvt::state_type state02; - zero_state(state02); - cvt->out(state02, i_lit + i, i_lit + i + 1, ifrom_next, - e_arr, e_arr + size, eto_next); - memset(e_arr, 0xf0, size + 1); - result r2 = cvt->unshift(state02, e_arr, e_arr + size, eto_next); - VERIFY( r2 == codecvt_base::noconv ); - VERIFY( !ext_traits::compare(e_arr, e_ref, size + 1) ); - VERIFY( eto_next == e_arr ); - } - - delete [] e_arr; - delete [] e_ref; -} - -int main () -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/4.cc deleted file mode 100644 index 09a91ed5597..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/4.cc +++ /dev/null @@ -1,116 +0,0 @@ -// 2003-02-06 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.1.5 - Template class codecvt [lib.locale.codecvt] - -#include <locale> -#include <testsuite_hooks.h> - -// Need to explicitly set the state(mbstate_t) to zero. -// How to do this is not specified by the ISO C99 standard, so we -// might need to add some operators to make the intuiative case -// work: -// w_codecvt::state_type state00; -// state00 = 0; -// or, can use this explicit "C" initialization: -// w_codecvt::state_type state01 = {0, 0}; -// .. except Ulrich says: Use memset. Always use memset. Feel the force... -void -zero_state(std::mbstate_t& state) -{ std::memset(&state, 0, sizeof(std::mbstate_t)); } - -// Required instantiation -// codecvt<wchar_t, char, mbstate_t> -void test04() -{ - using namespace std; - typedef codecvt<wchar_t, char, mbstate_t> w_codecvt; - typedef codecvt_base::result result; - typedef wchar_t int_type; - typedef char ext_type; - typedef char_traits<char> ext_traits; - - bool test = true; - const int_type i_lit[] = { - 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, - 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, L'!', - L'"', L'#', L'$', L'%', L'&', L'\'', L'(', L')', L'*', L'+', - L',', L'-', L'.', L'/', L'0', L'1', L'2', L'3', L'4', L'5', - L'6', L'7', L'8', L'9', L':', L';', L'<', L'=', L'>', L'?', - L'@', L'}', L'~', 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, - 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, - 0x9a, 0x9b, 0x9c, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0x100, - 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107, 0x108, 0x109, - 0x10a, 0x10b, 0x10c, 0x10d, 0x10e, 0x10f, 0x110, 0x111, 0x112, - 0x113, 0x114, 0x115, 0x116, 0x117, 0x118, 0x119, 0x7f8, 0x7f9, - 0x7fa, 0x7fb, 0x7fc, 0x7fd, 0x7fe, 0x7ff, 0x800, 0x801, 0x802, - 0x803, 0x804, 0x805, 0x806, 0x807, 0x808, 0x809, 0x80a, 0x80b, - 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, - 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', - 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 - }; - - const int_type* ifrom_next; - int size = wcslen(i_lit); - ext_type* e_arr = new ext_type[size + 1]; - ext_type* e_ref = new ext_type[size + 1]; - memset(e_arr, 0xf0, size + 1); - memset(e_ref, 0xf0, size + 1); - ext_type* eto_next; - - locale loc ("en_US.UTF-8"); - locale::global(loc); - const w_codecvt* cvt = &use_facet<w_codecvt>(loc); - - // unshift - w_codecvt::state_type state01; - zero_state(state01); - result r1 = cvt->unshift(state01, e_arr, e_arr + size, eto_next); - VERIFY( r1 == codecvt_base::noconv ); - VERIFY( !ext_traits::compare(e_arr, e_ref, size + 1) ); - VERIFY( eto_next == e_arr ); - - for (int i = 0; i < size; ++i) - { - w_codecvt::state_type state02; - zero_state(state02); - cvt->out(state02, i_lit + i, i_lit + i + 1, ifrom_next, - e_arr, e_arr + size, eto_next); - memset(e_arr, 0xf0, size + 1); - result r2 = cvt->unshift(state02, e_arr, e_arr + size, eto_next); - VERIFY( r2 == codecvt_base::noconv ); - VERIFY( !ext_traits::compare(e_arr, e_ref, size + 1) ); - VERIFY( eto_next == e_arr ); - } - - delete [] e_arr; - delete [] e_ref; -} - -int main () -{ - test04(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/1.cc b/libstdc++-v3/testsuite/22_locale/collate/1.cc deleted file mode 100644 index 5b55b03f24f..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/1.cc +++ /dev/null @@ -1,43 +0,0 @@ -// { dg-do compile } -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001 Free Software Foundation -// -// 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. - -// 22.2.4 The collate category - -#include <locale> - -void test01() -{ - // Check for required base class. - typedef std::messages<char> test_type; - typedef std::locale::facet base_type; - const test_type& obj = std::use_facet<test_type>(std::locale()); - const base_type* base = &obj; - - // Check for required typedefs - typedef test_type::char_type char_type; - typedef test_type::string_type string_type; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/2.cc b/libstdc++-v3/testsuite/22_locale/collate/2.cc deleted file mode 100644 index 98bc214943d..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/2.cc +++ /dev/null @@ -1,39 +0,0 @@ -// { dg-do compile } -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001 Free Software Foundation -// -// 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. - -// 22.2.4 The collate category - -#include <locale> - -// Should be able to instantiate this for other types besides char, wchar_t -class gnu_collate: public std::collate<unsigned char> -{ }; - -void test02() -{ - gnu_collate facet01; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/char/1.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/char/1.cc deleted file mode 100644 index bed2fb40991..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/compare/char/1.cc +++ /dev/null @@ -1,79 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <locale> -#include <testsuite_hooks.h> - -// Check "C" locale. -void test01() -{ - using namespace std; - typedef std::collate<char>::string_type string_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_us("en_US"); - locale loc_fr("fr_FR"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_us != loc_fr ); - VERIFY( loc_us != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the collate facets - const collate<char>& coll_c = use_facet<collate<char> >(loc_c); - const collate<char>& coll_us = use_facet<collate<char> >(loc_us); - const collate<char>& coll_fr = use_facet<collate<char> >(loc_fr); - const collate<char>& coll_de = use_facet<collate<char> >(loc_de); - - // int compare(const charT*, const charT*, const charT*, const charT*) const - - const char* strlit1 = "monkey picked tikuanyin oolong"; - const char* strlit2 = "imperial tea court green oolong"; - - int i1; - int i2; - int size1 = char_traits<char>::length(strlit1) - 1; - int size2 = char_traits<char>::length(strlit2) - 1; - - i1 = coll_c.compare(strlit1, strlit1 + size1, strlit1, strlit1 + 7); - VERIFY ( i1 == 1 ); - i1 = coll_c.compare(strlit1, strlit1 + 7, strlit1, strlit1 + size1); - VERIFY ( i1 == -1 ); - i1 = coll_c.compare(strlit1, strlit1 + 7, strlit1, strlit1 + 7); - VERIFY ( i1 == 0 ); - - i2 = coll_c.compare(strlit2, strlit2 + size2, strlit2, strlit2 + 13); - VERIFY ( i2 == 1 ); - i2 = coll_c.compare(strlit2, strlit2 + 13, strlit2, strlit2 + size2); - VERIFY ( i2 == -1 ); - i2 = coll_c.compare(strlit2, strlit2 + size2, strlit2, strlit2 + size2); - VERIFY ( i2 == 0 ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/char/2.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/char/2.cc deleted file mode 100644 index ab29ac409e1..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/compare/char/2.cc +++ /dev/null @@ -1,86 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <locale> -#include <testsuite_hooks.h> - -// Check German "de_DE" locale. -void test02() -{ - using namespace std; - typedef std::collate<char>::string_type string_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_us("en_US"); - locale loc_fr("fr_FR"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_us != loc_fr ); - VERIFY( loc_us != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the collate facets - const collate<char>& coll_c = use_facet<collate<char> >(loc_c); - const collate<char>& coll_us = use_facet<collate<char> >(loc_us); - const collate<char>& coll_fr = use_facet<collate<char> >(loc_fr); - const collate<char>& coll_de = use_facet<collate<char> >(loc_de); - - // int compare(const charT*, const charT*, const charT*, const charT*) const - - const char* strlit1 = "monkey picked tikuanyin oolong"; - const char* strlit2 = "imperial tea court green oolong"; - const char* strlit3 = "Äuglein Augment"; // "C" == "Augment Äuglein" - const char* strlit4 = "Base baß Baß Bast"; // "C" == "Base baß Baß Bast" - - int i1; - int i2; - int size1 = char_traits<char>::length(strlit1) - 1; - int size2 = char_traits<char>::length(strlit2) - 1; - int size3 = char_traits<char>::length(strlit3) - 1; - int size4 = char_traits<char>::length(strlit4) - 1; - - i1 = coll_de.compare(strlit3, strlit3 + size3, strlit3, strlit3 + 7); - VERIFY ( i1 == 1 ); - i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + size1); - VERIFY ( i1 == -1 ); - i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + 7); - VERIFY ( i1 == 0 ); - - i1 = coll_de.compare(strlit3, strlit3 + 6, strlit3 + 8, strlit3 + 14); - VERIFY ( i1 == -1 ); - - i2 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + 13); - VERIFY ( i2 == 1 ); - i2 = coll_de.compare(strlit4, strlit4 + 13, strlit4, strlit4 + size4); - VERIFY ( i2 == -1 ); - i2 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + size4); - VERIFY ( i2 == 0 ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/char/3.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/char/3.cc deleted file mode 100644 index c8209548bc3..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/compare/char/3.cc +++ /dev/null @@ -1,90 +0,0 @@ -// 2003-02-24 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <locale> -#include <testsuite_hooks.h> - -// Test handling of strings containing nul characters -void test03() -{ - using namespace std; - typedef std::collate<char>::string_type string_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - - // cache the collate facets - const collate<char>& coll_c = use_facet<collate<char> >(loc_c); - const collate<char>& coll_de = use_facet<collate<char> >(loc_de); - - // int compare(const charT*, const charT*, const charT*, const charT*) const - const char* strlit1 = "a\0a\0"; - const char* strlit2 = "a\0b\0"; - const char* strlit3 = "a\0\xc4\0"; - const char* strlit4 = "a\0B\0"; - const char* strlit5 = "aa\0"; - const char* strlit6 = "b\0a\0"; - - int i; - i = coll_c.compare(strlit1, strlit1 + 3, strlit2, strlit2 + 3); - VERIFY( i == -1 ); - - i = coll_de.compare(strlit1, strlit1 + 3, strlit2, strlit2 + 3); - VERIFY( i == -1 ); - - i = coll_c.compare(strlit3, strlit3 + 3, strlit4, strlit4 + 3); - VERIFY( i == 1 ); - - i = coll_de.compare(strlit3, strlit3 + 3, strlit4, strlit4 + 3); - VERIFY( i == -1 ); - - i = coll_c.compare(strlit1, strlit1 + 3, strlit1, strlit1 + 4); - VERIFY( i == -1 ); - - i = coll_de.compare(strlit3, strlit3 + 4, strlit3, strlit3 + 3); - VERIFY( i == 1 ); - - i = coll_c.compare(strlit1, strlit1 + 4, strlit4, strlit4 + 1); - VERIFY( i == 1 ); - - i = coll_de.compare(strlit3, strlit3 + 3, strlit3, strlit3 + 3); - VERIFY( i == 0 ); - - i = coll_c.compare(strlit1, strlit1 + 2, strlit1, strlit1 + 4); - VERIFY( i == -1 ); - - i = coll_de.compare(strlit1, strlit1 + 3, strlit5, strlit5 + 3); - VERIFY( i == -1 ); - - i = coll_c.compare(strlit6, strlit6 + 3, strlit1, strlit1 + 3); - VERIFY( i == 1 ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/char/wrapped_env.cc deleted file mode 100644 index 4f1d5e3f6a9..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/compare/char/wrapped_env.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/char/wrapped_locale.cc deleted file mode 100644 index 8d7871815db..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/compare/char/wrapped_locale.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/1.cc deleted file mode 100644 index 0ba7b05835e..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/1.cc +++ /dev/null @@ -1,79 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <locale> -#include <testsuite_hooks.h> - -// Check "C" locale. -void test01() -{ - using namespace std; - typedef std::collate<wchar_t>::string_type string_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_us("en_US"); - locale loc_fr("fr_FR"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_us != loc_fr ); - VERIFY( loc_us != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the collate facets - const collate<wchar_t>& coll_c = use_facet<collate<wchar_t> >(loc_c); - const collate<wchar_t>& coll_us = use_facet<collate<wchar_t> >(loc_us); - const collate<wchar_t>& coll_fr = use_facet<collate<wchar_t> >(loc_fr); - const collate<wchar_t>& coll_de = use_facet<collate<wchar_t> >(loc_de); - - // int compare(const charT*, const charT*, const charT*, const charT*) const - - const wchar_t* strlit1 = L"monkey picked tikuanyin oolong"; - const wchar_t* strlit2 = L"imperial tea court green oolong"; - - int i1; - int i2; - int size1 = char_traits<wchar_t>::length(strlit1) - 1; - int size2 = char_traits<wchar_t>::length(strlit2) - 1; - - i1 = coll_c.compare(strlit1, strlit1 + size1, strlit1, strlit1 + 7); - VERIFY ( i1 == 1 ); - i1 = coll_c.compare(strlit1, strlit1 + 7, strlit1, strlit1 + size1); - VERIFY ( i1 == -1 ); - i1 = coll_c.compare(strlit1, strlit1 + 7, strlit1, strlit1 + 7); - VERIFY ( i1 == 0 ); - - i2 = coll_c.compare(strlit2, strlit2 + size2, strlit2, strlit2 + 13); - VERIFY ( i2 == 1 ); - i2 = coll_c.compare(strlit2, strlit2 + 13, strlit2, strlit2 + size2); - VERIFY ( i2 == -1 ); - i2 = coll_c.compare(strlit2, strlit2 + size2, strlit2, strlit2 + size2); - VERIFY ( i2 == 0 ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/2.cc deleted file mode 100644 index 24b327f979b..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/2.cc +++ /dev/null @@ -1,86 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <locale> -#include <testsuite_hooks.h> - -// Check German "de_DE" locale. -void test02() -{ - using namespace std; - typedef std::collate<wchar_t>::string_type string_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_us("en_US"); - locale loc_fr("fr_FR"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_us != loc_fr ); - VERIFY( loc_us != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the collate facets - const collate<wchar_t>& coll_c = use_facet<collate<wchar_t> >(loc_c); - const collate<wchar_t>& coll_us = use_facet<collate<wchar_t> >(loc_us); - const collate<wchar_t>& coll_fr = use_facet<collate<wchar_t> >(loc_fr); - const collate<wchar_t>& coll_de = use_facet<collate<wchar_t> >(loc_de); - - // int compare(const charT*, const charT*, const charT*, const charT*) const - - const wchar_t* strlit1 = L"monkey picked tikuanyin oolong"; - const wchar_t* strlit2 = L"imperial tea court green oolong"; - const wchar_t* strlit3 = L"Äuglein Augment"; // "C" == "Augment Äuglein" - const wchar_t* strlit4 = L"Base baß Baß Bast"; // "C" == "Base baß Baß Bast" - - int i1; - int i2; - int size1 = char_traits<wchar_t>::length(strlit1) - 1; - int size2 = char_traits<wchar_t>::length(strlit2) - 1; - int size3 = char_traits<wchar_t>::length(strlit3) - 1; - int size4 = char_traits<wchar_t>::length(strlit4) - 1; - - i1 = coll_de.compare(strlit3, strlit3 + size3, strlit3, strlit3 + 7); - VERIFY ( i1 == 1 ); - i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + size1); - VERIFY ( i1 == -1 ); - i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + 7); - VERIFY ( i1 == 0 ); - - i1 = coll_de.compare(strlit3, strlit3 + 6, strlit3 + 8, strlit3 + 14); - VERIFY ( i1 == -1 ); - - i2 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + 13); - VERIFY ( i2 == 1 ); - i2 = coll_de.compare(strlit4, strlit4 + 13, strlit4, strlit4 + size4); - VERIFY ( i2 == -1 ); - i2 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + size4); - VERIFY ( i2 == 0 ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/3.cc deleted file mode 100644 index 0f9ee649c32..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/3.cc +++ /dev/null @@ -1,90 +0,0 @@ -// 2003-02-24 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <locale> -#include <testsuite_hooks.h> - -// Test handling of strings containing nul characters -void test03() -{ - using namespace std; - typedef std::collate<wchar_t>::string_type string_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - - // cache the collate facets - const collate<wchar_t>& coll_c = use_facet<collate<wchar_t> >(loc_c); - const collate<wchar_t>& coll_de = use_facet<collate<wchar_t> >(loc_de); - - // int compare(const charT*, const charT*, const charT*, const charT*) const - const wchar_t* strlit1 = L"a\0a\0"; - const wchar_t* strlit2 = L"a\0b\0"; - const wchar_t* strlit3 = L"a\0\xc4\0"; - const wchar_t* strlit4 = L"a\0B\0"; - const wchar_t* strlit5 = L"aa\0"; - const wchar_t* strlit6 = L"b\0a\0"; - - int i; - i = coll_c.compare(strlit1, strlit1 + 3, strlit2, strlit2 + 3); - VERIFY( i == -1 ); - - i = coll_de.compare(strlit1, strlit1 + 3, strlit2, strlit2 + 3); - VERIFY( i == -1 ); - - i = coll_c.compare(strlit3, strlit3 + 3, strlit4, strlit4 + 3); - VERIFY( i == 1 ); - - i = coll_de.compare(strlit3, strlit3 + 3, strlit4, strlit4 + 3); - VERIFY( i == -1 ); - - i = coll_c.compare(strlit1, strlit1 + 3, strlit1, strlit1 + 4); - VERIFY( i == -1 ); - - i = coll_de.compare(strlit3, strlit3 + 4, strlit3, strlit3 + 3); - VERIFY( i == 1 ); - - i = coll_c.compare(strlit1, strlit1 + 4, strlit4, strlit4 + 1); - VERIFY( i == 1 ); - - i = coll_de.compare(strlit3, strlit3 + 3, strlit3, strlit3 + 3); - VERIFY( i == 0 ); - - i = coll_c.compare(strlit1, strlit1 + 2, strlit1, strlit1 + 4); - VERIFY( i == -1 ); - - i = coll_de.compare(strlit1, strlit1 + 3, strlit5, strlit5 + 3); - VERIFY( i == -1 ); - - i = coll_c.compare(strlit6, strlit6 + 3, strlit1, strlit1 + 3); - VERIFY( i == 1 ); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_env.cc deleted file mode 100644 index 4f1d5e3f6a9..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_locale.cc deleted file mode 100644 index 8d7871815db..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/char/1.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/char/1.cc deleted file mode 100644 index 9be618a8f4a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/hash/char/1.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <locale> -#include <testsuite_hooks.h> - -// Check "C" locale. -void test01() -{ - bool test = true; - - std::string str1("fffff"); - std::string str2("ffffffffffff"); - - const std::locale cloc = std::locale::classic(); - const std::collate<char> &col = std::use_facet<std::collate<char> >(cloc); - - long l1 = col.hash(str1.c_str(), str1.c_str() + str1.size()); - long l2 = col.hash(str2.c_str(), str2.c_str() + str2.size()); - VERIFY( l1 != l2 ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/char/2.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/char/2.cc deleted file mode 100644 index 47fcd579ec7..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/hash/char/2.cc +++ /dev/null @@ -1,75 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <locale> -#include <testsuite_hooks.h> - -// Check German "de_DE" locale. -void test02() -{ - using namespace std; - typedef std::collate<char>::string_type string_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_us("en_US"); - locale loc_fr("fr_FR"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_us != loc_fr ); - VERIFY( loc_us != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the collate facets - const collate<char>& coll_c = use_facet<collate<char> >(loc_c); - const collate<char>& coll_us = use_facet<collate<char> >(loc_us); - const collate<char>& coll_fr = use_facet<collate<char> >(loc_fr); - const collate<char>& coll_de = use_facet<collate<char> >(loc_de); - - // long hash(const charT*, const charT*) cosnt - const char* strlit1 = "monkey picked tikuanyin oolong"; - const char* strlit2 = "imperial tea court green oolong"; - const char* strlit3 = "Äuglein Augment"; // "C" == "Augment Äuglein" - const char* strlit4 = "Base baß Baß Bast"; // "C" == "Base baß Baß Bast" - - int i1; - int i2; - long l1; - long l2; - int size3 = char_traits<char>::length(strlit4) - 1; - int size4 = char_traits<char>::length(strlit3) - 1; - - l1 = coll_de.hash(strlit3, strlit3 + size3); - l2 = coll_de.hash(strlit3, strlit3 + size3 - 1); - VERIFY ( l1 != l2 ); - l1 = coll_de.hash(strlit3, strlit3 + size3); - l2 = coll_de.hash(strlit4, strlit4 + size4); - VERIFY ( l1 != l2 ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_env.cc deleted file mode 100644 index 4f1d5e3f6a9..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_env.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_locale.cc deleted file mode 100644 index 8d7871815db..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_locale.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/1.cc deleted file mode 100644 index 73f8da142ca..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/1.cc +++ /dev/null @@ -1,48 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <locale> -#include <testsuite_hooks.h> - -// Check "C" locale. -void test01() -{ - using namespace std; - typedef std::collate<wchar_t>::string_type string_type; - bool test = true; - - string_type str1(L"fffff"); - string_type str2(L"ffffffffffff"); - - const std::locale cloc = std::locale::classic(); - const std::collate<wchar_t> &col = std::use_facet<std::collate<wchar_t> >(cloc); - - long l1 = col.hash(str1.c_str(), str1.c_str() + str1.size()); - long l2 = col.hash(str2.c_str(), str2.c_str() + str2.size()); - VERIFY( l1 != l2 ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/2.cc deleted file mode 100644 index b11be4a9990..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/2.cc +++ /dev/null @@ -1,74 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <locale> -#include <testsuite_hooks.h> - -// Check German "de_DE" locale. -void test02() -{ - using namespace std; - typedef std::collate<wchar_t>::string_type string_type; - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_us("en_US"); - locale loc_fr("fr_FR"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_us != loc_fr ); - VERIFY( loc_us != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the collate facets - const collate<wchar_t>& coll_c = use_facet<collate<wchar_t> >(loc_c); - const collate<wchar_t>& coll_us = use_facet<collate<wchar_t> >(loc_us); - const collate<wchar_t>& coll_fr = use_facet<collate<wchar_t> >(loc_fr); - const collate<wchar_t>& coll_de = use_facet<collate<wchar_t> >(loc_de); - - // long hash(const charT*, const charT*) cosnt - const wchar_t* strlit1 = L"monkey picked tikuanyin oolong"; - const wchar_t* strlit2 = L"imperial tea court green oolong"; - const wchar_t* strlit3 = L"Äuglein Augment"; // "C" == "Augment Äuglein" - const wchar_t* strlit4 = L"Base baß Baß Bast"; // "C" == "Base baß Baß Bast" - - int i1; - int i2; - long l1; - long l2; - int size3 = char_traits<wchar_t>::length(strlit4) - 1; - int size4 = char_traits<wchar_t>::length(strlit3) - 1; - - l1 = coll_de.hash(strlit3, strlit3 + size3); - l2 = coll_de.hash(strlit3, strlit3 + size3 - 1); - VERIFY ( l1 != l2 ); - l1 = coll_de.hash(strlit3, strlit3 + size3); - l2 = coll_de.hash(strlit4, strlit4 + size4); - VERIFY ( l1 != l2 ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_env.cc deleted file mode 100644 index 4f1d5e3f6a9..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_locale.cc deleted file mode 100644 index 8d7871815db..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/char/2.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/char/2.cc deleted file mode 100644 index 24ff7cdac8f..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/transform/char/2.cc +++ /dev/null @@ -1,72 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <locale> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef std::collate<char>::string_type string_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_us("en_US"); - locale loc_fr("fr_FR"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_us != loc_fr ); - VERIFY( loc_us != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the collate facets - const collate<char>& coll_c = use_facet<collate<char> >(loc_c); - const collate<char>& coll_us = use_facet<collate<char> >(loc_us); - const collate<char>& coll_fr = use_facet<collate<char> >(loc_fr); - const collate<char>& coll_de = use_facet<collate<char> >(loc_de); - - // long hash(const charT*, const charT*) cosnt - const char* strlit1 = "monkey picked tikuanyin oolong"; - const char* strlit2 = "imperial tea court green oolong"; - const char* strlit3 = "Äuglein Augment"; // "C" == "Augment Äuglein" - const char* strlit4 = "Base baß Baß Bast"; // "C" == "Base baß Baß Bast" - - int i1; - int i2; - int size3 = char_traits<char>::length(strlit3) - 1; - int size4 = char_traits<char>::length(strlit4) - 1; - - string_type str3 = coll_de.transform(strlit3, strlit3 + size3); - string_type str4 = coll_de.transform(strlit4, strlit4 + size4); - i1 = str3.compare(str4); - i2 = coll_de.compare(strlit3, strlit3 + size3, strlit4, strlit4 + size4); - VERIFY ( i2 == -1 ); - VERIFY ( i1 * i2 > 0 ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/char/3.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/char/3.cc deleted file mode 100644 index f9d16b54944..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/transform/char/3.cc +++ /dev/null @@ -1,93 +0,0 @@ -// 2003-02-24 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <locale> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - typedef std::collate<char>::string_type string_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - - // cache the collate facets - const collate<char>& coll_c = use_facet<collate<char> >(loc_c); - const collate<char>& coll_de = use_facet<collate<char> >(loc_de); - - const char* strlit1 = "a\0a\0"; - const char* strlit2 = "a\0b\0"; - const char* strlit3 = "a\0\xc4\0"; - const char* strlit4 = "a\0B\0"; - const char* strlit5 = "aa\0"; - const char* strlit6 = "b\0a\0"; - - int i; - string_type str1; - string_type str2; - - str1 = coll_c.transform(strlit1, strlit1 + 3); - str2 = coll_c.transform(strlit2, strlit2 + 3); - i = str1.compare(str2); - VERIFY( i < 0 ); - - str1 = coll_de.transform(strlit1, strlit1 + 3); - str2 = coll_de.transform(strlit2, strlit2 + 3); - i = str1.compare(str2); - VERIFY( i < 0 ); - - str1 = coll_c.transform(strlit3, strlit3 + 3); - str2 = coll_c.transform(strlit4, strlit4 + 3); - i = str1.compare(str2); - VERIFY( i > 0 ); - - str1 = coll_de.transform(strlit3, strlit3 + 3); - str2 = coll_de.transform(strlit4, strlit4 + 3); - i = str1.compare(str2); - VERIFY( i < 0 ); - - str1 = coll_c.transform(strlit1, strlit1 + 1); - str2 = coll_c.transform(strlit5, strlit5 + 1); - i = str1.compare(str2); - VERIFY( i == 0 ); - - str1 = coll_de.transform(strlit6, strlit6 + 3); - str2 = coll_de.transform(strlit1, strlit1 + 3); - i = str1.compare(str2); - VERIFY( i > 0 ); - - str1 = coll_c.transform(strlit1, strlit1 + 3); - str2 = coll_c.transform(strlit5, strlit5 + 3); - i = str1.compare(str2); - VERIFY( i < 0 ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/char/wrapped_env.cc deleted file mode 100644 index 9f9d1aade91..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/transform/char/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test02); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/char/wrapped_locale.cc deleted file mode 100644 index 2ef10fd5765..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/transform/char/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test02); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/2.cc deleted file mode 100644 index f643fd68da6..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/2.cc +++ /dev/null @@ -1,72 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <locale> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef std::collate<wchar_t>::string_type string_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_us("en_US"); - locale loc_fr("fr_FR"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_us != loc_fr ); - VERIFY( loc_us != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the collate facets - const collate<wchar_t>& coll_c = use_facet<collate<wchar_t> >(loc_c); - const collate<wchar_t>& coll_us = use_facet<collate<wchar_t> >(loc_us); - const collate<wchar_t>& coll_fr = use_facet<collate<wchar_t> >(loc_fr); - const collate<wchar_t>& coll_de = use_facet<collate<wchar_t> >(loc_de); - - // long hash(const charT*, const charT*) cosnt - const wchar_t* strlit1 = L"monkey picked tikuanyin oolong"; - const wchar_t* strlit2 = L"imperial tea court green oolong"; - const wchar_t* strlit3 = L"Äuglein Augment"; // "C" == "Augment Äuglein" - const wchar_t* strlit4 = L"Base baß Baß Bast"; // "C" == "Base baß Baß Bast" - - int i1; - int i2; - int size3 = char_traits<wchar_t>::length(strlit3) - 1; - int size4 = char_traits<wchar_t>::length(strlit4) - 1; - - string_type str3 = coll_de.transform(strlit3, strlit3 + size3); - string_type str4 = coll_de.transform(strlit4, strlit4 + size4); - i1 = str3.compare(str4); - i2 = coll_de.compare(strlit3, strlit3 + size3, strlit4, strlit4 + size4); - VERIFY ( i2 == -1 ); - VERIFY ( i1 * i2 > 0 ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/3.cc deleted file mode 100644 index 108c0a4be30..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/3.cc +++ /dev/null @@ -1,93 +0,0 @@ -// 2003-02-24 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <locale> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - typedef std::collate<wchar_t>::string_type string_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - - // cache the collate facets - const collate<wchar_t>& coll_c = use_facet<collate<wchar_t> >(loc_c); - const collate<wchar_t>& coll_de = use_facet<collate<wchar_t> >(loc_de); - - const wchar_t* strlit1 = L"a\0a\0"; - const wchar_t* strlit2 = L"a\0b\0"; - const wchar_t* strlit3 = L"a\0\xc4\0"; - const wchar_t* strlit4 = L"a\0B\0"; - const wchar_t* strlit5 = L"aa\0"; - const wchar_t* strlit6 = L"b\0a\0"; - - int i; - string_type str1; - string_type str2; - - str1 = coll_c.transform(strlit1, strlit1 + 3); - str2 = coll_c.transform(strlit2, strlit2 + 3); - i = str1.compare(str2); - VERIFY( i < 0 ); - - str1 = coll_de.transform(strlit1, strlit1 + 3); - str2 = coll_de.transform(strlit2, strlit2 + 3); - i = str1.compare(str2); - VERIFY( i < 0 ); - - str1 = coll_c.transform(strlit3, strlit3 + 3); - str2 = coll_c.transform(strlit4, strlit4 + 3); - i = str1.compare(str2); - VERIFY( i > 0 ); - - str1 = coll_de.transform(strlit3, strlit3 + 3); - str2 = coll_de.transform(strlit4, strlit4 + 3); - i = str1.compare(str2); - VERIFY( i < 0 ); - - str1 = coll_c.transform(strlit1, strlit1 + 1); - str2 = coll_c.transform(strlit5, strlit5 + 1); - i = str1.compare(str2); - VERIFY( i == 0 ); - - str1 = coll_de.transform(strlit6, strlit6 + 3); - str2 = coll_de.transform(strlit1, strlit1 + 3); - i = str1.compare(str2); - VERIFY( i > 0 ); - - str1 = coll_c.transform(strlit1, strlit1 + 3); - str2 = coll_c.transform(strlit5, strlit5 + 3); - i = str1.compare(str2); - VERIFY( i < 0 ); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_env.cc deleted file mode 100644 index 9f9d1aade91..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test02); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_locale.cc deleted file mode 100644 index 2ef10fd5765..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test02); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/collate_byname/1.cc b/libstdc++-v3/testsuite/22_locale/collate_byname/1.cc deleted file mode 100644 index edfb42c2120..00000000000 --- a/libstdc++-v3/testsuite/22_locale/collate_byname/1.cc +++ /dev/null @@ -1,136 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002 Free Software Foundation -// -// 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. - -// 22.2.4.2 Template class collate_byname - -#include <locale> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef std::collate<char>::string_type string_type; - - bool test = true; - string str; - locale loc_c = locale::classic(); - - locale loc_byname(locale::classic(), new collate_byname<char>("de_DE")); - str = loc_byname.name(); - - locale loc_de("de_DE"); - str = loc_de.name(); - - VERIFY( loc_de != loc_byname ); - - // cache the collate facets - const collate<char>& coll_byname = use_facet<collate<char> >(loc_byname); - const collate<char>& coll_de = use_facet<collate<char> >(loc_de); - - // Check German "de_DE" locale. - int i1; - int i2; - long l1; - long l2; - const char* strlit3 = "Äuglein Augment"; // "C" == "Augment Äuglein" - const char* strlit4 = "Base baß Baß Bast"; // "C" == "Base baß Baß Bast" - - int size3 = strlen(strlit3) - 1; - i1 = coll_de.compare(strlit3, strlit3 + size3, strlit3, strlit3 + 7); - VERIFY ( i1 == 1 ); - i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + size3); - VERIFY ( i1 == -1 ); - i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + 7); - VERIFY ( i1 == 0 ); - - i1 = coll_de.compare(strlit3, strlit3 + 6, strlit3 + 8, strlit3 + 14); - VERIFY ( i1 == -1 ); - - int size4 = strlen(strlit4) - 1; - i2 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + 13); - VERIFY ( i2 == 1 ); - i2 = coll_de.compare(strlit4, strlit4 + 13, strlit4, strlit4 + size4); - VERIFY ( i2 == -1 ); - i2 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + size4); - VERIFY ( i2 == 0 ); - - l1 = coll_de.hash(strlit3, strlit3 + size3); - l2 = coll_de.hash(strlit3, strlit3 + size3 - 1); - VERIFY ( l1 != l2 ); - l1 = coll_de.hash(strlit3, strlit3 + size3); - l2 = coll_de.hash(strlit4, strlit4 + size4); - VERIFY ( l1 != l2 ); - - string str3 = coll_de.transform(strlit3, strlit3 + size3); - string str4 = coll_de.transform(strlit4, strlit4 + size4); - i1 = str3.compare(str4); - i2 = coll_de.compare(strlit3, strlit3 + size3, strlit4, strlit4 + size4); - VERIFY ( i2 == -1 ); - VERIFY ( i1 * i2 > 0 ); - - - // Check byname locale - int i3; - int i4; - long l3; - long l4; - size4 = strlen(strlit3) - 1; - i3 = coll_de.compare(strlit3, strlit3 + size4, strlit3, strlit3 + 7); - VERIFY ( i3 == 1 ); - i3 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + size4); - VERIFY ( i3 == -1 ); - i3 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + 7); - VERIFY ( i3 == 0 ); - - i3 = coll_de.compare(strlit3, strlit3 + 6, strlit3 + 8, strlit3 + 14); - VERIFY ( i3 == -1 ); - - size4 = strlen(strlit4) - 1; - i4 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + 13); - VERIFY ( i4 == 1 ); - i4 = coll_de.compare(strlit4, strlit4 + 13, strlit4, strlit4 + size4); - VERIFY ( i4 == -1 ); - i4 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + size4); - VERIFY ( i4 == 0 ); - - l3 = coll_de.hash(strlit3, strlit3 + size4); - l4 = coll_de.hash(strlit3, strlit3 + size4 - 1); - VERIFY ( l3 != l4 ); - l3 = coll_de.hash(strlit3, strlit3 + size4); - l4 = coll_de.hash(strlit4, strlit4 + size4); - VERIFY ( l3 != l4 ); - - string str5 = coll_de.transform(strlit3, strlit3 + size3); - string str6 = coll_de.transform(strlit4, strlit4 + size4); - i3 = str5.compare(str6); - i4 = coll_de.compare(strlit3, strlit3 + size4, strlit4, strlit4 + size4); - VERIFY ( i4 == -1 ); - VERIFY ( i3 * i4 > 0 ); - - // Verify byname == de - VERIFY ( str5 == str3 ); - VERIFY ( str6 == str4 ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/1.cc b/libstdc++-v3/testsuite/22_locale/ctype/1.cc deleted file mode 100644 index 541f2b9c237..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/1.cc +++ /dev/null @@ -1,161 +0,0 @@ -// { dg-do compile } -// 1999-08-24 bkoz - -// Copyright (C) 1999, 2000, 2003 Free Software Foundation -// -// 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. - -// 22.2.1 The ctype category - -// 1: Test that the locale headers are picking up the correct declaration -// of the internal type `ctype_base::mask'. -int mask (); - -#include <locale> - -// 2: Should be able to instantiate this for other types besides char, wchar_t -typedef std::ctype<char> cctype; - -class gnu_ctype: public std::ctype<unsigned char> -{ -private: - const cctype& _M_cctype; - -public: - explicit - gnu_ctype(size_t __refs = 0) - : std::ctype<unsigned char>(__refs), - _M_cctype(std::use_facet<cctype>(std::locale::classic())) - { } - - ~gnu_ctype(); - -protected: - virtual bool - do_is(mask __m, char_type __c) const - { return _M_cctype.is(__m, __c); } - - virtual const char_type* - do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const - { - const char* __c = _M_cctype.is(reinterpret_cast<const char*>(__lo), - reinterpret_cast<const char*>(__hi), __vec); - return reinterpret_cast<const char_type*>(__c); - } - - virtual const char_type* - do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const - { - const char* __c = _M_cctype.scan_is(__m, - reinterpret_cast<const char*>(__lo), - reinterpret_cast<const char*>(__hi)); - return reinterpret_cast<const char_type*>(__c); - } - - virtual const char_type* - do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const - { - const char* __c = _M_cctype.scan_is(__m, - reinterpret_cast<const char*>(__lo), - reinterpret_cast<const char*>(__hi)); - return reinterpret_cast<const char_type*>(__c); - } - - virtual char_type - do_toupper(char_type __c) const - { return _M_cctype.toupper(__c); } - - virtual const char_type* - do_toupper(char_type* __lo, const char_type* __hi) const - { - const char* __c = _M_cctype.toupper(reinterpret_cast<char*>(__lo), - reinterpret_cast<const char*>(__hi)); - return reinterpret_cast<const char_type*>(__c); - } - - virtual char_type - do_tolower(char_type __c) const - { return _M_cctype.tolower(__c); } - - virtual const char_type* - do_tolower(char_type* __lo, const char_type* __hi) const - { - const char* __c = _M_cctype.toupper(reinterpret_cast<char*>(__lo), - reinterpret_cast<const char*>(__hi)); - return reinterpret_cast<const char_type*>(__c); - } - - virtual char_type - do_widen(char __c) const - { return _M_cctype.widen(__c); } - - virtual const char* - do_widen(const char* __lo, const char* __hi, char_type* __dest) const - { - const char* __c = _M_cctype.widen(reinterpret_cast<const char*>(__lo), - reinterpret_cast<const char*>(__hi), - reinterpret_cast<char*>(__dest)); - return __c; - } - - virtual char - do_narrow(char_type __c, char __dfault) const - { return _M_cctype.narrow(__c, __dfault); } - - virtual const char_type* - do_narrow(const char_type* __lo, const char_type* __hi, char __dfault, - char* __dest) const - { - const char* __c = _M_cctype.narrow(reinterpret_cast<const char*>(__lo), - reinterpret_cast<const char*>(__hi), - __dfault, - reinterpret_cast<char*>(__dest)); - return reinterpret_cast<const char_type*>(__c); - } - -}; - -gnu_ctype::~gnu_ctype() { } - -gnu_ctype facet01; - -// 3: Sanity check ctype_base::mask bitmask requirements -void -test01() -{ - using namespace std; - - ctype_base::mask m01; - ctype_base::mask m02; - - m01 = ctype_base::space; - m02 = ctype_base::xdigit; - - m01 & m02; - m01 | m02; - m01 ^ m02; - ~m01; - m01 &= m02; - m01 |= m02; - m01 ^= m02; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/2.cc b/libstdc++-v3/testsuite/22_locale/ctype/2.cc deleted file mode 100644 index 924efddedba..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/2.cc +++ /dev/null @@ -1,43 +0,0 @@ -// { dg-do compile } -// 1999-08-24 bkoz - -// Copyright (C) 1999, 2000, 2003 Free Software Foundation -// -// 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. - -// 22.2.1 The ctype category - -#include <locale> -#include <testsuite_hooks.h> - -class gnu_obj -{ }; - -class gnu_ctype2: public std::ctype<gnu_obj> -{ }; - -// libstdc++/3017 -void test02() -{ - gnu_ctype2 obj; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/cons/char/1.cc b/libstdc++-v3/testsuite/22_locale/ctype/cons/char/1.cc deleted file mode 100644 index 4846aec220e..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/cons/char/1.cc +++ /dev/null @@ -1,68 +0,0 @@ -// 2000-02-16 bkoz - -// Copyright (C) 2000, 2001, 2002, 2003 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. - -// 22.2.1.3.2 ctype<char> members - -#include <locale> -#include <testsuite_hooks.h> - -// Dietmar Kühl via Peter Schmid -class comma_ctype: public std::ctype<char> -{ -public: - comma_ctype(): std::ctype<char>() { } - comma_ctype(const std::ctype_base::mask* m): std::ctype<char>(m) { } - - const mask* - get_classic_table() - { return std::ctype<char>::classic_table(); } - - const mask* - get_table() - { return this->table(); } -}; - -void test01() -{ - using namespace std; - bool test = true; - - comma_ctype obj; - const ctype_base::mask* tmp = obj.get_classic_table(); - - comma_ctype obj2(tmp); - const ctype_base::mask* ctable = obj2.get_table(); - VERIFY ( tmp == ctable ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/cons/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/cons/char/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/cons/char/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/cons/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/cons/char/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/cons/char/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/char/1.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/char/1.cc deleted file mode 100644 index 8e80fd2fb96..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/is/char/1.cc +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (C) 2000, 2001, 2002, 2003 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. - -// 22.2.1.3.2 ctype<char> members - -#include <locale> -#include <testsuite_hooks.h> - -typedef char char_type; -class gnu_ctype: public std::ctype<char_type> { }; - -void test01() -{ - bool test = true; - const char_type strlit00[] = "manilla, cebu, tandag PHILIPPINES"; - const char_type strlit01[] = "MANILLA, CEBU, TANDAG PHILIPPINES"; - const char_type strlit02[] = "manilla, cebu, tandag philippines"; - const char_type c00 = 'S'; - const char_type c10 = 's'; - const char_type c20 = '9'; - const char_type c30 = ' '; - const char_type c40 = '!'; - const char_type c50 = 'F'; - const char_type c60 = 'f'; - const char_type c70 = 'X'; - const char_type c80 = 'x'; - - gnu_ctype gctype; - char_type c100; - int len = std::char_traits<char_type>::length(strlit00); - char_type c_array[len + 1]; - - // sanity check ctype_base::mask members - int i01 = std::ctype_base::space; - int i02 = std::ctype_base::upper; - int i03 = std::ctype_base::lower; - int i04 = std::ctype_base::digit; - int i05 = std::ctype_base::punct; - int i06 = std::ctype_base::alpha; - int i07 = std::ctype_base::xdigit; - int i08 = std::ctype_base::alnum; - int i09 = std::ctype_base::graph; - int i10 = std::ctype_base::print; - int i11 = std::ctype_base::cntrl; - int i12 = sizeof(std::ctype_base::mask); - VERIFY ( i01 != i02); - VERIFY ( i02 != i03); - VERIFY ( i03 != i04); - VERIFY ( i04 != i05); - VERIFY ( i05 != i06); - VERIFY ( i06 != i07); - VERIFY ( i07 != i08); - VERIFY ( i08 != i09); - VERIFY ( i09 != i10); - VERIFY ( i10 != i11); - VERIFY ( i11 != i01); - - // bool is(mask m, char_type c) const; - VERIFY( gctype.is(std::ctype_base::space, c30) ); - VERIFY( gctype.is(std::ctype_base::upper, c00) ); - VERIFY( gctype.is(std::ctype_base::lower, c10) ); - VERIFY( gctype.is(std::ctype_base::digit, c20) ); - VERIFY( gctype.is(std::ctype_base::punct, c40) ); - VERIFY( gctype.is(std::ctype_base::alpha, c50) ); - VERIFY( gctype.is(std::ctype_base::alpha, c60) ); - VERIFY( gctype.is(std::ctype_base::xdigit, c20) ); - VERIFY( !gctype.is(std::ctype_base::xdigit, c80) ); - VERIFY( gctype.is(std::ctype_base::alnum, c50) ); - VERIFY( gctype.is(std::ctype_base::alnum, c20) ); - VERIFY( gctype.is(std::ctype_base::graph, c40) ); - VERIFY( gctype.is(std::ctype_base::graph, c20) ); - - // const char* is(const char* low, const char* high, mask* vec) const - std::ctype_base::mask m00 = static_cast<std::ctype_base::mask>(0); - std::ctype_base::mask m01[3]; - std::ctype_base::mask m02[13]; - const char_type* cc0 = strlit00; - const char_type* cc1 = NULL; - const char_type* cc2 = NULL; - - cc0 = strlit00; - m01[0] = m00; - m01[1] = m00; - m01[2] = m00; - cc1 = gctype.is(cc0, cc0, m01); - VERIFY( cc1 == strlit00 ); - VERIFY( m01[0] == m00 ); - VERIFY( m01[1] == m00 ); - VERIFY( m01[2] == m00 ); - - cc0 = strlit00; - m01[0] = m00; - m01[1] = m00; - m01[2] = m00; - cc2 = gctype.is(cc0, cc0 + 3, m01); - VERIFY( cc2 == strlit00 + 3); - VERIFY( m01[0] != m00 ); - VERIFY( m01[1] != m00 ); - VERIFY( m01[2] != m00 ); - VERIFY( gctype.is(m01[0], cc0[0]) ); - VERIFY( gctype.is(m01[1], cc0[1]) ); - VERIFY( gctype.is(m01[2], cc0[2]) ); - - cc0 = strlit01; - cc1 = gctype.is(cc0, cc0 + 13, m02); - VERIFY( cc1 == strlit01 + 13); - VERIFY( m02[6] != m00 ); - VERIFY( m02[7] != m00 ); - VERIFY( m02[8] != m00 ); - VERIFY( m02[8] != m02[6] ); - VERIFY( m02[6] != m02[7] ); - VERIFY( static_cast<bool>(m02[6] & std::ctype_base::alnum) ); - VERIFY( static_cast<bool>(m02[6] & std::ctype_base::upper) ); - VERIFY( static_cast<bool>(m02[6] & std::ctype_base::alpha) ); - VERIFY( static_cast<bool>(m02[7] & std::ctype_base::punct) ); - VERIFY( static_cast<bool>(m02[8] & std::ctype_base::space) ); - VERIFY( gctype.is(m02[6], cc0[6]) ); - VERIFY( gctype.is(m02[7], cc0[7]) ); - VERIFY( gctype.is(m02[8], cc0[8]) ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/char/2.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/char/2.cc deleted file mode 100644 index d04800a01ca..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/is/char/2.cc +++ /dev/null @@ -1,104 +0,0 @@ -// { dg-do run { xfail *-*-![linux]* } } -// Copyright (C) 2000, 2001, 2002, 2003 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. - -// 22.2.1.3.2 ctype<char> members - -#include <locale> -#include <vector> -#include <testsuite_hooks.h> - -typedef char char_type; - -// libstdc++/4456, libstdc++/4457, libstdc++/4458 -void test02() -{ - using namespace std; - typedef ctype_base::mask mask; - typedef vector<mask> vector_type; - - bool test = true; - - // const int max = numeric_limits<char>::max(); - const int max = 255; - const int ctype_mask_max = 10; - vector_type v_c(max); - vector_type v_de(max); - - // "C" - locale loc_c = locale::classic(); - const ctype<char>& ctype_c = use_facet<ctype<char> >(loc_c); - for (int i = 0; i < max; ++i) - { - char_type c = static_cast<char>(i); - mask mask_test = static_cast<mask>(0); - mask mask_is = static_cast<mask>(0); - for (int j = 0; j <= ctype_mask_max; ++j) - { - mask_test = static_cast<mask>(1 << j); - if (ctype_c.is(mask_test, c)) - mask_is |= mask_test; - } - v_c[i] = mask_is; - } - - // "de_DE" - locale loc_de("de_DE"); - const ctype<char>& ctype_de = use_facet<ctype<char> >(loc_de); - for (int i = 0; i < max; ++i) - { - char_type c = static_cast<char>(i); - mask mask_test = static_cast<mask>(0); - mask mask_is = static_cast<mask>(0); - for (int j = 0; j <= ctype_mask_max; ++j) - { - mask_test = static_cast<mask>(1 << j); - if (ctype_de.is(mask_test, c)) - mask_is |= mask_test; - } - v_de[i] = mask_is; - } - -#if QUANNUM_VERBOSE_LYRICALLY_ADEPT_BAY_AREA_MCS_MODE - for (int i = 0; i < max; ++i) - { - char_type mark = v_c[i] == v_de[i] ? ' ' : '-'; - cout << i << ' ' << mark << ' ' << static_cast<char>(i) << '\t' ; - cout << "v_c: " << setw(4) << v_c[i] << '\t'; - cout << "v_de: " << setw(4) << v_de[i] << endl; - } - cout << (v_c == v_de) << endl; -#endif - - VERIFY( v_c != v_de ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/char/3.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/char/3.cc deleted file mode 100644 index fb3a75df244..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/is/char/3.cc +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (C) 2000, 2001, 2002, 2003 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. - -// 22.2.1.3.2 ctype<char> members - -#include <locale> -#include <testsuite_hooks.h> - -typedef char char_type; - -// Per Liboriussen <liborius@stofanet.dk> -void test03() -{ - bool test = true; - std::ctype_base::mask maskdata[256]; - for (int i = 0; i < 256; ++i) - maskdata[i] = std::ctype_base::alpha; - std::ctype<char>* f = new std::ctype<char>(maskdata); - std::locale global; - std::locale loc(global, f); - for (int i = 0; i < 256; ++i) - { - char_type ch = i; - VERIFY( std::isalpha(ch, loc) ); - } -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/char/wrapped_env.cc deleted file mode 100644 index 3f042d9ec42..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/is/char/wrapped_env.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/char/wrapped_locale.cc deleted file mode 100644 index 61086ad6da8..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/is/char/wrapped_locale.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/1.cc deleted file mode 100644 index ff115d2cdbe..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/1.cc +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (C) 2000, 2001, 2002, 2003 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. - -// 22.2.1.3.2 ctype<char> members - -#include <locale> -#include <testsuite_hooks.h> - -typedef wchar_t char_type; -class gnu_ctype: public std::ctype<char_type> { }; - -void test01() -{ - bool test = true; - const char_type strlit00[] = L"manilla, cebu, tandag PHILIPPINES"; - const char_type strlit01[] = L"MANILLA, CEBU, TANDAG PHILIPPINES"; - const char_type strlit02[] = L"manilla, cebu, tandag philippines"; - const char_type c00 = L'S'; - const char_type c10 = L's'; - const char_type c20 = L'9'; - const char_type c30 = L' '; - const char_type c40 = L'!'; - const char_type c50 = L'F'; - const char_type c60 = L'f'; - const char_type c70 = L'X'; - const char_type c80 = L'x'; - - gnu_ctype gctype; - char_type c100; - int len = std::char_traits<char_type>::length(strlit00); - char_type c_array[len + 1]; - - // sanity check ctype_base::mask members - int i01 = std::ctype_base::space; - int i02 = std::ctype_base::upper; - int i03 = std::ctype_base::lower; - int i04 = std::ctype_base::digit; - int i05 = std::ctype_base::punct; - int i06 = std::ctype_base::alpha; - int i07 = std::ctype_base::xdigit; - int i08 = std::ctype_base::alnum; - int i09 = std::ctype_base::graph; - int i10 = std::ctype_base::print; - int i11 = std::ctype_base::cntrl; - int i12 = sizeof(std::ctype_base::mask); - VERIFY ( i01 != i02); - VERIFY ( i02 != i03); - VERIFY ( i03 != i04); - VERIFY ( i04 != i05); - VERIFY ( i05 != i06); - VERIFY ( i06 != i07); - VERIFY ( i07 != i08); - VERIFY ( i08 != i09); - VERIFY ( i09 != i10); - VERIFY ( i10 != i11); - VERIFY ( i11 != i01); - - // bool is(mask m, char_type c) const; - VERIFY( gctype.is(std::ctype_base::space, c30) ); - VERIFY( gctype.is(std::ctype_base::upper, c00) ); - VERIFY( gctype.is(std::ctype_base::lower, c10) ); - VERIFY( gctype.is(std::ctype_base::digit, c20) ); - VERIFY( gctype.is(std::ctype_base::punct, c40) ); - VERIFY( gctype.is(std::ctype_base::alpha, c50) ); - VERIFY( gctype.is(std::ctype_base::alpha, c60) ); - VERIFY( gctype.is(std::ctype_base::xdigit, c20) ); - VERIFY( !gctype.is(std::ctype_base::xdigit, c80) ); - VERIFY( gctype.is(std::ctype_base::alnum, c50) ); - VERIFY( gctype.is(std::ctype_base::alnum, c20) ); - VERIFY( gctype.is(std::ctype_base::graph, c40) ); - VERIFY( gctype.is(std::ctype_base::graph, c20) ); - - // const char* is(const char* low, const char* high, mask* vec) const - std::ctype_base::mask m00 = static_cast<std::ctype_base::mask>(0); - std::ctype_base::mask m01[3]; - std::ctype_base::mask m02[13]; - const char_type* cc0 = strlit00; - const char_type* cc1 = NULL; - const char_type* cc2 = NULL; - - cc0 = strlit00; - m01[0] = m00; - m01[1] = m00; - m01[2] = m00; - cc1 = gctype.is(cc0, cc0, m01); - VERIFY( cc1 == strlit00 ); - VERIFY( m01[0] == m00 ); - VERIFY( m01[1] == m00 ); - VERIFY( m01[2] == m00 ); - -#if 0 - VERIFY( m01[0] != m00 ); - VERIFY( m01[1] != m00 ); - VERIFY( m01[2] != m00 ); - VERIFY( gctype.is(m01[0], cc0[0]) ); - VERIFY( gctype.is(m01[1], cc0[1]) ); - VERIFY( gctype.is(m01[2], cc0[2]) ); -#endif - - cc0 = strlit01; - cc1 = gctype.is(cc0, cc0 + 13, m02); - VERIFY( cc1 == strlit01 + 13); -#if 0 - VERIFY( m02[6] != m00 ); - VERIFY( m02[7] != m00 ); - VERIFY( m02[8] != m00 ); - VERIFY( m02[8] != m02[6] ); - VERIFY( m02[6] != m02[7] ); - VERIFY( static_cast<bool>(m02[6] & std::ctype_base::alnum) ); - VERIFY( static_cast<bool>(m02[6] & std::ctype_base::upper) ); - VERIFY( static_cast<bool>(m02[6] & std::ctype_base::alpha) ); - VERIFY( static_cast<bool>(m02[7] & std::ctype_base::punct) ); - VERIFY( static_cast<bool>(m02[8] & std::ctype_base::space) ); - VERIFY( gctype.is(m02[6], cc0[6]) ); - VERIFY( gctype.is(m02[7], cc0[7]) ); - VERIFY( gctype.is(m02[8], cc0[8]) ); -#endif -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/2.cc deleted file mode 100644 index b1b565f3780..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/2.cc +++ /dev/null @@ -1,104 +0,0 @@ -// { dg-do run { xfail *-*-![linux]* } } -// Copyright (C) 2000, 2001, 2002, 2003 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. - -// 22.2.1.3.2 ctype<char> members - -#include <locale> -#include <vector> -#include <testsuite_hooks.h> - -typedef wchar_t char_type; - -// libstdc++/4456, libstdc++/4457, libstdc++/4458 -void test02() -{ - using namespace std; - typedef ctype_base::mask mask; - typedef vector<mask> vector_type; - - bool test = true; - - // const int max = numeric_limits<char>::max(); - const int max = 255; - const int ctype_mask_max = 10; - vector_type v_c(max); - vector_type v_de(max); - - // "C" - locale loc_c = locale::classic(); - const ctype<wchar_t>& ctype_c = use_facet<ctype<wchar_t> >(loc_c); - for (int i = 0; i < max; ++i) - { - char_type c = static_cast<wchar_t>(i); - mask mask_test = static_cast<mask>(0); - mask mask_is = static_cast<mask>(0); - for (int j = 0; j <= ctype_mask_max; ++j) - { - mask_test = static_cast<mask>(1 << j); - if (ctype_c.is(mask_test, c)) - mask_is |= mask_test; - } - v_c[i] = mask_is; - } - - // "de_DE" - locale loc_de("de_DE"); - const ctype<wchar_t>& ctype_de = use_facet<ctype<wchar_t> >(loc_de); - for (int i = 0; i < max; ++i) - { - char_type c = static_cast<wchar_t>(i); - mask mask_test = static_cast<mask>(0); - mask mask_is = static_cast<mask>(0); - for (int j = 0; j <= ctype_mask_max; ++j) - { - mask_test = static_cast<mask>(1 << j); - if (ctype_de.is(mask_test, c)) - mask_is |= mask_test; - } - v_de[i] = mask_is; - } - -#if QUANNUM_VERBOSE_LYRICALLY_ADEPT_BAY_AREA_MCS_MODE - for (int i = 0; i < max; ++i) - { - char_type mark = v_c[i] == v_de[i] ? ' ' : '-'; - cout << i << ' ' << mark << ' ' << static_cast<wchar_t>(i) << '\t' ; - cout << "v_c: " << setw(4) << v_c[i] << '\t'; - cout << "v_de: " << setw(4) << v_de[i] << endl; - } - cout << (v_c == v_de) << endl; -#endif - - VERIFY( v_c != v_de ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/wrapped_env.cc deleted file mode 100644 index 4f1d5e3f6a9..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/wrapped_locale.cc deleted file mode 100644 index 8d7871815db..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/1.cc b/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/1.cc deleted file mode 100644 index b349a38aedd..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/1.cc +++ /dev/null @@ -1,69 +0,0 @@ -// 2002-05-24 bkoz - -// Copyright (C) 2002, 2003 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. - -// 22.2.1.3.2 ctype<char> members - -#include <locale> -#include <vector> -#include <testsuite_hooks.h> - -// libstdc++/6701 -void test01() -{ - using namespace std; - typedef char wide_type; - - bool test = true; - const char dfault = '?'; - const locale loc_c = locale::classic(); - const ctype<wide_type>& ctype_c = use_facet<ctype<wide_type> >(loc_c); - - basic_string<wide_type> wide("wibble"); - basic_string<char> narrow("wibble"); - vector<char> narrow_chars(wide.length() + 1); - - // narrow(charT c, char dfault) const - for (int i = 0; i < wide.length(); ++i) - { - char c = ctype_c.narrow(wide[i], dfault); - VERIFY( c == narrow[i] ); - } - - // narrow(const charT* low, const charT* high, char dfault, char* dest) const - ctype_c.narrow(&wide[0], &wide[wide.length()], dfault, &narrow_chars[0]); - VERIFY( narrow_chars[0] != dfault ); - for (int i = 0; i < wide.length(); ++i) - VERIFY( narrow_chars[i] == narrow[i] ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/2.cc b/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/2.cc deleted file mode 100644 index 31805ae1ecc..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/2.cc +++ /dev/null @@ -1,73 +0,0 @@ -// 2002-05-24 bkoz - -// Copyright (C) 2002, 2003 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. - -// 22.2.1.3.2 ctype<char> members - -#include <locale> -#include <vector> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef char wide_type; - - bool test = true; - const char dfault = '?'; - const locale loc_c = locale::classic(); - const ctype<wide_type>& ctype_c = use_facet<ctype<wide_type> >(loc_c); - - // Construct non-asci string. - basic_string<wide_type> wide("wibble"); - wide += wide_type(1240); - wide += "kibble"; - basic_string<char> narrow("wibble"); - narrow += char(1240); - narrow += "kibble"; - vector<char> narrow_chars(wide.length() + 1); - - // narrow(charT c, char dfault) const - for (int i = 0; i < wide.length(); ++i) - { - char c = ctype_c.narrow(wide[i], dfault); - VERIFY( c == narrow[i] ); - } - - // narrow(const charT* low, const charT* high, char dfault, char* dest) const - ctype_c.narrow(&wide[0], &wide[wide.length()], dfault, &narrow_chars[0]); - VERIFY( narrow_chars[0] != dfault ); - for (int i = 0; i < wide.length(); ++i) - VERIFY( narrow_chars[i] == narrow[i] ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/wrapped_env.cc deleted file mode 100644 index 4f1d5e3f6a9..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/wrapped_env.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/wrapped_locale.cc deleted file mode 100644 index 8d7871815db..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/narrow/char/wrapped_locale.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/1.cc deleted file mode 100644 index 820fe6c99bc..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/1.cc +++ /dev/null @@ -1,69 +0,0 @@ -// 2002-05-24 bkoz - -// Copyright (C) 2002, 2003 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. - -// 22.2.1.3.2 ctype<char> members - -#include <locale> -#include <vector> -#include <testsuite_hooks.h> - -// libstdc++/6701 -void test01() -{ - using namespace std; - typedef wchar_t wide_type; - - bool test = true; - const char dfault = '?'; - const locale loc_c = locale::classic(); - const ctype<wide_type>& ctype_c = use_facet<ctype<wide_type> >(loc_c); - - basic_string<wide_type> wide(L"wibble"); - basic_string<char> narrow("wibble"); - vector<char> narrow_chars(wide.length() + 1); - - // narrow(charT c, char dfault) const - for (int i = 0; i < wide.length(); ++i) - { - char c = ctype_c.narrow(wide[i], dfault); - VERIFY( c == narrow[i] ); - } - - // narrow(const charT* low, const charT* high, char dfault, char* dest) const - ctype_c.narrow(&wide[0], &wide[wide.length()], dfault, &narrow_chars[0]); - VERIFY( narrow_chars[0] != dfault ); - for (int i = 0; i < wide.length(); ++i) - VERIFY( narrow_chars[i] == narrow[i] ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/2.cc deleted file mode 100644 index 2d7750629b1..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/2.cc +++ /dev/null @@ -1,73 +0,0 @@ -// 2002-05-24 bkoz - -// Copyright (C) 2002, 2003 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. - -// 22.2.1.3.2 ctype<char> members - -#include <locale> -#include <vector> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef wchar_t wide_type; - - bool test = true; - const char dfault = '?'; - const locale loc_c = locale::classic(); - const ctype<wide_type>& ctype_c = use_facet<ctype<wide_type> >(loc_c); - - // Construct non-asci string. - basic_string<wide_type> wide(L"wibble"); - wide += wide_type(1240); - wide += L"kibble"; - basic_string<char> narrow("wibble"); - narrow += dfault; - narrow += "kibble"; - vector<char> narrow_chars(wide.length() + 1); - - // narrow(charT c, char dfault) const - for (int i = 0; i < wide.length(); ++i) - { - char c = ctype_c.narrow(wide[i], dfault); - VERIFY( c == narrow[i] ); - } - - // narrow(const charT* low, const charT* high, char dfault, char* dest) const - ctype_c.narrow(&wide[0], &wide[wide.length()], dfault, &narrow_chars[0]); - VERIFY( narrow_chars[0] != dfault ); - for (int i = 0; i < wide.length(); ++i) - VERIFY( narrow_chars[i] == narrow[i] ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/3.cc deleted file mode 100644 index f235d8a3661..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/3.cc +++ /dev/null @@ -1,56 +0,0 @@ -// 2003-03-12 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 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. - -// 22.2.1.3.2 ctype<wchar_t> members - -#include <locale> -#include <testsuite_hooks.h> - -// libstdc++/9581 -void test03() -{ - using namespace std; - bool test = true; - - locale loc ("se_NO.UTF-8"); - const ctype<wchar_t>& wct = use_facet<ctype<wchar_t> >(loc); - - const wchar_t* wstrlit = L"\x80"; - - char buf[2]; - wct.narrow(wstrlit, wstrlit + 2, ' ', buf); - VERIFY( buf[0] == wct.narrow(wstrlit[0], ' ') ); - VERIFY( buf[1] == wct.narrow(wstrlit[1], ' ') ); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/wrapped_env.cc deleted file mode 100644 index 4f1d5e3f6a9..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/wrapped_locale.cc deleted file mode 100644 index 8d7871815db..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/narrow/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/scan/char/1.cc b/libstdc++-v3/testsuite/22_locale/ctype/scan/char/1.cc deleted file mode 100644 index 6e8d1d31e26..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/scan/char/1.cc +++ /dev/null @@ -1,348 +0,0 @@ -// 2002-05-10 ghazi - -// Copyright (C) 2002 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. - -// { dg-do run } - -#include <locale> -#include <testsuite_hooks.h> - -typedef char char_type; -typedef std::char_traits<char_type> traits_type; -class gnu_ctype: public std::ctype<char_type> { }; - -// These two macros take a ctype mask, a string and a pointer within -// the string that the scan function should return, usually either the -// first or last character if the string contains identical values as -// below. -#define VERIFY_SCAN_IS(MASK, STRING, EXPECTED) \ - VERIFY(gctype.scan_is((MASK), (STRING), \ - (STRING) + traits_type::length(STRING)) == (EXPECTED)) -#define VERIFY_SCAN_NOT(MASK, STRING, EXPECTED) \ - VERIFY(gctype.scan_not((MASK), (STRING), \ - (STRING) + traits_type::length(STRING)) == (EXPECTED)) - -// Sanity check scan_is() and scan_not(). -void test01() -{ - bool test = true; - - const char_type *const ca = "aaaaa"; - const char_type *const cz = "zzzzz"; - const char_type *const cA = "AAAAA"; - const char_type *const cZ = "ZZZZZ"; - const char_type *const c0 = "00000"; - const char_type *const c9 = "99999"; - const char_type *const cs = " "; - const char_type *const xf = "fffff"; - const char_type *const xF = "FFFFF"; - const char_type *const p1 = "!!!!!"; - const char_type *const p2 = "/////"; - - gnu_ctype gctype; - - // 'a' - VERIFY_SCAN_IS (std::ctype_base::alnum, ca, ca); - VERIFY_SCAN_IS (std::ctype_base::alpha, ca, ca); - VERIFY_SCAN_IS (std::ctype_base::cntrl, ca, ca+5); - VERIFY_SCAN_IS (std::ctype_base::digit, ca, ca+5); - VERIFY_SCAN_IS (std::ctype_base::graph, ca, ca); - VERIFY_SCAN_IS (std::ctype_base::lower, ca, ca); - VERIFY_SCAN_IS (std::ctype_base::print, ca, ca); - VERIFY_SCAN_IS (std::ctype_base::punct, ca, ca+5); - VERIFY_SCAN_IS (std::ctype_base::space, ca, ca+5); - VERIFY_SCAN_IS (std::ctype_base::upper, ca, ca+5); - VERIFY_SCAN_IS (std::ctype_base::xdigit, ca, ca); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, ca, ca+5); - VERIFY_SCAN_NOT (std::ctype_base::alpha, ca, ca+5); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, ca, ca); - VERIFY_SCAN_NOT (std::ctype_base::digit, ca, ca); - VERIFY_SCAN_NOT (std::ctype_base::graph, ca, ca+5); - VERIFY_SCAN_NOT (std::ctype_base::lower, ca, ca+5); - VERIFY_SCAN_NOT (std::ctype_base::print, ca, ca+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, ca, ca); - VERIFY_SCAN_NOT (std::ctype_base::space, ca, ca); - VERIFY_SCAN_NOT (std::ctype_base::upper, ca, ca); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, ca, ca+5); - - // 'z' - VERIFY_SCAN_IS (std::ctype_base::alnum, cz, cz); - VERIFY_SCAN_IS (std::ctype_base::alpha, cz, cz); - VERIFY_SCAN_IS (std::ctype_base::cntrl, cz, cz+5); - VERIFY_SCAN_IS (std::ctype_base::digit, cz, cz+5); - VERIFY_SCAN_IS (std::ctype_base::graph, cz, cz); - VERIFY_SCAN_IS (std::ctype_base::lower, cz, cz); - VERIFY_SCAN_IS (std::ctype_base::print, cz, cz); - VERIFY_SCAN_IS (std::ctype_base::punct, cz, cz+5); - VERIFY_SCAN_IS (std::ctype_base::space, cz, cz+5); - VERIFY_SCAN_IS (std::ctype_base::upper, cz, cz+5); - VERIFY_SCAN_IS (std::ctype_base::xdigit, cz, cz+5); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, cz, cz+5); - VERIFY_SCAN_NOT (std::ctype_base::alpha, cz, cz+5); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, cz, cz); - VERIFY_SCAN_NOT (std::ctype_base::digit, cz, cz); - VERIFY_SCAN_NOT (std::ctype_base::graph, cz, cz+5); - VERIFY_SCAN_NOT (std::ctype_base::lower, cz, cz+5); - VERIFY_SCAN_NOT (std::ctype_base::print, cz, cz+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, cz, cz); - VERIFY_SCAN_NOT (std::ctype_base::space, cz, cz); - VERIFY_SCAN_NOT (std::ctype_base::upper, cz, cz); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, cz, cz); - - // 'A' - VERIFY_SCAN_IS (std::ctype_base::alnum, cA, cA); - VERIFY_SCAN_IS (std::ctype_base::alpha, cA, cA); - VERIFY_SCAN_IS (std::ctype_base::cntrl, cA, cA+5); - VERIFY_SCAN_IS (std::ctype_base::digit, cA, cA+5); - VERIFY_SCAN_IS (std::ctype_base::graph, cA, cA); - VERIFY_SCAN_IS (std::ctype_base::lower, cA, cA+5); - VERIFY_SCAN_IS (std::ctype_base::print, cA, cA); - VERIFY_SCAN_IS (std::ctype_base::punct, cA, cA+5); - VERIFY_SCAN_IS (std::ctype_base::space, cA, cA+5); - VERIFY_SCAN_IS (std::ctype_base::upper, cA, cA); - VERIFY_SCAN_IS (std::ctype_base::xdigit, cA, cA); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, cA, cA+5); - VERIFY_SCAN_NOT (std::ctype_base::alpha, cA, cA+5); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, cA, cA); - VERIFY_SCAN_NOT (std::ctype_base::digit, cA, cA); - VERIFY_SCAN_NOT (std::ctype_base::graph, cA, cA+5); - VERIFY_SCAN_NOT (std::ctype_base::lower, cA, cA); - VERIFY_SCAN_NOT (std::ctype_base::print, cA, cA+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, cA, cA); - VERIFY_SCAN_NOT (std::ctype_base::space, cA, cA); - VERIFY_SCAN_NOT (std::ctype_base::upper, cA, cA+5); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, cA, cA+5); - - // 'Z' - VERIFY_SCAN_IS (std::ctype_base::alnum, cZ, cZ); - VERIFY_SCAN_IS (std::ctype_base::alpha, cZ, cZ); - VERIFY_SCAN_IS (std::ctype_base::cntrl, cZ, cZ+5); - VERIFY_SCAN_IS (std::ctype_base::digit, cZ, cZ+5); - VERIFY_SCAN_IS (std::ctype_base::graph, cZ, cZ); - VERIFY_SCAN_IS (std::ctype_base::lower, cZ, cZ+5); - VERIFY_SCAN_IS (std::ctype_base::print, cZ, cZ); - VERIFY_SCAN_IS (std::ctype_base::punct, cZ, cZ+5); - VERIFY_SCAN_IS (std::ctype_base::space, cZ, cZ+5); - VERIFY_SCAN_IS (std::ctype_base::upper, cZ, cZ); - VERIFY_SCAN_IS (std::ctype_base::xdigit, cZ, cZ+5); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, cZ, cZ+5); - VERIFY_SCAN_NOT (std::ctype_base::alpha, cZ, cZ+5); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, cZ, cZ); - VERIFY_SCAN_NOT (std::ctype_base::digit, cZ, cZ); - VERIFY_SCAN_NOT (std::ctype_base::graph, cZ, cZ+5); - VERIFY_SCAN_NOT (std::ctype_base::lower, cZ, cZ); - VERIFY_SCAN_NOT (std::ctype_base::print, cZ, cZ+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, cZ, cZ); - VERIFY_SCAN_NOT (std::ctype_base::space, cZ, cZ); - VERIFY_SCAN_NOT (std::ctype_base::upper, cZ, cZ+5); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, cZ, cZ); - - // '0' - VERIFY_SCAN_IS (std::ctype_base::alnum, c0, c0); - VERIFY_SCAN_IS (std::ctype_base::alpha, c0, c0+5); - VERIFY_SCAN_IS (std::ctype_base::cntrl, c0, c0+5); - VERIFY_SCAN_IS (std::ctype_base::digit, c0, c0); - VERIFY_SCAN_IS (std::ctype_base::graph, c0, c0); - VERIFY_SCAN_IS (std::ctype_base::lower, c0, c0+5); - VERIFY_SCAN_IS (std::ctype_base::print, c0, c0); - VERIFY_SCAN_IS (std::ctype_base::punct, c0, c0+5); - VERIFY_SCAN_IS (std::ctype_base::space, c0, c0+5); - VERIFY_SCAN_IS (std::ctype_base::upper, c0, c0+5); - VERIFY_SCAN_IS (std::ctype_base::xdigit, c0, c0); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, c0, c0+5); - VERIFY_SCAN_NOT (std::ctype_base::alpha, c0, c0); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, c0, c0); - VERIFY_SCAN_NOT (std::ctype_base::digit, c0, c0+5); - VERIFY_SCAN_NOT (std::ctype_base::graph, c0, c0+5); - VERIFY_SCAN_NOT (std::ctype_base::lower, c0, c0); - VERIFY_SCAN_NOT (std::ctype_base::print, c0, c0+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, c0, c0); - VERIFY_SCAN_NOT (std::ctype_base::space, c0, c0); - VERIFY_SCAN_NOT (std::ctype_base::upper, c0, c0); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, c0, c0+5); - - // '9' - VERIFY_SCAN_IS (std::ctype_base::alnum, c9, c9); - VERIFY_SCAN_IS (std::ctype_base::alpha, c9, c9+5); - VERIFY_SCAN_IS (std::ctype_base::cntrl, c9, c9+5); - VERIFY_SCAN_IS (std::ctype_base::digit, c9, c9); - VERIFY_SCAN_IS (std::ctype_base::graph, c9, c9); - VERIFY_SCAN_IS (std::ctype_base::lower, c9, c9+5); - VERIFY_SCAN_IS (std::ctype_base::print, c9, c9); - VERIFY_SCAN_IS (std::ctype_base::punct, c9, c9+5); - VERIFY_SCAN_IS (std::ctype_base::space, c9, c9+5); - VERIFY_SCAN_IS (std::ctype_base::upper, c9, c9+5); - VERIFY_SCAN_IS (std::ctype_base::xdigit, c9, c9); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, c9, c9+5); - VERIFY_SCAN_NOT (std::ctype_base::alpha, c9, c9); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, c9, c9); - VERIFY_SCAN_NOT (std::ctype_base::digit, c9, c9+5); - VERIFY_SCAN_NOT (std::ctype_base::graph, c9, c9+5); - VERIFY_SCAN_NOT (std::ctype_base::lower, c9, c9); - VERIFY_SCAN_NOT (std::ctype_base::print, c9, c9+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, c9, c9); - VERIFY_SCAN_NOT (std::ctype_base::space, c9, c9); - VERIFY_SCAN_NOT (std::ctype_base::upper, c9, c9); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, c9, c9+5); - - // ' ' - VERIFY_SCAN_IS (std::ctype_base::alnum, cs, cs+5); - VERIFY_SCAN_IS (std::ctype_base::alpha, cs, cs+5); - VERIFY_SCAN_IS (std::ctype_base::cntrl, cs, cs+5); - VERIFY_SCAN_IS (std::ctype_base::digit, cs, cs+5); - VERIFY_SCAN_IS (std::ctype_base::graph, cs, cs+5); - VERIFY_SCAN_IS (std::ctype_base::lower, cs, cs+5); - VERIFY_SCAN_IS (std::ctype_base::print, cs, cs); - VERIFY_SCAN_IS (std::ctype_base::punct, cs, cs+5); - VERIFY_SCAN_IS (std::ctype_base::space, cs, cs); - VERIFY_SCAN_IS (std::ctype_base::upper, cs, cs+5); - VERIFY_SCAN_IS (std::ctype_base::xdigit, cs, cs+5); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, cs, cs); - VERIFY_SCAN_NOT (std::ctype_base::alpha, cs, cs); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, cs, cs); - VERIFY_SCAN_NOT (std::ctype_base::digit, cs, cs); - VERIFY_SCAN_NOT (std::ctype_base::graph, cs, cs); - VERIFY_SCAN_NOT (std::ctype_base::lower, cs, cs); - VERIFY_SCAN_NOT (std::ctype_base::print, cs, cs+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, cs, cs); - VERIFY_SCAN_NOT (std::ctype_base::space, cs, cs+5); - VERIFY_SCAN_NOT (std::ctype_base::upper, cs, cs); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, cs, cs); - - // 'f' - VERIFY_SCAN_IS (std::ctype_base::alnum, xf, xf); - VERIFY_SCAN_IS (std::ctype_base::alpha, xf, xf); - VERIFY_SCAN_IS (std::ctype_base::cntrl, xf, xf+5); - VERIFY_SCAN_IS (std::ctype_base::digit, xf, xf+5); - VERIFY_SCAN_IS (std::ctype_base::graph, xf, xf); - VERIFY_SCAN_IS (std::ctype_base::lower, xf, xf); - VERIFY_SCAN_IS (std::ctype_base::print, xf, xf); - VERIFY_SCAN_IS (std::ctype_base::punct, xf, xf+5); - VERIFY_SCAN_IS (std::ctype_base::space, xf, xf+5); - VERIFY_SCAN_IS (std::ctype_base::upper, xf, xf+5); - VERIFY_SCAN_IS (std::ctype_base::xdigit, xf, xf); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, xf, xf+5); - VERIFY_SCAN_NOT (std::ctype_base::alpha, xf, xf+5); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, xf, xf); - VERIFY_SCAN_NOT (std::ctype_base::digit, xf, xf); - VERIFY_SCAN_NOT (std::ctype_base::graph, xf, xf+5); - VERIFY_SCAN_NOT (std::ctype_base::lower, xf, xf+5); - VERIFY_SCAN_NOT (std::ctype_base::print, xf, xf+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, xf, xf); - VERIFY_SCAN_NOT (std::ctype_base::space, xf, xf); - VERIFY_SCAN_NOT (std::ctype_base::upper, xf, xf); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, xf, xf+5); - - // 'F' - VERIFY_SCAN_IS (std::ctype_base::alnum, xF, xF); - VERIFY_SCAN_IS (std::ctype_base::alpha, xF, xF); - VERIFY_SCAN_IS (std::ctype_base::cntrl, xF, xF+5); - VERIFY_SCAN_IS (std::ctype_base::digit, xF, xF+5); - VERIFY_SCAN_IS (std::ctype_base::graph, xF, xF); - VERIFY_SCAN_IS (std::ctype_base::lower, xF, xF+5); - VERIFY_SCAN_IS (std::ctype_base::print, xF, xF); - VERIFY_SCAN_IS (std::ctype_base::punct, xF, xF+5); - VERIFY_SCAN_IS (std::ctype_base::space, xF, xF+5); - VERIFY_SCAN_IS (std::ctype_base::upper, xF, xF); - VERIFY_SCAN_IS (std::ctype_base::xdigit, xF, xF); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, xF, xF+5); - VERIFY_SCAN_NOT (std::ctype_base::alpha, xF, xF+5); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, xF, xF); - VERIFY_SCAN_NOT (std::ctype_base::digit, xF, xF); - VERIFY_SCAN_NOT (std::ctype_base::graph, xF, xF+5); - VERIFY_SCAN_NOT (std::ctype_base::lower, xF, xF); - VERIFY_SCAN_NOT (std::ctype_base::print, xF, xF+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, xF, xF); - VERIFY_SCAN_NOT (std::ctype_base::space, xF, xF); - VERIFY_SCAN_NOT (std::ctype_base::upper, xF, xF+5); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, xF, xF+5); - - // '!' - VERIFY_SCAN_IS (std::ctype_base::alnum, p1, p1+5); - VERIFY_SCAN_IS (std::ctype_base::alpha, p1, p1+5); - VERIFY_SCAN_IS (std::ctype_base::cntrl, p1, p1+5); - VERIFY_SCAN_IS (std::ctype_base::digit, p1, p1+5); - VERIFY_SCAN_IS (std::ctype_base::graph, p1, p1); - VERIFY_SCAN_IS (std::ctype_base::lower, p1, p1+5); - VERIFY_SCAN_IS (std::ctype_base::print, p1, p1); - VERIFY_SCAN_IS (std::ctype_base::punct, p1, p1); - VERIFY_SCAN_IS (std::ctype_base::space, p1, p1+5); - VERIFY_SCAN_IS (std::ctype_base::upper, p1, p1+5); - VERIFY_SCAN_IS (std::ctype_base::xdigit, p1, p1+5); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, p1, p1); - VERIFY_SCAN_NOT (std::ctype_base::alpha, p1, p1); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, p1, p1); - VERIFY_SCAN_NOT (std::ctype_base::digit, p1, p1); - VERIFY_SCAN_NOT (std::ctype_base::lower, p1, p1); - VERIFY_SCAN_NOT (std::ctype_base::print, p1, p1+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, p1, p1+5); - VERIFY_SCAN_NOT (std::ctype_base::space, p1, p1); - VERIFY_SCAN_NOT (std::ctype_base::upper, p1, p1); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, p1, p1); - - // '/' - VERIFY_SCAN_IS (std::ctype_base::alnum, p2, p2+5); - VERIFY_SCAN_IS (std::ctype_base::alpha, p2, p2+5); - VERIFY_SCAN_IS (std::ctype_base::cntrl, p2, p2+5); - VERIFY_SCAN_IS (std::ctype_base::digit, p2, p2+5); - VERIFY_SCAN_IS (std::ctype_base::graph, p2, p2); - VERIFY_SCAN_IS (std::ctype_base::lower, p2, p2+5); - VERIFY_SCAN_IS (std::ctype_base::print, p2, p2); - VERIFY_SCAN_IS (std::ctype_base::punct, p2, p2); - VERIFY_SCAN_IS (std::ctype_base::space, p2, p2+5); - VERIFY_SCAN_IS (std::ctype_base::upper, p2, p2+5); - VERIFY_SCAN_IS (std::ctype_base::xdigit, p2, p2+5); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, p2, p2); - VERIFY_SCAN_NOT (std::ctype_base::alpha, p2, p2); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, p2, p2); - VERIFY_SCAN_NOT (std::ctype_base::digit, p2, p2); - VERIFY_SCAN_NOT (std::ctype_base::graph, p2, p2+5); - VERIFY_SCAN_NOT (std::ctype_base::lower, p2, p2); - VERIFY_SCAN_NOT (std::ctype_base::print, p2, p2+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, p2, p2+5); - VERIFY_SCAN_NOT (std::ctype_base::space, p2, p2); - VERIFY_SCAN_NOT (std::ctype_base::upper, p2, p2); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, p2, p2); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/scan/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/scan/char/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/scan/char/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/scan/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/scan/char/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/scan/char/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/scan/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/ctype/scan/wchar_t/1.cc deleted file mode 100644 index 7af4fae26b2..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/scan/wchar_t/1.cc +++ /dev/null @@ -1,352 +0,0 @@ -// 2002-05-10 ghazi - -// Copyright (C) 2002 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. - -// { dg-do run } - -#include <locale> -#include <testsuite_hooks.h> - -typedef wchar_t char_type; -typedef std::char_traits<char_type> traits_type; -class gnu_ctype: public std::ctype<char_type> { }; - -// These two macros take a ctype mask, a string and a pointer within -// the string that the scan function should return, usually either the -// first or last character if the string contains identical values as -// below. -#define VERIFY_SCAN_IS(MASK, STRING, EXPECTED) \ - VERIFY(gctype.scan_is((MASK), (STRING), \ - (STRING) + traits_type::length(STRING)) == (EXPECTED)) -#define VERIFY_SCAN_NOT(MASK, STRING, EXPECTED) \ - VERIFY(gctype.scan_not((MASK), (STRING), \ - (STRING) + traits_type::length(STRING)) == (EXPECTED)) - -#ifdef _GLIBCPP_USE_WCHAR_T -// Sanity check scan_is() and scan_not(). -void test01() -{ - bool test = true; - - const char_type *const ca = L"aaaaa"; - const char_type *const cz = L"zzzzz"; - const char_type *const cA = L"AAAAA"; - const char_type *const cZ = L"ZZZZZ"; - const char_type *const c0 = L"00000"; - const char_type *const c9 = L"99999"; - const char_type *const cs = L" "; - const char_type *const xf = L"fffff"; - const char_type *const xF = L"FFFFF"; - const char_type *const p1 = L"!!!!!"; - const char_type *const p2 = L"/////"; - - gnu_ctype gctype; - - // 'a' - VERIFY_SCAN_IS (std::ctype_base::alnum, ca, ca); - VERIFY_SCAN_IS (std::ctype_base::alpha, ca, ca); - VERIFY_SCAN_IS (std::ctype_base::cntrl, ca, ca+5); - VERIFY_SCAN_IS (std::ctype_base::digit, ca, ca+5); - VERIFY_SCAN_IS (std::ctype_base::graph, ca, ca); - VERIFY_SCAN_IS (std::ctype_base::lower, ca, ca); - VERIFY_SCAN_IS (std::ctype_base::print, ca, ca); - VERIFY_SCAN_IS (std::ctype_base::punct, ca, ca+5); - VERIFY_SCAN_IS (std::ctype_base::space, ca, ca+5); - VERIFY_SCAN_IS (std::ctype_base::upper, ca, ca+5); - VERIFY_SCAN_IS (std::ctype_base::xdigit, ca, ca); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, ca, ca+5); - VERIFY_SCAN_NOT (std::ctype_base::alpha, ca, ca+5); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, ca, ca); - VERIFY_SCAN_NOT (std::ctype_base::digit, ca, ca); - VERIFY_SCAN_NOT (std::ctype_base::graph, ca, ca+5); - VERIFY_SCAN_NOT (std::ctype_base::lower, ca, ca+5); - VERIFY_SCAN_NOT (std::ctype_base::print, ca, ca+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, ca, ca); - VERIFY_SCAN_NOT (std::ctype_base::space, ca, ca); - VERIFY_SCAN_NOT (std::ctype_base::upper, ca, ca); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, ca, ca+5); - - // 'z' - VERIFY_SCAN_IS (std::ctype_base::alnum, cz, cz); - VERIFY_SCAN_IS (std::ctype_base::alpha, cz, cz); - VERIFY_SCAN_IS (std::ctype_base::cntrl, cz, cz+5); - VERIFY_SCAN_IS (std::ctype_base::digit, cz, cz+5); - VERIFY_SCAN_IS (std::ctype_base::graph, cz, cz); - VERIFY_SCAN_IS (std::ctype_base::lower, cz, cz); - VERIFY_SCAN_IS (std::ctype_base::print, cz, cz); - VERIFY_SCAN_IS (std::ctype_base::punct, cz, cz+5); - VERIFY_SCAN_IS (std::ctype_base::space, cz, cz+5); - VERIFY_SCAN_IS (std::ctype_base::upper, cz, cz+5); - VERIFY_SCAN_IS (std::ctype_base::xdigit, cz, cz+5); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, cz, cz+5); - VERIFY_SCAN_NOT (std::ctype_base::alpha, cz, cz+5); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, cz, cz); - VERIFY_SCAN_NOT (std::ctype_base::digit, cz, cz); - VERIFY_SCAN_NOT (std::ctype_base::graph, cz, cz+5); - VERIFY_SCAN_NOT (std::ctype_base::lower, cz, cz+5); - VERIFY_SCAN_NOT (std::ctype_base::print, cz, cz+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, cz, cz); - VERIFY_SCAN_NOT (std::ctype_base::space, cz, cz); - VERIFY_SCAN_NOT (std::ctype_base::upper, cz, cz); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, cz, cz); - - // 'A' - VERIFY_SCAN_IS (std::ctype_base::alnum, cA, cA); - VERIFY_SCAN_IS (std::ctype_base::alpha, cA, cA); - VERIFY_SCAN_IS (std::ctype_base::cntrl, cA, cA+5); - VERIFY_SCAN_IS (std::ctype_base::digit, cA, cA+5); - VERIFY_SCAN_IS (std::ctype_base::graph, cA, cA); - VERIFY_SCAN_IS (std::ctype_base::lower, cA, cA+5); - VERIFY_SCAN_IS (std::ctype_base::print, cA, cA); - VERIFY_SCAN_IS (std::ctype_base::punct, cA, cA+5); - VERIFY_SCAN_IS (std::ctype_base::space, cA, cA+5); - VERIFY_SCAN_IS (std::ctype_base::upper, cA, cA); - VERIFY_SCAN_IS (std::ctype_base::xdigit, cA, cA); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, cA, cA+5); - VERIFY_SCAN_NOT (std::ctype_base::alpha, cA, cA+5); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, cA, cA); - VERIFY_SCAN_NOT (std::ctype_base::digit, cA, cA); - VERIFY_SCAN_NOT (std::ctype_base::graph, cA, cA+5); - VERIFY_SCAN_NOT (std::ctype_base::lower, cA, cA); - VERIFY_SCAN_NOT (std::ctype_base::print, cA, cA+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, cA, cA); - VERIFY_SCAN_NOT (std::ctype_base::space, cA, cA); - VERIFY_SCAN_NOT (std::ctype_base::upper, cA, cA+5); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, cA, cA+5); - - // 'Z' - VERIFY_SCAN_IS (std::ctype_base::alnum, cZ, cZ); - VERIFY_SCAN_IS (std::ctype_base::alpha, cZ, cZ); - VERIFY_SCAN_IS (std::ctype_base::cntrl, cZ, cZ+5); - VERIFY_SCAN_IS (std::ctype_base::digit, cZ, cZ+5); - VERIFY_SCAN_IS (std::ctype_base::graph, cZ, cZ); - VERIFY_SCAN_IS (std::ctype_base::lower, cZ, cZ+5); - VERIFY_SCAN_IS (std::ctype_base::print, cZ, cZ); - VERIFY_SCAN_IS (std::ctype_base::punct, cZ, cZ+5); - VERIFY_SCAN_IS (std::ctype_base::space, cZ, cZ+5); - VERIFY_SCAN_IS (std::ctype_base::upper, cZ, cZ); - VERIFY_SCAN_IS (std::ctype_base::xdigit, cZ, cZ+5); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, cZ, cZ+5); - VERIFY_SCAN_NOT (std::ctype_base::alpha, cZ, cZ+5); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, cZ, cZ); - VERIFY_SCAN_NOT (std::ctype_base::digit, cZ, cZ); - VERIFY_SCAN_NOT (std::ctype_base::graph, cZ, cZ+5); - VERIFY_SCAN_NOT (std::ctype_base::lower, cZ, cZ); - VERIFY_SCAN_NOT (std::ctype_base::print, cZ, cZ+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, cZ, cZ); - VERIFY_SCAN_NOT (std::ctype_base::space, cZ, cZ); - VERIFY_SCAN_NOT (std::ctype_base::upper, cZ, cZ+5); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, cZ, cZ); - - // '0' - VERIFY_SCAN_IS (std::ctype_base::alnum, c0, c0); - VERIFY_SCAN_IS (std::ctype_base::alpha, c0, c0+5); - VERIFY_SCAN_IS (std::ctype_base::cntrl, c0, c0+5); - VERIFY_SCAN_IS (std::ctype_base::digit, c0, c0); - VERIFY_SCAN_IS (std::ctype_base::graph, c0, c0); - VERIFY_SCAN_IS (std::ctype_base::lower, c0, c0+5); - VERIFY_SCAN_IS (std::ctype_base::print, c0, c0); - VERIFY_SCAN_IS (std::ctype_base::punct, c0, c0+5); - VERIFY_SCAN_IS (std::ctype_base::space, c0, c0+5); - VERIFY_SCAN_IS (std::ctype_base::upper, c0, c0+5); - VERIFY_SCAN_IS (std::ctype_base::xdigit, c0, c0); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, c0, c0+5); - VERIFY_SCAN_NOT (std::ctype_base::alpha, c0, c0); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, c0, c0); - VERIFY_SCAN_NOT (std::ctype_base::digit, c0, c0+5); - VERIFY_SCAN_NOT (std::ctype_base::graph, c0, c0+5); - VERIFY_SCAN_NOT (std::ctype_base::lower, c0, c0); - VERIFY_SCAN_NOT (std::ctype_base::print, c0, c0+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, c0, c0); - VERIFY_SCAN_NOT (std::ctype_base::space, c0, c0); - VERIFY_SCAN_NOT (std::ctype_base::upper, c0, c0); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, c0, c0+5); - - // '9' - VERIFY_SCAN_IS (std::ctype_base::alnum, c9, c9); - VERIFY_SCAN_IS (std::ctype_base::alpha, c9, c9+5); - VERIFY_SCAN_IS (std::ctype_base::cntrl, c9, c9+5); - VERIFY_SCAN_IS (std::ctype_base::digit, c9, c9); - VERIFY_SCAN_IS (std::ctype_base::graph, c9, c9); - VERIFY_SCAN_IS (std::ctype_base::lower, c9, c9+5); - VERIFY_SCAN_IS (std::ctype_base::print, c9, c9); - VERIFY_SCAN_IS (std::ctype_base::punct, c9, c9+5); - VERIFY_SCAN_IS (std::ctype_base::space, c9, c9+5); - VERIFY_SCAN_IS (std::ctype_base::upper, c9, c9+5); - VERIFY_SCAN_IS (std::ctype_base::xdigit, c9, c9); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, c9, c9+5); - VERIFY_SCAN_NOT (std::ctype_base::alpha, c9, c9); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, c9, c9); - VERIFY_SCAN_NOT (std::ctype_base::digit, c9, c9+5); - VERIFY_SCAN_NOT (std::ctype_base::graph, c9, c9+5); - VERIFY_SCAN_NOT (std::ctype_base::lower, c9, c9); - VERIFY_SCAN_NOT (std::ctype_base::print, c9, c9+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, c9, c9); - VERIFY_SCAN_NOT (std::ctype_base::space, c9, c9); - VERIFY_SCAN_NOT (std::ctype_base::upper, c9, c9); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, c9, c9+5); - - // ' ' - VERIFY_SCAN_IS (std::ctype_base::alnum, cs, cs+5); - VERIFY_SCAN_IS (std::ctype_base::alpha, cs, cs+5); - VERIFY_SCAN_IS (std::ctype_base::cntrl, cs, cs+5); - VERIFY_SCAN_IS (std::ctype_base::digit, cs, cs+5); - VERIFY_SCAN_IS (std::ctype_base::graph, cs, cs+5); - VERIFY_SCAN_IS (std::ctype_base::lower, cs, cs+5); - VERIFY_SCAN_IS (std::ctype_base::print, cs, cs); - VERIFY_SCAN_IS (std::ctype_base::punct, cs, cs+5); - VERIFY_SCAN_IS (std::ctype_base::space, cs, cs); - VERIFY_SCAN_IS (std::ctype_base::upper, cs, cs+5); - VERIFY_SCAN_IS (std::ctype_base::xdigit, cs, cs+5); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, cs, cs); - VERIFY_SCAN_NOT (std::ctype_base::alpha, cs, cs); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, cs, cs); - VERIFY_SCAN_NOT (std::ctype_base::digit, cs, cs); - VERIFY_SCAN_NOT (std::ctype_base::graph, cs, cs); - VERIFY_SCAN_NOT (std::ctype_base::lower, cs, cs); - VERIFY_SCAN_NOT (std::ctype_base::print, cs, cs+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, cs, cs); - VERIFY_SCAN_NOT (std::ctype_base::space, cs, cs+5); - VERIFY_SCAN_NOT (std::ctype_base::upper, cs, cs); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, cs, cs); - - // 'f' - VERIFY_SCAN_IS (std::ctype_base::alnum, xf, xf); - VERIFY_SCAN_IS (std::ctype_base::alpha, xf, xf); - VERIFY_SCAN_IS (std::ctype_base::cntrl, xf, xf+5); - VERIFY_SCAN_IS (std::ctype_base::digit, xf, xf+5); - VERIFY_SCAN_IS (std::ctype_base::graph, xf, xf); - VERIFY_SCAN_IS (std::ctype_base::lower, xf, xf); - VERIFY_SCAN_IS (std::ctype_base::print, xf, xf); - VERIFY_SCAN_IS (std::ctype_base::punct, xf, xf+5); - VERIFY_SCAN_IS (std::ctype_base::space, xf, xf+5); - VERIFY_SCAN_IS (std::ctype_base::upper, xf, xf+5); - VERIFY_SCAN_IS (std::ctype_base::xdigit, xf, xf); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, xf, xf+5); - VERIFY_SCAN_NOT (std::ctype_base::alpha, xf, xf+5); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, xf, xf); - VERIFY_SCAN_NOT (std::ctype_base::digit, xf, xf); - VERIFY_SCAN_NOT (std::ctype_base::graph, xf, xf+5); - VERIFY_SCAN_NOT (std::ctype_base::lower, xf, xf+5); - VERIFY_SCAN_NOT (std::ctype_base::print, xf, xf+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, xf, xf); - VERIFY_SCAN_NOT (std::ctype_base::space, xf, xf); - VERIFY_SCAN_NOT (std::ctype_base::upper, xf, xf); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, xf, xf+5); - - // 'F' - VERIFY_SCAN_IS (std::ctype_base::alnum, xF, xF); - VERIFY_SCAN_IS (std::ctype_base::alpha, xF, xF); - VERIFY_SCAN_IS (std::ctype_base::cntrl, xF, xF+5); - VERIFY_SCAN_IS (std::ctype_base::digit, xF, xF+5); - VERIFY_SCAN_IS (std::ctype_base::graph, xF, xF); - VERIFY_SCAN_IS (std::ctype_base::lower, xF, xF+5); - VERIFY_SCAN_IS (std::ctype_base::print, xF, xF); - VERIFY_SCAN_IS (std::ctype_base::punct, xF, xF+5); - VERIFY_SCAN_IS (std::ctype_base::space, xF, xF+5); - VERIFY_SCAN_IS (std::ctype_base::upper, xF, xF); - VERIFY_SCAN_IS (std::ctype_base::xdigit, xF, xF); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, xF, xF+5); - VERIFY_SCAN_NOT (std::ctype_base::alpha, xF, xF+5); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, xF, xF); - VERIFY_SCAN_NOT (std::ctype_base::digit, xF, xF); - VERIFY_SCAN_NOT (std::ctype_base::graph, xF, xF+5); - VERIFY_SCAN_NOT (std::ctype_base::lower, xF, xF); - VERIFY_SCAN_NOT (std::ctype_base::print, xF, xF+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, xF, xF); - VERIFY_SCAN_NOT (std::ctype_base::space, xF, xF); - VERIFY_SCAN_NOT (std::ctype_base::upper, xF, xF+5); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, xF, xF+5); - - // '!' - VERIFY_SCAN_IS (std::ctype_base::alnum, p1, p1+5); - VERIFY_SCAN_IS (std::ctype_base::alpha, p1, p1+5); - VERIFY_SCAN_IS (std::ctype_base::cntrl, p1, p1+5); - VERIFY_SCAN_IS (std::ctype_base::digit, p1, p1+5); - VERIFY_SCAN_IS (std::ctype_base::graph, p1, p1); - VERIFY_SCAN_IS (std::ctype_base::lower, p1, p1+5); - VERIFY_SCAN_IS (std::ctype_base::print, p1, p1); - VERIFY_SCAN_IS (std::ctype_base::punct, p1, p1); - VERIFY_SCAN_IS (std::ctype_base::space, p1, p1+5); - VERIFY_SCAN_IS (std::ctype_base::upper, p1, p1+5); - VERIFY_SCAN_IS (std::ctype_base::xdigit, p1, p1+5); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, p1, p1); - VERIFY_SCAN_NOT (std::ctype_base::alpha, p1, p1); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, p1, p1); - VERIFY_SCAN_NOT (std::ctype_base::digit, p1, p1); - VERIFY_SCAN_NOT (std::ctype_base::lower, p1, p1); - VERIFY_SCAN_NOT (std::ctype_base::print, p1, p1+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, p1, p1+5); - VERIFY_SCAN_NOT (std::ctype_base::space, p1, p1); - VERIFY_SCAN_NOT (std::ctype_base::upper, p1, p1); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, p1, p1); - - // '/' - VERIFY_SCAN_IS (std::ctype_base::alnum, p2, p2+5); - VERIFY_SCAN_IS (std::ctype_base::alpha, p2, p2+5); - VERIFY_SCAN_IS (std::ctype_base::cntrl, p2, p2+5); - VERIFY_SCAN_IS (std::ctype_base::digit, p2, p2+5); - VERIFY_SCAN_IS (std::ctype_base::graph, p2, p2); - VERIFY_SCAN_IS (std::ctype_base::lower, p2, p2+5); - VERIFY_SCAN_IS (std::ctype_base::print, p2, p2); - VERIFY_SCAN_IS (std::ctype_base::punct, p2, p2); - VERIFY_SCAN_IS (std::ctype_base::space, p2, p2+5); - VERIFY_SCAN_IS (std::ctype_base::upper, p2, p2+5); - VERIFY_SCAN_IS (std::ctype_base::xdigit, p2, p2+5); - - VERIFY_SCAN_NOT (std::ctype_base::alnum, p2, p2); - VERIFY_SCAN_NOT (std::ctype_base::alpha, p2, p2); - VERIFY_SCAN_NOT (std::ctype_base::cntrl, p2, p2); - VERIFY_SCAN_NOT (std::ctype_base::digit, p2, p2); - VERIFY_SCAN_NOT (std::ctype_base::graph, p2, p2+5); - VERIFY_SCAN_NOT (std::ctype_base::lower, p2, p2); - VERIFY_SCAN_NOT (std::ctype_base::print, p2, p2+5); - VERIFY_SCAN_NOT (std::ctype_base::punct, p2, p2+5); - VERIFY_SCAN_NOT (std::ctype_base::space, p2, p2); - VERIFY_SCAN_NOT (std::ctype_base::upper, p2, p2); - VERIFY_SCAN_NOT (std::ctype_base::xdigit, p2, p2); -} -#endif - -int main() -{ -#ifdef _GLIBCPP_USE_WCHAR_T - test01(); -#endif - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/scan/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/scan/wchar_t/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/scan/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/scan/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/scan/wchar_t/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/scan/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/to/char/1.cc b/libstdc++-v3/testsuite/22_locale/ctype/to/char/1.cc deleted file mode 100644 index a337d8e5ed4..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/to/char/1.cc +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (C) 2000, 2001, 2002, 2003 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. - -// 22.2.1.3.2 ctype<char> members - -#include <locale> -#include <testsuite_hooks.h> - -typedef char char_type; -class gnu_ctype: public std::ctype<char_type> { }; - -void test01() -{ - bool test = true; - const char_type strlit00[] = "manilla, cebu, tandag PHILIPPINES"; - const char_type strlit01[] = "MANILLA, CEBU, TANDAG PHILIPPINES"; - const char_type strlit02[] = "manilla, cebu, tandag philippines"; - const char_type c00 = 'S'; - const char_type c10 = 's'; - const char_type c20 = '9'; - const char_type c30 = ' '; - const char_type c40 = '!'; - const char_type c50 = 'F'; - const char_type c60 = 'f'; - const char_type c70 = 'X'; - const char_type c80 = 'x'; - - gnu_ctype gctype; - char_type c100; - int len = std::char_traits<char_type>::length(strlit00); - char_type c_array[len + 1]; - - // sanity check ctype_base::mask members - int i01 = std::ctype_base::space; - int i02 = std::ctype_base::upper; - int i03 = std::ctype_base::lower; - int i04 = std::ctype_base::digit; - int i05 = std::ctype_base::punct; - int i06 = std::ctype_base::alpha; - int i07 = std::ctype_base::xdigit; - int i08 = std::ctype_base::alnum; - int i09 = std::ctype_base::graph; - int i10 = std::ctype_base::print; - int i11 = std::ctype_base::cntrl; - int i12 = sizeof(std::ctype_base::mask); - VERIFY ( i01 != i02); - VERIFY ( i02 != i03); - VERIFY ( i03 != i04); - VERIFY ( i04 != i05); - VERIFY ( i05 != i06); - VERIFY ( i06 != i07); - VERIFY ( i07 != i08); - VERIFY ( i08 != i09); - VERIFY ( i09 != i10); - VERIFY ( i10 != i11); - VERIFY ( i11 != i01); - - // char_type toupper(char_type c) const - c100 = gctype.toupper(c10); - VERIFY( c100 == c00 ); - - // char_type tolower(char_type c) const - c100 = gctype.tolower(c00); - VERIFY( c100 == c10 ); - - // char_type toupper(char_type* low, const char_type* hi) const - std::char_traits<char_type>::copy(c_array, strlit02, len + 1); - gctype.toupper(c_array, c_array + len); - VERIFY( !std::char_traits<char_type>::compare(c_array, strlit01, len - 1) ); - - // char_type tolower(char_type* low, const char_type* hi) const - std::char_traits<char_type>::copy(c_array, strlit01, len + 1); - gctype.tolower(c_array, c_array + len); - VERIFY( !std::char_traits<char_type>::compare(c_array, strlit02, len - 1) ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/to/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/to/char/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/to/char/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/to/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/to/char/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/to/char/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/1.cc deleted file mode 100644 index 9f042abc438..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/1.cc +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (C) 2000, 2001, 2002, 2003 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. - -// 22.2.1.3.2 ctype<char> members - -#include <locale> -#include <testsuite_hooks.h> - -typedef wchar_t char_type; -class gnu_ctype: public std::ctype<char_type> { }; - -void test01() -{ - bool test = true; - const char_type strlit00[] = L"manilla, cebu, tandag PHILIPPINES"; - const char_type strlit01[] = L"MANILLA, CEBU, TANDAG PHILIPPINES"; - const char_type strlit02[] = L"manilla, cebu, tandag philippines"; - const char_type c00 = L'S'; - const char_type c10 = L's'; - const char_type c20 = L'9'; - const char_type c30 = L' '; - const char_type c40 = L'!'; - const char_type c50 = L'F'; - const char_type c60 = L'f'; - const char_type c70 = L'X'; - const char_type c80 = L'x'; - - gnu_ctype gctype; - char_type c100; - int len = std::char_traits<char_type>::length(strlit00); - char_type c_array[len + 1]; - - // sanity check ctype_base::mask members - int i01 = std::ctype_base::space; - int i02 = std::ctype_base::upper; - int i03 = std::ctype_base::lower; - int i04 = std::ctype_base::digit; - int i05 = std::ctype_base::punct; - int i06 = std::ctype_base::alpha; - int i07 = std::ctype_base::xdigit; - int i08 = std::ctype_base::alnum; - int i09 = std::ctype_base::graph; - int i10 = std::ctype_base::print; - int i11 = std::ctype_base::cntrl; - int i12 = sizeof(std::ctype_base::mask); - VERIFY ( i01 != i02); - VERIFY ( i02 != i03); - VERIFY ( i03 != i04); - VERIFY ( i04 != i05); - VERIFY ( i05 != i06); - VERIFY ( i06 != i07); - VERIFY ( i07 != i08); - VERIFY ( i08 != i09); - VERIFY ( i09 != i10); - VERIFY ( i10 != i11); - VERIFY ( i11 != i01); - - // char_type toupper(char_type c) const - c100 = gctype.toupper(c10); - VERIFY( c100 == c00 ); - - // char_type tolower(char_type c) const - c100 = gctype.tolower(c00); - VERIFY( c100 == c10 ); - - // char_type toupper(char_type* low, const char_type* hi) const - std::char_traits<char_type>::copy(c_array, strlit02, len + 1); - gctype.toupper(c_array, c_array + len); - VERIFY( !std::char_traits<char_type>::compare(c_array, strlit01, len - 1) ); - - // char_type tolower(char_type* low, const char_type* hi) const - std::char_traits<char_type>::copy(c_array, strlit01, len + 1); - gctype.tolower(c_array, c_array + len); - VERIFY( !std::char_traits<char_type>::compare(c_array, strlit02, len - 1) ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/widen/char/1.cc b/libstdc++-v3/testsuite/22_locale/ctype/widen/char/1.cc deleted file mode 100644 index ea206059bfb..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/widen/char/1.cc +++ /dev/null @@ -1,67 +0,0 @@ -// 2002-05-24 bkoz - -// Copyright (C) 2002 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. - -// 22.2.1.3.2 ctype<char> members - -#include <locale> -#include <vector> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef char wide_type; - - bool test = true; - const char dfault = '?'; - const locale loc_c = locale::classic(); - const ctype<wide_type>& ctype_c = use_facet<ctype<wide_type> >(loc_c); - - basic_string<wide_type> wide("drusilla, louvinia, bayard"); - basic_string<char> narrow("drusilla, louvinia, bayard"); - vector<wide_type> wide_chars(narrow.length() + 1); - - // widen(char c) const - for (int i = 0; i < narrow.length(); ++i) - { - char c = ctype_c.widen(narrow[i]); - VERIFY( c == wide[i] ); - } - - // widen(const char* low, const char* high, charT* dest) const - ctype_c.widen(&narrow[0], &narrow[narrow.length()], &wide_chars[0]); - for (int i = 0; i < narrow.length(); ++i) - VERIFY( wide_chars[i] == wide[i] ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/widen/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/widen/char/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/widen/char/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/widen/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/widen/char/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/widen/char/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/1.cc deleted file mode 100644 index e0b33155bb9..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/1.cc +++ /dev/null @@ -1,67 +0,0 @@ -// 2002-05-24 bkoz - -// Copyright (C) 2002, 2003 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. - -// 22.2.1.3.2 ctype<char> members - -#include <locale> -#include <vector> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef wchar_t wide_type; - - bool test = true; - const char dfault = '?'; - const locale loc_c = locale::classic(); - const ctype<wide_type>& ctype_c = use_facet<ctype<wide_type> >(loc_c); - - basic_string<wide_type> wide(L"drusilla, louvinia, bayard"); - basic_string<char> narrow("drusilla, louvinia, bayard"); - vector<wide_type> wide_chars(narrow.length() + 1); - - // widen(char c) const - for (int i = 0; i < narrow.length(); ++i) - { - char c = ctype_c.widen(narrow[i]); - VERIFY( c == wide[i] ); - } - - // widen(const char* low, const char* high, charT* dest) const - ctype_c.widen(&narrow[0], &narrow[narrow.length()], &wide_chars[0]); - for (int i = 0; i < narrow.length(); ++i) - VERIFY( wide_chars[i] == wide[i] ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/2.cc deleted file mode 100644 index e4e49676c5b..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/2.cc +++ /dev/null @@ -1,54 +0,0 @@ -// 2003-03-12 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 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. - -// 22.2.1.3.2 ctype<wchar_t> members - -#include <locale> -#include <testsuite_hooks.h> - -// libstdc++/9870 -void test02() -{ - using namespace std; - bool test = true; - - locale loc ("en_US.ISO-8859-1"); - const ctype<wchar_t>& wct = use_facet<ctype<wchar_t> >(loc); - - char c = 0xff; - wchar_t wc = wct.widen(c); - - VERIFY( wc == static_cast<wchar_t>(0xff) ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/3.cc deleted file mode 100644 index e872a944b85..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/3.cc +++ /dev/null @@ -1,57 +0,0 @@ -// 2003-03-12 Petur Runolfsson <peturr02@ru.is> - -// Copyright (C) 2003 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. - -// 22.2.1.3.2 ctype<wchar_t> members - -#include <locale> -#include <testsuite_hooks.h> - -// libstdc++/9581 -void test03() -{ - using namespace std; - bool test = true; - - locale loc ("se_NO.UTF-8"); - const ctype<wchar_t>& wct = use_facet<ctype<wchar_t> >(loc); - - const char* strlit = "\xc2\x80"; - - wchar_t wbuf[3]; - wct.widen(strlit, strlit + 3, wbuf); - VERIFY( wbuf[0] == wct.widen(strlit[0]) ); - VERIFY( wbuf[1] == wct.widen(strlit[1]) ); - VERIFY( wbuf[2] == wct.widen(strlit[2]) ); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/ctype/widen/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/facet/1.cc b/libstdc++-v3/testsuite/22_locale/facet/1.cc deleted file mode 100644 index f93265bd7d1..00000000000 --- a/libstdc++-v3/testsuite/22_locale/facet/1.cc +++ /dev/null @@ -1,241 +0,0 @@ -// 2000-08-31 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.1.1.1.2 - class locale::facet [lib.locale.facet] - -#include <cwchar> // for mbstate_t -#include <locale> -#include <stdexcept> -#include <string> -#include <iterator> -#include <limits> -#include <testsuite_hooks.h> - -// 1 a class if a facet if it is publicly derived from another facet -typedef std::istreambuf_iterator<char> input_iterator; -typedef std::ostreambuf_iterator<char> output_iterator; - -class gnu_collate: public std::collate<char> { }; -class gnu_ctype: public std::ctype<char> { }; -class gnu_codecvt: public std::codecvt<char, char, std::mbstate_t> { }; -class gnu_moneypunct: public std::moneypunct<char> { }; -class gnu_moneypunct_true: public std::moneypunct<char, true> { }; -class gnu_money_get: public std::money_get<char> { }; -class gnu_money_put: public std::money_put<char> { }; -class gnu_numpunct: public std::numpunct<char> { }; -class gnu_num_get: public std::num_get<char> { }; -class gnu_num_put: public std::num_put<char> { }; -class gnu_time_get: public std::time_get<char> { }; -class gnu_time_put: public std::time_put<char> { }; -class gnu_messages: public std::messages<char> { }; - -class gnu_collate_byname: public std::collate_byname<char> -{ -public: - explicit - gnu_collate_byname(const char* c, size_t refs = 0) - : std::collate_byname<char>(c, refs) { } -}; - -class gnu_ctype_byname: public std::ctype_byname<char> -{ -public: - explicit - gnu_ctype_byname(const char* c, size_t refs = 0) - : std::ctype_byname<char>(c, refs) { } -}; - -class gnu_moneypunct_byname_true: public std::moneypunct_byname<char, true> -{ -public: - explicit - gnu_moneypunct_byname_true(const char* c, size_t refs = 0) - : std::moneypunct_byname<char, true>(c, refs) { } -}; - -class gnu_moneypunct_byname_false: public std::moneypunct_byname<char, false> -{ -public: - explicit - gnu_moneypunct_byname_false(const char* c, size_t refs = 0) - : std::moneypunct_byname<char, false>(c, refs) { } -}; - - -class gnu_money_get_in: public std::money_get<char, input_iterator> -{ -public: - explicit - gnu_money_get_in(size_t refs = 0) - : std::money_get<char, input_iterator>(refs) { } -}; - -class gnu_money_put_out: public std::money_put<char, output_iterator> -{ -public: - explicit - gnu_money_put_out(size_t refs = 0) - : std::money_put<char, output_iterator>(refs) { } -}; - -class gnu_numpunct_byname: public std::numpunct_byname<char> -{ -public: - explicit - gnu_numpunct_byname(const char* c, size_t refs = 0) - : std::numpunct_byname<char>(c, refs) { } -}; - -class gnu_num_get_in: public std::num_get<char, input_iterator> -{ -public: - explicit - gnu_num_get_in(size_t refs = 0) - : std::num_get<char, input_iterator>(refs) { } -}; - -class gnu_num_put_out: public std::num_put<char, output_iterator> -{ -public: - explicit - gnu_num_put_out(size_t refs = 0) - : std::num_put<char, output_iterator>(refs) { } -}; - -class gnu_time_get_byname: public std::time_get_byname<char> -{ -public: - explicit - gnu_time_get_byname(const char* c, size_t refs = 0) - : std::time_get_byname<char>(c, refs) { } -}; - -class gnu_time_get_in: public std::time_get<char, input_iterator> -{ -public: - explicit - gnu_time_get_in(size_t refs = 0) - : std::time_get<char, input_iterator>(refs) { } -}; - -class gnu_time_put_byname: public std::time_put_byname<char> -{ -public: - explicit - gnu_time_put_byname(const char* c, size_t refs = 0) - : std::time_put_byname<char>(c, refs) { } -}; - -class gnu_time_put_out: public std::time_put<char, output_iterator> -{ -public: - explicit - gnu_time_put_out(size_t refs = 0) - : std::time_put<char, output_iterator>(refs) { } -}; - -class gnu_messages_byname: public std::messages_byname<char> -{ -public: - explicit - gnu_messages_byname(const char* c, size_t refs = 0) - : std::messages_byname<char>(c, refs) { } -}; - - -// 2 or if it is a class derived from locale:;facet and containing a -// publicly-accessible declaration as follows: -class gnu_facet: public std::locale::facet -{ -public: - static std::locale::id id; -}; - -std::locale::id gnu_facet::id; - -void test01() -{ - bool test = true; - const std::string name_no("*"); - const std::string name_c("C"); - - try - { - gnu_collate obj01; - gnu_ctype obj02; - gnu_codecvt obj03; - gnu_moneypunct obj04; - gnu_moneypunct_true obj05; - gnu_money_get obj06; - gnu_money_put obj07; - gnu_numpunct obj08; - gnu_num_get obj09; - gnu_num_put obj10; - gnu_time_get obj11; - gnu_time_put obj12; - gnu_messages obj13; - gnu_time_put_out obj14(0); - gnu_time_put_byname obj15("C", 0); - gnu_time_get_in obj16(0); - gnu_time_get_byname obj17("C", 0); - gnu_num_put_out obj18(0); - gnu_num_get_in obj19(0); - gnu_numpunct_byname obj20("C", 0); - gnu_money_put_out obj21(0); - gnu_money_get_in obj22(0); - gnu_moneypunct_byname_false obj23("C", 0); - gnu_moneypunct_byname_true obj24("C", 0); - gnu_ctype_byname obj25("C", 0); - gnu_collate_byname obj26("C", 0); - gnu_messages_byname obj27("C", 0); - } - catch (std::runtime_error& obj) - { - // named locale not valid - VERIFY( false ); - } - catch (std::exception& obj) - { - // some other error - VERIFY( false ); - } - - // 2 - try - { - gnu_facet obj28; - } - catch (std::runtime_error& obj) - { - // named locale not valid - VERIFY( false ); - } - catch (std::exception& obj) - { - // some other error - VERIFY( false ); - } -} - -int main () -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/facet/2.cc b/libstdc++-v3/testsuite/22_locale/facet/2.cc deleted file mode 100644 index ea63d731a3f..00000000000 --- a/libstdc++-v3/testsuite/22_locale/facet/2.cc +++ /dev/null @@ -1,94 +0,0 @@ -// 2000-08-31 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.1.1.1.2 - class locale::facet [lib.locale.facet] - -#include <cwchar> // for mbstate_t -#include <locale> -#include <stdexcept> -#include <string> -#include <iterator> -#include <limits> -#include <testsuite_hooks.h> - -// Static counter for use in checking ctors/dtors. -static std::size_t counter; - -class surf : public std::locale::facet -{ -public: - static std::locale::id id; - surf(size_t refs = 0): std::locale::facet(refs) { ++counter; } - ~surf() { --counter; } -}; - -std::locale::id surf::id; - -typedef surf facet_type; - -void test02() -{ - using namespace std; - bool test = true; - - // 1: Destroyed when out of scope. - VERIFY( counter == 0 ); - { - locale loc01(locale::classic(), new facet_type); - VERIFY( counter == 1 ); - } - VERIFY( counter == 0 ); - - // 2: Not destroyed when out of scope, deliberately leaked. - VERIFY( counter == 0 ); - { - // Default refs argument is zero. - locale loc02(locale::classic(), new facet_type(1)); - VERIFY( counter == 1 ); - } - VERIFY( counter == 1 ); - - // 3: Pathological. - counter = 0; - { - // Test bounds. - facet_type* f = new facet_type(numeric_limits<size_t>::max()); - VERIFY( counter == 1 ); - // Add a reference. - locale loc01(locale::classic(), f); - { - // Add another reference... - locale loc02(locale::classic(), f); - } - VERIFY( counter == 1 ); - } - - // 4: Named locale should destroy facets when it goes out of scope. - // Not quite sure how to test for this w/o valgrind at the moment. - { - locale loc03("es_MX"); - } -} - -int main () -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/global_templates/1.cc b/libstdc++-v3/testsuite/22_locale/global_templates/1.cc deleted file mode 100644 index 49886aa18bf..00000000000 --- a/libstdc++-v3/testsuite/22_locale/global_templates/1.cc +++ /dev/null @@ -1,70 +0,0 @@ -// 2000-09-11 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2000 Free Software Foundation -// -// 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. - -// 22.1.2 locale globals [lib.locale.global.templates] - -#include <cwchar> // for mbstate_t -#include <locale> -#include <testsuite_hooks.h> - -typedef std::codecvt<char, char, std::mbstate_t> ccodecvt; - -class gnu_codecvt: public ccodecvt { }; - -void test01() -{ - using namespace std; - - bool test = true; - - // construct a locale object with the C facet - const locale& cloc = locale::classic(); - // sanity check the constructed locale has the normal facet - VERIFY( has_facet<ccodecvt>(cloc) ); - - // construct a locale object with the specialized facet. - locale loc(locale::classic(), new gnu_codecvt); - // sanity check the constructed locale has the specialized facet. - VERIFY( has_facet<gnu_codecvt>(loc) ); - - try - { const ccodecvt& cvt01 = use_facet<ccodecvt>(cloc); } - catch(...) - { VERIFY( false ); } - - try - { const gnu_codecvt& cvt02 = use_facet<gnu_codecvt>(loc); } - catch(...) - { VERIFY( false ); } - - try - { const ccodecvt& cvt03 = use_facet<gnu_codecvt>(cloc); } - catch(bad_cast& obj) - { VERIFY( true ); } - catch(...) - { VERIFY( false ); } -} - -int main () -{ - test01(); - - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/1.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/1.cc deleted file mode 100644 index f95b06e6e4f..00000000000 --- a/libstdc++-v3/testsuite/22_locale/locale/cons/1.cc +++ /dev/null @@ -1,39 +0,0 @@ -// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.1.1.2 locale constructors and destructors [lib.locale.cons] - -#include <cwchar> // for mbstate_t -#include <locale> -#include <stdexcept> -#include <testsuite_hooks.h> - -void test00() -{ - // Should be able to do this as the first thing that happens in a - // file and have it not crash. - std::locale loc("C"); -} - -int main() -{ - test00(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/2.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/2.cc deleted file mode 100644 index 1f13c23992e..00000000000 --- a/libstdc++-v3/testsuite/22_locale/locale/cons/2.cc +++ /dev/null @@ -1,298 +0,0 @@ -// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.1.1.2 locale constructors and destructors [lib.locale.cons] - -#include <cwchar> // for mbstate_t -#include <locale> -#include <stdexcept> -#include <testsuite_hooks.h> - -#if _GLIBCPP_USE___ENC_TRAITS -typedef std::codecvt<char, char, std::mbstate_t> c_codecvt; -typedef std::codecvt_byname<char, char, std::mbstate_t> c_codecvt_byname; -typedef std::codecvt<wchar_t, char, std::mbstate_t> w_codecvt; -typedef std::codecvt_byname<wchar_t, char, std::mbstate_t> w_codecvt_byname; - -class gnu_codecvt: public c_codecvt { }; - -class gnu_facet: public std::locale::facet -{ -public: - static std::locale::id id; -}; - -std::locale::id gnu_facet::id; - -// Need some char_traits specializations for this to work. -typedef unsigned short unicode_t; - -namespace std -{ - template<> - struct char_traits<unicode_t> - { - typedef unicode_t char_type; - // Unsigned as wint_t is unsigned. - typedef unsigned long int_type; - typedef streampos pos_type; - typedef streamoff off_type; - typedef mbstate_t state_type; - - static void - assign(char_type& __c1, const char_type& __c2); - - static bool - eq(const char_type& __c1, const char_type& __c2); - - static bool - lt(const char_type& __c1, const char_type& __c2); - - static int - compare(const char_type* __s1, const char_type* __s2, size_t __n) - { return memcmp(__s1, __s2, __n); } - - static size_t - length(const char_type* __s); - - static const char_type* - find(const char_type* __s, size_t __n, const char_type& __a); - - static char_type* - move(char_type* __s1, const char_type* __s2, size_t __n); - - static char_type* - copy(char_type* __s1, const char_type* __s2, size_t __n) - { return static_cast<char_type*>(memcpy(__s1, __s2, __n)); } - - static char_type* - assign(char_type* __s, size_t __n, char_type __a); - - static char_type - to_char_type(const int_type& __c); - - static int_type - to_int_type(const char_type& __c); - - static bool - eq_int_type(const int_type& __c1, const int_type& __c2); - - static int_type - eof(); - - static int_type - not_eof(const int_type& __c); - }; -} - -void test01() -{ - using namespace std; - typedef unicode_t int_type; - typedef char ext_type; - typedef __enc_traits enc_type; - typedef codecvt<int_type, ext_type, enc_type> unicode_codecvt; - - bool test = true; - string str1, str2; - - // construct a locale object with the C facet - const locale loc01 = locale::classic(); - - // 1 - // template <class Facet> locale(const locale& other, Facet* f) - // construct a locale object with the specialized facet. - locale loc02(locale::classic(), new gnu_codecvt); - VERIFY (loc01 != loc02); - VERIFY (loc02.name() == "*"); - try - { - VERIFY (has_facet<gnu_codecvt>(loc02)); - VERIFY (has_facet<c_codecvt>(loc02)); - VERIFY (has_facet<w_codecvt>(loc02)); - } - catch(...) - { VERIFY( false ); } - - try - { use_facet<gnu_facet>(loc02); } - catch(bad_cast& obj) - { VERIFY( true ); } - catch(...) - { VERIFY( false ); } - - // unicode_codecvt - locale loc13(locale::classic(), new unicode_codecvt); - VERIFY (loc01 != loc13); - VERIFY (loc13.name() == "*"); - try - { - VERIFY (has_facet<c_codecvt>(loc13)); - VERIFY (has_facet<w_codecvt>(loc13)); - VERIFY (has_facet<unicode_codecvt>(loc13)); - } - catch(...) - { VERIFY( false ); } - - try - { use_facet<gnu_facet>(loc13); } - catch(bad_cast& obj) - { VERIFY( true ); } - catch(...) - { VERIFY( false ); } - - // 2 - // locale() throw() - locale loc03; - VERIFY (loc03 == loc01); - VERIFY (loc03.name() == "C"); - locale loc04 = locale::global(loc02); - locale loc05; - VERIFY (loc05 != loc03); - VERIFY (loc05 == loc02); - - // 3 - // explicit locale(const char* std_name) - locale loc06("fr_FR"); - VERIFY (loc06 != loc01); - VERIFY (loc06 != loc02); - VERIFY (loc06.name() == "fr_FR"); - locale loc07(""); - VERIFY (loc07 != loc02); - VERIFY (loc07.name() != ""); - try - { locale loc08(static_cast<const char*>(NULL)); } - catch(runtime_error& obj) - { VERIFY (true); } - catch(...) - { VERIFY (false); } - - try - { locale loc08("saturn_SUN*RA"); } - catch(runtime_error& obj) - { VERIFY (true); } - catch(...) - { VERIFY (false); } - - // 4 - // locale(const locale& other, const char* std_name, category) - { - // This is the same as 5 only use "C" for loc("C") - locale loc09(loc06, "C", locale::ctype); - VERIFY (loc09.name() != "fr_FR"); - VERIFY (loc09.name() != "C"); - VERIFY (loc09.name() != "*"); - VERIFY (loc09 != loc01); - VERIFY (loc09 != loc06); - - locale loc10(loc02, "C", locale::ctype); - VERIFY (loc10.name() == "*"); - VERIFY (loc10 != loc01); // As not named, even tho facets same... - VERIFY (loc10 != loc02); - - locale loc11(loc01, "C", locale::ctype); - VERIFY (loc11.name() == "C"); - VERIFY (loc11 == loc01); - - try - { locale loc12(loc01, static_cast<const char*>(NULL), locale::ctype); } - catch(runtime_error& obj) - { VERIFY (true); } - catch(...) - { VERIFY (false); } - - try - { locale loc13(loc01, "localized by the wu-tang clan", locale::ctype); } - catch(runtime_error& obj) - { VERIFY (true); } - catch(...) - { VERIFY (false); } - - locale loc14(loc06, "C", locale::none); - VERIFY (loc14.name() == "fr_FR"); - VERIFY (loc14 == loc06); - - locale loc15(loc06, "C", locale::collate); - VERIFY (loc15.name() != "fr_FR"); - VERIFY (loc15.name() != "C"); - VERIFY (loc15.name() != "*"); - VERIFY (loc15.name() != loc09.name()); - VERIFY (loc15 != loc01); - VERIFY (loc15 != loc06); - VERIFY (loc15 != loc09); - } - - // 5 - // locale(const locale& other, const locale& one, category) - { - // This is the exact same as 4, with locale("C") for "C" - locale loc09(loc06, loc01, locale::ctype); - VERIFY (loc09.name() != "fr_FR"); - VERIFY (loc09.name() != "C"); - VERIFY (loc09.name() != "*"); - VERIFY (loc09 != loc01); - VERIFY (loc09 != loc06); - - locale loc10(loc02, loc01, locale::ctype); - VERIFY (loc10.name() == "*"); - VERIFY (loc10 != loc01); // As not named, even tho facets same... - VERIFY (loc10 != loc02); - - locale loc11(loc01, loc01, locale::ctype); - VERIFY (loc11.name() == "C"); - VERIFY (loc11 == loc01); - - try - { locale loc12(loc01, static_cast<const char*>(NULL), locale::ctype); } - catch(runtime_error& obj) - { VERIFY (true); } - catch(...) - { VERIFY (false); } - - try - { locale loc13(loc01, locale("wu-tang clan"), locale::ctype); } - catch(runtime_error& obj) - { VERIFY (true); } - catch(...) - { VERIFY (false); } - - locale loc14(loc06, loc01, locale::none); - VERIFY (loc14.name() == "fr_FR"); - VERIFY (loc14 == loc06); - - locale loc15(loc06, loc01, locale::collate); - VERIFY (loc15.name() != "fr_FR"); - VERIFY (loc15.name() != "C"); - VERIFY (loc15.name() != "*"); - VERIFY (loc15.name() != loc09.name()); - VERIFY (loc15 != loc01); - VERIFY (loc15 != loc06); - VERIFY (loc15 != loc09); - } -} -#endif // _GLIBCPP_USE___ENC_TRAITS - -int main() -{ -#if _GLIBCPP_USE___ENC_TRAITS - test01(); -#endif - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/3.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/3.cc deleted file mode 100644 index 7cc91261c98..00000000000 --- a/libstdc++-v3/testsuite/22_locale/locale/cons/3.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.1.1.2 locale constructors and destructors [lib.locale.cons] - -#include <cwchar> // for mbstate_t -#include <locale> -#include <stdexcept> -#include <testsuite_hooks.h> - -// libstdc++/7222 -void test02() -{ - bool test = true; - std::locale loc_c1("C"); - std::locale loc_c2 ("C"); - - std::locale loc_1(""); - std::locale loc_2(""); - - VERIFY( loc_c1 == loc_c2 ); - VERIFY( loc_1 == loc_2 ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/4.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/4.cc deleted file mode 100644 index 4864b0bad7d..00000000000 --- a/libstdc++-v3/testsuite/22_locale/locale/cons/4.cc +++ /dev/null @@ -1,47 +0,0 @@ -// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.1.1.2 locale constructors and destructors [lib.locale.cons] - -#include <cwchar> // for mbstate_t -#include <locale> -#include <stdexcept> -#include <testsuite_hooks.h> - -// libstdc++/7811 -void test03() -{ - bool test = true; -#ifdef _GLIBCPP_HAVE_SETENV - const char* LC_ALL_orig = getenv("LC_ALL"); - if (!setenv("LC_ALL", "it_IT", 1)) - { - std::locale loc(""); - VERIFY( loc.name() == "it_IT" ); - setenv("LC_ALL", LC_ALL_orig ? LC_ALL_orig : "", 1); - } -#endif -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/5.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/5.cc deleted file mode 100644 index 5c649d0b5b9..00000000000 --- a/libstdc++-v3/testsuite/22_locale/locale/cons/5.cc +++ /dev/null @@ -1,198 +0,0 @@ -// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.1.1.2 locale constructors and destructors [lib.locale.cons] - -#include <cwchar> // for mbstate_t -#include <locale> -#include <stdexcept> -#include <testsuite_hooks.h> - -// More tests for locale("") == POSIX locale::name. -void test04() -{ - bool test = true; - using namespace std; - -#ifdef _GLIBCPP_HAVE_SETENV - - const char* LANG_orig = getenv("LANG") ? strdup(getenv("LANG")) : ""; - const char* LC_ALL_orig = getenv("LC_ALL") ? strdup(getenv("LC_ALL")) : ""; - const char* LC_CTYPE_orig = - getenv("LC_CTYPE") ? strdup(getenv("LC_CTYPE")) : ""; - const char* LC_NUMERIC_orig = - getenv("LC_NUMERIC") ? strdup(getenv("LC_NUMERIC")) : ""; - const char* LC_TIME_orig = - getenv("LC_TIME") ? strdup(getenv("LC_TIME")) : ""; - const char* LC_COLLATE_orig = - getenv("LC_COLLATE") ? strdup(getenv("LC_COLLATE")) : ""; - const char* LC_MONETARY_orig = - getenv("LC_MONETARY") ? strdup(getenv("LC_MONETARY")) : ""; - const char* LC_MESSAGES_orig = - getenv("LC_MESSAGES") ? strdup(getenv("LC_MESSAGES")) : ""; -#if _GLIBCPP_NUM_CATEGORIES - const char* LC_PAPER_orig = - getenv("LC_PAPER") ? strdup(getenv("LC_PAPER")) : ""; - const char* LC_NAME_orig = - getenv("LC_NAME") ? strdup(getenv("LC_NAME")) : ""; - const char* LC_ADDRESS_orig = - getenv("LC_ADDRESS") ? strdup(getenv("LC_ADDRESS")) : ""; - const char* LC_TELEPHONE_orig = - getenv("LC_TELEPHONE") ? strdup(getenv("LC_TELEPHONE")) : ""; - const char* LC_MEASUREMENT_orig = - getenv("LC_MEASUREMENT") ? strdup(getenv("LC_MEASUREMENT")) : ""; - const char* LC_IDENTIFICATION_orig = - getenv("LC_IDENTIFICATION") ? strdup(getenv("LC_IDENTIFICATION")) : ""; -#endif - - // Check that a "POSIX" LC_ALL is equivalent to "C". - if (!setenv("LC_ALL", "POSIX", 1)) - { - locale loc(""); - VERIFY( loc.name() == "C" ); - } - setenv("LC_ALL", "", 1); - - // Check that a "en_PH" LC_ALL is equivalent to "en_PH". - if (!setenv("LC_ALL", "en_PH", 1)) - { - locale loc(""); - VERIFY( loc.name() == "en_PH" ); - } - setenv("LC_ALL", "", 1); - - // Explicit check that LC_ALL sets regardless of LC_* and LANG. - if (!setenv("LANG", "es_MX", 1) && !setenv("LC_COLLATE", "de_DE", 1)) - { - if (!setenv("LC_ALL", "en_PH", 1)) - { - locale loc(""); - VERIFY( loc.name() == "en_PH" ); - } - setenv("LC_ALL", "", 1); - setenv("LANG", LANG_orig ? LANG_orig : "", 1); - setenv("LC_COLLATE", LC_COLLATE_orig ? LC_COLLATE_orig : "", 1); - } - - // NB: LANG checks all LC_* macro settings. As such, all LC_* macros - // must be cleared for these tests, and then restored. - setenv("LC_ALL", "", 1); - setenv("LC_CTYPE", "", 1); - setenv("LC_NUMERIC", "", 1); - setenv("LC_TIME", "", 1); - setenv("LC_COLLATE", "", 1); - setenv("LC_MONETARY", "", 1); - setenv("LC_MESSAGES", "", 1); -#if _GLIBCPP_NUM_CATEGORIES - setenv("LC_PAPER", "", 1); - setenv("LC_NAME", "", 1); - setenv("LC_ADDRESS", "", 1); - setenv("LC_TELEPHONE", "", 1); - setenv("LC_MEASUREMENT", "", 1); - setenv("LC_IDENTIFICATION", "", 1); -#endif - - // Check the default set by LANG. - if (!setenv("LANG", "fr_FR", 1)) - { - locale loc(""); - VERIFY( loc.name() == "fr_FR" ); - } - - // Check that a "POSIX" LANG is equivalent to "C". - if (!setenv("LANG", "POSIX", 1)) - { - locale loc(""); - VERIFY( loc.name() == "C" ); - } - - // Setting a category in the "C" default. - if (!setenv("LC_COLLATE", "de_DE", 1)) - { - locale loc(""); - -#if _GLIBCPP_NUM_CATEGORIES - VERIFY( loc.name() == "LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=C;" - "LC_COLLATE=de_DE;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;" - "LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;" - "LC_IDENTIFICATION=C" ); -#else - VERIFY( loc.name() == "LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=C;" - "LC_COLLATE=de_DE;LC_MONETARY=C;LC_MESSAGES=C" ); -#endif - } - - // Changing the LANG default while LC_COLLATE is set. - if (!setenv("LANG", "fr_FR", 1)) - { - locale loc(""); -#if _GLIBCPP_NUM_CATEGORIES - VERIFY( loc.name() == "LC_CTYPE=fr_FR;LC_NUMERIC=fr_FR;" - "LC_TIME=fr_FR;LC_COLLATE=de_DE;LC_MONETARY=fr_FR;" - "LC_MESSAGES=fr_FR;LC_PAPER=fr_FR;LC_NAME=fr_FR;" - "LC_ADDRESS=fr_FR;LC_TELEPHONE=fr_FR;LC_MEASUREMENT=fr_FR;" - "LC_IDENTIFICATION=fr_FR" ); -#else - VERIFY( loc.name() == "LC_CTYPE=fr_FR;LC_NUMERIC=fr_FR;" - "LC_TIME=fr_FR;LC_COLLATE=de_DE;LC_MONETARY=fr_FR;" - "LC_MESSAGES=fr_FR" ); -#endif - } - - // Changing another (C only) category. -#if _GLIBCPP_NUM_CATEGORIES - if (!setenv("LC_IDENTIFICATION", "it_IT", 1)) - { - locale loc(""); - VERIFY( loc.name() == "LC_CTYPE=fr_FR;LC_NUMERIC=fr_FR;" - "LC_TIME=fr_FR;LC_COLLATE=de_DE;LC_MONETARY=fr_FR;" - "LC_MESSAGES=fr_FR;LC_PAPER=fr_FR;LC_NAME=fr_FR;" - "LC_ADDRESS=fr_FR;LC_TELEPHONE=fr_FR;LC_MEASUREMENT=fr_FR;" - "LC_IDENTIFICATION=it_IT" ); - } -#endif - - // Restore the environment. - setenv("LANG", LANG_orig ? LANG_orig : "", 1); - setenv("LC_ALL", LC_ALL_orig ? LC_ALL_orig : "", 1); - setenv("LC_CTYPE", LC_CTYPE_orig ? LC_CTYPE_orig : "", 1); - setenv("LC_NUMERIC", LC_NUMERIC_orig ? LC_NUMERIC_orig : "", 1); - setenv("LC_TIME", LC_TIME_orig ? LC_TIME_orig : "", 1); - setenv("LC_COLLATE", LC_COLLATE_orig ? LC_COLLATE_orig : "", 1); - setenv("LC_MONETARY", LC_MONETARY_orig ? LC_MONETARY_orig : "", 1); - setenv("LC_MESSAGES", LC_MESSAGES_orig ? LC_MESSAGES_orig : "", 1); -#if _GLIBCPP_NUM_CATEGORIES - setenv("LC_PAPER", LC_PAPER_orig ? LC_PAPER_orig : "", 1); - setenv("LC_NAME", LC_NAME_orig ? LC_NAME_orig : "", 1); - setenv("LC_ADDRESS", LC_ADDRESS_orig ? LC_ADDRESS_orig : "", 1); - setenv("LC_TELEPHONE", LC_TELEPHONE_orig ? LC_TELEPHONE_orig : "", 1); - setenv("LC_MEASUREMENT", LC_MEASUREMENT_orig ? LC_MEASUREMENT_orig : "", 1); - setenv("LC_IDENTIFICATION", - LC_IDENTIFICATION_orig ? LC_IDENTIFICATION_orig : "", 1); -#endif - -#endif -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test04); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/6.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/6.cc deleted file mode 100644 index 6b11ac1e9a1..00000000000 --- a/libstdc++-v3/testsuite/22_locale/locale/cons/6.cc +++ /dev/null @@ -1,63 +0,0 @@ -// 2001-01-19 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.1.1 - Class locale [lib.locale] - -#include <locale> -#include <string> -#include <testsuite_hooks.h> - -// creating unnamed locales 1 using new + combine -void -test01() -{ - using namespace std; - bool test = true; - const string name_c("C"); - const string str_unnamed("*"); - string str; - - // construct a locale object with the specialized facet. - locale loc_c = locale::classic(); - locale loc_1(locale::classic(), new numpunct<char>); - - // check names - VERIFY( loc_c.name() == name_c ); - VERIFY( loc_1.name() == str_unnamed ); - - // sanity check the constructed locale has the specialized facet. - VERIFY( has_facet<numpunct<char> >(loc_1) ); - VERIFY( has_facet<numpunct<char> >(loc_c) ); - - // extract facet - const numpunct<char>& f_nump_1 = use_facet<numpunct<char> >(loc_1); - const numpunct<char>& f_nump_c = use_facet<numpunct<char> >(loc_c); - - // attempt to re-synthesize classic locale - locale loc_2 = loc_1.combine<numpunct<char> >(loc_c); - VERIFY( loc_2.name() == str_unnamed ); - VERIFY( loc_2 != loc_c ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/7.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/7.cc deleted file mode 100644 index fb709666d48..00000000000 --- a/libstdc++-v3/testsuite/22_locale/locale/cons/7.cc +++ /dev/null @@ -1,104 +0,0 @@ -// 2001-01-19 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.1.1 - Class locale [lib.locale] - -#include <locale> -#include <string> -#include <testsuite_hooks.h> - -void -test02() -{ - using namespace std; - bool test = true; - const string name_c("C"); - const string name_no("*"); - string str; - - // construct a locale object with the specialized facet. - locale loc_c = locale::classic(); - locale loc_1(locale::classic(), - new numpunct_byname<char>("fr_FR")); - locale loc_fr("fr_FR"); - - // check names - VERIFY( loc_c.name() == name_c ); - VERIFY( loc_1.name() == name_no ); - - // sanity check the constructed locale has the specialized facet. - VERIFY( has_facet<numpunct<char> >(loc_1) ); - VERIFY( has_facet<numpunct<char> >(loc_c) ); - - // attempt to re-synthesize classic locale - locale loc_2 = loc_1.combine<numpunct<char> >(loc_c); - VERIFY( loc_2.name() == name_no ); - VERIFY( loc_2 != loc_c ); - - // extract facet - const numpunct<char>& nump_1 = use_facet<numpunct<char> >(loc_1); - const numpunct<char>& nump_2 = use_facet<numpunct<char> >(loc_2); - const numpunct<char>& nump_c = use_facet<numpunct<char> >(loc_c); - const numpunct<char>& nump_fr = use_facet<numpunct<char> >(loc_fr); - - // sanity check the data is correct. - char dp1 = nump_c.decimal_point(); - char th1 = nump_c.thousands_sep(); - string g1 = nump_c.grouping(); - string t1 = nump_c.truename(); - string f1 = nump_c.falsename(); - - char dp2 = nump_1.decimal_point(); - char th2 = nump_1.thousands_sep(); - string g2 = nump_1.grouping(); - string t2 = nump_1.truename(); - string f2 = nump_1.falsename(); - - char dp3 = nump_2.decimal_point(); - char th3 = nump_2.thousands_sep(); - string g3 = nump_2.grouping(); - string t3 = nump_2.truename(); - string f3 = nump_2.falsename(); - - char dp4 = nump_fr.decimal_point(); - char th4 = nump_fr.thousands_sep(); - string g4 = nump_fr.grouping(); - string t4 = nump_fr.truename(); - string f4 = nump_fr.falsename(); - VERIFY( dp1 != dp2 ); - VERIFY( th1 != th2 ); - - VERIFY( dp1 == dp3 ); - VERIFY( th1 == th3 ); - VERIFY( t1 == t3 ); - VERIFY( f1 == f3 ); - - VERIFY( dp2 == dp4 ); - VERIFY( th2 == th4 ); - VERIFY( t2 == t4 ); - VERIFY( f2 == f4 ); -} - - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/8.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/8.cc deleted file mode 100644 index 433fc1fe9ba..00000000000 --- a/libstdc++-v3/testsuite/22_locale/locale/cons/8.cc +++ /dev/null @@ -1,43 +0,0 @@ -// 2003-02-01 Paolo Carlini <pcarlini@unitus.it> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.1.1.2 locale constructors and destructors [lib.locale.cons] - -#include <locale> - -// Const correctness issue: -// http://gcc.gnu.org/ml/libstdc++/2003-01/msg00370.html -void -test01() -{ - using namespace std; - bool test = true; - - const locale l1("C"); - const locale l2 = - locale(locale::classic(), &use_facet<time_get<char> >(l1)); -} - - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/1.cc b/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/1.cc deleted file mode 100644 index 3d2c931ec6d..00000000000 --- a/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/1.cc +++ /dev/null @@ -1,67 +0,0 @@ -// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.1.1.5 locale static members [lib.locale.statics] - -#include <cwchar> // for mbstate_t -#include <locale> -#include <testsuite_hooks.h> - -typedef std::codecvt<char, char, std::mbstate_t> ccodecvt; -class gnu_codecvt: public ccodecvt { }; - -void test01() -{ - using namespace std; - bool test = true; - - string str1, str2; - - // Construct a locale object with the C facet. - const locale loc01 = locale::classic(); - - // Construct a locale object with the specialized facet. - locale loc02(locale::classic(), new gnu_codecvt); - VERIFY ( loc01 != loc02 ); - VERIFY ( !(loc01 == loc02) ); - - // classic - locale loc06("C"); - VERIFY (loc06 == loc01); - str1 = loc06.name(); - VERIFY( str1 == "C" ); - - // global - locale loc03; - VERIFY ( loc03 == loc01); - locale global_orig = locale::global(loc02); - locale loc05; - VERIFY (loc05 != loc03); - VERIFY (loc05 == loc02); - - // Reset global settings. - locale::global(global_orig); -} - -int main () -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/2.cc b/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/2.cc deleted file mode 100644 index bde35e26347..00000000000 --- a/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/2.cc +++ /dev/null @@ -1,71 +0,0 @@ -// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.1.1.5 locale static members [lib.locale.statics] - -#include <cwchar> // for mbstate_t -#include <locale> -#include <testsuite_hooks.h> - -// Sanity check locale::global(loc) and setlocale. -void test02() -{ - using namespace std; - bool test = true; - - const string ph("en_PH"); - const string mx("es_MX"); - const char* orig = setlocale(LC_ALL, NULL); - const char* testph = setlocale(LC_ALL, ph.c_str()); - const char* testmx = setlocale(LC_ALL, mx.c_str()); - setlocale(LC_ALL, orig); - - // If the underlying locale doesn't support these names, setlocale - // won't be reset. Therefore, disable unless we know these specific - // named locales work. - if (testph && testmx) - { - const locale loc_ph(ph.c_str()); - const locale loc_mx(mx.c_str()); - - // Use setlocale between two calls to locale("") - const locale loc_env_1(""); - setlocale(LC_ALL, ph.c_str()); - const locale loc_env_2(""); - VERIFY( loc_env_1 == loc_env_2 ); - - // Change global locale. - locale global_orig = locale::global(loc_mx); - const char* lc_all_mx = setlocale(LC_ALL, NULL); - if (lc_all_mx) - { - VERIFY( mx == lc_all_mx ); - } - - // Restore global settings. - locale::global(global_orig); - } -} - -int main () -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/3.cc b/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/3.cc deleted file mode 100644 index 87d8193051e..00000000000 --- a/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/3.cc +++ /dev/null @@ -1,113 +0,0 @@ -// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.1.1.5 locale static members [lib.locale.statics] - -#include <cwchar> // for mbstate_t -#include <locale> -#include <testsuite_hooks.h> - -// Static counter for use in checking ctors/dtors. -static std::size_t counter; - -class surf : public std::locale::facet -{ -public: - static std::locale::id id; - surf(size_t refs = 0): std::locale::facet(refs) { ++counter; } - ~surf() { --counter; } -}; - -std::locale::id surf::id; - -typedef surf facet_type; - -// Verify lifetimes of global objects. -void test03() -{ - using namespace std; - bool test = true; - - string name; - locale global_orig; - // 1: Destroyed when out of scope. - { - { - { - VERIFY( counter == 0 ); - { - locale loc01(locale::classic(), new facet_type); - VERIFY( counter == 1 ); - global_orig = locale::global(loc01); - name = loc01.name(); - } - VERIFY( counter == 1 ); - locale loc02 = locale(); - // Weak, but it's something... - VERIFY( loc02.name() == name ); - } - VERIFY( counter == 1 ); - // NB: loc03 should be a copy of the previous global locale. - locale loc03 = locale::global(global_orig); - VERIFY( counter == 1 ); - VERIFY( loc03.name() == name ); - } - VERIFY( counter == 0 ); - locale loc04 = locale(); - VERIFY( loc04 == global_orig ); - } - - // 2: Not destroyed when out of scope, deliberately leaked. - { - { - { - VERIFY( counter == 0 ); - { - locale loc01(locale::classic(), new facet_type(1)); - VERIFY( counter == 1 ); - global_orig = locale::global(loc01); - name = loc01.name(); - } - VERIFY( counter == 1 ); - locale loc02 = locale(); - // Weak, but it's something... - VERIFY( loc02.name() == name ); - } - VERIFY( counter == 1 ); - // NB: loc03 should be a copy of the previous global locale. - locale loc03 = locale::global(global_orig); - VERIFY( counter == 1 ); - VERIFY( loc03.name() == name ); - } - VERIFY( counter == 1 ); - locale loc04 = locale(); - VERIFY( loc04 == global_orig ); - } - VERIFY( counter == 1 ); - - // Restore global settings. - locale::global(global_orig); -} - -int main () -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/locale/operations/1.cc b/libstdc++-v3/testsuite/22_locale/locale/operations/1.cc deleted file mode 100644 index 8fe6aa7ea3d..00000000000 --- a/libstdc++-v3/testsuite/22_locale/locale/operations/1.cc +++ /dev/null @@ -1,67 +0,0 @@ -// 2000-09-11 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.1.1.4 locale operators [lib.locale.operators] - -#include <cwchar> // for mbstate_t -#include <locale> -#include <testsuite_hooks.h> - -typedef std::codecvt<char, char, std::mbstate_t> ccodecvt; -class gnu_codecvt: public ccodecvt { }; - -void test01() -{ - using namespace std; - - bool test = true; - string str1, str2; - - // construct a locale object with the C facet - const locale& cloc = locale::classic(); - // construct a locale object with the specialized facet. - locale loc(locale::classic(), new gnu_codecvt); - VERIFY ( cloc != loc ); - VERIFY ( !(cloc == loc) ); - - str1 = cloc.name(); - str2 = loc.name(); - VERIFY( loc(str1, str2) == false ); -} - -// bool operator()(const string_type&, const string_type&) const -long gnu_count; - -class gnu_collate: public std::collate<char> -{ -protected: - virtual int - do_compare(const char*, const char*, const char*, const char*) const - { ++gnu_count; return 0; } -}; - -int main () -{ - test01(); - return 0; -} - - - diff --git a/libstdc++-v3/testsuite/22_locale/locale/operations/2.cc b/libstdc++-v3/testsuite/22_locale/locale/operations/2.cc deleted file mode 100644 index ed06e10a635..00000000000 --- a/libstdc++-v3/testsuite/22_locale/locale/operations/2.cc +++ /dev/null @@ -1,64 +0,0 @@ -// 2000-09-11 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.1.1.4 locale operators [lib.locale.operators] - -#include <cwchar> // for mbstate_t -#include <locale> -#include <testsuite_hooks.h> - -// bool operator()(const string_type&, const string_type&) const -long gnu_count; - -class gnu_collate: public std::collate<char> -{ -protected: - virtual int - do_compare(const char*, const char*, const char*, const char*) const - { ++gnu_count; return 0; } -}; - -void test02() -{ - using namespace std; - bool test = true; - - // Sanity check. - locale loc_c = locale::classic(); - string s01("land of "); - string s02("land of look behind"); - VERIFY( !loc_c(s01, s01) ); - VERIFY( loc_c(s01, s02) ); - - // Derivation, MF check. - locale loc_gnu(loc_c, new gnu_collate); - gnu_count = 0; - loc_gnu(s01, s02); - VERIFY( gnu_count == 1 ); -} - -int main () -{ - test02(); - return 0; -} - - - diff --git a/libstdc++-v3/testsuite/22_locale/messages/1.cc b/libstdc++-v3/testsuite/22_locale/messages/1.cc deleted file mode 100644 index 6eb593239b1..00000000000 --- a/libstdc++-v3/testsuite/22_locale/messages/1.cc +++ /dev/null @@ -1,45 +0,0 @@ -// { dg-do compile } -// 2001-07-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.7 The message retrieval category - -#include <locale> - -void test01() -{ - // Check for required base class. - typedef std::messages<char> test_type; - typedef std::locale::facet base_type1; - typedef std::messages_base base_type2; - const test_type& obj = std::use_facet<test_type>(std::locale()); - const base_type1* base1 = &obj; - const base_type2* base2 = &obj; - - // Check for required typedefs - typedef test_type::char_type char_type; - typedef test_type::string_type string_type; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/messages/2.cc b/libstdc++-v3/testsuite/22_locale/messages/2.cc deleted file mode 100644 index 52f25e7bd84..00000000000 --- a/libstdc++-v3/testsuite/22_locale/messages/2.cc +++ /dev/null @@ -1,39 +0,0 @@ -// { dg-do compile } -// 2001-07-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.7 The message retrieval category - -#include <locale> - -// Should be able to instantiate this for other types besides char, wchar_t -class gnu_messages: public std::messages<unsigned char> -{ }; - -void test02() -{ - gnu_messages facet01; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/messages/members/char/1.cc b/libstdc++-v3/testsuite/22_locale/messages/members/char/1.cc deleted file mode 100644 index 7167fadef10..00000000000 --- a/libstdc++-v3/testsuite/22_locale/messages/members/char/1.cc +++ /dev/null @@ -1,69 +0,0 @@ -// 2001-07-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.7.1.1 messages members - -#include <locale> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef std::messages<char>::catalog catalog; - typedef std::messages<char>::string_type string_type; - - bool test = true; - // This is exported through RUNTESTFLAGS in testsuite/Makefile.am. - const char* dir = LOCALEDIR; - - // basic construction - locale loc_c = locale::classic(); - locale loc_us("en_US"); - locale loc_fr("fr_FR"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_us != loc_fr ); - VERIFY( loc_us != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the messages facets - const messages<char>& mssg_c = use_facet<messages<char> >(loc_c); - const messages<char>& mssg_us = use_facet<messages<char> >(loc_us); - const messages<char>& mssg_fr = use_facet<messages<char> >(loc_fr); - const messages<char>& mssg_de = use_facet<messages<char> >(loc_de); - - // catalog open(const string&, const locale&) const; - // string_type get(catalog, int, int, const string_type& ) const; - // void close(catalog) const; - - // Check German (de_DE) locale. - catalog cat_de = mssg_de.open("libstdc++", loc_c, dir); - string s01 = mssg_de.get(cat_de, 0, 0, "please"); - string s02 = mssg_de.get(cat_de, 0, 0, "thank you"); - VERIFY ( s01 == "bitte" ); - VERIFY ( s02 == "danke" ); - mssg_de.close(cat_de); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/messages/members/char/2.cc b/libstdc++-v3/testsuite/22_locale/messages/members/char/2.cc deleted file mode 100644 index 61ffba626c1..00000000000 --- a/libstdc++-v3/testsuite/22_locale/messages/members/char/2.cc +++ /dev/null @@ -1,69 +0,0 @@ -// 2001-07-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.7.1.1 messages members - -#include <locale> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef std::messages<char>::catalog catalog; - typedef std::messages<char>::string_type string_type; - - bool test = true; - // This is exported through RUNTESTFLAGS in testsuite/Makefile.am. - const char* dir = LOCALEDIR; - - // basic construction - locale loc_c = locale::classic(); - locale loc_us("en_US"); - locale loc_fr("fr_FR"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_us != loc_fr ); - VERIFY( loc_us != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the messages facets - const messages<char>& mssg_c = use_facet<messages<char> >(loc_c); - const messages<char>& mssg_us = use_facet<messages<char> >(loc_us); - const messages<char>& mssg_fr = use_facet<messages<char> >(loc_fr); - const messages<char>& mssg_de = use_facet<messages<char> >(loc_de); - - // catalog open(const string&, const locale&) const; - // string_type get(catalog, int, int, const string_type& ) const; - // void close(catalog) const; - - // Check French (fr_FR) locale. - catalog cat_fr = mssg_fr.open("libstdc++", loc_c, dir); - string s01 = mssg_fr.get(cat_fr, 0, 0, "please"); - string s02 = mssg_fr.get(cat_fr, 0, 0, "thank you"); - VERIFY ( s01 == "s'il vous plaît" ); - VERIFY ( s02 == "merci" ); - mssg_fr.close(cat_fr); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/messages/members/char/3.cc b/libstdc++-v3/testsuite/22_locale/messages/members/char/3.cc deleted file mode 100644 index 55cf80193d6..00000000000 --- a/libstdc++-v3/testsuite/22_locale/messages/members/char/3.cc +++ /dev/null @@ -1,69 +0,0 @@ -// 2001-07-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.7.1.1 messages members - -#include <locale> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - typedef std::messages<char>::catalog catalog; - typedef std::messages<char>::string_type string_type; - - bool test = true; - // This is exported through RUNTESTFLAGS in testsuite/Makefile.am. - const char* dir = LOCALEDIR; - - // basic construction - locale loc_c = locale::classic(); - locale loc_us("en_US"); - locale loc_fr("fr_FR"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_us != loc_fr ); - VERIFY( loc_us != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the messages facets - const messages<char>& mssg_c = use_facet<messages<char> >(loc_c); - const messages<char>& mssg_us = use_facet<messages<char> >(loc_us); - const messages<char>& mssg_fr = use_facet<messages<char> >(loc_fr); - const messages<char>& mssg_de = use_facet<messages<char> >(loc_de); - - // catalog open(const string&, const locale&) const; - // string_type get(catalog, int, int, const string_type& ) const; - // void close(catalog) const; - - // Check US (en_US) locale. - catalog cat_us = mssg_fr.open("libstdc++", loc_c, dir); - string s01 = mssg_us.get(cat_us, 0, 0, "please"); - string s02 = mssg_us.get(cat_us, 0, 0, "thank you"); - VERIFY ( s01 == "please" ); - VERIFY ( s02 == "thank you" ); - mssg_us.close(cat_us); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/messages/members/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/messages/members/char/wrapped_env.cc deleted file mode 100644 index 3f042d9ec42..00000000000 --- a/libstdc++-v3/testsuite/22_locale/messages/members/char/wrapped_env.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/messages/members/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/messages/members/char/wrapped_locale.cc deleted file mode 100644 index 61086ad6da8..00000000000 --- a/libstdc++-v3/testsuite/22_locale/messages/members/char/wrapped_locale.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/messages_byname/1.cc b/libstdc++-v3/testsuite/22_locale/messages_byname/1.cc deleted file mode 100644 index e9d3217c08f..00000000000 --- a/libstdc++-v3/testsuite/22_locale/messages_byname/1.cc +++ /dev/null @@ -1,78 +0,0 @@ -// 2001-07-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.7.2 Template class messages_byname - -#include <locale> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef std::messages<char>::catalog catalog; - typedef std::messages<char>::string_type string_type; - - bool test = true; - string str; - // This is exported through RUNTESTFLAGS in testsuite/Makefile.am. - const char* dir = LOCALEDIR; - locale loc_c = locale::classic(); - - locale loc_byname(locale::classic(), new messages_byname<char>("de_DE")); - str = loc_byname.name(); - - locale loc_de("de_DE"); - str = loc_de.name(); - - VERIFY( loc_de != loc_byname ); - - // cache the messages facets - const messages<char>& mssg_byname = use_facet<messages<char> >(loc_byname); - const messages<char>& mssg_de = use_facet<messages<char> >(loc_de); - - // catalog open(const string&, const locale&) const; - // string_type get(catalog, int, int, const string_type& ) const; - // void close(catalog) const; - - // Check German (de_DE) locale. - catalog cat_de = mssg_de.open("libstdc++", loc_c, dir); - string s01 = mssg_de.get(cat_de, 0, 0, "please"); - string s02 = mssg_de.get(cat_de, 0, 0, "thank you"); - VERIFY ( s01 == "bitte" ); - VERIFY ( s02 == "danke" ); - mssg_de.close(cat_de); - - // Check byname locale. - catalog cat_byname = mssg_byname.open("libstdc++", loc_c, dir); - string s03 = mssg_byname.get(cat_de, 0, 0, "please"); - string s04 = mssg_byname.get(cat_de, 0, 0, "thank you"); - VERIFY ( s03 == "bitte" ); - VERIFY ( s04 == "danke" ); - mssg_byname.close(cat_byname); - - VERIFY ( s01 == s03 ); - VERIFY ( s02 == s04 ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/1.cc b/libstdc++-v3/testsuite/22_locale/money_get/1.cc deleted file mode 100644 index 86fcd18b501..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/1.cc +++ /dev/null @@ -1,44 +0,0 @@ -// { dg-do compile } -// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.1 Template class money_get - -#include <locale> - -void test01() -{ - // Check for required base class. - typedef std::money_get<char> test_type; - typedef std::locale::facet base_type; - const test_type& obj = std::use_facet<test_type>(std::locale()); - const base_type* base = &obj; - - // Check for required typedefs - typedef test_type::char_type char_type; - typedef test_type::string_type string_type; - typedef test_type::iter_type iter_type; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/2.cc b/libstdc++-v3/testsuite/22_locale/money_get/2.cc deleted file mode 100644 index 516f11bf169..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/2.cc +++ /dev/null @@ -1,39 +0,0 @@ -// { dg-do compile } -// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.1 Template class money_get - -#include <locale> - -// Should be able to instantiate this for other types besides char, wchar_t -class gnu_money_get: public std::money_get<unsigned char> -{ }; - -void test02() -{ - gnu_money_get facet01; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/1.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/1.cc deleted file mode 100644 index f4e5481def6..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/1.cc +++ /dev/null @@ -1,151 +0,0 @@ -// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// test string version -void test01() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - typedef istreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE@euro"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the moneypunct facets - typedef moneypunct<char, true> __money_true; - typedef moneypunct<char, false> __money_false; - const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c); - const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de); - const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c); - const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de); - const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk); - const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk); - - // sanity check the data is correct. - const string empty; - - // total EPA budget FY 2002 - const string digits1("720000000000"); - - // est. cost, national missile "defense", expressed as a loss in USD 2001 - const string digits2("-10000000000000"); - - // not valid input - const string digits3("-A"); - - // input less than frac_digits - const string digits4("-1"); - - iterator_type end; - istringstream iss; - iss.imbue(loc_de); - // cache the money_get facet - const money_get<char>& mon_get = use_facet<money_get<char> >(iss.getloc()); - - - iss.str("7.200.000.000,00 "); - iterator_type is_it01(iss); - string result1; - ios_base::iostate err01 = ios_base::goodbit; - mon_get.get(is_it01, end, true, iss, err01, result1); - VERIFY( result1 == digits1 ); - VERIFY( err01 == ios_base::eofbit ); - - iss.str("7.200.000.000,00 "); - iterator_type is_it02(iss); - string result2; - ios_base::iostate err02 = ios_base::goodbit; - mon_get.get(is_it02, end, true, iss, err02, result2); - VERIFY( result2 == digits1 ); - VERIFY( err02 == ios_base::eofbit ); - - iss.str("7.200.000.000,00 a"); - iterator_type is_it03(iss); - string result3; - ios_base::iostate err03 = ios_base::goodbit; - mon_get.get(is_it03, end, true, iss, err03, result3); - VERIFY( result3 == digits1 ); - VERIFY( err03 == ios_base::goodbit ); - - iss.str(""); - iterator_type is_it04(iss); - string result4; - ios_base::iostate err04 = ios_base::goodbit; - mon_get.get(is_it04, end, true, iss, err04, result4); - VERIFY( result4 == empty ); - VERIFY( err04 == ios_base::failbit | ios_base::eofbit ); - - iss.str("working for enlightenment and peace in a mad world"); - iterator_type is_it05(iss); - string result5; - ios_base::iostate err05 = ios_base::goodbit; - mon_get.get(is_it05, end, true, iss, err05, result5); - VERIFY( result5 == empty ); - VERIFY( err05 == ios_base::failbit ); - - // now try with showbase, to get currency symbol in format - iss.setf(ios_base::showbase); - - iss.str("7.200.000.000,00 EUR "); - iterator_type is_it06(iss); - string result6; - ios_base::iostate err06 = ios_base::goodbit; - mon_get.get(is_it06, end, true, iss, err06, result6); - VERIFY( result6 == digits1 ); - VERIFY( err06 == ios_base::eofbit ); - - iss.str("7.200.000.000,00 EUR "); // Extra space. - iterator_type is_it07(iss); - string result7; - ios_base::iostate err07 = ios_base::goodbit; - mon_get.get(is_it07, end, true, iss, err07, result7); - VERIFY( result7 == digits1 ); - VERIFY( err07 == ios_base::goodbit ); - - iss.str("7.200.000.000,00 \244"); - iterator_type is_it08(iss); - string result8; - ios_base::iostate err08 = ios_base::goodbit; - mon_get.get(is_it08, end, false, iss, err08, result8); - VERIFY( result8 == digits1 ); - VERIFY( err08 == ios_base::eofbit ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/2.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/2.cc deleted file mode 100644 index 42e149609a0..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/2.cc +++ /dev/null @@ -1,140 +0,0 @@ -// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// test string version -void test02() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - typedef istreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE@euro"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the moneypunct facets - typedef moneypunct<char, true> __money_true; - typedef moneypunct<char, false> __money_false; - const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c); - const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de); - const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c); - const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de); - const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk); - const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk); - - // sanity check the data is correct. - const string empty; - - // total EPA budget FY 2002 - const string digits1("720000000000"); - - // est. cost, national missile "defense", expressed as a loss in USD 2001 - const string digits2("-10000000000000"); - - // not valid input - const string digits3("-A"); - - // input less than frac_digits - const string digits4("-1"); - - iterator_type end; - istringstream iss; - iss.imbue(loc_hk); - // cache the money_get facet - const money_get<char>& mon_get = use_facet<money_get<char> >(iss.getloc()); - - // now try with showbase, to get currency symbol in format - iss.setf(ios_base::showbase); - - iss.str("HK$7,200,000,000.00"); - iterator_type is_it09(iss); - string result9; - ios_base::iostate err09 = ios_base::goodbit; - mon_get.get(is_it09, end, false, iss, err09, result9); - VERIFY( result9 == digits1 ); - VERIFY( err09 == ios_base::eofbit ); - - iss.str("(HKD 100,000,000,000.00)"); - iterator_type is_it10(iss); - string result10; - ios_base::iostate err10 = ios_base::goodbit; - mon_get.get(is_it10, end, true, iss, err10, result10); - VERIFY( result10 == digits2 ); - VERIFY( err10 == ios_base::goodbit ); - - iss.str("(HKD .01)"); - iterator_type is_it11(iss); - string result11; - ios_base::iostate err11 = ios_base::goodbit; - mon_get.get(is_it11, end, true, iss, err11, result11); - VERIFY( result11 == digits4 ); - VERIFY( err11 == ios_base::goodbit ); - - // for the "en_HK" locale the parsing of the very same input streams must - // be successful without showbase too, since the symbol field appears in - // the first positions in the format and the symbol, when present, must be - // consumed. - iss.unsetf(ios_base::showbase); - - iss.str("HK$7,200,000,000.00"); - iterator_type is_it12(iss); - string result12; - ios_base::iostate err12 = ios_base::goodbit; - mon_get.get(is_it12, end, false, iss, err12, result12); - VERIFY( result12 == digits1 ); - VERIFY( err12 == ios_base::eofbit ); - - iss.str("(HKD 100,000,000,000.00)"); - iterator_type is_it13(iss); - string result13; - ios_base::iostate err13 = ios_base::goodbit; - mon_get.get(is_it13, end, true, iss, err13, result13); - VERIFY( result13 == digits2 ); - VERIFY( err13 == ios_base::goodbit ); - - iss.str("(HKD .01)"); - iterator_type is_it14(iss); - string result14; - ios_base::iostate err14 = ios_base::goodbit; - mon_get.get(is_it14, end, true, iss, err14, result14); - VERIFY( result14 == digits4 ); - VERIFY( err14 == ios_base::goodbit ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/3.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/3.cc deleted file mode 100644 index 749c68c73ab..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/3.cc +++ /dev/null @@ -1,96 +0,0 @@ -// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// test double version -void test03() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - typedef istreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE@euro"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the moneypunct facets - typedef moneypunct<char, true> __money_true; - typedef moneypunct<char, false> __money_false; - const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c); - const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de); - const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c); - const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de); - const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk); - const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk); - - // sanity check the data is correct. - const string empty; - - // total EPA budget FY 2002 - const long double digits1 = 720000000000.0; - - // est. cost, national missile "defense", expressed as a loss in USD 2001 - const long double digits2 = -10000000000000.0; - - // input less than frac_digits - const long double digits4 = -1.0; - - iterator_type end; - istringstream iss; - iss.imbue(loc_de); - // cache the money_get facet - const money_get<char>& mon_get = use_facet<money_get<char> >(iss.getloc()); - - iss.str("7.200.000.000,00 "); - iterator_type is_it01(iss); - long double result1; - ios_base::iostate err01 = ios_base::goodbit; - mon_get.get(is_it01, end, true, iss, err01, result1); - VERIFY( result1 == digits1 ); - VERIFY( err01 == ios_base::eofbit ); - - iss.str("7.200.000.000,00 "); - iterator_type is_it02(iss); - long double result2; - ios_base::iostate err02 = ios_base::goodbit; - mon_get.get(is_it02, end, false, iss, err02, result2); - VERIFY( result2 == digits1 ); - VERIFY( err02 == ios_base::eofbit ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/4.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/4.cc deleted file mode 100644 index b2456658e56..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/4.cc +++ /dev/null @@ -1,91 +0,0 @@ -// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// test double version -void test04() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - typedef istreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE@euro"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the moneypunct facets - typedef moneypunct<char, true> __money_true; - typedef moneypunct<char, false> __money_false; - const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c); - const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de); - const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c); - const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de); - const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk); - const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk); - - // sanity check the data is correct. - const string empty; - - // total EPA budget FY 2002 - const long double digits1 = 720000000000.0; - - // est. cost, national missile "defense", expressed as a loss in USD 2001 - const long double digits2 = -10000000000000.0; - - // input less than frac_digits - const long double digits4 = -1.0; - - iterator_type end; - istringstream iss; - iss.imbue(loc_hk); - // cache the money_get facet - const money_get<char>& mon_get = use_facet<money_get<char> >(iss.getloc()); - - // now try with showbase, to get currency symbol in format - iss.setf(ios_base::showbase); - - iss.str("(HKD .01)"); - iterator_type is_it03(iss); - long double result3; - ios_base::iostate err03 = ios_base::goodbit; - mon_get.get(is_it03, end, true, iss, err03, result3); - VERIFY( result3 == digits4 ); - VERIFY( err03 == ios_base::goodbit ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test04); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/5.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/5.cc deleted file mode 100644 index f886c887ebd..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/5.cc +++ /dev/null @@ -1,71 +0,0 @@ -// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test05() -{ - using namespace std; - bool test = true; - - // Check money_get works with other iterators besides streambuf - // input iterators. - typedef string::const_iterator iter_type; - typedef money_get<char, iter_type> mon_get_type; - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = goodbit; - const locale loc_c = locale::classic(); - const string str = "0.01Eleanor Roosevelt"; - - istringstream iss; - iss.imbue(locale(loc_c, new mon_get_type)); - - // Iterator advanced, state, output. - const mon_get_type& mg = use_facet<mon_get_type>(iss.getloc()); - - // 01 string - string res1; - iter_type end1 = mg.get(str.begin(), str.end(), false, iss, err, res1); - string rem1(end1, str.end()); - VERIFY( err == goodbit ); - VERIFY( res1 == "1" ); - VERIFY( rem1 == "Eleanor Roosevelt" ); - - // 02 long double - iss.clear(); - err = goodbit; - long double res2; - iter_type end2 = mg.get(str.begin(), str.end(), false, iss, err, res2); - string rem2(end2, str.end()); - VERIFY( err == goodbit ); - VERIFY( res2 == 1 ); - VERIFY( rem2 == "Eleanor Roosevelt" ); -} - -int main() -{ - test05(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/6.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/6.cc deleted file mode 100644 index f9afb1e1fa4..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/6.cc +++ /dev/null @@ -1,104 +0,0 @@ -// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -struct My_money_io : public std::moneypunct<char,false> -{ - char_type do_decimal_point() const { return '.'; } - std::string do_grouping() const { return "\004"; } - - std::string do_curr_symbol() const { return "$"; } - std::string do_positive_sign() const { return ""; } - std::string do_negative_sign() const { return "-"; } - - int do_frac_digits() const { return 2; } - - pattern do_pos_format() const - { - pattern pat = { { symbol, none, sign, value } }; - return pat; - } - - pattern do_neg_format() const - { - pattern pat = { { symbol, none, sign, value } }; - return pat; - } -}; - -// libstdc++/5579 -void test06() -{ - using namespace std; - typedef istreambuf_iterator<char> InIt; - - bool test = true; - - locale loc(locale::classic(), new My_money_io); - - string bufferp("$1234.56"); - string buffern("$-1234.56"); - string bufferp_ns("1234.56"); - string buffern_ns("-1234.56"); - - bool intl = false; - - InIt iendp, iendn, iendp_ns, iendn_ns; - ios_base::iostate err; - string valp, valn, valp_ns, valn_ns; - - const money_get<char,InIt>& mg = - use_facet<money_get<char, InIt> >(loc); - - istringstream fmtp(bufferp); - fmtp.imbue(loc); - InIt ibegp(fmtp); - mg.get(ibegp,iendp,intl,fmtp,err,valp); - VERIFY( valp == "123456" ); - - istringstream fmtn(buffern); - fmtn.imbue(loc); - InIt ibegn(fmtn); - mg.get(ibegn,iendn,intl,fmtn,err,valn); - VERIFY( valn == "-123456" ); - - istringstream fmtp_ns(bufferp_ns); - fmtp_ns.imbue(loc); - InIt ibegp_ns(fmtp_ns); - mg.get(ibegp_ns,iendp_ns,intl,fmtp_ns,err,valp_ns); - VERIFY( valp_ns == "123456" ); - - istringstream fmtn_ns(buffern_ns); - fmtn_ns.imbue(loc); - InIt ibegn_ns(fmtn_ns); - mg.get(ibegn_ns,iendn_ns,intl,fmtn_ns,err,valn_ns); - VERIFY( valn_ns == "-123456" ); -} - -int main() -{ - test06(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/7.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/7.cc deleted file mode 100644 index f275d4e59d4..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/7.cc +++ /dev/null @@ -1,70 +0,0 @@ -// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// We were appending to the string val passed by reference, instead -// of constructing a temporary candidate, eventually copied into -// val in case of successful parsing. -void test07() -{ - using namespace std; - bool test = true; - - typedef istreambuf_iterator<char> InIt; - InIt iend1, iend2, iend3; - - locale loc_c = locale::classic(); - string buffer1("123"); - string buffer2("456"); - string buffer3("Golgafrincham"); // From Nathan's original idea. - - string val; - - ios_base::iostate err; - - const money_get<char,InIt>& mg = use_facet<money_get<char, InIt> >(loc_c); - - istringstream fmt1(buffer1); - InIt ibeg1(fmt1); - mg.get(ibeg1,iend1,false,fmt1,err,val); - VERIFY( val == buffer1 ); - - istringstream fmt2(buffer2); - InIt ibeg2(fmt2); - mg.get(ibeg2,iend2,false,fmt2,err,val); - VERIFY( val == buffer2 ); - - val = buffer3; - istringstream fmt3(buffer3); - InIt ibeg3(fmt3); - mg.get(ibeg3,iend3,false,fmt3,err,val); - VERIFY( val == buffer3 ); -} - -int main() -{ - test07(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/8.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/8.cc deleted file mode 100644 index 8c811e99a63..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/8.cc +++ /dev/null @@ -1,123 +0,0 @@ -// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -struct My_money_io_a : public std::moneypunct<char,false> -{ - char_type do_decimal_point() const { return '.'; } - std::string do_grouping() const { return "\004"; } - - std::string do_curr_symbol() const { return "$"; } - std::string do_positive_sign() const { return "()"; } - - int do_frac_digits() const { return 2; } - - pattern do_pos_format() const - { - pattern pat = { { sign, value, space, symbol } }; - return pat; - } -}; - -struct My_money_io_b : public std::moneypunct<char,false> -{ - char_type do_decimal_point() const { return '.'; } - std::string do_grouping() const { return "\004"; } - - std::string do_curr_symbol() const { return "$"; } - std::string do_positive_sign() const { return "()"; } - - int do_frac_digits() const { return 2; } - - pattern do_pos_format() const - { - pattern pat = { { sign, value, symbol, none } }; - return pat; - } -}; - -// This one exercises patterns of the type { X, Y, Z, symbol } and -// { X, Y, symbol, none } for a two character long sign. Therefore -// the optional symbol (showbase is false by default) must be consumed -// if present, since "rest of the sign" is left to read. -void test08() -{ - using namespace std; - typedef istreambuf_iterator<char> InIt; - - bool intl = false; - bool test = true; - ios_base::iostate err; - - locale loc_a(locale::classic(), new My_money_io_a); - - string buffer_a("(1234.56 $)"); - string buffer_a_ns("(1234.56 )"); - - InIt iend_a, iend_a_ns; - string val_a, val_a_ns; - - const money_get<char,InIt>& mg_a = use_facet<money_get<char, InIt> >(loc_a); - - istringstream fmt_a(buffer_a); - fmt_a.imbue(loc_a); - InIt ibeg_a(fmt_a); - mg_a.get(ibeg_a,iend_a,intl,fmt_a,err,val_a); - VERIFY( val_a == "123456" ); - - istringstream fmt_a_ns(buffer_a_ns); - fmt_a_ns.imbue(loc_a); - InIt ibeg_a_ns(fmt_a_ns); - mg_a.get(ibeg_a_ns,iend_a_ns,intl,fmt_a_ns,err,val_a_ns); - VERIFY( val_a_ns == "123456" ); - - locale loc_b(locale::classic(), new My_money_io_b); - - string buffer_b("(1234.56$)"); - string buffer_b_ns("(1234.56)"); - - InIt iend_b, iend_b_ns; - string val_b, val_b_ns; - - const money_get<char,InIt>& mg_b = use_facet<money_get<char, InIt> >(loc_b); - - istringstream fmt_b(buffer_b); - fmt_b.imbue(loc_b); - InIt ibeg_b(fmt_b); - mg_b.get(ibeg_b,iend_b,intl,fmt_b,err,val_b); - VERIFY( val_b == "123456" ); - - istringstream fmt_b_ns(buffer_b_ns); - fmt_b_ns.imbue(loc_b); - InIt ibeg_b_ns(fmt_b_ns); - mg_b.get(ibeg_b_ns,iend_b_ns,intl,fmt_b_ns,err,val_b_ns); - VERIFY( val_b_ns == "123456" ); -} - -int main() -{ - test08(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/wrapped_env.cc deleted file mode 100644 index b9872d9c7b0..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/wrapped_env.cc +++ /dev/null @@ -1,71 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -#define main discard_main_6 -#include "6.cc" -#undef main - -#define main discard_main_7 -#include "7.cc" -#undef main - -#define main discard_main_8 -#include "8.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - two.push_back(&test06); - two.push_back(&test07); - two.push_back(&test08); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/wrapped_locale.cc deleted file mode 100644 index 996af345b58..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/wrapped_locale.cc +++ /dev/null @@ -1,71 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -#define main discard_main_6 -#include "6.cc" -#undef main - -#define main discard_main_7 -#include "7.cc" -#undef main - -#define main discard_main_8 -#include "8.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - two.push_back(&test06); - two.push_back(&test07); - two.push_back(&test08); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/1.cc deleted file mode 100644 index d8d86f2cfaf..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/1.cc +++ /dev/null @@ -1,151 +0,0 @@ -// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// test wstring version -void test01() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE@euro"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the moneypunct facets - typedef moneypunct<wchar_t, true> __money_true; - typedef moneypunct<wchar_t, false> __money_false; - const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c); - const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de); - const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c); - const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de); - const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk); - const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk); - - // sanity check the data is correct. - const wstring empty; - - // total EPA budget FY 2002 - const wstring digits1(L"720000000000"); - - // est. cost, national missile "defense", expressed as a loss in USD 2001 - const wstring digits2(L"-10000000000000"); - - // not valid input - const wstring digits3(L"-A"); - - // input less than frac_digits - const wstring digits4(L"-1"); - - iterator_type end; - wistringstream iss; - iss.imbue(loc_de); - // cache the money_get facet - const money_get<wchar_t>& mon_get = use_facet<money_get<wchar_t> >(iss.getloc()); - - - iss.str(L"7.200.000.000,00 "); - iterator_type is_it01(iss); - wstring result1; - ios_base::iostate err01 = ios_base::goodbit; - mon_get.get(is_it01, end, true, iss, err01, result1); - VERIFY( result1 == digits1 ); - VERIFY( err01 == ios_base::eofbit ); - - iss.str(L"7.200.000.000,00 "); - iterator_type is_it02(iss); - wstring result2; - ios_base::iostate err02 = ios_base::goodbit; - mon_get.get(is_it02, end, true, iss, err02, result2); - VERIFY( result2 == digits1 ); - VERIFY( err02 == ios_base::eofbit ); - - iss.str(L"7.200.000.000,00 a"); - iterator_type is_it03(iss); - wstring result3; - ios_base::iostate err03 = ios_base::goodbit; - mon_get.get(is_it03, end, true, iss, err03, result3); - VERIFY( result3 == digits1 ); - VERIFY( err03 == ios_base::goodbit ); - - iss.str(L""); - iterator_type is_it04(iss); - wstring result4; - ios_base::iostate err04 = ios_base::goodbit; - mon_get.get(is_it04, end, true, iss, err04, result4); - VERIFY( result4 == empty ); - VERIFY( err04 == ios_base::failbit | ios_base::eofbit ); - - iss.str(L"working for enlightenment and peace in a mad world"); - iterator_type is_it05(iss); - wstring result5; - ios_base::iostate err05 = ios_base::goodbit; - mon_get.get(is_it05, end, true, iss, err05, result5); - VERIFY( result5 == empty ); - VERIFY( err05 == ios_base::failbit ); - - // now try with showbase, to get currency symbol in format - iss.setf(ios_base::showbase); - - iss.str(L"7.200.000.000,00 EUR "); - iterator_type is_it06(iss); - wstring result6; - ios_base::iostate err06 = ios_base::goodbit; - mon_get.get(is_it06, end, true, iss, err06, result6); - VERIFY( result6 == digits1 ); - VERIFY( err06 == ios_base::eofbit ); - - iss.str(L"7.200.000.000,00 EUR "); // Extra space. - iterator_type is_it07(iss); - wstring result7; - ios_base::iostate err07 = ios_base::goodbit; - mon_get.get(is_it07, end, true, iss, err07, result7); - VERIFY( result7 == digits1 ); - VERIFY( err07 == ios_base::goodbit ); - - iss.str(L"7.200.000.000,00 \x20ac"); - iterator_type is_it08(iss); - wstring result8; - ios_base::iostate err08 = ios_base::goodbit; - mon_get.get(is_it08, end, false, iss, err08, result8); - VERIFY( result8 == digits1 ); - VERIFY( err08 == ios_base::eofbit ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/2.cc deleted file mode 100644 index 9b3c8741e32..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/2.cc +++ /dev/null @@ -1,140 +0,0 @@ -// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// test wstring version -void test02() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE@euro"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the moneypunct facets - typedef moneypunct<wchar_t, true> __money_true; - typedef moneypunct<wchar_t, false> __money_false; - const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c); - const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de); - const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c); - const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de); - const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk); - const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk); - - // sanity check the data is correct. - const wstring empty; - - // total EPA budget FY 2002 - const wstring digits1(L"720000000000"); - - // est. cost, national missile "defense", expressed as a loss in USD 2001 - const wstring digits2(L"-10000000000000"); - - // not valid input - const wstring digits3(L"-A"); - - // input less than frac_digits - const wstring digits4(L"-1"); - - iterator_type end; - wistringstream iss; - iss.imbue(loc_hk); - // cache the money_get facet - const money_get<wchar_t>& mon_get = use_facet<money_get<wchar_t> >(iss.getloc()); - - // now try with showbase, to get currency symbol in format - iss.setf(ios_base::showbase); - - iss.str(L"HK$7,200,000,000.00"); - iterator_type is_it09(iss); - wstring result9; - ios_base::iostate err09 = ios_base::goodbit; - mon_get.get(is_it09, end, false, iss, err09, result9); - VERIFY( result9 == digits1 ); - VERIFY( err09 == ios_base::eofbit ); - - iss.str(L"(HKD 100,000,000,000.00)"); - iterator_type is_it10(iss); - wstring result10; - ios_base::iostate err10 = ios_base::goodbit; - mon_get.get(is_it10, end, true, iss, err10, result10); - VERIFY( result10 == digits2 ); - VERIFY( err10 == ios_base::goodbit ); - - iss.str(L"(HKD .01)"); - iterator_type is_it11(iss); - wstring result11; - ios_base::iostate err11 = ios_base::goodbit; - mon_get.get(is_it11, end, true, iss, err11, result11); - VERIFY( result11 == digits4 ); - VERIFY( err11 == ios_base::goodbit ); - - // for the "en_HK" locale the parsing of the very same input streams must - // be successful without showbase too, since the symbol field appears in - // the first positions in the format and the symbol, when present, must be - // consumed. - iss.unsetf(ios_base::showbase); - - iss.str(L"HK$7,200,000,000.00"); - iterator_type is_it12(iss); - wstring result12; - ios_base::iostate err12 = ios_base::goodbit; - mon_get.get(is_it12, end, false, iss, err12, result12); - VERIFY( result12 == digits1 ); - VERIFY( err12 == ios_base::eofbit ); - - iss.str(L"(HKD 100,000,000,000.00)"); - iterator_type is_it13(iss); - wstring result13; - ios_base::iostate err13 = ios_base::goodbit; - mon_get.get(is_it13, end, true, iss, err13, result13); - VERIFY( result13 == digits2 ); - VERIFY( err13 == ios_base::goodbit ); - - iss.str(L"(HKD .01)"); - iterator_type is_it14(iss); - wstring result14; - ios_base::iostate err14 = ios_base::goodbit; - mon_get.get(is_it14, end, true, iss, err14, result14); - VERIFY( result14 == digits4 ); - VERIFY( err14 == ios_base::goodbit ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/3.cc deleted file mode 100644 index 747b4944494..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/3.cc +++ /dev/null @@ -1,96 +0,0 @@ -// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// test double version -void test03() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE@euro"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the moneypunct facets - typedef moneypunct<wchar_t, true> __money_true; - typedef moneypunct<wchar_t, false> __money_false; - const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c); - const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de); - const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c); - const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de); - const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk); - const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk); - - // sanity check the data is correct. - const wstring empty; - - // total EPA budget FY 2002 - const long double digits1 = 720000000000.0; - - // est. cost, national missile "defense", expressed as a loss in USD 2001 - const long double digits2 = -10000000000000.0; - - // input less than frac_digits - const long double digits4 = -1.0; - - iterator_type end; - wistringstream iss; - iss.imbue(loc_de); - // cache the money_get facet - const money_get<wchar_t>& mon_get = use_facet<money_get<wchar_t> >(iss.getloc()); - - iss.str(L"7.200.000.000,00 "); - iterator_type is_it01(iss); - long double result1; - ios_base::iostate err01 = ios_base::goodbit; - mon_get.get(is_it01, end, true, iss, err01, result1); - VERIFY( result1 == digits1 ); - VERIFY( err01 == ios_base::eofbit ); - - iss.str(L"7.200.000.000,00 "); - iterator_type is_it02(iss); - long double result2; - ios_base::iostate err02 = ios_base::goodbit; - mon_get.get(is_it02, end, false, iss, err02, result2); - VERIFY( result2 == digits1 ); - VERIFY( err02 == ios_base::eofbit ); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/4.cc deleted file mode 100644 index 030c47a2994..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/4.cc +++ /dev/null @@ -1,91 +0,0 @@ -// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// test double version -void test04() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE@euro"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the moneypunct facets - typedef moneypunct<wchar_t, true> __money_true; - typedef moneypunct<wchar_t, false> __money_false; - const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c); - const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de); - const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c); - const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de); - const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk); - const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk); - - // sanity check the data is correct. - const wstring empty; - - // total EPA budget FY 2002 - const long double digits1 = 720000000000.0; - - // est. cost, national missile "defense", expressed as a loss in USD 2001 - const long double digits2 = -10000000000000.0; - - // input less than frac_digits - const long double digits4 = -1.0; - - iterator_type end; - wistringstream iss; - iss.imbue(loc_hk); - // cache the money_get facet - const money_get<wchar_t>& mon_get = use_facet<money_get<wchar_t> >(iss.getloc()); - - // now try with showbase, to get currency symbol in format - iss.setf(ios_base::showbase); - - iss.str(L"(HKD .01)"); - iterator_type is_it03(iss); - long double result3; - ios_base::iostate err03 = ios_base::goodbit; - mon_get.get(is_it03, end, true, iss, err03, result3); - VERIFY( result3 == digits4 ); - VERIFY( err03 == ios_base::goodbit ); -} - -int main() -{ - test04(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/5.cc deleted file mode 100644 index fd0c53ef313..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/5.cc +++ /dev/null @@ -1,71 +0,0 @@ -// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test05() -{ - using namespace std; - bool test = true; - - // Check money_get works with other iterators besides streambuf - // input iterators. - typedef wstring::const_iterator iter_type; - typedef money_get<wchar_t, iter_type> mon_get_type; - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = goodbit; - const locale loc_c = locale::classic(); - const wstring str = L"0.01Eleanor Roosevelt"; - - wistringstream iss; - iss.imbue(locale(loc_c, new mon_get_type)); - - // Iterator advanced, state, output. - const mon_get_type& mg = use_facet<mon_get_type>(iss.getloc()); - - // 01 wstring - wstring res1; - iter_type end1 = mg.get(str.begin(), str.end(), false, iss, err, res1); - wstring rem1(end1, str.end()); - VERIFY( err == goodbit ); - VERIFY( res1 == L"1" ); - VERIFY( rem1 == L"Eleanor Roosevelt" ); - - // 02 long double - iss.clear(); - err = goodbit; - long double res2; - iter_type end2 = mg.get(str.begin(), str.end(), false, iss, err, res2); - wstring rem2(end2, str.end()); - VERIFY( err == goodbit ); - VERIFY( res2 == 1 ); - VERIFY( rem2 == L"Eleanor Roosevelt" ); -} - -int main() -{ - test05(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/6.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/6.cc deleted file mode 100644 index 0015cd92ca6..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/6.cc +++ /dev/null @@ -1,102 +0,0 @@ -// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -struct My_money_io : public std::moneypunct<wchar_t,false> -{ - char_type do_decimal_point() const { return '.'; } - std::string do_grouping() const { return "\004"; } - - std::wstring do_curr_symbol() const { return L"$"; } - std::wstring do_positive_sign() const { return L""; } - std::wstring do_negative_sign() const { return L"-"; } - - int do_frac_digits() const { return 2; } - - pattern do_pos_format() const - { - pattern pat = { { symbol, none, sign, value } }; - return pat; - } - - pattern do_neg_format() const - { - pattern pat = { { symbol, none, sign, value } }; - return pat; - } -}; - -// libstdc++/5579 -void test06() -{ - using namespace std; - typedef istreambuf_iterator<wchar_t> InIt; - - bool test = true; - - locale loc(locale::classic(), new My_money_io); - - wstring bufferp(L"$1234.56"); - wstring buffern(L"$-1234.56"); - wstring bufferp_ns(L"1234.56"); - wstring buffern_ns(L"-1234.56"); - - bool intl = false; - - InIt iendp, iendn, iendp_ns, iendn_ns; - ios_base::iostate err; - wstring valp, valn, valp_ns, valn_ns; - - const money_get<wchar_t,InIt>& mg = use_facet<money_get<wchar_t, InIt> >(loc); - wistringstream fmtp(bufferp); - fmtp.imbue(loc); - InIt ibegp(fmtp); - mg.get(ibegp,iendp,intl,fmtp,err,valp); - VERIFY( valp == L"123456" ); - - wistringstream fmtn(buffern); - fmtn.imbue(loc); - InIt ibegn(fmtn); - mg.get(ibegn,iendn,intl,fmtn,err,valn); - VERIFY( valn == L"-123456" ); - - wistringstream fmtp_ns(bufferp_ns); - fmtp_ns.imbue(loc); - InIt ibegp_ns(fmtp_ns); - mg.get(ibegp_ns,iendp_ns,intl,fmtp_ns,err,valp_ns); - VERIFY( valp_ns == L"123456" ); - - wistringstream fmtn_ns(buffern_ns); - fmtn_ns.imbue(loc); - InIt ibegn_ns(fmtn_ns); - mg.get(ibegn_ns,iendn_ns,intl,fmtn_ns,err,valn_ns); - VERIFY( valn_ns == L"-123456" ); -} - -int main() -{ - test06(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/7.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/7.cc deleted file mode 100644 index bf8615f1748..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/7.cc +++ /dev/null @@ -1,70 +0,0 @@ -// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// We were appending to the string val passed by reference, instead -// of constructing a temporary candidate, eventually copied into -// val in case of successful parsing. -void test07() -{ - using namespace std; - bool test = true; - - typedef istreambuf_iterator<wchar_t> InIt; - InIt iend1, iend2, iend3; - - locale loc_c = locale::classic(); - wstring buffer1(L"123"); - wstring buffer2(L"456"); - wstring buffer3(L"Golgafrincham"); // From Nathan's original idea. - - wstring val; - - ios_base::iostate err; - - const money_get<wchar_t,InIt>& mg = use_facet<money_get<wchar_t, InIt> >(loc_c); - - wistringstream fmt1(buffer1); - InIt ibeg1(fmt1); - mg.get(ibeg1,iend1,false,fmt1,err,val); - VERIFY( val == buffer1 ); - - wistringstream fmt2(buffer2); - InIt ibeg2(fmt2); - mg.get(ibeg2,iend2,false,fmt2,err,val); - VERIFY( val == buffer2 ); - - val = buffer3; - wistringstream fmt3(buffer3); - InIt ibeg3(fmt3); - mg.get(ibeg3,iend3,false,fmt3,err,val); - VERIFY( val == buffer3 ); -} - -int main() -{ - test07(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/8.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/8.cc deleted file mode 100644 index ab1de4d3e10..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/8.cc +++ /dev/null @@ -1,123 +0,0 @@ -// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -struct My_money_io_a : public std::moneypunct<wchar_t,false> -{ - char_type do_decimal_point() const { return '.'; } - std::string do_grouping() const { return "\004"; } - - std::wstring do_curr_symbol() const { return L"$"; } - std::wstring do_positive_sign() const { return L"()"; } - - int do_frac_digits() const { return 2; } - - pattern do_pos_format() const - { - pattern pat = { { sign, value, space, symbol } }; - return pat; - } -}; - -struct My_money_io_b : public std::moneypunct<wchar_t,false> -{ - char_type do_decimal_point() const { return '.'; } - std::string do_grouping() const { return "\004"; } - - std::wstring do_curr_symbol() const { return L"$"; } - std::wstring do_positive_sign() const { return L"()"; } - - int do_frac_digits() const { return 2; } - - pattern do_pos_format() const - { - pattern pat = { { sign, value, symbol, none } }; - return pat; - } -}; - -// This one exercises patterns of the type { X, Y, Z, symbol } and -// { X, Y, symbol, none } for a two character long sign. Therefore -// the optional symbol (showbase is false by default) must be consumed -// if present, since "rest of the sign" is left to read. -void test08() -{ - using namespace std; - typedef istreambuf_iterator<wchar_t> InIt; - - bool intl = false; - bool test = true; - ios_base::iostate err; - - locale loc_a(locale::classic(), new My_money_io_a); - - wstring buffer_a(L"(1234.56 $)"); - wstring buffer_a_ns(L"(1234.56 )"); - - InIt iend_a, iend_a_ns; - wstring val_a, val_a_ns; - - const money_get<wchar_t,InIt>& mg_a = use_facet<money_get<wchar_t, InIt> >(loc_a); - - wistringstream fmt_a(buffer_a); - fmt_a.imbue(loc_a); - InIt ibeg_a(fmt_a); - mg_a.get(ibeg_a,iend_a,intl,fmt_a,err,val_a); - VERIFY( val_a == L"123456" ); - - wistringstream fmt_a_ns(buffer_a_ns); - fmt_a_ns.imbue(loc_a); - InIt ibeg_a_ns(fmt_a_ns); - mg_a.get(ibeg_a_ns,iend_a_ns,intl,fmt_a_ns,err,val_a_ns); - VERIFY( val_a_ns == L"123456" ); - - locale loc_b(locale::classic(), new My_money_io_b); - - wstring buffer_b(L"(1234.56$)"); - wstring buffer_b_ns(L"(1234.56)"); - - InIt iend_b, iend_b_ns; - wstring val_b, val_b_ns; - - const money_get<wchar_t,InIt>& mg_b = use_facet<money_get<wchar_t, InIt> >(loc_b); - - wistringstream fmt_b(buffer_b); - fmt_b.imbue(loc_b); - InIt ibeg_b(fmt_b); - mg_b.get(ibeg_b,iend_b,intl,fmt_b,err,val_b); - VERIFY( val_b == L"123456" ); - - wistringstream fmt_b_ns(buffer_b_ns); - fmt_b_ns.imbue(loc_b); - InIt ibeg_b_ns(fmt_b_ns); - mg_b.get(ibeg_b_ns,iend_b_ns,intl,fmt_b_ns,err,val_b_ns); - VERIFY( val_b_ns == L"123456" ); -} - -int main() -{ - test08(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/wrapped_env.cc deleted file mode 100644 index b9872d9c7b0..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,71 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -#define main discard_main_6 -#include "6.cc" -#undef main - -#define main discard_main_7 -#include "7.cc" -#undef main - -#define main discard_main_8 -#include "8.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - two.push_back(&test06); - two.push_back(&test07); - two.push_back(&test08); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/wrapped_locale.cc deleted file mode 100644 index 996af345b58..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,71 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -#define main discard_main_6 -#include "6.cc" -#undef main - -#define main discard_main_7 -#include "7.cc" -#undef main - -#define main discard_main_8 -#include "8.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - two.push_back(&test06); - two.push_back(&test07); - two.push_back(&test08); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_put/1.cc b/libstdc++-v3/testsuite/22_locale/money_put/1.cc deleted file mode 100644 index e4f27c723db..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_put/1.cc +++ /dev/null @@ -1,44 +0,0 @@ -// { dg-do compile } -// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.2 Template class money_put - -#include <locale> - -void test01() -{ - // Check for required base class. - typedef std::money_put<char> test_type; - typedef std::locale::facet base_type; - const test_type& obj = std::use_facet<test_type>(std::locale()); - const base_type* base = &obj; - - // Check for required typedefs - typedef test_type::char_type char_type; - typedef test_type::string_type string_type; - typedef test_type::iter_type iter_type; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_put/2.cc b/libstdc++-v3/testsuite/22_locale/money_put/2.cc deleted file mode 100644 index 13f57a95637..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_put/2.cc +++ /dev/null @@ -1,39 +0,0 @@ -// { dg-do compile } -// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.2 Template class money_put - -#include <locale> - -// Should be able to instantiate this for other types besides char, wchar_t -class gnu_money_put: public std::money_put<unsigned char> -{ }; - -void test02() -{ - gnu_money_put facet01; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/1.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/1.cc deleted file mode 100644 index d34d3fba0e7..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_put/put/char/1.cc +++ /dev/null @@ -1,129 +0,0 @@ -// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.2.1 money_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// test string version -void test01() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - typedef ostreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE@euro"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the moneypunct facets - typedef moneypunct<char, true> __money_true; - typedef moneypunct<char, false> __money_false; - const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c); - const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de); - const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c); - const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de); - const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk); - const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk); - - // sanity check the data is correct. - const string empty; - - // total EPA budget FY 2002 - const string digits1("720000000000"); - - // est. cost, national missile "defense", expressed as a loss in USD 2001 - const string digits2("-10000000000000"); - - // not valid input - const string digits3("-A"); - - // input less than frac_digits - const string digits4("-1"); - - // cache the money_put facet - ostringstream oss; - oss.imbue(loc_de); - const money_put<char>& mon_put = use_facet<money_put<char> >(oss.getloc()); - - iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1); - string result1 = oss.str(); - VERIFY( result1 == "7.200.000.000,00 "); - - oss.str(empty); - iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1); - string result2 = oss.str(); - VERIFY( result2 == "7.200.000.000,00 "); - - // intl and non-intl versions should be the same. - VERIFY( result1 == result2 ); - - // now try with showbase, to get currency symbol in format - oss.setf(ios_base::showbase); - - oss.str(empty); - iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1); - string result3 = oss.str(); - VERIFY( result3 == "7.200.000.000,00 EUR "); - - oss.str(empty); - iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1); - string result4 = oss.str(); - VERIFY( result4 == "7.200.000.000,00 \244"); - - // intl and non-intl versions should be different. - VERIFY( result3 != result4 ); - VERIFY( result3 != result1 ); - VERIFY( result4 != result2 ); - - oss.unsetf(ios_base::showbase); - - // test io.width() > length - // test various fill strategies - oss.str(empty); - oss.width(20); - iterator_type os_it10 = mon_put.put(oss.rdbuf(), true, oss, '*', digits4); - string result10 = oss.str(); - VERIFY( result10 == "***************-,01*"); - - oss.str(empty); - oss.width(20); - oss.setf(ios_base::internal); - iterator_type os_it11 = mon_put.put(oss.rdbuf(), true, oss, '*', digits4); - string result11 = oss.str(); - VERIFY( result11 == "-,01****************"); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/2.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/2.cc deleted file mode 100644 index d1c240f7809..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_put/put/char/2.cc +++ /dev/null @@ -1,120 +0,0 @@ -// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.2.1 money_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// test string version -void test02() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - typedef ostreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE@euro"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the moneypunct facets - typedef moneypunct<char, true> __money_true; - typedef moneypunct<char, false> __money_false; - const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c); - const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de); - const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c); - const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de); - const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk); - const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk); - - // sanity check the data is correct. - const string empty; - - // total EPA budget FY 2002 - const string digits1("720000000000"); - - // est. cost, national missile "defense", expressed as a loss in USD 2001 - const string digits2("-10000000000000"); - - // not valid input - const string digits3("-A"); - - // input less than frac_digits - const string digits4("-1"); - - // cache the money_put facet - ostringstream oss; - oss.imbue(loc_hk); - const money_put<char>& mon_put = use_facet<money_put<char> >(oss.getloc()); - - // now try with showbase, to get currency symbol in format - oss.setf(ios_base::showbase); - - // test sign of more than one digit, say hong kong. - oss.str(empty); - iterator_type os_it05 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1); - string result5 = oss.str(); - VERIFY( result5 == "HK$7,200,000,000.00"); - - oss.str(empty); - iterator_type os_it06 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits2); - string result6 = oss.str(); - VERIFY( result6 == "(HKD 100,000,000,000.00)"); - - // test one-digit formats without zero padding - oss.imbue(loc_c); - oss.str(empty); - const money_put<char>& mon_put2 = use_facet<money_put<char> >(oss.getloc()); - iterator_type os_it07 = mon_put2.put(oss.rdbuf(), true, oss, ' ', digits4); - string result7 = oss.str(); - VERIFY( result7 == "1"); - - // test one-digit formats with zero padding, zero frac widths - oss.imbue(loc_hk); - oss.str(empty); - const money_put<char>& mon_put3 = use_facet<money_put<char> >(oss.getloc()); - iterator_type os_it08 = mon_put3.put(oss.rdbuf(), true, oss, ' ', digits4); - string result8 = oss.str(); - VERIFY( result8 == "(HKD .01)"); - - oss.unsetf(ios_base::showbase); - - // test bunk input - oss.str(empty); - iterator_type os_it09 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits3); - string result9 = oss.str(); - VERIFY( result9 == ""); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/3.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/3.cc deleted file mode 100644 index 73c84b2c4d5..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_put/put/char/3.cc +++ /dev/null @@ -1,109 +0,0 @@ -// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.2.1 money_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// test double version -void test03() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - typedef ostreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE@euro"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the moneypunct facets - typedef moneypunct<char, true> __money_true; - typedef moneypunct<char, false> __money_false; - const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c); - const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de); - const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c); - const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de); - const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk); - const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk); - - // sanity check the data is correct. - const string empty; - - // total EPA budget FY 2002 - const long double digits1 = 720000000000.0; - - // est. cost, national missile "defense", expressed as a loss in USD 2001 - const long double digits2 = -10000000000000.0; - - // input less than frac_digits - const long double digits4 = -1.0; - - // cache the money_put facet - ostringstream oss; - oss.imbue(loc_de); - const money_put<char>& mon_put = use_facet<money_put<char> >(oss.getloc()); - - iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1); - string result1 = oss.str(); - VERIFY( result1 == "7.200.000.000,00 "); - - oss.str(empty); - iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1); - string result2 = oss.str(); - VERIFY( result2 == "7.200.000.000,00 "); - - // intl and non-intl versions should be the same. - VERIFY( result1 == result2 ); - - // now try with showbase, to get currency symbol in format - oss.setf(ios_base::showbase); - - oss.str(empty); - iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1); - string result3 = oss.str(); - VERIFY( result3 == "7.200.000.000,00 EUR "); - - oss.str(empty); - iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1); - string result4 = oss.str(); - VERIFY( result4 == "7.200.000.000,00 \244"); - - // intl and non-intl versions should be different. - VERIFY( result3 != result4 ); - VERIFY( result3 != result1 ); - VERIFY( result4 != result2 ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/4.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/4.cc deleted file mode 100644 index 4d4518fb776..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_put/put/char/4.cc +++ /dev/null @@ -1,73 +0,0 @@ -// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.2.1 money_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test04() -{ - using namespace std; - bool test = true; - - // Check money_put works with other iterators besides streambuf - // output iterators. (As long as output_iterator requirements are met.) - typedef string::iterator iter_type; - typedef money_put<char, iter_type> mon_put_type; - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = goodbit; - const locale loc_c = locale::classic(); - // woman, art, thief (stole the blues) - const string str("1943 Janis Joplin"); - const long double ld = 1943.0; - const string x(str.size(), 'x'); // have to have allocated string! - string res; - - ostringstream oss; - oss.imbue(locale(loc_c, new mon_put_type)); - - // Iterator advanced, state, output. - const mon_put_type& mp = use_facet<mon_put_type>(oss.getloc()); - - // 01 string - res = x; - iter_type ret1 = mp.put(res.begin(), false, oss, ' ', str); - string sanity1(res.begin(), ret1); - VERIFY( err == goodbit ); - VERIFY( res == "1943xxxxxxxxxxxxx" ); - VERIFY( sanity1 == "1943" ); - - // 02 long double - res = x; - iter_type ret2 = mp.put(res.begin(), false, oss, ' ', ld); - string sanity2(res.begin(), ret2); - VERIFY( err == goodbit ); - VERIFY( res == "1943xxxxxxxxxxxxx" ); - VERIFY( sanity2 == "1943" ); -} - -int main() -{ - test04(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/5.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/5.cc deleted file mode 100644 index 86a006d0023..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_put/put/char/5.cc +++ /dev/null @@ -1,70 +0,0 @@ -// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.2.1 money_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -struct My_money_io : public std::moneypunct<char,false> -{ - char_type do_decimal_point() const { return '.'; } - char_type do_thousands_sep() const { return ','; } - std::string do_grouping() const { return "\003"; } - - std::string do_negative_sign() const { return "()"; } - - int do_frac_digits() const { return 2; } - - pattern do_neg_format() const - { - pattern pat = { { symbol, space, sign, value } }; - return pat; - } -}; - -// libstdc++/5708 -void test05() -{ - using namespace std; - bool test = true; - typedef ostreambuf_iterator<char> OutIt; - - locale loc(locale::classic(), new My_money_io); - - bool intl = false; - - string val("-123456"); - const money_put<char,OutIt>& mp = - use_facet<money_put<char, OutIt> >(loc); - - ostringstream fmt; - fmt.imbue(loc); - OutIt out(fmt); - mp.put(out,intl,fmt,'*',val); - VERIFY( fmt.str() == "*(1,234.56)" ); -} - -int main() -{ - test05(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/6.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/6.cc deleted file mode 100644 index b663d76bbe2..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_put/put/char/6.cc +++ /dev/null @@ -1,59 +0,0 @@ -// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.2.1 money_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -struct My_money_io_2 : public std::moneypunct<char,false> -{ - char_type do_thousands_sep() const { return ','; } - std::string do_grouping() const { return "\001"; } -}; - -// Make sure we can output a very big amount of money (with grouping too). -void test06() -{ - using namespace std; - bool test = true; - typedef ostreambuf_iterator<char> OutIt; - - locale loc(locale::classic(), new My_money_io_2); - - bool intl = false; - - long double val = 1.0e50L; - const money_put<char,OutIt>& mp = - use_facet<money_put<char, OutIt> >(loc); - - ostringstream fmt; - fmt.imbue(loc); - OutIt out(fmt); - mp.put(out,intl,fmt,'*',val); - VERIFY( fmt.good() ); -} - -int main() -{ - test06(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/wrapped_env.cc deleted file mode 100644 index c04f700e5cd..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_put/put/char/wrapped_env.cc +++ /dev/null @@ -1,61 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -#define main discard_main_6 -#include "6.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - two.push_back(&test06); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/wrapped_locale.cc deleted file mode 100644 index 88f84572a91..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_put/put/char/wrapped_locale.cc +++ /dev/null @@ -1,61 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -#define main discard_main_6 -#include "6.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - two.push_back(&test06); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/1.cc deleted file mode 100644 index 400ce026ce7..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/1.cc +++ /dev/null @@ -1,129 +0,0 @@ -// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.2.1 money_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// test wstring version -void test01() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - typedef ostreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE@euro"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the moneypunct facets - typedef moneypunct<wchar_t, true> __money_true; - typedef moneypunct<wchar_t, false> __money_false; - const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c); - const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de); - const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c); - const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de); - const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk); - const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk); - - // sanity check the data is correct. - const wstring empty; - - // total EPA budget FY 2002 - const wstring digits1(L"720000000000"); - - // est. cost, national missile "defense", expressed as a loss in USD 2001 - const wstring digits2(L"-10000000000000"); - - // not valid input - const wstring digits3(L"-A"); - - // input less than frac_digits - const wstring digits4(L"-1"); - - // cache the money_put facet - wostringstream oss; - oss.imbue(loc_de); - const money_put<wchar_t>& mon_put = use_facet<money_put<wchar_t> >(oss.getloc()); - - iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1); - wstring result1 = oss.str(); - VERIFY( result1 == L"7.200.000.000,00 "); - - oss.str(empty); - iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1); - wstring result2 = oss.str(); - VERIFY( result2 == L"7.200.000.000,00 "); - - // intl and non-intl versions should be the same. - VERIFY( result1 == result2 ); - - // now try with showbase, to get currency symbol in format - oss.setf(ios_base::showbase); - - oss.str(empty); - iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1); - wstring result3 = oss.str(); - VERIFY( result3 == L"7.200.000.000,00 EUR "); - - oss.str(empty); - iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1); - wstring result4 = oss.str(); - VERIFY( result4 == L"7.200.000.000,00 \x20ac"); - - // intl and non-intl versions should be different. - VERIFY( result3 != result4 ); - VERIFY( result3 != result1 ); - VERIFY( result4 != result2 ); - - oss.unsetf(ios_base::showbase); - - // test io.width() > length - // test various fill strategies - oss.str(empty); - oss.width(20); - iterator_type os_it10 = mon_put.put(oss.rdbuf(), true, oss, '*', digits4); - wstring result10 = oss.str(); - VERIFY( result10 == L"***************-,01*"); - - oss.str(empty); - oss.width(20); - oss.setf(ios_base::internal); - iterator_type os_it11 = mon_put.put(oss.rdbuf(), true, oss, '*', digits4); - wstring result11 = oss.str(); - VERIFY( result11 == L"-,01****************"); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/2.cc deleted file mode 100644 index d99a240ff0a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/2.cc +++ /dev/null @@ -1,120 +0,0 @@ -// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.2.1 money_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// test wstring version -void test02() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - typedef ostreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE@euro"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the moneypunct facets - typedef moneypunct<wchar_t, true> __money_true; - typedef moneypunct<wchar_t, false> __money_false; - const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c); - const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de); - const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c); - const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de); - const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk); - const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk); - - // sanity check the data is correct. - const wstring empty; - - // total EPA budget FY 2002 - const wstring digits1(L"720000000000"); - - // est. cost, national missile "defense", expressed as a loss in USD 2001 - const wstring digits2(L"-10000000000000"); - - // not valid input - const wstring digits3(L"-A"); - - // input less than frac_digits - const wstring digits4(L"-1"); - - // cache the money_put facet - wostringstream oss; - oss.imbue(loc_hk); - const money_put<wchar_t>& mon_put = use_facet<money_put<wchar_t> >(oss.getloc()); - - // now try with showbase, to get currency symbol in format - oss.setf(ios_base::showbase); - - // test sign of more than one digit, say hong kong. - oss.str(empty); - iterator_type os_it05 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1); - wstring result5 = oss.str(); - VERIFY( result5 == L"HK$7,200,000,000.00"); - - oss.str(empty); - iterator_type os_it06 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits2); - wstring result6 = oss.str(); - VERIFY( result6 == L"(HKD 100,000,000,000.00)"); - - // test one-digit formats without zero padding - oss.imbue(loc_c); - oss.str(empty); - const money_put<wchar_t>& mon_put2 = use_facet<money_put<wchar_t> >(oss.getloc()); - iterator_type os_it07 = mon_put2.put(oss.rdbuf(), true, oss, ' ', digits4); - wstring result7 = oss.str(); - VERIFY( result7 == L"1"); - - // test one-digit formats with zero padding, zero frac widths - oss.imbue(loc_hk); - oss.str(empty); - const money_put<wchar_t>& mon_put3 = use_facet<money_put<wchar_t> >(oss.getloc()); - iterator_type os_it08 = mon_put3.put(oss.rdbuf(), true, oss, ' ', digits4); - wstring result8 = oss.str(); - VERIFY( result8 == L"(HKD .01)"); - - oss.unsetf(ios_base::showbase); - - // test bunk input - oss.str(empty); - iterator_type os_it09 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits3); - wstring result9 = oss.str(); - VERIFY( result9 == L""); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/3.cc deleted file mode 100644 index 8a7778396bc..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/3.cc +++ /dev/null @@ -1,109 +0,0 @@ -// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.2.1 money_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// test double version -void test03() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - typedef ostreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE@euro"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the moneypunct facets - typedef moneypunct<wchar_t, true> __money_true; - typedef moneypunct<wchar_t, false> __money_false; - const __money_true& monpunct_c_t = use_facet<__money_true>(loc_c); - const __money_true& monpunct_de_t = use_facet<__money_true>(loc_de); - const __money_false& monpunct_c_f = use_facet<__money_false>(loc_c); - const __money_false& monpunct_de_f = use_facet<__money_false>(loc_de); - const __money_true& monpunct_hk_t = use_facet<__money_true>(loc_hk); - const __money_false& monpunct_hk_f = use_facet<__money_false>(loc_hk); - - // sanity check the data is correct. - const wstring empty; - - // total EPA budget FY 2002 - const long double digits1 = 720000000000.0; - - // est. cost, national missile "defense", expressed as a loss in USD 2001 - const long double digits2 = -10000000000000.0; - - // input less than frac_digits - const long double digits4 = -1.0; - - // cache the money_put facet - wostringstream oss; - oss.imbue(loc_de); - const money_put<wchar_t>& mon_put = use_facet<money_put<wchar_t> >(oss.getloc()); - - iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1); - wstring result1 = oss.str(); - VERIFY( result1 == L"7.200.000.000,00 "); - - oss.str(empty); - iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1); - wstring result2 = oss.str(); - VERIFY( result2 == L"7.200.000.000,00 "); - - // intl and non-intl versions should be the same. - VERIFY( result1 == result2 ); - - // now try with showbase, to get currency symbol in format - oss.setf(ios_base::showbase); - - oss.str(empty); - iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1); - wstring result3 = oss.str(); - VERIFY( result3 == L"7.200.000.000,00 EUR "); - - oss.str(empty); - iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1); - wstring result4 = oss.str(); - VERIFY( result4 == L"7.200.000.000,00 \x20ac"); - - // intl and non-intl versions should be different. - VERIFY( result3 != result4 ); - VERIFY( result3 != result1 ); - VERIFY( result4 != result2 ); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/4.cc deleted file mode 100644 index 397fd2ea7fe..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/4.cc +++ /dev/null @@ -1,73 +0,0 @@ -// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.2.1 money_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test04() -{ - using namespace std; - bool test = true; - - // Check money_put works with other iterators besides streambuf - // output iterators. (As long as output_iterator requirements are met.) - typedef wstring::iterator iter_type; - typedef money_put<wchar_t, iter_type> mon_put_type; - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = goodbit; - const locale loc_c = locale::classic(); - // woman, art, thief (stole the blues) - const wstring str(L"1943 Janis Joplin"); - const long double ld = 1943.0; - const wstring x(str.size(), 'x'); // have to have allocated wstring! - wstring res; - - ostringstream oss; - oss.imbue(locale(loc_c, new mon_put_type)); - - // Iterator advanced, state, output. - const mon_put_type& mp = use_facet<mon_put_type>(oss.getloc()); - - // 01 wstring - res = x; - iter_type ret1 = mp.put(res.begin(), false, oss, ' ', str); - wstring sanity1(res.begin(), ret1); - VERIFY( err == goodbit ); - VERIFY( res == L"1943xxxxxxxxxxxxx" ); - VERIFY( sanity1 == L"1943" ); - - // 02 long double - res = x; - iter_type ret2 = mp.put(res.begin(), false, oss, ' ', ld); - wstring sanity2(res.begin(), ret2); - VERIFY( err == goodbit ); - VERIFY( res == L"1943xxxxxxxxxxxxx" ); - VERIFY( sanity2 == L"1943" ); -} - -int main() -{ - test04(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/5.cc deleted file mode 100644 index aa5a18c93d9..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/5.cc +++ /dev/null @@ -1,70 +0,0 @@ -// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.2.1 money_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -struct My_money_io : public std::moneypunct<wchar_t,false> -{ - char_type do_decimal_point() const { return '.'; } - char_type do_thousands_sep() const { return ','; } - std::string do_grouping() const { return "\003"; } - - std::wstring do_negative_sign() const { return L"()"; } - - int do_frac_digits() const { return 2; } - - pattern do_neg_format() const - { - pattern pat = { { symbol, space, sign, value } }; - return pat; - } -}; - -// libstdc++/5708 -void test05() -{ - using namespace std; - bool test = true; - typedef ostreambuf_iterator<wchar_t> OutIt; - - locale loc(locale::classic(), new My_money_io); - - bool intl = false; - - wstring val(L"-123456"); - const money_put<wchar_t,OutIt>& mp = - use_facet<money_put<wchar_t, OutIt> >(loc); - - wostringstream fmt; - fmt.imbue(loc); - OutIt out(fmt); - mp.put(out,intl,fmt,'*',val); - VERIFY( fmt.str() == L"*(1,234.56)" ); -} - -int main() -{ - test05(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/6.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/6.cc deleted file mode 100644 index d92619c554d..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/6.cc +++ /dev/null @@ -1,59 +0,0 @@ -// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.2.1 money_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -struct My_money_io_2 : public std::moneypunct<wchar_t,false> -{ - char_type do_thousands_sep() const { return ','; } - std::string do_grouping() const { return "\001"; } -}; - -// Make sure we can output a very big amount of money (with grouping too). -void test06() -{ - using namespace std; - bool test = true; - typedef ostreambuf_iterator<wchar_t> OutIt; - - locale loc(locale::classic(), new My_money_io_2); - - bool intl = false; - - long double val = 1.0e50L; - const money_put<wchar_t,OutIt>& mp = - use_facet<money_put<wchar_t, OutIt> >(loc); - - wostringstream fmt; - fmt.imbue(loc); - OutIt out(fmt); - mp.put(out,intl,fmt,'*',val); - VERIFY( fmt.good() ); -} - -int main() -{ - test06(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/wrapped_env.cc deleted file mode 100644 index c04f700e5cd..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,61 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -#define main discard_main_6 -#include "6.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - two.push_back(&test06); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/wrapped_locale.cc deleted file mode 100644 index 88f84572a91..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,61 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -#define main discard_main_6 -#include "6.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - two.push_back(&test06); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/1.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/1.cc deleted file mode 100644 index 6ab09c61a61..00000000000 --- a/libstdc++-v3/testsuite/22_locale/moneypunct/1.cc +++ /dev/null @@ -1,44 +0,0 @@ -// { dg-do compile } -// 2001-08-23 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.3 Template class moneypunct - -#include <locale> -#include <testsuite_hooks.h> - -void test01() -{ - // Check for required base class. - typedef std::moneypunct<char, true> test_type; - typedef std::locale::facet base_type; - const test_type& obj = std::use_facet<test_type>(std::locale()); - const base_type* base = &obj; - - // Check for required typedefs - typedef test_type::char_type char_type; - typedef test_type::string_type string_type; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/2.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/2.cc deleted file mode 100644 index edfefbbf89b..00000000000 --- a/libstdc++-v3/testsuite/22_locale/moneypunct/2.cc +++ /dev/null @@ -1,44 +0,0 @@ -// { dg-do compile } -// 2001-08-23 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.3 Template class moneypunct - -#include <locale> -#include <testsuite_hooks.h> - -void test02() -{ - // Check for required base class. - typedef std::moneypunct<char, false> test_type; - typedef std::locale::facet base_type; - const test_type& obj = std::use_facet<test_type>(std::locale()); - const base_type* base = &obj; - - // Check for required typedefs - typedef test_type::char_type char_type; - typedef test_type::string_type string_type; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/3.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/3.cc deleted file mode 100644 index db6c93c4541..00000000000 --- a/libstdc++-v3/testsuite/22_locale/moneypunct/3.cc +++ /dev/null @@ -1,47 +0,0 @@ -// 2001-08-23 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.3 Template class moneypunct - -// { dg-do compile } - -#include <locale> -#include <testsuite_hooks.h> - -// Should be able to instantiate this for other types besides char, wchar_t -class gnu_moneypunct_t: public std::moneypunct<unsigned char, true> -{ }; - -class gnu_moneypunct_f: public std::moneypunct<unsigned char, false> -{ }; - -void test03() -{ - gnu_moneypunct_t facet01; - gnu_moneypunct_f facet02; - VERIFY (facet01.intl == true); - VERIFY (facet02.intl == false); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/1.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/1.cc deleted file mode 100644 index c8d7b994904..00000000000 --- a/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/1.cc +++ /dev/null @@ -1,99 +0,0 @@ -// 2001-08-23 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.3.1 moneypunct members - -#include <locale> -#include <string> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - - // cache the moneypunct facets - typedef moneypunct<char, true> __money_true; - typedef moneypunct<char, false> __money_false; - const __money_true& monp_c_t = use_facet<__money_true>(loc_c); - const __money_false& monp_c_f = use_facet<__money_false>(loc_c); - - // quick sanity check for data. - char q1 = monp_c_t.decimal_point(); - char q2 = monp_c_t.thousands_sep(); - char q3 = monp_c_f.decimal_point(); - char q4 = monp_c_f.thousands_sep(); - string g1 = monp_c_t.grouping(); - string g2 = monp_c_f.grouping(); - string cs1 = monp_c_t.curr_symbol(); - string cs2 = monp_c_f.curr_symbol(); - string ps1 = monp_c_t.positive_sign(); - string ns1 = monp_c_t.negative_sign(); - string ps2 = monp_c_f.positive_sign(); - string ns2 = monp_c_f.negative_sign(); - int fd1 = monp_c_t.frac_digits(); - int fd2 = monp_c_f.frac_digits(); - pattern pos1 = monp_c_t.pos_format(); - pattern neg1 = monp_c_t.neg_format(); - pattern pos2 = monp_c_f.pos_format(); - pattern neg2 = monp_c_f.neg_format(); - - VERIFY( q1 == '.' ); - VERIFY( q3 == '.' ); - VERIFY( q2 == ',' ); - VERIFY( q4 == ',' ); - VERIFY( g1 == "" ); - VERIFY( g2 == "" ); - VERIFY( cs1 == "" ); - VERIFY( cs2 == "" ); - VERIFY( ps1 == "" ); - VERIFY( ps2 == "" ); - VERIFY( ns1 == "" ); - VERIFY( ns2 == "" ); - VERIFY( fd1 == 0 ); - VERIFY( fd2 == 0 ); - - VERIFY(static_cast<part>(pos1.field[0]) == static_cast<part>(pos2.field[0])); - VERIFY(static_cast<part>(pos1.field[1]) == static_cast<part>(pos2.field[1])); - VERIFY(static_cast<part>(pos1.field[2]) == static_cast<part>(pos2.field[2])); - VERIFY(static_cast<part>(pos1.field[3]) == static_cast<part>(pos2.field[3])); - -#if 0 - VERIFY( pos1[0] == money_base::_S_default_pattern[0] ); - VERIFY( pos1[1] == money_base::_S_default_pattern[1] ); - VERIFY( pos1[2] == money_base::_S_default_pattern[2] ); - VERIFY( pos1[3] == money_base::_S_default_pattern[3] ); - VERIFY( pos2 == money_base::_S_default_pattern ); - VERIFY( neg1 == money_base::_S_default_pattern ); - VERIFY( neg2 == money_base::_S_default_pattern ); -#endif -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/2.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/2.cc deleted file mode 100644 index 7d74101c95d..00000000000 --- a/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/2.cc +++ /dev/null @@ -1,100 +0,0 @@ -// 2001-08-23 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.3.1 moneypunct members - -#include <locale> -#include <string> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_de("de_DE"); - - // cache the moneypunct facets - typedef moneypunct<char, true> __money_true; - typedef moneypunct<char, false> __money_false; - const __money_true& monp_c_t = use_facet<__money_true>(loc_c); - const __money_false& monp_c_f = use_facet<__money_false>(loc_c); - const __money_true& monp_de_t = use_facet<__money_true>(loc_de); - const __money_false& monp_de_f = use_facet<__money_false>(loc_de); - - // quick sanity check for data. - char q1 = monp_c_t.decimal_point(); - char q2 = monp_c_t.thousands_sep(); - char q3 = monp_c_f.decimal_point(); - char q4 = monp_c_f.thousands_sep(); - VERIFY( q1 != char() ); - VERIFY( q2 != char() ); - VERIFY( q3 != char() ); - VERIFY( q4 != char() ); - - // sanity check the data is correct. - char dp1 = monp_c_t.decimal_point(); - char th1 = monp_c_t.thousands_sep(); - string g1 = monp_c_t.grouping(); - string cs1 = monp_c_t.curr_symbol(); - string ps1 = monp_c_t.positive_sign(); - string ns1 = monp_c_t.negative_sign(); - int fd1 = monp_c_t.frac_digits(); - pattern pos1 = monp_c_t.pos_format(); - pattern neg1 = monp_c_t.neg_format(); - - char dp2 = monp_de_t.decimal_point(); - char th2 = monp_de_t.thousands_sep(); - string g2 = monp_de_t.grouping(); - string cs2 = monp_de_t.curr_symbol(); - string ps2 = monp_de_t.positive_sign(); - string ns2 = monp_de_t.negative_sign(); - int fd2 = monp_de_t.frac_digits(); - pattern pos2 = monp_de_t.pos_format(); - pattern neg2 = monp_de_t.neg_format(); - - VERIFY( dp1 != dp2 ); - VERIFY( th1 != th2 ); - VERIFY( g1 != g2 ); - VERIFY( cs1 != cs2 ); - // VERIFY( ps1 != ps2 ); - VERIFY( ns1 != ns2 ); - VERIFY( fd1 != fd2 ); - VERIFY(static_cast<part>(pos1.field[0]) != static_cast<part>(pos2.field[0])); - VERIFY(static_cast<part>(pos1.field[1]) != static_cast<part>(pos2.field[1])); - VERIFY(static_cast<part>(pos1.field[2]) != static_cast<part>(pos2.field[2])); - VERIFY(static_cast<part>(pos1.field[3]) != static_cast<part>(pos2.field[3])); - - VERIFY(static_cast<part>(neg1.field[0]) != static_cast<part>(neg2.field[0])); - VERIFY(static_cast<part>(neg1.field[1]) != static_cast<part>(neg2.field[1])); - VERIFY(static_cast<part>(neg1.field[2]) != static_cast<part>(neg2.field[2])); - VERIFY(static_cast<part>(neg1.field[3]) != static_cast<part>(neg2.field[3])); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/wrapped_env.cc deleted file mode 100644 index 4f1d5e3f6a9..00000000000 --- a/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/wrapped_env.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/wrapped_locale.cc deleted file mode 100644 index 8d7871815db..00000000000 --- a/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/wrapped_locale.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/1.cc deleted file mode 100644 index 7f0d017bf1d..00000000000 --- a/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/1.cc +++ /dev/null @@ -1,99 +0,0 @@ -// 2001-08-23 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.3.1 moneypunct members - -#include <locale> -#include <string> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - - // cache the moneypunct facets - typedef moneypunct<wchar_t, true> __money_true; - typedef moneypunct<wchar_t, false> __money_false; - const __money_true& monp_c_t = use_facet<__money_true>(loc_c); - const __money_false& monp_c_f = use_facet<__money_false>(loc_c); - - // quick sanity check for data. - wchar_t q1 = monp_c_t.decimal_point(); - wchar_t q2 = monp_c_t.thousands_sep(); - wchar_t q3 = monp_c_f.decimal_point(); - wchar_t q4 = monp_c_f.thousands_sep(); - string g1 = monp_c_t.grouping(); - string g2 = monp_c_f.grouping(); - wstring cs1 = monp_c_t.curr_symbol(); - wstring cs2 = monp_c_f.curr_symbol(); - wstring ps1 = monp_c_t.positive_sign(); - wstring ns1 = monp_c_t.negative_sign(); - wstring ps2 = monp_c_f.positive_sign(); - wstring ns2 = monp_c_f.negative_sign(); - int fd1 = monp_c_t.frac_digits(); - int fd2 = monp_c_f.frac_digits(); - pattern pos1 = monp_c_t.pos_format(); - pattern neg1 = monp_c_t.neg_format(); - pattern pos2 = monp_c_f.pos_format(); - pattern neg2 = monp_c_f.neg_format(); - - VERIFY( q1 == L'.' ); - VERIFY( q3 == L'.' ); - VERIFY( q2 == L',' ); - VERIFY( q4 == L',' ); - VERIFY( g1 == "" ); - VERIFY( g2 == "" ); - VERIFY( cs1 == L"" ); - VERIFY( cs2 == L"" ); - VERIFY( ps1 == L"" ); - VERIFY( ps2 == L"" ); - VERIFY( ns1 == L"" ); - VERIFY( ns2 == L"" ); - VERIFY( fd1 == 0 ); - VERIFY( fd2 == 0 ); - - VERIFY(static_cast<part>(pos1.field[0]) == static_cast<part>(pos2.field[0])); - VERIFY(static_cast<part>(pos1.field[1]) == static_cast<part>(pos2.field[1])); - VERIFY(static_cast<part>(pos1.field[2]) == static_cast<part>(pos2.field[2])); - VERIFY(static_cast<part>(pos1.field[3]) == static_cast<part>(pos2.field[3])); - -#if 0 - VERIFY( pos1[0] == money_base::_S_default_pattern[0] ); - VERIFY( pos1[1] == money_base::_S_default_pattern[1] ); - VERIFY( pos1[2] == money_base::_S_default_pattern[2] ); - VERIFY( pos1[3] == money_base::_S_default_pattern[3] ); - VERIFY( pos2 == money_base::_S_default_pattern ); - VERIFY( neg1 == money_base::_S_default_pattern ); - VERIFY( neg2 == money_base::_S_default_pattern ); -#endif -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/2.cc deleted file mode 100644 index 2e258f9ce2c..00000000000 --- a/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/2.cc +++ /dev/null @@ -1,100 +0,0 @@ -// 2001-08-23 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.3.1 moneypunct members - -#include <locale> -#include <string> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_de("de_DE"); - - // cache the moneypunct facets - typedef moneypunct<wchar_t, true> __money_true; - typedef moneypunct<wchar_t, false> __money_false; - const __money_true& monp_c_t = use_facet<__money_true>(loc_c); - const __money_false& monp_c_f = use_facet<__money_false>(loc_c); - const __money_true& monp_de_t = use_facet<__money_true>(loc_de); - const __money_false& monp_de_f = use_facet<__money_false>(loc_de); - - // quick sanity check for data. - wchar_t q1 = monp_c_t.decimal_point(); - wchar_t q2 = monp_c_t.thousands_sep(); - wchar_t q3 = monp_c_f.decimal_point(); - wchar_t q4 = monp_c_f.thousands_sep(); - VERIFY( q1 != wchar_t() ); - VERIFY( q2 != wchar_t() ); - VERIFY( q3 != wchar_t() ); - VERIFY( q4 != wchar_t() ); - - // sanity check the data is correct. - wchar_t dp1 = monp_c_t.decimal_point(); - wchar_t th1 = monp_c_t.thousands_sep(); - string g1 = monp_c_t.grouping(); - wstring cs1 = monp_c_t.curr_symbol(); - wstring ps1 = monp_c_t.positive_sign(); - wstring ns1 = monp_c_t.negative_sign(); - int fd1 = monp_c_t.frac_digits(); - pattern pos1 = monp_c_t.pos_format(); - pattern neg1 = monp_c_t.neg_format(); - - wchar_t dp2 = monp_de_t.decimal_point(); - wchar_t th2 = monp_de_t.thousands_sep(); - string g2 = monp_de_t.grouping(); - wstring cs2 = monp_de_t.curr_symbol(); - wstring ps2 = monp_de_t.positive_sign(); - wstring ns2 = monp_de_t.negative_sign(); - int fd2 = monp_de_t.frac_digits(); - pattern pos2 = monp_de_t.pos_format(); - pattern neg2 = monp_de_t.neg_format(); - - VERIFY( dp1 != dp2 ); - VERIFY( th1 != th2 ); - VERIFY( g1 != g2 ); - VERIFY( cs1 != cs2 ); - // VERIFY( ps1 != ps2 ); - VERIFY( ns1 != ns2 ); - VERIFY( fd1 != fd2 ); - VERIFY(static_cast<part>(pos1.field[0]) != static_cast<part>(pos2.field[0])); - VERIFY(static_cast<part>(pos1.field[1]) != static_cast<part>(pos2.field[1])); - VERIFY(static_cast<part>(pos1.field[2]) != static_cast<part>(pos2.field[2])); - VERIFY(static_cast<part>(pos1.field[3]) != static_cast<part>(pos2.field[3])); - - VERIFY(static_cast<part>(neg1.field[0]) != static_cast<part>(neg2.field[0])); - VERIFY(static_cast<part>(neg1.field[1]) != static_cast<part>(neg2.field[1])); - VERIFY(static_cast<part>(neg1.field[2]) != static_cast<part>(neg2.field[2])); - VERIFY(static_cast<part>(neg1.field[3]) != static_cast<part>(neg2.field[3])); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/wrapped_env.cc deleted file mode 100644 index 4f1d5e3f6a9..00000000000 --- a/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/wrapped_locale.cc deleted file mode 100644 index 8d7871815db..00000000000 --- a/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct_byname/1.cc b/libstdc++-v3/testsuite/22_locale/moneypunct_byname/1.cc deleted file mode 100644 index 83fc8f62b31..00000000000 --- a/libstdc++-v3/testsuite/22_locale/moneypunct_byname/1.cc +++ /dev/null @@ -1,99 +0,0 @@ -// 2001-08-24 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.6.4 Template class moneypunct_byname - -#include <locale> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; - - bool test = true; - string str; - - locale loc_byname(locale::classic(), new moneypunct_byname<char>("de_DE")); - str = loc_byname.name(); - - locale loc_de("de_DE"); - str = loc_de.name(); - - locale loc_c = locale::classic(); - - VERIFY( loc_de != loc_byname ); - - // cache the moneypunct facets - const moneypunct<char>& monp_c = use_facet<moneypunct<char> >(loc_c); - const moneypunct<char>& monp_byname = - use_facet<moneypunct<char> >(loc_byname); - const moneypunct<char>& monp_de = use_facet<moneypunct<char> >(loc_de); - - // sanity check that the data match - char dp1 = monp_de.decimal_point(); - char th1 = monp_de.thousands_sep(); - string g1 = monp_de.grouping(); - string cs1 = monp_de.curr_symbol(); - string ps1 = monp_de.positive_sign(); - string ns1 = monp_de.negative_sign(); - int fd1 = monp_de.frac_digits(); - pattern pos1 = monp_de.pos_format(); - pattern neg1 = monp_de.neg_format(); - - char dp2 = monp_byname.decimal_point(); - char th2 = monp_byname.thousands_sep(); - string g2 = monp_byname.grouping(); - string cs2 = monp_byname.curr_symbol(); - string ps2 = monp_byname.positive_sign(); - string ns2 = monp_byname.negative_sign(); - int fd2 = monp_byname.frac_digits(); - pattern pos2 = monp_byname.pos_format(); - pattern neg2 = monp_byname.neg_format(); - - VERIFY( dp1 == dp2 ); - VERIFY( th1 == th2 ); - VERIFY( g1 == g2 ); - VERIFY( cs1 == cs2 ); - VERIFY( ps1 == ps2 ); - VERIFY( ns1 == ns2 ); - VERIFY( fd1 == fd2 ); - VERIFY(static_cast<part>(pos1.field[0]) == static_cast<part>(pos2.field[0])); - VERIFY(static_cast<part>(pos1.field[1]) == static_cast<part>(pos2.field[1])); - VERIFY(static_cast<part>(pos1.field[2]) == static_cast<part>(pos2.field[2])); - VERIFY(static_cast<part>(pos1.field[3]) == static_cast<part>(pos2.field[3])); - - VERIFY(static_cast<part>(neg1.field[0]) == static_cast<part>(neg2.field[0])); - VERIFY(static_cast<part>(neg1.field[1]) == static_cast<part>(neg2.field[1])); - VERIFY(static_cast<part>(neg1.field[2]) == static_cast<part>(neg2.field[2])); - VERIFY(static_cast<part>(neg1.field[3]) == static_cast<part>(neg2.field[3])); - - // ...and don't match "C" - char dp3 = monp_c.decimal_point(); - VERIFY( dp1 != dp3 ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01); - - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/num_get/1.cc b/libstdc++-v3/testsuite/22_locale/num_get/1.cc deleted file mode 100644 index 4a3ced974cf..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_get/1.cc +++ /dev/null @@ -1,43 +0,0 @@ -// { dg-do compile } -// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.1 Template class num_get - -#include <locale> - -void test01() -{ - // Check for required base class. - typedef std::num_get<char> test_type; - typedef std::locale::facet base_type; - const test_type& obj = std::use_facet<test_type>(std::locale()); - const base_type* base = &obj; - - // Check for required typedefs - typedef test_type::char_type char_type; - typedef test_type::iter_type iter_type; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/num_get/2.cc b/libstdc++-v3/testsuite/22_locale/num_get/2.cc deleted file mode 100644 index c41a13c44e7..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_get/2.cc +++ /dev/null @@ -1,39 +0,0 @@ -// { dg-do compile } -// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.1 Template class num_get - -#include <locale> - -// Should be able to instantiate this for other types besides char, wchar_t -class gnu_num_get: public std::num_get<unsigned char> -{ }; - -void test02() -{ - gnu_num_get facet01; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/char/1.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/char/1.cc deleted file mode 100644 index 3723e23ffd4..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_get/get/char/1.cc +++ /dev/null @@ -1,170 +0,0 @@ -// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.1.1 num_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef istreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the numpunct facets - const numpunct<char>& numpunct_c = use_facet<numpunct<char> >(loc_c); - const numpunct<char>& numpunct_de = use_facet<numpunct<char> >(loc_de); - const numpunct<char>& numpunct_hk = use_facet<numpunct<char> >(loc_hk); - - // sanity check the data is correct. - const string empty; - char c; - - bool b1 = true; - bool b0 = false; - long l1 = 2147483647; - long l2 = -2147483647; - long l; - unsigned long ul1 = 1294967294; - unsigned long ul2 = 0; - unsigned long ul; - double d1 = 1.02345e+308; - double d2 = 3.15e-308; - double d; - long double ld1 = 6.630025e+4; - long double ld2 = 0.0; - long double ld; - void* v; - const void* cv = &ul2; - - // cache the num_get facet - istringstream iss; - iss.imbue(loc_de); - const num_get<char>& ng = use_facet<num_get<char> >(iss.getloc()); - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = ios_base::goodbit; - - // bool, simple - iss.str("1"); - iterator_type os_it00 = iss.rdbuf(); - iterator_type os_it01 = ng.get(os_it00, 0, iss, err, b1); - VERIFY( b1 == true ); - VERIFY( err & ios_base::eofbit ); - - iss.str("0"); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, b0); - VERIFY( b0 == false ); - VERIFY( err & eofbit ); - - // ... and one that does - iss.imbue(loc_de); - iss.str("1.294.967.294+++++++"); - iss.clear(); - iss.width(20); - iss.setf(ios_base::left, ios_base::adjustfield); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ul); - VERIFY( ul == ul1 ); - VERIFY( err == goodbit ); - - iss.str("+1,02345e+308"); - iss.clear(); - iss.width(20); - iss.setf(ios_base::right, ios_base::adjustfield); - iss.setf(ios_base::scientific, ios_base::floatfield); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, d); - VERIFY( d == d1 ); - VERIFY( err == eofbit ); - - iss.str("3,15E-308 "); - iss.clear(); - iss.width(20); - iss.precision(10); - iss.setf(ios_base::right, ios_base::adjustfield); - iss.setf(ios_base::scientific, ios_base::floatfield); - iss.setf(ios_base::uppercase); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, d); - VERIFY( d == d2 ); - VERIFY( err == goodbit ); - - // long double - iss.str("6,630025e+4"); - iss.clear(); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ld); - VERIFY( ld == ld1 ); - VERIFY( err == eofbit ); - - iss.str("0 "); - iss.clear(); - iss.precision(0); - iss.setf(ios_base::fixed, ios_base::floatfield); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ld); - VERIFY( ld == 0 ); - VERIFY( err == goodbit ); - - // const void - iss.str("0xbffff74c,"); - iss.clear(); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, v); - VERIFY( &v != &cv ); - VERIFY( err == goodbit ); - -#ifdef _GLIBCPP_USE_LONG_LONG - long long ll1 = 9223372036854775807LL; - long long ll2 = -9223372036854775807LL; - long long ll; - - iss.str("9.223.372.036.854.775.807"); - iss.clear(); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ll); - VERIFY( ll == ll1 ); - VERIFY( err == eofbit ); -#endif -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01); - return 0; -} - - -// Kathleen Hannah, humanitarian, woman, art-thief diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/char/2.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/char/2.cc deleted file mode 100644 index 108fae13c1b..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_get/get/char/2.cc +++ /dev/null @@ -1,140 +0,0 @@ -// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.1.1 num_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef istreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the numpunct facets - const numpunct<char>& numpunct_c = use_facet<numpunct<char> >(loc_c); - const numpunct<char>& numpunct_de = use_facet<numpunct<char> >(loc_de); - const numpunct<char>& numpunct_hk = use_facet<numpunct<char> >(loc_hk); - - // sanity check the data is correct. - const string empty; - char c; - - bool b1 = true; - bool b0 = false; - long l1 = 2147483647; - long l2 = -2147483647; - long l; - unsigned long ul1 = 1294967294; - unsigned long ul2 = 0; - unsigned long ul; - double d1 = 1.02345e+308; - double d2 = 3.15e-308; - double d; - long double ld1 = 6.630025e+4; - long double ld2 = 0.0; - long double ld; - void* v; - const void* cv = &ul2; - - // cache the num_get facet - istringstream iss; - iss.imbue(loc_c); - const num_get<char>& ng = use_facet<num_get<char> >(iss.getloc()); - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = ios_base::goodbit; - - // C - // bool, more twisted examples - iss.str("true "); - iss.clear(); - iss.setf(ios_base::boolalpha); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, b0); - VERIFY( b0 == true ); - VERIFY( err == goodbit ); - - iss.str("false "); - iss.clear(); - iss.setf(ios_base::boolalpha); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, b1); - VERIFY( b1 == false ); - VERIFY( err == goodbit ); - - // unsigned long, in a locale that does not group - iss.imbue(loc_c); - iss.str("1294967294"); - iss.clear(); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ul); - VERIFY( ul == ul1); - VERIFY( err == eofbit ); - - iss.str("0+++++++++++++++++++"); - iss.clear(); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ul); - VERIFY( ul == ul2); - VERIFY( err == goodbit ); - - // double - iss.imbue(loc_c); - iss.str("1.02345e+308++++++++"); - iss.clear(); - iss.width(20); - iss.setf(ios_base::left, ios_base::adjustfield); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, d); - VERIFY( d == d1 ); - VERIFY( err == goodbit ); - - iss.str("+3.15e-308"); - iss.clear(); - iss.width(20); - iss.setf(ios_base::right, ios_base::adjustfield); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, d); - VERIFY( d == d2 ); - VERIFY( err == eofbit ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} - - -// Kathleen Hannah, humanitarian, woman, art-thief diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/char/3.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/char/3.cc deleted file mode 100644 index b6c0f12ca1a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_get/get/char/3.cc +++ /dev/null @@ -1,102 +0,0 @@ -// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.1.1 num_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - typedef istreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the numpunct facets - const numpunct<char>& numpunct_c = use_facet<numpunct<char> >(loc_c); - const numpunct<char>& numpunct_de = use_facet<numpunct<char> >(loc_de); - const numpunct<char>& numpunct_hk = use_facet<numpunct<char> >(loc_hk); - - // sanity check the data is correct. - const string empty; - char c; - - bool b1 = true; - bool b0 = false; - long l1 = 2147483647; - long l2 = -2147483647; - long l; - unsigned long ul1 = 1294967294; - unsigned long ul2 = 0; - unsigned long ul; - double d1 = 1.02345e+308; - double d2 = 3.15e-308; - double d; - long double ld1 = 6.630025e+4; - long double ld2 = 0.0; - long double ld; - void* v; - const void* cv = &ul2; - - // cache the num_get facet - istringstream iss; - iss.imbue(loc_hk); - const num_get<char>& ng = use_facet<num_get<char> >(iss.getloc()); - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = ios_base::goodbit; - - // HK - // long, in a locale that expects grouping - iss.str("2,147,483,647 "); - iss.clear(); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, l); - VERIFY( l == l1 ); - VERIFY( err == goodbit ); - - iss.str("-2,147,483,647++++++"); - iss.clear(); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, l); - VERIFY( l == l2 ); - VERIFY( err == goodbit ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03); - return 0; -} - - -// Kathleen Hannah, humanitarian, woman, art-thief diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/char/4.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/char/4.cc deleted file mode 100644 index aed5fcb4370..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_get/get/char/4.cc +++ /dev/null @@ -1,112 +0,0 @@ -// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.1.1 num_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// 2002-01-10 David Seymour <seymour_dj@yahoo.com> -// libstdc++/5331 -void test04() -{ - using namespace std; - bool test = true; - - // Check num_get works with other iterators besides streambuf - // output iterators. (As long as output_iterator requirements are met.) - typedef string::const_iterator iter_type; - typedef num_get<char, iter_type> num_get_type; - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = ios_base::goodbit; - const locale loc_c = locale::classic(); - const string str("20000106 Elizabeth Durack"); - const string str2("0 true 0xbffff74c Durack"); - - istringstream iss; // need an ios, add my num_get facet - iss.imbue(locale(loc_c, new num_get_type)); - - // Iterator advanced, state, output. - const num_get_type& ng = use_facet<num_get_type>(iss.getloc()); - - // 01 get(long) - // 02 get(long double) - // 03 get(bool) - // 04 get(void*) - - // 01 get(long) - long i = 0; - err = goodbit; - iter_type end1 = ng.get(str.begin(), str.end(), iss, err, i); - string rem1(end1, str.end()); - VERIFY( err == goodbit ); - VERIFY( i == 20000106); - VERIFY( rem1 == " Elizabeth Durack" ); - - // 02 get(long double) - long double ld = 0.0; - err = goodbit; - iter_type end2 = ng.get(str.begin(), str.end(), iss, err, ld); - string rem2(end2, str.end()); - VERIFY( err == goodbit ); - VERIFY( ld == 20000106); - VERIFY( rem2 == " Elizabeth Durack" ); - - // 03 get(bool) - bool b = 1; - iss.clear(); - err = goodbit; - iter_type end3 = ng.get(str2.begin(), str2.end(), iss, err, b); - string rem3(end3, str2.end()); - VERIFY( err == goodbit ); - VERIFY( b == 0 ); - VERIFY( rem3 == " true 0xbffff74c Durack" ); - - iss.clear(); - err = goodbit; - iss.setf(ios_base::boolalpha); - iter_type end4 = ng.get(++end3, str2.end(), iss, err, b); - string rem4(end4, str2.end()); - VERIFY( err == goodbit ); - VERIFY( b == true ); - VERIFY( rem4 == " 0xbffff74c Durack" ); - - // 04 get(void*) - void* v; - iss.clear(); - err = goodbit; - iss.setf(ios_base::fixed, ios_base::floatfield); - iter_type end5 = ng.get(++end4, str2.end(), iss, err, v); - string rem5(end5, str2.end()); - VERIFY( err == goodbit ); - VERIFY( b == true ); - VERIFY( rem5 == " Durack" ); -} - -int main() -{ - test04(); - return 0; -} - - -// Kathleen Hannah, humanitarian, woman, art-thief diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/char/5.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/char/5.cc deleted file mode 100644 index 94da704f1d3..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_get/get/char/5.cc +++ /dev/null @@ -1,92 +0,0 @@ -// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.1.1 num_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// Testing the correct parsing of grouped hexadecimals and octals. -void test05() -{ - using namespace std; - - bool test = true; - - unsigned long ul; - - istringstream iss; - - // A locale that expects grouping - locale loc_de("de_DE"); - iss.imbue(loc_de); - - const num_get<char>& ng = use_facet<num_get<char> >(iss.getloc()); - const ios_base::iostate goodbit = ios_base::goodbit; - ios_base::iostate err = ios_base::goodbit; - - iss.setf(ios::hex, ios::basefield); - iss.str("0xbf.fff.74c "); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ul); - VERIFY( err == goodbit ); - VERIFY( ul == 0xbffff74c ); - - iss.str("0Xf.fff "); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ul); - VERIFY( err == goodbit ); - VERIFY( ul == 0xffff ); - - iss.str("ffe "); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ul); - VERIFY( err == goodbit ); - VERIFY( ul == 0xffe ); - - iss.setf(ios::oct, ios::basefield); - iss.str("07.654.321 "); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ul); - VERIFY( err == goodbit ); - VERIFY( ul == 07654321 ); - - iss.str("07.777 "); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ul); - VERIFY( err == goodbit ); - VERIFY( ul == 07777 ); - - iss.str("776 "); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ul); - VERIFY( err == goodbit ); - VERIFY( ul == 0776 ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test05); - return 0; -} - - -// Kathleen Hannah, humanitarian, woman, art-thief diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/char/6.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/char/6.cc deleted file mode 100644 index b5e0a21615b..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_get/get/char/6.cc +++ /dev/null @@ -1,57 +0,0 @@ -// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.1.1 num_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// libstdc++/5816 -void test06() -{ - using namespace std; - bool test = true; - - double d = 0.0; - - istringstream iss; - locale loc_de("de_DE"); - iss.imbue(loc_de); - - const num_get<char>& ng = use_facet<num_get<char> >(iss.getloc()); - const ios_base::iostate goodbit = ios_base::goodbit; - ios_base::iostate err = ios_base::goodbit; - - iss.str("1234,5 "); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, d); - VERIFY( err == goodbit ); - VERIFY( d == 1234.5 ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test06); - return 0; -} - - -// Kathleen Hannah, humanitarian, woman, art-thief diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/char/wrapped_env.cc deleted file mode 100644 index c04f700e5cd..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_get/get/char/wrapped_env.cc +++ /dev/null @@ -1,61 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -#define main discard_main_6 -#include "6.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - two.push_back(&test06); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/char/wrapped_locale.cc deleted file mode 100644 index 88f84572a91..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_get/get/char/wrapped_locale.cc +++ /dev/null @@ -1,61 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -#define main discard_main_6 -#include "6.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - two.push_back(&test06); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/1.cc deleted file mode 100644 index a30cf971946..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/1.cc +++ /dev/null @@ -1,169 +0,0 @@ -// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.1.1 num_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the numpunct facets - const numpunct<wchar_t>& numpunct_c = use_facet<numpunct<wchar_t> >(loc_c); - const numpunct<wchar_t>& numpunct_de = use_facet<numpunct<wchar_t> >(loc_de); - const numpunct<wchar_t>& numpunct_hk = use_facet<numpunct<wchar_t> >(loc_hk); - - // sanity check the data is correct. - const wstring empty; - char c; - - bool b1 = true; - bool b0 = false; - long l1 = 2147483647; - long l2 = -2147483647; - long l; - unsigned long ul1 = 1294967294; - unsigned long ul2 = 0; - unsigned long ul; - double d1 = 1.02345e+308; - double d2 = 3.15e-308; - double d; - long double ld1 = 6.630025e+4; - long double ld2 = 0.0; - long double ld; - void* v; - const void* cv = &ul2; - - // cache the num_get facet - wistringstream iss; - iss.imbue(loc_de); - const num_get<wchar_t>& ng = use_facet<num_get<wchar_t> >(iss.getloc()); - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = ios_base::goodbit; - - // bool, simple - iss.str(L"1"); - iterator_type os_it00 = iss.rdbuf(); - iterator_type os_it01 = ng.get(os_it00, 0, iss, err, b1); - VERIFY( b1 == true ); - VERIFY( err & ios_base::eofbit ); - - iss.str(L"0"); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, b0); - VERIFY( b0 == false ); - VERIFY( err & eofbit ); - - // ... and one that does - iss.str(L"1.294.967.294+++++++"); - iss.clear(); - iss.width(20); - iss.setf(ios_base::left, ios_base::adjustfield); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ul); - VERIFY( ul == ul1 ); - VERIFY( err == goodbit ); - - iss.str(L"+1,02345e+308"); - iss.clear(); - iss.width(20); - iss.setf(ios_base::right, ios_base::adjustfield); - iss.setf(ios_base::scientific, ios_base::floatfield); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, d); - VERIFY( d == d1 ); - VERIFY( err == eofbit ); - - iss.str(L"3,15E-308 "); - iss.clear(); - iss.width(20); - iss.precision(10); - iss.setf(ios_base::right, ios_base::adjustfield); - iss.setf(ios_base::scientific, ios_base::floatfield); - iss.setf(ios_base::uppercase); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, d); - VERIFY( d == d2 ); - VERIFY( err == goodbit ); - - // long double - iss.str(L"6,630025e+4"); - iss.clear(); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ld); - VERIFY( ld == ld1 ); - VERIFY( err == eofbit ); - - iss.str(L"0 "); - iss.clear(); - iss.precision(0); - iss.setf(ios_base::fixed, ios_base::floatfield); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ld); - VERIFY( ld == 0 ); - VERIFY( err == goodbit ); - - // const void - iss.str(L"0xbffff74c,"); - iss.clear(); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, v); - VERIFY( &v != &cv ); - VERIFY( err == goodbit ); - -#ifdef _GLIBCPP_USE_LONG_LONG - long long ll1 = 9223372036854775807LL; - long long ll2 = -9223372036854775807LL; - long long ll; - - iss.str(L"9.223.372.036.854.775.807"); - iss.clear(); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ll); - VERIFY( ll == ll1 ); - VERIFY( err == eofbit ); -#endif -} - -int main() -{ - test01(); - return 0; -} - - -// Kathleen Hannah, humanitarian, woman, art-thief diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/2.cc deleted file mode 100644 index dc11885adf2..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/2.cc +++ /dev/null @@ -1,140 +0,0 @@ -// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.1.1 num_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the numpunct facets - const numpunct<wchar_t>& numpunct_c = use_facet<numpunct<wchar_t> >(loc_c); - const numpunct<wchar_t>& numpunct_de = use_facet<numpunct<wchar_t> >(loc_de); - const numpunct<wchar_t>& numpunct_hk = use_facet<numpunct<wchar_t> >(loc_hk); - - // sanity check the data is correct. - const wstring empty; - char c; - - bool b1 = true; - bool b0 = false; - long l1 = 2147483647; - long l2 = -2147483647; - long l; - unsigned long ul1 = 1294967294; - unsigned long ul2 = 0; - unsigned long ul; - double d1 = 1.02345e+308; - double d2 = 3.15e-308; - double d; - long double ld1 = 6.630025e+4; - long double ld2 = 0.0; - long double ld; - void* v; - const void* cv = &ul2; - - // cache the num_get facet - wistringstream iss; - iss.imbue(loc_c); - const num_get<wchar_t>& ng = use_facet<num_get<wchar_t> >(iss.getloc()); - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = ios_base::goodbit; - - // C - // bool, more twisted examples - iss.str(L"true "); - iss.clear(); - iss.setf(ios_base::boolalpha); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, b0); - VERIFY( b0 == true ); - VERIFY( err == goodbit ); - - iss.str(L"false "); - iss.clear(); - iss.setf(ios_base::boolalpha); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, b1); - VERIFY( b1 == false ); - VERIFY( err == goodbit ); - - // unsigned long, in a locale that does not group - iss.imbue(loc_c); - iss.str(L"1294967294"); - iss.clear(); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ul); - VERIFY( ul == ul1); - VERIFY( err == eofbit ); - - iss.str(L"0+++++++++++++++++++"); - iss.clear(); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ul); - VERIFY( ul == ul2); - VERIFY( err == goodbit ); - - // double - iss.imbue(loc_c); - iss.str(L"1.02345e+308++++++++"); - iss.clear(); - iss.width(20); - iss.setf(ios_base::left, ios_base::adjustfield); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, d); - VERIFY( d == d1 ); - VERIFY( err == goodbit ); - - iss.str(L"+3.15e-308"); - iss.clear(); - iss.width(20); - iss.setf(ios_base::right, ios_base::adjustfield); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, d); - VERIFY( d == d2 ); - VERIFY( err == eofbit ); -} - -int main() -{ - test02(); - return 0; -} - - -// Kathleen Hannah, humanitarian, woman, art-thief diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/3.cc deleted file mode 100644 index d3b1118354b..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/3.cc +++ /dev/null @@ -1,102 +0,0 @@ -// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.1.1 num_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the numpunct facets - const numpunct<wchar_t>& numpunct_c = use_facet<numpunct<wchar_t> >(loc_c); - const numpunct<wchar_t>& numpunct_de = use_facet<numpunct<wchar_t> >(loc_de); - const numpunct<wchar_t>& numpunct_hk = use_facet<numpunct<wchar_t> >(loc_hk); - - // sanity check the data is correct. - const wstring empty; - char c; - - bool b1 = true; - bool b0 = false; - long l1 = 2147483647; - long l2 = -2147483647; - long l; - unsigned long ul1 = 1294967294; - unsigned long ul2 = 0; - unsigned long ul; - double d1 = 1.02345e+308; - double d2 = 3.15e-308; - double d; - long double ld1 = 6.630025e+4; - long double ld2 = 0.0; - long double ld; - void* v; - const void* cv = &ul2; - - // cache the num_get facet - wistringstream iss; - iss.imbue(loc_hk); - const num_get<wchar_t>& ng = use_facet<num_get<wchar_t> >(iss.getloc()); - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = ios_base::goodbit; - - // HK - // long, in a locale that expects grouping - iss.str(L"2,147,483,647 "); - iss.clear(); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, l); - VERIFY( l == l1 ); - VERIFY( err == goodbit ); - - iss.str(L"-2,147,483,647++++++"); - iss.clear(); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, l); - VERIFY( l == l2 ); - VERIFY( err == goodbit ); -} - -int main() -{ - test03(); - return 0; -} - - -// Kathleen Hannah, humanitarian, woman, art-thief diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/4.cc deleted file mode 100644 index f23aa0f1555..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/4.cc +++ /dev/null @@ -1,112 +0,0 @@ -// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.1.1 num_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// 2002-01-10 David Seymour <seymour_dj@yahoo.com> -// libstdc++/5331 -void test04() -{ - using namespace std; - bool test = true; - - // Check num_get works with other iterators besides streambuf - // output iterators. (As long as output_iterator requirements are met.) - typedef wstring::const_iterator iter_type; - typedef num_get<wchar_t, iter_type> num_get_type; - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = ios_base::goodbit; - const locale loc_c = locale::classic(); - const wstring str(L"20000106 Elizabeth Durack"); - const wstring str2(L"0 true 0xbffff74c Durack"); - - wistringstream iss; // need an ios, add my num_get facet - iss.imbue(locale(loc_c, new num_get_type)); - - // Iterator advanced, state, output. - const num_get_type& ng = use_facet<num_get_type>(iss.getloc()); - - // 01 get(long) - // 02 get(long double) - // 03 get(bool) - // 04 get(void*) - - // 01 get(long) - long i = 0; - err = goodbit; - iter_type end1 = ng.get(str.begin(), str.end(), iss, err, i); - wstring rem1(end1, str.end()); - VERIFY( err == goodbit ); - VERIFY( i == 20000106); - VERIFY( rem1 == L" Elizabeth Durack" ); - - // 02 get(long double) - long double ld = 0.0; - err = goodbit; - iter_type end2 = ng.get(str.begin(), str.end(), iss, err, ld); - wstring rem2(end2, str.end()); - VERIFY( err == goodbit ); - VERIFY( ld == 20000106); - VERIFY( rem2 == L" Elizabeth Durack" ); - - // 03 get(bool) - bool b = 1; - iss.clear(); - err = goodbit; - iter_type end3 = ng.get(str2.begin(), str2.end(), iss, err, b); - wstring rem3(end3, str2.end()); - VERIFY( err == goodbit ); - VERIFY( b == 0 ); - VERIFY( rem3 == L" true 0xbffff74c Durack" ); - - iss.clear(); - err = goodbit; - iss.setf(ios_base::boolalpha); - iter_type end4 = ng.get(++end3, str2.end(), iss, err, b); - wstring rem4(end4, str2.end()); - VERIFY( err == goodbit ); - VERIFY( b == true ); - VERIFY( rem4 == L" 0xbffff74c Durack" ); - - // 04 get(void*) - void* v; - iss.clear(); - err = goodbit; - iss.setf(ios_base::fixed, ios_base::floatfield); - iter_type end5 = ng.get(++end4, str2.end(), iss, err, v); - wstring rem5(end5, str2.end()); - VERIFY( err == goodbit ); - VERIFY( b == true ); - VERIFY( rem5 == L" Durack" ); -} - -int main() -{ - test04(); - return 0; -} - - -// Kathleen Hannah, humanitarian, woman, art-thief diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/5.cc deleted file mode 100644 index 7eaaa89e9f7..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/5.cc +++ /dev/null @@ -1,92 +0,0 @@ -// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.1.1 num_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// Testing the correct parsing of grouped hexadecimals and octals. -void test05() -{ - using namespace std; - - bool test = true; - - unsigned long ul; - - wistringstream iss; - - // A locale that expects grouping - locale loc_de("de_DE"); - iss.imbue(loc_de); - - const num_get<wchar_t>& ng = use_facet<num_get<wchar_t> >(iss.getloc()); - const ios_base::iostate goodbit = ios_base::goodbit; - ios_base::iostate err = ios_base::goodbit; - - iss.setf(ios::hex, ios::basefield); - iss.str(L"0xbf.fff.74c "); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ul); - VERIFY( err == goodbit ); - VERIFY( ul == 0xbffff74c ); - - iss.str(L"0Xf.fff "); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ul); - VERIFY( err == goodbit ); - VERIFY( ul == 0xffff ); - - iss.str(L"ffe "); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ul); - VERIFY( err == goodbit ); - VERIFY( ul == 0xffe ); - - iss.setf(ios::oct, ios::basefield); - iss.str(L"07.654.321 "); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ul); - VERIFY( err == goodbit ); - VERIFY( ul == 07654321 ); - - iss.str(L"07.777 "); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ul); - VERIFY( err == goodbit ); - VERIFY( ul == 07777 ); - - iss.str(L"776 "); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, ul); - VERIFY( err == goodbit ); - VERIFY( ul == 0776 ); -} - -int main() -{ - test05(); - return 0; -} - - -// Kathleen Hannah, humanitarian, woman, art-thief diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/6.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/6.cc deleted file mode 100644 index 2f4bb1bb0b4..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/6.cc +++ /dev/null @@ -1,57 +0,0 @@ -// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.1.1 num_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// libstdc++/5816 -void test06() -{ - using namespace std; - bool test = true; - - double d = 0.0; - - wistringstream iss; - locale loc_de("de_DE"); - iss.imbue(loc_de); - - const num_get<wchar_t>& ng = use_facet<num_get<wchar_t> >(iss.getloc()); - const ios_base::iostate goodbit = ios_base::goodbit; - ios_base::iostate err = ios_base::goodbit; - - iss.str(L"1234,5 "); - err = goodbit; - ng.get(iss.rdbuf(), 0, iss, err, d); - VERIFY( err == goodbit ); - VERIFY( d == 1234.5 ); -} - -int main() -{ - test06(); - return 0; -} - - -// Kathleen Hannah, humanitarian, woman, art-thief diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/wrapped_env.cc deleted file mode 100644 index c04f700e5cd..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,61 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -#define main discard_main_6 -#include "6.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - two.push_back(&test06); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/wrapped_locale.cc deleted file mode 100644 index 88f84572a91..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,61 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -#define main discard_main_6 -#include "6.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - two.push_back(&test06); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/num_put/1.cc b/libstdc++-v3/testsuite/22_locale/num_put/1.cc deleted file mode 100644 index 2dabe86d830..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_put/1.cc +++ /dev/null @@ -1,43 +0,0 @@ -// { dg-do compile } -// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.2 Template class num_put - -#include <locale> - -void test01() -{ - // Check for required base class. - typedef std::num_put<char> test_type; - typedef std::locale::facet base_type; - const test_type& obj = std::use_facet<test_type>(std::locale()); - const base_type* base = &obj; - - // Check for required typedefs - typedef test_type::char_type char_type; - typedef test_type::iter_type iter_type; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/num_put/2.cc b/libstdc++-v3/testsuite/22_locale/num_put/2.cc deleted file mode 100644 index 67aeefaffec..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_put/2.cc +++ /dev/null @@ -1,39 +0,0 @@ -// { dg-do compile } -// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.2 Template class num_put - -#include <locale> - -// Should be able to instantiate this for other types besides char, wchar_t -class gnu_num_put: public std::num_put<unsigned char> -{ }; - -void test02() -{ - gnu_num_put facet01; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/1.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/1.cc deleted file mode 100644 index 87abef44e9a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_put/put/char/1.cc +++ /dev/null @@ -1,176 +0,0 @@ -// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.2.1 num_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef ostreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the numpunct facets - const numpunct<char>& numpunct_c = use_facet<numpunct<char> >(loc_c); - const numpunct<char>& numpunct_de = use_facet<numpunct<char> >(loc_de); - const numpunct<char>& numpunct_hk = use_facet<numpunct<char> >(loc_hk); - - // sanity check the data is correct. - const string empty; - string result1; - string result2; - char c; - - bool b1 = true; - bool b0 = false; - long l1 = 2147483647; - long l2 = -2147483647; - unsigned long ul1 = 1294967294; - unsigned long ul2 = 0; - double d1 = 1.7976931348623157e+308; - double d2 = 2.2250738585072014e-308; - long double ld1 = 1.7976931348623157e+308; - long double ld2 = 2.2250738585072014e-308; - const void* cv = &ld1; - - // cache the num_put facet - ostringstream oss; - oss.imbue(loc_de); - const num_put<char>& np = use_facet<num_put<char> >(oss.getloc()); - - // bool, simple - iterator_type os_it00 = oss.rdbuf(); - iterator_type os_it01 = np.put(os_it00, oss, '+', b1); - result1 = oss.str(); - VERIFY( result1 == "1" ); - // VERIFY( os_it00 != os_it01 ); - - oss.str(empty); - np.put(oss.rdbuf(), oss, '+', b0); - result2 = oss.str(); - VERIFY( result2 == "0" ); - - // ... and one that does - oss.imbue(loc_de); - oss.str(empty); - oss.clear(); - oss.width(20); - oss.setf(ios_base::left, ios_base::adjustfield); - np.put(oss.rdbuf(), oss, '+', ul1); - result1 = oss.str(); - VERIFY( result1 == "1.294.967.294+++++++" ); - - // double - oss.str(empty); - oss.clear(); - oss.width(20); - oss.setf(ios_base::left, ios_base::adjustfield); - np.put(oss.rdbuf(), oss, '+', d1); - result1 = oss.str(); - VERIFY( result1 == "1,79769e+308++++++++" ); - - oss.str(empty); - oss.clear(); - oss.width(20); - oss.setf(ios_base::right, ios_base::adjustfield); - np.put(oss.rdbuf(), oss, '+', d2); - result1 = oss.str(); - VERIFY( result1 == "++++++++2,22507e-308" ); - - oss.str(empty); - oss.clear(); - oss.width(20); - oss.setf(ios_base::right, ios_base::adjustfield); - oss.setf(ios_base::scientific, ios_base::floatfield); - np.put(oss.rdbuf(), oss, '+', d2); - result2 = oss.str(); - VERIFY( result2 == "+++++++2,225074e-308" ); - - oss.str(empty); - oss.clear(); - oss.width(20); - oss.precision(10); - oss.setf(ios_base::right, ios_base::adjustfield); - oss.setf(ios_base::scientific, ios_base::floatfield); - oss.setf(ios_base::uppercase); - np.put(oss.rdbuf(), oss, '+', d2); - result1 = oss.str(); - VERIFY( result1 == "+++2,2250738585E-308" ); - - // long double - oss.str(empty); - oss.clear(); - np.put(oss.rdbuf(), oss, '+', ld1); - result1 = oss.str(); - VERIFY( result1 == "1,7976931349E+308" ); - - oss.str(empty); - oss.clear(); - oss.precision(0); - oss.setf(ios_base::fixed, ios_base::floatfield); - np.put(oss.rdbuf(), oss, '+', ld2); - result1 = oss.str(); - VERIFY( result1 == "0" ); - - // const void - oss.str(empty); - oss.clear(); - np.put(oss.rdbuf(), oss, '+', cv); - result1 = oss.str(); - // No grouping characters. - VERIFY( !char_traits<char>::find(result1.c_str(), - result1.size(), - numpunct_de.decimal_point()) ); - // Should contain an 'x'. - VERIFY( result1.find('x') == 1 ); - -#ifdef _GLIBCPP_USE_LONG_LONG - long long ll1 = 9223372036854775807LL; - long long ll2 = -9223372036854775807LL; - - oss.str(empty); - oss.clear(); - np.put(oss.rdbuf(), oss, '+', ll1); - result1 = oss.str(); - VERIFY( result1 == "9.223.372.036.854.775.807" ); -#endif -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01); - return 0; -} - - diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/2.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/2.cc deleted file mode 100644 index a62dfc1f88b..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_put/put/char/2.cc +++ /dev/null @@ -1,112 +0,0 @@ -// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.2.1 num_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef ostreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the numpunct facets - const numpunct<char>& numpunct_c = use_facet<numpunct<char> >(loc_c); - const numpunct<char>& numpunct_de = use_facet<numpunct<char> >(loc_de); - const numpunct<char>& numpunct_hk = use_facet<numpunct<char> >(loc_hk); - - // sanity check the data is correct. - const string empty; - string result1; - string result2; - char c; - - bool b1 = true; - bool b0 = false; - long l1 = 2147483647; - long l2 = -2147483647; - unsigned long ul1 = 1294967294; - unsigned long ul2 = 0; - double d1 = 1.7976931348623157e+308; - double d2 = 2.2250738585072014e-308; - long double ld1 = 1.7976931348623157e+308; - long double ld2 = 2.2250738585072014e-308; - const void* cv = &ld1; - - // cache the num_put facet - ostringstream oss; - oss.imbue(loc_c); - const num_put<char>& np = use_facet<num_put<char> >(oss.getloc()); - - // C - // bool, more twisted examples - oss.str(empty); - oss.width(20); - oss.setf(ios_base::right, ios_base::adjustfield); - np.put(oss.rdbuf(), oss, '+', b0); - result1 = oss.str(); - VERIFY( result1 == "+++++++++++++++++++0" ); - - oss.str(empty); - oss.width(20); - oss.setf(ios_base::left, ios_base::adjustfield); - oss.setf(ios_base::boolalpha); - np.put(oss.rdbuf(), oss, '+', b1); - result2 = oss.str(); - VERIFY( result2 == "true++++++++++++++++" ); - - // unsigned long, in a locale that does not group - oss.imbue(loc_c); - oss.str(empty); - oss.clear(); - np.put(oss.rdbuf(), oss, '+', ul1); - result1 = oss.str(); - VERIFY( result1 == "1294967294" ); - - oss.str(empty); - oss.clear(); - oss.width(20); - oss.setf(ios_base::left, ios_base::adjustfield); - np.put(oss.rdbuf(), oss, '+', ul2); - result1 = oss.str(); - VERIFY( result1 == "0+++++++++++++++++++" ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} - - diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/3.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/3.cc deleted file mode 100644 index 0bc92b2af0e..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_put/put/char/3.cc +++ /dev/null @@ -1,95 +0,0 @@ -// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.2.1 num_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - typedef ostreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the numpunct facets - const numpunct<char>& numpunct_c = use_facet<numpunct<char> >(loc_c); - const numpunct<char>& numpunct_de = use_facet<numpunct<char> >(loc_de); - const numpunct<char>& numpunct_hk = use_facet<numpunct<char> >(loc_hk); - - // sanity check the data is correct. - const string empty; - string result1; - string result2; - char c; - - bool b1 = true; - bool b0 = false; - long l1 = 2147483647; - long l2 = -2147483647; - unsigned long ul1 = 1294967294; - unsigned long ul2 = 0; - double d1 = 1.7976931348623157e+308; - double d2 = 2.2250738585072014e-308; - long double ld1 = 1.7976931348623157e+308; - long double ld2 = 2.2250738585072014e-308; - const void* cv = &ld1; - - // cache the num_put facet - ostringstream oss; - oss.imbue(loc_hk); - const num_put<char>& np = use_facet<num_put<char> >(oss.getloc()); - - // HK - // long, in a locale that expects grouping - oss.str(empty); - oss.clear(); - np.put(oss.rdbuf(), oss, '+', l1); - result1 = oss.str(); - VERIFY( result1 == "2,147,483,647" ); - - oss.str(empty); - oss.clear(); - oss.width(20); - oss.setf(ios_base::left, ios_base::adjustfield); - np.put(oss.rdbuf(), oss, '+', l2); - result1 = oss.str(); - VERIFY( result1 == "-2,147,483,647++++++" ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03); - return 0; -} - - diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/4.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/4.cc deleted file mode 100644 index 7ce358311fe..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_put/put/char/4.cc +++ /dev/null @@ -1,105 +0,0 @@ -// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.2.1 num_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test04() -{ - using namespace std; - bool test = true; - - // Check num_put works with other iterators besides streambuf - // output iterators. (As long as output_iterator requirements are met.) - typedef string::iterator iter_type; - typedef char_traits<char> traits; - typedef num_put<char, iter_type> num_put_type; - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - const locale loc_c = locale::classic(); - const string str("1798 Lady Elgin"); - const string str2("0 true 0xbffff74c Mary Nisbet"); - const string x(15, 'x'); // have to have allocated string! - string res; - - ostringstream oss; - oss.imbue(locale(loc_c, new num_put_type)); - - // Iterator advanced, state, output. - const num_put_type& tp = use_facet<num_put_type>(oss.getloc()); - - // 01 put(long) - // 02 put(long double) - // 03 put(bool) - // 04 put(void*) - - // 01 put(long) - const long l = 1798; - res = x; - iter_type ret1 = tp.put(res.begin(), oss, ' ', l); - string sanity1(res.begin(), ret1); - VERIFY( res == "1798xxxxxxxxxxx" ); - VERIFY( sanity1 == "1798" ); - - // 02 put(long double) - const long double ld = 1798.0; - res = x; - iter_type ret2 = tp.put(res.begin(), oss, ' ', ld); - string sanity2(res.begin(), ret2); - VERIFY( res == "1798xxxxxxxxxxx" ); - VERIFY( sanity2 == "1798" ); - - // 03 put(bool) - bool b = 1; - res = x; - iter_type ret3 = tp.put(res.begin(), oss, ' ', b); - string sanity3(res.begin(), ret3); - VERIFY( res == "1xxxxxxxxxxxxxx" ); - VERIFY( sanity3 == "1" ); - - b = 0; - res = x; - oss.setf(ios_base::boolalpha); - iter_type ret4 = tp.put(res.begin(), oss, ' ', b); - string sanity4(res.begin(), ret4); - VERIFY( res == "falsexxxxxxxxxx" ); - VERIFY( sanity4 == "false" ); - - // 04 put(void*) - oss.clear(); - const void* cv = &ld; - res = x; - oss.setf(ios_base::fixed, ios_base::floatfield); - iter_type ret5 = tp.put(res.begin(), oss, ' ', cv); - string sanity5(res.begin(), ret5); - VERIFY( sanity5.size() ); - VERIFY( sanity5[1] == 'x' ); -} - -int main() -{ - test04(); - return 0; -} - - diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/5.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/5.cc deleted file mode 100644 index eb0bd219622..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_put/put/char/5.cc +++ /dev/null @@ -1,70 +0,0 @@ -// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.2.1 num_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// Make sure that, in a locale that expects grouping, when showbase -// is true, an hexadecimal or octal zero is correctly output (the case -// of zero is special since there is no 0x, 0 respectively, prefix) -void test05() -{ - using namespace std; - bool test = true; - - // A locale that expects grouping. - locale loc_de("de_DE"); - - const string empty; - string result; - - ostringstream oss; - oss.imbue(loc_de); - const num_put<char>& np = use_facet<num_put<char> >(oss.getloc()); - - long l = 0; - - oss.str(empty); - oss.clear(); - oss.setf(ios::showbase); - oss.setf(ios::hex, ios::basefield); - np.put(oss.rdbuf(), oss, '+', l); - result = oss.str(); - VERIFY( result == "0" ); - - oss.str(empty); - oss.clear(); - oss.setf(ios::showbase); - oss.setf(ios::oct, ios::basefield); - np.put(oss.rdbuf(), oss, '+', l); - result = oss.str(); - VERIFY( result == "0" ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test05); - return 0; -} - - diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/6.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/6.cc deleted file mode 100644 index 3cc550710bb..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_put/put/char/6.cc +++ /dev/null @@ -1,56 +0,0 @@ -// 2003-02-05 Paolo Carlini <pcarlini@unitus.it> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.2.2.1 num_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// libstdc++/9548 and DR 231 -void test01() -{ - using namespace std; - bool test = true; - - ostringstream oss1, oss2; - const num_put<char>& np1 = use_facet<num_put<char> >(oss1.getloc()); - const num_put<char>& np2 = use_facet<num_put<char> >(oss2.getloc()); - - string result1, result2; - - oss1.precision(-1); - oss1.setf(ios_base::fixed, ios_base::floatfield); - np1.put(oss1.rdbuf(), oss1, '+', 30.5); - result1 = oss1.str(); - VERIFY( result1 == "30.500000" ); - - oss2.precision(0); - oss2.setf(ios_base::scientific, ios_base::floatfield); - np2.put(oss2.rdbuf(), oss2, '+', 1.0); - result2 = oss2.str(); - VERIFY( result2 == "1e+00" ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/wrapped_env.cc deleted file mode 100644 index 2baa3a44950..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_put/put/char/wrapped_env.cc +++ /dev/null @@ -1,56 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/wrapped_locale.cc deleted file mode 100644 index 63e7a470160..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_put/put/char/wrapped_locale.cc +++ /dev/null @@ -1,56 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/1.cc deleted file mode 100644 index 9c5bdc5968e..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/1.cc +++ /dev/null @@ -1,176 +0,0 @@ -// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.2.1 num_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef ostreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the numpunct facets - const numpunct<wchar_t>& numpunct_c = use_facet<numpunct<wchar_t> >(loc_c); - const numpunct<wchar_t>& numpunct_de = use_facet<numpunct<wchar_t> >(loc_de); - const numpunct<wchar_t>& numpunct_hk = use_facet<numpunct<wchar_t> >(loc_hk); - - // sanity check the data is correct. - const wstring empty; - wstring result1; - wstring result2; - char c; - - bool b1 = true; - bool b0 = false; - long l1 = 2147483647; - long l2 = -2147483647; - unsigned long ul1 = 1294967294; - unsigned long ul2 = 0; - double d1 = 1.7976931348623157e+308; - double d2 = 2.2250738585072014e-308; - long double ld1 = 1.7976931348623157e+308; - long double ld2 = 2.2250738585072014e-308; - const void* cv = &ld1; - - // cache the num_put facet - wostringstream oss; - oss.imbue(loc_de); - const num_put<wchar_t>& np = use_facet<num_put<wchar_t> >(oss.getloc()); - - // bool, simple - iterator_type os_it00 = oss.rdbuf(); - iterator_type os_it01 = np.put(os_it00, oss, '+', b1); - result1 = oss.str(); - VERIFY( result1 == L"1" ); - // VERIFY( os_it00 != os_it01 ); - - oss.str(empty); - np.put(oss.rdbuf(), oss, '+', b0); - result2 = oss.str(); - VERIFY( result2 == L"0" ); - - // ... and one that does - oss.imbue(loc_de); - oss.str(empty); - oss.clear(); - oss.width(20); - oss.setf(ios_base::left, ios_base::adjustfield); - np.put(oss.rdbuf(), oss, '+', ul1); - result1 = oss.str(); - VERIFY( result1 == L"1.294.967.294+++++++" ); - - // double - oss.str(empty); - oss.clear(); - oss.width(20); - oss.setf(ios_base::left, ios_base::adjustfield); - np.put(oss.rdbuf(), oss, '+', d1); - result1 = oss.str(); - VERIFY( result1 == L"1,79769e+308++++++++" ); - - oss.str(empty); - oss.clear(); - oss.width(20); - oss.setf(ios_base::right, ios_base::adjustfield); - np.put(oss.rdbuf(), oss, '+', d2); - result1 = oss.str(); - VERIFY( result1 == L"++++++++2,22507e-308" ); - - oss.str(empty); - oss.clear(); - oss.width(20); - oss.setf(ios_base::right, ios_base::adjustfield); - oss.setf(ios_base::scientific, ios_base::floatfield); - np.put(oss.rdbuf(), oss, '+', d2); - result2 = oss.str(); - VERIFY( result2 == L"+++++++2,225074e-308" ); - - oss.str(empty); - oss.clear(); - oss.width(20); - oss.precision(10); - oss.setf(ios_base::right, ios_base::adjustfield); - oss.setf(ios_base::scientific, ios_base::floatfield); - oss.setf(ios_base::uppercase); - np.put(oss.rdbuf(), oss, '+', d2); - result1 = oss.str(); - VERIFY( result1 == L"+++2,2250738585E-308" ); - - // long double - oss.str(empty); - oss.clear(); - np.put(oss.rdbuf(), oss, '+', ld1); - result1 = oss.str(); - VERIFY( result1 == L"1,7976931349E+308" ); - - oss.str(empty); - oss.clear(); - oss.precision(0); - oss.setf(ios_base::fixed, ios_base::floatfield); - np.put(oss.rdbuf(), oss, '+', ld2); - result1 = oss.str(); - VERIFY( result1 == L"0" ); - - // const void - oss.str(empty); - oss.clear(); - np.put(oss.rdbuf(), oss, '+', cv); - result1 = oss.str(); - // No grouping characters. - VERIFY( !char_traits<wchar_t>::find(result1.c_str(), - result1.size(), - numpunct_de.decimal_point()) ); - // Should contain an 'x'. - VERIFY( result1.find(L'x') == 1 ); - -#ifdef _GLIBCPP_USE_LONG_LONG - long long ll1 = 9223372036854775807LL; - long long ll2 = -9223372036854775807LL; - - oss.str(empty); - oss.clear(); - np.put(oss.rdbuf(), oss, '+', ll1); - result1 = oss.str(); - VERIFY( result1 == L"9.223.372.036.854.775.807" ); -#endif -} - -int main() -{ - test01(); - return 0; -} - - diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/2.cc deleted file mode 100644 index de08c093745..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/2.cc +++ /dev/null @@ -1,112 +0,0 @@ -// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.2.1 num_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef ostreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the numpunct facets - const numpunct<wchar_t>& numpunct_c = use_facet<numpunct<wchar_t> >(loc_c); - const numpunct<wchar_t>& numpunct_de = use_facet<numpunct<wchar_t> >(loc_de); - const numpunct<wchar_t>& numpunct_hk = use_facet<numpunct<wchar_t> >(loc_hk); - - // sanity check the data is correct. - const wstring empty; - wstring result1; - wstring result2; - char c; - - bool b1 = true; - bool b0 = false; - long l1 = 2147483647; - long l2 = -2147483647; - unsigned long ul1 = 1294967294; - unsigned long ul2 = 0; - double d1 = 1.7976931348623157e+308; - double d2 = 2.2250738585072014e-308; - long double ld1 = 1.7976931348623157e+308; - long double ld2 = 2.2250738585072014e-308; - const void* cv = &ld1; - - // cache the num_put facet - wostringstream oss; - oss.imbue(loc_c); - const num_put<wchar_t>& np = use_facet<num_put<wchar_t> >(oss.getloc()); - - // C - // bool, more twisted examples - oss.str(empty); - oss.width(20); - oss.setf(ios_base::right, ios_base::adjustfield); - np.put(oss.rdbuf(), oss, '+', b0); - result1 = oss.str(); - VERIFY( result1 == L"+++++++++++++++++++0" ); - - oss.str(empty); - oss.width(20); - oss.setf(ios_base::left, ios_base::adjustfield); - oss.setf(ios_base::boolalpha); - np.put(oss.rdbuf(), oss, '+', b1); - result2 = oss.str(); - VERIFY( result2 == L"true++++++++++++++++" ); - - // unsigned long, in a locale that does not group - oss.imbue(loc_c); - oss.str(empty); - oss.clear(); - np.put(oss.rdbuf(), oss, '+', ul1); - result1 = oss.str(); - VERIFY( result1 == L"1294967294" ); - - oss.str(empty); - oss.clear(); - oss.width(20); - oss.setf(ios_base::left, ios_base::adjustfield); - np.put(oss.rdbuf(), oss, '+', ul2); - result1 = oss.str(); - VERIFY( result1 == L"0+++++++++++++++++++" ); -} - -int main() -{ - test02(); - return 0; -} - - diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/3.cc deleted file mode 100644 index ae2d0cfac8c..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/3.cc +++ /dev/null @@ -1,95 +0,0 @@ -// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.2.1 num_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - typedef ostreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the numpunct facets - const numpunct<wchar_t>& numpunct_c = use_facet<numpunct<wchar_t> >(loc_c); - const numpunct<wchar_t>& numpunct_de = use_facet<numpunct<wchar_t> >(loc_de); - const numpunct<wchar_t>& numpunct_hk = use_facet<numpunct<wchar_t> >(loc_hk); - - // sanity check the data is correct. - const wstring empty; - wstring result1; - wstring result2; - char c; - - bool b1 = true; - bool b0 = false; - long l1 = 2147483647; - long l2 = -2147483647; - unsigned long ul1 = 1294967294; - unsigned long ul2 = 0; - double d1 = 1.7976931348623157e+308; - double d2 = 2.2250738585072014e-308; - long double ld1 = 1.7976931348623157e+308; - long double ld2 = 2.2250738585072014e-308; - const void* cv = &ld1; - - // cache the num_put facet - wostringstream oss; - oss.imbue(loc_hk); - const num_put<wchar_t>& np = use_facet<num_put<wchar_t> >(oss.getloc()); - - // HK - // long, in a locale that expects grouping - oss.str(empty); - oss.clear(); - np.put(oss.rdbuf(), oss, '+', l1); - result1 = oss.str(); - VERIFY( result1 == L"2,147,483,647" ); - - oss.str(empty); - oss.clear(); - oss.width(20); - oss.setf(ios_base::left, ios_base::adjustfield); - np.put(oss.rdbuf(), oss, '+', l2); - result1 = oss.str(); - VERIFY( result1 == L"-2,147,483,647++++++" ); -} - -int main() -{ - test03(); - return 0; -} - - diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/4.cc deleted file mode 100644 index 1057a85f42d..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/4.cc +++ /dev/null @@ -1,105 +0,0 @@ -// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.2.1 num_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test04() -{ - using namespace std; - bool test = true; - - // Check num_put works with other iterators besides streambuf - // output iterators. (As long as output_iterator requirements are met.) - typedef wstring::iterator iter_type; - typedef char_traits<wchar_t> traits; - typedef num_put<wchar_t, iter_type> num_put_type; - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - const locale loc_c = locale::classic(); - const wstring str(L"1798 Lady Elgin"); - const wstring str2(L"0 true 0xbffff74c Mary Nisbet"); - const wstring x(15, L'x'); // have to have allocated wstring! - wstring res; - - wostringstream oss; - oss.imbue(locale(loc_c, new num_put_type)); - - // Iterator advanced, state, output. - const num_put_type& tp = use_facet<num_put_type>(oss.getloc()); - - // 01 put(long) - // 02 put(long double) - // 03 put(bool) - // 04 put(void*) - - // 01 put(long) - const long l = 1798; - res = x; - iter_type ret1 = tp.put(res.begin(), oss, ' ', l); - wstring sanity1(res.begin(), ret1); - VERIFY( res == L"1798xxxxxxxxxxx" ); - VERIFY( sanity1 == L"1798" ); - - // 02 put(long double) - const long double ld = 1798.0; - res = x; - iter_type ret2 = tp.put(res.begin(), oss, ' ', ld); - wstring sanity2(res.begin(), ret2); - VERIFY( res == L"1798xxxxxxxxxxx" ); - VERIFY( sanity2 == L"1798" ); - - // 03 put(bool) - bool b = 1; - res = x; - iter_type ret3 = tp.put(res.begin(), oss, ' ', b); - wstring sanity3(res.begin(), ret3); - VERIFY( res == L"1xxxxxxxxxxxxxx" ); - VERIFY( sanity3 == L"1" ); - - b = 0; - res = x; - oss.setf(ios_base::boolalpha); - iter_type ret4 = tp.put(res.begin(), oss, ' ', b); - wstring sanity4(res.begin(), ret4); - VERIFY( res == L"falsexxxxxxxxxx" ); - VERIFY( sanity4 == L"false" ); - - // 04 put(void*) - oss.clear(); - const void* cv = &ld; - res = x; - oss.setf(ios_base::fixed, ios_base::floatfield); - iter_type ret5 = tp.put(res.begin(), oss, ' ', cv); - wstring sanity5(res.begin(), ret5); - VERIFY( sanity5.size() ); - VERIFY( sanity5[1] == 'x' ); -} - -int main() -{ - test04(); - return 0; -} - - diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/5.cc deleted file mode 100644 index 18ea8edc600..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/5.cc +++ /dev/null @@ -1,70 +0,0 @@ -// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.2.2.1 num_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// Make sure that, in a locale that expects grouping, when showbase -// is true, an hexadecimal or octal zero is correctly output (the case -// of zero is special since there is no 0x, 0 respectively, prefix) -void test05() -{ - using namespace std; - bool test = true; - - // A locale that expects grouping. - locale loc_de("de_DE"); - - const wstring empty; - wstring result; - - wostringstream oss; - oss.imbue(loc_de); - const num_put<wchar_t>& np = use_facet<num_put<wchar_t> >(oss.getloc()); - - long l = 0; - - oss.str(empty); - oss.clear(); - oss.setf(ios::showbase); - oss.setf(ios::hex, ios::basefield); - np.put(oss.rdbuf(), oss, '+', l); - result = oss.str(); - VERIFY( result == L"0" ); - - oss.str(empty); - oss.clear(); - oss.setf(ios::showbase); - oss.setf(ios::oct, ios::basefield); - np.put(oss.rdbuf(), oss, '+', l); - result = oss.str(); - VERIFY( result == L"0" ); -} - -int main() -{ - test05(); - return 0; -} - - diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/6.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/6.cc deleted file mode 100644 index 01733603cfc..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/6.cc +++ /dev/null @@ -1,56 +0,0 @@ -// 2003-02-05 Paolo Carlini <pcarlini@unitus.it> - -// Copyright (C) 2003 Free Software Foundation -// -// 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. - -// 22.2.2.2.1 num_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// libstdc++/9548 and DR 231 -void test01() -{ - using namespace std; - bool test = true; - - wostringstream woss1, woss2; - const num_put<wchar_t>& np1 = use_facet<num_put<wchar_t> >(woss1.getloc()); - const num_put<wchar_t>& np2 = use_facet<num_put<wchar_t> >(woss2.getloc()); - - wstring result1, result2; - - woss1.precision(-1); - woss1.setf(ios_base::fixed, ios_base::floatfield); - np1.put(woss1.rdbuf(), woss1, '+', 30.5); - result1 = woss1.str(); - VERIFY( result1 == L"30.500000" ); - - woss2.precision(0); - woss2.setf(ios_base::scientific, ios_base::floatfield); - np2.put(woss2.rdbuf(), woss2, '+', 1.0); - result2 = woss2.str(); - VERIFY( result2 == L"1e+00" ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/wrapped_env.cc deleted file mode 100644 index 2baa3a44950..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,56 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/wrapped_locale.cc deleted file mode 100644 index 63e7a470160..00000000000 --- a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,56 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/numpunct/1.cc b/libstdc++-v3/testsuite/22_locale/numpunct/1.cc deleted file mode 100644 index f2f94273b9f..00000000000 --- a/libstdc++-v3/testsuite/22_locale/numpunct/1.cc +++ /dev/null @@ -1,39 +0,0 @@ -// { dg-do compile } -// 2001-01-23 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.3 The numeric punctuation facet - -#include <locale> - -void test01() -{ - // Check for required base class. - typedef std::numpunct<char> test_type; - typedef std::locale::facet base_type; - const test_type& obj = std::use_facet<test_type>(std::locale()); - const base_type* base = &obj; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/numpunct/2.cc b/libstdc++-v3/testsuite/22_locale/numpunct/2.cc deleted file mode 100644 index 0df50fa5e34..00000000000 --- a/libstdc++-v3/testsuite/22_locale/numpunct/2.cc +++ /dev/null @@ -1,39 +0,0 @@ -// { dg-do compile } -// 2001-01-23 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.3 The numeric punctuation facet - -#include <locale> - -// Should be able to instantiate this for other types besides char, wchar_t -class gnu_numpunct: public std::numpunct<unsigned char> -{ }; - -void test02() -{ - gnu_numpunct facet01; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/numpunct/members/char/1.cc b/libstdc++-v3/testsuite/22_locale/numpunct/members/char/1.cc deleted file mode 100644 index aba34e29267..00000000000 --- a/libstdc++-v3/testsuite/22_locale/numpunct/members/char/1.cc +++ /dev/null @@ -1,65 +0,0 @@ -// 2001-01-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.3.1.1 nunpunct members - -#include <locale> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_us("en_US"); - locale loc_fr("fr_FR"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_us != loc_fr ); - VERIFY( loc_us != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the numpunct facets - const numpunct<char>& nump_c = use_facet<numpunct<char> >(loc_c); - const numpunct<char>& nump_us = use_facet<numpunct<char> >(loc_us); - const numpunct<char>& nump_fr = use_facet<numpunct<char> >(loc_fr); - const numpunct<char>& nump_de = use_facet<numpunct<char> >(loc_de); - - // sanity check the data is correct. - char dp1 = nump_c.decimal_point(); - char th1 = nump_c.thousands_sep(); - string g1 = nump_c.grouping(); - string t1 = nump_c.truename(); - string f1 = nump_c.falsename(); - VERIFY ( dp1 == '.' ); - VERIFY ( th1 == ',' ); - VERIFY ( g1 == "" ); - VERIFY ( t1 == "true" ); - VERIFY ( f1 == "false" ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/numpunct/members/char/2.cc b/libstdc++-v3/testsuite/22_locale/numpunct/members/char/2.cc deleted file mode 100644 index ec9512fedbe..00000000000 --- a/libstdc++-v3/testsuite/22_locale/numpunct/members/char/2.cc +++ /dev/null @@ -1,87 +0,0 @@ -// 2001-01-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.3.1.1 nunpunct members - -#include <locale> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_us("en_US"); - locale loc_fr("fr_FR"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_us != loc_fr ); - VERIFY( loc_us != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the numpunct facets - const numpunct<char>& nump_c = use_facet<numpunct<char> >(loc_c); - const numpunct<char>& nump_us = use_facet<numpunct<char> >(loc_us); - const numpunct<char>& nump_fr = use_facet<numpunct<char> >(loc_fr); - const numpunct<char>& nump_de = use_facet<numpunct<char> >(loc_de); - - // sanity check the data is correct. - char dp1 = nump_c.decimal_point(); - char th1 = nump_c.thousands_sep(); - string g1 = nump_c.grouping(); - string t1 = nump_c.truename(); - string f1 = nump_c.falsename(); - - char dp2 = nump_us.decimal_point(); - char th2 = nump_us.thousands_sep(); - string g2 = nump_us.grouping(); - string t2 = nump_us.truename(); - string f2 = nump_us.falsename(); - - char dp3 = nump_fr.decimal_point(); - char th3 = nump_fr.thousands_sep(); - string g3 = nump_fr.grouping(); - string t3 = nump_fr.truename(); - string f3 = nump_fr.falsename(); - - char dp4 = nump_de.decimal_point(); - char th4 = nump_de.thousands_sep(); - string g4 = nump_de.grouping(); - string t4 = nump_de.truename(); - string f4 = nump_de.falsename(); - - VERIFY( dp2 != dp3 ); - VERIFY( th2 != th3 ); - - VERIFY( dp2 != dp4 ); - VERIFY( th2 != th4 ); - // XXX This isn't actually supported right now. - // VERIFY( t2 != t3 ); - // VERIFY( f2 != f3 ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/numpunct/members/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/numpunct/members/char/wrapped_env.cc deleted file mode 100644 index 4f1d5e3f6a9..00000000000 --- a/libstdc++-v3/testsuite/22_locale/numpunct/members/char/wrapped_env.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/numpunct/members/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/numpunct/members/char/wrapped_locale.cc deleted file mode 100644 index 8d7871815db..00000000000 --- a/libstdc++-v3/testsuite/22_locale/numpunct/members/char/wrapped_locale.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/1.cc deleted file mode 100644 index ac4e8201dbe..00000000000 --- a/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/1.cc +++ /dev/null @@ -1,65 +0,0 @@ -// 2001-01-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.3.1.1 nunpunct members - -#include <locale> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_us("en_US"); - locale loc_fr("fr_FR"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_us != loc_fr ); - VERIFY( loc_us != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the numpunct facets - const numpunct<wchar_t>& nump_c = use_facet<numpunct<wchar_t> >(loc_c); - const numpunct<wchar_t>& nump_us = use_facet<numpunct<wchar_t> >(loc_us); - const numpunct<wchar_t>& nump_fr = use_facet<numpunct<wchar_t> >(loc_fr); - const numpunct<wchar_t>& nump_de = use_facet<numpunct<wchar_t> >(loc_de); - - // sanity check the data is correct. - wchar_t dp1 = nump_c.decimal_point(); - wchar_t th1 = nump_c.thousands_sep(); - string g1 = nump_c.grouping(); - wstring t1 = nump_c.truename(); - wstring f1 = nump_c.falsename(); - VERIFY ( dp1 == L'.' ); - VERIFY ( th1 == L',' ); - VERIFY ( g1 == "" ); - VERIFY ( t1 == L"true" ); - VERIFY ( f1 == L"false" ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/2.cc deleted file mode 100644 index c544b29cce6..00000000000 --- a/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/2.cc +++ /dev/null @@ -1,87 +0,0 @@ -// 2001-01-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.3.1.1 nunpunct members - -#include <locale> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - - bool test = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_us("en_US"); - locale loc_fr("fr_FR"); - locale loc_de("de_DE"); - VERIFY( loc_c != loc_de ); - VERIFY( loc_us != loc_fr ); - VERIFY( loc_us != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the numpunct facets - const numpunct<wchar_t>& nump_c = use_facet<numpunct<wchar_t> >(loc_c); - const numpunct<wchar_t>& nump_us = use_facet<numpunct<wchar_t> >(loc_us); - const numpunct<wchar_t>& nump_fr = use_facet<numpunct<wchar_t> >(loc_fr); - const numpunct<wchar_t>& nump_de = use_facet<numpunct<wchar_t> >(loc_de); - - // sanity check the data is correct. - wchar_t dp1 = nump_c.decimal_point(); - wchar_t th1 = nump_c.thousands_sep(); - string g1 = nump_c.grouping(); - wstring t1 = nump_c.truename(); - wstring f1 = nump_c.falsename(); - - wchar_t dp2 = nump_us.decimal_point(); - wchar_t th2 = nump_us.thousands_sep(); - string g2 = nump_us.grouping(); - wstring t2 = nump_us.truename(); - wstring f2 = nump_us.falsename(); - - wchar_t dp3 = nump_fr.decimal_point(); - wchar_t th3 = nump_fr.thousands_sep(); - string g3 = nump_fr.grouping(); - wstring t3 = nump_fr.truename(); - wstring f3 = nump_fr.falsename(); - - wchar_t dp4 = nump_de.decimal_point(); - wchar_t th4 = nump_de.thousands_sep(); - string g4 = nump_de.grouping(); - wstring t4 = nump_de.truename(); - wstring f4 = nump_de.falsename(); - - VERIFY( dp2 != dp3 ); - VERIFY( th2 != th3 ); - - VERIFY( dp2 != dp4 ); - VERIFY( th2 != th4 ); - // XXX This isn't actually supported right now. - // VERIFY( t2 != t3 ); - // VERIFY( f2 != f3 ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/wrapped_env.cc deleted file mode 100644 index 4f1d5e3f6a9..00000000000 --- a/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/wrapped_locale.cc deleted file mode 100644 index 8d7871815db..00000000000 --- a/libstdc++-v3/testsuite/22_locale/numpunct/members/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/numpunct_byname/1.cc b/libstdc++-v3/testsuite/22_locale/numpunct_byname/1.cc deleted file mode 100644 index a6c71dc644e..00000000000 --- a/libstdc++-v3/testsuite/22_locale/numpunct_byname/1.cc +++ /dev/null @@ -1,76 +0,0 @@ -// 2001-01-24 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.3.2 Template class numpunct_byname - -#include <locale> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - - bool test = true; - string str; - - locale loc_byname(locale::classic(), new numpunct_byname<char>("de_DE")); - str = loc_byname.name(); - - locale loc_de("de_DE"); - str = loc_de.name(); - - locale loc_c = locale::classic(); - - VERIFY( loc_de != loc_byname ); - - // cache the numpunct facets - const numpunct<char>& nump_c = use_facet<numpunct<char> >(loc_c); - const numpunct<char>& nump_byname = use_facet<numpunct<char> >(loc_byname); - const numpunct<char>& nump_de = use_facet<numpunct<char> >(loc_de); - - // sanity check that the data match - char dp1 = nump_byname.decimal_point(); - char th1 = nump_byname.thousands_sep(); - string g1 = nump_byname.grouping(); - string t1 = nump_byname.truename(); - string f1 = nump_byname.falsename(); - - char dp2 = nump_de.decimal_point(); - char th2 = nump_de.thousands_sep(); - string g2 = nump_de.grouping(); - string t2 = nump_de.truename(); - string f2 = nump_de.falsename(); - - VERIFY( dp1 == dp2 ); - VERIFY( th1 == th2 ); - VERIFY( g1 == g2 ); - VERIFY( t1 == t2 ); - VERIFY( f1 == f2 ); - - // ...and don't match "C" - char dp3 = nump_c.decimal_point(); - VERIFY( dp1 != dp3 ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/numpunct_byname/2.cc b/libstdc++-v3/testsuite/22_locale/numpunct_byname/2.cc deleted file mode 100644 index f096a8b9f0c..00000000000 --- a/libstdc++-v3/testsuite/22_locale/numpunct_byname/2.cc +++ /dev/null @@ -1,45 +0,0 @@ -// 2001-01-24 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.3.2 Template class numpunct_byname - -#include <locale> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - - bool test = true; - - locale loc_it("it_IT"); - - const numpunct<char>& nump_it = use_facet<numpunct<char> >(loc_it); - - string g = nump_it.grouping(); - - VERIFY( g == "" ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/1.cc deleted file mode 100644 index 04d4aa84ce0..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/1.cc +++ /dev/null @@ -1,45 +0,0 @@ -// { dg-do compile } -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1 Template class time_get - -#include <locale> - -void test01() -{ - // Check for required base class. - typedef std::time_get<char> test_type; - typedef std::locale::facet base_type1; - typedef std::time_base base_type2; - const test_type& obj = std::use_facet<test_type>(std::locale()); - const base_type1* base1 = &obj; - const base_type2* base2 = &obj; - - // Check for required typedefs - typedef test_type::char_type char_type; - typedef test_type::iter_type iter_type; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/2.cc deleted file mode 100644 index 87e8533d316..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/2.cc +++ /dev/null @@ -1,39 +0,0 @@ -// { dg-do compile } -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1 Template class time_get - -#include <locale> - -// Should be able to instantiate this for other types besides char, wchar_t -class gnu_time_get: public std::time_get<unsigned char> -{ }; - -void test02() -{ - gnu_time_get facet01; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/date_order/char/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/date_order/char/1.cc deleted file mode 100644 index 46958a21da3..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/date_order/char/1.cc +++ /dev/null @@ -1,69 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - bool test = true; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<char> iterator_type; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); - const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); - const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); - const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); - - const string empty; - - // create an ostream-derived object, cache the time_get facet - iterator_type end; - istringstream iss; - iss.imbue(loc_c); - const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc()); - - // 1 - // dateorder date_order() const - dateorder do1 = tim_get.date_order(); - // VERIFY( do1 == time_base::mdy ); - VERIFY( do1 == time_base::no_order ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/date_order/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/date_order/char/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/date_order/char/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/date_order/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/date_order/char/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/date_order/char/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/1.cc deleted file mode 100644 index 9baf0216bc2..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/1.cc +++ /dev/null @@ -1,70 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - bool test = true; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<wchar_t> iterator_type; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c); - const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de); - const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk); - const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr); - - const string empty; - - // create an ostream-derived object, cache the time_get facet - iterator_type end; - istringstream iss; - iss.imbue(loc_c); - const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc()); - - // 1 - // dateorder date_order() const - iss.imbue(loc_c); - dateorder do1 = tim_get.date_order(); - // VERIFY( do1 == time_base::mdy ); - VERIFY( do1 == time_base::no_order ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/wrapped_env.cc deleted file mode 100644 index b3d040edc7a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/wrapped_locale.cc deleted file mode 100644 index 17d4d5dcb82..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/date_order/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/1.cc deleted file mode 100644 index f242c4bee4a..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/1.cc +++ /dev/null @@ -1,112 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); - const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); - const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); - const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); - - const string empty; - - // create an ostream-derived object, cache the time_get facet - iterator_type end; - - istringstream iss; - iss.imbue(loc_c); - const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc()); - - const ios_base::iostate good = ios_base::goodbit; - ios_base::iostate errorstate = good; - - // create "C" time objects - const tm time_bday = { 0, 0, 12, 4, 3, 71 }; - const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - "%w %W %x %X %y %Y %Z %%"; - const char* date = "%A, the second of %B"; - const char* date_ex = "%Ex"; - - // iter_type - // get_date(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const - - // sanity checks for "C" locale - iss.str("04/04/71"); - iterator_type is_it01(iss); - tm time01; - errorstate = good; - tim_get.get_date(is_it01, end, iss, errorstate, &time01); - VERIFY( time01.tm_year == time_bday.tm_year ); - VERIFY( time01.tm_mon == time_bday.tm_mon ); - VERIFY( time01.tm_mday == time_bday.tm_mday ); - VERIFY( errorstate == ios_base::eofbit ); - - iss.str("04/04/71 "); - iterator_type is_it02(iss); - tm time02; - errorstate = good; - tim_get.get_date(is_it02, end, iss, errorstate, &time02); - VERIFY( time02.tm_year == time_bday.tm_year ); - VERIFY( time02.tm_mon == time_bday.tm_mon ); - VERIFY( time02.tm_mday == time_bday.tm_mday ); - VERIFY( errorstate == good ); - VERIFY( *is_it02 == ' '); - - iss.str("04/04d/71 "); - iterator_type is_it03(iss); - tm time03; - time03.tm_year = 3; - errorstate = good; - tim_get.get_date(is_it03, end, iss, errorstate, &time03); - VERIFY( time03.tm_year == 3 ); - VERIFY( time03.tm_mon == time_bday.tm_mon ); - VERIFY( time03.tm_mday == time_bday.tm_mday ); - VERIFY( errorstate == ios_base::failbit ); - VERIFY( *is_it03 == 'd'); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/2.cc deleted file mode 100644 index 274a231cd6e..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/2.cc +++ /dev/null @@ -1,108 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); - const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); - const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); - const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); - - const string empty; - - // create an ostream-derived object, cache the time_get facet - iterator_type end; - - istringstream iss; - const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc()); - - const ios_base::iostate good = ios_base::goodbit; - ios_base::iostate errorstate = good; - - // create "C" time objects - const tm time_bday = { 0, 0, 12, 4, 3, 71 }; - const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - "%w %W %x %X %y %Y %Z %%"; - const char* date = "%A, the second of %B"; - const char* date_ex = "%Ex"; - - // iter_type - // get_date(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const - - // sanity checks for "C" locale - iss.imbue(loc_c); - iss.str("04/04/71"); - iterator_type is_it01(iss); - tm time01; - errorstate = good; - - // inspection of named locales, de_DE - iss.imbue(loc_de); - iss.str("04.04.1971"); - iterator_type is_it10(iss); - tm time10; - errorstate = good; - tim_get.get_date(is_it10, end, iss, errorstate, &time10); - VERIFY( time10.tm_mon == time_bday.tm_mon ); - VERIFY( time10.tm_mday == time_bday.tm_mday ); - VERIFY( time10.tm_year == time_bday.tm_year ); - VERIFY( errorstate == ios_base::eofbit ); - - // inspection of named locales, en_HK - iss.imbue(loc_hk); - iss.str("Sunday, April 04, 1971"); - iterator_type is_it20(iss); - tm time20; - errorstate = good; - tim_get.get_date(is_it20, end, iss, errorstate, &time20); - VERIFY( time20.tm_mon == time_bday.tm_mon ); - VERIFY( time20.tm_mday == time_bday.tm_mday ); - VERIFY( time20.tm_year == time_bday.tm_year ); - VERIFY( errorstate == ios_base::eofbit ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/3.cc deleted file mode 100644 index 249b5e8001f..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/3.cc +++ /dev/null @@ -1,72 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - bool test = true; - - // Check time_get works with other iterators besides streambuf - // input iterators. - typedef string::const_iterator iter_type; - typedef time_get<char, iter_type> time_get_type; - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = goodbit; - const locale loc_c = locale::classic(); - - // Create "C" time objects - const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 }; - tm tm1; - - istringstream iss; - iss.imbue(locale(loc_c, new time_get_type)); - - // Iterator advanced, state, output. - const time_get_type& tg = use_facet<time_get_type>(iss.getloc()); - - // Cindy Sherman's Untitled Film Stills - // June 26-September 2, 1997 - const string str = "06/26/97 Tuesday September 1997 Cindy Sherman"; - - // 02 get_date - string res2; - err = goodbit; - // White space is not eaten, so manually increment past it. - iter_type end2 = tg.get_date(str.begin(), str.end(), iss, err, &tm1); - string rem2(end2, str.end()); - VERIFY( err == goodbit ); - VERIFY( tm1.tm_year == time_sanity.tm_year ); - VERIFY( tm1.tm_mon == time_sanity.tm_mon ); - VERIFY( tm1.tm_mday == time_sanity.tm_mday ); - VERIFY( rem2 == " Tuesday September 1997 Cindy Sherman" ); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/wrapped_env.cc deleted file mode 100644 index 3f042d9ec42..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/wrapped_env.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/wrapped_locale.cc deleted file mode 100644 index 61086ad6da8..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/wrapped_locale.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/1.cc deleted file mode 100644 index 965493d316f..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/1.cc +++ /dev/null @@ -1,112 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c); - const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de); - const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk); - const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr); - - const wstring empty; - - // create an ostream-derived object, cache the time_get facet - iterator_type end; - - wistringstream iss; - iss.imbue(loc_c); - const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc()); - - const ios_base::iostate good = ios_base::goodbit; - ios_base::iostate errorstate = good; - - // create "C" time objects - const tm time_bday = { 0, 0, 12, 4, 3, 71 }; - const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - L"%w %W %x %X %y %Y %Z %%"; - const wchar_t* date = L"%A, the second of %B"; - const wchar_t* date_ex = L"%Ex"; - - // iter_type - // get_date(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const - - // sanity checks for "C" locale - iss.str(L"04/04/71"); - iterator_type is_it01(iss); - tm time01; - errorstate = good; - tim_get.get_date(is_it01, end, iss, errorstate, &time01); - VERIFY( time01.tm_year == time_bday.tm_year ); - VERIFY( time01.tm_mon == time_bday.tm_mon ); - VERIFY( time01.tm_mday == time_bday.tm_mday ); - VERIFY( errorstate == ios_base::eofbit ); - - iss.str(L"04/04/71 "); - iterator_type is_it02(iss); - tm time02; - errorstate = good; - tim_get.get_date(is_it02, end, iss, errorstate, &time02); - VERIFY( time02.tm_year == time_bday.tm_year ); - VERIFY( time02.tm_mon == time_bday.tm_mon ); - VERIFY( time02.tm_mday == time_bday.tm_mday ); - VERIFY( errorstate == good ); - VERIFY( *is_it02 == ' '); - - iss.str(L"04/04d/71 "); - iterator_type is_it03(iss); - tm time03; - time03.tm_year = 3; - errorstate = good; - tim_get.get_date(is_it03, end, iss, errorstate, &time03); - VERIFY( time03.tm_year == 3 ); - VERIFY( time03.tm_mon == time_bday.tm_mon ); - VERIFY( time03.tm_mday == time_bday.tm_mday ); - VERIFY( errorstate == ios_base::failbit ); - VERIFY( *is_it03 == 'd'); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/2.cc deleted file mode 100644 index 1e4d57afb44..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/2.cc +++ /dev/null @@ -1,108 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c); - const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de); - const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk); - const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr); - - const wstring empty; - - // create an ostream-derived object, cache the time_get facet - iterator_type end; - - wistringstream iss; - const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc()); - - const ios_base::iostate good = ios_base::goodbit; - ios_base::iostate errorstate = good; - - // create "C" time objects - const tm time_bday = { 0, 0, 12, 4, 3, 71 }; - const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - L"%w %W %x %X %y %Y %Z %%"; - const wchar_t* date = L"%A, the second of %B"; - const wchar_t* date_ex = L"%Ex"; - - // iter_type - // get_date(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const - - // sanity checks for "C" locale - iss.imbue(loc_c); - iss.str(L"04/04/71"); - iterator_type is_it01(iss); - tm time01; - errorstate = good; - - // inspection of named locales, de_DE - iss.imbue(loc_de); - iss.str(L"04.04.1971"); - iterator_type is_it10(iss); - tm time10; - errorstate = good; - tim_get.get_date(is_it10, end, iss, errorstate, &time10); - VERIFY( time10.tm_mon == time_bday.tm_mon ); - VERIFY( time10.tm_mday == time_bday.tm_mday ); - VERIFY( time10.tm_year == time_bday.tm_year ); - VERIFY( errorstate == ios_base::eofbit ); - - // inspection of named locales, en_HK - iss.imbue(loc_hk); - iss.str(L"Sunday, April 04, 1971"); - iterator_type is_it20(iss); - tm time20; - errorstate = good; - tim_get.get_date(is_it20, end, iss, errorstate, &time20); - VERIFY( time20.tm_mon == time_bday.tm_mon ); - VERIFY( time20.tm_mday == time_bday.tm_mday ); - VERIFY( time20.tm_year == time_bday.tm_year ); - VERIFY( errorstate == ios_base::eofbit ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/3.cc deleted file mode 100644 index b02049fcb46..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/3.cc +++ /dev/null @@ -1,72 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - bool test = true; - - // Check time_get works with other iterators besides streambuf - // input iterators. - typedef wstring::const_iterator iter_type; - typedef time_get<wchar_t, iter_type> time_get_type; - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = goodbit; - const locale loc_c = locale::classic(); - - // Create "C" time objects - const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 }; - tm tm1; - - istringstream iss; - iss.imbue(locale(loc_c, new time_get_type)); - - // Iterator advanced, state, output. - const time_get_type& tg = use_facet<time_get_type>(iss.getloc()); - - // Cindy Sherman's Untitled Film Stills - // June 26-September 2, 1997 - const wstring str = L"06/26/97 Tuesday September 1997 Cindy Sherman"; - - // 02 get_date - string res2; - err = goodbit; - // White space is not eaten, so manually increment past it. - iter_type end2 = tg.get_date(str.begin(), str.end(), iss, err, &tm1); - string rem2(end2, str.end()); - VERIFY( err == goodbit ); - VERIFY( tm1.tm_year == time_sanity.tm_year ); - VERIFY( tm1.tm_mon == time_sanity.tm_mon ); - VERIFY( tm1.tm_mday == time_sanity.tm_mday ); - VERIFY( rem2 == " Tuesday September 1997 Cindy Sherman" ); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/wrapped_env.cc deleted file mode 100644 index 3f042d9ec42..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/wrapped_locale.cc deleted file mode 100644 index 61086ad6da8..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/1.cc deleted file mode 100644 index 2fd9b760005..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/1.cc +++ /dev/null @@ -1,126 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<char> iterator_type; - - const ios_base::iostate good = ios_base::goodbit; - ios_base::iostate errorstate = good; - - bool test = true; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); - const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); - const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); - const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); - - // create "C" time objects - const tm time_bday = { 0, 0, 12, 4, 3, 71 }; - - // iter_type - // get_monthname(iter_type, iter_type, ios_base&, - // ios_base::iostate&, tm*) const - - // sanity checks for "C" locale - iterator_type end; - istringstream iss; - iss.imbue(loc_c); - const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc()); - - iss.str("April"); - iterator_type is_it01(iss); - tm time01; - errorstate = good; - tim_get.get_monthname(is_it01, end, iss, errorstate, &time01); - VERIFY( time01.tm_mon == time_bday.tm_mon ); - VERIFY( errorstate == ios_base::eofbit ); - - iss.str("Apr"); - iterator_type is_it02(iss); - tm time02; - errorstate = good; - tim_get.get_monthname(is_it02, end, iss, errorstate, &time02); - VERIFY( time02.tm_mon == time_bday.tm_mon ); - VERIFY( errorstate == ios_base::eofbit ); - - iss.str("Apr "); - iterator_type is_it03(iss); - tm time03; - errorstate = good; - tim_get.get_monthname(is_it03, end, iss, errorstate, &time03); - VERIFY( time03.tm_mon == time_bday.tm_mon ); - VERIFY( errorstate == good ); - VERIFY( *is_it03 == ' '); - - iss.str("Aar"); - iterator_type is_it04(iss); - tm time04; - time04.tm_mon = 5; - errorstate = good; - tim_get.get_monthname(is_it04, end, iss, errorstate, &time04); - VERIFY( time04.tm_mon == 5 ); - VERIFY( *is_it04 == 'a'); - VERIFY( errorstate == ios_base::failbit ); - - iss.str("December "); - iterator_type is_it05(iss); - tm time05; - errorstate = good; - tim_get.get_monthname(is_it05, end, iss, errorstate, &time05); - VERIFY( time05.tm_mon == 11 ); - VERIFY( errorstate == good ); - VERIFY( *is_it05 == ' '); - - iss.str("Decelember "); - iterator_type is_it06(iss); - tm time06; - time06.tm_mon = 4; - errorstate = good; - tim_get.get_monthname(is_it06, end, iss, errorstate, &time06); - VERIFY( time06.tm_mon == 4 ); - VERIFY( errorstate == ios_base::failbit ); - VERIFY( *is_it05 == 'l'); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/2.cc deleted file mode 100644 index c98f8d1cb50..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/2.cc +++ /dev/null @@ -1,90 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); - const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); - const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); - const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); - - const tm time_bday = { 0, 0, 12, 4, 3, 71 }; - - const string empty; - - const ios_base::iostate good = ios_base::goodbit; - ios_base::iostate errorstate = good; - - // create an ostream-derived object, cache the time_get facet - iterator_type end; - - istringstream iss; - iss.imbue(loc_de); - const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc()); - - // inspection of named locales, de_DE - iss.str("April"); - iterator_type is_it10(iss); - tm time10; - errorstate = good; - tim_get.get_monthname(is_it10, end, iss, errorstate, &time10); - VERIFY( time10.tm_mon == time_bday.tm_mon ); - VERIFY( errorstate == ios_base::eofbit ); - - // inspection of named locales, en_HK - iss.imbue(loc_hk); - const time_get<char>& tim_get2 = use_facet<time_get<char> >(iss.getloc()); - iss.str("April"); - iterator_type is_it20(iss); - tm time20; - errorstate = good; - tim_get2.get_monthname(is_it20, end, iss, errorstate, &time20); - VERIFY( time20.tm_mon == time_bday.tm_mon ); - VERIFY( errorstate == ios_base::eofbit ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/3.cc deleted file mode 100644 index c876f5c364b..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/3.cc +++ /dev/null @@ -1,70 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - bool test = true; - - // Check time_get works with other iterators besides streambuf - // input iterators. - typedef string::const_iterator iter_type; - typedef time_get<char, iter_type> time_get_type; - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = goodbit; - const locale loc_c = locale::classic(); - - // Create "C" time objects - const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 }; - tm tm1; - - istringstream iss; - iss.imbue(locale(loc_c, new time_get_type)); - - // Iterator advanced, state, output. - const time_get_type& tg = use_facet<time_get_type>(iss.getloc()); - - // Cindy Sherman's Untitled Film Stills - // June 26-September 2, 1997 - const string str = "September 1997 Cindy Sherman"; - - // 04 get_monthname - string res4; - err = goodbit; - // White space is not eaten, so manually increment past it. - iter_type end4 = tg.get_monthname(str.begin(), str.end(), iss, err, &tm1); - string rem4(end4, str.end()); - VERIFY( err == goodbit ); - VERIFY( tm1.tm_mon == 8 ); - VERIFY( rem4 == " 1997 Cindy Sherman" ); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/wrapped_env.cc deleted file mode 100644 index 3f042d9ec42..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/wrapped_env.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/wrapped_locale.cc deleted file mode 100644 index 61086ad6da8..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/wrapped_locale.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/1.cc deleted file mode 100644 index 8ba9d5df074..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/1.cc +++ /dev/null @@ -1,126 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<wchar_t> iterator_type; - - const ios_base::iostate good = ios_base::goodbit; - ios_base::iostate errorstate = good; - - bool test = true; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c); - const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de); - const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk); - const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr); - - // create "C" time objects - const tm time_bday = { 0, 0, 12, 4, 3, 71 }; - - // iter_type - // get_monthname(iter_type, iter_type, ios_base&, - // ios_base::iostate&, tm*) const - - // sanity checks for "C" locale - iterator_type end; - wistringstream iss; - iss.imbue(loc_c); - const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc()); - - iss.str(L"April"); - iterator_type is_it01(iss); - tm time01; - errorstate = good; - tim_get.get_monthname(is_it01, end, iss, errorstate, &time01); - VERIFY( time01.tm_mon == time_bday.tm_mon ); - VERIFY( errorstate == ios_base::eofbit ); - - iss.str(L"Apr"); - iterator_type is_it02(iss); - tm time02; - errorstate = good; - tim_get.get_monthname(is_it02, end, iss, errorstate, &time02); - VERIFY( time02.tm_mon == time_bday.tm_mon ); - VERIFY( errorstate == ios_base::eofbit ); - - iss.str(L"Apr "); - iterator_type is_it03(iss); - tm time03; - errorstate = good; - tim_get.get_monthname(is_it03, end, iss, errorstate, &time03); - VERIFY( time03.tm_mon == time_bday.tm_mon ); - VERIFY( errorstate == good ); - VERIFY( *is_it03 == ' '); - - iss.str(L"Aar"); - iterator_type is_it04(iss); - tm time04; - time04.tm_mon = 5; - errorstate = good; - tim_get.get_monthname(is_it04, end, iss, errorstate, &time04); - VERIFY( time04.tm_mon == 5 ); - VERIFY( *is_it04 == 'a'); - VERIFY( errorstate == ios_base::failbit ); - - iss.str(L"December "); - iterator_type is_it05(iss); - tm time05; - errorstate = good; - tim_get.get_monthname(is_it05, end, iss, errorstate, &time05); - VERIFY( time05.tm_mon == 11 ); - VERIFY( errorstate == good ); - VERIFY( *is_it05 == ' '); - - iss.str(L"Decelember "); - iterator_type is_it06(iss); - tm time06; - time06.tm_mon = 4; - errorstate = good; - tim_get.get_monthname(is_it06, end, iss, errorstate, &time06); - VERIFY( time06.tm_mon == 4 ); - VERIFY( errorstate == ios_base::failbit ); - VERIFY( *is_it05 == 'l'); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/2.cc deleted file mode 100644 index 80fe2dfda41..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/2.cc +++ /dev/null @@ -1,90 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c); - const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de); - const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk); - const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr); - - const tm time_bday = { 0, 0, 12, 4, 3, 71 }; - - const wstring empty; - - const ios_base::iostate good = ios_base::goodbit; - ios_base::iostate errorstate = good; - - // create an ostream-derived object, cache the time_get facet - iterator_type end; - - wistringstream iss; - iss.imbue(loc_de); - const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc()); - - // inspection of named locales, de_DE - iss.str(L"April"); - iterator_type is_it10(iss); - tm time10; - errorstate = good; - tim_get.get_monthname(is_it10, end, iss, errorstate, &time10); - VERIFY( time10.tm_mon == time_bday.tm_mon ); - VERIFY( errorstate == ios_base::eofbit ); - - // inspection of named locales, en_HK - iss.imbue(loc_hk); - const time_get<wchar_t>& tim_get2 = use_facet<time_get<wchar_t> >(iss.getloc()); - iss.str(L"April"); - iterator_type is_it20(iss); - tm time20; - errorstate = good; - tim_get2.get_monthname(is_it20, end, iss, errorstate, &time20); - VERIFY( time20.tm_mon == time_bday.tm_mon ); - VERIFY( errorstate == ios_base::eofbit ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/3.cc deleted file mode 100644 index 5cb2b651a9c..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/3.cc +++ /dev/null @@ -1,70 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - bool test = true; - - // Check time_get works with other iterators besides streambuf - // input iterators. - typedef wstring::const_iterator iter_type; - typedef time_get<wchar_t, iter_type> time_get_type; - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = goodbit; - const locale loc_c = locale::classic(); - - // Create "C" time objects - const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 }; - tm tm1; - - istringstream iss; - iss.imbue(locale(loc_c, new time_get_type)); - - // Iterator advanced, state, output. - const time_get_type& tg = use_facet<time_get_type>(iss.getloc()); - - // Cindy Sherman's Untitled Film Stills - // June 26-September 2, 1997 - const wstring str = L"September 1997 Cindy Sherman"; - - // 04 get_monthname - wstring res4; - err = goodbit; - // White space is not eaten, so manually increment past it. - iter_type end4 = tg.get_monthname(str.begin(), str.end(), iss, err, &tm1); - wstring rem4(end4, str.end()); - VERIFY( err == goodbit ); - VERIFY( tm1.tm_mon == 8 ); - VERIFY( rem4 == L" 1997 Cindy Sherman" ); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/wrapped_env.cc deleted file mode 100644 index 3f042d9ec42..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/wrapped_locale.cc deleted file mode 100644 index 61086ad6da8..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/1.cc deleted file mode 100644 index 80d996c0c47..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/1.cc +++ /dev/null @@ -1,127 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - bool test = true; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<char> iterator_type; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); - const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); - const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); - const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); - - const string empty; - - // create an ostream-derived object, cache the time_get facet - iterator_type end; - istringstream iss; - iss.imbue(loc_c); - const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc()); - - const ios_base::iostate good = ios_base::goodbit; - ios_base::iostate errorstate = good; - - // create "C" time objects - const tm time_bday = { 0, 0, 12, 4, 3, 71 }; - const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - "%w %W %x %X %y %Y %Z %%"; - const char* date = "%A, the second of %B"; - const char* date_ex = "%Ex"; - - // 2 - // iter_type - // get_time(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const - - // sanity checks for "C" locale - iss.str("12:00:00"); - iterator_type is_it01(iss); - tm time01; - errorstate = good; - tim_get.get_time(is_it01, end, iss, errorstate, &time01); - VERIFY( time01.tm_sec == time_bday.tm_sec ); - VERIFY( time01.tm_min == time_bday.tm_min ); - VERIFY( time01.tm_hour == time_bday.tm_hour ); - VERIFY( errorstate == ios_base::eofbit ); - - iss.str("12:00:00 "); - iterator_type is_it02(iss); - tm time02; - errorstate = good; - tim_get.get_time(is_it02, end, iss, errorstate, &time02); - VERIFY( time01.tm_sec == time_bday.tm_sec ); - VERIFY( time01.tm_min == time_bday.tm_min ); - VERIFY( time01.tm_hour == time_bday.tm_hour ); - VERIFY( errorstate == good ); - - iss.str("12:61:00 "); - iterator_type is_it03(iss); - tm time03; - errorstate = good; - tim_get.get_time(is_it03, end, iss, errorstate, &time03); - VERIFY( time01.tm_hour == time_bday.tm_hour ); - VERIFY( errorstate == ios_base::failbit ); - - iss.str("12:a:00 "); - iterator_type is_it04(iss); - tm time04; - errorstate = good; - tim_get.get_time(is_it04, end, iss, errorstate, &time04); - VERIFY( time01.tm_hour == time_bday.tm_hour ); - VERIFY( *is_it04 == 'a'); - VERIFY( errorstate == ios_base::failbit ); - - // inspection of named locales, de_DE - iss.imbue(loc_de); - iss.str("12:00:00"); - iterator_type is_it10(iss); - tm time10; - errorstate = good; - tim_get.get_time(is_it10, end, iss, errorstate, &time10); - VERIFY( time10.tm_sec == time_bday.tm_sec ); - VERIFY( time10.tm_min == time_bday.tm_min ); - VERIFY( time10.tm_hour == time_bday.tm_hour ); - VERIFY( errorstate == ios_base::eofbit ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/2.cc deleted file mode 100644 index 1d56827071c..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/2.cc +++ /dev/null @@ -1,80 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - bool test = true; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<char> iterator_type; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); - const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); - const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); - const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); - - const string empty; - const tm time_bday = { 0, 0, 12, 4, 3, 71 }; - - // create an ostream-derived object, cache the time_get facet - iterator_type end; - istringstream iss; - const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc()); - const ios_base::iostate good = ios_base::goodbit; - ios_base::iostate errorstate = good; - - // inspection of named locales, en_HK - iss.imbue(loc_hk); - iss.str("12:00:00 PST"); - // Hong Kong in California! Well, they have Paris in Vegas... this - // is all a little disney-esque anyway. Besides, you can get decent - // Dim Sum in San Francisco. - iterator_type is_it20(iss); - tm time20; - errorstate = good; - tim_get.get_time(is_it20, end, iss, errorstate, &time20); - VERIFY( time20.tm_sec == time_bday.tm_sec ); - VERIFY( time20.tm_min == time_bday.tm_min ); - VERIFY( time20.tm_hour == time_bday.tm_hour ); - VERIFY( errorstate == ios_base::eofbit ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/3.cc deleted file mode 100644 index 01a06cacc28..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/3.cc +++ /dev/null @@ -1,71 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - bool test = true; - - // Check time_get works with other iterators besides streambuf - // input iterators. - typedef string::const_iterator iter_type; - typedef time_get<char, iter_type> time_get_type; - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = goodbit; - const locale loc_c = locale::classic(); - - // Create "C" time objects - const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 }; - tm tm1; - - istringstream iss; - iss.imbue(locale(loc_c, new time_get_type)); - - // Iterator advanced, state, output. - const time_get_type& tg = use_facet<time_get_type>(iss.getloc()); - - // Cindy Sherman's Untitled Film Stills - // June 26-September 2, 1997 - const string str = "12:00:00 06/26/97 Tuesday September 1997 Cindy Sherman"; - - // 01 get_time - string res1; - err = goodbit; - iter_type end1 = tg.get_time(str.begin(), str.end(), iss, err, &tm1); - string rem1(end1, str.end()); - VERIFY( err == goodbit ); - VERIFY( tm1.tm_sec == time_sanity.tm_sec ); - VERIFY( tm1.tm_min == time_sanity.tm_min ); - VERIFY( tm1.tm_hour == time_sanity.tm_hour ); - VERIFY( rem1 == " 06/26/97 Tuesday September 1997 Cindy Sherman" ); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/wrapped_env.cc deleted file mode 100644 index 3f042d9ec42..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/wrapped_env.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/wrapped_locale.cc deleted file mode 100644 index 61086ad6da8..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/wrapped_locale.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/1.cc deleted file mode 100644 index 5d64670f3bd..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/1.cc +++ /dev/null @@ -1,127 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - bool test = true; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<wchar_t> iterator_type; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c); - const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de); - const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk); - const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr); - - const wstring empty; - - // create an ostream-derived object, cache the time_get facet - iterator_type end; - wistringstream iss; - iss.imbue(loc_c); - const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc()); - - const ios_base::iostate good = ios_base::goodbit; - ios_base::iostate errorstate = good; - - // create "C" time objects - const tm time_bday = { 0, 0, 12, 4, 3, 71 }; - const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - L"%w %W %x %X %y %Y %Z %%"; - const wchar_t* date = L"%A, the second of %B"; - const wchar_t* date_ex = L"%Ex"; - - // 2 - // iter_type - // get_time(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const - - // sanity checks for "C" locale - iss.str(L"12:00:00"); - iterator_type is_it01(iss); - tm time01; - errorstate = good; - tim_get.get_time(is_it01, end, iss, errorstate, &time01); - VERIFY( time01.tm_sec == time_bday.tm_sec ); - VERIFY( time01.tm_min == time_bday.tm_min ); - VERIFY( time01.tm_hour == time_bday.tm_hour ); - VERIFY( errorstate == ios_base::eofbit ); - - iss.str(L"12:00:00 "); - iterator_type is_it02(iss); - tm time02; - errorstate = good; - tim_get.get_time(is_it02, end, iss, errorstate, &time02); - VERIFY( time01.tm_sec == time_bday.tm_sec ); - VERIFY( time01.tm_min == time_bday.tm_min ); - VERIFY( time01.tm_hour == time_bday.tm_hour ); - VERIFY( errorstate == good ); - - iss.str(L"12:61:00 "); - iterator_type is_it03(iss); - tm time03; - errorstate = good; - tim_get.get_time(is_it03, end, iss, errorstate, &time03); - VERIFY( time01.tm_hour == time_bday.tm_hour ); - VERIFY( errorstate == ios_base::failbit ); - - iss.str(L"12:a:00 "); - iterator_type is_it04(iss); - tm time04; - errorstate = good; - tim_get.get_time(is_it04, end, iss, errorstate, &time04); - VERIFY( time01.tm_hour == time_bday.tm_hour ); - VERIFY( *is_it04 == 'a'); - VERIFY( errorstate == ios_base::failbit ); - - // inspection of named locales, de_DE - iss.imbue(loc_de); - iss.str(L"12:00:00"); - iterator_type is_it10(iss); - tm time10; - errorstate = good; - tim_get.get_time(is_it10, end, iss, errorstate, &time10); - VERIFY( time10.tm_sec == time_bday.tm_sec ); - VERIFY( time10.tm_min == time_bday.tm_min ); - VERIFY( time10.tm_hour == time_bday.tm_hour ); - VERIFY( errorstate == ios_base::eofbit ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/2.cc deleted file mode 100644 index 5b7293848cc..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/2.cc +++ /dev/null @@ -1,80 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - bool test = true; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<wchar_t> iterator_type; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c); - const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de); - const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk); - const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr); - - const wstring empty; - const tm time_bday = { 0, 0, 12, 4, 3, 71 }; - - // create an ostream-derived object, cache the time_get facet - iterator_type end; - wistringstream iss; - const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc()); - const ios_base::iostate good = ios_base::goodbit; - ios_base::iostate errorstate = good; - - // inspection of named locales, en_HK - iss.imbue(loc_hk); - iss.str(L"12:00:00 PST"); - // Hong Kong in California! Well, they have Paris in Vegas... this - // is all a little disney-esque anyway. Besides, you can get decent - // Dim Sum in San Francisco. - iterator_type is_it20(iss); - tm time20; - errorstate = good; - tim_get.get_time(is_it20, end, iss, errorstate, &time20); - VERIFY( time20.tm_sec == time_bday.tm_sec ); - VERIFY( time20.tm_min == time_bday.tm_min ); - VERIFY( time20.tm_hour == time_bday.tm_hour ); - VERIFY( errorstate == ios_base::eofbit ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/3.cc deleted file mode 100644 index bb9c2e0b46f..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/3.cc +++ /dev/null @@ -1,71 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - bool test = true; - - // Check time_get works with other iterators besides streambuf - // input iterators. - typedef wstring::const_iterator iter_type; - typedef time_get<wchar_t, iter_type> time_get_type; - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = goodbit; - const locale loc_c = locale::classic(); - - // Create "C" time objects - const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 }; - tm tm1; - - wistringstream iss; - iss.imbue(locale(loc_c, new time_get_type)); - - // Iterator advanced, state, output. - const time_get_type& tg = use_facet<time_get_type>(iss.getloc()); - - // Cindy Sherman's Untitled Film Stills - // June 26-September 2, 1997 - const wstring str = L"12:00:00 06/26/97 Tuesday September 1997 Cindy Sherman"; - - // 01 get_time - wstring res1; - err = goodbit; - iter_type end1 = tg.get_time(str.begin(), str.end(), iss, err, &tm1); - wstring rem1(end1, str.end()); - VERIFY( err == goodbit ); - VERIFY( tm1.tm_sec == time_sanity.tm_sec ); - VERIFY( tm1.tm_min == time_sanity.tm_min ); - VERIFY( tm1.tm_hour == time_sanity.tm_hour ); - VERIFY( rem1 == L" 06/26/97 Tuesday September 1997 Cindy Sherman" ); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/wrapped_env.cc deleted file mode 100644 index 3f042d9ec42..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/wrapped_locale.cc deleted file mode 100644 index 61086ad6da8..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/1.cc deleted file mode 100644 index ca89d1e4a2b..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/1.cc +++ /dev/null @@ -1,134 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); - const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); - const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); - const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); - - const string empty; - - // create an ostream-derived object, cache the time_get facet - iterator_type end; - - istringstream iss; - iss.imbue(loc_c); - const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc()); - - const ios_base::iostate good = ios_base::goodbit; - ios_base::iostate errorstate = good; - - // create "C" time objects - const tm time_bday = { 0, 0, 12, 4, 3, 71 }; - const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - "%w %W %x %X %y %Y %Z %%"; - const char* date = "%A, the second of %B"; - const char* date_ex = "%Ex"; - - // iter_type - // get_weekday(iter_type, iter_type, ios_base&, - // ios_base::iostate&, tm*) const - - // sanity checks for "C" locale - iss.str("Sunday"); - iterator_type is_it01(iss); - tm time01; - errorstate = good; - tim_get.get_weekday(is_it01, end, iss, errorstate, &time01); - VERIFY( time01.tm_wday == time_bday.tm_wday ); - VERIFY( errorstate == ios_base::eofbit ); - - iss.str("Sun"); - iterator_type is_it02(iss); - tm time02; - errorstate = good; - tim_get.get_weekday(is_it02, end, iss, errorstate, &time02); - VERIFY( time02.tm_wday == time_bday.tm_wday ); - VERIFY( errorstate == ios_base::eofbit ); - - iss.str("Sun "); - iterator_type is_it03(iss); - tm time03; - errorstate = good; - tim_get.get_weekday(is_it03, end, iss, errorstate, &time03); - VERIFY( time03.tm_wday == time_bday.tm_wday ); - VERIFY( errorstate == good ); - VERIFY( *is_it03 == ' '); - - iss.str("San"); - iterator_type is_it04(iss); - tm time04; - time04.tm_wday = 4; - errorstate = good; - tim_get.get_weekday(is_it04, end, iss, errorstate, &time04); - VERIFY( time04.tm_wday == 4 ); - VERIFY( *is_it04 == 'n'); - VERIFY( errorstate == ios_base::failbit ); - - iss.str("Tuesday "); - iterator_type is_it05(iss); - tm time05; - errorstate = good; - tim_get.get_weekday(is_it05, end, iss, errorstate, &time05); - VERIFY( time05.tm_wday == 2 ); - VERIFY( errorstate == good ); - VERIFY( *is_it05 == ' '); - - iss.str("Tuesducky "); // Kind of like Fryday, without the swirls. - iterator_type is_it06(iss); - tm time06; - time06.tm_wday = 4; - errorstate = good; - tim_get.get_weekday(is_it06, end, iss, errorstate, &time06); - VERIFY( time06.tm_wday == 4 ); - VERIFY( errorstate == ios_base::failbit ); - VERIFY( *is_it05 == 'u'); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/2.cc deleted file mode 100644 index 6e9d99936ef..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/2.cc +++ /dev/null @@ -1,90 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); - const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); - const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); - const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); - - const string empty; - - // create an ostream-derived object, cache the time_get facet - iterator_type end; - - istringstream iss; - const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc()); - - const ios_base::iostate good = ios_base::goodbit; - ios_base::iostate errorstate = good; - - // create "C" time objects - const tm time_bday = { 0, 0, 12, 4, 3, 71 }; - - // inspection of named locales, de_DE - iss.imbue(loc_de); - iss.str("Sonntag"); - iterator_type is_it10(iss); - tm time10; - errorstate = good; - tim_get.get_weekday(is_it10, end, iss, errorstate, &time10); - VERIFY( time10.tm_wday == time_bday.tm_wday ); - VERIFY( errorstate == ios_base::eofbit ); - - // inspection of named locales, en_HK - iss.imbue(loc_hk); - iss.str("Sunday"); - iterator_type is_it20(iss); - tm time20; - errorstate = good; - tim_get.get_weekday(is_it20, end, iss, errorstate, &time20); - VERIFY( time20.tm_wday == time_bday.tm_wday ); - VERIFY( errorstate == ios_base::eofbit ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/3.cc deleted file mode 100644 index 59dde862a35..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/3.cc +++ /dev/null @@ -1,70 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - bool test = true; - - // Check time_get works with other iterators besides streambuf - // input iterators. - typedef string::const_iterator iter_type; - typedef time_get<char, iter_type> time_get_type; - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = goodbit; - const locale loc_c = locale::classic(); - - // Create "C" time objects - const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 }; - tm tm1; - - istringstream iss; - iss.imbue(locale(loc_c, new time_get_type)); - - // Iterator advanced, state, output. - const time_get_type& tg = use_facet<time_get_type>(iss.getloc()); - - // Cindy Sherman's Untitled Film Stills - // June 26-September 2, 1997 - const string str = "Tuesday September 1997 Cindy Sherman"; - - // 03 get_weekday - string res3; - err = goodbit; - // White space is not eaten, so manually increment past it. - iter_type end3 = tg.get_weekday(str.begin(), str.end(), iss, err, &tm1); - string rem3(end3, str.end()); - VERIFY( err == goodbit ); - VERIFY( tm1.tm_wday == time_sanity.tm_wday ); - VERIFY( rem3 == " September 1997 Cindy Sherman" ); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_env.cc deleted file mode 100644 index 3f042d9ec42..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_env.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_locale.cc deleted file mode 100644 index 61086ad6da8..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_locale.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/1.cc deleted file mode 100644 index a865c2eff1d..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/1.cc +++ /dev/null @@ -1,134 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c); - const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de); - const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk); - const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr); - - const wstring empty; - - // create an ostream-derived object, cache the time_get facet - iterator_type end; - - wistringstream iss; - iss.imbue(loc_c); - const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc()); - - const ios_base::iostate good = ios_base::goodbit; - ios_base::iostate errorstate = good; - - // create "C" time objects - const tm time_bday = { 0, 0, 12, 4, 3, 71 }; - const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - L"%w %W %x %X %y %Y %Z %%"; - const wchar_t* date = L"%A, the second of %B"; - const wchar_t* date_ex = L"%Ex"; - - // iter_type - // get_weekday(iter_type, iter_type, ios_base&, - // ios_base::iostate&, tm*) const - - // sanity checks for "C" locale - iss.str(L"Sunday"); - iterator_type is_it01(iss); - tm time01; - errorstate = good; - tim_get.get_weekday(is_it01, end, iss, errorstate, &time01); - VERIFY( time01.tm_wday == time_bday.tm_wday ); - VERIFY( errorstate == ios_base::eofbit ); - - iss.str(L"Sun"); - iterator_type is_it02(iss); - tm time02; - errorstate = good; - tim_get.get_weekday(is_it02, end, iss, errorstate, &time02); - VERIFY( time02.tm_wday == time_bday.tm_wday ); - VERIFY( errorstate == ios_base::eofbit ); - - iss.str(L"Sun "); - iterator_type is_it03(iss); - tm time03; - errorstate = good; - tim_get.get_weekday(is_it03, end, iss, errorstate, &time03); - VERIFY( time03.tm_wday == time_bday.tm_wday ); - VERIFY( errorstate == good ); - VERIFY( *is_it03 == ' '); - - iss.str(L"San"); - iterator_type is_it04(iss); - tm time04; - time04.tm_wday = 4; - errorstate = good; - tim_get.get_weekday(is_it04, end, iss, errorstate, &time04); - VERIFY( time04.tm_wday == 4 ); - VERIFY( *is_it04 == 'n'); - VERIFY( errorstate == ios_base::failbit ); - - iss.str(L"Tuesday "); - iterator_type is_it05(iss); - tm time05; - errorstate = good; - tim_get.get_weekday(is_it05, end, iss, errorstate, &time05); - VERIFY( time05.tm_wday == 2 ); - VERIFY( errorstate == good ); - VERIFY( *is_it05 == ' '); - - iss.str(L"Tuesducky "); // Kind of like Fryday, without the swirls. - iterator_type is_it06(iss); - tm time06; - time06.tm_wday = 4; - errorstate = good; - tim_get.get_weekday(is_it06, end, iss, errorstate, &time06); - VERIFY( time06.tm_wday == 4 ); - VERIFY( errorstate == ios_base::failbit ); - VERIFY( *is_it05 == 'u'); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/2.cc deleted file mode 100644 index 299f2ef0525..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/2.cc +++ /dev/null @@ -1,90 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c); - const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de); - const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk); - const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr); - - const wstring empty; - - // create an ostream-derived object, cache the time_get facet - iterator_type end; - - wistringstream iss; - const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc()); - - const ios_base::iostate good = ios_base::goodbit; - ios_base::iostate errorstate = good; - - // create "C" time objects - const tm time_bday = { 0, 0, 12, 4, 3, 71 }; - - // inspection of named locales, de_DE - iss.imbue(loc_de); - iss.str(L"Sonntag"); - iterator_type is_it10(iss); - tm time10; - errorstate = good; - tim_get.get_weekday(is_it10, end, iss, errorstate, &time10); - VERIFY( time10.tm_wday == time_bday.tm_wday ); - VERIFY( errorstate == ios_base::eofbit ); - - // inspection of named locales, en_HK - iss.imbue(loc_hk); - iss.str(L"Sunday"); - iterator_type is_it20(iss); - tm time20; - errorstate = good; - tim_get.get_weekday(is_it20, end, iss, errorstate, &time20); - VERIFY( time20.tm_wday == time_bday.tm_wday ); - VERIFY( errorstate == ios_base::eofbit ); -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/3.cc deleted file mode 100644 index eab0343be37..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/3.cc +++ /dev/null @@ -1,70 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - bool test = true; - - // Check time_get works with other iterators besides streambuf - // input iterators. - typedef wstring::const_iterator iter_type; - typedef time_get<wchar_t, iter_type> time_get_type; - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = goodbit; - const locale loc_c = locale::classic(); - - // Create "C" time objects - const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 }; - tm tm1; - - wistringstream iss; - iss.imbue(locale(loc_c, new time_get_type)); - - // Iterator advanced, state, output. - const time_get_type& tg = use_facet<time_get_type>(iss.getloc()); - - // Cindy Sherman's Untitled Film Stills - // June 26-September 2, 1997 - const wstring str = L"Tuesday September 1997 Cindy Sherman"; - - // 03 get_weekday - wstring res3; - err = goodbit; - // White space is not eaten, so manually increment past it. - iter_type end3 = tg.get_weekday(str.begin(), str.end(), iss, err, &tm1); - wstring rem3(end3, str.end()); - VERIFY( err == goodbit ); - VERIFY( tm1.tm_wday == time_sanity.tm_wday ); - VERIFY( rem3 == L" September 1997 Cindy Sherman" ); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/wrapped_env.cc deleted file mode 100644 index 3f042d9ec42..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/wrapped_locale.cc deleted file mode 100644 index 61086ad6da8..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/1.cc deleted file mode 100644 index aabfd6d0f25..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/1.cc +++ /dev/null @@ -1,123 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<char> iterator_type; - - bool test = true; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); - const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); - const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); - const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); - - const string empty; - - // create an ostream-derived object, cache the time_get facet - iterator_type end; - - istringstream iss; - iss.imbue(loc_c); - const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc()); - - const ios_base::iostate good = ios_base::goodbit; - ios_base::iostate errorstate = good; - - // create "C" time objects - const tm time_bday = { 0, 0, 12, 4, 3, 71 }; - const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - "%w %W %x %X %y %Y %Z %%"; - const char* date = "%A, the second of %B"; - const char* date_ex = "%Ex"; - - // iter_type - // get_year(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const - - // sanity checks for "C" locale - iss.str("1971"); - iterator_type is_it01(iss); - tm time01; - errorstate = good; - tim_get.get_year(is_it01, end, iss, errorstate, &time01); - VERIFY( time01.tm_year == time_bday.tm_year ); - VERIFY( errorstate == ios_base::eofbit ); - - iss.str("1971 "); - iterator_type is_it02(iss); - tm time02; - errorstate = good; - tim_get.get_year(is_it02, end, iss, errorstate, &time02); - VERIFY( time02.tm_year == time_bday.tm_year ); - VERIFY( errorstate == good ); - VERIFY( *is_it02 == ' '); - - iss.str("197d1 "); - iterator_type is_it03(iss); - tm time03; - time03.tm_year = 3; - errorstate = good; - tim_get.get_year(is_it03, end, iss, errorstate, &time03); - VERIFY( time03.tm_year == 3 ); - VERIFY( errorstate == ios_base::failbit ); - VERIFY( *is_it03 == 'd'); - - iss.str("71d71"); - iterator_type is_it04(iss); - tm time04; - errorstate = good; - tim_get.get_year(is_it04, end, iss, errorstate, &time04); - VERIFY( time04.tm_year == time_bday.tm_year ); - VERIFY( errorstate == good ); - VERIFY( *is_it03 == 'd'); - - iss.str("71"); - iterator_type is_it05(iss); - tm time05; - errorstate = good; - tim_get.get_year(is_it05, end, iss, errorstate, &time05); - VERIFY( time05.tm_year == time_bday.tm_year ); - VERIFY( errorstate == ios_base::eofbit ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/3.cc deleted file mode 100644 index 1c38fcb3884..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/3.cc +++ /dev/null @@ -1,70 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - bool test = true; - - // Check time_get works with other iterators besides streambuf - // input iterators. - typedef string::const_iterator iter_type; - typedef time_get<char, iter_type> time_get_type; - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = goodbit; - const locale loc_c = locale::classic(); - - // Create "C" time objects - const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 }; - tm tm1; - - istringstream iss; - iss.imbue(locale(loc_c, new time_get_type)); - - // Iterator advanced, state, output. - const time_get_type& tg = use_facet<time_get_type>(iss.getloc()); - - // Cindy Sherman's Untitled Film Stills - // June 26-September 2, 1997 - const string str = "1997 Cindy Sherman"; - - // 05 get_year - string res5; - err = goodbit; - // White space is not eaten, so manually increment past it. - iter_type end5 = tg.get_year(str.begin(), str.end(), iss, err, &tm1); - string rem5(end5, str.end()); - VERIFY( err == goodbit ); - VERIFY( tm1.tm_year == time_sanity.tm_year ); - VERIFY( rem5 == " Cindy Sherman" ); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/wrapped_env.cc deleted file mode 100644 index 206130ac140..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/wrapped_env.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test03); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/wrapped_locale.cc deleted file mode 100644 index b805c3c43cf..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/wrapped_locale.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test03); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/1.cc deleted file mode 100644 index c117311c731..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/1.cc +++ /dev/null @@ -1,123 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef time_base::dateorder dateorder; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c); - const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de); - const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk); - const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr); - - const wstring empty; - - // create an ostream-derived object, cache the time_get facet - iterator_type end; - - wistringstream iss; - iss.imbue(loc_c); - const time_get<wchar_t>& tim_get = use_facet<time_get<wchar_t> >(iss.getloc()); - - const ios_base::iostate good = ios_base::goodbit; - ios_base::iostate errorstate = good; - - // create "C" time objects - const tm time_bday = { 0, 0, 12, 4, 3, 71 }; - const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - L"%w %W %x %X %y %Y %Z %%"; - const wchar_t* date = L"%A, the second of %B"; - const wchar_t* date_ex = L"%Ex"; - - // iter_type - // get_year(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const - - // sanity checks for "C" locale - iss.str(L"1971"); - iterator_type is_it01(iss); - tm time01; - errorstate = good; - tim_get.get_year(is_it01, end, iss, errorstate, &time01); - VERIFY( time01.tm_year == time_bday.tm_year ); - VERIFY( errorstate == ios_base::eofbit ); - - iss.str(L"1971 "); - iterator_type is_it02(iss); - tm time02; - errorstate = good; - tim_get.get_year(is_it02, end, iss, errorstate, &time02); - VERIFY( time02.tm_year == time_bday.tm_year ); - VERIFY( errorstate == good ); - VERIFY( *is_it02 == ' '); - - iss.str(L"197d1 "); - iterator_type is_it03(iss); - tm time03; - time03.tm_year = 3; - errorstate = good; - tim_get.get_year(is_it03, end, iss, errorstate, &time03); - VERIFY( time03.tm_year == 3 ); - VERIFY( errorstate == ios_base::failbit ); - VERIFY( *is_it03 == 'd'); - - iss.str(L"71d71"); - iterator_type is_it04(iss); - tm time04; - errorstate = good; - tim_get.get_year(is_it04, end, iss, errorstate, &time04); - VERIFY( time04.tm_year == time_bday.tm_year ); - VERIFY( errorstate == good ); - VERIFY( *is_it03 == 'd'); - - iss.str(L"71"); - iterator_type is_it05(iss); - tm time05; - errorstate = good; - tim_get.get_year(is_it05, end, iss, errorstate, &time05); - VERIFY( time05.tm_year == time_bday.tm_year ); - VERIFY( errorstate == ios_base::eofbit ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/3.cc deleted file mode 100644 index 0f61392df09..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/3.cc +++ /dev/null @@ -1,70 +0,0 @@ -// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.1.1 time_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - bool test = true; - - // Check time_get works with other iterators besides streambuf - // input iterators. - typedef wstring::const_iterator iter_type; - typedef time_get<wchar_t, iter_type> time_get_type; - const ios_base::iostate goodbit = ios_base::goodbit; - const ios_base::iostate eofbit = ios_base::eofbit; - ios_base::iostate err = goodbit; - const locale loc_c = locale::classic(); - - // Create "C" time objects - const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 }; - tm tm1; - - istringstream iss; - iss.imbue(locale(loc_c, new time_get_type)); - - // Iterator advanced, state, output. - const time_get_type& tg = use_facet<time_get_type>(iss.getloc()); - - // Cindy Sherman's Untitled Film Stills - // June 26-September 2, 1997 - const wstring str = L"1997 Cindy Sherman"; - - // 05 get_year - wstring res5; - err = goodbit; - // White space is not eaten, so manually increment past it. - iter_type end5 = tg.get_year(str.begin(), str.end(), iss, err, &tm1); - wstring rem5(end5, str.end()); - VERIFY( err == goodbit ); - VERIFY( tm1.tm_year == time_sanity.tm_year ); - VERIFY( rem5 == L" Cindy Sherman" ); -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/wrapped_env.cc deleted file mode 100644 index 206130ac140..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test03); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/wrapped_locale.cc deleted file mode 100644 index b805c3c43cf..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test03); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/1.cc b/libstdc++-v3/testsuite/22_locale/time_put/1.cc deleted file mode 100644 index a1ce9ac60fa..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/1.cc +++ /dev/null @@ -1,43 +0,0 @@ -// { dg-do compile } -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3 Template class time_put - -#include <locale> - -void test01() -{ - // Check for required base class. - typedef std::time_put<char> test_type; - typedef std::locale::facet base_type; - const test_type& obj = std::use_facet<test_type>(std::locale()); - const base_type* base = &obj; - - // Check for required typedefs - typedef test_type::char_type char_type; - typedef test_type::iter_type iter_type; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/2.cc b/libstdc++-v3/testsuite/22_locale/time_put/2.cc deleted file mode 100644 index 84761bf2090..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/2.cc +++ /dev/null @@ -1,39 +0,0 @@ -// { dg-do compile } -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3 Template class time_put - -#include <locale> - -// Should be able to instantiate this for other types besides char, wchar_t -class gnu_time_put: public std::time_put<unsigned char> -{ }; - -void test02() -{ - gnu_time_put facet01; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc deleted file mode 100644 index f54a8c91829..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc +++ /dev/null @@ -1,90 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef ostreambuf_iterator<char> iterator_type; - - bool test = true; - - // create "C" time objects - tm time1 = { 0, 0, 12, 4, 3, 71 }; - const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - "%w %W %x %X %y %Y %Z %%"; - const char* date = "%A, the second of %B"; - const char* date_ex = "%Ex"; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); - const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); - const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); - const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); - - // create an ostream-derived object, cache the time_put facet - const string empty; - ostringstream oss; - oss.imbue(loc_c); - const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc()); - - // 1 - // iter_type - // put(iter_type s, ios_base& str, char_type fill, const tm* t, - // char format, char modifier = 0) const; - oss.str(empty); - iterator_type os_it01 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a'); - string result1 = oss.str(); - VERIFY( result1 == "Sun" ); - - oss.str(empty); - iterator_type os_it21 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x'); - string result21 = oss.str(); // "04/04/71" - oss.str(empty); - iterator_type os_it22 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X'); - string result22 = oss.str(); // "12:00:00" - oss.str(empty); - iterator_type os_it31 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E'); - string result31 = oss.str(); // "04/04/71" - oss.str(empty); - iterator_type os_it32 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E'); - string result32 = oss.str(); // "12:00:00" -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/10.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/10.cc deleted file mode 100644 index 82d00538ed8..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/10.cc +++ /dev/null @@ -1,63 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test10() -{ - using namespace std; - bool test = true; - - // Check time_put works with other iterators besides streambuf - // output iterators. (As long as output_iterator requirements are met.) - typedef string::iterator iter_type; - typedef char_traits<char> traits; - typedef time_put<char, iter_type> time_put_type; - const ios_base::iostate goodbit = ios_base::goodbit; - - ios_base::iostate err = goodbit; - const locale loc_c = locale::classic(); - const string x(50, 'x'); // have to have allocated string! - string res; - const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 }; - const char* date = "%X, %A, the second of %B, %Y"; - - ostringstream oss; - oss.imbue(locale(loc_c, new time_put_type)); - const time_put_type& tp = use_facet<time_put_type>(oss.getloc()); - - // 02 char format - res = x; - iter_type ret2 = tp.put(res.begin(), oss, ' ', &time_sanity, 'A'); - string sanity2(res.begin(), ret2); - VERIFY( err == goodbit ); - VERIFY( res == "Tuesdayxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ); - VERIFY( sanity2 == "Tuesday" ); -} - -int main() -{ - test10(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/2.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/2.cc deleted file mode 100644 index 665036b1c6e..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/2.cc +++ /dev/null @@ -1,85 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef ostreambuf_iterator<char> iterator_type; - - bool test = true; - - // create "C" time objects - tm time1 = { 0, 0, 12, 4, 3, 71 }; - const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - "%w %W %x %X %y %Y %Z %%"; - const char* date = "%A, the second of %B"; - const char* date_ex = "%Ex"; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); - const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); - const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); - const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); - - // create an ostream-derived object, cache the time_put facet - const string empty; - ostringstream oss; - oss.imbue(loc_de); - const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc()); - - iterator_type os_it02 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a'); - string result2 = oss.str(); - VERIFY( result2 == "Son" ); - - oss.str(empty); // "%d.%m.%Y" - iterator_type os_it23 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x'); - string result23 = oss.str(); // "04.04.1971" - oss.str(empty); // "%T" - iterator_type os_it24 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X'); - string result24 = oss.str(); // "12:00:00" - oss.str(empty); - iterator_type os_it33 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E'); - string result33 = oss.str(); // "04.04.1971" - oss.str(empty); - iterator_type os_it34 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E'); - string result34 = oss.str(); // "12:00:00" -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/3.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/3.cc deleted file mode 100644 index 3399669df85..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/3.cc +++ /dev/null @@ -1,85 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - typedef ostreambuf_iterator<char> iterator_type; - - bool test = true; - - // create "C" time objects - tm time1 = { 0, 0, 12, 4, 3, 71 }; - const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - "%w %W %x %X %y %Y %Z %%"; - const char* date = "%A, the second of %B"; - const char* date_ex = "%Ex"; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); - const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); - const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); - const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); - - // create an ostream-derived object, cache the time_put facet - const string empty; - ostringstream oss; - oss.imbue(loc_hk); - const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc()); - - iterator_type os_it03 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a'); - string result3 = oss.str(); - VERIFY( result3 == "Sun" ); - - oss.str(empty); // "%A, %B %d, %Y" - iterator_type os_it25 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x'); - string result25 = oss.str(); // "Sunday, April 04, 1971" - oss.str(empty); // "%I:%M:%S %Z" - iterator_type os_it26 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X'); - string result26 = oss.str(); // "12:00:00 PST" - oss.str(empty); - iterator_type os_it35 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E'); - string result35 = oss.str(); // "Sunday, April 04, 1971" - oss.str(empty); - iterator_type os_it36 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E'); - string result36 = oss.str(); // "12:00:00 PST" -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/4.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/4.cc deleted file mode 100644 index afb45eecacc..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/4.cc +++ /dev/null @@ -1,84 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test04() -{ - using namespace std; - typedef ostreambuf_iterator<char> iterator_type; - - bool test = true; - - // create "C" time objects - tm time1 = { 0, 0, 12, 4, 3, 71 }; - const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - "%w %W %x %X %y %Y %Z %%"; - const char* date = "%A, the second of %B"; - const char* date_ex = "%Ex"; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); - const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); - const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); - const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); - - // create an ostream-derived object, cache the time_put facet - const string empty; - ostringstream oss; - oss.imbue(loc_fr); - const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc()); - iterator_type os_it04 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a'); - string result4 = oss.str(); - VERIFY( result4 == "dim" ); - - oss.str(empty); // "%d.%m.%Y" - iterator_type os_it27 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x'); - string result27 = oss.str(); // "04.04.1971" - oss.str(empty); // "%T" - iterator_type os_it28 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X'); - string result28 = oss.str(); // "12:00:00" - oss.str(empty); - iterator_type os_it37 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E'); - string result37 = oss.str(); // "04.04.1971" - oss.str(empty); - iterator_type os_it38 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E'); - string result38 = oss.str(); // "12:00:00" -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test04); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc deleted file mode 100644 index b7b0055c29d..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc +++ /dev/null @@ -1,80 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test05() -{ - using namespace std; - typedef ostreambuf_iterator<char> iterator_type; - typedef char_traits<char> traits; - - bool test = true; - - // create "C" time objects - tm time1 = { 0, 0, 12, 4, 3, 71 }; - const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - "%w %W %x %X %y %Y %Z %%"; - const char* date = "%A, the second of %B"; - const char* date_ex = "%Ex"; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); - const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); - const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); - const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); - - // create an ostream-derived object, cache the time_put facet - const string empty; - ostringstream oss; - oss.imbue(loc_c); - const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc()); - - // 2 - oss.str(empty); - iterator_type os_it05 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date, date + traits::length(date)); - string result5 = oss.str(); - VERIFY( result5 == "Sunday, the second of April"); - iterator_type os_it06 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date_ex, date_ex + traits::length(date)); - string result6 = oss.str(); - VERIFY( result6 != result5 ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test05); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc deleted file mode 100644 index 9287571901c..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc +++ /dev/null @@ -1,78 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test06() -{ - using namespace std; - typedef ostreambuf_iterator<char> iterator_type; - typedef char_traits<char> traits; - - bool test = true; - - // create "C" time objects - tm time1 = { 0, 0, 12, 4, 3, 71 }; - const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - "%w %W %x %X %y %Y %Z %%"; - const char* date = "%A, the second of %B"; - const char* date_ex = "%Ex"; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); - const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); - const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); - const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); - - // create an ostream-derived object, cache the time_put facet - const string empty; - ostringstream oss; - oss.imbue(loc_de); - const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc()); - - iterator_type os_it07 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date, date + traits::length(date)); - string result7 = oss.str(); - VERIFY( result7 == "Sonntag, the second of April"); - iterator_type os_it08 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date_ex, date_ex + traits::length(date)); - string result8 = oss.str(); - VERIFY( result8 != result7 ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test06); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc deleted file mode 100644 index 00cefcfe7b9..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc +++ /dev/null @@ -1,79 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test07() -{ - using namespace std; - typedef ostreambuf_iterator<char> iterator_type; - typedef char_traits<char> traits; - - bool test = true; - - // create "C" time objects - tm time1 = { 0, 0, 12, 4, 3, 71 }; - const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - "%w %W %x %X %y %Y %Z %%"; - const char* date = "%A, the second of %B"; - const char* date_ex = "%Ex"; - - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); - const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); - const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); - const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); - - // create an ostream-derived object, cache the time_put facet - const string empty; - ostringstream oss; - oss.imbue(loc_hk); - const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc()); - - iterator_type os_it09 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date, date + traits::length(date)); - string result9 = oss.str(); - VERIFY( result9 == "Sunday, the second of April"); - iterator_type os_it10 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date_ex, date_ex + traits::length(date)); - string result10 = oss.str(); - VERIFY( result10 != result9 ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test07); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc deleted file mode 100644 index 10afde5c500..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc +++ /dev/null @@ -1,77 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test08() -{ - using namespace std; - typedef ostreambuf_iterator<char> iterator_type; - typedef char_traits<char> traits; - - bool test = true; - - // create "C" time objects - tm time1 = { 0, 0, 12, 4, 3, 71 }; - const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - "%w %W %x %X %y %Y %Z %%"; - const char* date = "%A, the second of %B"; - const char* date_ex = "%Ex"; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); - const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); - const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); - const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); - - // create an ostream-derived object, cache the time_put facet - const string empty; - ostringstream oss; - oss.imbue(loc_fr); - const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc()); - iterator_type os_it11 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date, date + traits::length(date)); - string result11 = oss.str(); - VERIFY( result11 == "dimanche, the second of avril"); - iterator_type os_it12 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date_ex, date_ex + traits::length(date)); - string result12 = oss.str(); - VERIFY( result12 != result11 ); -} - -int main() -{ - __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test08); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/9.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/9.cc deleted file mode 100644 index 42cfb34b053..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/9.cc +++ /dev/null @@ -1,64 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test09() -{ - using namespace std; - bool test = true; - - // Check time_put works with other iterators besides streambuf - // output iterators. (As long as output_iterator requirements are met.) - typedef string::iterator iter_type; - typedef char_traits<char> traits; - typedef time_put<char, iter_type> time_put_type; - const ios_base::iostate goodbit = ios_base::goodbit; - - ios_base::iostate err = goodbit; - const locale loc_c = locale::classic(); - const string x(50, 'x'); // have to have allocated string! - string res; - const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 }; - const char* date = "%X, %A, the second of %B, %Y"; - - ostringstream oss; - oss.imbue(locale(loc_c, new time_put_type)); - const time_put_type& tp = use_facet<time_put_type>(oss.getloc()); - - // 01 date format - res = x; - iter_type ret1 = tp.put(res.begin(), oss, ' ', &time_sanity, - date, date + traits::length(date)); - string sanity1(res.begin(), ret1); - VERIFY( err == goodbit ); - VERIFY( res == "12:00:00, Tuesday, the second of June, 1997xxxxxxx" ); - VERIFY( sanity1 == "12:00:00, Tuesday, the second of June, 1997" ); -} - -int main() -{ - test09(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_env.cc deleted file mode 100644 index bcf68e986ba..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_env.cc +++ /dev/null @@ -1,81 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -#define main discard_main_6 -#include "6.cc" -#undef main - -#define main discard_main_7 -#include "7.cc" -#undef main - -#define main discard_main_8 -#include "8.cc" -#undef main - -#define main discard_main_9 -#include "9.cc" -#undef main - -#define main discard_main_10 -#include "10.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - two.push_back(&test06); - two.push_back(&test07); - two.push_back(&test08); - two.push_back(&test09); - two.push_back(&test10); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_locale.cc deleted file mode 100644 index 465af45016e..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_locale.cc +++ /dev/null @@ -1,81 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -#define main discard_main_6 -#include "6.cc" -#undef main - -#define main discard_main_7 -#include "7.cc" -#undef main - -#define main discard_main_8 -#include "8.cc" -#undef main - -#define main discard_main_9 -#include "9.cc" -#undef main - -#define main discard_main_10 -#include "10.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - two.push_back(&test06); - two.push_back(&test07); - two.push_back(&test08); - two.push_back(&test09); - two.push_back(&test10); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/1.cc deleted file mode 100644 index 914b187d46b..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/1.cc +++ /dev/null @@ -1,90 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test01() -{ - using namespace std; - typedef ostreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // create "C" time objects - tm time1 = { 0, 0, 12, 4, 3, 71 }; - const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - L"%w %W %x %X %y %Y %Z %%"; - const wchar_t* date = L"%A, the second of %B"; - const wchar_t* date_ex = L"%Ex"; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c); - const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de); - const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk); - const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr); - - // create an ostream-derived object, cache the time_put facet - const wstring empty; - wostringstream oss; - oss.imbue(loc_c); - const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc()); - - // 1 - // iter_type - // put(iter_type s, ios_base& str, char_type fill, const tm* t, - // char format, char modifier = 0) const; - oss.str(empty); - iterator_type os_it01 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a'); - wstring result1 = oss.str(); - VERIFY( result1 == L"Sun" ); - - oss.str(empty); - iterator_type os_it21 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x'); - wstring result21 = oss.str(); // "04/04/71" - oss.str(empty); - iterator_type os_it22 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X'); - wstring result22 = oss.str(); // "12:00:00" - oss.str(empty); - iterator_type os_it31 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E'); - wstring result31 = oss.str(); // "04/04/71" - oss.str(empty); - iterator_type os_it32 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E'); - wstring result32 = oss.str(); // "12:00:00" -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/10.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/10.cc deleted file mode 100644 index 9cd5db73a5f..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/10.cc +++ /dev/null @@ -1,63 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test10() -{ - using namespace std; - bool test = true; - - // Check time_put works with other iterators besides streambuf - // output iterators. (As long as output_iterator requirements are met.) - typedef wstring::iterator iter_type; - typedef char_traits<wchar_t> traits; - typedef time_put<wchar_t, iter_type> time_put_type; - const ios_base::iostate goodbit = ios_base::goodbit; - - ios_base::iostate err = goodbit; - const locale loc_c = locale::classic(); - const wstring x(50, 'x'); // have to have allocated wstring! - wstring res; - const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 }; - const wchar_t* date = L"%X, %A, the second of %B, %Y"; - - wostringstream oss; - oss.imbue(locale(loc_c, new time_put_type)); - const time_put_type& tp = use_facet<time_put_type>(oss.getloc()); - - // 02 char format - res = x; - iter_type ret2 = tp.put(res.begin(), oss, ' ', &time_sanity, 'A'); - wstring sanity2(res.begin(), ret2); - VERIFY( err == goodbit ); - VERIFY( res == L"Tuesdayxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ); - VERIFY( sanity2 == L"Tuesday" ); -} - -int main() -{ - test10(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/2.cc deleted file mode 100644 index bddb23f52d8..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/2.cc +++ /dev/null @@ -1,85 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test02() -{ - using namespace std; - typedef ostreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // create "C" time objects - tm time1 = { 0, 0, 12, 4, 3, 71 }; - const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - L"%w %W %x %X %y %Y %Z %%"; - const wchar_t* date = L"%A, the second of %B"; - const wchar_t* date_ex = L"%Ex"; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c); - const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de); - const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk); - const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr); - - // create an ostream-derived object, cache the time_put facet - const wstring empty; - wostringstream oss; - oss.imbue(loc_de); - const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc()); - - iterator_type os_it02 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a'); - wstring result2 = oss.str(); - VERIFY( result2 == L"Son" ); - - oss.str(empty); // "%d.%m.%Y" - iterator_type os_it23 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x'); - wstring result23 = oss.str(); // "04.04.1971" - oss.str(empty); // "%T" - iterator_type os_it24 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X'); - wstring result24 = oss.str(); // "12:00:00" - oss.str(empty); - iterator_type os_it33 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E'); - wstring result33 = oss.str(); // "04.04.1971" - oss.str(empty); - iterator_type os_it34 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E'); - wstring result34 = oss.str(); // "12:00:00" -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/3.cc deleted file mode 100644 index 566a3a57ca4..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/3.cc +++ /dev/null @@ -1,85 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test03() -{ - using namespace std; - typedef ostreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // create "C" time objects - tm time1 = { 0, 0, 12, 4, 3, 71 }; - const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - L"%w %W %x %X %y %Y %Z %%"; - const wchar_t* date = L"%A, the second of %B"; - const wchar_t* date_ex = L"%Ex"; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c); - const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de); - const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk); - const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr); - - // create an ostream-derived object, cache the time_put facet - const wstring empty; - wostringstream oss; - oss.imbue(loc_hk); - const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc()); - - iterator_type os_it03 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a'); - wstring result3 = oss.str(); - VERIFY( result3 == L"Sun" ); - - oss.str(empty); // "%A, %B %d, %Y" - iterator_type os_it25 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x'); - wstring result25 = oss.str(); // "Sunday, April 04, 1971" - oss.str(empty); // "%I:%M:%S %Z" - iterator_type os_it26 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X'); - wstring result26 = oss.str(); // "12:00:00 PST" - oss.str(empty); - iterator_type os_it35 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E'); - wstring result35 = oss.str(); // "Sunday, April 04, 1971" - oss.str(empty); - iterator_type os_it36 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E'); - wstring result36 = oss.str(); // "12:00:00 PST" -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/4.cc deleted file mode 100644 index 88d3b04239f..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/4.cc +++ /dev/null @@ -1,84 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test04() -{ - using namespace std; - typedef ostreambuf_iterator<wchar_t> iterator_type; - - bool test = true; - - // create "C" time objects - tm time1 = { 0, 0, 12, 4, 3, 71 }; - const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - L"%w %W %x %X %y %Y %Z %%"; - const wchar_t* date = L"%A, the second of %B"; - const wchar_t* date_ex = L"%Ex"; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c); - const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de); - const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk); - const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr); - - // create an ostream-derived object, cache the time_put facet - const wstring empty; - wostringstream oss; - oss.imbue(loc_fr); - const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc()); - iterator_type os_it04 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a'); - wstring result4 = oss.str(); - VERIFY( result4 == L"dim" ); - - oss.str(empty); // "%d.%m.%Y" - iterator_type os_it27 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x'); - wstring result27 = oss.str(); // "04.04.1971" - oss.str(empty); // "%T" - iterator_type os_it28 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X'); - wstring result28 = oss.str(); // "12:00:00" - oss.str(empty); - iterator_type os_it37 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E'); - wstring result37 = oss.str(); // "04.04.1971" - oss.str(empty); - iterator_type os_it38 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E'); - wstring result38 = oss.str(); // "12:00:00" -} - -int main() -{ - test04(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc deleted file mode 100644 index ac53243b339..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc +++ /dev/null @@ -1,80 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test05() -{ - using namespace std; - typedef ostreambuf_iterator<wchar_t> iterator_type; - typedef char_traits<wchar_t> traits; - - bool test = true; - - // create "C" time objects - tm time1 = { 0, 0, 12, 4, 3, 71 }; - const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - L"%w %W %x %X %y %Y %Z %%"; - const wchar_t* date = L"%A, the second of %B"; - const wchar_t* date_ex = L"%Ex"; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c); - const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de); - const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk); - const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr); - - // create an ostream-derived object, cache the time_put facet - const wstring empty; - wostringstream oss; - oss.imbue(loc_c); - const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc()); - - // 2 - oss.str(empty); - iterator_type os_it05 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date, date + traits::length(date)); - wstring result5 = oss.str(); - VERIFY( result5 == L"Sunday, the second of April"); - iterator_type os_it06 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date_ex, date_ex + traits::length(date)); - wstring result6 = oss.str(); - VERIFY( result6 != result5 ); -} - -int main() -{ - test05(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/6.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/6.cc deleted file mode 100644 index 0f5855510a9..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/6.cc +++ /dev/null @@ -1,78 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test06() -{ - using namespace std; - typedef ostreambuf_iterator<wchar_t> iterator_type; - typedef char_traits<wchar_t> traits; - - bool test = true; - - // create "C" time objects - tm time1 = { 0, 0, 12, 4, 3, 71 }; - const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - L"%w %W %x %X %y %Y %Z %%"; - const wchar_t* date = L"%A, the second of %B"; - const wchar_t* date_ex = L"%Ex"; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c); - const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de); - const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk); - const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr); - - // create an ostream-derived object, cache the time_put facet - const wstring empty; - wostringstream oss; - oss.imbue(loc_de); - const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc()); - - iterator_type os_it07 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date, date + traits::length(date)); - wstring result7 = oss.str(); - VERIFY( result7 == L"Sonntag, the second of April"); - iterator_type os_it08 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date_ex, date_ex + traits::length(date)); - wstring result8 = oss.str(); - VERIFY( result8 != result7 ); -} - -int main() -{ - test06(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/7.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/7.cc deleted file mode 100644 index 44a86ac80c8..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/7.cc +++ /dev/null @@ -1,78 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test07() -{ - using namespace std; - typedef ostreambuf_iterator<wchar_t> iterator_type; - typedef char_traits<wchar_t> traits; - - bool test = true; - - // create "C" time objects - tm time1 = { 0, 0, 12, 4, 3, 71 }; - const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - L"%w %W %x %X %y %Y %Z %%"; - const wchar_t* date = L"%A, the second of %B"; - const wchar_t* date_ex = L"%Ex"; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c); - const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de); - const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk); - const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr); - - // create an ostream-derived object, cache the time_put facet - const wstring empty; - wostringstream oss; - oss.imbue(loc_hk); - const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc()); - - iterator_type os_it09 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date, date + traits::length(date)); - wstring result9 = oss.str(); - VERIFY( result9 == L"Sunday, the second of April"); - iterator_type os_it10 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date_ex, date_ex + traits::length(date)); - wstring result10 = oss.str(); - VERIFY( result10 != result9 ); -} - -int main() -{ - test07(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/8.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/8.cc deleted file mode 100644 index 900dc1328e6..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/8.cc +++ /dev/null @@ -1,77 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test08() -{ - using namespace std; - typedef ostreambuf_iterator<wchar_t> iterator_type; - typedef char_traits<wchar_t> traits; - - bool test = true; - - // create "C" time objects - tm time1 = { 0, 0, 12, 4, 3, 71 }; - const wchar_t* all = L"%a %A %b %B %c %d %H %I %j %m %M %p %s %U " - L"%w %W %x %X %y %Y %Z %%"; - const wchar_t* date = L"%A, the second of %B"; - const wchar_t* date_ex = L"%Ex"; - - // basic construction and sanity checks. - locale loc_c = locale::classic(); - locale loc_hk("en_HK"); - locale loc_fr("fr_FR@euro"); - locale loc_de("de_DE"); - VERIFY( loc_hk != loc_c ); - VERIFY( loc_hk != loc_fr ); - VERIFY( loc_hk != loc_de ); - VERIFY( loc_de != loc_fr ); - - // cache the __timepunct facets, for quicker gdb inspection - const __timepunct<wchar_t>& time_c = use_facet<__timepunct<wchar_t> >(loc_c); - const __timepunct<wchar_t>& time_de = use_facet<__timepunct<wchar_t> >(loc_de); - const __timepunct<wchar_t>& time_hk = use_facet<__timepunct<wchar_t> >(loc_hk); - const __timepunct<wchar_t>& time_fr = use_facet<__timepunct<wchar_t> >(loc_fr); - - // create an ostream-derived object, cache the time_put facet - const wstring empty; - wostringstream oss; - oss.imbue(loc_fr); - const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc()); - iterator_type os_it11 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date, date + traits::length(date)); - wstring result11 = oss.str(); - VERIFY( result11 == L"dimanche, the second of avril"); - iterator_type os_it12 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date_ex, date_ex + traits::length(date)); - wstring result12 = oss.str(); - VERIFY( result12 != result11 ); -} - -int main() -{ - test08(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/9.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/9.cc deleted file mode 100644 index 072e4c38e02..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/9.cc +++ /dev/null @@ -1,64 +0,0 @@ -// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.5.3.1 time_put members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -void test09() -{ - using namespace std; - bool test = true; - - // Check time_put works with other iterators besides streambuf - // output iterators. (As long as output_iterator requirements are met.) - typedef wstring::iterator iter_type; - typedef char_traits<wchar_t> traits; - typedef time_put<wchar_t, iter_type> time_put_type; - const ios_base::iostate goodbit = ios_base::goodbit; - - ios_base::iostate err = goodbit; - const locale loc_c = locale::classic(); - const wstring x(50, L'x'); // have to have allocated wstring! - wstring res; - const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 }; - const wchar_t* date = L"%X, %A, the second of %B, %Y"; - - wostringstream oss; - oss.imbue(locale(loc_c, new time_put_type)); - const time_put_type& tp = use_facet<time_put_type>(oss.getloc()); - - // 01 date format - res = x; - iter_type ret1 = tp.put(res.begin(), oss, L' ', &time_sanity, - date, date + traits::length(date)); - wstring sanity1(res.begin(), ret1); - VERIFY( err == goodbit ); - VERIFY( res == L"12:00:00, Tuesday, the second of June, 1997xxxxxxx" ); - VERIFY( sanity1 == L"12:00:00, Tuesday, the second of June, 1997" ); -} - -int main() -{ - test09(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_env.cc deleted file mode 100644 index bcf68e986ba..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_env.cc +++ /dev/null @@ -1,81 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -#define main discard_main_6 -#include "6.cc" -#undef main - -#define main discard_main_7 -#include "7.cc" -#undef main - -#define main discard_main_8 -#include "8.cc" -#undef main - -#define main discard_main_9 -#include "9.cc" -#undef main - -#define main discard_main_10 -#include "10.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - two.push_back(&test06); - two.push_back(&test07); - two.push_back(&test08); - two.push_back(&test09); - two.push_back(&test10); - run_tests_wrapped_env("de_DE", "LANG", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_locale.cc deleted file mode 100644 index 465af45016e..00000000000 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_locale.cc +++ /dev/null @@ -1,81 +0,0 @@ -// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation -// -// 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. - -// 22.2.4.1.1 collate members - -#include <testsuite_hooks.h> - -#define main discard_main_1 -#include "1.cc" -#undef main - -#define main discard_main_2 -#include "2.cc" -#undef main - -#define main discard_main_3 -#include "3.cc" -#undef main - -#define main discard_main_4 -#include "4.cc" -#undef main - -#define main discard_main_5 -#include "5.cc" -#undef main - -#define main discard_main_6 -#include "6.cc" -#undef main - -#define main discard_main_7 -#include "7.cc" -#undef main - -#define main discard_main_8 -#include "8.cc" -#undef main - -#define main discard_main_9 -#include "9.cc" -#undef main - -#define main discard_main_10 -#include "10.cc" -#undef main - -int main() -{ - using namespace __gnu_cxx_test; - func_callback two; - two.push_back(&test01); - two.push_back(&test02); - two.push_back(&test03); - two.push_back(&test04); - two.push_back(&test05); - two.push_back(&test06); - two.push_back(&test07); - two.push_back(&test08); - two.push_back(&test09); - two.push_back(&test10); - run_tests_wrapped_locale("ja_JP.eucjp", two); - return 0; -} diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/01.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_arith/01.cc deleted file mode 100644 index b2fdd2691e7..00000000000 --- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/01.cc +++ /dev/null @@ -1,134 +0,0 @@ -// 1999-04-12 bkoz - -// Copyright (C) 1999, 2000, 2002, 2003 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. - -// 27.6.1.2.2 arithmetic extractors - -#include <cstdio> // for printf -#include <istream> -#include <ostream> -#include <sstream> -#include <locale> -#include <testsuite_hooks.h> - -std::string str_01; -std::string str_02("true false 0 1 110001"); -std::string str_03("-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5"); -std::string str_04("0123"); - -std::stringbuf isbuf_01(std::ios_base::in); -std::stringbuf isbuf_02(str_02, std::ios_base::in); -std::stringbuf isbuf_03(str_03, std::ios_base::in); -std::stringbuf isbuf_04(str_04, std::ios_base::in); - -std::istream is_01(NULL); -std::istream is_02(&isbuf_02); -std::istream is_03(&isbuf_03); -std::istream is_04(&isbuf_04); -std::stringstream ss_01(str_01); - -// minimal sanity check -bool test01() { - - bool test = true; - - // Integral Types: - bool b1 = false; - bool b2 = false; - short s1 = 0; - int i1 = 0; - long l1 = 0; - unsigned short us1 = 0; - unsigned int ui1 = 0; - unsigned long ul1 = 0; - - // Floating-point Types: - float f1 = 0; - double d1 = 0; - long double ld1 = 0; - - // process alphanumeric versions of bool values - std::ios_base::fmtflags fmt = is_02.flags(); - bool testfmt = fmt & std::ios_base::boolalpha; - is_02.setf(std::ios_base::boolalpha); - fmt = is_02.flags(); - testfmt = fmt & std::ios_base::boolalpha; - is_02 >> b1; - VERIFY( b1 == 1 ); - is_02 >> b1; - VERIFY( b1 == 0 ); - - // process numeric versions of of bool values - is_02.unsetf(std::ios_base::boolalpha); - fmt = is_02.flags(); - testfmt = fmt & std::ios_base::boolalpha; - is_02 >> b1; - VERIFY( b1 == 0 ); - is_02 >> b1; - VERIFY( b1 == 1 ); - - // is_03 == "-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5" - is_03 >> l1; - VERIFY( l1 == -19999999 ); - is_03 >> ul1; - VERIFY( ul1 == 777777 ); - is_03 >> i1; - VERIFY( i1 == -234234 ); - is_03 >> ui1; - VERIFY( ui1 == 233 ); - is_03 >> s1; - VERIFY( s1 == -234 ); - is_03 >> us1; - VERIFY( us1 == 33 ); - is_03 >> b1; - VERIFY( b1 == 1 ); - is_03 >> ld1; - VERIFY( ld1 == 66300.25 ); - is_03 >> d1; - VERIFY( d1 == .315 ); - is_03 >> f1; - VERIFY( f1 == 1.5 ); - - is_04 >> std::hex >> i1; - std::printf ("%d %d %d\n", i1, i1 == 0x123, test); - VERIFY( i1 == 0x123 ); - std::printf ("%d %d %d\n", i1, i1 == 0x123, test); - - // test void pointers - int i = 55; - void* po = &i; - void* pi; - - ss_01 << po; - ss_01 >> pi; - std::printf ("%x %x\n", pi, po); - VERIFY( po == pi ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif - - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/02.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_arith/02.cc deleted file mode 100644 index 374fbd8e0c7..00000000000 --- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/02.cc +++ /dev/null @@ -1,71 +0,0 @@ -// 1999-04-12 bkoz - -// Copyright (C) 1999, 2000, 2002, 2003 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. - -// 27.6.1.2.2 arithmetic extractors - -#include <cstdio> // for printf -#include <istream> -#include <ostream> -#include <sstream> -#include <locale> -#include <testsuite_hooks.h> - -std::string str_01; -std::string str_02("true false 0 1 110001"); -std::string str_03("-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5"); -std::string str_04("0123"); - -std::stringbuf isbuf_01(std::ios_base::in); -std::stringbuf isbuf_02(str_02, std::ios_base::in); -std::stringbuf isbuf_03(str_03, std::ios_base::in); -std::stringbuf isbuf_04(str_04, std::ios_base::in); - -std::istream is_01(NULL); -std::istream is_02(&isbuf_02); -std::istream is_03(&isbuf_03); -std::istream is_04(&isbuf_04); -std::stringstream ss_01(str_01); - -// elaborated test for ints -bool test02() { - - bool test = true; - const std::string str_01("20000AB"); - std::stringbuf strb_01(str_01, std::ios_base::in); - std::istream is(&strb_01); - - int n = 15; - is >> n; - VERIFY( n == 20000 ); - char c = is.peek(); - VERIFY( c == 65 ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif - - return test; -} - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/03.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_arith/03.cc deleted file mode 100644 index 869d828b091..00000000000 --- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/03.cc +++ /dev/null @@ -1,70 +0,0 @@ -// 1999-04-12 bkoz - -// Copyright (C) 1999, 2000, 2002, 2003 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. - -// 27.6.1.2.2 arithmetic extractors - -#include <cstdio> // for printf -#include <istream> -#include <ostream> -#include <sstream> -#include <locale> -#include <testsuite_hooks.h> - -std::string str_01; -std::string str_02("true false 0 1 110001"); -std::string str_03("-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5"); -std::string str_04("0123"); - -std::stringbuf isbuf_01(std::ios_base::in); -std::stringbuf isbuf_02(str_02, std::ios_base::in); -std::stringbuf isbuf_03(str_03, std::ios_base::in); -std::stringbuf isbuf_04(str_04, std::ios_base::in); - -std::istream is_01(NULL); -std::istream is_02(&isbuf_02); -std::istream is_03(&isbuf_03); -std::istream is_04(&isbuf_04); -std::stringstream ss_01(str_01); - -bool test03() -{ - std::stringbuf sbuf; - std::istream istr(&sbuf); - std::ostream ostr(&sbuf); - - bool test = true; - long l01; - ostr << "12220101"; - istr >> l01; // _M_in_end set completely incorrectly here. - VERIFY( l01 == 12220101 ); - VERIFY( istr.rdstate() == std::ios_base::eofbit ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif - - return test; -} - -int main() -{ - test03(); - return 0; -} diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/06.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_arith/06.cc deleted file mode 100644 index de92bcd52cb..00000000000 --- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/06.cc +++ /dev/null @@ -1,83 +0,0 @@ -// 1999-04-12 bkoz - -// Copyright (C) 1999, 2000, 2002, 2003 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. - -// 27.6.1.2.2 arithmetic extractors - -#include <cstdio> // for printf -#include <istream> -#include <ostream> -#include <sstream> -#include <locale> -#include <testsuite_hooks.h> - -std::string str_01; -std::string str_02("true false 0 1 110001"); -std::string str_03("-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5"); -std::string str_04("0123"); - -std::stringbuf isbuf_01(std::ios_base::in); -std::stringbuf isbuf_02(str_02, std::ios_base::in); -std::stringbuf isbuf_03(str_03, std::ios_base::in); -std::stringbuf isbuf_04(str_04, std::ios_base::in); - -std::istream is_01(NULL); -std::istream is_02(&isbuf_02); -std::istream is_03(&isbuf_03); -std::istream is_04(&isbuf_04); -std::stringstream ss_01(str_01); - -// http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00081.html -// Jim Parsons -void test06() -{ - // default locale, grouping is turned off - bool test = true; - unsigned int h4, h3, h2; - char c; - std::string s("205,199,144"); - std::istringstream is(s); - - is >> h4; // 205 - VERIFY( h4 == 205 ); - is >> c; // ',' - VERIFY( c == ',' ); - - is >> h4; // 199 - VERIFY( h4 == 199 ); - is >> c; // ',' - VERIFY( c == ',' ); - - is >> h4; // 144 - VERIFY( is.rdstate() == std::ios_base::eofbit ); - VERIFY( h4 == 144 ); - is >> c; // EOF - VERIFY( c == ',' ); - VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif -} - -int main() -{ - test06(); - return 0; -} diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/07.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_arith/07.cc deleted file mode 100644 index 118668ea1d9..00000000000 --- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/07.cc +++ /dev/null @@ -1,169 +0,0 @@ -// 1999-04-12 bkoz - -// Copyright (C) 1999, 2000, 2002, 2003 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. - -// 27.6.1.2.2 arithmetic extractors - -#include <cstdio> // for printf -#include <istream> -#include <ostream> -#include <sstream> -#include <locale> -#include <testsuite_hooks.h> - -std::string str_01; -std::string str_02("true false 0 1 110001"); -std::string str_03("-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5"); -std::string str_04("0123"); - -std::stringbuf isbuf_01(std::ios_base::in); -std::stringbuf isbuf_02(str_02, std::ios_base::in); -std::stringbuf isbuf_03(str_03, std::ios_base::in); -std::stringbuf isbuf_04(str_04, std::ios_base::in); - -std::istream is_01(NULL); -std::istream is_02(&isbuf_02); -std::istream is_03(&isbuf_03); -std::istream is_04(&isbuf_04); -std::stringstream ss_01(str_01); - -namespace std { - class test_numpunct1 : public numpunct<char> - { - protected: - string - do_grouping() const - { return string(1, '\003'); } - }; -} // namespace std - -void test07() -{ - // manufactured locale, grouping is turned on - bool test = true; - unsigned int h4 = 0, h3 = 0, h2 = 0; - float f1 = 0.0; - const std::string s1("205,199 23,445.25 1,024,365 123,22,24"); - std::istringstream is(s1); - is.imbue(std::locale(std::locale(), new std::test_numpunct1)); - - // Basic operation. - is >> h4; - VERIFY( h4 == 205199 ); - VERIFY( is.good() ); - - is.clear(); - is >> f1; - VERIFY( f1 == 23445.25 ); - VERIFY( is.good() ); - - is.clear(); - is >> h3; - VERIFY( h3 == 1024365 ); - VERIFY( is.good() ); - - is.clear(); - is >> h2; - VERIFY( h2 == 0 ); - VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) ); - VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::eofbit) ); - - // Stress tests for explicit errors in grouping corner cases. The - // validity of these tests and results have been hammered out in - // private email between bkoz and ncm between Jan 25 and Jan 27, 2000. - // Thanks nate -- benjamin - const std::string s2(",111 4,,4 0.25,345 5..25 156,, 1,000000 1000000 1234,567"); - h3 = h4 = h2 = 0; - f1 = 0.0; - const char c_control = '?'; - char c = c_control; - is.clear(); - is.str(s2); - - is >> h4; - VERIFY( h4 == 0 ); - VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) ); - is.clear(); - is >> c; - VERIFY( c == ',' ); - VERIFY( is.good() ); - - is.ignore(3); - is >> f1; - VERIFY( f1 == 0.0 ); - VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) ); - is.clear(); - is >> c; - VERIFY( c == ',' ); - is >> c; - VERIFY( c == '4' ); - VERIFY( is.good() ); - - is >> f1; - VERIFY( f1 == 0.25 ); - VERIFY( is.good() ); - is >> c; - VERIFY( c == ',' ); - is >> h2; - VERIFY( h2 == 345 ); - VERIFY( is.good() ); - f1 = 0.0; - h2 = 0; - - is >> f1; - VERIFY( f1 == 5.0 ); - VERIFY( is.good() ); - is >> f1; - VERIFY( f1 == .25 ); - VERIFY( is.good() ); - - is >> h3; - VERIFY( h3 == 0 ); - VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) ); - is.clear(); - is >> c; - VERIFY( c == ',' ); // second one - VERIFY( is.good() ); - - is >> h2; - VERIFY( h2 == 0 ); - VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) ); - is.clear(); - - is >> h2; - VERIFY( h2 == 1000000 ); - VERIFY( is.good() ); - h2 = 0; - - is >> h2; - VERIFY( h2 == 0 ); - VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) ); - VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::eofbit) ); - is.clear(); - -#ifdef DEBUG_ASSERT - assert(test); -#endif -} - -int main() -{ - test07(); - return 0; -} diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/08.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_arith/08.cc deleted file mode 100644 index f8491612ddf..00000000000 --- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/08.cc +++ /dev/null @@ -1,93 +0,0 @@ -// 1999-04-12 bkoz - -// Copyright (C) 1999, 2000, 2002, 2003 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. - -// 27.6.1.2.2 arithmetic extractors - -#include <cstdio> // for printf -#include <istream> -#include <ostream> -#include <sstream> -#include <locale> -#include <testsuite_hooks.h> - -std::string str_01; -std::string str_02("true false 0 1 110001"); -std::string str_03("-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5"); -std::string str_04("0123"); - -std::stringbuf isbuf_01(std::ios_base::in); -std::stringbuf isbuf_02(str_02, std::ios_base::in); -std::stringbuf isbuf_03(str_03, std::ios_base::in); -std::stringbuf isbuf_04(str_04, std::ios_base::in); - -std::istream is_01(NULL); -std::istream is_02(&isbuf_02); -std::istream is_03(&isbuf_03); -std::istream is_04(&isbuf_04); -std::stringstream ss_01(str_01); - -namespace std { - class test_numpunct2 : public numpunct<char> - { - protected: - string - do_grouping() const - { return string("\002\003"); } - }; -} // namespace std - -void test08() -{ - // manufactured locale, grouping is turned on - bool test = true; - unsigned int h4 = 0, h3 = 0, h2 = 0; - float f1 = 0.0; - const std::string s1("1,22 205,19 22,123,22"); - const std::string s2("1,220 2050,19 202,123,22"); - - std::istringstream is(s1); - is.imbue(std::locale(std::locale(), new std::test_numpunct2)); - - // Basic operation. - is >> h4; - VERIFY( h4 == 122 ); - VERIFY( is.good() ); - - is.clear(); - is >> h3; - VERIFY( h3 == 20519 ); - VERIFY( is.good() ); - - is.clear(); - is >> h2; - VERIFY( h2 == 2212322 ); - VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::eofbit) ); - - -#ifdef DEBUG_ASSERT - assert(test); -#endif -} - -int main() -{ - test08(); - return 0; -} diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/09.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_arith/09.cc deleted file mode 100644 index 37e175e6f7c..00000000000 --- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/09.cc +++ /dev/null @@ -1,72 +0,0 @@ -// 1999-04-12 bkoz - -// Copyright (C) 1999, 2000, 2002, 2003 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. - -// 27.6.1.2.2 arithmetic extractors - -#include <cstdio> // for printf -#include <istream> -#include <ostream> -#include <sstream> -#include <locale> -#include <testsuite_hooks.h> - -std::string str_01; -std::string str_02("true false 0 1 110001"); -std::string str_03("-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5"); -std::string str_04("0123"); - -std::stringbuf isbuf_01(std::ios_base::in); -std::stringbuf isbuf_02(str_02, std::ios_base::in); -std::stringbuf isbuf_03(str_03, std::ios_base::in); -std::stringbuf isbuf_04(str_04, std::ios_base::in); - -std::istream is_01(NULL); -std::istream is_02(&isbuf_02); -std::istream is_03(&isbuf_03); -std::istream is_04(&isbuf_04); -std::stringstream ss_01(str_01); - -bool test09() -{ - bool test = true; - - std::string st("2.456e3-+0.567e-2"); - std::stringbuf sb(st); - std::istream is(&sb); - double f1 = 0, f2 = 0; - char c; - (is>>std::ws) >> f1; - (is>>std::ws) >> c; - (is>>std::ws) >> f2; - test = f1 == 2456; - VERIFY( f2 == 0.00567 ); - VERIFY( c == '-' ); -#ifdef DEBUG_ASSERT - assert(test); -#endif - - return test; -} - -int main() -{ - test09(); - return 0; -} diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/10.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_arith/10.cc deleted file mode 100644 index bc67190533f..00000000000 --- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/10.cc +++ /dev/null @@ -1,154 +0,0 @@ -// 1999-04-12 bkoz - -// Copyright (C) 1999, 2000, 2002, 2003 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. - -// 27.6.1.2.2 arithmetic extractors - -#include <cstdio> // for printf -#include <istream> -#include <ostream> -#include <sstream> -#include <locale> -#include <testsuite_hooks.h> - -std::string str_01; -std::string str_02("true false 0 1 110001"); -std::string str_03("-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5"); -std::string str_04("0123"); - -std::stringbuf isbuf_01(std::ios_base::in); -std::stringbuf isbuf_02(str_02, std::ios_base::in); -std::stringbuf isbuf_03(str_03, std::ios_base::in); -std::stringbuf isbuf_04(str_04, std::ios_base::in); - -std::istream is_01(NULL); -std::istream is_02(&isbuf_02); -std::istream is_03(&isbuf_03); -std::istream is_04(&isbuf_04); -std::stringstream ss_01(str_01); - -bool test10() { - std::string str_01("0 00 000 +0 +0 -0"); - std::stringbuf isbuf_01(str_01); - std::istream is_01(&isbuf_01); - - bool test = true; - - int n = 365; - is_01 >> n; - VERIFY( n == 0 ); - n = 364; - is_01 >> n; - VERIFY( n == 0 ); - n = 363; - is_01 >> n; - VERIFY( n == 0 ); - n = 362; - is_01 >> n; - VERIFY( n == 0 ); - n = 361; - is_01 >> n; - VERIFY( n == 0 ); - n = 360; - is_01 >> n; - VERIFY( n == 0 ); - VERIFY( is_01.rdstate() == std::ios_base::eofbit ); - - std::string str_02("0x32 0X33 033 33"); - std::stringbuf isbuf_02(str_02); - std::istream is_02(&isbuf_02); - is_02.unsetf(std::ios_base::basefield); - is_02 >> n; - VERIFY( n == 50 ); - is_02 >> n; - VERIFY( n == 51 ); - is_02 >> n; - VERIFY( n == 27 ); - is_02 >> n; - VERIFY( n == 33 ); - VERIFY( is_02.rdstate() == std::ios_base::eofbit ); - - std::stringbuf isbuf_03(str_02); - std::istream is_03(&isbuf_03); - char c; - int m; - - is_03 >> std::dec >> n >> c >> m; - VERIFY( n == 0 ); - VERIFY( c == 'x' ); - VERIFY( m == 32 ); - - is_03 >> std::oct >> m >> c >> n; - VERIFY( m == 0 ); - VERIFY( c == 'X' ); - VERIFY( n == 27 ); - - is_03 >> std::dec >> m >> n; - VERIFY( m == 33 ); - VERIFY( n == 33 ); - VERIFY( is_03.rdstate() == std::ios_base::eofbit ); - - std::string str_04("3. 4.5E+2a5E-3 .6E1"); - std::stringbuf isbuf_04(str_04); - std::istream is_04(&isbuf_04); - - double f; - is_04 >> f; - VERIFY( f == 3.0 ); - is_04 >> f; - VERIFY( f == 450.0 ); - is_04.ignore(); - is_04 >> f; - VERIFY( f == 0.005 ); - is_04 >> f; - VERIFY( f == 6 ); - VERIFY( is_03.rdstate() == std::ios_base::eofbit ); - - std::string str_05("0E20 5Ea E16"); - std::stringbuf isbuf_05(str_05); - std::istream is_05(&isbuf_05); - - is_05 >> f; - VERIFY( f == 0 ); - is_05 >> f; - VERIFY( f == 0 ); - VERIFY( is_05.rdstate() == std::ios_base::failbit ); - is_05.clear(); - is_05 >> c; - VERIFY( c == 'a' ); - is_05 >> f; - VERIFY( f == 0 ); - VERIFY( is_05.rdstate() == std::ios_base::failbit ); - is_05.clear(); - is_05.ignore(); - is_05 >> n; - VERIFY( n == 16 ); - -#ifdef DEBUG_ASSERT - assert(test); -#endif - - return test; -} - -int main() -{ - test10(); - return 0; -} diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/11.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_arith/11.cc deleted file mode 100644 index 309875dfc54..00000000000 --- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/11.cc +++ /dev/null @@ -1,73 +0,0 @@ -// 1999-04-12 bkoz - -// Copyright (C) 1999, 2000, 2002, 2003 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. - -// 27.6.1.2.2 arithmetic extractors - -#include <cstdio> // for printf -#include <istream> -#include <ostream> -#include <sstream> -#include <locale> -#include <testsuite_hooks.h> - -std::string str_01; -std::string str_02("true false 0 1 110001"); -std::string str_03("-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5"); -std::string str_04("0123"); - -std::stringbuf isbuf_01(std::ios_base::in); -std::stringbuf isbuf_02(str_02, std::ios_base::in); -std::stringbuf isbuf_03(str_03, std::ios_base::in); -std::stringbuf isbuf_04(str_04, std::ios_base::in); - -std::istream is_01(NULL); -std::istream is_02(&isbuf_02); -std::istream is_03(&isbuf_03); -std::istream is_04(&isbuf_04); -std::stringstream ss_01(str_01); - -// In the presence of no fmtflags, the input operator should behave -// like strtol(x, y, 0) -// libstdc++/90 -bool test11() -{ - bool test = true; - const char* cstrlit = "0x2a"; - - // sanity check via 'C' library call - char* err; - long l = std::strtol(cstrlit, &err, 0); - - std::istringstream iss(cstrlit); - iss.setf(std::ios::fmtflags(0), std::ios::basefield); - int i; - iss >> i; - - VERIFY (!iss.fail()); - VERIFY (l == i); - - return test; -} - -int main() -{ - test11(); - return 0; -} diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/12.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_arith/12.cc deleted file mode 100644 index 64795c05812..00000000000 --- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/12.cc +++ /dev/null @@ -1,94 +0,0 @@ -// 1999-04-12 bkoz - -// Copyright (C) 1999, 2000, 2002, 2003 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. - -// 27.6.1.2.2 arithmetic extractors - -// XXX This test fails on sparc-solaris2 because of a bug in libc -// XXX sscanf for very long input. See: -// XXX http://gcc.gnu.org/ml/gcc/2002-12/msg01422.html -// { dg-do run { xfail sparc*-*-solaris2* } } - -#include <cstdio> // for printf -#include <istream> -#include <ostream> -#include <sstream> -#include <locale> -#include <testsuite_hooks.h> - -std::string str_01; -std::string str_02("true false 0 1 110001"); -std::string str_03("-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5"); -std::string str_04("0123"); - -std::stringbuf isbuf_01(std::ios_base::in); -std::stringbuf isbuf_02(str_02, std::ios_base::in); -std::stringbuf isbuf_03(str_03, std::ios_base::in); -std::stringbuf isbuf_04(str_04, std::ios_base::in); - -std::istream is_01(NULL); -std::istream is_02(&isbuf_02); -std::istream is_03(&isbuf_03); -std::istream is_04(&isbuf_04); -std::stringstream ss_01(str_01); - -// libstdc++/3720 -// excess input should not cause a core dump -template<typename T> -bool test12_aux(bool integer_type) -{ - bool test = true; - - int digits_overflow; - if (integer_type) - // This many digits will overflow integer types in base 10. - digits_overflow = std::numeric_limits<T>::digits10 + 2; - else - // This might do it, unsure. - digits_overflow = std::numeric_limits<T>::max_exponent10 + 1; - - std::string st; - std::string part = "1234567890123456789012345678901234567890"; - for (int i = 0; i < digits_overflow / part.size() + 1; ++i) - st += part; - std::stringbuf sb(st); - std::istream is(&sb); - T t; - is >> t; - VERIFY(is.fail()); - return test; -} - -bool test12() -{ - bool test = true; - VERIFY(test12_aux<short>(true)); - VERIFY(test12_aux<int>(true)); - VERIFY(test12_aux<long>(true)); - VERIFY(test12_aux<float>(false)); - VERIFY(test12_aux<double>(false)); - VERIFY(test12_aux<long double>(false)); - return test; -} - -int main() -{ - test12(); - return 0; -} diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/13.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_arith/13.cc deleted file mode 100644 index 935d456f448..00000000000 --- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith/13.cc +++ /dev/null @@ -1,88 +0,0 @@ -// 1999-04-12 bkoz - -// Copyright (C) 1999, 2000, 2002, 2003 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. - -// 27.6.1.2.2 arithmetic extractors - -#include <cstdio> // for printf -#include <istream> -#include <ostream> -#include <sstream> -#include <locale> -#include <testsuite_hooks.h> - -std::string str_01; -std::string str_02("true false 0 1 110001"); -std::string str_03("-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5"); -std::string str_04("0123"); - -std::stringbuf isbuf_01(std::ios_base::in); -std::stringbuf isbuf_02(str_02, std::ios_base::in); -std::stringbuf isbuf_03(str_03, std::ios_base::in); -std::stringbuf isbuf_04(str_04, std::ios_base::in); - -std::istream is_01(NULL); -std::istream is_02(&isbuf_02); -std::istream is_03(&isbuf_03); -std::istream is_04(&isbuf_04); -std::stringstream ss_01(str_01); - -// libstdc++/3720 part two -void test13() -{ - using namespace std; - bool test = true; - const char* l1 = "12345678901234567890123456789012345678901234567890123456"; - const char* l2 = "1.2345678901234567890123456789012345678901234567890123456" - " " - "1246.9"; - - // 1 - // used to core. - double d; - istringstream iss1(l2); - iss1 >> d; - iss1 >> d; - VERIFY (d > 1246 && d < 1247); - - // 2 - // quick test for failbit on maximum length extraction. - int i; - int max_digits = numeric_limits<int>::digits10 + 1; - string digits; - for (int j = 0; j < max_digits; ++j) - digits += '1'; - istringstream iss2(digits); - iss2 >> i; - VERIFY( !iss2.fail() ); - - digits += '1'; - i = 0; - iss2.str(digits); - iss2.clear(); - iss2 >> i; - VERIFY( i == 0 ); - VERIFY( iss2.fail() ); -} - -int main() -{ - test13(); - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/01.cc b/libstdc++-v3/testsuite/demangle/abi_examples/01.cc deleted file mode 100644 index 8ce9ee3da4c..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/01.cc +++ /dev/null @@ -1,37 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // extern "C" function - // extern "C" float f(void) { }; - // T f - verify_demangle("f", "f"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/02.cc b/libstdc++-v3/testsuite/demangle/abi_examples/02.cc deleted file mode 100644 index 44558e1faed..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/02.cc +++ /dev/null @@ -1,37 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // or variable "f" - // int f; - // B f - verify_demangle("f", "f"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/03.cc b/libstdc++-v3/testsuite/demangle/abi_examples/03.cc deleted file mode 100644 index f807189fb09..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/03.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // or a global namespace variable "f" - /* - namespace f - { - int f; - } - */ - verify_demangle("_ZN1f1fE", "f::f"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/04.cc b/libstdc++-v3/testsuite/demangle/abi_examples/04.cc deleted file mode 100644 index 7705d8d7117..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/04.cc +++ /dev/null @@ -1,37 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // void f() { }; - // int f() { }; - // verify_demangle("_Z1fv", "f(void)"); - verify_demangle("_Z1fv", "f()"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/05.cc b/libstdc++-v3/testsuite/demangle/abi_examples/05.cc deleted file mode 100644 index 927b7e11d49..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/05.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // void f(int) { }; - // int f(int) { }; - verify_demangle("_Z1fi", "f(int)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/06.cc b/libstdc++-v3/testsuite/demangle/abi_examples/06.cc deleted file mode 100644 index 47f07a3096f..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/06.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // class bar { }; - // void foo(bar) { }; - verify_demangle("_Z3foo3bar", "foo(bar)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/07.cc b/libstdc++-v3/testsuite/demangle/abi_examples/07.cc deleted file mode 100644 index e73c3dd5b93..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/07.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // class X { }; - // int operator%(X, X) { }; - verify_demangle("_Zrm1XS_", "operator%(X, X)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/08.cc b/libstdc++-v3/testsuite/demangle/abi_examples/08.cc deleted file mode 100644 index 74394dc00bd..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/08.cc +++ /dev/null @@ -1,35 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // int operator+(X&, X&) { }; - verify_demangle("_ZplR1XS0_", "operator+(X&, X&)"); // XXX - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/09.cc b/libstdc++-v3/testsuite/demangle/abi_examples/09.cc deleted file mode 100644 index 8e56b104ab2..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/09.cc +++ /dev/null @@ -1,35 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // int operator<< (X const&, X const&) { }; - verify_demangle("_ZlsRK1XS1_", "operator<<(X const&, X const&)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/10.cc b/libstdc++-v3/testsuite/demangle/abi_examples/10.cc deleted file mode 100644 index 597e83bbae8..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/10.cc +++ /dev/null @@ -1,40 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - /* - template<typename T> - class Foo - { static int bar; }; - int Foo<int[4]>::bar; - */ - verify_demangle("_ZN3FooIA4_iE3barE", "Foo<int[4]>::bar"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/11.cc b/libstdc++-v3/testsuite/demangle/abi_examples/11.cc deleted file mode 100644 index 7201afbee55..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/11.cc +++ /dev/null @@ -1,38 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // template<typename T> void f(int) { } - // template void f<int>(int); - // NB: the return type is always explicitly encoded for template - // functions taking parameters. - verify_demangle("_Z1fIiEvi", "void f<int>(int)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/12.cc b/libstdc++-v3/testsuite/demangle/abi_examples/12.cc deleted file mode 100644 index c0c31a21f59..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/12.cc +++ /dev/null @@ -1,39 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - /* - class Duo { }; - template<typename T> void first(Duo) { } - template void first<Duo>(Duo); - */ - verify_demangle("_Z5firstI3DuoEvS0_", "void first<Duo>(Duo)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/13.cc b/libstdc++-v3/testsuite/demangle/abi_examples/13.cc deleted file mode 100644 index 43aae1f34b3..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/13.cc +++ /dev/null @@ -1,39 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - /* - class Duo { }; - template<typename T> void first(T obj) { } - template void first(Duo); - */ - verify_demangle("_Z5firstI3DuoEvT_", "void first<Duo>(Duo)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/14.cc b/libstdc++-v3/testsuite/demangle/abi_examples/14.cc deleted file mode 100644 index 4bb70f643e0..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/14.cc +++ /dev/null @@ -1,40 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - /* - typedef void fun(double); - template<typename I, typename T, typename J> void foo() { } - template void foo<int, fun, int>(); - */ - //demangle("_Z3fooIiPFidEiEvv", "void foo<int, int (*)(double), int>(void)"); - verify_demangle("_Z3fooIiFvdEiEvv", "void foo<int, void ()(double), int>()"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/15.cc b/libstdc++-v3/testsuite/demangle/abi_examples/15.cc deleted file mode 100644 index b79f1cc859e..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/15.cc +++ /dev/null @@ -1,40 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - /* - namespace N - { - int f; - } - */ - verify_demangle("_ZN1N1fE", "N::f"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/16.cc b/libstdc++-v3/testsuite/demangle/abi_examples/16.cc deleted file mode 100644 index 5afc643a304..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/16.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - /* - namespace System - { - struct Sound - { - int beep(); - }; - - int Sound::beep() { }; - } - */ - // verify_demangle("_ZN6System5Sound4beepEv", "System::Sound::beep(void)"); - verify_demangle("_ZN6System5Sound4beepEv", "System::Sound::beep()"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/17.cc b/libstdc++-v3/testsuite/demangle/abi_examples/17.cc deleted file mode 100644 index e9ce1058673..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/17.cc +++ /dev/null @@ -1,40 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - /* - namespace Arena - { - int level; - } - */ - verify_demangle("_ZN5Arena5levelE", "Arena::level"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/18.cc b/libstdc++-v3/testsuite/demangle/abi_examples/18.cc deleted file mode 100644 index 847568ca89c..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/18.cc +++ /dev/null @@ -1,42 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - /* - template<typename T1, typename T2> struct Stack - { - static int level; - int return_level() { return level; } - }; - template struct Stack<int, int>; - */ - verify_demangle("_ZN5StackIiiE5levelE", "Stack<int, int>::level"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/19.cc b/libstdc++-v3/testsuite/demangle/abi_examples/19.cc deleted file mode 100644 index f70a389f5bc..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/19.cc +++ /dev/null @@ -1,34 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - verify_demangle("_Z1fI1XEvPVN1AIT_E1TE", "void f<X>(A<X>::T volatile*)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/20.cc b/libstdc++-v3/testsuite/demangle/abi_examples/20.cc deleted file mode 100644 index 99517157437..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/20.cc +++ /dev/null @@ -1,35 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - verify_demangle("_ZngILi42EEvN1AIXplT_Li2EEE1TE", - "void operator-<42>(A<(42) + (2)>::T)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/21.cc b/libstdc++-v3/testsuite/demangle/abi_examples/21.cc deleted file mode 100644 index debeb790fd2..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/21.cc +++ /dev/null @@ -1,35 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - verify_demangle("_Z4makeI7FactoryiET_IT0_Ev", - "Factory<int> make<Factory, int>()"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/22.cc b/libstdc++-v3/testsuite/demangle/abi_examples/22.cc deleted file mode 100644 index debeb790fd2..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/22.cc +++ /dev/null @@ -1,35 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - verify_demangle("_Z4makeI7FactoryiET_IT0_Ev", - "Factory<int> make<Factory, int>()"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/23.cc b/libstdc++-v3/testsuite/demangle/abi_examples/23.cc deleted file mode 100644 index 02f55a8cffc..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/23.cc +++ /dev/null @@ -1,34 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - verify_demangle("_Z3foo5Hello5WorldS0_S_", - "foo(Hello, World, World, Hello)"); - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/24.cc b/libstdc++-v3/testsuite/demangle/abi_examples/24.cc deleted file mode 100644 index e200574e873..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/24.cc +++ /dev/null @@ -1,34 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - verify_demangle("_Z3fooPM2ABi", "foo(int AB::**)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/25.cc b/libstdc++-v3/testsuite/demangle/abi_examples/25.cc deleted file mode 100644 index 04ba05bad96..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/25.cc +++ /dev/null @@ -1,39 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // Equivalent - // uncompressed, cp-dem - // verify_demangle("_ZlsRSoRKSs", "operator<<(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)"); - // compressed (good!), new __cxa_demangle - verify_demangle("_ZlsRSoRKSs", - "operator<<(std::ostream&, std::string const&)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_examples/26.cc b/libstdc++-v3/testsuite/demangle/abi_examples/26.cc deleted file mode 100644 index 075a80515cb..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_examples/26.cc +++ /dev/null @@ -1,34 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - verify_demangle("_ZTI7a_class", "typeinfo for a_class"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_text/01.cc b/libstdc++-v3/testsuite/demangle/abi_text/01.cc deleted file mode 100644 index f26ec7c615e..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_text/01.cc +++ /dev/null @@ -1,42 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Examples given in the IA64 C++ ABI -// http://www.codesourcery.com/cxx-abi/abi-examples.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // 5.1.5 Type encodings. - // int* volatile const restrict _far p; - // cplus-dem FAIL - // icc CORE - // Equivalent as considered order-insensitive. - // standard text - // verify_demangle("U4_farrVKPi", "int* volatile const restrict _far"); - // new __cxa_demangle - verify_demangle("U4_farrVKPi", "int* restrict volatile const _far"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_text/02.cc b/libstdc++-v3/testsuite/demangle/abi_text/02.cc deleted file mode 100644 index 210ad98e687..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_text/02.cc +++ /dev/null @@ -1,42 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Specific examples mentioned in the IA64 C++ ABI text -// http://www.codesourcery.com/cxx-abi/abi.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // template<int I> void foo (int (&)[I + 1]) { }; - // template void foo<2> (int (&)[3]); - // Equivalent, but formatting difference in void argument and parentheses. - // icc, __cxa_demangle - verify_demangle("_Z3fooILi2EEvRAplT_Li1E_i", - "void foo<2>(int (&) [(2) + (1)])"); - // cplus-dem - // verify_demangle("_Z3fooILi2EEvRAplT_Li1E_i", - // "void foo<(int)2>(int (&) [((int)2)+((int)1)])"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_text/03.cc b/libstdc++-v3/testsuite/demangle/abi_text/03.cc deleted file mode 100644 index 678fd287244..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_text/03.cc +++ /dev/null @@ -1,39 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Specific examples mentioned in the IA64 C++ ABI text -// http://www.codesourcery.com/cxx-abi/abi.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // struct A; - // void f (void (A::*)() const) {} - // cplus-dem FAIL - // Equivalent, but formatting difference in void argument. - verify_demangle("_Z1fM1AKFvvE", "f(void (A::*)() const)"); - // verify_demangle("_Z1fM1AKFvvE", "f(void (A::*)(void) const)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_text/04.cc b/libstdc++-v3/testsuite/demangle/abi_text/04.cc deleted file mode 100644 index 66f739fffc2..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_text/04.cc +++ /dev/null @@ -1,35 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Specific examples mentioned in the IA64 C++ ABI text -// http://www.codesourcery.com/cxx-abi/abi.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // void foo(char); - verify_demangle("_Z3fooc", "foo(char)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_text/05.cc b/libstdc++-v3/testsuite/demangle/abi_text/05.cc deleted file mode 100644 index ddada2cdbb3..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_text/05.cc +++ /dev/null @@ -1,39 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Specific examples mentioned in the IA64 C++ ABI text -// http://www.codesourcery.com/cxx-abi/abi.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // void foo(char); - // template<void (&)(char)> struct CB { }; - // CB<foo> obj; - // cplus-dem FAIL - // standard text FAIL "CB<foo>" - verify_demangle("2CBIL_Z3foocEE", "CB<foo(char)>"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_text/06.cc b/libstdc++-v3/testsuite/demangle/abi_text/06.cc deleted file mode 100644 index 01b09b407c6..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_text/06.cc +++ /dev/null @@ -1,38 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Specific examples mentioned in the IA64 C++ ABI text -// http://www.codesourcery.com/cxx-abi/abi.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // extern "C" bool IsEmpty(char *); - // template<void (&)(char *)> struct CB; - // CB<IsEmpty> is mangled as - // cplus-dem FAIL - verify_demangle("2CBIL_Z7IsEmptyEE", "CB<IsEmpty>"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_text/07.cc b/libstdc++-v3/testsuite/demangle/abi_text/07.cc deleted file mode 100644 index 2005dde6baf..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_text/07.cc +++ /dev/null @@ -1,53 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Specific examples mentioned in the IA64 C++ ABI text -// http://www.codesourcery.com/cxx-abi/abi.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // 5.1.6 Scope Encoding - /* - namespace N - { - inline char* - f(int i) - { - static char *p = "Itanium C++ ABI"; // p = 1, "..." = 2 - { - struct X - { // X = 3 - void g() {} - }; - } - return p[i]; - } - } - */ - // encoding of N::f::p (first local mangled entity) - verify_demangle("_ZZN1N1fEiE1p", "N::f(int)::p"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_text/08.cc b/libstdc++-v3/testsuite/demangle/abi_text/08.cc deleted file mode 100644 index f85ef438429..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_text/08.cc +++ /dev/null @@ -1,35 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Specific examples mentioned in the IA64 C++ ABI text -// http://www.codesourcery.com/cxx-abi/abi.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // encoding of N::f::"Itanium C++ ABI" (no discriminator) - verify_demangle("_ZZN1N1fEiEs", "N::f(int)::string literal"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_text/09.cc b/libstdc++-v3/testsuite/demangle/abi_text/09.cc deleted file mode 100644 index 66f03076f2a..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_text/09.cc +++ /dev/null @@ -1,37 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Specific examples mentioned in the IA64 C++ ABI text -// http://www.codesourcery.com/cxx-abi/abi.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // encoding of N::f::X::g() - // (third local mangled entity used as a class-qualifier) - // cplus-dem FAIL - // icc CORE - verify_demangle("_ZNZN1N1fEiE1X1gE", "error code = -2: invalid mangled name"); - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_text/10.cc b/libstdc++-v3/testsuite/demangle/abi_text/10.cc deleted file mode 100644 index 82f7392b23e..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_text/10.cc +++ /dev/null @@ -1,35 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Specific examples mentioned in the IA64 C++ ABI text -// http://www.codesourcery.com/cxx-abi/abi.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - verify_demangle("_ZNZN1N1fEiE1X1gEv", - "error code = -2: invalid mangled name"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_text/11.cc b/libstdc++-v3/testsuite/demangle/abi_text/11.cc deleted file mode 100644 index 7eed78762bf..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_text/11.cc +++ /dev/null @@ -1,42 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Specific examples mentioned in the IA64 C++ ABI text -// http://www.codesourcery.com/cxx-abi/abi.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // 5.1.7 Compression. - // typedef void T(); - // struct S {}; - // void f(T*, T (S::*)) { } - // Equivalent, void variance. - // standard text, not possible - // verify_demangle("_Z1fPFvvEM1SFvvE", "void f(T*, T (S::*))"); - verify_demangle("_Z1fPFvvEM1SFvvE", "f(void (*)(), void (S::*)())"); - // demangle("_Z1fPFvvEM1SFvvE", "f(void (*)(void), void (S::*)(void))"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_text/12.cc b/libstdc++-v3/testsuite/demangle/abi_text/12.cc deleted file mode 100644 index 25c92c54daf..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_text/12.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Specific examples mentioned in the IA64 C++ ABI text -// http://www.codesourcery.com/cxx-abi/abi.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // N::T<int, int>::mf(N::T<double, double>) - verify_demangle("_ZN1N1TIiiE2mfES0_IddE", - "N::T<int, int>::mf(N::T<double, double>)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_text/13.cc b/libstdc++-v3/testsuite/demangle/abi_text/13.cc deleted file mode 100644 index 63a64e0d47d..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_text/13.cc +++ /dev/null @@ -1,35 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Specific examples mentioned in the IA64 C++ ABI text -// http://www.codesourcery.com/cxx-abi/abi.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // std::state - verify_demangle("_ZSt5state", "std::state"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/abi_text/14.cc b/libstdc++-v3/testsuite/demangle/abi_text/14.cc deleted file mode 100644 index 358c6e1a633..00000000000 --- a/libstdc++-v3/testsuite/demangle/abi_text/14.cc +++ /dev/null @@ -1,35 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// Specific examples mentioned in the IA64 C++ ABI text -// http://www.codesourcery.com/cxx-abi/abi.html#mangling -int main() -{ - using namespace __gnu_cxx_test; - - // std::_In::ward - verify_demangle("_ZNSt3_In4wardE", "std::_In::ward"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/3111-1.cc b/libstdc++-v3/testsuite/demangle/regression/3111-1.cc deleted file mode 100644 index 6e7d702c289..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/3111-1.cc +++ /dev/null @@ -1,33 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// c++/3111 -int main() -{ - using namespace __gnu_cxx_test; - - verify_demangle("_Z1fKPFiiE", "f(int (* const)(int))"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/3111-2.cc b/libstdc++-v3/testsuite/demangle/regression/3111-2.cc deleted file mode 100644 index fe6ceb3abed..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/3111-2.cc +++ /dev/null @@ -1,38 +0,0 @@ -// 2003-02-26 Carlo Wood <carlo@alinoe.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// c++/3111 -int main() -{ - using namespace __gnu_cxx_test; - - // cplus-dem FAIL - // icc FAIL - // verify_demangle("_Z1fAszL_ZZNK1N1A1fEvE3foo_0E_i", - // "f(int[sizeof(N::A::f() const::foo())])"); - verify_demangle("_Z1fAszL_ZZNK1N1A1fEvE3foo_0E_i", - "f(int[sizeof(N::A::f() const::foo)])"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/7986-01.cc b/libstdc++-v3/testsuite/demangle/regression/7986-01.cc deleted file mode 100644 index f05f097fe2f..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/7986-01.cc +++ /dev/null @@ -1,33 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libstdc++/7986 -int main() -{ - using namespace __gnu_cxx_test; - // cplus-dem FAIL - verify_demangle("_Z1fA37_iPS_", "f(int[37], int (*) [37])"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/7986-02.cc b/libstdc++-v3/testsuite/demangle/regression/7986-02.cc deleted file mode 100644 index ae9d945cb01..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/7986-02.cc +++ /dev/null @@ -1,35 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libstdc++/7986 -int main() -{ - using namespace __gnu_cxx_test; - - // Equivalent, but formatting difference in void argument. - // verify_demangle("_Z1fM1AFivEPS0_", "f(int (A::*)(void), int (*)(void))"); - verify_demangle("_Z1fM1AFivEPS0_", "f(int (A::*)(), int (*)())"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/7986-03.cc b/libstdc++-v3/testsuite/demangle/regression/7986-03.cc deleted file mode 100644 index 2596f9aa161..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/7986-03.cc +++ /dev/null @@ -1,34 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libstdc++/7986 -int main() -{ - using namespace __gnu_cxx_test; - - // cplus-dem FAIL - verify_demangle("_Z1fPFPA1_ivE", "f(int (*(*)()) [1])"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/7986-04.cc b/libstdc++-v3/testsuite/demangle/regression/7986-04.cc deleted file mode 100644 index 23d1f1f9cd6..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/7986-04.cc +++ /dev/null @@ -1,34 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libstdc++/7986 -int main() -{ - using namespace __gnu_cxx_test; - - // cplus-dem FAIL - verify_demangle("_Z1fPKM1AFivE", "f(int (A::* const*)())"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/7986-05.cc b/libstdc++-v3/testsuite/demangle/regression/7986-05.cc deleted file mode 100644 index b3393c903ff..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/7986-05.cc +++ /dev/null @@ -1,34 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libstdc++/7986 -int main() -{ - using namespace __gnu_cxx_test; - - // cplus-dem FAIL - verify_demangle("_Z1jM1AFivEPS1_", "j(int (A::*)(), int (A::**)())"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/7986-06.cc b/libstdc++-v3/testsuite/demangle/regression/7986-06.cc deleted file mode 100644 index 360c70c1cfe..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/7986-06.cc +++ /dev/null @@ -1,34 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libstdc++/7986 -int main() -{ - using namespace __gnu_cxx_test; - - // cplus-dem FAIL - verify_demangle("_Z1sPA37_iPS0_", "s(int (*) [37], int (**) [37])"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/7986-07.cc b/libstdc++-v3/testsuite/demangle/regression/7986-07.cc deleted file mode 100644 index 933c4c61e42..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/7986-07.cc +++ /dev/null @@ -1,35 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libstdc++/7986 -int main() -{ - using namespace __gnu_cxx_test; - - // cplus-dem FAIL - verify_demangle("_Z3fooA30_A_i", "foo(int[30][])"); - - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/7986-08.cc b/libstdc++-v3/testsuite/demangle/regression/7986-08.cc deleted file mode 100644 index 20800856518..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/7986-08.cc +++ /dev/null @@ -1,34 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libstdc++/7986 -int main() -{ - using namespace __gnu_cxx_test; - - // cplus-dem FAIL - verify_demangle("_Z3kooPA28_A30_i", "koo(int (*) [28][30])"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/7986-09.cc b/libstdc++-v3/testsuite/demangle/regression/7986-09.cc deleted file mode 100644 index 18a18b35c54..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/7986-09.cc +++ /dev/null @@ -1,40 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libstdc++/7986 -int main() -{ - using namespace __gnu_cxx_test; - - // cplus-dem FAIL - // Equivalent as considered order-insensitive? - // standard text, icc FAIL - // verify_demangle("_ZlsRKU3fooU4bart1XS0_", - // "operator<<(X const foo bart&, X const foo bart)"); - // new __cxa_demangle - verify_demangle("_ZlsRKU3fooU4bart1XS0_", - "operator<<(X bart foo const&, X bart)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/7986-10.cc b/libstdc++-v3/testsuite/demangle/regression/7986-10.cc deleted file mode 100644 index ff7fa4c3a6c..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/7986-10.cc +++ /dev/null @@ -1,34 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libstdc++/7986 -int main() -{ - using namespace __gnu_cxx_test; - - verify_demangle("_ZlsRKU3fooU4bart1XS2_", - "operator<<(X bart foo const&, X bart foo const)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/7986-11.cc b/libstdc++-v3/testsuite/demangle/regression/7986-11.cc deleted file mode 100644 index 49114d2c8ac..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/7986-11.cc +++ /dev/null @@ -1,34 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libstdc++/7986 -int main() -{ - using namespace __gnu_cxx_test; - - // cplus-dem FAIL - verify_demangle("_Z1fM1AKFivE", "f(int (A::*)() const)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/7986-12.cc b/libstdc++-v3/testsuite/demangle/regression/7986-12.cc deleted file mode 100644 index 64a400f781f..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/7986-12.cc +++ /dev/null @@ -1,47 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libstdc++/7986 -int main() -{ - using namespace __gnu_cxx_test; - - // ICE on figmative float template parameters? - /* - demangle("_Z3absILd1c1f1496f8a44219EEvv", "void abs<3.14159e-173>()"); - demangle("_Z3absILd40092acd9e83e426EEvv", "void abs<3.1459>()"); - demangl("_Z3absILe08042191a6cc56a2fe117becEEvv", "void abs<1.234e-2345l>()"); - demangle("_Z3absILf4016147bEEvv", "void abs<2.345f>()"); - demangle("_Z3absILfc1800000EEvv", " void abs<-16f>()"); - demangle("_Z3absILe804bfff8000000000000000EEvv", "void abs<-1l>()"); - */ - - // template<int D> void abs(void) { }; - // template void abs<11>(void); - // Equivalent, but formatting difference in void argument. - // verify_demangle("_Z3absILi11EEvv", "void abs<(int)11>()"); - verify_demangle("_Z3absILi11EEvv", "void abs<11>()"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/7986.cc b/libstdc++-v3/testsuite/demangle/regression/7986.cc deleted file mode 100644 index 05fa6a71c29..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/7986.cc +++ /dev/null @@ -1,32 +0,0 @@ -// 2003-02-26 Carlo Wood <carlo@alinoe.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libcwd tests -int main() -{ - using namespace __gnu_cxx_test; - - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/8897.cc b/libstdc++-v3/testsuite/demangle/regression/8897.cc deleted file mode 100644 index f40b90f30f6..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/8897.cc +++ /dev/null @@ -1,61 +0,0 @@ -// 2003-02-26 Martin v. Loewis <martin@v.loewis.de> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// c++/8897 -int main() -{ - using namespace __gnu_cxx_test; - - /* - template<typename T1> - struct A - { - template<typename T2> - operator T2(); - }; - - A<float> a; - (int)a; <-- that function. - */ - /* - Using "operator int()" is ambigious because that - could be either: - - operator int(); - - or - - template<typename T> - operator T(); - with T = int. - - - Carlo Wood - */ - // cplus-dem FAIL - // icc FAIL - // new __cxa_demangle FAIL - verify_demangle("_ZN1AIfEcvT_IiEEv", "A<float>::operator int<int>()"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/cw-01.cc b/libstdc++-v3/testsuite/demangle/regression/cw-01.cc deleted file mode 100644 index cda35f6a808..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/cw-01.cc +++ /dev/null @@ -1,54 +0,0 @@ -// 2003-02-26 Carlo Wood <carlo@alinoe.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libcwd tests -int main() -{ - using namespace __gnu_cxx_test; - - /* -class libcw_app_ct { -public: - void dummy(char const*) { } - template<typename T> - static void add_option(void (T::*)(char const*), char const*, char, - char const*, char const*); -}; - -template<typename T> - void libcw_app_ct::add_option(void (T::*)(char const*), char const*, char, - char const*, char const*) -{ } - -void fn(void) -{ - // Instantiation. - libcw_app_ct::add_option(&libcw_app_ct::dummy, "", '\0', "", ""); -} -*/ -verify_demangle("_ZN12libcw_app_ct10add_optionIS_EEvMT_FvPKcES3_cS3_S3_", - "void libcw_app_ct::add_option<libcw_app_ct>(void (libcw_app_ct::*)(char const*), char const*, char, char const*, char const*)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/cw-02.cc b/libstdc++-v3/testsuite/demangle/regression/cw-02.cc deleted file mode 100644 index 7c0d613bee3..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/cw-02.cc +++ /dev/null @@ -1,59 +0,0 @@ -// 2003-02-26 Carlo Wood <carlo@alinoe.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libcwd tests -int main() -{ - using namespace __gnu_cxx_test; - -/* -namespace libcw { - namespace debug { - class memblk_types_manipulator_data_ct { }; - } - template<typename T> - class omanip_id_tct { }; - namespace { - template<typename T> - class compiler_bug_workaround { - public: - static std::vector<int> ids; - }; - template<typename T> - std::vector<int> compiler_bug_workaround<T>::ids; - typedef std::vector<libcw::omanip_id_tct<libcw::debug::memblk_types_manipulator_data_ct> > vector_t; - compiler_bug_workaround<vector_t> dummy; - } -} - -void g(void) -{ - // Instantiation. - libcw::dummy.ids.size(); -} -*/ - verify_demangle("_ZGVN5libcw24_GLOBAL__N_cbll.cc0ZhUKa23compiler_bug_workaroundISt6vectorINS_13omanip_id_tctINS_5debug32memblk_types_manipulator_data_ctEEESaIS6_EEE3idsE", "guard variable for libcw::(anonymous namespace)::compiler_bug_workaround<std::vector<libcw::omanip_id_tct<libcw::debug::memblk_types_manipulator_data_ct>, std::allocator<libcw::omanip_id_tct<libcw::debug::memblk_types_manipulator_data_ct> > > >::ids"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/cw-03.cc b/libstdc++-v3/testsuite/demangle/regression/cw-03.cc deleted file mode 100644 index 0ab62327e4e..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/cw-03.cc +++ /dev/null @@ -1,54 +0,0 @@ -// 2003-02-26 Carlo Wood <carlo@alinoe.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libcwd tests -int main() -{ - using namespace __gnu_cxx_test; - -/* -namespace libcw { - namespace _private_ { - class GlobalObject { public: void dummy(std::ostream&) const; }; - } - namespace debug { - template<typename T> - class cwprint_using_tct { }; - template<typename T> - cwprint_using_tct<T> cwprint_using(T const&, void (T::*)(std::ostream&) const); - } -} - -void h(void) -{ - // Instantiation. - libcw::_private_::GlobalObject dummy; - (void)libcw::debug::cwprint_using(dummy, &libcw::_private_::GlobalObject::dummy); -} -*/ - // cplus-dem CORE - verify_demangle("_ZN5libcw5debug13cwprint_usingINS_9_private_12GlobalObjectEEENS0_17cwprint_using_tctIT_EERKS5_MS5_KFvRSt7ostreamE", "libcw::debug::cwprint_using_tct<libcw::_private_::GlobalObject> libcw::debug::cwprint_using<libcw::_private_::GlobalObject>(libcw::_private_::GlobalObject const&, void (libcw::_private_::GlobalObject::*)(std::ostream&) const)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/cw-04.cc b/libstdc++-v3/testsuite/demangle/regression/cw-04.cc deleted file mode 100644 index d2a7c09cdbc..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/cw-04.cc +++ /dev/null @@ -1,45 +0,0 @@ -// 2003-02-26 Carlo Wood <carlo@alinoe.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libcwd tests -int main() -{ - using namespace __gnu_cxx_test; - - -/* -class timer_event_request_base_ct { }; -struct timer_greater { }; - -void i(void) -{ - // Instantiation. - std::priority_queue<timer_event_request_base_ct*, std::deque<timer_event_request_base_ct*>, timer_greater> dummy; - dummy.top(); -} -*/ - verify_demangle("_ZNKSt14priority_queueIP27timer_event_request_base_ctSt5dequeIS1_SaIS1_EE13timer_greaterE3topEv", "std::priority_queue<timer_event_request_base_ct*, std::deque<timer_event_request_base_ct*, std::allocator<timer_event_request_base_ct*> >, timer_greater>::top() const"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/cw-05.cc b/libstdc++-v3/testsuite/demangle/regression/cw-05.cc deleted file mode 100644 index e56c834aeb5..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/cw-05.cc +++ /dev/null @@ -1,51 +0,0 @@ -// 2003-02-26 Carlo Wood <carlo@alinoe.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libcwd tests -int main() -{ - using namespace __gnu_cxx_test; - -/* -struct memory_block_st { }; -namespace std { - template<typename T, typename R = T const&, typename P = T const*> - class _Deque_iterator { - public: - void operator==(_Deque_iterator const&) const { } - }; -} - -void j(void) -{ - // Instantiation. - std::_Deque_iterator<memory_block_st*> dummy; - dummy.operator==(dummy); -} -*/ - verify_demangle("_ZNKSt15_Deque_iteratorIP15memory_block_stRKS1_PS2_EeqERKS5_", - "std::_Deque_iterator<memory_block_st*, memory_block_st* const&, memory_block_st* const*>::operator==(std::_Deque_iterator<memory_block_st*, memory_block_st* const&, memory_block_st* const*> const&) const"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/cw-06.cc b/libstdc++-v3/testsuite/demangle/regression/cw-06.cc deleted file mode 100644 index 5c22d177d9b..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/cw-06.cc +++ /dev/null @@ -1,51 +0,0 @@ -// 2003-02-26 Carlo Wood <carlo@alinoe.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libcwd tests -int main() -{ - using namespace __gnu_cxx_test; - -/* -struct option { }; -namespace std { - template<typename T1, typename T2> - class __normal_iterator { - public: - void operator-(__normal_iterator const&) const { } - }; -} - -void k(void) -{ - // Instantiation. - std::__normal_iterator<option const*, std::vector<option> > dummy; - dummy.operator-(dummy); -} -*/ - verify_demangle("_ZNKSt17__normal_iteratorIPK6optionSt6vectorIS0_SaIS0_EEEmiERKS6_", - "std::__normal_iterator<option const*, std::vector<option, std::allocator<option> > >::operator-(std::__normal_iterator<option const*, std::vector<option, std::allocator<option> > > const&) const"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/cw-07.cc b/libstdc++-v3/testsuite/demangle/regression/cw-07.cc deleted file mode 100644 index 25f3661fe50..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/cw-07.cc +++ /dev/null @@ -1,62 +0,0 @@ -// 2003-02-26 Carlo Wood <carlo@alinoe.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libcwd tests -int main() -{ - using namespace __gnu_cxx_test; - - -/* - -namespace libcw { - namespace debug { - class no_alloc_checking_allocator { }; - } -} -namespace std { - template<typename T> - class char_traits { }; - template<typename T, class _Traits, class _Alloc> - class basic_string { - public: - template<typename T2> - char* _S_construct(T2, T2, _Alloc const&) { return (char*)0; } - }; -} - -void l(void) -{ - // Instantiation. - std::basic_string<char, std::char_traits<char>, - libcw::debug::no_alloc_checking_allocator> dummy; - char* cp; - libcw::debug::no_alloc_checking_allocator alloc; - dummy._S_construct(cp, cp, alloc); -} -*/ - verify_demangle("_ZNSbIcSt11char_traitsIcEN5libcw5debug27no_alloc_checking_allocatorEE12_S_constructIPcEES6_T_S7_RKS3_", "char* std::basic_string<char, std::char_traits<char>, libcw::debug::no_alloc_checking_allocator>::_S_construct<char*>(char*, char*, libcw::debug::no_alloc_checking_allocator const&)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/cw-08.cc b/libstdc++-v3/testsuite/demangle/regression/cw-08.cc deleted file mode 100644 index 25280a5151c..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/cw-08.cc +++ /dev/null @@ -1,54 +0,0 @@ -// 2003-02-26 Carlo Wood <carlo@alinoe.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libcwd tests -int main() -{ - using namespace __gnu_cxx_test; - -/* -class A { }; -typedef A const* a4_t[4]; -typedef a4_t* ap4_t; -class C { -public: - ap4_t c; -}; -template<typename T1, typename T2, typename T3> - void f(T1, T2, T3, ap4_t, ap4_t (C::*)) { } - -void m(void) -{ - // Instantiation. - A a; - a4_t a4; - f(a, &a, static_cast<A const*>(&a), &a4, &C::c); -} -*/ - // Equivalent, spacing differences with icc. - // cplus-dem FAIL - verify_demangle("_Z1fI1APS0_PKS0_EvT_T0_T1_PA4_S3_M1CS8_", "void f<A, A*, A const*>(A, A*, A const*, A const* (*) [4], A const* (* C::*) [4])"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/cw-09.cc b/libstdc++-v3/testsuite/demangle/regression/cw-09.cc deleted file mode 100644 index 0ad38f1d291..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/cw-09.cc +++ /dev/null @@ -1,62 +0,0 @@ -// 2003-02-26 Carlo Wood <carlo@alinoe.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libcwd tests -int main() -{ - using namespace __gnu_cxx_test; - - -/* - -void foo(int, int*, int**, int***, int****, int*****, int******, int*******, int********, int*********, int**********, int***********, int************, int*************, int**************, int***************) -{ -} - -void n(void) -{ - int i0; - int* i1; - int** i2; - int*** i3; - int**** i4; - int***** i5; - int****** i6; - int******* i7; - int******** i8; - int********* i9; - int********** i10; - int*********** i11; - int************ i12; - int************* i13; - int************** i14; - int*************** i15; - foo(i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15); -} -*/ - // cplus-dem FAIL - verify_demangle("_Z3fooiPiPS_PS0_PS1_PS2_PS3_PS4_PS5_PS6_PS7_PS8_PS9_PSA_PSB_PSC_", "foo(int, int*, int**, int***, int****, int*****, int******, int*******, int********, int*********, int**********, int***********, int************, int*************, int**************, int***************)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/cw-10.cc b/libstdc++-v3/testsuite/demangle/regression/cw-10.cc deleted file mode 100644 index ab0da2af05f..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/cw-10.cc +++ /dev/null @@ -1,52 +0,0 @@ -// 2003-02-26 Carlo Wood <carlo@alinoe.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libcwd tests -int main() -{ - using namespace __gnu_cxx_test; - - -/* - -namespace std { - template<typename T1, typename T2, typename T3> - class D { }; - D<A*, A*&, A**> d; - template<typename T1, typename T2, typename T3> - D<T3, T3&, T3*> B(T1, T1, T2, T3*) { return d; } -} - -void o(void) -{ - std::D<A*, A* const&, A* const*> dummy1; - std::D<A*, A*&, A**> dummy2; - A* dummy3; - std::B(dummy1, dummy1, dummy2, &dummy3); -} -*/ - - verify_demangle("_ZSt1BISt1DIP1ARKS2_PS3_ES0_IS2_RS2_PS2_ES2_ET0_T_SB_SA_PT1_", "std::D<A*, A*&, A**> std::B<std::D<A*, A* const&, A* const*>, std::D<A*, A*&, A**>, A*>(std::D<A*, A* const&, A* const*>, std::D<A*, A* const&, A* const*>, std::D<A*, A*&, A**>, A**)"); - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/cw-11.cc b/libstdc++-v3/testsuite/demangle/regression/cw-11.cc deleted file mode 100644 index d763e8c56af..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/cw-11.cc +++ /dev/null @@ -1,34 +0,0 @@ -// 2003-02-26 Carlo Wood <carlo@alinoe.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libcwd tests -int main() -{ - using namespace __gnu_cxx_test; - - // cplus-dem CORE - verify_demangle("_X11TransParseAddress", "_X11TransParseAddress"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/cw-12.cc b/libstdc++-v3/testsuite/demangle/regression/cw-12.cc deleted file mode 100644 index cb6a40ee548..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/cw-12.cc +++ /dev/null @@ -1,88 +0,0 @@ -// 2003-02-26 Carlo Wood <carlo@alinoe.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libcwd tests -int main() -{ - using namespace __gnu_cxx_test; - -/* -namespace std { - template<bool b, int i> - class __default_alloc_template { }; - - template<typename CHAR> - class string_char_traits { }; - - template<class BASIC_STRING, class ADAPTOR> - struct _Alloc_traits { - static char _S_instanceless; - }; - template<class BASIC_STRING, class ADAPTOR> - char _Alloc_traits<BASIC_STRING, ADAPTOR>::_S_instanceless; -} -namespace libcw { - namespace debug { - namespace _private_ { - template<typename CHAR, class ALLOCATOR, bool b> - class allocator_adaptor { }; - } - } -} - -char x; -void q(void) -{ - std::_Alloc_traits< - std::basic_string< - char, - std::string_char_traits<char>, - libcw::debug::_private_::allocator_adaptor< - char, - std::__default_alloc_template<false, 327664>, - true - > - >, - libcw::debug::_private_::allocator_adaptor< - std::basic_string< - char, - std::string_char_traits<char>, - libcw::debug::_private_::allocator_adaptor< - char, - std::__default_alloc_template<false, 327664>, - true - > - >, - std::__default_alloc_template<false, 327664>, - true - > - > dummy1; - x = dummy1._S_instanceless; -} -*/ - // cplus-dem FAIL - verify_demangle("_ZNSt13_Alloc_traitsISbIcSt18string_char_traitsIcEN5libcw5debug9_private_17allocator_adaptorIcSt24__default_alloc_templateILb0ELi327664EELb1EEEENS5_IS9_S7_Lb1EEEE15_S_instancelessE","std::_Alloc_traits<std::basic_string<char, std::string_char_traits<char>, libcw::debug::_private_::allocator_adaptor<char, std::__default_alloc_template<false, 327664>, true> >, libcw::debug::_private_::allocator_adaptor<std::basic_string<char, std::string_char_traits<char>, libcw::debug::_private_::allocator_adaptor<char, std::__default_alloc_template<false, 327664>, true> >, std::__default_alloc_template<false, 327664>, true> >::_S_instanceless"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/cw-13.cc b/libstdc++-v3/testsuite/demangle/regression/cw-13.cc deleted file mode 100644 index 8fe07fd44a6..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/cw-13.cc +++ /dev/null @@ -1,34 +0,0 @@ -// 2003-02-26 Carlo Wood <carlo@alinoe.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libcwd tests -int main() -{ - using namespace __gnu_cxx_test; - - // cplus-dem CORE - verify_demangle("_GLOBAL__I__Z2fnv", "global constructors keyed to fn()"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/cw-14.cc b/libstdc++-v3/testsuite/demangle/regression/cw-14.cc deleted file mode 100644 index 613c0c8b32c..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/cw-14.cc +++ /dev/null @@ -1,72 +0,0 @@ -// 2003-02-26 Carlo Wood <carlo@alinoe.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// libcwd tests -int main() -{ - using namespace __gnu_cxx_test; - -/* -struct G { - int m(void) const { return 0; } - int n(void) { return 0; } -}; - -struct H { - int m(void) const { return 0; } - int n(void) { return 0; } -}; - -template<typename T> - class what - { - }; - -template<typename T> - class what2 - { - }; - -void r(int (G::*)(void), - int (G::*)(void) const, - G, // S_ - int (H::*)(void), // M1HS0_ - int (G::*)(void), // S1_ - what<G const>, // what<S2_> - what2<G const>, // what2<S8_> - int (G::*)(void) const // S3_ -{ - G g; - what<G const> y; - what2<G const> y2; - r(&G::n, &G::m, g, &H::n, &G::n, y, y2, &G::m); -} -*/ - - // cplus-dem CORE -verify_demangle("_Z1rM1GFivEMS_KFivES_M1HFivES1_4whatIKS_E5what2IS8_ES3_", - "r(int (G::*)(), int (G::*)() const, G, int (H::*)(), int (G::*)(), what<G const>, what2<G const>, int (G::*)() const)"); - - return 0; -} diff --git a/libstdc++-v3/testsuite/demangle/regression/old.cc b/libstdc++-v3/testsuite/demangle/regression/old.cc deleted file mode 100644 index 7bb8484d78c..00000000000 --- a/libstdc++-v3/testsuite/demangle/regression/old.cc +++ /dev/null @@ -1,31 +0,0 @@ -// 2003-02-26 Benjamin Kosnik <bkoz@redhat.com> - -// Copyright (C) 2003 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. - -// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) - -#include <testsuite_hooks.h> - -// old libiberty tests for gnu-v3 -int main() -{ - using namespace __gnu_cxx_test; - verify_demangle("St9bad_alloc", "std::bad_alloc"); - return 0; -} |