diff options
author | Roland McGrath <roland@gnu.org> | 1996-05-01 13:55:18 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-05-01 13:55:18 +0000 |
commit | 75cd5204dd829d849a6e41380a64cf61d7f406d0 (patch) | |
tree | 8d821a60b9fd42bf4965b49faf5e6d13f7cebee3 | |
parent | 5bd44955948a63ea9a71726fb2b8b54b970aeb66 (diff) | |
download | glibc-75cd5204dd829d849a6e41380a64cf61d7f406d0.zip glibc-75cd5204dd829d849a6e41380a64cf61d7f406d0.tar.gz glibc-75cd5204dd829d849a6e41380a64cf61d7f406d0.tar.bz2 |
Wed May 1 09:10:04 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* time/strftime.c: Use canonical autoconf nugget for time.h+sys/time.h
include.
Mon Apr 29 02:48:26 1996 Ulrich Drepper <drepper@cygnus.com>
* ctype/ctype-info.c: (__ctype_width): New variable.
(__ctype_names): Initialize correctly without offset.
* locale/C-collate.c, locale/C-ctype.c,
locale/C-messages.c, locale/C-monetary.c,
locale/C-numeric.c, locale/C-time.c: Change copyright.
* locale/C-ctype.c (_nl_C_LC_CTYPE_class32): Correct
endianess for initialization value.
* locale/lc-ctype.c (current): Add parameter for offset.
(__ctype32_b, __ctype_width): Add initialization for these
variables.
* locale/programs/charmap.c: Finish support for WIDTH information.
(new_width): New function.
* locale/programs/charset.h (width_rule): new data structure.
(charset_t): Add elements for width information.
* locale/programs/ld-ctype.c (locale_ctype_t): Add element
for width information.
(allocate_arrays): Add new argument for charset.
(ctype_finish): Make sure all characters named in charset
width table are known to name table.
(ctype_output): Correct handling of class and map name
information and write out width information.
(find_idx): Prepare for being called with NULL pointer as
TABLE argument. This means only allocate name entry.
(allocate_arrays): Correct handling of array element -1.
Because EOF == -1 the value of element 127 must *not* be
mirrored here.
Fill width information from charset tables.
* locale/programs/localedef.c (main): Correct loop over all
categories after change of order from Thu Mar 28 14:22:51 1996.
Add new charset argument to call of `write_all_categories'.
* locale/programs/locales.h (ctype_finish, ctype_output): New
charset argument.
* locale/programs/locfile.c (write_all_categories): Call
`ctype_output' with additional argument charset.
* posix/getconf.c (vars): Add _POSIX_SYNC_IO, _POSIX_ASYNC_IO,
and _POSIX_PRIO_IO definitions.
* posix/posix2_lim.h: Add definition of _POSIX2_CHARCLASS_NAME_MAX
and CHARCLASS_NAME_MAX.
* posix/unistd.h: Document _POSIX_SYNC_IO, _POSIX_ASYNC_IO,
and _POSIX_PRIO_IO.
* stdlib/grouping.h: Prepare for use in wide string functions.
* stdlib/stdlib.h: Correct prototypes for __strto*_internal
functions.
* stdlib/strtod.c: Extend for use as `wcsto{f,d,ld}'.
* stdlib/strtol.c: Extend for use as `wcsto{l,ul,q,uq}'.
* string/strcoll.c: Extend for use as `wcscoll'.
* string/strxfrm.c: Extend for use as `wcsxfrm'.
* sysdeps/generic/confname.h: Add definition of _PC_SYNC_IO,
_PC_ASYNC_IO, _PC_PRIO_IO and _SC_CHARCLASS_NAME_MAX.
* sysdeps/generic/stpncpy.c: Correct return value.
* sysdeps/posix/fpathconf.c: Add handling of _PC_SYNC_IO,
_PC_ASYNC_IO, and _PC_PRIO_IO.
* sysdeps/posix/sysconf.c: Add handling of _SC_REALTIME_SIGNALS,
_SC_PRIORITY_SCHEDULING, _SC_TIMERS, _SC_ASYNCHRONOUS_IO,
_SC_PRIORITIZED_IO, _SC_SYNCHRONIZED_IO, _SC_FSYNC,
_SC_MAPPED_FILES, _SC_MEMLOCK, _SC_MEMLOCK_RANGE,
_SC_MEMORY_PROTECTION, _SC_MESSAGE_PASSING, _SC_SEMAPHORES,
_SC_SHARED_MEMORY_OBJECTS, and _SC_CHARCLASS_NAME_MAX.
* sysdeps/stub/sysconf.c: Ditto.
* sysdeps/unix/sysv/sysv4/sysconf.c: Ditto.
* sysdeps/unix/sysv/linux/Dist: Add sys/sysctl.h.
* sysdeps/unix/sysv/linux/Makefile [subdir == misc]
(sysdep_routines): Add s_sysctl and sysctl.
* sysdeps/unix/sysv/linux/sys/mman.h: Add declaration of mremap.
* sysdeps/unix/sysv/linux/sys/socket.h: New file. Wrapper
around kernel header.
* sysdeps/unix/sysv/linux/sys/sysctl.h: New file. Define
interface to `sysctl' function.
* sysdeps/unix/sysv/linux/syscalls.list: Add mremap and _sysctl.
* sysdeps/unix/sysv/linux/sysconf.c: Add handling of
_SC_CHARCLASS_NAME_MAX.
* sysdeps/unix/sysv/linux/sysctl.c: new file. Implement caller
of _sysctl system call.
* sysvipc/Makefile (routines): Add ftok.
* sysvipc/ftok.c: use variable `proj_id' not `id'. Patch by
David Mosberger-Tang.
* wcsmbs/Makefile (routines): Add wcpcpy, wcpncpy, wcstol,
wcstoul, wcstoq, wcstouq, wcstod, wcstold, wcstof, wcscoll,
wcsxfrm, wcwidth, and wcswidth.
* wcsmbs/wchar.h: Add declarations for wcpcpy, wcpncpy, wcstol,
wcstoul, wcstoq, wcstouq, wcstod, wcstold, wcstof, wcscoll,
wcsxfrm, wcwidth, and wcswidth.
Declare internal interfaces for wcsto* functions.
[OPTIMIZE]: Define inline functions for wcsto* functions to
call internal interface functions.
* wcsmbs/wcpcpy.c, wcsmbs/wcpncpy.c: New files. Implement non-
standard function equivalent to stpcpy/stpncpy.
* wcsmbs/wcscoll.c: Implement `wcscoll' function by using
`strcoll' implementation.
* wcsmbs/wcscpy.c, wcsmbs/wcsncpy.c: Use wint_t instead of
wchar_t.
* wcsmbs/wcstod.c: Implement `wcstod' function by using `strtod'
implementation.
* wcsmbs/wcstof.c: Same for `wcstof'.
* wcsmbs/wcstold.c: Same for `strtold'.
* wcsmbs/wcstol.c: Implement `wcstol' function by using `strtol'
implementation.
* wcsmbs/wcstoq.c: Same for `wcstoq'.
* wcsmbs/wcstoul.c: Same for `wcstoul'.
* wcsmbs/wcstouq.c: Same for `wcstouq'.
* wcsmbs/wcswidth.c: Implement `wcswidth' function from X/Open
CAE.
* wcsmbs/wcwidth.c: Ditto for `wcwidth'.
* wcsmbs/wcwidth.h: Common function for definitions of above two
functions.
* wcsmbs/wcsxfrm.c: Implement `wcsxfrm function by using
`strxfrm implementation.
* wctype/wctype.c: Remove case for `wctype_t' being 16 bit type.
* wctype/wctype.h (wint_t): Protect against multiple definition.
(wctype_t): Always define as `unsigned long int'.
* wctype.h: New file. Wrapper around wctype/wctype.h.
* hurd/hurdstartup.c (_hurd_split_args): Function removed.
(_hurd_startup): Use argz functions.
* hurd/hurdexec.c: Use argz functions.
67 files changed, 1901 insertions, 575 deletions
@@ -1,3 +1,166 @@ +Wed May 1 09:10:04 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> + + * time/strftime.c: Use canonical autoconf nugget for time.h+sys/time.h + include. + +Mon Apr 29 02:48:26 1996 Ulrich Drepper <drepper@cygnus.com> + + * ctype/ctype-info.c: (__ctype_width): New variable. + (__ctype_names): Initialize correctly without offset. + + * locale/C-collate.c, locale/C-ctype.c, + locale/C-messages.c, locale/C-monetary.c, + locale/C-numeric.c, locale/C-time.c: Change copyright. + + * locale/C-ctype.c (_nl_C_LC_CTYPE_class32): Correct + endianess for initialization value. + + * locale/lc-ctype.c (current): Add parameter for offset. + (__ctype32_b, __ctype_width): Add initialization for these + variables. + + * locale/programs/charmap.c: Finish support for WIDTH information. + (new_width): New function. + + * locale/programs/charset.h (width_rule): new data structure. + (charset_t): Add elements for width information. + + * locale/programs/ld-ctype.c (locale_ctype_t): Add element + for width information. + (allocate_arrays): Add new argument for charset. + (ctype_finish): Make sure all characters named in charset + width table are known to name table. + (ctype_output): Correct handling of class and map name + information and write out width information. + (find_idx): Prepare for being called with NULL pointer as + TABLE argument. This means only allocate name entry. + (allocate_arrays): Correct handling of array element -1. + Because EOF == -1 the value of element 127 must *not* be + mirrored here. + Fill width information from charset tables. + + * locale/programs/localedef.c (main): Correct loop over all + categories after change of order from Thu Mar 28 14:22:51 1996. + Add new charset argument to call of `write_all_categories'. + + * locale/programs/locales.h (ctype_finish, ctype_output): New + charset argument. + + * locale/programs/locfile.c (write_all_categories): Call + `ctype_output' with additional argument charset. + + * posix/getconf.c (vars): Add _POSIX_SYNC_IO, _POSIX_ASYNC_IO, + and _POSIX_PRIO_IO definitions. + + * posix/posix2_lim.h: Add definition of _POSIX2_CHARCLASS_NAME_MAX + and CHARCLASS_NAME_MAX. + + * posix/unistd.h: Document _POSIX_SYNC_IO, _POSIX_ASYNC_IO, + and _POSIX_PRIO_IO. + + * stdlib/grouping.h: Prepare for use in wide string functions. + + * stdlib/stdlib.h: Correct prototypes for __strto*_internal + functions. + + * stdlib/strtod.c: Extend for use as `wcsto{f,d,ld}'. + + * stdlib/strtol.c: Extend for use as `wcsto{l,ul,q,uq}'. + + * string/strcoll.c: Extend for use as `wcscoll'. + + * string/strxfrm.c: Extend for use as `wcsxfrm'. + + * sysdeps/generic/confname.h: Add definition of _PC_SYNC_IO, + _PC_ASYNC_IO, _PC_PRIO_IO and _SC_CHARCLASS_NAME_MAX. + + * sysdeps/generic/stpncpy.c: Correct return value. + + * sysdeps/posix/fpathconf.c: Add handling of _PC_SYNC_IO, + _PC_ASYNC_IO, and _PC_PRIO_IO. + + * sysdeps/posix/sysconf.c: Add handling of _SC_REALTIME_SIGNALS, + _SC_PRIORITY_SCHEDULING, _SC_TIMERS, _SC_ASYNCHRONOUS_IO, + _SC_PRIORITIZED_IO, _SC_SYNCHRONIZED_IO, _SC_FSYNC, + _SC_MAPPED_FILES, _SC_MEMLOCK, _SC_MEMLOCK_RANGE, + _SC_MEMORY_PROTECTION, _SC_MESSAGE_PASSING, _SC_SEMAPHORES, + _SC_SHARED_MEMORY_OBJECTS, and _SC_CHARCLASS_NAME_MAX. + * sysdeps/stub/sysconf.c: Ditto. + * sysdeps/unix/sysv/sysv4/sysconf.c: Ditto. + + * sysdeps/unix/sysv/linux/Dist: Add sys/sysctl.h. + + * sysdeps/unix/sysv/linux/Makefile [subdir == misc] + (sysdep_routines): Add s_sysctl and sysctl. + + * sysdeps/unix/sysv/linux/sys/mman.h: Add declaration of mremap. + + * sysdeps/unix/sysv/linux/sys/socket.h: New file. Wrapper + around kernel header. + + * sysdeps/unix/sysv/linux/sys/sysctl.h: New file. Define + interface to `sysctl' function. + + * sysdeps/unix/sysv/linux/syscalls.list: Add mremap and _sysctl. + + * sysdeps/unix/sysv/linux/sysconf.c: Add handling of + _SC_CHARCLASS_NAME_MAX. + + * sysdeps/unix/sysv/linux/sysctl.c: new file. Implement caller + of _sysctl system call. + + * sysvipc/Makefile (routines): Add ftok. + + * sysvipc/ftok.c: use variable `proj_id' not `id'. Patch by + David Mosberger-Tang. + + * wcsmbs/Makefile (routines): Add wcpcpy, wcpncpy, wcstol, + wcstoul, wcstoq, wcstouq, wcstod, wcstold, wcstof, wcscoll, + wcsxfrm, wcwidth, and wcswidth. + + * wcsmbs/wchar.h: Add declarations for wcpcpy, wcpncpy, wcstol, + wcstoul, wcstoq, wcstouq, wcstod, wcstold, wcstof, wcscoll, + wcsxfrm, wcwidth, and wcswidth. + Declare internal interfaces for wcsto* functions. + [OPTIMIZE]: Define inline functions for wcsto* functions to + call internal interface functions. + + * wcsmbs/wcpcpy.c, wcsmbs/wcpncpy.c: New files. Implement non- + standard function equivalent to stpcpy/stpncpy. + + * wcsmbs/wcscoll.c: Implement `wcscoll' function by using + `strcoll' implementation. + + * wcsmbs/wcscpy.c, wcsmbs/wcsncpy.c: Use wint_t instead of + wchar_t. + + * wcsmbs/wcstod.c: Implement `wcstod' function by using `strtod' + implementation. + * wcsmbs/wcstof.c: Same for `wcstof'. + * wcsmbs/wcstold.c: Same for `strtold'. + + * wcsmbs/wcstol.c: Implement `wcstol' function by using `strtol' + implementation. + * wcsmbs/wcstoq.c: Same for `wcstoq'. + * wcsmbs/wcstoul.c: Same for `wcstoul'. + * wcsmbs/wcstouq.c: Same for `wcstouq'. + + * wcsmbs/wcswidth.c: Implement `wcswidth' function from X/Open + CAE. + * wcsmbs/wcwidth.c: Ditto for `wcwidth'. + * wcsmbs/wcwidth.h: Common function for definitions of above two + functions. + + * wcsmbs/wcsxfrm.c: Implement `wcsxfrm function by using + `strxfrm implementation. + + * wctype/wctype.c: Remove case for `wctype_t' being 16 bit type. + + * wctype/wctype.h (wint_t): Protect against multiple definition. + (wctype_t): Always define as `unsigned long int'. + + * wctype.h: New file. Wrapper around wctype/wctype.h. + Tue Apr 30 17:30:46 1996 Miles Bader <miles@gnu.ai.mit.edu> * hurd/hurdsig.c (_hurdsig_abort_rpcs): Add timeout argument to @@ -9,6 +172,11 @@ Tue Apr 30 17:30:46 1996 Miles Bader <miles@gnu.ai.mit.edu> Mon Apr 29 00:11:59 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> + * hurd/hurdstartup.c (_hurd_split_args): Function removed. + (_hurd_startup): Use argz functions. + + * hurd/hurdexec.c: Use argz functions. + * errno.h [!__error_t_defined] (error_t): New type. * sysdeps/mach/hurd/errnos.awk: #define __error_t_defined after the typedef in errnos.h. diff --git a/ctype/ctype-info.c b/ctype/ctype-info.c index 3a47b34..70f86ea 100644 --- a/ctype/ctype-info.c +++ b/ctype/ctype-info.c @@ -25,11 +25,13 @@ extern const char _nl_C_LC_CTYPE_class32[]; extern const char _nl_C_LC_CTYPE_toupper[]; extern const char _nl_C_LC_CTYPE_tolower[]; extern const char _nl_C_LC_CTYPE_names[]; +extern const char _nl_C_LC_CTYPE_width[]; -#define b(u,x,o) (((const u int *) _nl_C_LC_CTYPE_##x) + o); +#define b(t,x,o) (((const t *) _nl_C_LC_CTYPE_##x) + o); -const unsigned short int *__ctype_b = b (unsigned short, class, 128); -const unsigned int *__ctype32_b = b (unsigned, class32, 0); -const int *__ctype_tolower = b (, tolower, 128); -const int *__ctype_toupper = b (, toupper, 128); -const unsigned int *__ctype_names = b (unsigned, names, 0); +const unsigned short int *__ctype_b = b (unsigned short int, class, 128); +const unsigned int *__ctype32_b = b (unsigned int, class32, 0); +const int *__ctype_tolower = b (int, tolower, 128); +const int *__ctype_toupper = b (int, toupper, 128); +const unsigned int *__ctype_names = b (unsigned int, names, 0); +const unsigned char *__ctype_width = b (unsigned char, width, 0); diff --git a/hurd/hurdexec.c b/hurd/hurdexec.c index 149e95c..7893c91 100644 --- a/hurd/hurdexec.c +++ b/hurd/hurdexec.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 93, 94, 95, 96 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 @@ -25,6 +25,7 @@ Cambridge, MA 02139, USA. */ #include <hurd.h> #include <hurd/fd.h> #include <hurd/signal.h> +#include <argz.h> /* Overlay TASK, executing FILE with arguments ARGV and environment ENVP. If TASK == mach_task_self (), some ports are dealloc'd by the exec server. @@ -47,36 +48,10 @@ _hurd_exec (task_t task, file_t file, struct hurd_sigstate *ss; mach_port_t *please_dealloc, *pdp; - - /* Pack the arguments into an array with nulls separating the elements. */ - argslen = 0; - if (argv != NULL) - { - p = argv; - while (*p != NULL) - argslen += strlen (*p++) + 1; - args = __alloca (argslen); - ap = args; - for (p = argv; *p != NULL; ++p) - ap = __memccpy (ap, *p, '\0', ULONG_MAX); - } - else - args = NULL; - - /* Pack the environment into an array with nulls separating elements. */ - envlen = 0; - if (envp != NULL) - { - p = envp; - while (*p != NULL) - envlen += strlen (*p++) + 1; - env = __alloca (envlen); - ap = env; - for (p = envp; *p != NULL; ++p) - ap = __memccpy (ap, *p, '\0', ULONG_MAX); - } - else - env = NULL; + if (err = __argz_create (argv, &args, &argslen)) + return err; + if (err = __argz_create (envp, &env, &envlen)) + goto outargs; /* Load up the ports to give to the new program. */ for (i = 0; i < _hurd_nports; ++i) @@ -88,7 +63,7 @@ _hurd_exec (task_t task, file_t file, { while (--i > 0) _hurd_port_free (&_hurd_ports[i], &ulink_ports[i], ports[i]); - return err; + goto outenv; } } else @@ -254,5 +229,9 @@ _hurd_exec (task_t task, file_t file, __msg_sig_post (_hurd_msgport, 0, __mach_task_self ()); } + outargs: + free (args); + outenv: + free (env); return err; } diff --git a/hurd/hurdstartup.c b/hurd/hurdstartup.c index ca44737..17a7705 100644 --- a/hurd/hurdstartup.c +++ b/hurd/hurdstartup.c @@ -1,5 +1,5 @@ /* Initial program startup for running under the GNU Hurd. -Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. +Copyright (C) 1991, 92, 93, 94, 95, 96 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 @@ -30,6 +30,7 @@ Cambridge, MA 02139, USA. */ #include "set-hooks.h" #include "hurdmalloc.h" /* XXX */ #include "hurdstartup.h" +#include <argz.h> mach_port_t *_hurd_init_dtable; mach_msg_type_number_t _hurd_init_dtablesize; @@ -45,9 +46,6 @@ unsigned long int *__hurd_sigthread_variables; extern void __mach_init (void); -int _hurd_split_args (char *, size_t, char **); - - /* Entry point. This is the first thing in the text segment. The exec server started the initial thread in our task with this spot the @@ -125,9 +123,9 @@ _hurd_startup (void **argptr, void (*main) (int *data)) arguments and environment into vectors of pointers to strings. */ /* Count up the arguments so we can allocate ARGV. */ - argc = _hurd_split_args (args, argslen, NULL); + argc = __argz_count (args, argslen); /* Count up the environment variables so we can allocate ENVP. */ - envc = _hurd_split_args (env, envlen, NULL); + envc = __argz_count (env, envlen); /* There were some arguments. Allocate space for the vectors of pointers and fill them in. We allocate the space for the @@ -138,11 +136,11 @@ _hurd_startup (void **argptr, void (*main) (int *data)) sizeof (struct hurd_startup_data)); *argcptr = argc; argv = (void *) (argcptr + 1); - _hurd_split_args (args, argslen, argv); + __argz_extract (args, argslen, argv); /* There was some environment. */ envp = &argv[argc + 1]; - _hurd_split_args (env, envlen, envp); + __argz_extract (env, envlen, envp); } if (err || in_bootstrap == MACH_PORT_NULL) @@ -197,35 +195,3 @@ _hurd_startup (void **argptr, void (*main) (int *data)) LOSE; abort (); } - -/* Split ARGSLEN bytes at ARGS into words, breaking at NUL characters. If - ARGV is not a null pointer, store a pointer to the start of each word in - ARGV[n], and null-terminate ARGV. Return the number of words split. */ - -int -_hurd_split_args (char *args, size_t argslen, char **argv) -{ - char *p = args; - size_t n = argslen; - int argc = 0; - - while (n > 0) - { - char *end = memchr (p, '\0', n); - - if (argv) - argv[argc] = p; - ++argc; - - if (end == NULL) - /* The last argument is unterminated. */ - break; - - n -= end + 1 - p; - p = end + 1; - } - - if (argv) - argv[argc] = NULL; - return argc; -} diff --git a/locale/C-collate.c b/locale/C-collate.c index 7211eb1..ec467fc 100644 --- a/locale/C-collate.c +++ b/locale/C-collate.c @@ -1,8 +1,21 @@ -/* Generated by GNU locale 0.1. - Copyright (C) 1995 Free Software Foundation, Inc. -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. */ +/* Copyright (C) 1995, 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. + +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. */ #include "localeinfo.h" diff --git a/locale/C-ctype.c b/locale/C-ctype.c index 8bf6bee..95ac311 100644 --- a/locale/C-ctype.c +++ b/locale/C-ctype.c @@ -1,4 +1,21 @@ -/* Generated by GNU locale 0.1. */ +/* Copyright (C) 1995, 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. + +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. */ #include "localeinfo.h" #include <endian.h> @@ -70,92 +87,92 @@ const char _nl_C_LC_CTYPE_class[768] = /* 0xfa */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" ; const char _nl_C_LC_CTYPE_class32[1024] = - /* 0x00 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x03 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x06 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x09 */ "\003\040\000\000" "\002\040\000\000" "\002\040\000\000" - /* 0x0c */ "\002\040\000\000" "\002\040\000\000" "\002\000\000\000" - /* 0x0f */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x12 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x15 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x18 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x1b */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x1e */ "\002\000\000\000" "\002\000\000\000" "\001\140\000\000" - /* 0x21 */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x24 */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x27 */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x2a */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x2d */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x30 */ "\010\330\000\000" "\010\330\000\000" "\010\330\000\000" - /* 0x33 */ "\010\330\000\000" "\010\330\000\000" "\010\330\000\000" - /* 0x36 */ "\010\330\000\000" "\010\330\000\000" "\010\330\000\000" - /* 0x39 */ "\010\330\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x3c */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x3f */ "\004\300\000\000" "\004\300\000\000" "\010\325\000\000" - /* 0x42 */ "\010\325\000\000" "\010\325\000\000" "\010\325\000\000" - /* 0x45 */ "\010\325\000\000" "\010\325\000\000" "\010\305\000\000" - /* 0x48 */ "\010\305\000\000" "\010\305\000\000" "\010\305\000\000" - /* 0x4b */ "\010\305\000\000" "\010\305\000\000" "\010\305\000\000" - /* 0x4e */ "\010\305\000\000" "\010\305\000\000" "\010\305\000\000" - /* 0x51 */ "\010\305\000\000" "\010\305\000\000" "\010\305\000\000" - /* 0x54 */ "\010\305\000\000" "\010\305\000\000" "\010\305\000\000" - /* 0x57 */ "\010\305\000\000" "\010\305\000\000" "\010\305\000\000" - /* 0x5a */ "\010\305\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x5d */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x60 */ "\004\300\000\000" "\010\326\000\000" "\010\326\000\000" - /* 0x63 */ "\010\326\000\000" "\010\326\000\000" "\010\326\000\000" - /* 0x66 */ "\010\326\000\000" "\010\306\000\000" "\010\306\000\000" - /* 0x69 */ "\010\306\000\000" "\010\306\000\000" "\010\306\000\000" - /* 0x6c */ "\010\306\000\000" "\010\306\000\000" "\010\306\000\000" - /* 0x6f */ "\010\306\000\000" "\010\306\000\000" "\010\306\000\000" - /* 0x72 */ "\010\306\000\000" "\010\306\000\000" "\010\306\000\000" - /* 0x75 */ "\010\306\000\000" "\010\306\000\000" "\010\306\000\000" - /* 0x78 */ "\010\306\000\000" "\010\306\000\000" "\010\306\000\000" - /* 0x7b */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000" - /* 0x7e */ "\004\300\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x81 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x84 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x87 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x8a */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x8d */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x90 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x93 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x96 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x99 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x9c */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0x9f */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xa2 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xa5 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xa8 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xab */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xae */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xb1 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xb4 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xb7 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xba */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xbd */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xc0 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xc3 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xc6 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xc9 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xcc */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xcf */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xd2 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xd5 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xd8 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xdb */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xde */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xe1 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xe4 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xe7 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xea */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xed */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xf0 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xf3 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xf6 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xf9 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xfc */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000" - /* 0xff */ "\002\000\000\000" + /* 0x00 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x03 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x06 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x09 */ "\000\000\003\040" "\000\000\002\040" "\000\000\002\040" + /* 0x0c */ "\000\000\002\040" "\000\000\002\040" "\000\000\002\000" + /* 0x0f */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x12 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x15 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x18 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x1b */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x1e */ "\000\000\002\000" "\000\000\002\000" "\000\000\001\140" + /* 0x21 */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300" + /* 0x24 */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300" + /* 0x27 */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300" + /* 0x2a */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300" + /* 0x2d */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300" + /* 0x30 */ "\000\000\010\330" "\000\000\010\330" "\000\000\010\330" + /* 0x33 */ "\000\000\010\330" "\000\000\010\330" "\000\000\010\330" + /* 0x36 */ "\000\000\010\330" "\000\000\010\330" "\000\000\010\330" + /* 0x39 */ "\000\000\010\330" "\000\000\004\300" "\000\000\004\300" + /* 0x3c */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300" + /* 0x3f */ "\000\000\004\300" "\000\000\004\300" "\000\000\010\325" + /* 0x42 */ "\000\000\010\325" "\000\000\010\325" "\000\000\010\325" + /* 0x45 */ "\000\000\010\325" "\000\000\010\325" "\000\000\010\305" + /* 0x48 */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305" + /* 0x4b */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305" + /* 0x4e */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305" + /* 0x51 */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305" + /* 0x54 */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305" + /* 0x57 */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305" + /* 0x5a */ "\000\000\010\305" "\000\000\004\300" "\000\000\004\300" + /* 0x5d */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300" + /* 0x60 */ "\000\000\004\300" "\000\000\010\326" "\000\000\010\326" + /* 0x63 */ "\000\000\010\326" "\000\000\010\326" "\000\000\010\326" + /* 0x66 */ "\000\000\010\326" "\000\000\010\306" "\000\000\010\306" + /* 0x69 */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306" + /* 0x6c */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306" + /* 0x6f */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306" + /* 0x72 */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306" + /* 0x75 */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306" + /* 0x78 */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306" + /* 0x7b */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300" + /* 0x7e */ "\000\000\004\300" "\000\000\002\000" "\000\000\002\000" + /* 0x81 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x84 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x87 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x8a */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x8d */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x90 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x93 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x96 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x99 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x9c */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0x9f */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xa2 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xa5 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xa8 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xab */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xae */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xb1 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xb4 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xb7 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xba */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xbd */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xc0 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xc3 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xc6 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xc9 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xcc */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xcf */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xd2 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xd5 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xd8 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xdb */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xde */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xe1 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xe4 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xe7 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xea */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xed */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xf0 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xf3 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xf6 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xf9 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xfc */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000" + /* 0xff */ "\000\000\002\000" ; #if BYTE_ORDER == LITTLE_ENDIAN const char _nl_C_LC_CTYPE_toupper[1536] = diff --git a/locale/C-messages.c b/locale/C-messages.c index 6f89919..b118c13 100644 --- a/locale/C-messages.c +++ b/locale/C-messages.c @@ -1,8 +1,21 @@ -/* Generated by GNU locale 0.1. - Copyright (C) 1995, 1996 Free Software Foundation, Inc. -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. */ +/* Copyright (C) 1995, 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. + +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. */ #include "localeinfo.h" diff --git a/locale/C-monetary.c b/locale/C-monetary.c index 1859422..befb429 100644 --- a/locale/C-monetary.c +++ b/locale/C-monetary.c @@ -1,8 +1,21 @@ -/* Generated by GNU locale 0.1. - Copyright (C) 1995, 1996 Free Software Foundation, Inc. -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. */ +/* Copyright (C) 1995, 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. + +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. */ #include "localeinfo.h" diff --git a/locale/C-numeric.c b/locale/C-numeric.c index 5d68a89..feb20c8 100644 --- a/locale/C-numeric.c +++ b/locale/C-numeric.c @@ -1,8 +1,21 @@ -/* Generated by GNU locale 0.1. - Copyright (C) 1995, 1996 Free Software Foundation, Inc. -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. */ +/* Copyright (C) 1995, 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. + +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. */ #include "localeinfo.h" diff --git a/locale/C-time.c b/locale/C-time.c index 6fb5e3e..4bab361 100644 --- a/locale/C-time.c +++ b/locale/C-time.c @@ -1,8 +1,21 @@ -/* Generated by GNU locale 0.1. - Copyright (C) 1995, 1996 Free Software Foundation, Inc. -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. */ +/* Copyright (C) 1995, 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. + +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. */ #include "localeinfo.h" diff --git a/locale/lc-ctype.c b/locale/lc-ctype.c index 4b7dcc5..2eeedf8 100644 --- a/locale/lc-ctype.c +++ b/locale/lc-ctype.c @@ -43,14 +43,17 @@ _nl_postload_ctype (void) #define paste(a,b) paste1(a,b) #define paste1(a,b) a##b -#define current(unsigned,x) \ - ((const unsigned int *) _NL_CURRENT (LC_CTYPE, paste(_NL_CTYPE_,x)) \ - + 128) +#define current(type,x,offset) \ + ((const type *) _NL_CURRENT (LC_CTYPE, paste(_NL_CTYPE_,x)) + offset) + extern const unsigned int *__ctype32_b; extern const unsigned int *__ctype_names; - - __ctype_b = current (unsigned short, CLASS); - __ctype_toupper = current (, bo (TOUPPER)); - __ctype_tolower = current (, bo (TOLOWER)); - __ctype_names = current (unsigned, bo (NAMES)); + extern const unsigned char *__ctype_width; + + __ctype_b = current (unsigned short int, CLASS, 128); + __ctype_toupper = current (int, bo (TOUPPER), 128); + __ctype_tolower = current (int, bo (TOLOWER), 128); + __ctype32_b = current (unsigned int, CLASS32, 0); + __ctype_names = current (unsigned int, bo (NAMES), 0); + __ctype_width = current (unsigned char, WIDTH, 0); } diff --git a/locale/programs/charmap.c b/locale/programs/charmap.c index 2b71821..f938d79 100644 --- a/locale/programs/charmap.c +++ b/locale/programs/charmap.c @@ -47,7 +47,9 @@ void *xmalloc (size_t __n); /* Prototypes for local functions. */ static struct charset_t *parse_charmap (const char *filename); - +static void new_width (struct linereader *cmfile, struct charset_t *result, + const char *from, const char *to, + unsigned long int width); struct charset_t * @@ -123,6 +125,8 @@ parse_charmap (const char *filename) /* Allocate room for result. */ result = (struct charset_t *) xmalloc (sizeof (struct charset_t)); memset (result, '\0', sizeof (struct charset_t)); + /* The default DEFAULT_WIDTH is 1. */ + result->width_default = 1; #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free @@ -399,6 +403,10 @@ argument to <%s> must be a single character"), case 91: /* Waiting for WIDTH... */ + if (nowtok == tok_eol) + /* Ignore empty lines. */ + continue; + if (nowtok == tok_width_default) { state = 92; @@ -474,7 +482,10 @@ only WIDTH definitions are allowed to follow the CHARMAP definition")); case 94: if (nowtok == tok_ellipsis) - state = 95; + { + state = 95; + continue; + } case 96: if (nowtok != tok_number) @@ -482,8 +493,11 @@ only WIDTH definitions are allowed to follow the CHARMAP definition")); "WIDTH"); else { - /* XXX Store width for chars. */ + /* Store width for chars. */ + new_width (cmfile, result, from_name, to_name, now->val.num); + from_name = NULL; + to_name = NULL; } lr_ignore_rest (cmfile, nowtok == tok_number); @@ -507,8 +521,6 @@ only WIDTH definitions are allowed to follow the CHARMAP definition")); now->val.str.start, now->val.str.len); - lr_ignore_rest (cmfile, 1); - state = 96; continue; @@ -591,3 +603,50 @@ only WIDTH definitions are allowed to follow the CHARMAP definition")); return result; } + + +static void +new_width (struct linereader *cmfile, struct charset_t *result, + const char *from, const char *to, unsigned long int width) +{ + unsigned int from_val, to_val; + + from_val = charset_find_value (result, from, strlen (from)); + if (from_val == ILLEGAL_CHAR_VALUE) + { + lr_error (cmfile, _("unknown character `%s'"), from); + return; + } + + if (to == NULL) + to_val = from_val; + else + { + to_val = charset_find_value (result, to, strlen (to)); + if (to_val == ILLEGAL_CHAR_VALUE) + { + lr_error (cmfile, _("unknown character `%s'"), to); + return; + } + } + + if (result->nwidth_rules >= result->nwidth_rules_max) + { + size_t new_size = result->nwidth_rules + 32; + struct width_rule *new_rules = + (struct width_rule *) obstack_alloc (&result->mem_pool, + (new_size + * sizeof (struct width_rule))); + + memcpy (new_rules, result->width_rules, + result->nwidth_rules_max * sizeof (struct width_rule)); + + result->width_rules = new_rules; + result->nwidth_rules_max = new_size; + } + + result->width_rules[result->nwidth_rules].from = from_val; + result->width_rules[result->nwidth_rules].to = to_val; + result->width_rules[result->nwidth_rules].width = (unsigned int) width; + ++result->nwidth_rules; +} diff --git a/locale/programs/charset.h b/locale/programs/charset.h index 222d468..1e8819c 100644 --- a/locale/programs/charset.h +++ b/locale/programs/charset.h @@ -26,11 +26,23 @@ Boston, MA 02111-1307, USA. */ #include "linereader.h" +struct width_rule +{ + unsigned int from; + unsigned int to; + unsigned int width; +}; + + struct charset_t { const char *code_set_name; int mb_cur_min; int mb_cur_max; + + struct width_rule *width_rules; + size_t nwidth_rules; + size_t nwidth_rules_max; int width_default; struct obstack mem_pool; diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index c1cc8e5..99e9ebe 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -107,6 +107,7 @@ struct locale_ctype_t u32_t **map_el; u32_t *class_name_ptr; u32_t *map_name_ptr; + unsigned char *width; }; @@ -120,7 +121,8 @@ static u32_t *find_idx (struct locale_ctype_t *ctype, u32_t **table, size_t *max, size_t *act, unsigned int idx); static void set_class_defaults (struct locale_ctype_t *ctype, struct charset_t *charset); -static void allocate_arrays (struct locale_ctype_t *ctype); +static void allocate_arrays (struct locale_ctype_t *ctype, + struct charset_t *charset); void @@ -321,20 +323,33 @@ character %s'%s' in class `%s' must not be in class `%s'"), valid_table[cnt].name); else ELEM (ctype, class_collection, , space_value) |= BIT (tok_print); + + /* Now that the tests are done make sure the name array contains all + characters which are handled in the WIDTH section of the + character set definition file. */ + if (charset->width_rules != NULL) + for (cnt = 0; cnt < charset->nwidth_rules; ++cnt) + { + size_t inner; + for (inner = charset->width_rules[cnt].from; + inner <= charset->width_rules[cnt].to; ++inner) + (void) find_idx (ctype, NULL, NULL, NULL, inner); + } } void -ctype_output (struct localedef_t *locale, const char *output_path) +ctype_output (struct localedef_t *locale, struct charset_t *charset, + const char *output_path) { struct locale_ctype_t *ctype = locale->categories[LC_CTYPE].ctype; const size_t nelems = (_NL_ITEM_INDEX (_NL_NUM_LC_CTYPE) + 2 * (ctype->map_collection_nr - 2)); - struct iovec iov[2 + nelems + (ctype->nr_charclass + 1) - + (ctype->map_collection_nr + 1)]; + struct iovec iov[2 + nelems + ctype->nr_charclass + + ctype->map_collection_nr]; struct locale_file data; u32_t idx[nelems]; - size_t elem, cnt, offset; + size_t elem, cnt, offset, total; if ((locale->binary & (1 << LC_CTYPE)) != 0) @@ -349,7 +364,7 @@ ctype_output (struct localedef_t *locale, const char *output_path) /* Now prepare the output: Find the sizes of the table we can use. */ - allocate_arrays (ctype); + allocate_arrays (ctype, charset); data.magic = LIMAGIC (LC_CTYPE); data.n = nelems; @@ -369,8 +384,10 @@ ctype_output (struct localedef_t *locale, const char *output_path) { #define CTYPE_DATA(name, base, len) \ case _NL_ITEM_INDEX (name): \ - iov[2 + elem].iov_base = base; \ - iov[2 + elem].iov_len = len; \ + iov[2 + elem + offset].iov_base = base; \ + iov[2 + elem + offset].iov_len = len; \ + if (elem + 1 < nelems) \ + idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len; \ break CTYPE_DATA (_NL_CTYPE_CLASS, @@ -412,15 +429,46 @@ ctype_output (struct localedef_t *locale, const char *output_path) CTYPE_DATA (_NL_CTYPE_HASH_LAYERS, &ctype->plane_cnt, sizeof (u32_t)); - CTYPE_DATA (_NL_CTYPE_CLASS_NAMES, - ctype->class_name_ptr, - ctype->nr_charclass * sizeof (u32_t)); - CTYPE_DATA (_NL_CTYPE_MAP_NAMES, - ctype->map_name_ptr, - ctype->map_collection_nr * sizeof (u32_t)); + case _NL_ITEM_INDEX (_NL_CTYPE_CLASS_NAMES): + /* The class name array. */ + total = 0; + for (cnt = 0; cnt < ctype->nr_charclass; ++cnt, ++offset) + { + iov[2 + elem + offset].iov_base + = (void *) ctype->classnames[cnt]; + iov[2 + elem + offset].iov_len + = strlen (ctype->classnames[cnt]) + 1; + total += iov[2 + elem + offset].iov_len; + } + iov[2 + elem + offset].iov_base = (void *) ""; + iov[2 + elem + offset].iov_len = 1; + ++total; + + if (elem + 1 < nelems) + idx[elem + 1] = idx[elem] + total; + break; + + case _NL_ITEM_INDEX (_NL_CTYPE_MAP_NAMES): + /* The class name array. */ + total = 0; + for (cnt = 0; cnt < ctype->map_collection_nr; ++cnt, ++offset) + { + iov[2 + elem + offset].iov_base + = (void *) ctype->mapnames[cnt]; + iov[2 + elem + offset].iov_len + = strlen (ctype->mapnames[cnt]) + 1; + total += iov[2 + elem + offset].iov_len; + } + iov[2 + elem + offset].iov_base = (void *) ""; + iov[2 + elem + offset].iov_len = 1; + ++total; + + if (elem + 1 < nelems) + idx[elem + 1] = idx[elem] + total; + break; CTYPE_DATA (_NL_CTYPE_WIDTH, - NULL, 0); /* Not yet implemented. */ + ctype->width, ctype->plane_size * ctype->plane_cnt); default: assert (! "unknown CTYPE element"); @@ -431,49 +479,23 @@ ctype_output (struct localedef_t *locale, const char *output_path) size_t nr = (elem - _NL_ITEM_INDEX (_NL_NUM_LC_CTYPE)) >> 1; if (((elem - _NL_ITEM_INDEX (_NL_NUM_LC_CTYPE)) & 1) == 0) - iov[2 + elem].iov_base = ctype->map_eb[nr]; + iov[2 + elem + offset].iov_base = ctype->map_eb[nr]; else - iov[2 + elem].iov_base = ctype->map_el[nr]; - - iov[2 + elem].iov_len = ((ctype->plane_size * ctype->plane_cnt + 128) - * sizeof (u32_t)); - } - - if (elem + 1 < nelems) - idx[elem + 1] = idx[elem] + iov[2 + elem].iov_len; - } - - offset = idx[elem - 1] + iov[2 + elem - 1].iov_len; - - /* The class name array. */ - for (cnt = 0; cnt < ctype->nr_charclass; ++cnt, ++elem) - { - iov[2 + elem].iov_base = (void *) ctype->classnames[cnt]; - iov[2 + elem].iov_len = strlen (ctype->classnames[cnt]) + 1; - - ctype->class_name_ptr[cnt] = offset; - offset += iov[2 + elem].iov_len; - } - iov[2 + elem].iov_base = (void *) ""; - iov[2 + elem].iov_len = 1; - ++elem; + iov[2 + elem + offset].iov_base = ctype->map_el[nr]; - /* The map name array. */ - for (cnt = 0; cnt < ctype->map_collection_nr; ++cnt, ++elem) - { - iov[2 + elem].iov_base = (void *) ctype->mapnames[cnt]; - iov[2 + elem].iov_len = strlen (ctype->mapnames[cnt]) + 1; + iov[2 + elem + offset].iov_len = ((ctype->plane_size + * ctype->plane_cnt + 128) + * sizeof (u32_t)); - ctype->map_name_ptr[cnt] = offset; - offset += iov[2 + elem].iov_len; + if (elem + 1 < nelems) + idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len; + } } - iov[2 + elem].iov_base = (void *) ""; - iov[2 + elem].iov_len = 1; - ++elem; - assert (elem == nelems + ctype->nr_charclass + ctype->map_collection_nr + 2); + assert (2 + elem + offset == (nelems + ctype->nr_charclass + + ctype->map_collection_nr + 2)); - write_locale_data (output_path, "LC_CTYPE", 2 + elem, iov); + write_locale_data (output_path, "LC_CTYPE", 2 + elem + offset, iov); } @@ -813,6 +835,8 @@ implementation limit: no more than %d character maps allowed"), } +/* We have to be prepared that TABLE, MAX, and ACT can be NULL. This + is possible if we only want ot extend the name array. */ static u32_t * find_idx (struct locale_ctype_t *ctype, u32_t **table, size_t *max, size_t *act, unsigned int idx) @@ -820,7 +844,7 @@ find_idx (struct locale_ctype_t *ctype, u32_t **table, size_t *max, size_t cnt; if (idx < 256) - return &(*table)[idx]; + return table == NULL ? NULL : &(*table)[idx]; for (cnt = 256; cnt < ctype->charnames_act; ++cnt) if (ctype->charnames[cnt] == idx) @@ -840,6 +864,10 @@ find_idx (struct locale_ctype_t *ctype, u32_t **table, size_t *max, ctype->charnames[ctype->charnames_act++] = idx; } + if (table == NULL) + /* We have done everything we are asked to do. */ + return NULL; + if (cnt >= *act) { if (cnt >= *max) @@ -1126,7 +1154,7 @@ character `%s' not defined while needed as default value"), static void -allocate_arrays (struct locale_ctype_t *ctype) +allocate_arrays (struct locale_ctype_t *ctype, struct charset_t *charset) { size_t idx; @@ -1182,6 +1210,7 @@ Computing table size for character classes might take a while..."), fprintf (stderr, _(" done\n")); + #if __BYTE_ORDER == __LITTLE_ENDIAN # define NAMES_B1 ctype->names_el # define NAMES_B2 ctype->names_eb @@ -1246,8 +1275,9 @@ Computing table size for character classes might take a while..."), ctype->ctype_b[128 + ctype->charnames[idx]] = TRANS (ctype->class_collection[idx]); - /* Mirror first 128 entries. */ - for (idx = 0; idx < 128; ++idx) + /* Mirror first 127 entries. We must take care that entry -1 is not + mirrored because EOF == -1. */ + for (idx = 0; idx < 127; ++idx) ctype->ctype_b[idx] = ctype->ctype_b[256 + idx]; /* The 32 bit array contains all characters. */ @@ -1292,10 +1322,13 @@ Computing table size for character classes might take a while..."), MAP_B1[idx][128 + ctype->charnames[idx2]] = ctype->map_collection[idx][idx2]; - /* Mirror first 128 entries. */ - for (idx2 = 0; idx2 < 128; ++idx2) + /* Mirror first 127 entries. We must take care not to map entry + -1 because EOF == -1. */ + for (idx2 = 0; idx2 < 127; ++idx2) MAP_B1[idx][idx2] = MAP_B1[idx][256 + idx2]; + /* EOF must map to EOF. */ + MAP_B1[idx][127] = EOF; /* And now the other byte order. */ for (idx2 = 0; idx2 < ctype->plane_size * ctype->plane_cnt + 128; ++idx2) @@ -1307,4 +1340,33 @@ Computing table size for character classes might take a while..."), * sizeof (u32_t)); ctype->map_name_ptr = (u32_t *) xmalloc (ctype->map_collection_nr * sizeof (u32_t)); + + /* Array for width information. Because the expected width are very + small we use only one single byte. This save space and we need + not provide the information twice with both endianesses. */ + ctype->width = (unsigned char *) xmalloc (ctype->plane_size + * ctype->plane_cnt); + /* Initialize with default width value. */ + memset (ctype->width, charset->width_default, + ctype->plane_size * ctype->plane_cnt); + if (charset->width_rules != NULL) + { + size_t cnt; + + for (cnt = 0; cnt < charset->nwidth_rules; ++cnt) + if (charset->width_rules[cnt].width != charset->width_default) + for (idx = charset->width_rules[cnt].from; + idx <= charset->width_rules[cnt].to; ++idx) + { + size_t nr = idx % ctype->plane_size; + size_t depth = 0; + + while (NAMES_B1[nr + depth * ctype->plane_size] != nr) + ++depth; + assert (depth < ctype->plane_cnt); + + ctype->width[nr + depth * ctype->plane_size] + = charset->width_rules[cnt].width; + } + } } diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c index a98bac4..72eb2d3 100644 --- a/locale/programs/localedef.c +++ b/locale/programs/localedef.c @@ -231,7 +231,7 @@ main (int argc, char *argv[]) for (act_add_locdef = copy_list; act_add_locdef != NULL; act_add_locdef = act_add_locdef->next) { - for (cat = LC_COLLATE; cat <= LC_MESSAGES; ++cat) + for (cat = LC_CTYPE; cat <= LC_MESSAGES; ++cat) if ((act_add_locdef->mask & (1 << cat)) != 0) { act_add_locdef->mask &= ~(1 << cat); @@ -335,7 +335,7 @@ cannot `stat' locale file `%s'"), error (4, cannot_write_why, _("cannot write output files to `%s'"), output_path); else - write_all_categories (localedef, output_path); + write_all_categories (localedef, charset, output_path); } else error (4, 0, _("no output file produced because warning were issued")); diff --git a/locale/programs/locales.h b/locale/programs/locales.h index 3c7676b..a992642 100644 --- a/locale/programs/locales.h +++ b/locale/programs/locales.h @@ -79,129 +79,130 @@ charclass_to_bit (enum token_t tok) /* Remember name of newly created charclass. */ void ctype_startup (struct linereader *lr, struct localedef_t *locale, - struct charset_t *__charset); -void ctype_finish (struct localedef_t *__locale, struct charset_t *__charset); + struct charset_t *charset); +void ctype_finish (struct localedef_t *locale, struct charset_t *charset); -void ctype_output (struct localedef_t *locale, const char *output_path); +void ctype_output (struct localedef_t *locale, struct charset_t *charset, + const char *output_path); int ctype_is_charclass (struct linereader *lr, struct localedef_t *locale, - const char *__name); + const char *name); void ctype_class_new (struct linereader *lr, struct localedef_t *locale, - enum token_t __tok, struct token *__code, - struct charset_t *__charset); + enum token_t tok, struct token *code, + struct charset_t *charset); void ctype_class_start (struct linereader *lr, struct localedef_t *locale, - enum token_t __tok, const char *__name, - struct charset_t *__charset); + enum token_t tok, const char *name, + struct charset_t *charset); void ctype_class_from (struct linereader *lr, struct localedef_t *locale, - struct token *__code, struct charset_t *__charset); + struct token *code, struct charset_t *charset); void ctype_class_to (struct linereader *lr, struct localedef_t *locale, - struct token *__code, struct charset_t *__charset); + struct token *code, struct charset_t *charset); void ctype_class_end (struct linereader *lr, struct localedef_t *locale); int ctype_is_charmap (struct linereader *lr, struct localedef_t *locale, - const char *__name); + const char *name); void ctype_map_new (struct linereader *lr, struct localedef_t *locale, - enum token_t __tok, struct token *__code, - struct charset_t *__charset); + enum token_t tok, struct token *code, + struct charset_t *charset); void ctype_map_start (struct linereader *lr, struct localedef_t *locale, - enum token_t __tok, const char *__name, - struct charset_t *__charset); + enum token_t tok, const char *name, + struct charset_t *charset); void ctype_map_from (struct linereader *lr, struct localedef_t *locale, - struct token *__code, struct charset_t *__charset); + struct token *code, struct charset_t *charset); void ctype_map_to (struct linereader *lr, struct localedef_t *locale, - struct token *__code, struct charset_t *__charset); + struct token *code, struct charset_t *charset); void ctype_map_end (struct linereader *lr, struct localedef_t *locale); /* Handle LC_COLLATE category. */ -void collate_startup (struct linereader *__lr, struct localedef_t *__locale, - struct charset_t *__charset); +void collate_startup (struct linereader *lr, struct localedef_t *locale, + struct charset_t *charset); -void collate_finish (struct localedef_t *__locale, - struct charset_t *__charset); +void collate_finish (struct localedef_t *locale, + struct charset_t *charset); void collate_output (struct localedef_t *locale, const char *output_path); -void collate_element_to (struct linereader *__lr, struct localedef_t *__locale, - struct token *__code, struct charset_t *__charset); -void collate_element_from (struct linereader *__lr, - struct localedef_t *__locale, struct token *__code, - struct charset_t *__charset); -void collate_symbol (struct linereader *__lr, struct localedef_t *__locale, - struct token *__code, struct charset_t *__charset); -void collate_new_order (struct linereader *__lr, struct localedef_t *__locale, - enum coll_sort_rule __sort_rule); -void collate_build_arrays (struct linereader *__lr, - struct localedef_t *__locale); -int collate_order_elem (struct linereader *__lr, struct localedef_t *__locale, - struct token *__code, struct charset_t *__charset); -int collate_weight_bsymbol (struct linereader *__lr, - struct localedef_t *__locale, - struct token *__code, struct charset_t *__charset); -int collate_next_weight (struct linereader *__lr, - struct localedef_t *__locale); -int collate_simple_weight (struct linereader *__lr, - struct localedef_t *__locale, - struct token *__code, struct charset_t *__charset); -void collate_end_weight (struct linereader *__lr, - struct localedef_t *__locale); +void collate_element_to (struct linereader *lr, struct localedef_t *locale, + struct token *code, struct charset_t *charset); +void collate_element_from (struct linereader *lr, + struct localedef_t *locale, struct token *code, + struct charset_t *charset); +void collate_symbol (struct linereader *lr, struct localedef_t *locale, + struct token *code, struct charset_t *charset); +void collate_new_order (struct linereader *lr, struct localedef_t *locale, + enum coll_sort_rule sort_rule); +void collate_build_arrays (struct linereader *lr, + struct localedef_t *locale); +int collate_order_elem (struct linereader *lr, struct localedef_t *locale, + struct token *code, struct charset_t *charset); +int collate_weight_bsymbol (struct linereader *lr, + struct localedef_t *locale, + struct token *code, struct charset_t *charset); +int collate_next_weight (struct linereader *lr, + struct localedef_t *locale); +int collate_simple_weight (struct linereader *lr, + struct localedef_t *locale, + struct token *code, struct charset_t *charset); +void collate_end_weight (struct linereader *lr, + struct localedef_t *locale); /* Handle LC_MONETARY category. */ -void monetary_startup (struct linereader *__lr, struct localedef_t *__locale, - struct charset_t *__charset); +void monetary_startup (struct linereader *lr, struct localedef_t *locale, + struct charset_t *charset); -void monetary_finish (struct localedef_t *__locale); +void monetary_finish (struct localedef_t *locale); void monetary_output (struct localedef_t *locale, const char *output_path); void monetary_add (struct linereader *lr, struct localedef_t *locale, - enum token_t __tok, struct token *__code, - struct charset_t *__charset); + enum token_t tok, struct token *code, + struct charset_t *charset); /* Handle LC_NUMERIC category. */ -void numeric_startup (struct linereader *__lr, struct localedef_t *__locale, - struct charset_t *__charset); +void numeric_startup (struct linereader *lr, struct localedef_t *locale, + struct charset_t *charset); -void numeric_finish (struct localedef_t *__locale); +void numeric_finish (struct localedef_t *locale); void numeric_output (struct localedef_t *locale, const char *output_path); void numeric_add (struct linereader *lr, struct localedef_t *locale, - enum token_t __tok, struct token *__code, - struct charset_t *__charset); + enum token_t tok, struct token *code, + struct charset_t *charset); /* Handle LC_TIME category. */ -void time_startup (struct linereader *__lr, struct localedef_t *__locale, - struct charset_t *__charset); +void time_startup (struct linereader *lr, struct localedef_t *locale, + struct charset_t *charset); -void time_finish (struct localedef_t *__locale); +void time_finish (struct localedef_t *locale); void time_output (struct localedef_t *locale, const char *output_path); void time_add (struct linereader *lr, struct localedef_t *locale, - enum token_t __tok, struct token *__code, - struct charset_t *__charset); + enum token_t tok, struct token *code, + struct charset_t *charset); /* Handle LC_MESSAGES category. */ -void messages_startup (struct linereader *__lr, struct localedef_t *__locale, - struct charset_t *__charset); +void messages_startup (struct linereader *lr, struct localedef_t *locale, + struct charset_t *charset); -void messages_finish (struct localedef_t *__locale); +void messages_finish (struct localedef_t *locale); void messages_output (struct localedef_t *locale, const char *output_path); void messages_add (struct linereader *lr, struct localedef_t *locale, - enum token_t __tok, struct token *__code, - struct charset_t *__charset); + enum token_t tok, struct token *code, + struct charset_t *charset); #endif /* locales.h */ diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c index cb98a5d..89dc6bb 100644 --- a/locale/programs/locfile.c +++ b/locale/programs/locfile.c @@ -25,6 +25,7 @@ Boston, MA 02111-1307, USA. */ #include <fcntl.h> #include <locale.h> #include <malloc.h> +#include <stdio.h> #include <string.h> #include <unistd.h> #include <sys/stat.h> @@ -913,10 +914,11 @@ check_all_categories (struct localedef_t *locale, struct charset_t *charset) void -write_all_categories (struct localedef_t *locale, const char *output_path) +write_all_categories (struct localedef_t *locale, struct charset_t *charset, + const char *output_path) { /* Call all functions to write locale data. */ - ctype_output (locale, output_path); + ctype_output (locale, charset, output_path); collate_output (locale, output_path); monetary_output (locale, output_path); numeric_output (locale, output_path); diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h index e337e96..a0fe06b 100644 --- a/locale/programs/locfile.h +++ b/locale/programs/locfile.h @@ -66,7 +66,7 @@ void check_all_categories (struct localedef_t *locale, struct charset_t *charset); void write_all_categories (struct localedef_t *locale, - const char *output_path); + struct charset_t *charset, const char *output_path); void write_locale_data (const char *output_path, const char *category, diff --git a/posix/getconf.c b/posix/getconf.c index bf13fb4..26d1d38 100644 --- a/posix/getconf.c +++ b/posix/getconf.c @@ -41,6 +41,9 @@ static struct conf vars[] = { "_POSIX_CHOWN_RESTRICTED", _PC_CHOWN_RESTRICTED, PATHCONF }, { "_POSIX_NO_TRUNC", _PC_NO_TRUNC, PATHCONF }, { "_POSIX_VDISABLE", _PC_VDISABLE, PATHCONF }, + { "_POSIX_SYNC_IO", _PC_SYNC_IO, PATHCONF }, + { "_POSIX_ASYNC_IO", _PC_ASYNC_IO, PATHCONF }, + { "_POSIX_PRIO_IO", _PC_PRIO_IO, PATHCONF }, { "ARG_MAX", _SC_ARG_MAX, SYSCONF }, { "CHILD_MAX", _SC_CHILD_MAX, SYSCONF }, diff --git a/posix/posix2_lim.h b/posix/posix2_lim.h index 0556502..8dda66d 100644 --- a/posix/posix2_lim.h +++ b/posix/posix2_lim.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1996 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 @@ -22,31 +22,34 @@ Cambridge, MA 02139, USA. */ /* The maximum `ibase' and `obase' values allowed by the `bc' utility. */ -#define _POSIX2_BC_BASE_MAX 99 +#define _POSIX2_BC_BASE_MAX 99 /* The maximum number of elements allowed in an array by the `bc' utility. */ -#define _POSIX2_BC_DIM_MAX 2048 +#define _POSIX2_BC_DIM_MAX 2048 /* The maximum `scale' value allowed by the `bc' utility. */ -#define _POSIX2_BC_SCALE_MAX 99 +#define _POSIX2_BC_SCALE_MAX 99 /* The maximum length of a string constant accepted by the `bc' utility. */ -#define _POSIX2_BC_STRING_MAX 1000 +#define _POSIX2_BC_STRING_MAX 1000 /* The maximum number of weights that can be assigned to an entry of the LC_COLLATE category `order' keyword in a locale definition. */ -#define _POSIX2_EQUIV_CLASS_MAX 2 +#define _POSIX2_EQUIV_CLASS_MAX 2 /* The maximum number of expressions that can be nested within parentheses by the `expr' utility. */ -#define _POSIX2_EXPR_NEST_MAX 32 +#define _POSIX2_EXPR_NEST_MAX 32 /* The maximum length, in bytes, of an input line. */ -#define _POSIX2_LINE_MAX 2048 +#define _POSIX2_LINE_MAX 2048 /* The maximum number of repeated occurrences of a regular expression permitted when using the interval notation `\{M,N\}'. */ -#define _POSIX2_RE_DUP_MAX 255 +#define _POSIX2_RE_DUP_MAX 255 + +/* The manimum number of bytes in a character class name. */ +#define _POSIX2_CHARCLASS_NAME_MAX 14 /* These values are implementation-specific, @@ -54,28 +57,31 @@ Cambridge, MA 02139, USA. */ Their precise values can be obtained from sysconf. */ #ifndef BC_BASE_MAX -#define BC_BASE_MAX _POSIX2_BC_BASE_MAX +#define BC_BASE_MAX _POSIX2_BC_BASE_MAX #endif #ifndef BC_DIM_MAX -#define BC_DIM_MAX _POSIX2_BC_DIM_MAX +#define BC_DIM_MAX _POSIX2_BC_DIM_MAX #endif #ifndef BC_SCALE_MAX -#define BC_SCALE_MAX _POSIX2_BC_SCALE_MAX +#define BC_SCALE_MAX _POSIX2_BC_SCALE_MAX #endif #ifndef BC_STRING_MAX -#define BC_STRING_MAX _POSIX2_BC_STRING_MAX +#define BC_STRING_MAX _POSIX2_BC_STRING_MAX #endif #ifndef EQUIV_CLASS_MAX -#define EQUIV_CLASS_MAX _POSIX2_EQUIV_CLASS_MAX +#define EQUIV_CLASS_MAX _POSIX2_EQUIV_CLASS_MAX #endif #ifndef EXPR_NEST_MAX -#define EXPR_NEST_MAX _POSIX2_EXPR_NEST_MAX +#define EXPR_NEST_MAX _POSIX2_EXPR_NEST_MAX #endif #ifndef LINE_MAX -#define LINE_MAX _POSIX2_LINE_MAX +#define LINE_MAX _POSIX2_LINE_MAX #endif #ifndef RE_DUP_MAX -#define RE_DUP_MAX _POSIX2_RE_DUP_MAX +#define RE_DUP_MAX _POSIX2_RE_DUP_MAX +#endif +#ifndef CHARCLASS_NAME_MAX +#define CHARCLASS_NAME_MAX _POSIX2_CHARCLASS_NAME_MAX #endif diff --git a/posix/unistd.h b/posix/unistd.h index 6818699..b48f24b 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -30,8 +30,9 @@ __BEGIN_DECLS /* These may be used to determine what facilities are present at compile time. Their values can be obtained at run time from sysconf. */ -/* POSIX Standard approved as IEEE Std 1003.1 as of August, 1988. */ -#define _POSIX_VERSION 199009L +/* POSIX Standard approved as IEEE Std 1003.1 as of August, 1988 and + extended by P1003.1b (aka POSIX.4). */ +#define _POSIX_VERSION 199309L /* These are not #ifdef __USE_POSIX2 because they are in the theoretically application-owned namespace. */ @@ -94,6 +95,9 @@ __BEGIN_DECLS `c_cc' member of `struct termios' is _POSIX_VDISABLE, no character will have the effect associated with that element. + _POSIX_SYNC_IO Synchronous I/O may be performed. + _POSIX_ASYNC_IO Asynchronous I/O may be performed. + _POSIX_PRIO_IO Prioritized Asynchronous I/O may be performed. */ #include <posix_opt.h> diff --git a/stdlib/grouping.h b/stdlib/grouping.h index 566f6a6..f533689 100644 --- a/stdlib/grouping.h +++ b/stdlib/grouping.h @@ -1,6 +1,6 @@ /* Internal header for proving correct grouping in strings of numbers. -Copyright (C) 1995 Free Software Foundation, Inc. -Contributed by Ulrich Drepper. +Copyright (C) 1995, 1996 Free Software Foundation, Inc. +Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. 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 @@ -28,16 +28,16 @@ Cambridge, MA 02139, USA. */ satisfies the grouping rules. It is assumed that at least one digit follows BEGIN directly. */ -static inline const char * -correctly_grouped_prefix (const char *begin, const char *end, +static inline const STRING_TYPE * +correctly_grouped_prefix (const STRING_TYPE *begin, const STRING_TYPE *end, wchar_t thousands, const char *grouping) { - if (! grouping) + if (grouping == NULL) return end; while (end > begin) { - const char *cp = end - 1; + const STRING_TYPE *cp = end - 1; const char *gp = grouping; /* Check first group. */ @@ -48,7 +48,7 @@ correctly_grouped_prefix (const char *begin, const char *end, { /* This group matches the specification. */ - const char *new_end; + const STRING_TYPE *new_end; if (cp < begin) /* There is just one complete group. We are done. */ @@ -66,7 +66,7 @@ correctly_grouped_prefix (const char *begin, const char *end, /* Get the next grouping rule. */ ++gp; if (*gp == 0) - /* If end is reached use last rule. */ + /* If end is reached use last rule. */ --gp; /* Skip the thousands separator. */ @@ -85,7 +85,7 @@ correctly_grouped_prefix (const char *begin, const char *end, else { /* Check the next group. */ - const char *group_end = cp; + const STRING_TYPE *group_end = cp; while (cp >= begin && (wchar_t) *cp != thousands) --cp; @@ -120,4 +120,4 @@ correctly_grouped_prefix (const char *begin, const char *end, } return MAX (begin, end); -} +} diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index 40b81c6..2fde1c8 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -102,22 +102,26 @@ extern unsigned long long int strtouq __P ((__const char *__nptr, /* The internal entry points for `strtoX' take an extra flag argument saying whether or not to parse locale-dependent number grouping. */ -extern double __strtod_internal (__const char *__nptr, - char **__endptr, int __group); -extern float __strtof_internal (__const char *__nptr, char **__endptr, - int __group); -extern __long_double_t __strtold_internal (__const char *__nptr, - char **__endptr, int __group); -extern long int __strtol_internal (__const char *__nptr, char **__endptr, - int __base, int __group); -extern unsigned long int __strtoul_internal (__const char *__nptr, - char **__endptr, int __base, - int __group); -extern long long int __strtoq_internal (__const char *__nptr, char **__endptr, - int __base, int __group); -extern unsigned long long int __strtouq_internal (__const char *__nptr, +extern double __strtod_internal __P ((__const char *__nptr, + char **__endptr, int __group)); +extern float __strtof_internal __P ((__const char *__nptr, char **__endptr, + int __group)); +extern __long_double_t __strtold_internal __P ((__const char *__nptr, + char **__endptr, int __group)); +extern long int __strtol_internal __P ((__const char *__nptr, char **__endptr, + int __base, int __group)); +extern unsigned long int __strtoul_internal __P ((__const char *__nptr, char **__endptr, int __base, - int __group); + int __group)); +#ifdef __GNUC__ +extern long long int __strtoq_internal __P ((__const char *__nptr, + char **__endptr, int __base, + int __group)); +extern unsigned long long int __strtouq_internal __P ((__const char *__nptr, + char **__endptr, + int __base, + int __group)); +#endif /* GCC */ #if defined (__OPTIMIZE__) && __GNUC__ >= 2 /* Define inline functions which call the internal entry points. */ @@ -143,7 +147,7 @@ extern __inline long long int strtoq (__const char *__nptr, char **__endptr, int __base) { return __strtoq_internal (__nptr, __endptr, __base, 0); } extern __inline unsigned long long int strtouq (__const char *__nptr, - char **__endptr, int __base) + char **__endptr, int __base) { return __strtouq_internal (__nptr, __endptr, __base, 0); } #endif diff --git a/stdlib/strtod.c b/stdlib/strtod.c index 51dc520..e262f3d 100644 --- a/stdlib/strtod.c +++ b/stdlib/strtod.c @@ -1,6 +1,6 @@ /* Read decimal floating point numbers. Copyright (C) 1995, 1996 Free Software Foundation, Inc. -Contributed by Ulrich Drepper. +Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. This file is part of the GNU C Library. @@ -15,18 +15,39 @@ 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., 675 Mass Ave, -Cambridge, MA 02139, USA. */ +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. */ -/* Configuration part. These macros are defined by `strtold.c' and `strtof.c' - to produce the `long double' and `float' versions of the reader. */ +/* Configuration part. These macros are defined by `strtold.c', + `strtof.c', `wcstod.c', `wcstold.c', and `wcstof.c' to produce the + `long double' and `float' versions of the reader. */ #ifndef FLOAT -#define FLOAT double -#define FLT DBL -#define STRTOF strtod -#define MPN2FLOAT __mpn_construct_double -#define FLOAT_HUGE_VAL HUGE_VAL +# define FLOAT double +# define FLT DBL +# ifdef USE_WIDE_CHAR +# define STRTOF wcstod +# else +# define STRTOF strtod +# endif +# define MPN2FLOAT __mpn_construct_double +# define FLOAT_HUGE_VAL HUGE_VAL +#endif + +#ifdef USE_WIDE_CHAR +# include <wctype.h> +# include <wchar.h> +# define STRING_TYPE wchar_t +# define CHAR_TYPE wint_t +# define L_(Ch) L##Ch +# define ISSPACE(Ch) iswspace (Ch) +# define TOLOWER(Ch) towlower (Ch) +#else +# define STRING_TYPE char +# define CHAR_TYPE char +# define L_(Ch) Ch +# define ISSPACE(Ch) isspace (Ch) +# define TOLOWER(Ch) tolower (Ch) #endif /* End of configuration part. */ @@ -103,8 +124,9 @@ static const mp_limb _tens_in_limb[MAX_DIG_PER_LIMB + 1] = #define NDIG (MAX_10_EXP - MIN_10_EXP + 2 * MANT_DIG) #define RETURN_LIMB_SIZE howmany (MANT_DIG, BITS_PER_MP_LIMB) -#define RETURN(val,end) \ - do { if (endptr != 0) *endptr = (char *) (end); return val; } while (0) +#define RETURN(val,end) \ + do { if (endptr != NULL) *endptr = (STRING_TYPE *) (end); \ + return val; } while (0) /* Maximum size necessary for mpn integers to hold floating point numbers. */ #define MPNSIZE (howmany (MAX_EXP + 2 * MANT_DIG, BITS_PER_MP_LIMB) \ @@ -206,8 +228,8 @@ round_and_return (mp_limb *retval, int exponent, int negative, character od the string that is not part of the integer as the function value. If the EXPONENT is small enough to be taken as an additional factor for the resulting number (see code) multiply by it. */ -static inline const char * -str_to_mpn (const char *str, int digcnt, mp_limb *n, mp_size_t *nsize, +static inline const STRING_TYPE * +str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb *n, mp_size_t *nsize, int *exponent) { /* Number of digits for actual limb. */ @@ -239,9 +261,9 @@ str_to_mpn (const char *str, int digcnt, mp_limb *n, mp_size_t *nsize, /* There might be thousands separators or radix characters in the string. But these all can be ignored because we know the format of the number is correct and we have an exact number of characters to read. */ - while (!isdigit (*str)) + while (*str < L_('0') || *str > L_('9')) ++str; - low = low * 10 + *str++ - '0'; + low = low * 10 + *str++ - L_('0'); ++cnt; } while (--digcnt > 0); @@ -311,8 +333,8 @@ __mpn_lshift_1 (mp_limb *ptr, mp_size_t size, unsigned int count, mp_limb limb) ERANGE and return HUGE_VAL with the approriate sign. */ FLOAT INTERNAL (STRTOF) (nptr, endptr, group) - const char *nptr; - char **endptr; + const STRING_TYPE *nptr; + STRING_TYPE **endptr; int group; { int negative; /* The sign of the number. */ @@ -330,15 +352,15 @@ INTERNAL (STRTOF) (nptr, endptr, group) int bits; /* Running pointer after the last character processed in the string. */ - const char *cp, *tp; + const STRING_TYPE *cp, *tp; /* Start of significant part of the number. */ - const char *startp, *start_of_digits; + const STRING_TYPE *startp, *start_of_digits; /* Points at the character following the integer and fractional digits. */ - const char *expp; + const STRING_TYPE *expp; /* Total number of digit and number of digits in integer part. */ int dig_no, int_no, lead_zero; /* Contains the last character read. */ - char c; + CHAR_TYPE c; /* The radix character of the current locale. */ wchar_t decimal; @@ -386,32 +408,33 @@ INTERNAL (STRTOF) (nptr, endptr, group) /* Ignore leading white space. */ do c = *++cp; - while (isspace (c)); + while (ISSPACE (c)); /* Get sign of the result. */ - if (c == '-') + if (c == L_('-')) { negative = 1; c = *++cp; } - else if (c == '+') + else if (c == L_('+')) c = *++cp; /* Return 0.0 if no legal string is found. No character is used even if a sign was found. */ - if (!isdigit (c) && (c != decimal || !isdigit (cp[1]))) + if ((c < L_('0') || c > L_('9')) + && (c != decimal || cp[1] < L_('0') || cp[1] > L_('9'))) RETURN (0.0, nptr); /* Record the start of the digits, in case we will check their grouping. */ start_of_digits = startp = cp; /* Ignore leading zeroes. This helps us to avoid useless computations. */ - while (c == '0' || (thousands != L'\0' && c == thousands)) + while (c == L_('0') || (thousands != L'\0' && c == thousands)) c = *++cp; /* If no other digit but a '0' is found the result is 0.0. Return current read pointer. */ - if (!isdigit (c) && c != decimal) + if ((c < L_('0') || c > L_('9')) && c != decimal) { tp = correctly_grouped_prefix (start_of_digits, cp, thousands, grouping); /* If TP is at the start of the digits, there was no correctly @@ -428,7 +451,7 @@ INTERNAL (STRTOF) (nptr, endptr, group) so we can check all the grouping separators. */ grouping) { - if (isdigit (c)) + if (c >= L_('0') && c <= L_('9')) ++dig_no; else if (thousands == L'\0' || c != thousands) /* Not a digit or separator: end of the integer part. */ @@ -458,7 +481,7 @@ INTERNAL (STRTOF) (nptr, endptr, group) cp = tp; dig_no = 0; for (tp = startp; tp < cp; ++tp) - if (isdigit (*tp)) + if (*tp >= L_('0') && *tp <= L_('9')) ++dig_no; int_no = dig_no; @@ -481,31 +504,35 @@ INTERNAL (STRTOF) (nptr, endptr, group) /* Read the fractional digits. A special case are the 'american style' numbers like `16.' i.e. with decimal but without trailing digits. */ if (c == decimal) - while (isdigit (c = *++cp)) - { - if (c != '0' && lead_zero == -1) - lead_zero = dig_no - int_no; - ++dig_no; - } + { + c = *++cp; + while (c >= L_('0') && c <= L_('9')) + { + if (c != L_('0') && lead_zero == -1) + lead_zero = dig_no - int_no; + ++dig_no; + c = *++cp; + } + } /* Remember start of exponent (if any). */ expp = cp; /* Read exponent. */ - if (tolower (c) == 'e') + if (TOLOWER (c) == L_('e')) { int exp_negative = 0; c = *++cp; - if (c == '-') + if (c == L_('-')) { exp_negative = 1; c = *++cp; } - else if (c == '+') + else if (c == L_('+')) c = *++cp; - if (isdigit (c)) + if (c >= L_('0') && c <= L_('9')) { int exp_limit; @@ -532,16 +559,16 @@ INTERNAL (STRTOF) (nptr, endptr, group) /* Accept all following digits as part of the exponent. */ do ++cp; - while (isdigit (*cp)); + while (*cp >= L_('0') && *cp <= L_('9')); RETURN (retval, cp); /* NOTREACHED */ } - exponent += c - '0'; + exponent += c - L_('0'); c = *++cp; } - while (isdigit (c)); + while (c >= L_('0') && c <= L_('9')); if (exp_negative) exponent = -exponent; @@ -553,7 +580,7 @@ INTERNAL (STRTOF) (nptr, endptr, group) /* We don't want to have to work with trailing zeroes after the radix. */ if (dig_no > int_no) { - while (expp[-1] == '0') + while (expp[-1] == L_('0')) { --expp; --dig_no; @@ -565,7 +592,7 @@ INTERNAL (STRTOF) (nptr, endptr, group) /* The whole string is parsed. Store the address of the next character. */ if (endptr) - *endptr = (char *) cp; + *endptr = (STRING_TYPE *) cp; if (dig_no == 0) return 0.0; @@ -573,7 +600,8 @@ INTERNAL (STRTOF) (nptr, endptr, group) if (lead_zero) { /* Find the decimal point */ - while (*startp != decimal) startp++; + while (*startp != decimal) + ++startp; startp += lead_zero + 1; exponent -= lead_zero; dig_no -= lead_zero; @@ -1131,8 +1159,8 @@ INTERNAL (STRTOF) (nptr, endptr, group) FLOAT STRTOF (nptr, endptr) - const char *nptr; - char **endptr; + const STRING_TYPE *nptr; + STRING_TYPE **endptr; { return INTERNAL (STRTOF) (nptr, endptr, 0); } diff --git a/stdlib/strtol.c b/stdlib/strtol.c index 289aa04..2a2a8ea 100644 --- a/stdlib/strtol.c +++ b/stdlib/strtol.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1991, 1992, 1994, 1995, 1996 Free Software Foundation, Inc. - +/* Copyright (C) 1991, 92, 94, 95, 96 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 @@ -56,18 +55,41 @@ extern int errno; # define UNSIGNED 0 # define INT LONG int #else -# define strtol strtoul # define INT unsigned LONG int #endif +/* Determine the name. */ +#if UNSIGNED +# ifdef USE_WIDE_CHAR +# ifdef QUAD +# define strtol wcstouq +# else +# define strtol wcstoul +# endif +# else +# ifdef QUAD +# define strtol strtouq +# else +# define strtol strtoul +# endif +# endif +#else +# ifdef USE_WIDE_CHAR +# ifdef QUAD +# define strtol wcstoq +# else +# define strtol wcstol +# endif +# else +# ifdef QUAD +# define strtol strtoq +# endif +# endif +#endif + /* If QUAD is defined, we are defining `strtoq' or `strtouq', operating on `long long int's. */ #ifdef QUAD -# if UNSIGNED -# define strtoul strtouq -# else -# define strtol strtoq -# endif # define LONG long long # undef LONG_MIN # define LONG_MIN LONG_LONG_MIN @@ -85,6 +107,24 @@ extern int errno; # define LONG long #endif +#ifdef USE_WIDE_CHAR +# include <wchar.h> +# include <wctype.h> +# define L_(ch) L##ch +# define UCHAR_TYPE wint_t +# define STRING_TYPE wchar_t +# define ISSPACE(ch) iswspace (ch) +# define ISALPHA(ch) iswalpha (ch) +# define TOUPPER(ch) towupper (ch) +#else +# define L_(ch) ch +# define UCHAR_TYPE unsigned char +# define STRING_TYPE char +# define ISSPACE(ch) isspace (ch) +# define ISALPHA(ch) isalpha (ch) +# define TOUPPER(ch) toupper (ch) +#endif + #ifdef __STDC__ # define INTERNAL(x) INTERNAL1(x) # define INTERNAL1(x) __##x##_internal @@ -107,8 +147,8 @@ extern int errno; INT INTERNAL (strtol) (nptr, endptr, base, group) - const char *nptr; - char **endptr; + const STRING_TYPE *nptr; + STRING_TYPE **endptr; int base; int group; { @@ -116,9 +156,9 @@ INTERNAL (strtol) (nptr, endptr, base, group) register unsigned LONG int cutoff; register unsigned int cutlim; register unsigned LONG int i; - register const char *s; - register unsigned char c; - const char *save, *end; + register const STRING_TYPE *s; + register UCHAR_TYPE c; + const STRING_TYPE *save, *end; int overflow; #ifdef USE_NUMBER_GROUPING @@ -153,18 +193,18 @@ INTERNAL (strtol) (nptr, endptr, base, group) save = s = nptr; /* Skip white space. */ - while (isspace (*s)) + while (ISSPACE (*s)) ++s; - if (*s == '\0') + if (*s == L_('\0')) goto noconv; /* Check for a sign. */ - if (*s == '-') + if (*s == L_('-')) { negative = 1; ++s; } - else if (*s == '+') + else if (*s == L_('+')) { negative = 0; ++s; @@ -172,14 +212,14 @@ INTERNAL (strtol) (nptr, endptr, base, group) else negative = 0; - if (base == 16 && s[0] == '0' && toupper (s[1]) == 'X') + if (base == 16 && s[0] == L_('0') && TOUPPER (s[1]) == L_('X')) s += 2; /* If BASE is zero, figure it out ourselves. */ if (base == 0) - if (*s == '0') + if (*s == L_('0')) { - if (toupper (s[1]) == 'X') + if (TOUPPER (s[1]) == L_('X')) { s += 2; base = 16; @@ -198,9 +238,9 @@ INTERNAL (strtol) (nptr, endptr, base, group) { /* Find the end of the digit string and check its grouping. */ end = s; - for (c = *end; c != '\0'; c = *++end) - if (c != thousands && !isdigit (c) && - (!isalpha (c) || toupper (c) - 'A' + 10 >= base)) + for (c = *end; c != L_('\0'); c = *++end) + if (c != thousands && (c < L_('0') || c > L_('9')) + && (!ISALPHA (c) || TOUPPER (c) - L_('A') + 10 >= base)) break; if (*s == thousands) end = s; @@ -216,14 +256,14 @@ INTERNAL (strtol) (nptr, endptr, base, group) overflow = 0; i = 0; - for (c = *s; c != '\0'; c = *++s) + for (c = *s; c != L_('\0'); c = *++s) { if (s == end) break; - if (isdigit (c)) - c -= '0'; - else if (isalpha (c)) - c = toupper (c) - 'A' + 10; + if (c >= L_('0') && c <= L_('9')) + c -= L_('0'); + else if (ISALPHA (c)) + c = TOUPPER (c) - L_('A') + 10; else break; if (c >= base) @@ -245,7 +285,7 @@ INTERNAL (strtol) (nptr, endptr, base, group) /* Store in ENDPTR the address of one character past the last character we converted. */ if (endptr != NULL) - *endptr = (char *) s; + *endptr = (STRING_TYPE *) s; #if !UNSIGNED /* Check for a value that is within the range of @@ -274,11 +314,12 @@ noconv: hexadecimal digits. This is no error case. We return 0 and ENDPTR points to the `x`. */ if (endptr != NULL) - if (save - nptr >= 2 && tolower (save[-1]) == 'x' && save[-2] == '0') - *endptr = (char *) &save[-1]; + if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X') + && save[-2] == L_('0')) + *endptr = (STRING_TYPE *) &save[-1]; else /* There was no number to convert. */ - *endptr = (char *) nptr; + *endptr = (STRING_TYPE *) nptr; return 0L; } @@ -287,8 +328,8 @@ noconv: INT strtol (nptr, endptr, base) - const char *nptr; - char **endptr; + const STRING_TYPE *nptr; + STRING_TYPE **endptr; int base; { return INTERNAL (strtol) (nptr, endptr, base, 0); diff --git a/string/envz.h b/string/envz.h index 55224c7..c39c497 100644 --- a/string/envz.h +++ b/string/envz.h @@ -1,6 +1,6 @@ /* Routines for dealing with '\0' separated environment vectors - Copyright (C) 1995 Free Software Foundation, Inc. + Copyright (C) 1995, 1996 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> @@ -28,11 +28,11 @@ #include <argz.h> /* Returns a pointer to the entry in ENVZ for NAME, or 0 if there is none. */ -char *envz_entry (char *envz, unsigned envz_len, char *name); +char *envz_entry (const char *envz, size_t envz_len, const char *name); /* Returns a pointer to the value portion of the entry in ENVZ for NAME, or 0 if there is none. */ -char *envz_get (char *envz, unsigned envz_len, char *name); +char *envz_get (const char *envz, size_t envz_len, const char *name); /* Adds an entry for NAME with value VALUE to ENVZ & ENVZ_LEN. If an entry with the same name already exists in ENVZ, it is removed. If VALUE is @@ -40,16 +40,17 @@ char *envz_get (char *envz, unsigned envz_len, char *name); return NULL, although envz_entry will still return an entry; this is handy because when merging with another envz, the null entry can override an entry in the other one. Null entries can be removed with envz_strip (). */ -error_t envz_add (char **envz, unsigned *envz_len, char *name, char *value); +error_t envz_add (char **envz, size_t *envz_len, + const char *name, const char *value); /* Adds each entry in ENVZ2 to ENVZ & ENVZ_LEN, as if with envz_add(). If OVERRIDE is true, then values in ENVZ2 will supercede those with the same name in ENV, otherwise not. */ -error_t -envz_merge (char **envz, unsigned *envz_len, char *envz2, unsigned envz2_len, - int override); +error_t envz_merge (char **envz, size_t *envz_len, + const char *envz2, size_t envz2_len, + int override); /* Remove null entries. */ -void envz_strip (char **envz, unsigned *envz_len); +void envz_strip (char **envz, size_t *envz_len); #endif /* __ENVZ_H__ */ diff --git a/string/strcoll.c b/string/strcoll.c index f5e2458..dc1bb2a 100644 --- a/string/strcoll.c +++ b/string/strcoll.c @@ -1,6 +1,6 @@ /* Copyright (C) 1995, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. -Written by Ulrich Drepper, <drepper@gnu.ai.mit.edu>. +Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. 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 @@ -25,6 +25,7 @@ Boston, MA 02111-1307, USA. */ # define STRING_TYPE char # define USTRING_TYPE unsigned char # define STRCOLL strcoll +# define STRCMP strcmp #endif /* Include the shared helper functions. `strxfrm'/`wcsxfrm' also use @@ -49,7 +50,7 @@ STRCOLL (s1, s2) /* If the current locale does not specify locale data we use normal 8-bit string comparison. */ if (collate_nrules == 0) - return strcmp (s1, s2); + return STRCMP (s1, s2); /* Get full information about the strings. This means we get information for all passes in a special data structure. */ diff --git a/string/strxfrm.c b/string/strxfrm.c index 7824ad8..300967b 100644 --- a/string/strxfrm.c +++ b/string/strxfrm.c @@ -1,6 +1,6 @@ /* Copyright (C) 1995, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. -Written by Ulrich Drepper, <drepper@gnu.ai.mit.edu>. +Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. 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 @@ -36,10 +36,7 @@ Boston, MA 02111-1307, USA. */ /* Write 32 bit value UTF-8 encoded but only if enough space is left. */ static __inline size_t -print_val (u_int32_t value, - STRING_TYPE *dest, - size_t max, - size_t act) +print_val (u_int32_t value, STRING_TYPE *dest, size_t max, size_t act) { char tmp[6]; int idx = 0; @@ -101,10 +98,7 @@ print_val (u_int32_t value, their transformation. The transformed string is put in at most N characters of DEST and its length is returned. */ size_t -STRXFRM (dest, src, n) - STRING_TYPE *dest; - const STRING_TYPE *src; - size_t n; +STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n) { weight_t *forw = NULL; weight_t *backw = NULL; diff --git a/sysdeps/generic/confname.h b/sysdeps/generic/confname.h index da189fb..6c58410 100644 --- a/sysdeps/generic/confname.h +++ b/sysdeps/generic/confname.h @@ -36,7 +36,13 @@ enum #define _PC_CHOWN_RESTRICTED _PC_CHOWN_RESTRICTED _PC_NO_TRUNC, #define _PC_NO_TRUNC _PC_NO_TRUNC - _PC_VDISABLE + _PC_VDISABLE, + _PC_SYNC_IO, +#define _PC_SYNC_IO _PC_SYNC_IO + _PC_ASYNC_IO, +#define _PC_ASYNC_IO _PC_ASYNC_IO + _PC_PRIO_IO +#define _PC_PRIO_IO _PC_PRIO_IO }; /* Values for the argument to `sysconf'. */ @@ -113,6 +119,8 @@ enum #define _SC_LINE_MAX _SC_LINE_MAX _SC_RE_DUP_MAX, #define _SC_RE_DUP_MAX _SC_RE_DUP_MAX + _SC_CHARCLASS_NAME_MAX, +#define _SC_CHARCLASS_NAME_MAX _SC_CHARCLASS_NAME_MAX _SC_2_VERSION, #define _SC_2_VERSION _SC_2_VERSION diff --git a/sysdeps/generic/stpncpy.c b/sysdeps/generic/stpncpy.c index d4a5240..5cdd93d 100644 --- a/sysdeps/generic/stpncpy.c +++ b/sysdeps/generic/stpncpy.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996 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 @@ -67,7 +67,7 @@ DEFUN(__stpncpy, (dest, src, n), char *dest AND CONST char *src AND size_t n) last_chars: n &= 3; if (n == 0) - return s; + return dest; do { diff --git a/sysdeps/posix/fpathconf.c b/sysdeps/posix/fpathconf.c index b339990..5c91c4a 100644 --- a/sysdeps/posix/fpathconf.c +++ b/sysdeps/posix/fpathconf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1995, 1996 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 @@ -107,6 +107,27 @@ DEFUN(__fpathconf, (fd, name), int fd AND int name) #else return -1; #endif + + case _PC_SYNC_IO: +#ifdef _POSIX_SYNC_IO + return _POSIX_SYNC_IO; +#else + return -1; +#endif + + case _PC_ASYNC_IO: +#ifdef _POSIX_ASYNC_IO + return _POSIX_ASYNC_IO; +#else + return -1; +#endif + + case _PC_PRIO_IO: +#ifdef _POSIX_PRIO_IO + return _POSIX_PRIO_IO; +#else + return -1; +#endif } errno = ENOSYS; diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c index 485f9b3..bf3c5b8 100644 --- a/sysdeps/posix/sysconf.c +++ b/sysdeps/posix/sysconf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1993, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1993, 1995, 1996 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 @@ -84,12 +84,112 @@ DEFUN(__sysconf, (name), int name) #else return -1; #endif + case _SC_SAVED_IDS: #ifdef _POSIX_SAVED_IDS return 1; #else return -1; #endif + + case _SC_REALTIME_SIGNALS: +#ifdef _POSIX_REALTIME_SIGNALS + return 1; +#else + return -1; +#endif + + case _SC_PRIORITY_SCHEDULING: +#ifdef _POSIX_PRIORITY_SCHEDULING + return 1; +#else + return -1; +#endif + + case _SC_TIMERS: +#ifdef _POSIX_TIMERS + return 1; +#else + return -1; +#endif + + case _SC_ASYNCHRONOUS_IO: +#ifdef _POSIX_ASYNCHRONOUS_IO + return 1; +#else + return -1; +#endif + + case _SC_PRIORITIZED_IO: +#ifdef _POSIX_PRIORITIZED_IO + return 1; +#else + return -1; +#endif + + case _SC_SYNCHRONIZED_IO: +#ifdef _POSIX_SYNCHRONIZED_IO + return 1; +#else + return -1; +#endif + + case _SC_FSYNC: +#ifdef _POSIX_FSYNC + return 1; +#else + return -1; +#endif + + case _SC_MAPPED_FILES: +#ifdef _POSIX_MAPPED_FILES + return 1; +#else + return -1; +#endif + + case _SC_MEMLOCK: +#ifdef _POSIX_MEMLOCK + return 1; +#else + return -1; +#endif + + case _SC_MEMLOCK_RANGE: +#ifdef _POSIX_MEMLOCK_RANGE + return 1; +#else + return -1; +#endif + + case _SC_MEMORY_PROTECTION: +#ifdef _POSIX_MEMORY_PROTECTION + return 1; +#else + return -1; +#endif + + case _SC_MESSAGE_PASSING: +#ifdef _POSIX_MESSAGE_PASSING + return 1; +#else + return -1; +#endif + + case _SC_SEMAPHORES: +#ifdef _POSIX_SEMAPHORES + return 1; +#else + return -1; +#endif + + case _SC_SHARED_MEMORY_OBJECTS: +#ifdef _POSIX_SHARED_MEMORY_OBJECTS + return 1; +#else + return -1; +#endif + case _SC_VERSION: return _POSIX_VERSION; @@ -152,6 +252,12 @@ DEFUN(__sysconf, (name), int name) return -1; #endif + case _SC_CHARCLASS_NAME_MAX: +#ifdef CHARCLASS_NAME_MAX + return CHARCLASS_NAME_MAX; +#else + return -1; +#endif case _SC_2_VERSION: /* This is actually supposed to return the version diff --git a/sysdeps/stub/sysconf.c b/sysdeps/stub/sysconf.c index bb4eb87..fc9ee84 100644 --- a/sysdeps/stub/sysconf.c +++ b/sysdeps/stub/sysconf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1993, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1993, 1995, 1996 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 @@ -43,6 +43,20 @@ DEFUN(__sysconf, (name), int name) case _SC_OPEN_MAX: case _SC_JOB_CONTROL: case _SC_SAVED_IDS: + case _SC_REALTIME_SIGNALS: + case _SC_PRIORITY_SCHEDULING: + case _SC_TIMERS: + case _SC_ASYNCHRONOUS_IO: + case _SC_PRIORITIZED_IO: + case _SC_SYNCHRONIZED_IO: + case _SC_FSYNC: + case _SC_MAPPED_FILES: + case _SC_MEMLOCK: + case _SC_MEMLOCK_RANGE: + case _SC_MEMORY_PROTECTION: + case _SC_MESSAGE_PASSING: + case _SC_SEMAPHORES: + case _SC_SHARED_MEMORY_OBJECTS: case _SC_VERSION: case _SC_BC_BASE_MAX: @@ -53,6 +67,7 @@ DEFUN(__sysconf, (name), int name) case _SC_EXPR_NEST_MAX: case _SC_LINE_MAX: case _SC_RE_DUP_MAX: + case _SC_CHARCLASS_NAME_MAX: case _SC_2_VERSION: case _SC_2_C_BIND: case _SC_2_C_DEV: diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist index d6124bd..e6505c0 100644 --- a/sysdeps/unix/sysv/linux/Dist +++ b/sysdeps/unix/sysv/linux/Dist @@ -1,3 +1,4 @@ sys/socketcall.h +sys/sysctl.h sys/timex.h nfs/nfs.h diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index c33a190..4d484ab 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -15,7 +15,7 @@ sysdep_routines += fxstat lxstat xstat endif ifeq ($(subdir), misc) -sysdep_routines += xmknod s_ptrace +sysdep_routines += xmknod s_ptrace s_sysctl sysctl headers += sys/mount.h endif @@ -36,4 +36,3 @@ rtld-installed-name = ld-gnu.so.1 # Don't compile the ctype glue code, since there is no old non-GNU C library. inhibit-glue = yes - diff --git a/sysdeps/unix/sysv/linux/sys/mman.h b/sysdeps/unix/sysv/linux/sys/mman.h index 3336154..5c59095 100644 --- a/sysdeps/unix/sysv/linux/sys/mman.h +++ b/sysdeps/unix/sysv/linux/sys/mman.h @@ -1,5 +1,5 @@ /* Definitions for BSD-style memory management. Linux version. -Copyright (C) 1994, 1995 Free Software Foundation, Inc. +Copyright (C) 1994, 1995, 1996 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 @@ -88,6 +88,14 @@ int mlock __P ((__caddr_t __addr, size_t __len)); /* Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). */ int munlock __P ((__caddr_t __addr, size_t __len)); +/* Remap pages mapped by the range [ADDR,ADDR+OLD_LEN) to new length + NEW_LEN. If MAY_MOVE is MREMAP_MAXMOVE the returned address may + differ from ADDR. */ +__caddr_t __mremap __P ((__caddr_t __addr, size_t __old_len, size_t __new_len, + int __may_move)); +__caddr_t mremap __P ((__caddr_t __addr, size_t __old_len, size_t __new_len, + int __may_move)); + __END_DECLS diff --git a/sysdeps/unix/sysv/linux/sys/socket.h b/sysdeps/unix/sysv/linux/sys/socket.h new file mode 100644 index 0000000..b3e8fe8 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sys/socket.h @@ -0,0 +1,2 @@ +#include <linux/socket.h> +#include <linux/socket.h> diff --git a/sysdeps/unix/sysv/linux/sys/sysctl.h b/sysdeps/unix/sysv/linux/sys/sysctl.h new file mode 100644 index 0000000..1ec768f --- /dev/null +++ b/sysdeps/unix/sysv/linux/sys/sysctl.h @@ -0,0 +1,36 @@ +/* Copyright (C) 1996 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_SYSCTL_H +#define _SYS_SYSCTL_H 1 + +#include <features.h> + +__BEGIN_DECLS + +#define __need_size_t +#include <stddef.h> +#include <linux/sysctl.h> + +/* Read or write system parameters. */ +extern int sysctl __P ((int *__name, int __nlen, void *__oldval, + size_t *__oldlenp, void *__newval, size_t __newlen)); + +__END_DECLS + +#endif /* sys/sysctl.h */ diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index 42d3e7e..6deee59 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -13,6 +13,7 @@ ipc msgget ipc 5 __ipc mlock - mlock 2 __mlock mlock mlockall - mlockall 1 __mlockall mlockall mount - mount 5 __mount mount +mremap - mremap 4 __mremap mremap munlock - munlock 2 __munlock munlock munlockall - munlockall 0 __munlockall munlockall nanosleep - nanosleep 2 nanosleep @@ -32,5 +33,6 @@ sched_rr_gi - sched_rr_get_interval 2 __sched_rr_get_interval sched_rr_get_inter setpgid - setpgid 2 setpgid sigpending - sigpending 1 sigpending sigprocmask - sigprocmask 3 __sigprocmask sigprocmask +s_sysctl sysctl _sysctl 1 __syscall__sysctl umount - umount 1 __umount umount wait4 - wait4 4 __wait4 wait4 diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c index 33640c5..d658165 100644 --- a/sysdeps/unix/sysv/linux/sysconf.c +++ b/sysdeps/unix/sysv/linux/sysconf.c @@ -251,6 +251,12 @@ DEFUN(__sysconf, (name), int name) return -1; #endif + case _SC_CHARCLASS_NAME_MAX: +#ifdef CHARCLASS_NAME_MAX + return CHARCLASS_NAME_MAX; +#else + return -1; +#endif case _SC_2_VERSION: /* This is actually supposed to return the version diff --git a/sysdeps/unix/sysv/linux/sysctl.c b/sysdeps/unix/sysv/linux/sysctl.c new file mode 100644 index 0000000..d2a0b2b --- /dev/null +++ b/sysdeps/unix/sysv/linux/sysctl.c @@ -0,0 +1,40 @@ +/* sysctl - Read or write system information. Linux version. +Copyright (C) 1996 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. */ + +#include <sys/sysctl.h> + + +extern int __syscall__sysctl (struct __sysctl_args *args); + +int +sysctl (int *name, int nlen, void *oldval, size_t *oldlenp, + void *newval, size_t newlen) +{ + struct __sysctl_args args = + { + name: name, + nlen: nlen, + oldval: oldval, + oldlenp: oldlenp, + newval: newval, + newlen: newlen + }; + + return __syscall__sysctl (&args); +} diff --git a/sysdeps/unix/sysv/sysv4/sysconf.c b/sysdeps/unix/sysv/sysv4/sysconf.c index 607cd05..9ed5cbc 100644 --- a/sysdeps/unix/sysv/sysv4/sysconf.c +++ b/sysdeps/unix/sysv/sysv4/sysconf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. Contributed by Brendan Kehoe (brendan@zen.org). The GNU C Library is free software; you can redistribute it and/or @@ -74,12 +74,112 @@ DEFUN(__sysconf, (name), int name) #else return -1; #endif + case _SC_SAVED_IDS: #ifdef _POSIX_SAVED_IDS return 1; #else return -1; #endif + + case _SC_REALTIME_SIGNALS: +#ifdef _POSIX_REALTIME_SIGNALS + return 1; +#else + return -1; +#endif + + case _SC_PRIORITY_SCHEDULING: +#ifdef _POSIX_PRIORITY_SCHEDULING + return 1; +#else + return -1; +#endif + + case _SC_TIMERS: +#ifdef _POSIX_TIMERS + return 1; +#else + return -1; +#endif + + case _SC_ASYNCHRONOUS_IO: +#ifdef _POSIX_ASYNCHRONOUS_IO + return 1; +#else + return -1; +#endif + + case _SC_PRIORITIZED_IO: +#ifdef _POSIX_PRIORITIZED_IO + return 1; +#else + return -1; +#endif + + case _SC_SYNCHRONIZED_IO: +#ifdef _POSIX_SYNCHRONIZED_IO + return 1; +#else + return -1; +#endif + + case _SC_FSYNC: +#ifdef _POSIX_FSYNC + return 1; +#else + return -1; +#endif + + case _SC_MAPPED_FILES: +#ifdef _POSIX_MAPPED_FILES + return 1; +#else + return -1; +#endif + + case _SC_MEMLOCK: +#ifdef _POSIX_MEMLOCK + return 1; +#else + return -1; +#endif + + case _SC_MEMLOCK_RANGE: +#ifdef _POSIX_MEMLOCK_RANGE + return 1; +#else + return -1; +#endif + + case _SC_MEMORY_PROTECTION: +#ifdef _POSIX_MEMORY_PROTECTION + return 1; +#else + return -1; +#endif + + case _SC_MESSAGE_PASSING: +#ifdef _POSIX_MESSAGE_PASSING + return 1; +#else + return -1; +#endif + + case _SC_SEMAPHORES: +#ifdef _POSIX_SEMAPHORES + return 1; +#else + return -1; +#endif + + case _SC_SHARED_MEMORY_OBJECTS: +#ifdef _POSIX_SHARED_MEMORY_OBJECTS + return 1; +#else + return -1; +#endif + case _SC_VERSION: return _POSIX_VERSION; @@ -142,6 +242,12 @@ DEFUN(__sysconf, (name), int name) return -1; #endif + case _SC_CHARCLASS_NAME_MAX: +#ifdef CHARCLASS_NAME_MAX + return CHARCLASS_NAME_MAX; +#else + return -1; +#endif case _SC_2_VERSION: /* This is actually supposed to return the version diff --git a/sysvipc/Makefile b/sysvipc/Makefile index 7cedab6..2e9471b 100644 --- a/sysvipc/Makefile +++ b/sysvipc/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1995 Free Software Foundation, Inc. +# Copyright (C) 1995, 1996 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,8 @@ subdir := sysvipc headers := sys/ipc.h sys/msg.h sys/sem.h sys/shm.h \ sys/ipc_buf.h sys/msq_buf.h sys/sem_buf.h sys/shm_buf.h -routines := msgsnd msgrcv msgget msgctl \ +routines := ftok \ + msgsnd msgrcv msgget msgctl \ semop semget semctl \ shmat shmdt shmget shmctl diff --git a/sysvipc/ftok.c b/sysvipc/ftok.c index 4ecc3e6..20d98b9 100644 --- a/sysvipc/ftok.c +++ b/sysvipc/ftok.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. @@ -31,7 +31,7 @@ ftok (pathname, proj_id) if (__stat (pathname, &st) < 0) return (key_t) -1; - key = (st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16) | (id << 24); + key = (st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16) | (proj_id << 24); return key; } diff --git a/time/strftime.c b/time/strftime.c index 02f72b3..8c5e0cb 100644 --- a/time/strftime.c +++ b/time/strftime.c @@ -31,7 +31,17 @@ Cambridge, MA 02139, USA. */ #include <stdio.h> #include <sys/types.h> /* Some systems define `time_t' here. */ -#include <time.h> + +#ifdef TIME_WITH_SYS_TIME +# include <sys/time.h> +# include <time.h> +#else +# ifdef HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif #if HAVE_MBLEN # include <ctype.h> diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile index 99d9dd5..f713892 100644 --- a/wcsmbs/Makefile +++ b/wcsmbs/Makefile @@ -22,11 +22,26 @@ subdir := wcsmbs headers := wchar.h +distribute := wcwidth.h routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \ wcsncmp wcsncpy wcspbrk wcsrchr wcsspn wcstok wcsstr wmemchr \ - wmemcmp wmemcpy wmemmove wmemset \ + wmemcmp wmemcpy wmemmove wmemset wcpcpy wcpncpy \ btowc wctob mbsinit \ - mbrlen mbrtowc wcrtomb mbsrtowcs wcsrtombs + mbrlen mbrtowc wcrtomb mbsrtowcs wcsrtombs \ + wcstol wcstoul wcstoq wcstouq wcstod wcstold wcstof \ + wcscoll wcsxfrm \ + wcwidth wcswidth include ../Rules + +CFLAGS-wcwidth.c = -I../wctype +CFLAGS-wcswidth.c = -I../wctype + +CFLAGS-wcstol.c = -I../stdlib +CFLAGS-wcstoul.c = -I../stdlib +CFLAGS-wcstoq.c = -I../stdlib +CFLAGS-wcstouq.c = -I../stdlib +CFLAGS-wcstod.c = -I../stdlib +CFLAGS-wcstold.c = -I../stdlib +CFLAGS-wcstof.c = -I../stdlib diff --git a/wcsmbs/mbscmp.c b/wcsmbs/mbscmp.c deleted file mode 100644 index 04f6f47..0000000 --- a/wcsmbs/mbscmp.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright (C) 1995 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., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include <mbstr.h> -#include <stdlib.h> - -#define __need_wchar_t -/* FIXME: should be defined in stddef.h. -!!! #define __need_uwchar_t */ -typedef unsigned int uwchar_t; -#include <stddef.h> - - -/* Compare MBS1 and MBS2. */ -int -mbscmp (mbs1, mbs2) - const char *mbs1; - const char *mbs2; -{ - int len1 = 0; - int len2 = 0; - uwchar_t c1; - uwchar_t c2; - - /* Reset multibyte characters to their initial state. */ - (void) mblen ((char *) NULL, 0); - - do - { - len1 = mbtowc ((wchar_t *) &c1, mbs1, MB_CUR_MAX); - len2 = mbtowc ((wchar_t *) &c2, mbs2, MB_CUR_MAX); - - if (len1 == 0) - return len2 == 0 ? 0 : -1; - if (len2 == 0) - return 1; - if (len1 < 0 || len2 < 0) - /* FIXME: an illegal character appears. What to do? */ - return c1 - c2; - - mbs1 += len1; - mbs2 += len2; - } - while (c1 == c2); - - return c1 - c2; -} - diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h index 69ad2d3..2292bd8 100644 --- a/wcsmbs/wchar.h +++ b/wcsmbs/wchar.h @@ -59,8 +59,12 @@ typedef int mbstate_t; /* FIXME */ hold any value corresponding to members of the extended character set, as well as at least one value that does not correspond to any member of the extended character set. */ +#ifndef __have_wint_t_defined +#define __have_wint_t_defined 1 +/* This is a hack!!! */ typedef unsigned int wint_t; #endif +#endif /* Copy SRC to DEST. */ @@ -81,6 +85,14 @@ extern int wcscmp __P ((__const wchar_t *__s1, __const wchar_t *__s2)); extern int wcsncmp __P ((__const wchar_t *__s1, __const wchar_t *__s2, size_t __n)); +/* Compare S1 and S2, both interpreted as appropriate to the + LC_COLLATE category of the current locale. */ +extern int wcscoll __P ((__const wchar_t *__s1, __const wchar_t *__s2)); +/* Transform S2 into array pointed to by S1 such that if wcscmp is + applied to two transformed strings the result is the as applying + `wcscoll' to the original strings. */ +extern size_t wcsxfrm __P ((wchar_t *__s1, __const wchar_t *__s2, size_t __n)); + /* Duplicate S, returning an identical malloc'd string. */ extern wchar_t *wcsdup __P ((__const wchar_t *__s)); @@ -163,6 +175,127 @@ extern size_t mbsrtowcs __P ((wchar_t *__dst, __const char **__src, extern size_t wcsrtombs __P ((char *__dst, __const wchar_t **__src, size_t __len, mbstate_t *__ps)); + +#ifdef __USE_GNU +/* The following functions are extensions found in X/Open CAE. */ + +/* Determine number of column positions required for C. */ +extern int wcwidth __P ((wint_t __c)); + +/* Determine number of column positions required for first N wide + characters (or fewer if S ends before this) in S. */ +extern int wcswidth __P ((__const wchar_t *__s, size_t __n)); +#endif /* use GNU */ + + +/* Convert initial portion of the wide string NPTR to `double' + representation. */ +extern double wcstod __P ((__const wchar_t *__nptr, wchar_t **__endptr)); + +#ifdef USE_GNU +/* Likewise for `float' and `long double' sizes of floating-point numbers. */ +extern float wcstof __P ((__const wchar_t *__nptr, wchar_t **__endptr)); +extern __long_double_t wcstold __P ((__const wchar_t *__nptr, + wchar_t **__endptr)); +#endif /* GNU */ + + +/* Convert initial portion of wide string NPTR to `long int' + representation. */ +extern long int wcstol __P ((__const wchar_t *__nptr, wchar_t **__endptr, + int __base)); + +/* Convert initial portion of wide string NPTR to `unsigned long int' + representation. */ +extern unsigned long int wcstoul __P ((__const wchar_t *__nptr, + wchar_t **__endptr, int __base)); + +#if defined (__GNUC__) && defined (__USE_GNU) +/* Convert initial portion of wide string NPTR to `long int' + representation. */ +extern long long int wcstoq __P ((__const wchar_t *__nptr, wchar_t **__endptr, + int __base)); + +/* Convert initial portion of wide string NPTR to `unsigned long long int' + representation. */ +extern unsigned long long int wcstouq __P ((__const wchar_t *__nptr, + wchar_t **__endptr, int __base)); +#endif /* GCC and use GNU. */ + + +/* The internal entry points for `wcstoX' take an extra flag argument + saying whether or not to parse locale-dependent number grouping. */ +extern double __wcstod_internal __P ((__const wchar_t *__nptr, + wchar_t **_endptr, int __group)); +extern float __wcstof_internal __P ((__const wchar_t *__nptr, + wchar_t **_endptr, int __group)); +extern __long_double_t __wcstold_internal __P ((__const wchar_t *__nptr, + wchar_t **_endptr, + int __group)); + +extern long int __wcstol_internal __P ((__const wchar_t *__nptr, + wchar_t **__endptr, int __base, + int __group)); +extern unsigned long int __wcstoul_internal __P ((__const wchar_t *__nptr, + wchar_t **__endptr, + int __base, int __group)); +#ifdef __GNUC__ +extern long long int __wcstoq_internal __P ((__const wchar_t *__nptr, + wchar_t **__endptr, int __base, + int __group)); +extern unsigned long long int __wcstouq_internal __P ((__const wchar_t *__nptr, + wchar_t **__endptr, + int __base, + int __group)); +#endif /* GCC */ + + +#if defined (__OPTIMIZE__) && __GNUC__ >= 2 +/* Define inline functions which call the internal entry points. */ + +extern __inline double wcstod (__const wchar_t *__nptr, wchar_t **__endptr) +{ return __wcstod_internal (__nptr, __endptr, 0); } +extern __inline long int wcstol (__const wchar_t *__nptr, + wchar_t **__endptr, int __base) +{ return __wcstol_internal (__nptr, __endptr, __base, 0); } +extern __inline unsigned long int wcstoul (__const wchar_t *__nptr, + wchar_t **__endptr, int __base) +{ return __wcstoul_internal (__nptr, __endptr, __base, 0); } + +#ifdef __USE_GNU +extern __inline float wcstof (__const wchar_t *__nptr, wchar_t **__endptr) +{ return __wcstof_internal (__nptr, __endptr, 0); } +extern __inline __long_double_t wcstold (__const wchar_t *__nptr, + wchar_t **__endptr) +{ return __wcstold_internal (__nptr, __endptr, 0); } +#endif + +#ifdef __USE_BSD +extern __inline long long int wcstoq (__const wchar_t *__nptr, + wchar_t **__endptr, int __base) +{ return __wcstoq_internal (__nptr, __endptr, __base, 0); } +extern __inline unsigned long long int wcstouq (__const wchar_t *__nptr, + wchar_t **__endptr, int __base) +{ return __wcstouq_internal (__nptr, __endptr, __base, 0); } +#endif +#endif /* Optimizing GCC >=2. */ + + +#ifdef __USE_GNU +/* Copy SRC to DEST, returning the address of the terminating L'\0' in + DEST. */ +extern wchar_t *__wcpcpy __P ((wchar_t *__dest, __const wchar_t *__src)); +extern wchar_t *wcpcpy __P ((wchar_t *__dest, __const wchar_t *__src)); + +/* Copy no more than N characters of SRC to DEST, returning the address of + the last character written into DEST. */ +extern wchar_t *__wcpncpy __P ((wchar_t *__dest, __const wchar_t *__src, + size_t __n)); +extern wchar_t *wcpncpy __P ((wchar_t *__dest, __const wchar_t *__src, + size_t __n)); +#endif /* use GNU */ + + __END_DECLS #endif /* wchar.h */ diff --git a/wcsmbs/wcpcpy.c b/wcsmbs/wcpcpy.c new file mode 100644 index 0000000..2fe5985 --- /dev/null +++ b/wcsmbs/wcpcpy.c @@ -0,0 +1,47 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996. + +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. */ + +#include <wchar.h> + +#define __need_ptrdiff_t +#include <stddef.h> + + +/* Copy SRC to DEST, returning the address of the terminating L'\0' in + DEST. */ +wchar_t * +__wcpcpy (dest, src) + wchar_t *dest; + const wchar_t *src; +{ + wchar_t *wcp = (wchar_t *) dest - 1; + wint_t c; + const ptrdiff_t off = src - dest + 1; + + do + { + c = wcp[off]; + *++wcp = c; + } + while (c != L'\0'); + + return wcp; +} + +weak_alias (__wcpcpy, wcpcpy) diff --git a/wcsmbs/wcpncpy.c b/wcsmbs/wcpncpy.c new file mode 100644 index 0000000..2ff7abf --- /dev/null +++ b/wcsmbs/wcpncpy.c @@ -0,0 +1,89 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. + +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. */ + +#include <wchar.h> + + +/* Copy no more than N wide-characters of SRC to DEST, returning the + address of the last character written into DEST. */ +wchar_t * +__wcpncpy (dest, src, n) + wchar_t *dest; + const wchar_t *src; + size_t n; +{ + wint_t c; + wchar_t *const s = dest; + + --dest; + + if (n >= 4) + { + size_t n4 = n >> 2; + + for (;;) + { + c = *src++; + *++dest = c; + if (c == L'\0') + break; + c = *src++; + *++dest = c; + if (c == L'\0') + break; + c = *src++; + *++dest = c; + if (c == L'\0') + break; + c = *src++; + *++dest = c; + if (c == L'\0') + break; + if (--n4 == 0) + goto last_chars; + } + n = n - (dest - s) - 1; + if (n == 0) + return dest; + goto zero_fill; + } + + last_chars: + n &= 3; + if (n == 0) + return dest; + + do + { + c = *src++; + *++dest = c; + if (--n == 0) + return dest; + } + while (c != L'\0'); + + zero_fill: + do + *++dest = L'\0'; + while (--n > 0); + + return dest; +} + +weak_alias (__wcpncpy, wcpncpy) diff --git a/wcsmbs/wcscoll.c b/wcsmbs/wcscoll.c new file mode 100644 index 0000000..e033b4a --- /dev/null +++ b/wcsmbs/wcscoll.c @@ -0,0 +1,26 @@ +/* Copyright (C) 1996 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. */ + +#include <wchar.h> + +#define STRING_TYPE wchar_t +#define USTRING_TYPE uwchar_t +#define STRCOLL wcscoll +#define STRCMP wcscmp + +#include "../string/strcoll.c" diff --git a/wcsmbs/wcscpy.c b/wcsmbs/wcscpy.c index 3aa897e..469134e 100644 --- a/wcsmbs/wcscpy.c +++ b/wcsmbs/wcscpy.c @@ -1,6 +1,6 @@ /* Copyright (C) 1995, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. -Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu> +Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. 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 @@ -30,7 +30,7 @@ wcscpy (dest, src) const wchar_t *src; { wchar_t *wcp = (wchar_t *) src; - wchar_t c; + wint_t c; const ptrdiff_t off = dest - src - 1; do @@ -42,4 +42,3 @@ wcscpy (dest, src) return dest; } - diff --git a/wcsmbs/wcsncpy.c b/wcsmbs/wcsncpy.c index 180da79..ffa791a 100644 --- a/wcsmbs/wcsncpy.c +++ b/wcsmbs/wcsncpy.c @@ -1,6 +1,6 @@ /* Copyright (C) 1995, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. -Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu> +Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. 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 @@ -27,7 +27,7 @@ wcsncpy (dest, src, n) const wchar_t *src; size_t n; { - wchar_t c; + wint_t c; wchar_t *const s = dest; --dest; diff --git a/wcsmbs/wcstod.c b/wcsmbs/wcstod.c new file mode 100644 index 0000000..9a77c8c --- /dev/null +++ b/wcsmbs/wcstod.c @@ -0,0 +1,25 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996. + +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. */ + + +/* The actual implementation for all floating point sizes is in strtod.c. */ + +#define USE_WIDE_CHAR 1 + +#include "strtod.c" diff --git a/wcsmbs/wcstof.c b/wcsmbs/wcstof.c new file mode 100644 index 0000000..4cccdf0 --- /dev/null +++ b/wcsmbs/wcstof.c @@ -0,0 +1,31 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996. + +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. */ + + +/* The actual implementation for all floating point sizes is in strtod.c. + These macros tell it to produce the `float' version, `wcstof'. */ + +#define FLOAT float +#define FLT LDBL +#define STRTOF wcstof +#define MPN2FLOAT __mpn_construct_float +#define FLOAT_HUGE_VAL HUGE_VALf +#define USE_WIDE_CHAR 1 + +#include "strtod.c" diff --git a/wcsmbs/wcstol.c b/wcsmbs/wcstol.c new file mode 100644 index 0000000..a1d877e --- /dev/null +++ b/wcsmbs/wcstol.c @@ -0,0 +1,22 @@ +/* wcstol - Function to parse a `long int' from text. +Copyright (C) 1996 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. */ + +#define USE_WIDE_CHAR 1 + +#include "strtol.c" diff --git a/wcsmbs/wcstold.c b/wcsmbs/wcstold.c new file mode 100644 index 0000000..b19a48e --- /dev/null +++ b/wcsmbs/wcstold.c @@ -0,0 +1,31 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996. + +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. */ + + +/* The actual implementation for all floating point sizes is in strtod.c. + These macros tell it to produce the `long double' version, `wcstold'. */ + +#define FLOAT long double +#define FLT LDBL +#define STRTOF wcstold +#define MPN2FLOAT __mpn_construct_long_double +#define FLOAT_HUGE_VAL HUGE_VALl +#define USE_WIDE_CHAR 1 + +#include "strtod.c" diff --git a/wcsmbs/wcstoq.c b/wcsmbs/wcstoq.c new file mode 100644 index 0000000..cc66e92 --- /dev/null +++ b/wcsmbs/wcstoq.c @@ -0,0 +1,22 @@ +/* wcstoq - Function to parse a `long long int' from text. +Copyright (C) 1996 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. */ + +#define QUAD 1 + +#include "wcstol.c" diff --git a/wcsmbs/wcstoul.c b/wcsmbs/wcstoul.c new file mode 100644 index 0000000..e345ca8 --- /dev/null +++ b/wcsmbs/wcstoul.c @@ -0,0 +1,22 @@ +/* wcstoul - Function to parse an `unsigned long int' from text. +Copyright (C) 1996 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. */ + +#define UNSIGNED 1 + +#include "wcstol.c" diff --git a/wcsmbs/wcstouq.c b/wcsmbs/wcstouq.c new file mode 100644 index 0000000..c50d9be --- /dev/null +++ b/wcsmbs/wcstouq.c @@ -0,0 +1,22 @@ +/* wcstouq - Function to parse an `unsigned long long int' from text. +Copyright (C) 1996 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. */ + +#define QUAD 1 + +#include "wcstoul.c" diff --git a/wcsmbs/wcswidth.c b/wcsmbs/wcswidth.c new file mode 100644 index 0000000..ae074f2 --- /dev/null +++ b/wcsmbs/wcswidth.c @@ -0,0 +1,39 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edi>, 1996. + +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. */ + +#include "wcwidth.h" + +/* Determine number of column positions required for first N wide + characters (or fewer if S ends before this) in S. */ +int +wcswidth (const wchar_t *s, size_t n) +{ + int result = 0; + + while (n > 0 && *s != L'\0') + { + int now = internal_wcwidth (*s); + if (now == -1) + return -1; + result += now; + ++s; + } + + return result; +} diff --git a/wcsmbs/wcsxfrm.c b/wcsmbs/wcsxfrm.c new file mode 100644 index 0000000..96a3238 --- /dev/null +++ b/wcsmbs/wcsxfrm.c @@ -0,0 +1,27 @@ +/* Copyright (C) 1996 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. */ + +#include <wchar.h> + +#define STRING_TYPE wchar_t +#define USTRING_TYPE uwchar_t +#define STRXFRM wcsxfrm +#define STRLEN wcslen +#define STPNCPY __wcpncpy + +#include "../string/strxfrm.c" diff --git a/wcsmbs/wcwidth.c b/wcsmbs/wcwidth.c new file mode 100644 index 0000000..5c7f8b6 --- /dev/null +++ b/wcsmbs/wcwidth.c @@ -0,0 +1,27 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edi>, 1996. + +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. */ + +#include "wcwidth.h" + +/* Determine number of column positions required for CH. */ +int +wcwidth (wint_t ch) +{ + return internal_wcwidth (ch); +} diff --git a/wcsmbs/wcwidth.h b/wcsmbs/wcwidth.h new file mode 100644 index 0000000..3e60d49 --- /dev/null +++ b/wcsmbs/wcwidth.h @@ -0,0 +1,40 @@ +/* Internal header containing implementation of wcwidth() function. +Copyright (C) 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edi>, 1996. + +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. */ + +#include <wchar.h> +#include "cname-lookup.h" + +/* Array containing width information. */ +extern unsigned char *__ctype_width; + +static __inline int +internal_wcwidth (wint_t ch) +{ + size_t idx; + + if (ch == L'\0') + return 0; + + idx = cname_lookup (ch); + if (idx == ~((size_t) 0)) + return -1; + + return (int) __ctype_width[idx]; +} diff --git a/wctype.h b/wctype.h new file mode 100644 index 0000000..c76f50c --- /dev/null +++ b/wctype.h @@ -0,0 +1 @@ +#include <wctype/wctype.h> diff --git a/wctype/wctype.c b/wctype/wctype.c index 0f7e478..c3bb1d9 100644 --- a/wctype/wctype.c +++ b/wctype/wctype.c @@ -45,12 +45,6 @@ wctype (const char *property) # define SWAPU32(w) \ (((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24)) -# define SWAPU16(w) \ - (((w) >> 8) | ((w) << 8)) - - if (sizeof (wctype_t) == 4) - return SWAPU32 (result); - else - return SWAPU16 (result); + return SWAPU32 (result); #endif } diff --git a/wctype/wctype.h b/wctype/wctype.h index 7e90e2b..cabbc67 100644 --- a/wctype/wctype.h +++ b/wctype/wctype.h @@ -38,8 +38,12 @@ __BEGIN_DECLS hold any value corresponding to members of the extended character set, as well as at least one value that does not correspond to any member of the extended character set. */ +#ifndef __have_wint_t_defined +#define __have_wint_t_defined 1 +/* This is a hack!!! */ typedef unsigned int wint_t; #endif +#endif /* Scalar type that can hold values which represent locale-specific character mappings. */ @@ -47,13 +51,7 @@ typedef const unsigned int *wctrans_t; /* Scalar type that can hold values which represent locale-specific character classifications. */ -#if 0 typedef unsigned long int wctype_t; -#else -/* For compatibility reasons we have to use shorts for now. */ -typedef unsigned short int wctype_t; -#endif - /* Constant expression of type `wint_t' whose value does not correspond to any member of the extended character set. */ |