1999-01-11  Ulrich Drepper  <drepper@cygnus.com>

	* ctype/Versions [GLIBC_2.0]: Export __ctype32_b.
	* include/wctype.h: Declare __iswctype.
	* stdio-common/vfscanf.c (__vfscanf): Use __iswspace instead of
	iswspace.
	* wctype/Makefile (routines): Add wcextra_l.
	* wctype/wcextra.c (iswblank): Implement function here and don't use
	__iswctype.
	(__iswblank_l):  Move definition to...
	* wctype/wcextra_l.c: ...here.  New file.
	* wctype/wcfuncs.c: Really implement functions and don't call
	__iswctype or __towctrans.
	* wctype/wctype.h: Change isw* and tow* macros.  Don't call
	__iswctype or __towctrans.  Instead optimize constant argument case.

	* iconv/gconv.h: Fix typos.

	* iconv/skeleton.c: Fix typos.  Optimize init function a bit.
	Correctly emit escape sequence to return to initial state in
	conversion function.

	* iconvdata/iso-2022-jp.c (gconv_init): Correctly initialize
	max_needed_to element.

	* manual/mbyte.texi: Removed.  This is now described in charset.texi.
	* manual/charset.texi: New file.
	* manual/Makefile (chapters): Replace mbyte by charset.
	* manual/ctype.texi: Document wide character functions.
	* manual/intro.texi: Fix reference to mbyte chapter.
	* manual/lang.texi: Likewise.
	* manual/locale.texi: Likewise.
	* manual/stdio.texi: Likewise.
	* manual/string.texi: Fix @node line for new charset chapter.
	* manual/libc.texinfo (UPDATED): Updated.  Also update copyright years.
	* manual/memory.texi (savestring): Optimize code to give a good
	example.

	* manual/filesys.texi: Fix wording.  Patches by Jim Meyering.

	* nscd/nscd_getgr_r.c: Include stdint.h to get uintptr_t definition.
	* nscd/nscd_getpw_r.c: Likewise.
	* nscd/nscd_gethst_r.c: Likewise.

	* stdlib/stdtold_l.c: Always include xlocale.h.

1999-01-11  Geoffrey Keating  <geoffk@ozemail.com.au>

	* stdlib/fpioconst.h (LDBL_MAX_10_EXP_LOG): Define to be same as
	DBL_MAX_10_EXP_LOG if there is no long double.
	(_fpioconst_pow10): Always use size as LDBL_MAX_10_EXP_LOG to match
	printf_fp.c.

1999-01-10  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* timezone/Makefile ($(testdata)/GB): Changed to ...
	($(testdata)/Europe/London): ... for tst-timezone test.
	($(objpfx)tst-timezone.out): Change GB to Europe/London.

	* timezone/tst-timezone.c (main): Enable DST switching test,
	change GB to Europe/London.

1999-01-10  Philip Blundell  <philb@gnu.org>

	* socket/Makefile (headers): Remove bits/sockunion.h.

1999-01-09  Philip Blundell  <philb@gnu.org>

	* socket/sys/socket.h: Don't include <bits/sockunion.h>.
	* sysdeps/generic/bits/sockunion.h: Deleted.
	* sysdeps/unix/sysv/linux/bits/sockunion.h: Likewise.

1999-01-08  H.J. Lu  <hjl@gnu.org>

	* io/fts.c (fts_close): Don't access memory after having it freed.
This commit is contained in:
Ulrich Drepper 1999-01-11 20:13:43 +00:00
parent 68ef28edc2
commit 390955cbde
37 changed files with 3716 additions and 243 deletions

View file

@ -1,3 +1,79 @@
1999-01-11 Ulrich Drepper <drepper@cygnus.com>
* ctype/Versions [GLIBC_2.0]: Export __ctype32_b.
* include/wctype.h: Declare __iswctype.
* stdio-common/vfscanf.c (__vfscanf): Use __iswspace instead of
iswspace.
* wctype/Makefile (routines): Add wcextra_l.
* wctype/wcextra.c (iswblank): Implement function here and don't use
__iswctype.
(__iswblank_l): Move definition to...
* wctype/wcextra_l.c: ...here. New file.
* wctype/wcfuncs.c: Really implement functions and don't call
__iswctype or __towctrans.
* wctype/wctype.h: Change isw* and tow* macros. Don't call
__iswctype or __towctrans. Instead optimize constant argument case.
* iconv/gconv.h: Fix typos.
* iconv/skeleton.c: Fix typos. Optimize init function a bit.
Correctly emit escape sequence to return to initial state in
conversion function.
* iconvdata/iso-2022-jp.c (gconv_init): Correctly initialize
max_needed_to element.
* manual/mbyte.texi: Removed. This is now described in charset.texi.
* manual/charset.texi: New file.
* manual/Makefile (chapters): Replace mbyte by charset.
* manual/ctype.texi: Document wide character functions.
* manual/intro.texi: Fix reference to mbyte chapter.
* manual/lang.texi: Likewise.
* manual/locale.texi: Likewise.
* manual/stdio.texi: Likewise.
* manual/string.texi: Fix @node line for new charset chapter.
* manual/libc.texinfo (UPDATED): Updated. Also update copyright years.
* manual/memory.texi (savestring): Optimize code to give a good
example.
* manual/filesys.texi: Fix wording. Patches by Jim Meyering.
* nscd/nscd_getgr_r.c: Include stdint.h to get uintptr_t definition.
* nscd/nscd_getpw_r.c: Likewise.
* nscd/nscd_gethst_r.c: Likewise.
* stdlib/stdtold_l.c: Always include xlocale.h.
1999-01-11 Geoffrey Keating <geoffk@ozemail.com.au>
* stdlib/fpioconst.h (LDBL_MAX_10_EXP_LOG): Define to be same as
DBL_MAX_10_EXP_LOG if there is no long double.
(_fpioconst_pow10): Always use size as LDBL_MAX_10_EXP_LOG to match
printf_fp.c.
1999-01-10 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* timezone/Makefile ($(testdata)/GB): Changed to ...
($(testdata)/Europe/London): ... for tst-timezone test.
($(objpfx)tst-timezone.out): Change GB to Europe/London.
* timezone/tst-timezone.c (main): Enable DST switching test,
change GB to Europe/London.
1999-01-10 Philip Blundell <philb@gnu.org>
* socket/Makefile (headers): Remove bits/sockunion.h.
1999-01-09 Philip Blundell <philb@gnu.org>
* socket/sys/socket.h: Don't include <bits/sockunion.h>.
* sysdeps/generic/bits/sockunion.h: Deleted.
* sysdeps/unix/sysv/linux/bits/sockunion.h: Likewise.
1999-01-08 H.J. Lu <hjl@gnu.org>
* io/fts.c (fts_close): Don't access memory after having it freed.
1998-01-08 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
* manual/Makefile (stamp-summary): Remove space after -t option

View file

