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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libstdc++-v3/] [src/] [compatibility.cc] - Blame information for rev 18

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 18 jlechner
// Compatibility symbols for previous versions -*- C++ -*-
2
 
3
// Copyright (C) 2005
4
// Free Software Foundation, Inc.
5
//
6
// This file is part of the GNU ISO C++ Library.  This library is free
7
// software; you can redistribute it and/or modify it under the
8
// terms of the GNU General Public License as published by the
9
// Free Software Foundation; either version 2, or (at your option)
10
// any later version.
11
 
12
// This library is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
// GNU General Public License for more details.
16
 
17
// You should have received a copy of the GNU General Public License along
18
// with this library; see the file COPYING.  If not, write to the Free
19
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20
// USA.
21
 
22
// As a special exception, you may use this file as part of a free software
23
// library without restriction.  Specifically, if other files instantiate
24
// templates or use macros or inline functions from this file, or you compile
25
// this file and link it with other files to produce an executable, this
26
// file does not by itself cause the resulting executable to be covered by
27
// the GNU General Public License.  This exception does not however
28
// invalidate any other reasons why the executable file might be covered by
29
// the GNU General Public License.
30
 
31
#include <bits/c++config.h>
32
 
33
#if defined(_GLIBCXX_SYMVER) && defined(PIC)
34
#define istreambuf_iterator istreambuf_iteratorXX
35
#define basic_fstream basic_fstreamXX
36
#define basic_ifstream basic_ifstreamXX
37
#define basic_ofstream basic_ofstreamXX
38
#define _M_copy(a, b, c) _M_copyXX(a, b, c)
39
#define _M_move(a, b, c) _M_moveXX(a, b, c)
40
#define _M_assign(a, b, c) _M_assignXX(a, b, c)
41
#define _M_disjunct(a) _M_disjunctXX(a)
42
#define _M_check_length(a, b, c) _M_check_lengthXX(a, b, c)
43
#define _M_set_length_and_sharable(a) _M_set_length_and_sharableXX(a)
44
#define ignore ignoreXX
45
#define eq eqXX
46
#endif
47
 
48
#include <string>
49
#include <istream>
50
#include <fstream>
51
#include <sstream>
52
 
53
namespace std
54
{
55
  // std::istream ignore explicit specializations.
56
 
57
  template<>
58
    basic_istream<char>&
59
    basic_istream<char>::
60
    ignore(streamsize __n)
61
    {
62
      if (__n == 1)
63
        return ignore();
64
 
65
      _M_gcount = 0;
66
      sentry __cerb(*this, true);
67
      if (__cerb && __n > 0)
68
        {
69
          ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
70
          try
71
            {
72
              const int_type __eof = traits_type::eof();
73
              __streambuf_type* __sb = this->rdbuf();
74
              int_type __c = __sb->sgetc();
75
 
76
              // See comment in istream.tcc.
77
              bool __large_ignore = false;
78
              while (true)
79
                {
80
                  while (_M_gcount < __n
81
                         && !traits_type::eq_int_type(__c, __eof))
82
                    {
83
                      streamsize __size = std::min(streamsize(__sb->egptr()
84
                                                              - __sb->gptr()),
85
                                                   streamsize(__n - _M_gcount));
86
                      if (__size > 1)
87
                        {
88
                          __sb->gbump(__size);
89
                          _M_gcount += __size;
90
                          __c = __sb->sgetc();
91
                        }
92
                      else
93
                        {
94
                          ++_M_gcount;
95
                          __c = __sb->snextc();
96
                        }
97
                    }
98
                  if (__n == numeric_limits<streamsize>::max()
99
                      && !traits_type::eq_int_type(__c, __eof))
100
                    {
101
                      _M_gcount = numeric_limits<streamsize>::min();
102
                      __large_ignore = true;
103
                    }
104
                  else
105
                    break;
106
                }
107
 
108
              if (__large_ignore)
109
                _M_gcount = numeric_limits<streamsize>::max();
110
 
111
              if (traits_type::eq_int_type(__c, __eof))
112
                __err |= ios_base::eofbit;
113
            }
114
          catch(...)
115
            { this->_M_setstate(ios_base::badbit); }
116
          if (__err)
117
            this->setstate(__err);
118
        }
119
      return *this;
120
    }
121
 
122
#ifdef _GLIBCXX_USE_WCHAR_T
123
  template<>
124
    basic_istream<wchar_t>&
125
    basic_istream<wchar_t>::
126
    ignore(streamsize __n)
127
    {
128
      if (__n == 1)
129
        return ignore();
130
 
131
      _M_gcount = 0;
132
      sentry __cerb(*this, true);
133
      if (__cerb && __n > 0)
134
        {
135
          ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
136
          try
137
            {
138
              const int_type __eof = traits_type::eof();
139
              __streambuf_type* __sb = this->rdbuf();
140
              int_type __c = __sb->sgetc();
141
 
142
              bool __large_ignore = false;
143
              while (true)
144
                {
145
                  while (_M_gcount < __n
146
                         && !traits_type::eq_int_type(__c, __eof))
147
                    {
148
                      streamsize __size = std::min(streamsize(__sb->egptr()
149
                                                              - __sb->gptr()),
150
                                                   streamsize(__n - _M_gcount));
151
                      if (__size > 1)
152
                        {
153
                          __sb->gbump(__size);
154
                          _M_gcount += __size;
155
                          __c = __sb->sgetc();
156
                        }
157
                      else
158
                        {
159
                          ++_M_gcount;
160
                          __c = __sb->snextc();
161
                        }
162
                    }
163
                  if (__n == numeric_limits<streamsize>::max()
164
                      && !traits_type::eq_int_type(__c, __eof))
165
                    {
166
                      _M_gcount = numeric_limits<streamsize>::min();
167
                      __large_ignore = true;
168
                    }
169
                  else
170
                    break;
171
                }
172
 
173
              if (__large_ignore)
174
                _M_gcount = numeric_limits<streamsize>::max();
175
 
176
              if (traits_type::eq_int_type(__c, __eof))
177
                __err |= ios_base::eofbit;
178
            }
179
          catch(...)
180
            { this->_M_setstate(ios_base::badbit); }
181
          if (__err)
182
            this->setstate(__err);
183
        }
184
      return *this;
185
    }
186
#endif
187
}
188
 
