OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libstdc++-v3/] [testsuite/] [testsuite_character.cc] - Blame information for rev 19

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 jlechner
// -*- C++ -*-
2
 
3
// Utility subroutines for the C++ library testsuite. 
4
//
5
// Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
6
//
7
// This file is part of the GNU ISO C++ Library.  This library is free
8
// software; you can redistribute it and/or modify it under the
9
// terms of the GNU General Public License as published by the
10
// Free Software Foundation; either version 2, or (at your option)
11
// any later version.
12
//
13
// This library is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
// GNU General Public License for more details.
17
//
18
// You should have received a copy of the GNU General Public License along
19
// with this library; see the file COPYING.  If not, write to the Free
20
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21
// USA.
22
//
23
// As a special exception, you may use this file as part of a free software
24
// library without restriction.  Specifically, if other files instantiate
25
// templates or use macros or inline functions from this file, or you compile
26
// this file and link it with other files to produce an executable, this
27
// file does not by itself cause the resulting executable to be covered by
28
// the GNU General Public License.  This exception does not however
29
// invalidate any other reasons why the executable file might be covered by
30
// the GNU General Public License.
31
 
32
#include <testsuite_character.h>
33
 
34
namespace std
35
{
36
  locale::id
37
  codecvt<__gnu_test::pod_uchar, char, __gnu_test::pod_state>::id;
38
 
39
  locale::id
40
  ctype<__gnu_test::pod_uchar>::id;
41
 
42
  locale::id
43
  numpunct<__gnu_test::pod_uint>::id;
44
 
45
  locale::id
46
  moneypunct<__gnu_test::pod_uint>::id;
47
 
48
  // Member specializations for the existing facet classes.  
49
  // NB: This isn't especially portable. Perhaps a better way would be
50
  // to just specialize all of numpunct and ctype.
51
  using __gnu_test::pod_ushort;
52
  typedef pod_ushort::value_type value_type;
53
 
54
  template<>
55
    bool
56
    ctype<pod_ushort>::
57
    do_is(mask, char_type) const { return true; }
58
 
59
  template<>
60
    const pod_ushort*
61
    ctype<pod_ushort>::
62
    do_is(const char_type* __lo, const char_type*, mask*) const
63
    { return __lo; }
64
 
65
  template<>
66
    const pod_ushort*
67
    ctype<pod_ushort>::
68
    do_scan_is(mask, const char_type* __lo, const char_type*) const
69
    { return __lo; }
70
 
71
  template<>
72
    const pod_ushort*
73
    ctype<pod_ushort>::
74
    do_scan_not(mask, const char_type* __lo, const char_type*) const
75
    { return __lo; }
76
 
77
  template<>
78
    pod_ushort
79
    ctype<pod_ushort>::
80
    do_toupper(char_type __c) const
81
    { return __c; }
82
 
83
  template<>
84
    const pod_ushort*
85
    ctype<pod_ushort>::
86
    do_toupper(char_type*, const char_type* __hi) const
87
    { return __hi; }
88
 
89
  template<>
90
    pod_ushort
91
    ctype<pod_ushort>::
92
    do_tolower(char_type __c) const
93
    { return __c; }
94
 
95
  template<>
96
    const pod_ushort*
97
    ctype<pod_ushort>::
98
    do_tolower(char_type*, const char_type* __hi) const
99
    { return __hi; }
100
 
101
  template<>
102
    pod_ushort
103
    ctype<pod_ushort>::
104
    do_widen(char __c) const
105
    {
106
      char_type ret = { value_type(__c) };
107
      return ret;
108
    }
109
 
110
  template<>
111
    const char*
112
    ctype<pod_ushort>::
113
    do_widen(const char* __lo, const char* __hi, char_type* __dest) const
114
    {
115
      while (__lo < __hi)
116
        {
117
          *__dest = this->do_widen(*__lo);
118
          ++__lo;
119
          ++__dest;
120
        }
121
      return __hi;
122
    }
123
 
124
  template<>
125
    char
126
    ctype<pod_ushort>::
127
    do_narrow(char_type __wc, char) const
128
    { return static_cast<char>(__wc.value); }
129
 
130
  template<>
131
    const pod_ushort*
132
    ctype<pod_ushort>::
133
    do_narrow(const pod_ushort* __lo, const pod_ushort* __hi,
134
              char, char* __dest) const
135
    {
136
      while (__lo < __hi)
137
        {
138
          *__dest = this->do_narrow(*__lo, char());
139
          ++__lo;
140
          ++__dest;
141
        }
142
      return __hi;
143
    }
144
 
145
  template<>
146
    ctype<pod_ushort>::~ctype() { }
147
 
148
  template<>
149
    void
150
    numpunct<pod_ushort>::_M_initialize_numpunct(__c_locale)
151
    {
152
      if (!_M_data)
153
        _M_data = new __numpunct_cache<pod_ushort>;
154
 
155
      _M_data->_M_grouping = "";
156
      _M_data->_M_use_grouping = false;
157
 
158
      _M_data->_M_decimal_point.value =  value_type('.');
159
      _M_data->_M_thousands_sep.value = value_type(',');
160
 
161
      for (size_t i = 0; i < __num_base::_S_oend; ++i)
162
        {
163
          value_type v = __num_base::_S_atoms_out[i];
164
          _M_data->_M_atoms_out[i].value = v;
165
        }
166
      _M_data->_M_atoms_out[__num_base::_S_oend] = pod_ushort();
167
 
168
      for (size_t j = 0; j < __num_base::_S_iend; ++j)
169
        _M_data->_M_atoms_in[j].value = value_type(__num_base::_S_atoms_in[j]);
170
      _M_data->_M_atoms_in[__num_base::_S_iend] = pod_ushort();
171
 
172
      // "true"
173
      pod_ushort* __truename = new pod_ushort[4 + 1];
174
      __truename[0].value = value_type('t');
175
      __truename[1].value = value_type('r');
176
      __truename[2].value = value_type('u');
177
      __truename[3].value = value_type('e');
178
      __truename[4] = pod_ushort();
179
      _M_data->_M_truename = __truename;
180
 
181
      // "false"
182
      pod_ushort* __falsename = new pod_ushort[5 + 1];
183
      __falsename[0].value = value_type('f');
184
      __falsename[1].value = value_type('a');
185
      __falsename[2].value = value_type('l');
186
      __falsename[3].value = value_type('s');
187
      __falsename[4].value = value_type('e');
188
      __falsename[5] = pod_ushort();
189
      _M_data->_M_falsename = __falsename;
190
    }
191
 
192
  template<>
193
    numpunct<pod_ushort>::~numpunct()
194
    { delete _M_data; }
195
} // namespace std

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.