@ -1,7 +1,8 @@
libc {
GLIBC_2.0 {
# global variables
__ctype_b; __ctype_tolower; __ctype_toupper; _tolower; _toupper;
__ctype_b; __ctype32_b; __ctype_tolower; __ctype_toupper;
_tolower; _toupper;
# i*
isalnum; isalpha; isascii; isblank; iscntrl; isdigit; isgraph; islower;

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -69,7 +69,7 @@ typedef void (*gconv_end_fct) __PMT ((struct gconv_step *));
struct gconv_step
{
struct gconv_loaded_object *shlib_handle;
const char *modname;
__const char *modname;
int counter;
@ -104,7 +104,7 @@ struct gconv_step_data
int is_last;
/* Counter for number of invocations of the module function for this
desriptor. */
descriptor. */
int invocation_counter;
/* Flag whether this is an internal use of the module (in the mb*towc*

View file

@ -1,5 +1,5 @@
/* Skeleton for a conversion module.
Copyright (C) 1998 Free Software Foundation, Inc.
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@ -119,7 +119,7 @@ static int to_object;
character set we we can define RESET_INPUT_BUFFER is necessary. */
#if !defined RESET_INPUT_BUFFER && !defined SAVE_RESET_STATE
# if MIN_NEEDED_FROM == MAX_NEEDED_FROM && MIN_NEEDED_TO == MAX_NEEDED_TO
/* We have to used these `if's here since the compiler cannot know that
/* We have to use these `if's here since the compiler cannot know that
(outbuf - outerr) is always divisible by MIN_NEEDED_TO. */
# define RESET_INPUT_BUFFER \
if (MIN_NEEDED_FROM % MIN_NEEDED_TO == 0) \
@ -144,26 +144,25 @@ gconv_init (struct gconv_step *step)
{
/* Determine which direction. */
if (__strcasecmp (step->from_name, CHARSET_NAME) == 0)
step->data = &from_object;
else if (__strcasecmp (step->to_name, CHARSET_NAME) == 0)
step->data = &to_object;
else
return GCONV_NOCONV;
if (step->data == &from_object)
{
step->data = &from_object;
step->min_needed_from = MIN_NEEDED_FROM;
step->max_needed_from = MAX_NEEDED_FROM;
step->min_needed_to = MIN_NEEDED_TO;
step->max_needed_to = MAX_NEEDED_TO;
}
else
else if (__strcasecmp (step->to_name, CHARSET_NAME) == 0)
{
step->data = &to_object;
step->min_needed_from = MIN_NEEDED_TO;
step->max_needed_from = MAX_NEEDED_TO;
step->min_needed_to = MIN_NEEDED_FROM;
step->max_needed_to = MAX_NEEDED_FROM;
}
else
return GCONV_NOCONV;
#ifdef RESET_STATE
step->stateful = 1;
@ -210,22 +209,17 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
dropped. */
if (do_flush)
{
/* Call the steps down the chain if there are any. */
if (data->is_last)
status = GCONV_OK;
else
{
status = GCONV_OK;
#ifdef EMIT_SHIFT_TO_INIT
status = GCONV_OK;
EMIT_SHIFT_TO_INIT;
if (status == GCONV_OK)
/* Emit the escape sequence to reset the state. */
EMIT_SHIFT_TO_INIT;
#endif
/* Give the modules below the same chance. */
status = DL_CALL_FCT (fct, (next_step, next_data, NULL, NULL,
written, 1));
}
/* Call the steps down the chain if there are any but only if we
successfully emitted the escape sequence. */
if (status == GCONV_OK && ! data->is_last)
status = DL_CALL_FCT (fct, (next_step, next_data, NULL, NULL,
written, 1));
}
else
{
@ -271,7 +265,7 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
data->statep, step->data, &converted
EXTRA_LOOP_ARGS);
/* If this is the last step leave the loop, there is nothgin
/* If this is the last step leave the loop, there is nothing
we can do. */
if (data->is_last)
{

View file

@ -1,5 +1,5 @@
/* Conversion module for ISO-2022-JP.
Copyright (C) 1998 Free Software Foundation, Inc.
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@ -149,14 +149,14 @@ gconv_init (struct gconv_step *step)
step->min_needed_from = MIN_NEEDED_FROM;
step->max_needed_from = MAX_NEEDED_FROM;
step->min_needed_to = MIN_NEEDED_TO;
step->max_needed_to = MIN_NEEDED_TO;
step->max_needed_to = MAX_NEEDED_TO;
}
else
{
step->min_needed_from = MIN_NEEDED_TO;
step->max_needed_from = MAX_NEEDED_TO;
step->min_needed_to = MIN_NEEDED_FROM;
step->max_needed_to = MIN_NEEDED_FROM + 2;
step->max_needed_to = MAX_NEEDED_FROM + 2;
}
/* Yes, this is a stateful encoding. */

View file

@ -1 +1,7 @@
#ifndef _WCTYPE_H
#include <wctype/wctype.h>
extern int __iswspace __P ((wint_t __wc));
#endif

View file

@ -231,6 +231,7 @@ fts_close(sp)
{
register FTSENT *freep, *p;
int saved_errno;
int retval = 0;
/*
* This still works if we haven't read anything -- the dummy structure
@ -259,15 +260,16 @@ fts_close(sp)
(void)__close(sp->fts_rfd);
}
/* Free up the stream pointer. */
free(sp);
/* Set errno and return. */
if (!ISSET(FTS_NOCHDIR) && saved_errno) {
__set_errno (saved_errno);
return (-1);
retval = -1;
}
return (0);
/* Free up the stream pointer. */
free (sp);
return retval;
}
/*

View file

@ -49,7 +49,7 @@ endif
mkinstalldirs = $(..)scripts/mkinstalldirs
chapters = $(addsuffix .texi, \
intro errno memory ctype string mbyte locale \
intro errno memory ctype string charset locale \
message search pattern io stdio llio filesys \
pipe socket terminal math arith time setjmp \
signal startup process job nss users sysinfo conf)
@ -74,7 +74,7 @@ libc.dvi: texinfo.tex
# Generate the summary from the Texinfo source files for each chapter.
summary.texi: stamp-summary ;
stamp-summary: summary.awk $(filter-out summary.texi, $(texis))
$(AWK) -f $^ | sort -t'^L' -df +0 -1 | tr '\014' '\012' > summary-tmp
$(AWK) -f $^ | sort -t' ' -df +0 -1 | tr '\014' '\012' > summary-tmp
$(move-if-change) summary-tmp summary.texi
touch $@

View file

@ -3,7 +3,7 @@
@include memory.texi
@include ctype.texi
@include string.texi
@include mbyte.texi
@include charset.texi
@include locale.texi
@include message.texi
@include search.texi
@ -27,6 +27,7 @@
@include users.texi
@include sysinfo.texi
@include conf.texi
@include ../crypt/crypt.texi
@include ../linuxthreads/linuxthreads.texi
@include lang.texi
@include header.texi

2846
manual/charset.texi Normal file

File diff suppressed because it is too large Load diff

View file

@ -15,11 +15,20 @@ are affected by the current locale. (More precisely, they are affected
by the locale currently selected for character classification---the
@code{LC_CTYPE} category; see @ref{Locale Categories}.)
@menu
* Classification of Characters:: Testing whether characters are
letters, digits, punctuation, etc.
The @w{ISO C} standard specifies two different sets of functions. The
one set works on @code{char} type characters, the other one on
@code{wchar_t} wide character (@pxref{Extended Char Intro}).
* Case Conversion:: Case mapping, and the like.
@menu
* Classification of Characters:: Testing whether characters are
letters, digits, punctuation, etc.
* Case Conversion:: Case mapping, and the like.
* Classification of Wide Characters:: Character class determination for
wide characters.
* Using Wide Char Classes:: Notes on using the wide character
classes.
* Wide Character Case Conversion:: Mapping of wide characters.
@end menu
@node Classification of Characters, Case Conversion, , Character Handling
@ -57,14 +66,16 @@ These functions are declared in the header file @file{ctype.h}.
@comment ctype.h
@comment ISO
@deftypefun int islower (int @var{c})
Returns true if @var{c} is a lower-case letter.
Returns true if @var{c} is a lower-case letter. The letter need not be
from the Latin alphabet, any alphabet representable is valid.
@end deftypefun
@cindex upper-case character
@comment ctype.h
@comment ISO
@deftypefun int isupper (int @var{c})
Returns true if @var{c} is an upper-case letter.
Returns true if @var{c} is an upper-case letter. The letter need not be
from the Latin alphabet, any alphabet representable is valid.
@end deftypefun
@cindex alphabetic character
@ -188,7 +199,7 @@ into the US/UK ASCII character set. This function is a BSD extension
and is also an SVID extension.
@end deftypefun
@node Case Conversion, , Classification of Characters, Character Handling
@node Case Conversion, Classification of Wide Characters, Classification of Characters, Character Handling
@section Case Conversion
@cindex character case conversion
@cindex case conversion of characters
@ -224,7 +235,7 @@ lower-case letter. If @var{c} is not an upper-case letter,
@comment ctype.h
@comment ISO
@deftypefun int toupper (int @var{c})
If @var{c} is a lower-case letter, @code{tolower} returns the corresponding
If @var{c} is a lower-case letter, @code{toupper} returns the corresponding
upper-case letter. Otherwise @var{c} is returned unchanged.
@end deftypefun
@ -249,3 +260,497 @@ with the SVID. @xref{SVID}.@refill
This is identical to @code{toupper}, and is provided for compatibility
with the SVID.
@end deftypefun
@node Classification of Wide Characters, Using Wide Char Classes, Case Conversion, Character Handling
@section Character class determination for wide characters
The second amendment to @w{ISO C89} defines functions to classify wide
character. Although the original @w{ISO C89} standard already defined
the type @code{wchar_t} but no functions operating on them were defined.
The general design of the classification functions for wide characters
is more general. It allows to extend the set of available
classification beyond the set which is always available. The POSIX
standard specifies a way how the extension can be done and this is
already implemented in the GNU C library implementation of the
@code{localedef} program.
The character class functions are normally implemented using bitsets.
I.e., for the character in question the appropriate bitset is read from
a table and a test is performed whether a certain bit is set in this
bitset. Which bit is tested for is determined by the class.
For the wide character classification functions this is made visible.
There is a type representing the classification, a function to retrieve
this value for a specific class, and a function to test using the
classification value whether a given character is in this class. On top
of this the normal character classification functions as used for
@code{char} objects can be defined.
@comment wctype.h
@comment ISO
@deftp {Data type} wctype_t
The @code{wctype_t} can hold a value which represents a character class.
The ony defined way to generate such a value is by using the
@code{wctype} function.
@pindex wctype.h
This type is defined in @file{wctype.h}.
@end deftp
@comment wctype.h
@comment ISO
@deftypefun wctype_t wctype (const char *@var{property})
The @code{wctype} returns a value representing a class of wide
characters which is identified by the string @var{property}. Beside
some standard properties each locale can define its own ones. In case
no property with the given name is known for the current locale for the
@code{LC_CTYPE} category the function returns zero.
@noindent
The properties known in every locale are:
@multitable @columnfractions .25 .25 .25 .25
@item
@code{"alnum"} @tab @code{"alpha"} @tab @code{"cntrl"} @tab @code{"digit"}
@item
@code{"graph"} @tab @code{"lower"} @tab @code{"print"} @tab @code{"punct"}
@item
@code{"space"} @tab @code{"upper"} @tab @code{"xdigit"}
@end multitable
@pindex wctype.h
This function is declared in @file{wctype.h}.
@end deftypefun
To test the membership of a character to one of the non-standard classes
the @w{ISO C} standard defines a completely new function.
@comment wctype.h
@comment ISO
@deftypefun int iswctype (wint_t @var{wc}, wctype_t @var{desc})
This function returns a nonzero value if @var{wc} is in the character
class specified by @var{desc}. @var{desc} must previously be returned
by a successful call to @code{wctype}.
@pindex wctype.h
This function is declared in @file{wctype.h}.
@end deftypefun
The make it easier to use the commonly used classification functions
they are defined in the C library. There is no need to use
@code{wctype} is the property string is one of the known character
classes. In some situations it is desirable to construct the property
string and then it gets important that @code{wctype} can also handle the
standard classes.
@cindex alphanumeric character
@comment wctype.h
@comment ISO
@deftypefun int iswalnum (wint_t @var{wc})
This function returns a nonzero value if @var{wc} is an alphanumeric
character (a letter or number); in other words, if either @code{iswalpha}
or @code{iswdigit} is true of a character, then @code{iswalnum} is also
true.
@noindent
This function can be implemented using
@smallexample
iswctype (wc, wctype ("alnum"))
@end smallexample
@pindex wctype.h
This function is declared in @file{wctype.h}.
@end deftypefun
@cindex alphabetic character
@comment wctype.h
@comment ISO
@deftypefun int iswalpha (wint_t @var{wc})
Returns true if @var{wc} is an alphabetic character (a letter). If
@code{iswlower} or @code{iswupper} is true of a character, then
@code{iswalpha} is also true.
In some locales, there may be additional characters for which
@code{iswalpha} is true---letters which are neither upper case nor lower
case. But in the standard @code{"C"} locale, there are no such
additional characters.
@noindent
This function can be implemented using
@smallexample
iswctype (wc, wctype ("alpha"))
@end smallexample
@pindex wctype.h
This function is declared in @file{wctype.h}.
@end deftypefun
@cindex control character
@comment wctype.h
@comment ISO
@deftypefun int iswcntrl (wint_t @var{wc})
Returns true if @var{wc} is a control character (that is, a character that
is not a printing character).
@noindent
This function can be implemented using
@smallexample
iswctype (wc, wctype ("cntrl"))
@end smallexample
@pindex wctype.h
This function is declared in @file{wctype.h}.
@end deftypefun
@cindex digit character
@comment wctype.h
@comment ISO
@deftypefun int iswdigit (wint_t @var{wc})
Returns true if @var{wc} is a digit (e.g., @samp{0} through @samp{9}).
Please note that this function does not only return a nonzero value for
@emph{decimal} digits, but for all kinds of digits. A consequence is
that code like the following will @strong{not} work unconditionally for
wide characters:
@smallexample
n = 0;
while (iswctype (*wc))
@{
n *= 10;
n += *wc++ - L'0';
@}
@end smallexample
@noindent
This function can be implemented using
@smallexample
iswctype (wc, wctype ("digit"))
@end smallexample
@pindex wctype.h
This function is declared in @file{wctype.h}.
@end deftypefun
@cindex graphic character
@comment wctype.h
@comment ISO
@deftypefun int iswgraph (wint_t @var{wc})
Returns true if @var{wc} is a graphic character; that is, a character
that has a glyph associated with it. The whitespace characters are not
considered graphic.
@noindent
This function can be implemented using
@smallexample
iswctype (wc, wctype ("graph"))
@end smallexample
@pindex wctype.h
This function is declared in @file{wctype.h}.
@end deftypefun
@cindex lower-case character
@comment ctype.h
@comment ISO
@deftypefun int iswlower (wint_t @var{wc})
Returns true if @var{wc} is a lower-case letter. The letter need not be
from the Latin alphabet, any alphabet representable is valid.
@noindent
This function can be implemented using
@smallexample
iswctype (wc, wctype ("lower"))
@end smallexample
@pindex wctype.h
This function is declared in @file{wctype.h}.
@end deftypefun
@cindex printing character
@comment wctype.h
@comment ISO
@deftypefun int iswprint (wint_t @var{wc})
Returns true if @var{wc} is a printing character. Printing characters
include all the graphic characters, plus the space (@samp{ }) character.
@noindent
This function can be implemented using
@smallexample
iswctype (wc, wctype ("print"))
@end smallexample
@pindex wctype.h
This function is declared in @file{wctype.h}.
@end deftypefun
@cindex punctuation character
@comment wctype.h
@comment ISO
@deftypefun int iswpunct (wint_t @var{wc})
Returns true if @var{wc} is a punctuation character.
This means any printing character that is not alphanumeric or a space
character.
@noindent
This function can be implemented using
@smallexample
iswctype (wc, wctype ("punct"))
@end smallexample
@pindex wctype.h
This function is declared in @file{wctype.h}.
@end deftypefun
@cindex whitespace character
@comment wctype.h
@comment ISO
@deftypefun int iswspace (wint_t @var{wc})
Returns true if @var{wc} is a @dfn{whitespace} character. In the standard
@code{"C"} locale, @code{iswspace} returns true for only the standard
whitespace characters:
@table @code
@item L' '
space
@item L'\f'
formfeed
@item L'\n'
newline
@item L'\r'
carriage return
@item L'\t'
horizontal tab
@item L'\v'
vertical tab
@end table
@noindent
This function can be implemented using
@smallexample
iswctype (wc, wctype ("space"))
@end smallexample
@pindex wctype.h
This function is declared in @file{wctype.h}.
@end deftypefun
@cindex upper-case character
@comment wctype.h
@comment ISO
@deftypefun int iswupper (wint_t @var{wc})
Returns true if @var{wc} is an upper-case letter. The letter need not be
from the Latin alphabet, any alphabet representable is valid.
@noindent
This function can be implemented using
@smallexample
iswctype (wc, wctype ("upper"))
@end smallexample
@pindex wctype.h
This function is declared in @file{wctype.h}.
@end deftypefun
@cindex hexadecimal digit character
@comment wctype.h
@comment ISO
@deftypefun int iswxdigit (wint_t @var{wc})
Returns true if @var{wc} is a hexadecimal digit.
Hexadecimal digits include the normal decimal digits @samp{0} through
@samp{9} and the letters @samp{A} through @samp{F} and
@samp{a} through @samp{f}.
@noindent
This function can be implemented using
@smallexample
iswctype (wc, wctype ("xdigit"))
@end smallexample
@pindex wctype.h
This function is declared in @file{wctype.h}.
@end deftypefun
The GNu C library provides also a function which is not defined in the
@w{ISO C} standard but which is available as a version for single byte
characters as well.
@cindex blank character
@comment wctype.h
@comment GNU
@deftypefun int iswblank (wint_t @var{wc})
Returns true if @var{wc} is a blank character; that is, a space or a tab.
This function is a GNU extension. It is declared in @file{wchar.h}.
@end deftypefun
@node Using Wide Char Classes, Wide Character Case Conversion, Classification of Wide Characters, Character Handling
@section Notes on using the wide character classes
The first note is probably nothing astonishing but still occasionally a
cause of problems. The @code{isw@var{XXX}} functions can be implemented
using macros and in fact, the GNU C library does this. They are still
available as real functions but when the @file{wctype.h} header is
included the macros will be used. This is nothing new compared to the
@code{char} type versions of these functions.
The second notes covers something which is new. It can be best
illustrated by a (real-world) example. The first piece of code is an
excerpt from the original code. It is truncated a bit but the intention
should be clear.
@smallexample
int
is_in_class (int c, const char *class)
@{
if (strcmp (class, "alnum") == 0)
return isalnum (c);
if (strcmp (class, "alpha") == 0)
return isalpha (c);
if (strcmp (class, "cntrl") == 0)
return iscntrl (c);
...
return 0;
@}
@end smallexample
Now with the @code{wctype} and @code{iswctype} one could avoid the
@code{if} cascades. But rewriting the code as follows is wrong:
@smallexample
int
is_in_class (int c, const char *class)
@{
wctype_t desc = wctype (class);
return desc ? iswctype ((wint_t) c, desc) : 0;
@}
@end smallexample
The problem is that it is not guarateed that the wide character
representation of a single-byte character can be found using casting.
In fact, usually this fails miserably. The correct solution for this
problem is to write the code as follows:
@smallexample
int
is_in_class (int c, const char *class)
@{
wctype_t desc = wctype (class);
return desc ? iswctype (btowc (c), desc) : 0;
@}
@end smallexample
See @xref{Converting a Character} for more information on @code{btowc}.
Please note that this change probably does not improve the performance
of the program a lot since the @code{wctype} function still has to make
the string comparisons. But it gets really interesting if the
@code{is_in_class} function would be called more than once using the
same class name. In this case the variable @var{desc} could be computed
once and reused for all the calls. Therefore the above form of the
function is probably not the final one.
@node Wide Character Case Conversion, , Using Wide Char Classes, Character Handling
@section Mapping of wide characters.
As for the classification functions the @w{ISO C} standard also
generalizes the mapping functions. Instead of only allowing the two
standard mappings the locale can contain others. Again, the
@code{localedef} program already supports generating such locale data
files.
@comment wctype.h
@comment ISO
@deftp {Data Type} wctrans_t
This data type is defined as a scalar type which can hold a value
representing the locale-dependent character mapping. There is no way to
construct such a value beside using the return value of the
@code{wctrans} function.
@pindex wctype.h
@noindent
This type is defined in @file{wctype.h}.
@end deftp
@comment wctype.h
@comment ISO
@deftypefun wctrans_t wctrans (const char *@var{property}
The @code{wctrans} function has to be used to find out whether a named
mapping is defined in the current locale selected for the
@code{LC_CTYPE} category. If the returned value is non-zero it can
afterwards be used in calls to @code{towctrans}. If the return value is
zero no such mapping is known in the current locale.
Beside locale-specific mappings there are two mappings which are
guaranteed to be available in every locale:
@multitable @columnfractions .5 .5
@item
@code{"tolower"} @tab @code{"toupper"}
@end multitable
@pindex wctype.h
@noindent
This function is declared in @file{wctype.h}.
@end deftypefun
@comment wctype.h
@comment ISO
@deftypefun wint_t towctrans (wint_t @var{wc}, wctrans_t @var{desc})
The @code{towctrans} function maps the input character @var{wc}
according to the rules of the mapping for which @var{desc} is an
descriptor and returns the so found value. The @var{desc} value must be
obtained by a successful call to @code{wctrans}.
@pindex wctype.h
@noindent
This function is declared in @file{wctype.h}.
@end deftypefun
The @w{ISO C} standard also defines for the generally available mappings
convenient shortcuts so that it is not necesary to call @code{wctrans}
for them.
@comment wctype.h
@comment ISO
@deftypefun wint_t towlower (wint_t @var{wc})
If @var{wc} is an upper-case letter, @code{towlower} returns the corresponding
lower-case letter. If @var{wc} is not an upper-case letter,
@var{wc} is returned unchanged.
@pindex wctype.h
@noindent
This function is declared in @file{wctype.h}.
@end deftypefun
@comment wctype.h
@comment ISO
@deftypefun wint_t towupper (wint_t @var{wc})
If @var{wc} is a lower-case letter, @code{towupper} returns the corresponding
upper-case letter. Otherwise @var{wc} is returned unchanged.
@pindex wctype.h
@noindent
This function is declared in @file{wctype.h}.
@end deftypefun
The same warnings given in the last section for the use of the wide
character classiffication function applies here. It is not possible to
simply cast a @code{char} type value to a @code{wint_t} and use it as an
argument for @code{towctrans} calls.

View file

@ -2696,8 +2696,8 @@ this file, you must remove the old file explicitly first.
If you need to use a temporary file in your program, you can use the
@code{tmpfile} function to open it. Or you can use the @code{tmpnam}
(better: @code{tmpnam_r}) function make a name for a temporary file and
then open it in the usual way with @code{fopen}.
(better: @code{tmpnam_r}) function to make a name for a temporary file and
then you can open it in the usual way with @code{fopen}.
The @code{tempnam} function is like @code{tmpnam} but lets you choose
what directory temporary files will go in, and something about what

View file

@ -652,7 +652,7 @@ and shell file name patterns, and for expanding words as the shell does.
and CPU time, as well as functions for setting alarms and timers.
@item
@ref{Extended Characters}, contains information about manipulating
@ref{Character Set Handling}, contains information about manipulating
characters and strings using character sets larger than will fit in
the usual @code{char} data type.

View file

@ -855,7 +855,7 @@ long long int} and @code{unsigned long long int}, respectively.
@item WCHAR_MAX
This is the maximum value that can be represented by a @code{wchar_t}.
@xref{Wide Char Intro}.
@xref{Extended Char Intro}.
@end vtable
The header file @file{limits.h} also defines some additional constants

View file

@ -19,7 +19,7 @@
@c sold 0.06/1.09, print run out 21may96
@set EDITION 0.08 DRAFT
@set VERSION 2.1 Beta
@set UPDATED 17 Dec 1998
@set UPDATED 11 Jan 1999
@set ISBN 1-882114-53-1
@ifinfo
@ -28,7 +28,7 @@ This file documents the GNU C library.
This is Edition @value{EDITION}, last updated @value{UPDATED},
of @cite{The GNU C Library Reference Manual}, for Version @value{VERSION}.
Copyright (C) 1993, '94, '95, '96, '97, '98 Free Software Foundation, Inc.
Copyright (C) 1993, '94, '95, '96, '97, '98, '99 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice

View file

@ -1,4 +1,4 @@
@node Locales, Message Translation, Extended Characters, Top
@node Locales, Message Translation, Character Set Handling, Top
@c %MENU% The country and language can affect the behavior of library functions
@chapter Locales and Internationalization
@ -42,7 +42,7 @@ following:
@itemize @bullet
@item
What multibyte character sequences are valid, and how they are
interpreted (@pxref{Extended Characters}).
interpreted (@pxref{Character Set Handling}).
@item
Classification of which characters in the local character set are
@ -140,7 +140,7 @@ and @code{strxfrm}); see @ref{Collation Functions}.
@item LC_CTYPE
This category applies to classification and conversion of characters,
and to multibyte and wide characters;
see @ref{Character Handling}, and @ref{Extended Characters}.
see @ref{Character Handling}, and @ref{Character Set Handling}.
@comment locale.h
@comment ISO

View file

@ -230,9 +230,8 @@ char *
savestring (const char *ptr, size_t len)
@{
register char *value = (char *) xmalloc (len + 1);
memcpy (value, ptr, len);
value[len] = '\0';
return value;
return (char *) memcpy (value, ptr, len);
@}
@end group
@end smallexample

View file

@ -929,10 +929,10 @@ This section provides details about the precise syntax of conversion
specifications that can appear in a @code{printf} template
string.
Characters in the template string that are not part of a
conversion specification are printed as-is to the output stream.
Multibyte character sequences (@pxref{Extended Characters}) are permitted in
a template string.
Characters in the template string that are not part of a conversion
specification are printed as-is to the output stream. Multibyte
character sequences (@pxref{Character Set Handling}) are permitted in a
template string.
The conversion specifications in a @code{printf} template string have
the general form:

View file

@ -1,4 +1,4 @@
@node String and Array Utilities, Extended Characters, Character Handling, Top
@node String and Array Utilities, Character Set Handling, Character Handling, Top
@c %MENU% Utilities for copying and comparing strings and arrays
@chapter String and Array Utilities

View file

@ -8,7 +8,7 @@ string.texi \
stpcpy.c.texi \
strdupa.c.texi \
strncat.c.texi \
mbyte.texi \
charset.texi \
locale.texi \
message.texi \
search.texi \

View file

@ -6,7 +6,7 @@
* Character Handling:: Character testing and conversion functions.
* String and Array Utilities:: Utilities for copying and comparing strings
and arrays.
* Extended Characters:: Support for extended character sets.
* Character Set Handling:: Support for extended character sets.
* Locales:: The country and language can affect the
behavior of library functions.
* Message Translation:: How to make the program speak the user's
@ -15,7 +15,7 @@
* Pattern Matching:: Matching shell ``globs'' and regular
expressions.
* I/O Overview:: Introduction to the I/O facilities.
* I/O on Streams:: Hign-level, portable I/O facilities.
* I/O on Streams:: High-level, portable I/O facilities.
* Low-Level I/O:: Low-level, less portable I/O.
* File System Interface:: Functions for manipulating files.
* Pipes and FIFOs:: A simple interprocess communication
@ -45,6 +45,7 @@
Add-ons
* Cryptographic Functions:: DES encryption and password handling.
* POSIX Threads:: The standard threads library.
Appendices
@ -176,10 +177,15 @@ Variable Size Automatic
Character Handling
* Classification of Characters:: Testing whether characters are
letters, digits, punctuation, etc.
* Classification of Characters:: Testing whether characters are
letters, digits, punctuation, etc.
* Case Conversion:: Case mapping, and the like.
* Case Conversion:: Case mapping, and the like.
* Classification of Wide Characters:: Character class determination for
wide characters.
* Using Wide Char Classes:: Notes on using the wide character
classes.
* Wide Character Case Conversion:: Mapping of wide characters.
String and Array Utilities
@ -203,19 +209,40 @@ Argz and Envz Vectors
* Argz Functions:: Operations on argz vectors.
* Envz Functions:: Additional operations on environment vectors.
Extended Characters
Character Set Handling
* Extended Char Intro:: Multibyte codes versus wide characters.
* Locales and Extended Chars:: The locale selects the character codes.
* Multibyte Char Intro:: How multibyte codes are represented.
* Wide Char Intro:: How wide characters are represented.
* Wide String Conversion:: Converting wide strings to multibyte code
and vice versa.
* Length of Char:: how many bytes make up one multibyte char.
* Converting One Char:: Converting a string character by character.
* Example of Conversion:: Example showing why converting
one character at a time may be useful.
* Shift State:: Multibyte codes with "shift characters".
* Extended Char Intro:: Introduction to Extended Characters.
* Charset Function Overview:: Overview about Character Handling
Functions.
* Restartable multibyte conversion:: Restartable multibyte conversion
Functions.
* Non-reentrant Conversion:: Non-reentrant Conversion Function.
* Generic Charset Conversion:: Generic Charset Conversion.
Restartable multibyte conversion
* Selecting the Conversion:: Selecting the conversion and its properties.
* Keeping the state:: Representing the state of the conversion.
* Converting a Character:: Converting Single Characters.
* Converting Strings:: Converting Multibyte and Wide Character
Strings.
* Multibyte Conversion Example:: A Complete Multibyte Conversion Example.
Non-reentrant Conversion
* Non-reentrant Character Conversion:: Non-reentrant Conversion of Single
Characters.
* Non-reentrant String Conversion:: Non-reentrant Conversion of Strings.
* Shift State:: States in Non-reentrant Functions.
Generic Charset Conversion
* Generic Conversion Interface:: Generic Character Set Conversion Interface.
* iconv Examples:: A complete @code{iconv} example.
* Other iconv Implementations:: Some Details about other @code{iconv}
Implementations.
* glibc iconv Implementation:: The @code{iconv} Implementation in the GNU C
library.
Locales
@ -751,6 +778,8 @@ Date and Time
* Processor Time:: Measures processor time used by a program.
* Calendar Time:: Manipulation of ``real'' dates and times.
* Precision Time:: Manipulation and monitoring of high accuracy
time.
* Setting an Alarm:: Sending a signal after a specified time.
* Sleeping:: Waiting for a period of time.
* Resource Usage:: Measuring various resources used.
@ -1094,6 +1123,13 @@ Sysconf
* Examples of Sysconf:: How to use @code{sysconf} and the parameter
macros properly together.
Cryptographic Functions
* Legal Problems:: This software can get you locked up, or worse.
* getpass:: Prompting the user for a password.
* crypt:: A one-way function for UNIX passwords.
* DES Encryption:: Routines for DES encryption.
POSIX Threads
* Basic Thread Operations:: Creating, terminating, and waiting for threads.

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1998 Free Software Foundation, Inc.
/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1998.
@ -19,6 +19,7 @@
#include <errno.h>
#include <grp.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1998 Free Software Foundation, Inc.
/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@ -20,6 +20,7 @@
#include <errno.h>
#include <netdb.h>
#include <resolv.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1998 Free Software Foundation, Inc.
/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1998.
@ -19,6 +19,7 @@
#include <errno.h>
#include <pwd.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View file

@ -1,4 +1,4 @@
# Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
# Copyright (C) 1991, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@ -21,8 +21,7 @@
#
subdir := socket
headers := sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h \
bits/sockunion.h
headers := sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h
routines := accept bind connect getpeername getsockname getsockopt \
listen recv recvfrom recvmsg send sendmsg sendto \

View file

@ -1,5 +1,5 @@
/* Declarations of socket constants, types, and functions.
Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -33,9 +33,6 @@ __BEGIN_DECLS
`struct msghdr', and `struct linger' types. */
#include <bits/socket.h>
/* Get the definition of `sockaddr_union'. */
#include <bits/sockunion.h>
#ifdef __USE_BSD
/* This is the 4.3 BSD `struct sockaddr' format, which is used as wire
format in the grotty old 4.3 `talk' protocol. */

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1991,92,93,94,95,96,97,98 Free Software Foundation, Inc.
/* Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -772,7 +772,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
size_t cnt = 0;
NEXT_WIDE_CHAR (first);
if (iswspace (val))
if (__iswspace (val))
{
/* XXX We would have to push back the whole wide char
with possibly many bytes. But since scanf does

View file

@ -1,5 +1,5 @@
/* Header file for constants used in floating point <-> decimal conversions.
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -33,7 +33,11 @@
XXX These should be defined in <float.h>. For the time being, we have the
IEEE754 values here. */
#define LDBL_MAX_10_EXP_LOG 12 /* = floor(log_2(LDBL_MAX_10_EXP)) */
#ifndef __NO_LONG_DOUBLE_MATH
# define LDBL_MAX_10_EXP_LOG 12 /* = floor(log_2(LDBL_MAX_10_EXP)) */
#else
# define LDBL_MAX_10_EXP_LOG 8 /* = floor(log_2(LDBL_MAX_10_EXP)) */
#endif
#define DBL_MAX_10_EXP_LOG 8 /* = floor(log_2(DBL_MAX_10_EXP)) */
#define FLT_MAX_10_EXP_LOG 5 /* = floor(log_2(FLT_MAX_10_EXP)) */
@ -47,11 +51,7 @@ struct mp_power
int p_expo; /* Exponent of the number 10^(2^i). */
int m_expo; /* Exponent of the number 10^-(2^i-1). */
};
#ifndef __NO_LONG_DOUBLE_MATH
extern const struct mp_power _fpioconst_pow10[LDBL_MAX_10_EXP_LOG + 1];
#else
extern const struct mp_power _fpioconst_pow10[DBL_MAX_10_EXP_LOG + 1];
#endif
/* The constants in the array `_fpioconst_pow10' have an offset. */
#if BITS_PER_MP_LIMB == 32

View file

@ -1,5 +1,5 @@
/* Convert string representing a number to float value, using given locale.
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -19,10 +19,10 @@
Boston, MA 02111-1307, USA. */
#include <math.h>
#include <xlocale.h>
#ifndef __NO_LONG_DOUBLE_MATH
#include <xlocale.h>
#define USE_IN_EXTENDED_LOCALE_MODEL 1
extern long double ____strtold_l_internal (const char *, char **, int,

View file

@ -1,48 +0,0 @@
/* Definition of `sockaddr_union'. Linux version.
Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _SYS_SOCKET_H
# error "Never include <bits/sockunion.h> directly; use <sys/socket.h> instead."
#endif
#include <netash/ash.h>
#include <netatalk/at.h>
#include <netax25/ax25.h>
#include <neteconet/ec.h>
#include <netinet/in.h>
#include <netipx/ipx.h>
#include <netrose/rose.h>
#include <sys/un.h>
/* Union of all sockaddr types (required by IPv6 Basic API). This is
somewhat evil. */
union sockaddr_union
{
struct sockaddr sa;
struct sockaddr_ash sash;
struct sockaddr_at sat;
struct sockaddr_ax25 sax25;
struct sockaddr_ec sec;
struct sockaddr_in sin;
struct sockaddr_in6 sin6;
struct sockaddr_ipx sipx;
struct sockaddr_rose rose;
struct sockaddr_un sun;
char __maxsize[128];
};

View file

@ -1,4 +1,4 @@
# Copyright (C) 1998 Free Software Foundation, Inc.
# Copyright (C) 1998, 1999 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@ -180,7 +180,8 @@ $(objpfx)test-tz.out: $(addprefix $(testdata)/, America/New_York Etc/UTC UTC)
$(objpfx)tst-timezone.out: $(addprefix $(testdata)/, \
Europe/Berlin Universal \
Australia/Melbourne \
America/Sao_Paulo Asia/Tokyo GB)
America/Sao_Paulo Asia/Tokyo \
Europe/London)
test-tz-ENV = TZDIR=$(testdata)
tst-timezone-ENV = TZDIR=$(testdata)
@ -206,7 +207,7 @@ $(testdata)/America/Sao_Paulo: southamerica $(objpfx)zic $(leapseconds) \
$(build-testdata)
$(testdata)/Asia/Tokyo: asia $(objpfx)zic $(leapseconds) yearistype
$(build-testdata)
$(testdata)/GB: europe $(objpfx)zic $(leapseconds) yearistype
$(testdata)/Europe/London: europe $(objpfx)zic $(leapseconds) yearistype
$(build-testdata)

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1998 Free Software Foundation, Inc.
/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1998.
@ -114,13 +114,12 @@ main (int argc, char ** argv)
check_tzvars (pt->name, pt->daylight, pt->timezone, pt->tzname);
}
#if 0
/* From a port of Scott Harrington <seh4@ix.netcom.com> to the timezone
/* From a post of Scott Harrington <seh4@ix.netcom.com> to the timezone
mailing list. */
{
struct tm tmBuf = {0, 0, 0, 10, 3, 98, 0, 0, -1};
char buf[200];
putenv ("TZ=GB");
putenv ("TZ=Europe/London");
t = mktime (&tmBuf);
snprintf (buf, sizeof (buf), "TZ=%s %ld %d %d %d %d %d %d %d %d %d",
getenv ("TZ"), t,
@ -129,8 +128,8 @@ main (int argc, char ** argv)
tmBuf.tm_wday, tmBuf.tm_yday, tmBuf.tm_isdst);
fputs (buf, stdout);
puts (" should be");
puts ("TZ=GB 892162800 0 0 0 10 3 98 5 99 1");
failed |= strcmp (buf, "TZ=GB 892162800 0 0 0 10 3 98 5 99 1") != 0;
puts ("TZ=Europe/London 892162800 0 0 0 10 3 98 5 99 1");
failed |= strcmp (buf, "TZ=Europe/London 892162800 0 0 0 10 3 98 5 99 1") != 0;
}
printf("\n");
@ -150,7 +149,6 @@ main (int argc, char ** argv)
puts ("TZ=GMT 892166400 0 0 0 10 3 98 5 99 0");
failed |= strcmp (buf, "TZ=GMT 892166400 0 0 0 10 3 98 5 99 0") != 0;
}
#endif
return failed ? EXIT_FAILURE : EXIT_SUCCESS;
}

View file

@ -1,4 +1,4 @@
# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
# Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@ -24,7 +24,7 @@ subdir := wctype
headers := wctype.h
distribute := cname-lookup.h
routines := wcfuncs wctype iswctype wctrans towctrans wcextra \
wcfuncs_l iswctype_l towctrans_l wctype_l
wcfuncs_l iswctype_l towctrans_l wctype_l wcextra_l
tests := test_wctype

View file

@ -1,5 +1,5 @@
/* Additional non standardized wide character classification functions.
Copyright (C) 1997 Free Software Foundation, Inc.
Copyright (C) 1997, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -18,18 +18,20 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <stdint.h>
#define __NO_WCTYPE 1
#include <wctype.h>
int
iswblank (wint_t wc)
{
return __iswctype (wc, _ISwblank);
}
#include "cname-lookup.h"
int
(__iswblank_l) (wint_t wc, __locale_t locale)
(iswblank) (wint_t wc)
{
return __iswctype_l (wc, _ISwblank, locale);
size_t idx;
idx = cname_lookup (wc);
if (idx == ~((size_t) 0))
return 0;
return __ctype32_b[idx] & _ISwblank;
}

View file

@ -1,6 +1,7 @@
/* Definition of `sockaddr_union'. Generic/4.2 BSD version.
Copyright (C) 1998 Free Software Foundation, Inc.
/* Additional non standardized wide character classification functions.
Copyright (C) 1997, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@ -17,24 +18,26 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/*
* Never include this file directly; use <sys/socket.h> instead.
*/
#include <stdint.h>
#define __NO_WCTYPE 1
#include <wctype.h>
#ifndef _BITS_SOCKUNION_H
#define _BITS_SOCKUNION_H 1
#define USE_IN_EXTENDED_LOCALE_MODEL 1
#include "cname-lookup.h"
#include <netinet/in.h>
#include <sys/un.h>
/* Union of all sockaddr types (required by IPv6 Basic API). */
union sockaddr_union
{
struct sockaddr sa;
struct sockaddr_in sin;
struct sockaddr_in6 sin6;
struct sockaddr_un sun;
char __maxsize[128];
};
int
(__iswblank_l) (wint_t wc, __locale_t locale)
{
const unsigned int *class32_b;
size_t idx;
#endif /* bits/sockunion.h */
idx = cname_lookup (wc, locale);
if (idx == ~((size_t) 0))
return 0;
class32_b = (uint32_t *)
locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS32)].string;
return class32_b[idx] & _ISwblank;
}

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -20,33 +20,71 @@
#include <wctype.h>
#include <ctype.h> /* For __ctype_tolower and __ctype_toupper. */
#include "cname-lookup.h"
/* Provide real-function versions of all the wctype macros. */
#define func(name, type) \
int name (wc) wint_t wc; { return __iswctype (wc, type); }
int \
__##name (wint_t wc) \
{ \
size_t idx; \
\
idx = cname_lookup (wc); \
if (idx == ~((size_t) 0)) \
return 0; \
\
return __ctype32_b[idx] & type; \
} \
weak_alias (__##name, name)
#undef iswalnum
func (iswalnum, _ISwalnum)
#undef iswalpha
func (iswalpha, _ISwalpha)
#undef iswcntrl
func (iswcntrl, _ISwcntrl)
#undef iswdigit
func (iswdigit, _ISwdigit)
#undef iswlower
func (iswlower, _ISwlower)
#undef iswgraph
func (iswgraph, _ISwgraph)
#undef iswprint
func (iswprint, _ISwprint)
#undef iswpunct
func (iswpunct, _ISwpunct)
#undef iswspace
func (iswspace, _ISwspace)
#undef iswupper
func (iswupper, _ISwupper)
#undef iswxdigit
func (iswxdigit, _ISwxdigit)
wint_t
towlower (wc)
(towlower) (wc)
wint_t wc;
{
return __towctrans (wc, __ctype_tolower);
size_t idx;
idx = cname_lookup (wc);
if (idx == ~((size_t) 0))
/* Character is not known. Default action is to simply return it. */
return wc;
return (wint_t) __ctype_toupper[idx];
}
wint_t
towupper (wc)
(towupper) (wc)
wint_t wc;
{
return __towctrans (wc, __ctype_toupper);
size_t idx;
idx = cname_lookup (wc);
if (idx == ~((size_t) 0))
/* Character is not known. Default action is to simply return it. */
return wc;
return (wint_t) __ctype_toupper[idx];
}

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -166,6 +166,56 @@ extern wctype_t wctype __P ((__const char *__property));
extern int __iswctype __P ((wint_t __wc, wctype_t __desc));
extern int iswctype __P ((wint_t __wc, wctype_t __desc));
#if __GNUC__ >= 2 && defined __OPTIMIZE__
/* The tables are always organized in a way which allows direct access
for single byte characters. */
extern unsigned int *__ctype32_b;
# define iswalnum(wc) \
(__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \
? (int) (__ctype32_b[wc] & _ISwalnum) : iswalnum (wc))
# define iswalpha(wc) \
(__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \
? (int) (__ctype32_b[wc] & _ISwalpha) : iswalpha (wc))
# define iswcntrl(wc) \
(__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \
? (int) (__ctype32_b[wc] & _ISwcntrl) : iswcntrl (wc))
# define iswdigit(wc) \
(__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \
? (int) (__ctype32_b[wc] & _ISwdigit) : iswdigit (wc))
# define iswlower(wc) \
(__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \
? (int) (__ctype32_b[wc] & _ISwlower) : iswlower (wc))
# define iswgraph(wc) \
(__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \
? (int) (__ctype32_b[wc] & _ISwgraph) : iswgraph (wc))
# define iswprint(wc) \
(__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \
? (int) (__ctype32_b[wc] & _ISwprint) : iswprint (wc))
# define iswpunct(wc) \
(__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \
? (int) (__ctype32_b[wc] & _ISwpunct) : iswpunct (wc))
# define iswspace(wc) \
(__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \
? (int) (__ctype32_b[wc] & _ISwspace) : iswspace (wc))
# define iswupper(wc) \
(__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \
? (int) (__ctype32_b[wc] & _ISwupper) : iswupper (wc))
# define iswxdigit(wc) \
(__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \
? (int) (__ctype32_b[wc] & _ISwxdigit) : iswxdigit (wc))
# ifdef __USE_GNU
# define iswblank(wc) \
(__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \
? (int) (__ctype32_b[wc] & _ISwblank) : iswblank (wc))
# endif
# define iswctype(wc, desc) \
(__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \
? (int) (__ctype32_b[wc] & desc) : iswctype (wc, desc))
#endif /* gcc && optimizing */
/*
* Wide-character case-mapping functions: 7.15.3.1.
@ -184,33 +234,20 @@ extern wint_t towupper __P ((wint_t __wc));
/* Map the wide character WC using the mapping described by DESC. */
extern wint_t __towctrans __P ((wint_t __wc, wctrans_t __desc));
# ifndef __NO_WCTYPE
# define iswalnum(wc) __iswctype ((wc), _ISwalnum)
# define iswalpha(wc) __iswctype ((wc), _ISwalpha)
# define iswcntrl(wc) __iswctype ((wc), _ISwcntrl)
# define iswdigit(wc) __iswctype ((wc), _ISwdigit)
# define iswlower(wc) __iswctype ((wc), _ISwlower)
# define iswgraph(wc) __iswctype ((wc), _ISwgraph)
# define iswprint(wc) __iswctype ((wc), _ISwprint)
# define iswpunct(wc) __iswctype ((wc), _ISwpunct)
# define iswspace(wc) __iswctype ((wc), _ISwspace)
# define iswupper(wc) __iswctype ((wc), _ISwupper)
# define iswxdigit(wc) __iswctype ((wc), _ISwxdigit)
# ifdef __USE_GNU
# define iswblank(wc) __iswctype ((wc), _ISwblank)
# endif
/* Pointer to conversion tables. */
#if __GNUC__ >= 2 && defined __OPTIMIZE__
/* The tables are always organized in a way which allows direct access
for single byte characters. */
extern __const __int32_t *__ctype_tolower; /* Case conversions. */
extern __const __int32_t *__ctype_toupper; /* Case conversions. */
# define towlower(wc) __towctrans ((wc), __ctype_tolower)
# define towupper(wc) __towctrans ((wc), __ctype_toupper)
# define towlower(wc) \
(__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \
? (wint_t) __ctype_tolower[wc] : towlower (wc))
# define towuppert(wc) \
(__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \
? (wint_t) __ctype_toupper[wc] : towupper (wc))
# endif /* Not __NO_WCTYPE. */
#endif /* gcc && optimizing */
__END_DECLS
@ -317,29 +354,6 @@ extern wint_t __towupper_l __P ((wint_t __wc, __locale_t __locale));
extern wint_t __towctrans_l __P ((wint_t __wc, wctrans_t __desc,
__locale_t __locale));
# ifndef __NO_WCTYPE
# define __iswalnum_l(wc, loc) __iswctype_l ((wc), _ISwalnum, (loc))
# define __iswalpha_l(wc, loc) __iswctype_l ((wc), _ISwalpha, (loc))
# define __iswcntrl_l(wc, loc) __iswctype_l ((wc), _ISwcntrl, (loc))
# define __iswdigit_l(wc, loc) __iswctype_l ((wc), _ISwdigit, (loc))
# define __iswlower_l(wc, loc) __iswctype_l ((wc), _ISwlower, (loc))
# define __iswgraph_l(wc, loc) __iswctype_l ((wc), _ISwgraph, (loc))
# define __iswprint_l(wc, loc) __iswctype_l ((wc), _ISwprint, (loc))
# define __iswpunct_l(wc, loc) __iswctype_l ((wc), _ISwpunct, (loc))
# define __iswspace_l(wc, loc) __iswctype_l ((wc), _ISwspace, (loc))
# define __iswupper_l(wc, loc) __iswctype_l ((wc), _ISwupper, (loc))
# define __iswxdigit_l(wc, loc) __iswctype_l ((wc), _ISwxdigit, (loc))
# define __iswblank_l(wc, loc) __iswctype_l ((wc), _ISwblank, (loc))
# define __towlower_l(wc, loc) __towctrans_l ((wc), (loc)->__ctype_tolower, \
(loc))
# define __towupper_l(wc, loc) __towctrans_l ((wc), (loc)->__ctype_toupper, \
(loc))
# endif /* Not __NO_WCTYPE. */
# endif /* Use GNU. */
__END_DECLS