189
// NB: These symbols renames should go into the shared library only,
190
// and only those shared libraries that support versioning.
191
#if defined(_GLIBCXX_SYMVER) && defined(PIC)
192
 
193
/* gcc-3.4.4
194
_ZNSt19istreambuf_iteratorIcSt11char_traitsIcEEppEv
195
_ZNSt19istreambuf_iteratorIwSt11char_traitsIwEEppEv
196
 */
197
namespace std
198
{
199
  template
200
    istreambuf_iterator<char>&
201
    istreambuf_iterator<char>::operator++();
202
 
203
#ifdef _GLIBCXX_USE_WCHAR_T
204
  template
205
    istreambuf_iterator<wchar_t>&
206
    istreambuf_iterator<wchar_t>::operator++();
207
#endif
208
} // namespace std
209
 
210
/* gcc-4.0.0
211
_ZNSs4_Rep26_M_set_length_and_sharableEj
212
_ZNSs7_M_copyEPcPKcj
213
_ZNSs7_M_moveEPcPKcj
214
_ZNSs9_M_assignEPcjc
215
_ZNKSs11_M_disjunctEPKc
216
_ZNKSs15_M_check_lengthEjjPKc
217
_ZNSbIwSt11char_traitsIwESaIwEE4_Rep26_M_set_length_and_sharableEj
218
_ZNSbIwSt11char_traitsIwESaIwEE7_M_copyEPwPKwj
219
_ZNSbIwSt11char_traitsIwESaIwEE7_M_moveEPwPKwj
220
_ZNSbIwSt11char_traitsIwESaIwEE9_M_assignEPwjw
221
_ZNKSbIwSt11char_traitsIwESaIwEE11_M_disjunctEPKw
222
_ZNKSbIwSt11char_traitsIwESaIwEE15_M_check_lengthEjjPKc
223
 
224
_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv
225
_ZNKSt13basic_fstreamIwSt11char_traitsIwEE7is_openEv
226
_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE7is_openEv
227
_ZNKSt14basic_ifstreamIwSt11char_traitsIwEE7is_openEv
228
_ZNKSt14basic_ofstreamIcSt11char_traitsIcEE7is_openEv
229
_ZNKSt14basic_ofstreamIwSt11char_traitsIwEE7is_openEv
230
 
231
_ZNSi6ignoreEi
232
_ZNSi6ignoreEv
233
_ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEi
234
_ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEv
235
 
236
_ZNSt11char_traitsIcE2eqERKcS2_
237
_ZNSt11char_traitsIwE2eqERKwS2_
238
 */
