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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [newlib-1.18.0/] [newlib/] [libc/] [stdlib/] [wcstoll.c] - Blame information for rev 862

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/*
2
FUNCTION
3
   <<wcstoll>>---wide string to long long
4
 
5
INDEX
6
        wcstoll
7
INDEX
8
        _wcstoll_r
9
 
10
ANSI_SYNOPSIS
11
        #include <wchar.h>
12
        long long wcstoll(const wchar_t *<[s]>, wchar_t **<[ptr]>,int <[base]>);
13
 
14
        long long _wcstoll_r(void *<[reent]>,
15
                       const wchar_t *<[s]>, wchar_t **<[ptr]>,int <[base]>);
16
 
17
TRAD_SYNOPSIS
18
        #include <stdlib.h>
19
        long long wcstoll (<[s]>, <[ptr]>, <[base]>)
20
        const wchar_t *<[s]>;
21
        wchar_t **<[ptr]>;
22
        int <[base]>;
23
 
24
        long long _wcstoll_r (<[reent]>, <[s]>, <[ptr]>, <[base]>)
25
        wchar_t *<[reent]>;
26
        const wchar_t *<[s]>;
27
        wchar_t **<[ptr]>;
28
        int <[base]>;
29
 
30
DESCRIPTION
31
The function <<wcstoll>> converts the wide string <<*<[s]>>> to
32
a <<long long>>. First, it breaks down the string into three parts:
33
leading whitespace, which is ignored; a subject string consisting
34
of characters resembling an integer in the radix specified by <[base]>;
35
and a trailing portion consisting of zero or more unparseable characters,
36
and always including the terminating null character. Then, it attempts
37
to convert the subject string into a <<long long>> and returns the
38
result.
39
 
40
If the value of <[base]> is 0, the subject string is expected to look
41
like a normal C integer constant: an optional sign, a possible `<<0x>>'
42
indicating a hexadecimal base, and a number. If <[base]> is between
43
2 and 36, the expected form of the subject is a sequence of letters
44
and digits representing an integer in the radix specified by <[base]>,
45
with an optional plus or minus sign. The letters <<a>>--<<z>> (or,
46
equivalently, <<A>>--<<Z>>) are used to signify values from 10 to 35;
47
only letters whose ascribed values are less than <[base]> are
48
permitted. If <[base]> is 16, a leading <<0x>> is permitted.
49
 
50
The subject sequence is the longest initial sequence of the input
51
string that has the expected form, starting with the first
52
non-whitespace character.  If the string is empty or consists entirely
53
of whitespace, or if the first non-whitespace character is not a
54
permissible letter or digit, the subject string is empty.
55
 
56
If the subject string is acceptable, and the value of <[base]> is zero,
57
<<wcstoll>> attempts to determine the radix from the input string. A
58
string with a leading <<0x>> is treated as a hexadecimal value; a string with
59
a leading 0 and no <<x>> is treated as octal; all other strings are
60
treated as decimal. If <[base]> is between 2 and 36, it is used as the
61
conversion radix, as described above. If the subject string begins with
62
a minus sign, the value is negated. Finally, a pointer to the first
63
character past the converted subject string is stored in <[ptr]>, if
64
<[ptr]> is not <<NULL>>.
65
 
66
If the subject string is empty (or not in acceptable form), no conversion
67
is performed and the value of <[s]> is stored in <[ptr]> (if <[ptr]> is
68
not <<NULL>>).
69
 
70
The alternate function <<_wcstoll_r>> is a reentrant version.  The
71
extra argument <[reent]> is a pointer to a reentrancy structure.
72
 
73
RETURNS
74
<<wcstoll>> returns the converted value, if any. If no conversion was
75
made, 0 is returned.
76
 
77
<<wcstoll>> returns <<LONG_LONG_MAX>> or <<LONG_LONG_MIN>> if the magnitude of
78
the converted value is too large, and sets <<errno>> to <<ERANGE>>.
79
 
80
PORTABILITY
81
<<wcstoll>> is ANSI.
82
 
83
No supporting OS subroutines are required.
84
*/
85
 
86
/*-
87
 * Copyright (c) 1990 The Regents of the University of California.
88
 * All rights reserved.
89
 *
90
 * Redistribution and use in source and binary forms, with or without
91
 * modification, are permitted provided that the following conditions
92
 * are met:
93
 * 1. Redistributions of source code must retain the above copyright
94
 *    notice, this list of conditions and the following disclaimer.
95
 * 2. Redistributions in binary form must reproduce the above copyright
96
 *    notice, this list of conditions and the following disclaimer in the
97
 *    documentation and/or other materials provided with the distribution.
98
 * 3. All advertising materials mentioning features or use of this software
99
 *    must display the following acknowledgement:
100
 *      This product includes software developed by the University of
101
 *      California, Berkeley and its contributors.
102
 * 4. Neither the name of the University nor the names of its contributors
103
 *    may be used to endorse or promote products derived from this software
104
 *    without specific prior written permission.
105
 *
106
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
107
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
108
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
109
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
110
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
111
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
112
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
113
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
114
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
115
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
116
 * SUCH DAMAGE.
117
 */
118
 
119
 
120
#include <_ansi.h>
121
#include <limits.h>
122
#include <wctype.h>
123
#include <errno.h>
124
#include <wchar.h>
125
#include <reent.h>
126
 
127
#ifndef _REENT_ONLY
128
 
129
long long
130
_DEFUN (wcstoll, (s, ptr, base),
131
        _CONST wchar_t *s _AND
132
        wchar_t **ptr _AND
133
        int base)
134
{
135
        return _wcstoll_r (_REENT, s, ptr, base);
136
}
137
 
138
#endif

powered by: WebSVN 2.1.0

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