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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc1/] [newlib/] [libc/] [stdlib/] [strtoull.c] - Diff between revs 207 and 345

Only display areas with differences | Details | Blame | View Log

Rev 207 Rev 345
/*
/*
FUNCTION
FUNCTION
        <<strtoull>>---string to unsigned long long
        <<strtoull>>---string to unsigned long long
 
 
INDEX
INDEX
        strtoull
        strtoull
INDEX
INDEX
        _strtoull_r
        _strtoull_r
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include <stdlib.h>
        #include <stdlib.h>
        unsigned long long strtoull(const char *<[s]>, char **<[ptr]>,
        unsigned long long strtoull(const char *<[s]>, char **<[ptr]>,
                              int <[base]>);
                              int <[base]>);
 
 
        unsigned long long _strtoull_r(void *<[reent]>, const char *<[s]>,
        unsigned long long _strtoull_r(void *<[reent]>, const char *<[s]>,
                              char **<[ptr]>, int <[base]>);
                              char **<[ptr]>, int <[base]>);
 
 
TRAD_SYNOPSIS
TRAD_SYNOPSIS
        #include <stdlib.h>
        #include <stdlib.h>
        unsigned long long strtoull(<[s]>, <[ptr]>, <[base]>)
        unsigned long long strtoull(<[s]>, <[ptr]>, <[base]>)
        char *<[s]>;
        char *<[s]>;
        char **<[ptr]>;
        char **<[ptr]>;
        int <[base]>;
        int <[base]>;
 
 
        unsigned long long _strtoull_r(<[reent]>, <[s]>, <[ptr]>, <[base]>)
        unsigned long long _strtoull_r(<[reent]>, <[s]>, <[ptr]>, <[base]>)
        char *<[reent]>;
        char *<[reent]>;
        char *<[s]>;
        char *<[s]>;
        char **<[ptr]>;
        char **<[ptr]>;
        int <[base]>;
        int <[base]>;
 
 
DESCRIPTION
DESCRIPTION
The function <<strtoull>> converts the string <<*<[s]>>> to
The function <<strtoull>> converts the string <<*<[s]>>> to
an <<unsigned long long>>. First, it breaks down the string into three parts:
an <<unsigned long long>>. First, it breaks down the string into three parts:
leading whitespace, which is ignored; a subject string consisting
leading whitespace, which is ignored; a subject string consisting
of the digits meaningful in the radix specified by <[base]>
of the digits meaningful in the radix specified by <[base]>
(for example, <<0>> through <<7>> if the value of <[base]> is 8);
(for example, <<0>> through <<7>> if the value of <[base]> is 8);
and a trailing portion consisting of one or more unparseable characters,
and a trailing portion consisting of one or more unparseable characters,
which always includes the terminating null character. Then, it attempts
which always includes the terminating null character. Then, it attempts
to convert the subject string into an unsigned long long integer, and returns the
to convert the subject string into an unsigned long long integer, and returns the
result.
result.
 
 
If the value of <[base]> is zero, the subject string is expected to look
If the value of <[base]> is zero, the subject string is expected to look
like a normal C integer constant (save that no optional sign is permitted):
like a normal C integer constant (save that no optional sign is permitted):
a possible <<0x>> indicating hexadecimal radix, and a number.
a possible <<0x>> indicating hexadecimal radix, and a number.
If <[base]> is between 2 and 36, the expected form of the subject is a
If <[base]> is between 2 and 36, the expected form of the subject is a
sequence of digits (which may include letters, depending on the
sequence of digits (which may include letters, depending on the
base) representing an integer in the radix specified by <[base]>.
base) representing an integer in the radix specified by <[base]>.
The letters <<a>>--<<z>> (or <<A>>--<<Z>>) are used as digits valued from
The letters <<a>>--<<z>> (or <<A>>--<<Z>>) are used as digits valued from
10 to 35. If <[base]> is 16, a leading <<0x>> is permitted.
10 to 35. If <[base]> is 16, a leading <<0x>> is permitted.
 
 
The subject sequence is the longest initial sequence of the input
The subject sequence is the longest initial sequence of the input
string that has the expected form, starting with the first
string that has the expected form, starting with the first
non-whitespace character.  If the string is empty or consists entirely
non-whitespace character.  If the string is empty or consists entirely
of whitespace, or if the first non-whitespace character is not a
of whitespace, or if the first non-whitespace character is not a
permissible digit, the subject string is empty.
permissible digit, the subject string is empty.
 
 
If the subject string is acceptable, and the value of <[base]> is zero,
If the subject string is acceptable, and the value of <[base]> is zero,
<<strtoull>> attempts to determine the radix from the input string. A
<<strtoull>> attempts to determine the radix from the input string. A
string with a leading <<0x>> is treated as a hexadecimal value; a string with
string with a leading <<0x>> is treated as a hexadecimal value; a string with
a leading <<0>> and no <<x>> is treated as octal; all other strings are
a leading <<0>> and no <<x>> is treated as octal; all other strings are
treated as decimal. If <[base]> is between 2 and 36, it is used as the
treated as decimal. If <[base]> is between 2 and 36, it is used as the
conversion radix, as described above. Finally, a pointer to the first
conversion radix, as described above. Finally, a pointer to the first
character past the converted subject string is stored in <[ptr]>, if
character past the converted subject string is stored in <[ptr]>, if
<[ptr]> is not <<NULL>>.
<[ptr]> is not <<NULL>>.
 
 
If the subject string is empty (that is, if <<*>><[s]> does not start
If the subject string is empty (that is, if <<*>><[s]> does not start
with a substring in acceptable form), no conversion
with a substring in acceptable form), no conversion
is performed and the value of <[s]> is stored in <[ptr]> (if <[ptr]> is
is performed and the value of <[s]> is stored in <[ptr]> (if <[ptr]> is
not <<NULL>>).
not <<NULL>>).
 
 
The alternate function <<_strtoull_r>> is a reentrant version.  The
The alternate function <<_strtoull_r>> is a reentrant version.  The
extra argument <[reent]> is a pointer to a reentrancy structure.
extra argument <[reent]> is a pointer to a reentrancy structure.
 
 
 
 
RETURNS
RETURNS
<<strtoull>> returns the converted value, if any. If no conversion was
<<strtoull>> returns the converted value, if any. If no conversion was
made, <<0>> is returned.
made, <<0>> is returned.
 
 
<<strtoull>> returns <<ULONG_LONG_MAX>> if the magnitude of the converted
<<strtoull>> returns <<ULONG_LONG_MAX>> if the magnitude of the converted
value is too large, and sets <<errno>> to <<ERANGE>>.
value is too large, and sets <<errno>> to <<ERANGE>>.
 
 
PORTABILITY
PORTABILITY
<<strtoull>> is ANSI.
<<strtoull>> is ANSI.
 
 
<<strtoull>> requires no supporting OS subroutines.
<<strtoull>> requires no supporting OS subroutines.
*/
*/
 
 
/*
/*
 * Copyright (c) 1990 Regents of the University of California.
 * Copyright (c) 1990 Regents of the University of California.
 * All rights reserved.
 * All rights reserved.
 *
 *
 * Redistribution and use in source and binary forms, with or without
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * modification, are permitted provided that the following conditions
 * are met:
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *    must display the following acknowledgement:
 *      This product includes software developed by the University of
 *      This product includes software developed by the University of
 *      California, Berkeley and its contributors.
 *      California, Berkeley and its contributors.
 * 4. Neither the name of the University nor the names of its contributors
 * 4. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *    without specific prior written permission.
 *
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * SUCH DAMAGE.
 */
 */
 
 
#include <_ansi.h>
#include <_ansi.h>
#include <limits.h>
#include <limits.h>
#include <ctype.h>
#include <ctype.h>
#include <errno.h>
#include <errno.h>
#include <stdlib.h>
#include <stdlib.h>
#include <reent.h>
#include <reent.h>
 
 
#ifndef _REENT_ONLY
#ifndef _REENT_ONLY
 
 
unsigned long long
unsigned long long
_DEFUN (strtoull, (s, ptr, base),
_DEFUN (strtoull, (s, ptr, base),
        _CONST char *s _AND
        _CONST char *s _AND
        char **ptr _AND
        char **ptr _AND
        int base)
        int base)
{
{
        return _strtoull_r (_REENT, s, ptr, base);
        return _strtoull_r (_REENT, s, ptr, base);
}
}
 
 
#endif
#endif
 
 

powered by: WebSVN 2.1.0

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