From kido@vnet.IBM.COM Mon Mar 15 04:24:21 1993
Received: from vnet.IBM.COM ([192.239.48.4]) by dkuug.dk with SMTP id AA00181
(5.65c8/IDA-1.4.4j); Mon, 15 Mar 1993 03:06:02 +0100
Message-Id: <199303150206.AA00181@dkuug.dk>
Received: from YMTVM8 by vnet.IBM.COM (IBM VM SMTP V2R2) with BSMTP id 4030;
Sun, 14 Mar 93 21:05:22 EST
Date: Mon, 15 Mar 93 11:05:29 JST
From: "Akio Kido"
To: sc22wg15@dkuug.dk, sc22wg20@dkuug.dk, XoJIG@xopen.co.uk,
sig-international@osf.org, uojlg-bse@uiap.ui.org,
efischer@donald.aix.kingston.ibm.com
Subject: MSE 4.5.4.1.mm
X-Charset: ASCII
X-Char-Esc: 29
.SK
.H 3 "General wide string utilities"
.P
The header
.Cf
declares a number of functions useful
for wide string manipulation.
Various methods are used for determining the lengths of the arrays,
but in all cases a
.Cf wchar_t
.Cf *
argument points to the initial
(lowest addressed)
element of the array.
If an array is accessed beyond the end of an object,
the behavior is undefined.
.H 4 "Wide string numeric conversion functions"
.H 5 "The \*(Cwwcstod\fP function"
.HU Synopsis
.Cb
#include
double wcstod(const wchar_t *nptr, wchar_t **endptr);
.Ce
.HU Description
.P
The
.Cf wcstod
function converts the initial portion of the wide string pointed to by
.Cf nptr
to
.Cf double
representation.
First,
it decomposes the input string into three parts:
an initial,
possibly empty,
sequence of white-space wide characters
(as specified by the
.Cf iswspace
function),
a subject sequence resembling a floating-point constant;
and a final wide string of one or more unrecognized wide characters,
including the terminating null wide character of the input wide string.
Then,
it attempts to convert the subject sequence to a floating-point number,
and returns the result.
.P
The expected form of the subject sequence is
an optional plus or minus sign,
then a nonempty sequence of digits
optionally containing a decimal-point wide character,
then an optional exponent part as defined in \*(AC subclause 6.1.3.1,
but no floating suffix.
The subject sequence is defined as the longest initial subsequence
of the input wide string,
starting with the first non-white-space wide character,
that is of the expected form.
The subject sequence contains no wide characters if the
input wide string is empty or consists entirely of white space,
or if the first non-white-space wide character is
other than a sign,
a digit,
or a decimal-point wide character.
.P
If the subject sequence has the expected form,
the sequence of wide characters
starting with the first digit or the decimal-point wide character
(whichever occurs first)
is interpreted as a floating constant
according to the rules of \*(AC subclause 6.1.3.1,
except that the decimal-point wide character is used in place of a period,
and that if neither an exponent part nor a decimal-point wide character appears,
a decimal point is assumed to follow the last digit in the wide string.
If the subject sequence begins with a minus sign,
the value resulting from the conversion is negated.
A pointer to the final wide string is
stored in the object pointed to by
.Cf endptr ,
provided that
.Cf endptr
is not a null pointer.
.P
Additional implementation-defined subject sequences
may be accepted.
.P
If the subject sequence is empty or does not have the expected form,
no conversion is performed;
the value of
.Cf nptr
is stored in the object pointed to by
.Cf endptr ,
provided that
.Cf endptr
is not a null pointer.
.HU Returns
.P
The
.Cf wcstod
function returns the converted value,
if any.
If no conversion could be performed,
zero is returned.
If the correct value is outside the range of representable values,
plus or minus
.Cf HUGE_VAL
is returned
(according to the sign of the value),
and the value of the macro
.Cf ERANGE
is stored in
.Cf errno .
If the correct value would cause underflow,
zero is returned and the value of the macro
.Cf ERANGE
is stored in
.Cf errno .
.H 5 "The \*(Cwwcstol\fP function"
.HU Synopsis
.Cb
#include
long int wcstol(const wchar_t *nptr, wchar_t **endptr, int base);
.Ce
.HU Description
.P
The
.Cf wcstol
function converts the initial portion of the wide string pointed to by
.Cf nptr
to
.Cf long
.Cf int
representation.
First,
it decomposes the input string into three parts:
an initial,
possibly empty,
sequence of white-space wide characters
(as specified by the
.Cf iswspace
function),
a subject sequence resembling an
integer represented in some radix determined by the value of
.Cf base ,
and a final wide string of one or more unrecognized wide characters,
including the terminating null wide character of the input wide string.
Then,
it attempts to convert the subject sequence to an integer,
and returns the result.
.P
If the value of
.Cf base
is zero,
the expected form of the subject sequence is that of an integer
constant as described in \*(AC subclause 6.1.3.2,
optionally preceded by a plus or minus sign,
but not including an integer suffix.
If the value of
.Cf base
is between 2 and 36 (inclusive),
the expected form of the subject sequence
is a sequence of letters and digits representing an integer
with the radix specified by
.Cf base ,
optionally preceded by a plus or minus sign,
but not including an integer suffix.
The letters from
.Cf a
(or
.Cf A )
through
.Cf z
(or
.Cf Z )
are ascribed the values 10 through 35;
only letters whose ascribed values are less than that of
.Cf base
are permitted.
If the value of
.Cf base
is 16, the wide characters
.Cf 0x
or
.Cf 0X
may optionally precede the sequence of letters and digits,
following the sign if present.
.P
The subject sequence is defined as the longest initial subsequence
of the input wide string,
starting with the first non-white-space wide character,
that is of the expected form.
The subject sequence contains no wide characters
if the input wide string is empty
or consists entirely of white space,
or if the first non-white-space wide character is other than a sign
or a permissible letter or digit.
.P
If the subject sequence has the expected form and the value of
.Cf base
is zero,
the sequence of wide characters starting with the first digit
is interpreted as an integer constant
according to the rules of \*(AC subclause 6.1.3.2.
If the subject sequence has the expected form and the value of
.Cf base
is between 2 and 36,
it is used as the base for conversion,
ascribing to each letter its value as given above.
If the subject sequence begins with a minus sign,
the value resulting from the conversion is negated.
A pointer to the final wide string is
stored in the object pointed to by
.Cf endptr ,
provided that
.Cf endptr
is not a null pointer.
.P
Additional implementation-defined subject sequences
may be accepted.
.P
If the subject sequence is empty or does not have the expected form,
no conversion is performed;
the value of
.Cf nptr
is stored in the object pointed to by
.Cf endptr ,
provided that
.Cf endptr
is not a null pointer.
.HU Returns
.P
The
.Cf wcstol
function returns the converted value,
if any.
If no conversion could be performed,
zero is returned.
If the correct value is outside the range of representable values,
.Cf LONG_MAX
or
.Cf LONG_MIN
is returned
(according to the sign of the value),
and the value of the macro
.Cf ERANGE
is stored in
.Cf errno .
.H 5 "The \*(Cwwcstoul\fP function"
.HU Synopsis
.Cb
#include
unsigned long int wcstoul(const wchar_t *nptr, wchar_t **endptr,
int base);
.Ce
.HU Description
.P
The
.Cf wcstoul
function converts the initial portion of the wide string pointed to by
.Cf nptr
to
.Cf unsigned
.Cf long
.Cf int
representation.
First,
it decomposes the input string into three parts:
an initial,
possibly empty,
sequence of white-space wide characters
(as specified by the
.Cf iswspace
function),
a subject sequence resembling an unsigned
integer represented in some radix determined by the value of
.Cf base ,
and a final wide string of one or more unrecognized wide characters,
including the terminating null wide character of the input wide string.
Then,
it attempts to convert the subject sequence to an unsigned integer,
and returns the result.
.P
If the value of
.Cf base
is zero,
the expected form of the subject sequence is that of an integer
constant as described in \*(AC subclause 6.1.3.2,
optionally preceded by a plus or minus sign,
but not including an integer suffix.
If the value of
.Cf base
is between 2 and 36 (inclusive),
the expected form of the subject sequence
is a sequence of letters and digits representing an integer
with the radix specified by
.Cf base ,
optionally preceded by a plus or minus sign,
but not including an integer suffix.
The letters from
.Cf a
(or
.Cf A )
through
.Cf z
(or
.Cf Z )
are ascribed the values 10 through 35;
only letters whose ascribed values are less than that of
.Cf base
are permitted.
If the value of
.Cf base
is 16, the wide characters
.Cf 0x
or
.Cf 0X
may optionally precede the sequence of letters and digits,
following the sign if present.
.P
The subject sequence is defined as the longest initial subsequence
of the input wide string,
starting with the first non-white-space wide character,
that is of the expected form.
The subject sequence contains no wide characters
if the input wide string is empty
or consists entirely of white space,
or if the first non-white-space wide character is other than a sign
or a permissible letter or digit.
.P
If the subject sequence has the expected form and the value of
.Cf base
is zero,
the sequence of wide characters starting with the first digit
is interpreted as an integer constant
according to the rules of \*(AC subcaluse 6.1.3.2.
If the subject sequence has the expected form and the value of
.Cf base
is between 2 and 36,
it is used as the base for conversion,
ascribing to each letter its value as given above.
If the subject sequence begins with a minus sign,
the value resulting from the conversion is negated.
A pointer to the final wide string is
stored in the object pointed to by
.Cf endptr ,
provided that
.Cf endptr
is not a null pointer.
.P
Additional implementation-defined subject sequences
may be accepted.
.P
If the subject sequence is empty or does not have the expected form,
no conversion is performed;
the value of
.Cf nptr
is stored in the object pointed to by
.Cf endptr ,
provided that
.Cf endptr
is not a null pointer.
.HU Returns
.P
The
.Cf wcstoul
function returns the converted value,
if any.
If no conversion could be performed,
zero is returned.
If the correct value is outside the range of representable values,
.Cf ULONG_MAX
is returned,
and the value of the macro
.Cf ERANGE
is stored in
.Cf errno .