239
namespace std
240
{
241
  // std::char_traits is explicitly specialized
242
  bool (* __p1)(const char&, const char&) = &char_traits<char>::eq;
243
 
244
  // std::string
245
  template
246
    void
247
    basic_string<char>::_M_copy(char*, const char*, size_t);
248
 
249
  template
250
    void
251
    basic_string<char>::_M_move(char*, const char*, size_t);
252
 
253
  template
254
    void
255
    basic_string<char>::_M_assign(char*, size_t, char);
256
 
257
  template
258
    bool
259
    basic_string<char>::_M_disjunct(const char*) const;
260
 
261
  template
262
    void
263
    basic_string<char>::_M_check_length(size_t, size_t, const char*) const;
264
 
265
  template
266
    void
267
    basic_string<char>::_Rep::_M_set_length_and_sharable(size_t);
268
 
269
 
270
  // std::istream
271
  template
272
    basic_istream<char>&
273
    basic_istream<char>::ignore();
274
 
275
  template
276
    bool
277
    basic_fstream<char>::is_open() const;
278
 
279
  template
280
    bool
281
    basic_ifstream<char>::is_open() const;
282
 
283
  template
284
    bool
285
    basic_ofstream<char>::is_open() const;
286
 
287
#ifdef _GLIBCXX_USE_WCHAR_T
288
  bool (* __p2)(const wchar_t&, const wchar_t&) = &char_traits<wchar_t>::eq;
289
 
290
  // std::wstring
291
  template
292
    void
293
    basic_string<wchar_t>::_M_copy(wchar_t*, const wchar_t*, size_t);
294
 
295
  template
296
    void
297
    basic_string<wchar_t>::_M_move(wchar_t*, const wchar_t*, size_t);
298
 
299
  template
300
    void
301
    basic_string<wchar_t>::_M_assign(wchar_t*, size_t, wchar_t);
302
 
303
  template
304
    bool
305
    basic_string<wchar_t>::_M_disjunct(const wchar_t*) const;
306
 
307
  template
308
    void
309
    basic_string<wchar_t>::_M_check_length(size_t, size_t,
310
                                           const char*) const;
311
 
312
  template
313
    void
314
    basic_string<wchar_t>::_Rep::_M_set_length_and_sharable(size_t);
315
 
316
  template
317
    basic_istream<wchar_t>&
318
    basic_istream<wchar_t>::ignore();
319
 
320
  template
321
    bool
322
    basic_fstream<wchar_t>::is_open() const;
323
 
324
  template
325
    bool
326
    basic_ifstream<wchar_t>::is_open() const;
327
 
328
  template
329
    bool
330
    basic_ofstream<wchar_t>::is_open() const;
331
#endif
332
}
333
 
334
// The rename syntax for default exported names is
335
//   asm (".symver name1,exportedname@GLIBCXX_3.4")
336
//   asm (".symver name2,exportedname@@GLIBCXX_3.4.5")
337
// In the future, GLIBCXX_ABI > 6 should remove all uses of
338
// _GLIBCXX_*_SYMVER macros in this file.
339
 
340
#define _GLIBCXX_3_4_SYMVER(XXname, name) \
341
   extern "C" void \
342
   _X##name() \
343
   __attribute__ ((alias(#XXname))); \
344
   asm (".symver " "_X" #name "," #name "@GLIBCXX_3.4");
345
 
346
#define _GLIBCXX_3_4_5_SYMVER(XXname, name) \
347
   extern "C" void \
348
   _Y##name() \
349
   __attribute__ ((alias(#XXname))); \
350
   asm (".symver " "_Y" #name  "," #name "@@GLIBCXX_3.4.5");
351
 
352
#define _GLIBCXX_ASM_SYMVER(cur, old, version) \
353
   asm (".symver " #cur "," #old "@@" #version);
354
 
355
#define _GLIBCXX_APPLY_SYMVER _GLIBCXX_3_4_SYMVER
356
#include <bits/compatibility.h>
357
#undef _GLIBCXX_APPLY_SYMVER
358
 
359
#define _GLIBCXX_APPLY_SYMVER _GLIBCXX_3_4_5_SYMVER
360
#include <bits/compatibility.h>
361
#undef _GLIBCXX_APPLY_SYMVER
362
 
363
#endif
364
 
365
#ifdef __APPLE__
366
#if (defined(__ppc__) || defined (__ppc64__)) && defined (PIC)
367
/* __eprintf shouldn't have been made visible from libstdc++, or
368
   anywhere, but on Mac OS X 10.4 it was defined in
369
   libstdc++.6.0.3.dylib; so on that platform we have to keep defining
370
   it to keep binary compatibility.  We can't just put the libgcc
371
   version in the export list, because that doesn't work; once a
372
   symbol is marked as hidden, it stays that way.  */
373
 
374
#include <cstdio>
375
#include <cstdlib>
376
 
377
using namespace std;
378
 
379
extern "C" void
380
__eprintf (const char *string, const char *expression,
381
           unsigned int line, const char *filename)
382
{
383
  fprintf (stderr, string, expression, line, filename);
384
  fflush (stderr);
385
  abort ();
386
}
387
#endif
388
#endif /* __APPLE__ */

powered by: WebSVN 2.1.0

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