Compare commits

...
Author SHA1 Message Date
Miles Bader e2a501ab7c *** empty log message ***
Wed Apr 10 14:13:45 1996  Miles Bader  <miles@gnu.ai.mit.edu>

	* hurd/sigunwind.c (_hurdsig_longjmp_from_handler): Store
 	MACH_PORT_DEAD in the thread reply-port variable before destroying
 	the signal handler's reply port, to avoid infinite recursion.
1996-04-10 18:36:39 +00:00
Miles Bader 574ce5e4e4 (_hurdsig_longjmp_from_handler): Store MACH_PORT_DEAD in the thread reply-port variable before destroying the signal handler's reply port, to avoid infinite recursion. 1996-04-10 18:36:02 +00:00
Roland McGrath b84095feb4 Mon Apr 8 18:27:17 1996 Miles Bader <miles@gnu.ai.mit.edu>
* sysdeps/mach/gettimeofday.c (__gettimeofday): Don't fail if the
	user passes in TZ, just zero it (emacs passes in a dummy variable,
	and rms says the hurd should be the one to change).
1996-04-09 09:02:55 +00:00
Miles Bader a1a5fa67c6 (__gettimeofday): Don't fail if the user passes in TZ, just zero it (emacs passes in a dummy variable, and rms says the hurd should be the one to change). 1996-04-08 23:35:57 +00:00
Michael Meissner 2e6878f7b1 Add Solaris on PowerPC support 1996-04-08 20:19:10 +00:00
Roland McGrath 3125073e10 Sun Apr 7 10:37:30 1996 Roland McGrath <roland@whiz-bang.gnu.ai.mit.edu>
* sysdeps/mach/hurd/fork.c: Don't leak send rights to the child's proc
 	port in the parent.
Fri Apr  5 17:43:41 1996  Miles Bader  <miles@gnu.ai.mit.edu>
1996-04-07 17:44:31 +00:00
Roland McGrath d70576891e * sysdeps/mach/hurd/fork.c (__fork): Don't leak send-rights to the
child's proc port in the parent.
1996-04-06 10:03:22 +00:00
Miles Bader 786db2208e *** empty log message ***
Fri Apr  5 17:43:41 1996  Miles Bader  <miles@gnu.ai.mit.edu>

	* sysdeps/mach/hurd/i386/sigreturn.c (__sigreturn): Store
	MACH_PORT_DEAD in the thread reply-port variable before destroying
	the signal handler's reply port to avoid infinite recursion.
	* sysdeps/mach/hurd/mig-reply.c (__mig_dealloc_reply_port): Only
	attempt to destroy PORT if it's a valid port name.
1996-04-06 01:51:07 +00:00
Miles Bader aa0e1b599c (__mig_dealloc_reply_port): Only attempt to destroy PORT if it's a valid port name. 1996-04-06 01:49:21 +00:00
Roland McGrath 2e516341fa Wed Apr 3 17:10:44 1996 Roland McGrath <roland@whiz-bang.gnu.ai.mit.edu>
* extra-lib.mk: Put libs in $(common-objpfx) instead of $(objpfx).
	* Makerules ($(install-lib) rules): Find libs with $(common-objpfx)
	instead of $(objpfx).
1996-04-04 01:18:10 +00:00
Roland McGrath 299a95b9f0 Tue Apr 2 21:27:01 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* posix/glob.c (glob_pattern_p): Avoid scanning past eos if
	the pattern ends with a backslash and quoting is enabled.
	* posix/fnmatch.c (fnmatch): Likewise; return FNM_NOMATCH for such
 	patterns.
1996-04-03 16:31:49 +00:00
Roland McGrath 30de3b18a5 Mon Apr 1 13:34:55 1996 Roland McGrath <roland@whiz-bang.gnu.ai.mit.edu>
* stdio-common/tst-printf.c (main): Add new test case.

	* sysdeps/generic/setenv.c (unsetenv): Use old-style definition.

Mon Apr  1 11:39:10  Ulrich Drepper  <drepper@gnu.ai.mit.edu>

	* stdlib/strtod.c (STRTOD): Fix handling of American style FP
	numbers.

	* stdio-common/vfprintf.c (vfprintf): Don't increment format
	string pointer twice after seeing `*'.

Sun Mar 31 17:31:54 1996  Roland McGrath  <roland@whiz-bang.gnu.ai.mit.edu>

	* MakeTAGS (po/SYS_libc.pot): Prepend header processed from
 	po/header.pot.

Sun Mar 31 18:07:32 1996  Ulrich Drepper  <drepper@gnu.ai.mit.edu>

	* locale/Makefile (others, install-bin): Compiling locale works
        again.
	(locale-modules): locale has no --dump option anymore.  Remove
	ctypedump.

	* locale/programs/config.h: Don't declare euidaccess.
	Use #include_next to get libc's config.h.

	* locale/programs/ctypedump.c: Not needed anymore.  Dump option
	of locale is removed.

	* locale/programs/locale.c: Adapt for new locale implementation.

	* stdio-common/_itoa.h (_itoa_word): Define as inline function.
	* stdio-common/_itoa.c (_itoa_lower_digits, _itoa_upper_digits):
	Don't declare static because used in _itoa_word inline function.

	* stdio-common/printf-parse.h: Prepare for use in wide-char
	stdio implementation.
	(find_spec): Take additional argument to work with mbrlen instead
	of mblen.
	(parse_one_spec): Ditto.

	* stdio-common/printf-prs.c: Prepare for use in wide-char
	stdio implementation.

	* stdio-common/printf.h: Mark change for wide-char handling.
	Changing it now would result in incompatibilities.

	* stdio-common/vfprintf.c: New and fast implementation.

	* wcsmbs/Makefile (routines): Remove pre-ISO C multibyte functions
	mbsadvance, mbscat, mbschr, mbscmp, mbscpy, mbsdup, mbslen,
	mbsncat, mbsncmp, mbsncpy, mbsrchr, mbstomb.
	Change wcswcs to wcsstr.
	Add wmemchr, wmemcmp, wmemcpy, wmemmove, wmemset, btowc, wctob,
	mbsinit, mbrlen, mbrtowc, wcrtomb, mbsrtowcs, wcsrtombs.

	* wcsmbs/btowc.c, wcsmbs/mbrlen.c, wcsmbs/mbrtowc.c,
        wcsmbs/mbsinit.c, wcsmbs/mbsrtowcs.c, wcsmbs/wchar.h,
        wcsmbs/wcrtomb.c, wcsmbs/wcsrtombs.c, wcsmbs/wcsstr.c,
        wcsmbs/wctob.c, wcsmbs/wmemchr.c, wcsmbs/wmemcmp.c,
        wcsmbs/wmemcpy.c, wcsmbs/wmemmove.c, wcsmbs/wmemset.c: New
        function according to ISO C amendment 1.
	* wchar.h: Wrapper around "wcsmbs/wchar.h".

	* wcsmbs/wcscat.c, wcsmbs/wcschr.c, wcsmbs/wcscmp.c,
        wcsmbs/wcscpy.c, wcsmbs/wcscspn.c, wcsmbs/wcsdup.c,
        wcsmbs/wcslen.c, wcsmbs/wcsncat.c, wcsmbs/wcsncmp.c,
        wcsmbs/wcsncpy.c, wcsmbs/wcspbrk.c, wcsmbs/wcsrchr.c,
        wcsmbs/wcsspn.c, wcsmbs/wcstok.c: Changed to conform with ISO C
        amendment 1.

	* wcsmbs/mbsadvance.c, wcsmbs/mbscat.c, wcsmbs/mbschr.c,
        wcsmbs/mbscmp.c, wcsmbs/mbscpy.c, wcsmbs/mbsdup.c,
        wcsmbs/mbslen.c, wcsmbs/mbsncat.c, wcsmbs/mbsncmp.c,
        wcsmbs/mbsncpy.c, wcsmbs/mbsrchr.c, wcsmbs/mbstomb.c,
        wcsmbs/mbstr.h, wcsmbs/wcstr.h, wcsmbs/wcswcs.c: Removed.
        Implement functions from early drafts, not part of final standard.

Sun Mar 31 16:50:41 1996  Roland McGrath  <roland@whiz-bang.gnu.ai.mit.edu>

	* setjmp/setjmp.h (jmp_buf): Change gratuitous struct tag name to
	__jmp_bug_tag so its C++ implicit typedef does not conflict with the
	__jmp_buf typedef.

	* Makerules (BUILD_CFLAGS) [! objdir]: Use $(..)config.h when
	compiling in the source directories.

Fri Mar 29 16:26:35 1996  Roland McGrath  <roland@whiz-bang.gnu.ai.mit.edu>

	* sysdeps/libm-ieee754/w_gamma.c: Use signgam instead of __signgam.
	* sysdeps/libm-ieee754/s_signgam.c: Undo last change.
1996-04-02 13:27:17 +00:00
Roland McGrath b80510574c Fri Mar 29 11:29:46 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* sysdeps/libm-ieee754/s_signgam.c (signgam): Renamed to __signgam,
	with weak alias signgam.
1996-03-29 21:23:58 +00:00
Roland McGrath 27e00f3f17 Thu Mar 28 18:32:34 1996 Roland McGrath <roland@whiz-bang.gnu.ai.mit.edu>
* Makeconfig (+cflags, +gcc-nowarn): Use gcc flags unconditionally.
1996-03-29 21:19:15 +00:00
Roland McGrath ac157523bd Thu Mar 28 18:32:34 1996 Roland McGrath <roland@whiz-bang.gnu.ai.mit.edu>
* Makeconfig (+cflags, +gcc-nowarn): Use gcc flags unconditionally.
1996-03-29 21:13:27 +00:00
Doug Evans 46a7c97679 (aux): Delete another duplicate entry. 1996-03-29 01:49:55 +00:00
Doug Evans 0daf278545 (aux): Delete duplicate entry. 1996-03-29 01:46:52 +00:00
Roland McGrath b7407d6362 wctype.h mention 1996-03-29 01:04:20 +00:00
Roland McGrath c475b8f594 * sunrpc/rpc_main.c (main): Call textdomain. 1996-03-28 21:00:28 +00:00
Roland McGrath 7a1c652d58 * MakeTAGS (XGETTEXTFLAGS-siglist.pot, XGETTEXTFLAGS-errlist.pot): Add
--no-location.
	(all-pot): Replace $(subdirs) files with $P/subdirs.pot.
	($P/subdirs.pot): New target.
	($P/SYS_libc.pot): Add -n switch.
1996-03-28 20:55:37 +00:00
Roland McGrath a141dd342d * locale/locale.h (LC_*): Values reordered to match Linux libc. 1996-03-28 19:34:47 +00:00
Roland McGrath 8c1442d02f Thu Mar 28 14:22:51 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* sysdeps/mach/hurd/kill.c: If proc_pid2task gives us MACH_PORT_NULL
	the process is a zombie; send no messages and return success.
1996-03-28 19:30:33 +00:00
Roland McGrath 43efc10333 Thu Mar 28 11:53:26 1996 Roland McGrath <roland@whiz-bang.gnu.ai.mit.edu>
* wctype/cname-lookup.h: Find localeinfo.h in ../locale.
	* wctype/wctype.c: Likewise.
	* wctype/wctrans.c: Likewise.
1996-03-28 17:19:40 +00:00
Roland McGrath ffcf96345f Thu Mar 28 03:00:43 1996 Roland McGrath <roland@whiz-bang.gnu.ai.mit.edu>
* locale/nl_langinfo.c (nl_langinfo): Use DATA->values instead of
	DATA->strings.

	* Makerules (BUILD_CFLAGS): Remove $(common-objpfx) from config.h.

	* configure.in (.weakext check): Fix asm code to use .weakext instead
	of .weak!  Fix bogus test calls.
	* configure: Regenerated.
1996-03-28 09:48:58 +00:00
Roland McGrath 0393dfd6c2 * locale/programs/xmalloc.c: Test _LIBC as well as STDC_HEADERS.
* locale/programs/ld-collate.c (collate_finish): Use error_at_line
	instead of error_with_loc.

	* locale/weight.h: Use u_int32_t instead of u32_t.
	* string/strxfrm.c: Likewise.

	* string/strxfrm.c: Find weight.h in ../locale; don't #include
	"localeinfo.h".
	* string/strcoll.c: Likewise.

	* locale/programs/simple-hash.c, locale/programs/simple-hash.h,
 	locale/programs/xmalloc.c, locale/programs/xstrdup.c: Helper functions
 	for locale related programs.
 	locale/programs/charmap.c, locale/programs/charset.c,
 	locale/programs/charset.h, locale/programs/config.h,
 	locale/programs/ctypedump.c, locale/programs/ld-collate.c,
 	locale/programs/ld-ctype.c, locale/programs/ld-messages.c,
 	locale/programs/ld-monetary.c, locale/programs/ld-numeric.c,
 	locale/programs/ld-time.c, locale/programs/linereader.c,
 	locale/programs/linereader.h, locale/programs/locale.c,
 	locale/programs/localedef.c, locale/programs/locales.h,
 	locale/programs/locfile-kw.gperf, locale/programs/locfile-kw.h,
 	locale/programs/locfile-token.h, locale/programs/locfile.c,
 	locale/programs/locfile.h, locale/programs/stringtrans.c,
 	locale/programs/stringtrans.h: Implementation of locale related
 	programs.
1996-03-28 09:16:15 +00:00
Roland McGrath 19bc17a905 Thu Mar 28 03:25:10 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* intl/Makefile (copysrc): Add missing > in sed cmd.

Sat Mar 23 17:52:49 1996  Ulrich Drepper  <drepper@gnu.ai.mit.edu>

	* Makeconfig: Rename Makefile variable nlsdir to i18ndir and
	change value to $(datadir)/i18n.  `nls' is not an appropriate
	name.

	* Makefile (subdirs): Add new subdir wctype.

	* ctype/ctype-info.c: Add new global variable __ctype_names
	and initialize from _nl_C_LC_CTYPE.

	* ctype/ctype.h: In P1003.3b/D11 `alnum' is a separate character
        class.  Use bit 11.
	[_ISbit]: Protect definition of bitmasks because they are also
	used in wctype.h.

	* libio/genops.c (_IO_sputbackc, _IO_sungetc): Clear EOF flag
	after successfully pushing back a character.

	Fundamental changes in locale implementation.  Almost nothing
	from the old code is used anymore.
	* locale/charmap.c, locale/collate.c, locale/config.h,
 	locale/ctypedump.c, locale/hash.h, locale/keyword.gperf,
 	locale/keyword.h, locale/loadlocale.c, locale/locale-ctype.c,
 	locale/locale.c locale/localeconv.c, locale/localedef.c,
 	locale/localedef.h, locale/locfile-hash.c, locale/locfile-lex.c,
 	locale/locfile-parse.c, locale/messages.c, locale/monetary.c,
 	locale/numeric.c, locale/setlocale.c, locale/token.h,
 	locale/xmalloc.c: Removed.

	* locale/Makefile: Update for new locale implementation with
	program source code distributed in subdir.

	* locale/categories.def, locale/iso-4217.def: Updated file
        for new locale implementation.

	* locale/langinfo.h: Updated for new locale implementation.
	(ERA_D_T_FMT, ERA_T_FMT): New official values according to
	P1003.2b/D11.
	(_NL_COLLATE_NRULES, _NL_COLLATE_RULES, _NL_COLLATE_HASH_SIZE,
	_NL_COLLATE_HASH_LAYERS, _NL_COLLATE_TABLE_EB,
	_NL_COLLATE_TABLE_EL, _NL_COLLATE_UNDEFINED, _NL_COLLATE_EXTRA_EB,
	_NL_COLLATE_EXTRA_EL, _NL_CTYPE_NAMES_EB, _NL_CTYPE_NAMES_EL,
	_NL_CTYPE_HASH_SIZE, _NL_CTYPE_HASH_LAYERS, _NL_CTYPE_CLASS_NAMES,
	_NL_CTYPE_MAP_NAMES, _NL_CTYPE_WIDTH): New internal values for
	extended LC_CTYPE and LC_COLLATE implementation.

	* locale/simple-hash.c, locale/simple-hash.h, locale/xmalloc.c,
 	locale/xstrdup.c: Helper functions for locale related programs.

	* locale/C-collate.c, locale/C-ctype.c,
        locale/C-messages.c, locale/C-monetary.c,
        locale/C-numeric.c, locale/C-time.c,
        locale/lc-collate.c, locale/lc-ctype.c,
        locale/lc-messages.c, locale/lc-monetary.c,
        locale/lc-numeric.c, locale/lc-time.c: New implementation of locale
        functions, and new generated "C" locale data.

	* locale/loadlocale.c: Now handles word fields in locale binary
        automatically by changing the endianess if necessary.

	* locale/localeinfo.h (LIMAGIC): Changed magic number because
	of incompatible changes.
	(locale_data): Changed definition to allow word as a value type.
	(coll_sort_rule): Values for collation sorting mode.
	(_NL_CURRENT_WORD): New macro to access word value of locale entry.
	(__collate_table, __collate_extra): Declare new global variables
	for collation tables.

	* locale/programs/charmap-kw.gperf, locale/programs/charmap-kw.h,
        locale/programs/charmap.c, locale/programs/charset.c,
        locale/programs/charset.h, locale/programs/config.h,
        locale/programs/ctypedump.c, locale/programs/ld-collate.c,
        locale/programs/ld-ctype.c, locale/programs/ld-messages.c,
        locale/programs/ld-monetary.c, locale/programs/ld-numeric.c,
        locale/programs/ld-time.c, locale/programs/linereader.c,
        locale/programs/linereader.h, locale/programs/locale.c,
        locale/programs/localedef.c, locale/programs/locales.h,
        locale/programs/locfile-kw.gperf, locale/programs/locfile-kw.h,
        locale/programs/locfile-token.h, locale/programs/locfile.c,
        locale/programs/locfile.h, locale/programs/stringtrans.c,
        locale/programs/stringtrans.h: Implementation of locale related
        programs.

	* locale/weight.h: Functions to access collation tables.

	* posix/unistd.h: Define _POSIX2_LOCALEDEF.

	* stdio-common/printf_fp.c: Fix bug with printing certain numbers
	< 10^-1.  Reported by Bill Metzenthen.

	* stdio-common/tfformat.c: Add new test for above bug.

	* string/strcoll.c, string/strxfrm.c: Real implementation of
        string collation according to ISO C.

	* wctype/Makefile, wctype/cname-lookup.h, wctype/iswctype.c,
        wctype/test_wctype.c, wctype/towctrans.c, wctype/wcfuncs.c,
        wctype/wctrans.c, wctype/wctype.c, wctype/wctype.h: New files.
        Implementation of wide character classes and mapping.
1996-03-28 08:30:38 +00:00
Roland McGrath 53f770e0f9 Wed Mar 27 14:52:11 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* elf/rtld.c (dl_main): Call _dl_sysdep_start_cleanup after
	_dl_relocate_object loop.  Avoid relocating RTLD_MAP in that loop, and
	do it individually if necessary after _dl_sysdep_start_cleanup call.

	* stdlib/Makefile (mpn-routines): Add divrem.

Tue Mar 26 22:54:14  Ulrich Drepper  <drepper@gnu.ai.mit.edu>

	* stdio-common/printf_fp.c (__printf_fp): Use mpn_divmod
	instead of __mpn_divmod.

Wed Mar 27 10:26:21 1996  David Mosberger-Tang  <davidm@azstarnet.com>

	* sysdeps/alpha/setjmp.S: Must establish global pointer before
 	address of __sigsetjmp_aux can be loaded.

Wed Mar 27 02:23:19 1996 Ulrich Drepper <drepper@gnu.ai.mit.edu>

	* sysdeps/i386/i586/memset.S: New file.  Highly optimized
	version for i586 contributed by Torbjorn Granlund.
	Adapted for use as bzero.
	* sysdeps/i386/i586/bzero.S: Use sysdeps/i386/i586/memset.S
	code to implement bzero().

Tue Mar 26 20:01:17 1996  Roland McGrath  <roland@charlie-brown.gnu.ai.mit.edu>

	* stdlib/Makefile (mpn-routines): Remove divmod.
1996-03-27 23:23:59 +00:00
Roland McGrath 3ef987a23c Updated from /src/gmp-1.937 1996-03-27 20:18:04 +00:00
Brendan Kehoe c0621444ed * sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h (NO_UNDERSCORES): Use
wrapped with #ifndef, to avoid config.h defining it.
Tue Mar 26 15:40:14 1996  Brendan Kehoe  <brendan@zen.org>

	* sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h (NO_UNDERSCORES): Use
	wrapped with #ifndef, to avoid config.h defining it.
1996-03-27 00:46:37 +00:00
Roland McGrath 81e4d60c7b * malloc/realloc.c (_realloc_internal): In case of growing large
block, leave _heaplimit zero across _malloc_internal call.
1996-03-25 21:23:16 +00:00
Roland McGrath 5775972dec Mon Mar 25 13:10:04 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* intl/Makefile [gettext-srcdir]: Use gpl2lgpl.sed on copied sources.
1996-03-25 18:10:46 +00:00
Roland McGrath 857fa1b81d Mon Mar 25 03:35:16 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* malloc/malloc.c (morecore): Don't attempt recursive realloc of info
	table when _heaplimit==0 during realloc growing large block.

	* MakeTAGS (extract): Remove /dev/null from xgettext command line.
	(text-srcs): New variable: extract only C sources from $(tags_sources).
	(po/$(domain).pot): Depend on that.
	If it's empty, cp /dev/null $@ instead of $(extract).

	* misc/Makefile (headers): Add iovec.h.
	* sysdeps/unix/sysv/linux/iovec.h: New file.
	* sysdeps/generic/iovec.h: New file.
	* misc/sys/uio.h (struct iovec): Type replaced with #include <iovec.h>.

	* configure.in (NO_UNDERSCORES check): Use AC_TRY_LINK instead of
	AC_TRY_COMPILE.

	* misc/sys/cdefs.h [__USE_BSD] (const, signed, volatile): Move these
	macros inside [! __STDC__].

	* stdlib/rpmatch.c: New file.
	* stdlib/Makefile (routines): Add rpmatch.
	* stdlib/stdlib.h [__USE_SVID]: Declare rpmatch.

	* MakeTAGS (MSGJOIN): Variable removed.
	(po/SYS_libc.pot): Use $(XGETTEXT) instead of $(MSGJOIN).

Wed Mar 20 20:08:46 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysdep.h: Don't define C_SYMBOL_NAME.

	* sysdeps/unix/sysv/linux/m68k/sysdep.h: Don't define
	NO_UNDERSCORES.
1996-03-25 17:48:26 +00:00
Roland McGrath 25c931a18c Contents were duplicated by botched patching. 1996-03-25 06:26:06 +00:00
Doug Evans edc1601c51 (os): sunos[3456] -> sunos[34], sunos[56] have their own entries 1996-03-21 23:26:26 +00:00
Roland McGrath 036a272548 Thu Mar 21 11:19:15 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* mach/devstream.c (input): Translate \r to \n on input.
1996-03-21 16:23:21 +00:00
Roland McGrath ce563359af Wed Mar 20 11:28:49 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* stdio-common/printf.h, stdio-common/printf_fp.c,
	stdio-common/vfprintf.c: Place const in parameter list at
	correct place.

Wed Mar 20 23:58.12 1996  Ulrich Drepper <drepper@gnu.ai.mit.edu>

	* sysdeps/i386/ldbl2mpn.c: Copy of former version of
	sysdeps/ieee754/ldbl2mpn.c.
	* sysdeps/ieee754/ldbl2mpn.c: Remove i386 specific unification.
	Reported by Andreas Schwab.

Wed Mar 20 19:58:43 1996  Roland McGrath  <roland@charlie-brown.gnu.ai.mit.edu>

	* version.c: Include version.h to define RELEASE and VERSION macros.
	(__libc_release, __libc_version): Use them.
	* locale/SYS_libc.c (_libc_intl_domainname): Include ../version.h and
	use VERSION to define domainname as `SYS_GNU_libc-VERSION'.
	* Make-dist (rel+vers): Snarf the macro values from version.h.

	* MakeTAGS (extract): Pass $(XGETTEXTFLAGS-$(@F)).
	(XGETTEXTFLAGS-siglist.pot, XGETTEXTFLAGS-errlist.pot): New variables;
	pass -a for these files.

	* Makerules (po/%.pot): Depend on FORCE target so recursive make is
	always run.
1996-03-21 15:20:37 +00:00
Roland McGrath 38bb44bc19 Mon Mar 18 22:54:32 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/wait3.c: New file.
	* sysdeps/unix/sysv/linux/wait.c: Use the bsd4.4 wait, not the
	one from sysdeps/posix.
1996-03-21 00:37:31 +00:00
Roland McGrath d7193325fc * sysdeps/unix/bsd/waitflags.h (WNOREAP): New macro. 1996-03-20 17:01:27 +00:00
Roland McGrath 948c3e72ec Wed Mar 20 09:42:11 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* elf/dl-load.c (_dl_map_object_from_fd): Always set L->l_type; if not
	lt_executable, then lt_library.
	* elf/rtld.c (dl_main): Don't set NEW->l_type after _dl_map_object.

Wed Mar 20 00:08:23 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysv/linux/syscalls.list: Remove gtty and stty.

Tue Mar 19 16:31:06 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysv/linux/termbits.h (CRTSCTS, CBAUDEX, VEOL,
	VEOL2, VMIN, VTIME): Corrected.
	(PAGEOUT, WRAP, VDSUSP): Deleted.

	* sysdeps/unix/readdir.c: Test [! _DIRENT_HAVE_D_RECLEN] instead of
	(sizeof (DP->d_name) > 1) to detect fixed-size dir entries.
1996-03-20 14:50:57 +00:00
Roland McGrath 213afb94b6 Regenerated
Thu Mar 14 06:01:07 1996  Roland McGrath  <roland@charlie-brown.gnu.ai.mit.edu>

	* posix/glob.c (glob): In GLOB_BRACE brace expansion, fix buffer size
	calculation to include trailing invariant portion.  Don't use alloca;
	instead use a dynamic auto array for GCC, malloc for non-GCC.
	Handle nested braces properly.
1996-03-20 03:12:40 +00:00
Roland McGrath 4d58533340 * sysdeps/i386/fpu/__math.h (asinh): Call log1p instead of __log1p.
* math/math.h: Move M_* constants before __math.h include.
	[__NO_MATH_INLINES || __OPTIMIZE__]: Include __math.h only #if this.

	* misc/efgcvt_r.c (ecvt_r): Declare floor, log10, fabs as weak extern.
	If log10 is not defined (i.e. no -lm), use stupid loop instead.
1996-03-20 00:18:44 +00:00
Roland McGrath d3669add24 * features.h (__FAVOR_BSD): Define only if _BSD_SOURCE is defined
and no other _*_SOURCE macro is.
	(_GNU_SOURCE): Don't define by default.
	* libc-symbols.h (_GNU_SOURCE): Define it.
1996-03-19 21:59:41 +00:00
Roland McGrath c8cf0b14ed * configure.in (alpha*-*-linux*): Unset $gnu_ld and $elf. 1996-03-19 21:23:40 +00:00
Roland McGrath c224a18a90 * config.make.in (weak-symbols): Variable removed.
* configure.in (--with-weak-symbols): Option removed.
	(NO_UNDERSCORES, HAVE_ASM_WEAK_DIRECTIVE, HAVE_ASM_WEAKEXT_DIRECTIVE):
	New tests.
	* config.h.in (HAVE_WEAK_SYMBOLS): #undef removed.
	(NO_UNDERSCORES, HAVE_ASM_WEAK_DIRECTIVE, HAVE_ASM_WEAKEXT_DIRECTIVE):
	New #undefs.
	* libc-symbols.h: Use them instead of HAVE_WEAK_SYMBOLS.

	* inet/inet_lnaof.c: Use u_int32_t instead of u_long.
	* inet/inet_mkadr.c: Likewise.
	* inet/inet_net.c: Likewise.
	* inet/inet_netof.c: Likewise.
	* inet/rcmd.c: Likewise.
	* inet/arpa/inet.h: Likewise.
	* inet/netinet/in.h: Likewise.
	* inet/netinet/tcp.h: Likewise.
	* inet/protocols/rwhod.h: Likewise.
	* inet/protocols/talkd.h: Likewise.
	* resolv/inet_addr.c: Likewise.

	* sunrpc/rpc/xdr.h (IXDR_GET_LONG, IXDR_PUT_LONG): change casts to
 	u_int32_t (instead of u_long).
1996-03-19 21:10:11 +00:00
Roland McGrath b20e47cb14 Tue Mar 19 14:18:42 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* sysdeps/unix/bsd/pause.c: Moved to sysdeps/unix/common/pause.c.

Mon Mar  4 20:17:28 1996  David Mosberger-Tang  <davidm@azstarnet.com>

	* sysdeps/unix/sysv/linux/adjtime.c: Use INT_MAX instead of LONG_MAX.

	* sysdeps/unix/sysv/Makefile (sysdep_routines): Don't add s_getdents.

	* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Don't add mount,
	umount.

	* sysdeps/alpha/__math.h (atan, cabs): New functions.

	* sysdeps/unix/sysv/linux/alpha/sigsuspend.S: new file (syscall
 	expects set-value, not pointer to it).

Sun Feb 25 22:36:10 1996  David Mosberger-Tang  <davidm@azstarnet.com>

	* sysdeps/unix/sysv/linux/alpha/profil-counter.h: New file.

	* gmon/gmon.c (__bb_head): new variable.
	(write_hist, write_call_graph, write_bb_counts): new functions.
	(_mcleanup): modified to call above functions instead of directly
 	writing out gmon.out.
	* gmon/sys/gmon.h (struct __bb): New type.
	(struct gmonhdr): Type removed.
	(struct gmonparam): New member `log_hashfraction'.
	(GMONVERSION): Macro removed.

	* gmon/sys/gmon_out.h, gmon/bb_exit_func.c,
 	sysdeps/generic/bb_init_func.c, sysdeps/alpha/bb_init_func.S: new
 	files.
	* gmon/Makefile (headers): Add sys/gmon_out.h.
	(routines): Add bb_init_func, bb_exit_func.

	* gmon/mcount.c: Avoid integer division.

Wed Feb 21 23:56:41 1996  David Mosberger-Tang  <davidm@azstarnet.com>

	* sysdeps/alpha/setjmp.S: switched order in which sp and fp are
 	passed to match what __sigsetjmp_aux() expects.

Tue Feb 20 11:33:46 1996  David Mosberger-Tang  <davidm@azstarnet.com>

	* sysdeps/unix/sysv/linux/alpha/syscalls.list (select, bind,
 	connect, getpeername, getsockname, listen, recv, recvfrom,
 	recvmsg, send, sendmsg, sendto, setsockopt, shutdown, socketpair):
 	added to override same-name assembly file in the parent directory.

	* stdlib/stdlib.h: add include of sys/types.h in front of random
 	etc declarations to ensure int32_t is declared.

	* stdlib/random.c, stdlib/random_r.c: replaced "long int" by int32_t
	where 32 bit integers are required.  Also change LONG_MAX into
	0x7fffffff since the intent is to turn off the sign bit in a
	32 bit integer.

	* time/offtime.c (__offtime): Use Paul Eggert's code to deal
	with very large values for "days" (e.g., 64 bit values).

Mon Feb 19 22:22:12 1996  David Mosberger-Tang  <davidm@azstarnet.com>

	* stdlib/stdlib.h (__random, __random_r, random_r, struct
 	random_data): use int32_t instead of `long int'.

Sat Feb 17 11:29:29 1996  David Mosberger-Tang  <davidm@azstarnet.com>

	* sysdeps/unix/sysv/linux/alpha/ioperm.c: new file.

	* sysdeps/alpha/ffs.S: new file.

	* sysdeps/alpha/fabs.c: File removed.

	* time/tzfile.c (__tzfile_read): counter variable is i, *not*
	num_transitions!

	* time/offtime.c: make capable of dealing with very large (64 bit)
 	time_t values.  Use old algorithm until a year is reached that
	is an integer multiple of 400, then use DAYS_PER_400_YEARS to
	do the remainder in a single division.

	* sysdeps/generic/ffs.c (ffs): fix variable declarations to
	be unsigned int, not unsigned long.

	* string/test-ffs.c (main): add test case with all upper bits
	set.

	* stdlib/tst-strtol.c: add tests cases for machines where
	sizeof(long)==8.

	* stdlib/testrand.c (main): disallow rand() to return negative
 	integers.

	* stdlib/testmb.c (main): fix format to use %lx instead of %x.

	* stdlib/stdlib.h: on 64 bit machines, declare
	struct random_data, __random(),  __random_r, and random_r to
	return "int" instead of "long int".

	* stdlib/random_r.c: 64 bit machines use "int" instead of "long
 	int".  Similarly, use INT_MAX instead of LONG_MAX.

	* stdlib/random.c: on 64 bit machines, randtbl[] and __random[]
 	need to operate on "int" instead of "long int".

	* locale/locfile-hash.c (compute_hashval): make shifted constant
	a long to avoid loosing bits on 64 bit machines.

	* dirent/tst-seekdir.c (main): fix confusing comment; print
	a line to mark point where directory is rewound.

Fri Feb 16 15:01:49 1996  David Mosberger-Tang  <davidm@azstarnet.com>

	* time/strftime.c (strftime): any hour > 11 is PM (not > 12!).

Wed Feb 14 00:21:17 1996  David Mosberger-Tang  <davidm@azstarnet.com>

	* sysdeps/unix/sysv/linux/alpha/Makefile,
	sysdeps/unix/sysv/linux/alpha/brk.S,
	sysdeps/unix/sysv/linux/alpha/fpu_control.c,
	sysdeps/unix/sysv/linux/alpha/fpu_control.h,
	sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S,
	sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S,
	sysdeps/unix/sysv/linux/alpha/pipe.S,
	sysdeps/unix/sysv/linux/alpha/setfpucw.c,
	sysdeps/unix/sysv/linux/alpha/sigprocmask.c,
	sysdeps/unix/sysv/linux/alpha/speed.c,
	sysdeps/unix/sysv/linux/alpha/start.S,
	sysdeps/unix/sysv/linux/alpha/syscall.S,
	sysdeps/unix/sysv/linux/alpha/syscalls.list,
	sysdeps/unix/sysv/linux/alpha/alpha/regdef.h,
	sysdeps/unix/sysv/linux/alpha/sysdep.S,
	sysdeps/unix/sysv/linux/alpha/sysdep.h: New files.

	* sysdeps/alpha/setjmp_aux.c (__sigsetjmp_aux): restore return
 	address register before returning (gcc 2.7.1 doesn't do it,
 	presumably because $26 is declared as a global variable).

	* sysdeps/unix/sysv/linux/sys/mman.h: msync was missing "flags"
	argument.

	* sysdeps/unix/alarm.c (alarm): do roundup using test & increment
	instead of multiplication.

	* sysdeps/posix/sleep.c (sleep): initialize sa_mask to mask of
	currently blocked signals instead of the empty mask to ensure
	that execution of alarm handler occurs with none of the currently
	blocked signals enabled.

	* sysdeps/unix/alpha/sysdep.h: new file (adapted from OSF/1 version).

	* sysdeps/unix/bsd/osf/alpha/sysdep.h: include
 	sysdeps/unix/alpha/sysdep.h and removed definitions now in that file.

	* sysdeps/alpha/divrem.S, sysdeps/alpha/htonl.S,
	sysdeps/alpha/htons.S, sysdeps/alpha/machine-gmon.h,
	sysdeps/alpha/_mcount.S, sysdeps/alpha/ntohl.s, sysdeps/alpha/ntohs.s,
	sysdeps/alpha/strlen.S: New files.

	* sysdeps/alpha/divl.S, sysdeps/alpha/divlu.S, sysdeps/alpha/divq.S,
	sysdeps/alpha/divqu.S, sysdeps/alpha/divrem.m4,
	sysdeps/alpha/macros.m4, sysdeps/alpha/reml.S, sysdeps/alpha/remlu.S,
	sysdeps/alpha/remq.S, sysdeps/alpha/remqu.S, sysdeps/alpha/strlen.c:
 	Removed.

	* sysdeps/generic/sbrk.c (__sbrk): argument is of type ptrdiff_t, not
	int.

	* sysdeps/alpha/__longjmp.c (__longjmp): moved dummy while loop
	to end of function to avoid a jump across NOPs.

	* sysdeps/alpha/Makefile (sysdep_routines): Removed all rules
 	pertaining to integer division/remainder routines since new code
 	doesn't require them.

	* sunrpc/xdr_mem.c, sunrpc/xdr_stdio.c: Use 4 instead of sizeof(long)
	where 32 bit quantities are consumed/stored.  Various other minor
	64-bit cleanups (casting).

	* sunrpc/xdr.c (xdr_int): test for sizeof(int)==4 to determine
 	whether xdr_long or xdr_short should be used to encode an int.
  	Notice that an xdr_long is 4 bytes independent of the architecture
	(otherwise no Alpha could interoperate with existing NFS servers,
 	for example).  Ditto for enums.

	* sunrpc/svc_udp.c (svcudp_recv): changed test from 4*sizeof(u_long)
	to 16 since it really wants 16 bytes.

	* sunrpc/svc.c (maskp): changed from u_long* to u_int32*.

	* sunrpc/rpc_cmsg.c (xdr_callmsg), sunrpc/svc_authux.c: increment
	"buf" pointer by casting it to a char* first since a long* may be 8
 	bytes or more and oa->oa_length may be any multiple of 4.

	* sunrpc/rpc/xdr.h (IXDR_GET_LONG, IXDR_PUT_LONG): change casts to
 	u_int32_t (instead of u_long).

	* sunrpc/clnt_udp.c (clntudp_call): replaced sizeof(u_long) by 4
	since it really is testing for 32 bits.  Fixed casts to use
	u_int32 instead of u_long.
	* sunrpc/xdr_rec.c: Likewise.

	* sunrpc/clnt_tcp.c (clnttcp_call): replaced u_long by u_int32.
	* sunrpc/rpc/auth.h: Likewise.

	* limits.h (LONG_MAX, LONG_MIN, ULONG_MAX): use 64 bit values
	for Alpha.

Tue Mar 19 13:27:49 1996  Roland McGrath  <roland@charlie-brown.gnu.ai.mit.edu>

	* sysdeps/i386/fpu/__math.h: New file.
	Contributed by John C. Bowman <bowman@hagar.ph.utexas.edu>.

Sun Mar 17 00:28:16 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/posix/clock.c: Don't multiply the return value by
	CLOCKS_PER_SEC or CLK_TCK.

	* sysdeps/mach/hurd/getcwd.c: Fail with ENOENT if a parent directory
	scan finds no match.

	* posix/unistd.h (setpgrp): Declare no-arg version unless __FAVOR_BSD.
	* misc/bsd-compat.c (setpgrp): New function, two arg version.
	* sysdeps/stub/setpgid.c: Remove setpgrp alias.
	* sysdeps/mach/hurd/setpgid.c: Likewise.
	* sysdeps/unix/sysv/sysv4/setpgid.c: Likewise.
	* sysdeps/unix/common/syscalls.list (setpgid): Remove setpgrp alias.
	* sysdeps/unix/sysv/irix4/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/setpgrp.c: Obsolete file removed.
	* posix/setpgrp.c (setpgrp): New file.
	* posix/Makefile (routines): Add setpgrp.

Tue Feb  6 12:46:29 1996  David Mosberger-Tang  <davidm@azstarnet.com>

	* libc-symbols.h (weak_alias, weak_symbol): added definitions
	for ECOFF (HAVE_ECOFF).
1996-03-19 20:21:54 +00:00
Roland McGrath e384537164 Mon Mar 18 13:20:46 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* elf/Makefile (rtld-link): New canned sequence.
	(ld.so, ld-linux.so.1): Use it.  Pass -soname option.

	* sysdeps/i386/setjmp.S (__setjmp): Define compatibility entry point.

Sun Mar 17 23:15:32 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysv/linux/tcgetpgrp.c,
	sysdeps/unix/sysv/linux/tcsetpgrp.c: New files.
1996-03-18 18:32:47 +00:00
Roland McGrath 9b431e31e1 Sun Mar 17 07:19:33 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* db/Makefile (CFLAGS-hash_func.c): New variable; pass -Wno-unused.
	(CFLAGS): Append -Wno-unitialized.

	* sysdeps/alpha/memchr.S: New file.
	* sysdeps/alpha/memchr.c: Obsolete file removed.
	* string/tester.c: Soup up memchr tests.
1996-03-17 12:36:52 +00:00
Roland McGrath 5aab07eb56 Sat Mar 16 20:58:43 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* stdlib/erand48_r.c: Use FP division by powers of two to distribute
	short bits into double.
1996-03-17 02:00:05 +00:00
Roland McGrath 6025c399e9 Sat Mar 16 20:08:22 1996 David Mosberger-Tang <davidm@azstarnet.com>
* sysdeps/alpha/memchr.S: new file.
	* sysdeps/alpha/memchr.c: obsolete file removed.

Sat Mar 16 16:26:09 1996  Roland McGrath  <roland@charlie-brown.gnu.ai.mit.edu>

	* misc/Makefile (headers): Add sysexits.h.
	* misc/sysexits.h: New file.

Thu Mar 14 15:20:45 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/libm-ieee754/e_atan2.c (__ieee754_atan2): Change atan
	call to __atan.
	* sysdeps/libm-ieee754/e_atan2f.c (__ieee754_atan2f): Change atanf
 	call to __atanf.

	* sysdeps/m68k/fpu/e_acos.c, sysdeps/m68k/fpu/e_acosf.c,
	sysdeps/m68k/fpu/e_asin.c, sysdeps/m68k/fpu/e_asinf.c,
	sysdeps/m68k/fpu/e_atanh.c, sysdeps/m68k/fpu/e_atanhf.c,
	sysdeps/m68k/fpu/e_cosh.c, sysdeps/m68k/fpu/e_coshf.c,
	sysdeps/m68k/fpu/e_exp.c, sysdeps/m68k/fpu/e_expf.c,
	sysdeps/m68k/fpu/e_fmod.c, sysdeps/m68k/fpu/e_fmodf.c,
	sysdeps/m68k/fpu/e_log.c, sysdeps/m68k/fpu/e_log10.c,
	sysdeps/m68k/fpu/e_log10f.c, sysdeps/m68k/fpu/e_logf.c,
	sysdeps/m68k/fpu/e_pow.c, sysdeps/m68k/fpu/e_powf.c,
	sysdeps/m68k/fpu/e_remainder.c, sysdeps/m68k/fpu/e_remainderf.c,
	sysdeps/m68k/fpu/e_scalb.c, sysdeps/m68k/fpu/e_scalbf.c,
	sysdeps/m68k/fpu/e_sinh.c, sysdeps/m68k/fpu/e_sinhf.c,
	sysdeps/m68k/fpu/e_sqrt.c, sysdeps/m68k/fpu/e_sqrtf.c,
	sysdeps/m68k/fpu/k_cos.c, sysdeps/m68k/fpu/k_cosf.c,
	sysdeps/m68k/fpu/k_sin.c, sysdeps/m68k/fpu/k_sinf.c,
	sysdeps/m68k/fpu/k_tan.c, sysdeps/m68k/fpu/k_tanf.c,
	sysdeps/m68k/fpu/s_atan.c, sysdeps/m68k/fpu/s_atanf.c,
	sysdeps/m68k/fpu/s_ceil.c, sysdeps/m68k/fpu/s_ceilf.c,
	sysdeps/m68k/fpu/s_cos.c, sysdeps/m68k/fpu/s_cosf.c,
	sysdeps/m68k/fpu/s_expm1.c, sysdeps/m68k/fpu/s_expm1f.c,
	sysdeps/m68k/fpu/s_fabs.c, sysdeps/m68k/fpu/s_fabsf.c,
	sysdeps/m68k/fpu/s_finite.c, sysdeps/m68k/fpu/s_finitef.c,
	sysdeps/m68k/fpu/s_floor.c, sysdeps/m68k/fpu/s_floorf.c,
	sysdeps/m68k/fpu/s_frexp.c, sysdeps/m68k/fpu/s_frexpf.c,
	sysdeps/m68k/fpu/s_ilogb.c, sysdeps/m68k/fpu/s_ilogbf.c,
	sysdeps/m68k/fpu/s_isinf.c, sysdeps/m68k/fpu/s_isinff.c,
	sysdeps/m68k/fpu/s_isnan.c, sysdeps/m68k/fpu/s_isnanf.c,
	sysdeps/m68k/fpu/s_ldexp.c, sysdeps/m68k/fpu/s_ldexpf.c,
	sysdeps/m68k/fpu/s_log1p.c, sysdeps/m68k/fpu/s_log1pf.c,
	sysdeps/m68k/fpu/s_logb.c, sysdeps/m68k/fpu/s_logbf.c,
	sysdeps/m68k/fpu/s_modf.c, sysdeps/m68k/fpu/s_modff.c,
	sysdeps/m68k/fpu/s_rint.c, sysdeps/m68k/fpu/s_rintf.c,
	sysdeps/m68k/fpu/s_scalbn.c, sysdeps/m68k/fpu/s_scalbnf.c,
	sysdeps/m68k/fpu/s_significand.c,
	sysdeps/m68k/fpu/s_significandf.c, sysdeps/m68k/fpu/s_sin.c,
	sysdeps/m68k/fpu/s_sinf.c, sysdeps/m68k/fpu/s_tan.c,
	sysdeps/m68k/fpu/s_tanf.c, sysdeps/m68k/fpu/s_tanh.c,
	sysdeps/m68k/fpu/s_tanhf.c: New files, for m68881 port of fdlibm.

	* sysdeps/m68k/fpu/__math.h: Rewritten for fdlibm.

	* sysdeps/m68k/fpu/isinfl.c: Rewritten to get argument type right.
	* sysdeps/m68k/fpu/isnanl.c: Likewise.

Thu Mar 14 06:01:07 1996  Roland McGrath  <roland@charlie-brown.gnu.ai.mit.edu>

	* posix/glob.c (glob): In GLOB_BRACE brace expansion, fix buffer size
	calculation to include trailing invariant portion.  Don't use alloca;
	instead use a dynamic auto array for GCC, malloc for non-GCC.
	Handle nested braces properly.

	* elf/elf.h (Elf32_auxv_t): Specify prototype (void) for `a_un.a_fcn'.

	* libc-symbols.h (lint): New macro.

Fri Mar 15 01:18:00 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* libio/iosetvbuf.c: Add weak alias setvbuf.
1996-03-17 01:58:17 +00:00
Roland McGrath d3b7d2ac93 Fri Mar 15 01:18:00 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* libio/iosetvbuf.c: Add weak alias setvbuf.
1996-03-16 21:08:20 +00:00
Ian e5ba41ce24 Recognize mips-*-sysv* 1996-03-15 00:14:04 +00:00
Roland McGrath 8d71c7b0e4 Thu Mar 14 06:01:07 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* string/strnlen.c: New file.
	* string/Makefile (routines): Add strnlen.
	* string/string.h [__USE_GNU] (strnlen): Declare new function.
	[__OPTIMIZE__]: Define extern inline implementation of it.
1996-03-14 11:20:23 +00:00
Roland McGrath 52e9a9d118 Thu Mar 14 06:01:07 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* string/strnlen.c: New file.
	* string/Makefile (routines): Add strnlen.
	* string/string.h [__USE_GNU] (strnlen): Declare new function.
	[__OPTIMIZE__]: Define extern inline implementation of it.

	* stdlib/erand48_r.c: Use __mpn_construct_double instead of ldexp and
	addition, to avoid using anything from -lm.

Mon Mar  4 21:57:14 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysv/linux/m68k/Makefile: New file.

	* sysdeps/unix/sysv/linux/m68k/sysdep.h (SYS_ify): Redefine.
	(CALL_MCOUNT): New macro, empty unless [PROF].
	(ENTRY): Do CALL_MCOUNT just after the label.
	(JUMPTARGET): New macro.
	(SYSCALL_ERROR_HANDLER): Fix syntax.

Thu Mar 14 04:20:48 1996  Roland McGrath  <roland@charlie-brown.gnu.ai.mit.edu>

	* sysdeps/unix/sysv/linux/init-first.c (init): Call `__personality'
	function instead of using inline asm i386 syscall.
	* sysdeps/unix/sysv/linux/syscalls.list: Add personality syscall.

	* posix/unistd.h [__USE_BSD]: Declare usleep.

	* misc/efgcvt.c (MAXDIG): New macro computed from <floats.h> constants.
	(fcvt, ecvt): Use it for buffer size.

	* stdlib/drand48-iter.c (__drand48_iterate): Use u_int64_t instead of
	conditionalizing long vs long long.

	* stdlib/drand48-iter.c (__drand48_iterate): Don't check for null
	pointers; never return EFAULT.
	* stdlib/drand48_r.c (drand48_r): Likewise.
	* stdlib/erand48_r.c (erand48_r): Likewise.
1996-03-14 11:20:03 +00:00
Roland McGrath 6c46dada59 Tue Mar 12 04:57:57 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* setjmp/Makefile (tests): Add jmpbug.
	* setjmp/jmpbug.c: New file.
1996-03-12 10:01:41 +00:00
Roland McGrath 1177c8babf Tue Mar 12 04:42:01 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* sysdeps/sparc/jmp_buf.h: Rewritten; use array of ints, not struct.
	* sysdeps/sparc/setjmp.S: Rewritten; store %fp value as well.
	* sysdeps/sparc/__longjmp.S: Rewritten; unwind frames one by one with
	`restore' until the target frame is hit.

Sun Mar 10 20:29:40 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysv/linux/sigsuspend.c: New file.
	* sysdeps/unix/sysv/linux/syscalls.list: Remove sigsuspend, add
	s_sigsuspend.

Thu Mar  7 21:30:58 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Makerules (+make-deps, sed-remove-objpfx): Quote periods on the
	left side of sed substitutions.

Sun Mar 10 16:58:10 1996  Ulrich Drepper  <drepper@gnu.ai.mit.edu>

	* stdio-common/printf_fp.c (hack_digit): __mpn_normal_size
	is not available anymore.  Do it ourselves.

	* sysdeps/unix/sysv/linux/i386/fpu_control.h (_FPU_SETCW):
	Correct GCC `asm' syntax.

	* stdio-common/Makefile (tests): Add tst-ungetc.
	* stdio-common/tst-ungetc.c: New test from drepper.
	* stdio-common/tstscanf.c (main): New %[ test case from drepper.

	* sysdeps/libm-ieee754/s_scalbn.c (scalbn): Rename to __scalbn;
	somehow this was missed, though the weak alias is already there.
1996-03-12 09:50:46 +00:00
Roland McGrath dd0e4e0c8b Tue Mar 12 03:15:02 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* sysdeps/unix/sysv/linux/i386/fpu_control.h (_FPU_DEFAULT): Change
	default to double precision, all interrupts masked; fdlibm requires.
1996-03-12 08:19:58 +00:00
Roland McGrath d25d5f6a50 Sat Mar 9 18:44:27 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* sysdeps/unix/sysv/linux/i386/setfpucw.c: Obsolete file removed.

Fri Mar  8 22:16:48 1996  Roland McGrath  <roland@charlie-brown.gnu.ai.mit.edu>

	* stdio-common/printf_fp.c (HAVE_ALLOCA): New macro.
1996-03-09 23:50:19 +00:00
Roland McGrath 3f92886a4c Fri Mar 8 22:16:48 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* stdio-common/printf_fp.c (HAVE_ALLOCA): New macro.
1996-03-09 03:16:59 +00:00
Miles Bader 45667a533a *** empty log message ***
Tue Mar  5 18:45:14 1996  Miles Bader  <miles@gnu.ai.mit.edu>

	* sysdeps/mach/hurd/select.c (__select): Include LASTFD in the
	final loop.
1996-03-05 23:48:15 +00:00
Miles Bader 5ac0712ca5 (__select): Include LASTFD in the final loop. 1996-03-05 23:46:23 +00:00
Richard Kenner b49d86bd21 Add -apple and -aux. 1996-03-05 23:34:58 +00:00
Roland McGrath f7eac6eb50 Mon Mar 4 20:54:40 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makeconfig ($(common-objpfx)config.make): Depend on config.h.in.


Mon Mar  4 17:35:09 1996  Roland McGrath  <roland@charlie-brown.gnu.ai.mit.edu>

	* hurd/catch-signal.c (hurd_safe_memmove): New function.
	(hurd_safe_copyin, hurd_safe_copyout): New functions.
	* hurd/hurd/sigpreempt.h: Declare them.

Sun Mar  3 08:43:44 1996  Roland McGrath  <roland@charlie-brown.gnu.ai.mit.edu>

	Replace math code with fdlibm from Sun as modified for netbsd by
	JT Conklin and Ian Taylor, including x86 FPU support.
	* sysdeps/libm-ieee754, sysdeps/libm-i387: New directories.
	* math/math_private.h: New file.
	* sysdeps/i386/fpu/Implies: New file.
	* sysdeps/ieee754/Implies: New file.
	* math/machine/asm.h, math/machine/endian.h: New files.
	* math/Makefile, math/math.h: Rewritten.
	* mathcalls.h, math/mathcalls.h: New file, broken out of math.h.
	* math/finite.c: File removed.
	* sysdeps/generic/Makefile [$(subdir)=math]: Frobnication removed.

	* math/test-math.c: Include errno.h and string.h.

	* sysdeps/unix/bsd/dirstream.h: File removed.
	* sysdeps/unix/bsd/readdir.c: File removed.
1996-03-05 21:41:30 +00:00
Roland McGrath 1521668f2a Sun Mar 3 08:43:44 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* math/test-math.c: Include errno.h and string.h.
1996-03-05 19:06:19 +00:00
Miles Bader 5d8a006d2c A bug fix for the previous select bug fix.
Tue Mar  5 12:14:57 1996  Miles Bader  <miles@gnu.ai.mit.edu>

	* sysdeps/mach/hurd/select.c (__select): Also don't fault just
	because some fdmask is 0.
1996-03-05 17:35:49 +00:00
Miles Bader 3cf11a4b33 (__select): Don't fault when some fdmask is 0. 1996-03-05 17:15:44 +00:00
Roland McGrath d43e047895 Mon Mar 4 20:54:40 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makeconfig ($(common-objpfx)config.make): Depend on config.h.in.
1996-03-05 16:23:22 +00:00
Erik Sandberg 9a0d30bdb1 (moss): Fix previous change. 1996-03-05 03:02:45 +00:00
Miles Bader e9ef1cf37a (__select): Don't increment GOT only because READ/WRITE/EXCEPTFDS is 0! Don't return without frobbing the bitmasks after a timeout. When clearing the bitmasks, only loop from FIRSTFD to LASTFD. 1996-03-05 00:07:01 +00:00
Richard Kenner bba51ac77a Accept -moss* as op sys. 1996-03-04 23:03:15 +00:00
Miles Bader e49639955f Hurd select fixes.
Mon Mar  4 17:35:35 1996  Miles Bader  <miles@gnu.ai.mit.edu>

	* sysdeps/mach/hurd/select.c (__select):
	Don't increment GOT only because READ/WRITE/EXCEPTFDS is 0!
	Don't return without frobbing the bitmasks after a timeout.
	When clearing the bitmasks, only loop from FIRSTFD to LASTFD.
1996-03-04 22:56:09 +00:00
Roland McGrath c3d3967cd2 Mon Mar 4 17:35:09 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* hurd/catch-signal.c (hurd_safe_memmove): New function.
	(hurd_safe_copyin, hurd_safe_copyout): New functions.
	* hurd/hurd/sigpreempt.h: Declare them.
1996-03-04 22:45:04 +00:00
Roland McGrath 661fa17673 Sat Mar 2 16:35:40 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* sysdeps/unix/sysv/linux/m68k/profil-counter.h: File removed.
	* sysdeps/unix/sysv/sysv4/solaris2/sparc/profil-counter.h: File
	removed.
	* sysdeps/generic/profil-counter.h: New file.
1996-03-02 21:38:05 +00:00
Roland McGrath 36ff88f69e Sat Mar 2 16:35:40 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* sysdeps/unix/sysv/linux/m68k/profil-counter.h: File removed.
	* sysdeps/unix/sysv/sysv4/solaris2/sparc/profil-counter.h: File
	removed.
	* sysdeps/generic/profil-counter.h: New file.
1996-03-02 21:37:50 +00:00
Brendan Kehoe 48a65a2993 * sysdeps/unix/sysv/sysv4/solaris2/sparc/sigcontext.h: New file,
including <sysdeps/unix/bsd/sun/sparc/sigcontext.h>. 
* sysdeps/unix/sysv/sysv4/solaris2/sparc/profil-counter.h: New file, 
same as linux/m68k/profil-counter.h except the comment.
Fri Mar  1 17:11:59 1996  Brendan Kehoe  <brendan@zen.org>

	* sysdeps/unix/sysv/sysv4/solaris2/sparc/sigcontext.h: New file,
	including <sysdeps/unix/bsd/sun/sparc/sigcontext.h>.
	* sysdeps/unix/sysv/sysv4/solaris2/sparc/profil-counter.h: New file,
	same as linux/m68k/profil-counter.h except the comment.
1996-03-02 01:34:50 +00:00
Roland McGrath 6b628d3634 * stdlib/Makefile (mpn-stuff): New target.
(copy-mpn): Use it.

	* Code copied from GMP updated to 1.937 version.
	* stdlib/strtod.c (HAVE_ALLOCA): Define this for gmp headers.
1996-03-01 18:45:35 +00:00
Roland McGrath bc47d7a85b Regenerated
Fri Mar  1 10:09:46 1996  Roland McGrath  <roland@charlie-brown.gnu.ai.mit.edu>

	* posix/glob.c: Use canonical code from autoconf manual for dirent
 	include.
	[_D_NAMLEN]: Redefine NAMLEN using this.
	(glob_in_dir): Use NAMLEN macro.
1996-03-01 17:42:49 +00:00
Roland McGrath e9607dbeb9 Fri Mar 1 10:09:46 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* posix/glob.c: Use canonical code from autoconf manual for dirent
 	include.
	[_D_NAMLEN]: Redefine NAMLEN using this.
	(glob_in_dir): Use NAMLEN macro.

	* sysdeps/posix/profil.c: New file.

Thu Feb 29 20:55:57 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysv/linux/m68k/profil-counter.h: New file.

	* libc-symbols.h [GCC >= 2.8] (strong_alias, weak_alias): Remove
	`extern' keyword.

	* time/zic.c, time/zdump.c, time/private.h: Updated from ADO 96e.
1996-03-01 17:40:28 +00:00
Roland McGrath 4a9af5c708 Regenerated
Fri Jan 19 13:28:59 1996  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>

	* posix/glob.c (glob): Use prototype in getlogin decl.

Thu Jan 18 00:32:43 1996  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>

	* posix/glob.c (_GNU_SOURCE): Define if undefined, so glob.h
	defines GNU extensions.
	* posix/fnmatch.c: Likewise.

Fri Jan 12 13:40:01 1996  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>

	* posix/glob.c (glob): Add parens in glob call flags arg for
	GLOB_BRACE case.
1996-03-01 17:07:03 +00:00
Roland McGrath 01fec49ca6 Recognize cpu-vendor [ctj]90-cray, default c90-cray-unicos. From tege. 1996-03-01 14:57:49 +00:00
Miles Bader d1c57d0c40 Updated from ../gpl2lgpl.sed /home/gd/gnu/lib/getopt.c 1996-02-29 01:05:13 +00:00
707 changed files with 40633 additions and 10511 deletions
+976 -2
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -105,9 +105,9 @@ foo:=$(shell echo '+tsrcs=$(+tsrcs)'>&2)
foo:=$(shell echo foobie, dammit! >&2)
ifndef tardir
rel+vers := $(shell sed -n -e 's/^.*libc_release.*\"\([^"]*\)";$$/\1/p' \
-e 's/^.*libc_version.*\"\([^"]*\)";$$/\1/p' \
< $(..)version.c)
rel+vers := $(shell sed -n -e 's/^.*RELEASE.*\"\([^"]*\)";$$/\1/p' \
-e 's/^.*VERSION.*\"\([^"]*\)";$$/\1/p' \
< $(..)version.h)
release := $(word 1,$(rel+vers))
version := $(word 2,$(rel+vers))
export tardir := glibc-$(version)
+27 -8
View File
@@ -118,9 +118,6 @@ endif # subdir
ifndef XGETTEXT
XGETTEXT = xgettext
endif
ifndef MSGJOIN
MSGJOIN = msgjoin
endif
P = $(..)po
@@ -133,22 +130,44 @@ endif
define extract
@rm -f $@.new
$(XGETTEXT) --keyword=_ --keyword=N_ --sort-output -d - \
> $@.new /dev/null $^
$(XGETTEXTFLAGS-$(@F)) > $@.new $^
mv -f $@.new $@
endef
$P/$(domain).pot: $(tags_sources); $(extract)
text-srcs := $(filter %.c %.h %.cc %.C,$(tags_sources))
$P/$(domain).pot: $(text-srcs)
ifeq (,$(text-srcs))
cp /dev/null $@
else
$(extract)
endif
$P/siglist.pot: $(..)sysdeps/generic/signame.c; $(extract)
$P/siglist.pot: $(common-objpfx)siglist.c; $(extract)
$P/errlist.pot: $(..)sysdeps/mach/hurd/errlist.c; $(extract)
all-pot = $P/libc-top.pot $(subdirs:%=$P/%.pot) \
# Extract all strings from these files; their strings are not marked.
# Their surroundings are also not interesting.
XGETTEXTFLAGS-siglist.pot = -a --no-location
XGETTEXTFLAGS-errlist.pot = -a --no-location
all-pot = $P/libc-top.pot $P/subdirs.pot \
$P/siglist.pot $P/errlist.pot
ifndef subdir
# Collect all the subdir messages, massaging the file names in comments
# to include the subdir name.
$P/subdirs.pot: $(subdirs:%=$P/%.pot)
@rm -f $@.new
(for d in $(subdirs); \
do sed "s%^#: %&$$d/%" $P/$$d.pot; done) > $@.new
mv -f $@.new $@
# Combine all the messages into the final sorted template translation file.
$P/SYS_libc.pot: $(all-pot)
@rm -f $@.new
$(MSGJOIN) $^ > $@.new
sed -e 's/VERSION/$(version)/' -e "s/DATE/`date +'%Y-%m-%d %k:%M'`" \
po/header.pot > $@.new
$(XGETTEXT) -d - -n -s --omit-header $^ >> $@.new
mv -f $@.new $@
test ! -d CVS || cvs ci -m'Regenerated from source files' $@
+3 -8
View File
@@ -83,7 +83,7 @@ include $(common-objpfx)config.make
# changes and so config.status would be run every time; the dependence of
# config.make should suffice to force regeneration and re-exec, and the new
# image will notice if config.h changed.
$(common-objpfx)config.make: $(common-objpfx)config.status
$(common-objpfx)config.make: $(common-objpfx)config.status $(..)config.h.in
cd $(<D); $(SHELL) $(<F)
# Force the user to configure before making.
@@ -171,8 +171,8 @@ localedir = $(datadir)/locale
endif
# Where to install the locale charmap source files.
ifndef nlsdir
nlsdir = $(datadir)/nls
ifndef i18ndir
i18ndir = $(datadir)/i18n
endif
@@ -395,13 +395,8 @@ ifeq "$(strip $(+cflags))" ""
+cflags := $(default_cflags)
endif # $(+cflags) == ""
# If using gcc, add flags that only it will grok.
ifneq "$(findstring gcc,$(CC))" ""
+cflags := $(+cflags) $(+gccwarn)
+gcc-nowarn := -w
else
+gcc-nowarn :=
endif # gcc
# Don't duplicate options if we inherited variables from the parent.
+cflags := $(sort $(+cflags))
+1 -1
View File
@@ -54,7 +54,7 @@ endif
subdirs = csu assert ctype db locale intl math setjmp signal stdlib \
stdio-common $(stdio) malloc string wcsmbs time dirent grp pwd\
posix io termios resource misc socket sysvipc gmon gnulib \
$(wildcard crypt) manual $(sysdep-subdirs) elf
wctype $(wildcard crypt) manual $(sysdep-subdirs) elf
export subdirs := $(subdirs) # Benign, useless in GNU make before 3.63.
# The mach and hurd subdirectories have many generated header files which
+15 -8
View File
@@ -276,13 +276,14 @@ S-CPPFLAGS = $(asm-CPPFLAGS)
define +make-deps
-@rm -f $@
$(+mkdep) $< $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | \
sed -e 's,$*\.o,$(foreach o,$(object-suffixes),$(@:.d=$o)) $@,' \
sed -e 's,$(subst .,\.,$*)\.o,$(foreach o,$(object-suffixes),$(@:.d=$o)) $@,' \
$(sed-remove-objpfx) > $(@:.d=.T)
mv -f $(@:.d=.T) $@
endef
ifneq (,$(objpfx))
sed-remove-objpfx = -e 's@ $(subst @,\@,$(objpfx))@ $$(objpfx)@g' \
-e 's@^$(subst @,\@,$(objpfx))@$$(objpfx)@g'
sed-remove-objpfx = -e 's@ $(subst .,\., \
$(subst @,\@,$(objpfx)))@ $$(objpfx)@g' \
-e 's@^$(subst .,\.,$(subst @,\@,$(objpfx)))@$$(objpfx)@g'
endif
# Figure out the source filenames in this directory.
@@ -518,12 +519,12 @@ install-lib.a := $(filter lib%.a,$(install-lib))
install-lib-non.a := $(filter-out lib%.a,$(install-lib))
ifdef install-lib-non.a
$(addprefix $(libdir)/$(libprefix),$(install-lib-non.a)): \
$(libdir)/$(libprefix)%: $(objpfx)%
$(libdir)/$(libprefix)%: $(common-objpfx)%
$(do-install)
endif
ifdef install-lib.a
$(install-lib.a:lib%.a=$(libdir)/lib$(libprefix)%.a): \
$(libdir)/lib$(libprefix)%.a: $(objpfx)lib%.a
$(libdir)/lib$(libprefix)%.a: $(common-objpfx)lib%.a
$(do-install)
$(patsubst %,$(RANLIB) $@,$(filter-out $(non-lib.a),$(<F)))
endif
@@ -609,7 +610,12 @@ cd $(@D); $(BUILD_CC) $(BUILD_CFLAGS) $(<:$(common-objpfx)%=%) -o $(@F)
endef
# We always want to use configuration definitions.
BUILD_CFLAGS = -include $(common-objpfx)config.h
ifdef objdir
# This is always used in $(common-objdir), so we use no directory name.
BUILD_CFLAGS = -include config.h
else
BUILD_CFLAGS = -include $(..)config.h
endif
# Support the GNU standard name for this target.
.PHONY: check
@@ -619,8 +625,9 @@ check: tests
TAGS: distinfo $(..)MakeTAGS
$(MAKE) $(addprefix -f ,$^) $@
$(..)po/%.pot: distinfo $(..)MakeTAGS
$(MAKE) $(addprefix -f ,$^) $@
$(..)po/%.pot: distinfo $(..)MakeTAGS FORCE
$(MAKE) $(addprefix -f ,$(filter-out FORCE,$^)) $@
FORCE:
.PHONY: echo-headers
+32 -7
View File
@@ -1,4 +1,4 @@
GNU C Library NEWS -- history of user-visible changes. 2 January 1996
GNU C Library NEWS -- history of user-visible changes. 28 March 1996
Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
See the end for copying conditions.
@@ -7,6 +7,10 @@ Please send GNU C library bug reports to bug-glibc@prep.ai.mit.edu.
Version 1.10
* GNU extensions are no longer declared by default. To enable them you
must define the macro `_GNU_SOURCE' in your program or compile with
`-D_GNU_SOURCE'.
* The library has changed from using GNU ld symbol aliases to using weak
symbols where available. The ELF object file format supports weak
symbols; GNU ld also supports weak symbols in the a.out format. (There
@@ -34,8 +38,14 @@ Version 1.10
* The C library now provides the run-time support code for profiling
executables compiled with `-pg'. Programs can control the profiling code
through the interface in <sys/gmon.h>. The profiling code was adapted
from 4.4 BSD-Lite.
through the interface in <sys/gmon.h>. The `gmon.out' files written by
the GNU C library can be read only by GNU `gprof' (from GNU binutils);
the support for this file format was contributed by David Mosberger-Tang.
* The math code has been replaced with a math library based on fdlibm from
Sun, and modified by JT Conklin with i387 support and by Ian Taylor with
`float' functions. The math functions now reside in a separate library,
so programs using them will need to use `-lm' their linking commands.
* The new functions `strtoq' and `strtouq' parse integer values from
strings, like `strtol' and `strtoul', but they return `long long int' and
@@ -53,6 +63,11 @@ Version 1.10
* The new header <langinfo.h> defines an interface for accessing
various locale-dependent data (using the locale chosen with `setlocale').
* Ulrich Drepper has contributed a new suite of functions for operation on
wide-character and multibyte-character strings, in <wcstr.h> and <mbstr.h>;
and classification and case conversion of wide characters, in <wctype.h>.
These new functions are intended to conform to the ISO C specification.
* You can now use positional parameter specifications in format strings
for the `printf' and `scanf' families of functions. For example,
`printf ("Number %2$d, Mr %1$s\n", "Jones", 6);'' prints
@@ -133,6 +148,10 @@ Version 1.10
The GNU library now supports Linux versions 1.3.29 and later,
using the ELF object file format (i[345]86-*-linux).
* Andreas Schwab has ported the C library to Linux/m68k (m68k-*-linux).
* David Mosberger-Tang has ported the C library to Linux/Alpha (alpha-*-linux).
* Ulrich Drepper has contributed a new set of message catalog functions to
support multiple languages, for use with his new package GNU gettext.
@@ -163,10 +182,16 @@ Version 1.10
* New function `getsid' returns session ID number on systems that support it.
* The 4.4 BSD `db' library has been incorporated into the GNU C library.
New header files <db.h> and <mpool.h> provide a rich set of functions for
several types of simple databases stored in memory and in files, and
<ndbm.h> is an old `ndbm'-compatbile interface using the `db' functions.
* We have incorporated the 4.4 BSD `db' library (version 1.85). New header
files <db.h> and <mpool.h> provide a rich set of functions for several
types of simple databases stored in memory and in files, and <ndbm.h> is
an old `ndbm'-compatbile interface using the `db' functions.
* New macro `strdupa' copies a string like `strdup', but uses local stack
space from `alloca' instead of dynamic heap space from `malloc'.
* New function `strnlen' is like `strlen' but searches only a given maximum
number of characters for the null terminator.
Version 1.09
+10
View File
@@ -330,6 +330,9 @@ EOF
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin32
exit 0 ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
*:GNU:*:*)
echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
@@ -451,6 +454,13 @@ EOF
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit 0 ;;
R3000:*System_V*:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
+11 -11
View File
@@ -4,12 +4,19 @@
#undef HAVE_GNU_LD
/* Define if using ELF, which supports weak symbols.
This implies HAVE_WEAK_SYMBOLS; set by --with-elf. */
This implies HAVE_ASM_WEAK_DIRECTIVE and NO_UNDERSCORES; set by
--with-elf. */
#undef HAVE_ELF
/* Define if weak symbols are available in the assembler and
linker being used. Set by --with-weak-symbols. */
#undef HAVE_WEAK_SYMBOLS
/* Define if C symbols are asm symbols. Don't define if C symbols
have a `_' prepended to make the asm symbol. */
#undef NO_UNDERSCORES
/* Define if weak symbols are available via the `.weak' directive. */
#undef HAVE_ASM_WEAK_DIRECTIVE
/* Define if weak symbols are available via the `.weakext' directive. */
#undef HAVE_ASM_WEAKEXT_DIRECTIVE
/* Define if not using ELF, but `.init' and `.fini' sections are available. */
#undef HAVE_INITFINI
@@ -24,13 +31,6 @@
declaring a symbol global (default `.globl'). */
#undef ASM_GLOBAL_DIRECTIVE
/* ELF has weak symbols, and with GNU ld a.out does too. */
#ifndef HAVE_WEAK_SYMBOLS
#if defined (HAVE_ELF) || defined (HAVE_GNU_LD)
#define HAVE_WEAK_SYMBOLS
#endif
#endif
/* Define to use GNU libio instead of GNU stdio.
This is defined by configure under --enable-libio. */
#undef USE_IN_LIBIO
-1
View File
@@ -15,7 +15,6 @@ config-sysdirs = @sysnames@
config-defines = @DEFS@
elf = @elf@
weak-symbols = @weak@
have-initfini = @libc_cv_have_initfini@
# Configuration options.
Vendored
+10 -4
View File
@@ -3,7 +3,7 @@
# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can.
# can handle that machine. It does not imply ALL GNU software can.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -81,7 +81,8 @@ case $os in
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp )
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple)
os=
basic_machine=$1
;;
@@ -233,6 +234,10 @@ case $basic_machine in
basic_machine=cray2-cray
os=-unicos
;;
[ctj]90-cray)
basic_machine=c90-cray
os=-unicos
;;
crds | unos)
basic_machine=m68k-crds
;;
@@ -648,7 +653,7 @@ case $os in
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[3456]* \
| -vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]* \
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
| -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \
@@ -657,7 +662,7 @@ case $os in
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin32* | -pe* | -psos*)
| -cygwin32* | -pe* | -psos* | -moss* )
# Remember, each alternative MUST END IN *, to match a version number.
;;
-sunos5*)
@@ -883,6 +888,7 @@ case $basic_machine in
;;
-aux*)
vendor=apple
;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
Vendored
+124 -33
View File
@@ -2,8 +2,8 @@
# From configure.in CVSid
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.7
# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
# Generated automatically using autoconf version 2.9
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
@@ -26,8 +26,6 @@ ac_help="$ac_help
--with-gnu-as if using GNU as (in the binutils package)"
ac_help="$ac_help
--with-elf if using the ELF object format"
ac_help="$ac_help
--with-weak-symbols if weak symbols are available in as and ld"
ac_help="$ac_help
--enable-libio build in GNU libio instead of GNU stdio"
ac_help="$ac_help
@@ -355,7 +353,7 @@ EOF
verbose=yes ;;
-version | --version | --versio | --versi | --vers)
echo "configure generated by autoconf version 2.7"
echo "configure generated by autoconf version 2.9"
exit 0 ;;
-with-* | --with-*)
@@ -620,14 +618,6 @@ else
elf=no
fi
# Check whether --with-weak-symbols or --without-weak-symbols was given.
if test "${with_weak_symbols+set}" = set; then
withval="$with_weak_symbols"
weak=$withval
else
weak=no
fi
# Check whether --enable-libio or --disable-libio was given.
if test "${enable_libio+set}" = set; then
@@ -721,12 +711,18 @@ config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
case "$host_os" in
gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
# These systems always use GNU tools.
gnu_ld=yes gnu_as=yes
gnu_ld=yes gnu_as=yes ;;
esac
case "$host_os" in
gnu* | linux* | sysv4* | solaris2*)
# These systems always use the ELF format.
elf=yes
elf=yes ;;
esac
# Linux/Alpha does not use ELF yet.
case "$host_cpu-$host_os" in
alpha*-linux*)
gnu_ld=no elf=no ;;
esac
# Compute the list of sysdep directories for this configuration.
@@ -1147,13 +1143,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 1151 "configure"
#line 1147 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1157: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1153: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@@ -1162,13 +1158,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 1166 "configure"
#line 1162 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@@ -1217,7 +1213,7 @@ if eval "test \"`echo '$''{'libc_cv_friendly_stddef'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
cat > conftest.$ac_ext <<EOF
#line 1221 "configure"
#line 1217 "configure"
#include "confdefs.h"
#define __need_size_t
#define __need_wchar_t
@@ -1233,7 +1229,7 @@ size_t size; wchar_t wchar;
if (&size == NULL || &wchar == NULL) abort ();
; return 0; }
EOF
if { (eval echo configure:1237: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1233: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libc_cv_friendly_stddef=yes
else
@@ -1340,7 +1336,7 @@ if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
cat > conftest.$ac_ext <<EOF
#line 1344 "configure"
#line 1340 "configure"
#include "confdefs.h"
int main() { return 0; }
@@ -1349,7 +1345,7 @@ asm (".section .init");
asm (".section .fini");
; return 0; }
EOF
if { (eval echo configure:1353: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1349: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libc_cv_have_initfini=yes
else
@@ -1369,6 +1365,108 @@ EOF
fi
fi
if test $elf = yes; then
libc_cv_asm_underscores=no
else
echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&4
if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
cat > conftest.$ac_ext <<EOF
#line 1377 "configure"
#include "confdefs.h"
asm ("_glibc_foobar:");
int main() { return 0; }
int t() {
glibc_foobar ();
; return 0; }
EOF
if { (eval echo configure:1385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
libc_cv_asm_underscores=yes
else
rm -rf conftest*
libc_cv_asm_underscores=no
fi
rm -f conftest*
fi
echo "$ac_t""$libc_cv_asm_underscores" 1>&4
fi
if test $libc_cv_asm_underscores = no; then
cat >> confdefs.h <<\EOF
#define NO_UNDERSCORES 1
EOF
fi
if test $elf = yes; then
libc_cv_weak_symbols=yes
libc_cv_asm_weak_directive=yes
libc_cv_asm_weakext_directive=no
else
echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&4
if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
cat > conftest.s <<EOF
.text
${libc_cv_asm_global_directive} foo
foo: .long 0
.weak foo
.weak bar; bar = foo
EOF
if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
libc_cv_asm_weak_directive=yes
else
libc_cv_asm_weak_directive=no
fi
rm -f conftest*
fi
echo "$ac_t""$libc_cv_asm_weak_directive" 1>&4
if test $libc_cv_asm_weak_directive = no; then
echo $ac_n "checking for assembler .weakext directive""... $ac_c" 1>&4
if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
cat > conftest.s <<EOF
.text
${libc_cv_asm_global_directive} foo
foo: .long 0
.weakext foo
.weakext bar, foo
EOF
if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
libc_cv_asm_weakext_directive=yes
else
libc_cv_asm_weakext_directive=no
fi
rm -f conftest*
fi
echo "$ac_t""$libc_cv_asm_weakext_directive" 1>&4
fi # no .weak
fi # not ELF
if test $libc_cv_asm_weak_directive = yes; then
cat >> confdefs.h <<\EOF
#define HAVE_ASM_WEAK_DIRECTIVE 1
EOF
elif test $libc_cv_asm_weakext_directive = yes; then
cat >> confdefs.h <<\EOF
#define HAVE_ASM_WEAKEXT_DIRECTIVE 1
EOF
fi
### End of automated tests.
### Now run sysdeps configure fragments.
# sysdeps configure fragments may set these with files to be linked below.
libc_link_dests=
libc_link_sources=
@@ -1456,7 +1554,7 @@ default) stdio=stdio ;;
esac
echo "$ac_t""$stdio" 1>&4
if test $gnu_ld = yes; then
cat >> confdefs.h <<\EOF
#define HAVE_GNU_LD 1
@@ -1474,12 +1572,6 @@ if test $elf = yes; then
#define HAVE_ELF 1
EOF
fi
if test $weak = yes; then
cat >> confdefs.h <<\EOF
#define HAVE_WEAK_SYMBOLS 1
EOF
fi
@@ -1573,7 +1665,7 @@ do
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
echo "$CONFIG_STATUS generated by autoconf version 2.7"
echo "$CONFIG_STATUS generated by autoconf version 2.9"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;;
@@ -1639,7 +1731,6 @@ s%@stdio@%$stdio%g
s%@gnu_ld@%$gnu_ld%g
s%@gnu_as@%$gnu_as%g
s%@elf@%$elf%g
s%@weak@%$weak%g
s%@shared@%$shared%g
s%@profile@%$profile%g
s%@omitfp@%$omitfp%g
@@ -1747,7 +1838,7 @@ rm -f conftest.vals
cat > conftest.hdr <<\EOF
s/[\\&%]/\\&/g
s%[\\$`]%\\&%g
s%#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
s%ac_d%ac_u%gp
s%ac_u%ac_e%gp
EOF
+73 -10
View File
@@ -1,6 +1,6 @@
Dnl Process this file with autoconf to produce a configure script.
AC_REVISION([$CVSid$])
AC_PREREQ(2.4.2)dnl dnl Minimum Autoconf version required.
AC_PREREQ(2.9)dnl dnl Minimum Autoconf version required.
AC_INIT(features.h)
AC_CONFIG_HEADER(config.h)
@@ -49,9 +49,6 @@ test $gnu_binutils = yes && gnu_as=yes gnu_ld=yes
AC_ARG_WITH(elf, dnl
--with-elf if using the ELF object format,
elf=$withval, elf=no)
AC_ARG_WITH(weak-symbols, dnl
--with-weak-symbols if weak symbols are available in as and ld,
weak=$withval, weak=no)
AC_ARG_ENABLE(libio, dnl
[ --enable-libio build in GNU libio instead of GNU stdio],
@@ -84,12 +81,18 @@ config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
case "$host_os" in
gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
# These systems always use GNU tools.
gnu_ld=yes gnu_as=yes
gnu_ld=yes gnu_as=yes ;;
esac
case "$host_os" in
gnu* | linux* | sysv4* | solaris2*)
# These systems always use the ELF format.
elf=yes
elf=yes ;;
esac
# Linux/Alpha does not use ELF yet.
case "$host_cpu-$host_os" in
alpha*-linux*)
gnu_ld=no elf=no ;;
esac
# Compute the list of sysdep directories for this configuration.
@@ -406,6 +409,69 @@ if test $elf != yes; then
fi
fi
if test $elf = yes; then
libc_cv_asm_underscores=no
else
AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
[AC_TRY_LINK([asm ("_glibc_foobar:");], [glibc_foobar ();],
libc_cv_asm_underscores=yes,
libc_cv_asm_underscores=no)])
fi
if test $libc_cv_asm_underscores = no; then
AC_DEFINE(NO_UNDERSCORES)
fi
if test $elf = yes; then
libc_cv_weak_symbols=yes
libc_cv_asm_weak_directive=yes
libc_cv_asm_weakext_directive=no
else
AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
[dnl
cat > conftest.s <<EOF
.text
${libc_cv_asm_global_directive} foo
foo: .long 0
.weak foo
.weak bar; bar = foo
EOF
if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
libc_cv_asm_weak_directive=yes
else
libc_cv_asm_weak_directive=no
fi
rm -f conftest*])
if test $libc_cv_asm_weak_directive = no; then
AC_CACHE_CHECK(for assembler .weakext directive,
libc_cv_asm_weakext_directive,
[dnl
cat > conftest.s <<EOF
.text
${libc_cv_asm_global_directive} foo
foo: .long 0
.weakext foo
.weakext bar, foo
EOF
if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
libc_cv_asm_weakext_directive=yes
else
libc_cv_asm_weakext_directive=no
fi
rm -f conftest*])
fi # no .weak
fi # not ELF
if test $libc_cv_asm_weak_directive = yes; then
AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
elif test $libc_cv_asm_weakext_directive = yes; then
AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
fi
### End of automated tests.
### Now run sysdeps configure fragments.
# sysdeps configure fragments may set these with files to be linked below.
libc_link_dests=
libc_link_sources=
@@ -498,7 +564,7 @@ default) stdio=stdio ;;
esac
AC_MSG_RESULT($stdio)
AC_SUBST(gnu_ld) AC_SUBST(gnu_as) AC_SUBST(elf) AC_SUBST(weak)
AC_SUBST(gnu_ld) AC_SUBST(gnu_as) AC_SUBST(elf)
if test $gnu_ld = yes; then
AC_DEFINE(HAVE_GNU_LD)
fi
@@ -508,9 +574,6 @@ fi
if test $elf = yes; then
AC_DEFINE(HAVE_ELF)
fi
if test $weak = yes; then
AC_DEFINE(HAVE_WEAK_SYMBOLS)
fi
AC_SUBST(shared)
if test $shared = default; then
+9 -5
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1992, 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
@@ -21,11 +21,15 @@ Cambridge, MA 02139, USA. */
/* Defined in locale/C-ctype.c. */
extern const char _nl_C_LC_CTYPE_class[];
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[];
#define b(u,x) (((u int *) _nl_C_LC_CTYPE_##x) + 128);
#define b(u,x,o) (((const u int *) _nl_C_LC_CTYPE_##x) + o);
const unsigned short int *__ctype_b = b(unsigned short, class);
const int *__ctype_tolower = b(, tolower);
const int *__ctype_toupper = b(, toupper);
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);
+6 -6
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1993, 1995 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1992, 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
@@ -27,6 +27,7 @@ Cambridge, MA 02139, USA. */
__BEGIN_DECLS
#ifndef _ISbit
/* These are all the characteristics of characters.
If there get to be more than 16 distinct characteristics,
many things must be changed that use `unsigned short int's.
@@ -55,11 +56,9 @@ enum
_ISblank = _ISbit (8), /* Blank (usually SPC and TAB). */
_IScntrl = _ISbit (9), /* Control character. */
_ISpunct = _ISbit (10), /* Punctuation. */
/* The following are defined in POSIX.2 as being combinations of the
classes above. */
_ISalnum = _ISalpha | _ISdigit /* Alphanumeric. */
_ISalnum = _ISbit (11) /* Alphanumeric. */
};
#endif /* ! _ISbit */
/* These are defined in ctype-info.c.
The declarations here must match those in localeinfo.h.
@@ -70,7 +69,8 @@ enum
char' values and for EOF; we also support negative `signed char' values
for broken old programs. The case conversion arrays are of `int's
rather than `unsigned char's because tolower (EOF) must be EOF, which
doesn't fit into an `unsigned char'. */
doesn't fit into an `unsigned char'. But today more important is that
the arrays are also used for multi-byte character sets. */
extern __const unsigned short int *__ctype_b; /* Characteristics. */
extern __const int *__ctype_tolower; /* Case conversions. */
extern __const int *__ctype_toupper; /* Case conversions. */
+7
View File
@@ -26,3 +26,10 @@ distribute := compat.h \
include ../Rules
CPPFLAGS += -D__DBINTERFACE_PRIVATE
# This file defines some static functions for alternative hash algorithms
# that are not actually used.
CFLAGS-hash_func.c := -Wno-unused
# The db code outsmarts the compiler frequently.
override CFLAGS += -Wno-uninitialized
+3 -1
View File
@@ -14,7 +14,7 @@ main ()
dirp = opendir(".");
for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp))
{
/* save position 3 (fourth entry) */
/* save position 3 (after fourth entry) */
if (i++ == 3)
save3 = telldir(dirp);
@@ -26,6 +26,8 @@ main ()
break;
}
printf("going back past 4-th entry...\n");
/* go back to saved entry */
seekdir (dirp, save3);
+9 -3
View File
@@ -61,9 +61,15 @@ $(objpfx)librtld.so: $(rtld-routines:%=$(objpfx)%.so) \
$(LINK.o) -nostdlib -nostartfiles -r -o $@ \
'-Wl,-(' $^ -lgcc '-Wl,-)'
$(objpfx)ld.so $(objpfx)ld-linux.so.1: $(objpfx)librtld.so
$(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
-Wl,-rpath=$(default-rpath) $^
$(objpfx)ld.so: $(objpfx)librtld.so
$(rtld-link) -Wl,-soname=$(rtld-installed-name)
$(objpfx)ld-linux.so.1: $(objpfx)librtld.so
$(rtld-link) -Wl,-soname=ld-linux.so.1
define rtld-link
$(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
-Wl,-rpath=$(default-rpath) $^
endef
# The Linux-compatible dynamic linker shared object is just the same
# with one object file of compatibility initialization code added.
+1 -2
View File
@@ -430,8 +430,7 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname)
}
}
if (type == ET_EXEC)
l->l_type = lt_executable;
l->l_type = type == ET_EXEC ? lt_executable : lt_library;
if (l->l_ld == 0)
{
+4 -4
View File
@@ -412,12 +412,12 @@ typedef struct
typedef struct
{
int a_type; /* Entry type */
int a_type; /* Entry type */
union
{
long a_val; /* Integer value */
void *a_ptr; /* Pointer value */
void (*a_fcn) (); /* Function pointer value */
long int a_val; /* Integer value */
void *a_ptr; /* Pointer value */
void (*a_fcn) (void); /* Function pointer value */
} a_un;
} Elf32_auxv_t;
+23 -11
View File
@@ -1,5 +1,5 @@
/* Run time dynamic linker.
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
@@ -269,7 +269,6 @@ of this helper program; chances are you did not intend to run this program.\n",
{
struct link_map *new;
new = _dl_map_object (l, strtab + d->d_un.d_val);
new->l_type = lt_library;
if (!before_rtld && new == &rtld_map)
before_rtld = last;
last = new;
@@ -340,23 +339,36 @@ of this helper program; chances are you did not intend to run this program.\n",
lazy = !_dl_secure && *(getenv ("LD_BIND_NOW") ?: "") == '\0';
/* Do any necessary cleanups for the startup OS interface code.
We do these now so that no calls are made after real relocation
which might be resolved to different functions than we expect. */
_dl_sysdep_start_cleanup ();
/* Now we have all the objects loaded. Relocate them all.
We do this in reverse order so that copy relocs of earlier
objects overwrite the data written by later objects. */
/* Now we have all the objects loaded. Relocate them all except for
the dynamic linker itself. We do this in reverse order so that
copy relocs of earlier objects overwrite the data written by later
objects. We do not re-relocate the dynamic linker itself in this
loop because that could result in the GOT entries for functions we
call being changed, and that would break us. It is safe to
relocate the dynamic linker out of order because it has no copy
relocs (we know that because it is self-contained). */
l = _dl_loaded;
while (l->l_next)
l = l->l_next;
do
{
_dl_relocate_object (l, lazy);
if (l != &rtld_map)
_dl_relocate_object (l, lazy);
l = l->l_prev;
} while (l);
/* Do any necessary cleanups for the startup OS interface code.
We do these now so that no calls are made after rtld re-relocation
which might be resolved to different functions than we expect.
We cannot do this before relocating the other objects because
_dl_relocate_object might need to call `mprotect' for DT_TEXTREL. */
_dl_sysdep_start_cleanup ();
if (rtld_map.l_opencount > 0)
/* There was an explicit ref to the dynamic linker as a shared lib.
Re-relocate ourselves with user-controlled symbol definitions. */
_dl_relocate_object (&rtld_map, lazy);
/* Tell the debugger where to find the map of loaded objects. */
dl_r_debug.r_version = 1 /* R_DEBUG_VERSION XXX */;
dl_r_debug.r_ldbase = rtld_map.l_addr; /* Record our load address. */
+3 -3
View File
@@ -19,10 +19,10 @@ extra-objs := $(extra-objs)
install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o)))
extra-objs += $(foreach o,$(object-suffixes-$(lib)),$($(lib)-routines:=$o))
alltypes-$(lib) := $(foreach o,$(object-suffixes-$(lib)),\
$(objpfx)$(patsubst %,$(libtype$o),\
$(common-objpfx)$(patsubst %,$(libtype$o),\
$(lib:lib%=%)))
ifneq (,$(filter .so,$(object-suffixes-$(lib))))
alltypes-$(lib) += $(objpfx)$(lib).so
alltypes-$(lib) += $(common-objpfx)$(lib).so
endif
ifeq (,$($(lib)-no-lib-dep))
@@ -33,7 +33,7 @@ endif
# Use o-iterator.mk to generate a rule for each flavor of library.
define o-iterator-doit
$(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \
$(common-objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \
$($(lib)-routines:%=$(objpfx)%$o); $$(build-extra-lib)
endef
object-suffixes-left = $(object-suffixes-$(lib))
+5 -11
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1993, 1995 Free Software Foundation, Inc.
/* Copyright (C) 1991, 92, 93, 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
@@ -31,7 +31,7 @@ Cambridge, MA 02139, USA. */
_GNU_SOURCE All of the above, plus GNU extensions.
The `-ansi' switch to the GNU C compiler defines __STRICT_ANSI__.
If none of these are defined, the default is _GNU_SOURCE.
If none of these are defined, the default is all but _GNU_SOURCE.
If more than one of these are defined, they accumulate.
For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE
together give you ANSI C, 1003.1, and 1003.2, but nothing else.
@@ -69,20 +69,14 @@ Cambridge, MA 02139, USA. */
#undef __FAVOR_BSD
/* If nothing is defined, define _GNU_SOURCE. */
#if (!defined(_GNU_SOURCE) && !defined(__STRICT_ANSI__) && \
!defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) && \
!defined(_BSD_SOURCE) && !defined(_SVID_SOURCE))
#define _GNU_SOURCE 1
#endif
/* Always use ANSI things. */
#define __USE_ANSI 1
/* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */
#ifdef _BSD_SOURCE
#if defined (_BSD_SOURCE) && \
!(defined (_POSIX_SOURCE) || defined (_POSIX_C_SOURCE) || \
defined (_GNU_SOURCE) || defined (_SVID_SOURCE))
#define __FAVOR_BSD 1
#endif
+2 -2
View File
@@ -21,9 +21,9 @@
#
subdir := gmon
headers := sys/gmon.h
headers := sys/gmon.h sys/gmon_out.h
distribute := machine-gmon.h
routines := gmon mcount profil
routines := gmon mcount profil bb_init_func bb_exit_func
include ../Rules
+78
View File
@@ -0,0 +1,78 @@
/* Copyright (C) 1996 Free Software Foundation, Inc.
Contributed by David Mosberger (davidm@cs.arizona.edu).
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. */
/* __bb_exit_func() dumps all the basic-block statistics linked into
the bb_head chain to .d files. */
#include <sys/gmon_out.h>
#include <sys/types.h>
#include <ansidecl.h>
#include <stdio.h>
#include <strings.h>
/* structure emitted by -a */
struct bb {
long zero_word;
const char *filename;
long *counts;
long ncounts;
struct bb *next;
const unsigned long *addresses;
};
extern struct bb *__bb_head; /* from gmon.c */
#define OUT_NAME "gmon.out"
void
DEFUN_VOID(__bb_exit_func)
{
const int version = GMON_VERSION;
struct gmon_hdr ghdr;
struct bb *ptr;
FILE *fp;
fp = fopen(OUT_NAME, "wb");
if (!fp)
{
perror(OUT_NAME);
return;
}
bcopy(GMON_MAGIC, &ghdr.cookie[0], 4);
bcopy(&version, &ghdr.version, sizeof(version));
fwrite(&ghdr, sizeof(ghdr), 1, fp);
for (ptr = __bb_head; ptr != 0; ptr = ptr->next) {
u_int ncounts = ptr->ncounts;
u_char tag;
u_int i;
tag = GMON_TAG_BB_COUNT;
fwrite(&tag, sizeof(tag), 1, fp);
fwrite(&ncounts, sizeof(ncounts), 1, fp);
for (i = 0; i < ncounts; ++i) {
fwrite(&ptr->addresses[i], sizeof(ptr->addresses[0]), 1, fp);
fwrite(&ptr->counts[i], sizeof(ptr->counts[0]), 1, fp);
}
}
fclose (fp);
}
+223 -165
View File
@@ -30,161 +30,53 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if !defined(lint) && defined(LIBC_SCCS)
static char sccsid[] = "@(#)gmon.c 8.1 (Berkeley) 6/4/93";
#endif
#include <sys/param.h>
#include <sys/time.h>
#include <sys/gmon.h>
#include <sys/gmon_out.h>
#include <ansidecl.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
struct __bb *__bb_head; /* Head of basic-block list or NULL. */
struct gmonparam _gmonparam = { GMON_PROF_OFF };
/*
* See profil(2) where this is described:
*/
static int s_scale;
/* see profil(2) where this is describe (incorrectly) */
#define SCALE_1_TO_1 0x10000L
#define ERR(s) write(2, s, sizeof(s) - 1)
#define ERR(s) write(2, s, sizeof(s))
void moncontrol __P((int));
static int hertz __P((void));
void
monstartup(lowpc, highpc)
u_long lowpc;
u_long highpc;
/*
* Discover the tick frequency of the machine if something goes wrong,
* we return 0, an impossible hertz.
*/
static int
DEFUN_VOID(hertz)
{
register int o;
char *cp;
struct gmonparam *p = &_gmonparam;
/*
* round lowpc and highpc to multiples of the density we're using
* so the rest of the scaling (here and in gprof) stays in ints.
*/
p->lowpc = ROUNDDOWN(lowpc, HISTFRACTION * sizeof(HISTCOUNTER));
p->highpc = ROUNDUP(highpc, HISTFRACTION * sizeof(HISTCOUNTER));
p->textsize = p->highpc - p->lowpc;
p->kcountsize = p->textsize / HISTFRACTION;
p->hashfraction = HASHFRACTION;
p->fromssize = p->textsize / HASHFRACTION;
p->tolimit = p->textsize * ARCDENSITY / 100;
if (p->tolimit < MINARCS)
p->tolimit = MINARCS;
else if (p->tolimit > MAXARCS)
p->tolimit = MAXARCS;
p->tossize = p->tolimit * sizeof(struct tostruct);
cp = malloc (p->kcountsize + p->fromssize + p->tossize);
if (! cp) {
ERR("monstartup: out of memory\n");
return;
}
bzero(cp, p->kcountsize + p->fromssize + p->tossize);
p->tos = (struct tostruct *)cp;
cp += p->tossize;
p->kcount = (u_short *)cp;
cp += p->kcountsize;
p->froms = (u_short *)cp;
p->tos[0].link = 0;
o = p->highpc - p->lowpc;
if (p->kcountsize < o) {
#ifndef hp300
s_scale = ((float)p->kcountsize / o ) * SCALE_1_TO_1;
#else /* avoid floating point */
int quot = o / p->kcountsize;
if (quot >= 0x10000)
s_scale = 1;
else if (quot >= 0x100)
s_scale = 0x10000 / quot;
else if (o >= 0x800000)
s_scale = 0x1000000 / (o / (p->kcountsize >> 8));
else
s_scale = 0x1000000 / ((o << 8) / p->kcountsize);
#endif
} else
s_scale = SCALE_1_TO_1;
moncontrol(1);
struct itimerval tim;
tim.it_interval.tv_sec = 0;
tim.it_interval.tv_usec = 1;
tim.it_value.tv_sec = 0;
tim.it_value.tv_usec = 0;
setitimer(ITIMER_REAL, &tim, 0);
setitimer(ITIMER_REAL, 0, &tim);
if (tim.it_interval.tv_usec < 2)
return 0;
return (1000000 / tim.it_interval.tv_usec);
}
void
_mcleanup()
{
int fd;
int fromindex;
int endfrom;
u_long frompc;
int toindex;
struct rawarc rawarc;
struct gmonparam *p = &_gmonparam;
struct gmonhdr gmonhdr, *hdr;
#ifdef DEBUG
int log, len;
char buf[200];
#endif
if (p->state == GMON_PROF_ERROR)
ERR("_mcleanup: tos overflow\n");
moncontrol(0);
fd = open("gmon.out", O_CREAT|O_TRUNC|O_WRONLY, 0666);
if (fd < 0) {
perror("mcount: gmon.out");
return;
}
#ifdef DEBUG
log = open("gmon.log", O_CREAT|O_TRUNC|O_WRONLY, 0664);
if (log < 0) {
perror("mcount: gmon.log");
return;
}
len = sprintf(buf, "[mcleanup1] kcount 0x%x ssiz %d\n",
p->kcount, p->kcountsize);
write(log, buf, len);
#endif
hdr = (struct gmonhdr *)&gmonhdr;
hdr->lpc = p->lowpc;
hdr->hpc = p->highpc;
hdr->ncnt = p->kcountsize + sizeof(gmonhdr);
hdr->version = GMONVERSION;
hdr->profrate = hertz();
write(fd, (char *)hdr, sizeof *hdr);
write(fd, p->kcount, p->kcountsize);
endfrom = p->fromssize / sizeof(*p->froms);
for (fromindex = 0; fromindex < endfrom; fromindex++) {
if (p->froms[fromindex] == 0)
continue;
frompc = p->lowpc;
frompc += fromindex * p->hashfraction * sizeof(*p->froms);
for (toindex = p->froms[fromindex]; toindex != 0;
toindex = p->tos[toindex].link) {
#ifdef DEBUG
len = sprintf(buf,
"[mcleanup2] frompc 0x%x selfpc 0x%x count %d\n" ,
frompc, p->tos[toindex].selfpc,
p->tos[toindex].count);
write(log, buf, len);
#endif
rawarc.raw_frompc = frompc;
rawarc.raw_selfpc = p->tos[toindex].selfpc;
rawarc.raw_count = p->tos[toindex].count;
write(fd, &rawarc, sizeof rawarc);
}
}
close(fd);
}
/*
* Control profiling
@@ -192,41 +84,207 @@ _mcleanup()
* all the data structures are ready.
*/
void
moncontrol(mode)
int mode;
DEFUN(moncontrol, (mode), int mode)
{
struct gmonparam *p = &_gmonparam;
struct gmonparam *p = &_gmonparam;
if (mode) {
/* start */
profil(p->kcount, p->kcountsize, (int)p->lowpc,
s_scale);
p->state = GMON_PROF_ON;
} else {
/* stop */
profil(0, 0, 0, 0);
p->state = GMON_PROF_OFF;
if (mode)
{
/* start */
profil((void *) p->kcount, p->kcountsize, p->lowpc, s_scale);
p->state = GMON_PROF_ON;
}
else
{
/* stop */
profil((void *) 0, 0, 0, 0);
p->state = GMON_PROF_OFF;
}
}
void
DEFUN(monstartup, (lowpc, highpc), u_long lowpc AND u_long highpc)
{
register int o;
char *cp;
struct gmonparam *p = &_gmonparam;
/*
* round lowpc and highpc to multiples of the density we're using
* so the rest of the scaling (here and in gprof) stays in ints.
*/
p->lowpc = ROUNDDOWN(lowpc, HISTFRACTION * sizeof(HISTCOUNTER));
p->highpc = ROUNDUP(highpc, HISTFRACTION * sizeof(HISTCOUNTER));
p->textsize = p->highpc - p->lowpc;
p->kcountsize = p->textsize / HISTFRACTION;
p->hashfraction = HASHFRACTION;
p->log_hashfraction = -1;
if ((HASHFRACTION & (HASHFRACTION - 1)) == 0) {
/* if HASHFRACTION is a power of two, mcount can use shifting
instead of integer division. Precompute shift amount. */
p->log_hashfraction = ffs(p->hashfraction * sizeof(*p->froms)) - 1;
}
p->fromssize = p->textsize / HASHFRACTION;
p->tolimit = p->textsize * ARCDENSITY / 100;
if (p->tolimit < MINARCS)
p->tolimit = MINARCS;
else if (p->tolimit > MAXARCS)
p->tolimit = MAXARCS;
p->tossize = p->tolimit * sizeof(struct tostruct);
cp = malloc (p->kcountsize + p->fromssize + p->tossize);
if (! cp)
{
ERR("monstartup: out of memory\n");
return;
}
bzero(cp, p->kcountsize + p->fromssize + p->tossize);
p->tos = (struct tostruct *)cp;
cp += p->tossize;
p->kcount = (u_short *)cp;
cp += p->kcountsize;
p->froms = (u_short *)cp;
p->tos[0].link = 0;
o = p->highpc - p->lowpc;
if (p->kcountsize < o)
{
#ifndef hp300
s_scale = ((float)p->kcountsize / o ) * SCALE_1_TO_1;
#else
/* avoid floating point operations */
int quot = o / p->kcountsize;
if (quot >= 0x10000)
s_scale = 1;
else if (quot >= 0x100)
s_scale = 0x10000 / quot;
else if (o >= 0x800000)
s_scale = 0x1000000 / (o / (p->kcountsize >> 8));
else
s_scale = 0x1000000 / ((o << 8) / p->kcountsize);
#endif
} else
s_scale = SCALE_1_TO_1;
moncontrol(1);
}
static void
DEFUN(write_hist, (fd), int fd)
{
const u_char tag = GMON_TAG_TIME_HIST;
struct gmon_hist_hdr thdr;
int size, rate;
if (_gmonparam.kcountsize > 0)
{
size = _gmonparam.kcountsize / sizeof(HISTCOUNTER);
rate = hertz();
bcopy(&_gmonparam.lowpc, &thdr.low_pc, sizeof(thdr.low_pc));
bcopy(&_gmonparam.highpc, &thdr.high_pc, sizeof(thdr.high_pc));
bcopy(&size, &thdr.hist_size, sizeof(thdr.hist_size));
bcopy(&rate, &thdr.prof_rate, sizeof(thdr.prof_rate));
strcpy(thdr.dimen, "seconds");
thdr.dimen_abbrev = 's';
write(fd, &tag, sizeof(tag));
write(fd, &thdr, sizeof(thdr));
write(fd, _gmonparam.kcount, _gmonparam.kcountsize);
}
}
static void
DEFUN(write_call_graph, (fd), int fd)
{
const u_char tag = GMON_TAG_CG_ARC;
struct gmon_cg_arc_record raw_arc;
int from_index, to_index, from_len;
u_long frompc;
from_len = _gmonparam.fromssize / sizeof(*_gmonparam.froms);
for (from_index = 0; from_index < from_len; ++from_index)
{
if (_gmonparam.froms[from_index] == 0)
continue;
frompc = _gmonparam.lowpc;
frompc += (from_index * _gmonparam.hashfraction
* sizeof(*_gmonparam.froms));
for (to_index = _gmonparam.froms[from_index];
to_index != 0;
to_index = _gmonparam.tos[to_index].link)
{
bcopy(&frompc, &raw_arc.from_pc, sizeof(raw_arc.from_pc));
bcopy(&_gmonparam.tos[to_index].selfpc, &raw_arc.self_pc,
sizeof(raw_arc.self_pc));
bcopy(&_gmonparam.tos[to_index].count, &raw_arc.count,
sizeof(raw_arc.count));
write(fd, &tag, sizeof(tag));
write(fd, &raw_arc, sizeof(raw_arc));
}
}
}
/*
* discover the tick frequency of the machine
* if something goes wrong, we return 0, an impossible hertz.
*/
static int
hertz()
static void
DEFUN(write_bb_counts, (fd), int fd)
{
struct itimerval tim;
tim.it_interval.tv_sec = 0;
tim.it_interval.tv_usec = 1;
tim.it_value.tv_sec = 0;
tim.it_value.tv_usec = 0;
setitimer(ITIMER_REAL, &tim, 0);
setitimer(ITIMER_REAL, 0, &tim);
if (tim.it_interval.tv_usec < 2)
return(0);
return (1000000 / tim.it_interval.tv_usec);
struct __bb *grp;
const u_char tag = GMON_TAG_BB_COUNT;
int ncounts;
int i;
/* Write each group of basic-block info (all basic-blocks in a
compilation unit form a single group). */
for (grp = __bb_head; grp; grp = grp->next)
{
ncounts = grp->ncounts;
write(fd, &tag, sizeof(tag));
write(fd, &ncounts, sizeof(ncounts));
for (i = 0; i < ncounts; ++i)
{
write(fd, &grp->addresses[i], sizeof(grp->addresses[0]));
write(fd, &grp->counts[i], sizeof(grp->counts[0]));
}
}
}
void
DEFUN_VOID(_mcleanup)
{
const int version = GMON_VERSION;
struct gmon_hdr ghdr;
int fd;
moncontrol(0);
fd = open("gmon.out", O_CREAT|O_TRUNC|O_WRONLY, 0666);
if (fd < 0)
{
perror("_mcleanup: gmon.out");
return;
}
/* write gmon.out header: */
bcopy(GMON_MAGIC, &ghdr.cookie[0], 4);
bcopy(&version, &ghdr.version, sizeof(version));
write(fd, &ghdr, sizeof(ghdr));
/* write PC histogram: */
write_hist(fd);
/* write call-graph: */
write_call_graph(fd);
/* write basic-block execution counts: */
write_bb_counts(fd);
close(fd);
}
+8 -1
View File
@@ -67,6 +67,7 @@ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */
#ifdef KERNEL
register int s;
#endif
int i;
p = &_gmonparam;
/*
@@ -89,7 +90,13 @@ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */
if (frompc > p->textsize)
goto done;
frompcindex = &p->froms[frompc / (p->hashfraction * sizeof(*p->froms))];
/* avoid integer divide if possible: */
if (p->log_hashfraction >= 0) {
i = frompc >> p->log_hashfraction;
} else {
i = frompc / (p->hashfraction * sizeof(*p->froms));
}
frompcindex = &p->froms[i];
toindex = *frompcindex;
if (toindex == 0) {
/*
+16 -9
View File
@@ -39,17 +39,23 @@
#include <sys/cdefs.h>
/*
* Structure prepended to gmon.out profiling data file.
* See gmon_out.h for gmon.out format.
*/
struct gmonhdr {
u_long lpc; /* base pc address of sample buffer */
u_long hpc; /* max pc address of sampled buffer */
int ncnt; /* size of sample buffer (plus this header) */
int version; /* version number */
int profrate; /* profiling clock rate */
int spare[3]; /* reserved */
/* structure emitted by "gcc -a". This must match struct bb in
gcc/libgcc2.c. It is OK for gcc to declare a longer structure as
long as the members below are present. */
struct __bb
{
long zero_word;
const char *filename;
long *counts;
long ncounts;
struct __bb *next;
const unsigned long *addresses;
};
#define GMONVERSION 0x00051879
extern struct __bb *__bb_head;
/*
* histogram counters are unsigned shorts (according to the kernel).
@@ -137,6 +143,7 @@ struct gmonparam {
u_long highpc;
u_long textsize;
u_long hashfraction;
long log_hashfraction;
};
extern struct gmonparam _gmonparam;
+66
View File
@@ -0,0 +1,66 @@
/* Copyright (C) 1996 Free Software Foundation, Inc.
Contributed by David Mosberger (davidm@cs.arizona.edu).
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. */
/* This file specifies the format of gmon.out files. It should have
as few external dependencies as possible as it is going to be included
in many different programs. That is, minimize the number of #include's.
A gmon.out file consists of a header (defined by gmon_hdr) followed by
a sequence of records. Each record starts with a one-byte tag
identifying the type of records, followed by records specific data. */
#ifndef _SYS_GMON_OUT_H_
#define _SYS_GMON_OUT_H_
#define GMON_MAGIC "gmon" /* magic cookie */
#define GMON_VERSION 1 /* version number */
/*
* Raw header as it appears on file (without padding). This header
* always comes first in gmon.out and is then followed by a series
* records defined below.
*/
struct gmon_hdr {
char cookie[4];
char version[4];
char spare[3 * 4];
};
/* types of records in this file: */
typedef enum {
GMON_TAG_TIME_HIST = 0, GMON_TAG_CG_ARC = 1, GMON_TAG_BB_COUNT = 2
} GMON_Record_Tag;
struct gmon_hist_hdr {
char low_pc[sizeof (char *)]; /* base pc address of sample buffer */
char high_pc[sizeof (char *)]; /* max pc address of sampled buffer */
char hist_size[4]; /* size of sample buffer */
char prof_rate[4]; /* profiling clock rate */
char dimen[15]; /* phys. dim., usually "seconds" */
char dimen_abbrev; /* usually 's' for "seconds" */
};
struct gmon_cg_arc_record {
char from_pc[sizeof (char *)]; /* address within caller's body */
char self_pc[sizeof (char *)]; /* address within callee's body */
char count[4]; /* number of arc traversals */
};
#endif /* !_SYS_GMON_OUT_H_ */
+79
View File
@@ -85,3 +85,82 @@ hurd_safe_memset (void *dest, int byte, size_t nbytes)
(vm_address_t) dest, (vm_address_t) dest + nbytes,
&operate, SIG_ERR);
}
error_t
hurd_safe_copyout (void *dest, const void *src, size_t nbytes)
{
error_t operate (struct hurd_signal_preempter *preempter)
{
memcpy (dest, src, nbytes);
return 0;
}
return hurd_catch_signal (sigmask (SIGBUS) | sigmask (SIGSEGV),
(vm_address_t) dest, (vm_address_t) dest + nbytes,
&operate, SIG_ERR);
}
error_t
hurd_safe_copyin (void *dest, const void *src, size_t nbytes)
{
error_t operate (struct hurd_signal_preempter *preempter)
{
memcpy (dest, src, nbytes);
return 0;
}
return hurd_catch_signal (sigmask (SIGBUS) | sigmask (SIGSEGV),
(vm_address_t) src, (vm_address_t) src + nbytes,
&operate, SIG_ERR);
}
error_t
hurd_safe_memmove (void *dest, const void *src, size_t nbytes)
{
jmp_buf buf;
void throw (int signo, long int sigcode, struct sigcontext *scp)
{ longjmp (buf, scp->sc_error ?: EGRATUITOUS); }
struct hurd_signal_preempter src_preempter =
{
sigmask (SIGBUS) | sigmask (SIGSEGV),
(vm_address_t) src, (vm_address_t) src + nbytes,
NULL, (sighandler_t) &throw,
};
struct hurd_signal_preempter dest_preempter =
{
sigmask (SIGBUS) | sigmask (SIGSEGV),
(vm_address_t) dest, (vm_address_t) dest + nbytes,
NULL, (sighandler_t) &throw,
&src_preempter
};
struct hurd_sigstate *const ss = _hurd_self_sigstate ();
error_t error;
/* This returns again with nonzero value when we preempt a signal. */
error = setjmp (buf);
if (error == 0)
{
/* Install a signal preempter for the thread. */
__spin_lock (&ss->lock);
src_preempter.next = ss->preempters;
ss->preempters = &dest_preempter;
__spin_unlock (&ss->lock);
/* Do the copy; it might fault. */
memmove (dest, src, nbytes);
}
/* Either memmove completed happily and ERROR is still zero, or it hit
an expected signal and `throw' made setjmp return the signal error
code in ERROR. Now we can remove the preempter and return. */
__spin_lock (&ss->lock);
assert (ss->preempters == &dest_preempter);
ss->preempters = src_preempter.next;
__spin_unlock (&ss->lock);
return error;
}
+13 -1
View File
@@ -83,8 +83,20 @@ error_t hurd_catch_signal (sigset_t sigset,
/* Convenience functions using `hurd_catch_signal'. */
error_t hurd_safe_memmove (void *dest, const void *src, size_t nbytes);
/* Like `memset', but catch faults in DEST. */
error_t hurd_safe_memset (void *dest, int byte, size_t nbytes);
/* Like `memcpy', but catch faults in SRC. */
error_t hurd_safe_copyin (void *dest, const void *src, size_t nbytes);
/* Like `memcpy', but catch faults in DEST. */
error_t hurd_safe_copyout (void *dest, const void *src, size_t nbytes);
/* Like `memmove', but catch faults in SRC or DEST.
If only one region is expected to fault, it is more efficient
to use `hurd_safe_copyin' or `hurd_safe_copyout' as appropriate. */
error_t hurd_safe_memmove (void *dest, const void *src, size_t nbytes);
#endif /* hurd/sigpreempt.h */
+10 -2
View File
@@ -1,5 +1,5 @@
/* longjmp cleanup function for unwinding past signal handlers.
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
@@ -41,7 +41,15 @@ _hurdsig_longjmp_from_handler (void *data, jmp_buf env, int val)
mach_port_t *reply_port =
(mach_port_t *) __hurd_threadvar_location (_HURD_THREADVAR_MIG_REPLY);
if (*reply_port)
__mach_port_destroy (__mach_task_self (), *reply_port);
{
mach_port_t port = *reply_port;
/* Assigning MACH_PORT_DEAD here tells libc's mig_get_reply_port
not to get another reply port, but avoids mig_dealloc_reply_port
trying to deallocate it after the receive fails (which it will,
because the reply port will be bogus, regardless). */
*reply_port = MACH_PORT_DEAD;
__mach_port_destroy (__mach_task_self (), port);
}
*reply_port = scp->sc_reply_port;
}
+6 -5
View File
@@ -39,14 +39,15 @@
/* External definitions for functions in inet(3) */
#include <sys/cdefs.h>
#include <sys/types.h>
__BEGIN_DECLS
unsigned long inet_addr __P((const char *));
u_int32_t inet_addr __P((const char *));
int inet_aton __P((const char *, struct in_addr *));
unsigned long inet_lnaof __P((struct in_addr));
struct in_addr inet_makeaddr __P((u_long , u_long));
unsigned long inet_netof __P((struct in_addr));
unsigned long inet_network __P((const char *));
u_int32_t inet_lnaof __P((struct in_addr));
struct in_addr inet_makeaddr __P((u_int32_t , u_int32_t));
u_int32_t inet_netof __P((struct in_addr));
u_int32_t inet_network __P((const char *));
char *inet_ntoa __P((struct in_addr));
__END_DECLS
+2 -2
View File
@@ -44,11 +44,11 @@ static char sccsid[] = "@(#)inet_lnaof.c 8.1 (Berkeley) 6/4/93";
* internet address; handles class a/b/c network
* number formats.
*/
u_long
u_int32_t
inet_lnaof(in)
struct in_addr in;
{
register u_long i = ntohl(in.s_addr);
register u_int32_t i = ntohl(in.s_addr);
if (IN_CLASSA(i))
return ((i)&IN_CLASSA_HOST);
+2 -2
View File
@@ -45,9 +45,9 @@ static char sccsid[] = "@(#)inet_makeaddr.c 8.1 (Berkeley) 6/4/93";
*/
struct in_addr
inet_makeaddr(net, host)
u_long net, host;
u_int32_t net, host;
{
u_long addr;
u_int32_t addr;
if (net < 128)
addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);
+3 -3
View File
@@ -45,13 +45,13 @@ static char sccsid[] = "@(#)inet_network.c 8.1 (Berkeley) 6/4/93";
* The library routines call this routine to interpret
* network numbers.
*/
u_long
u_int32_t
inet_network(cp)
register const char *cp;
{
register u_long val, base, n;
register u_int32_t val, base, n;
register char c;
u_long parts[4], *pp = parts;
u_int32_t parts[4], *pp = parts;
register int i;
again:
+2 -2
View File
@@ -43,11 +43,11 @@ static char sccsid[] = "@(#)inet_netof.c 8.1 (Berkeley) 6/4/93";
* Return the network number from an internet
* address; handles class a/b/c network #'s.
*/
u_long
u_int32_t
inet_netof(in)
struct in_addr in;
{
register u_long i = ntohl(in.s_addr);
register u_int32_t i = ntohl(in.s_addr);
if (IN_CLASSA(i))
return (((i)&IN_CLASSA_NET) >> IN_CLASSA_NSHIFT);
+9 -9
View File
@@ -89,7 +89,7 @@ enum
/* Internet address. */
struct in_addr
{
unsigned long int s_addr;
unsigned int s_addr;
};
@@ -98,33 +98,33 @@ struct in_addr
On subnets, host and network parts are found according to
the subnet mask, not these masks. */
#define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0)
#define IN_CLASSA(a) ((((unsigned) (a)) & 0x80000000) == 0)
#define IN_CLASSA_NET 0xff000000
#define IN_CLASSA_NSHIFT 24
#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
#define IN_CLASSA_MAX 128
#define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000)
#define IN_CLASSB(a) ((((unsigned) (a)) & 0xc0000000) == 0x80000000)
#define IN_CLASSB_NET 0xffff0000
#define IN_CLASSB_NSHIFT 16
#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
#define IN_CLASSB_MAX 65536
#define IN_CLASSC(a) ((((long int) (a)) & 0xc0000000) == 0xc0000000)
#define IN_CLASSC(a) ((((unsigned) (a)) & 0xc0000000) == 0xc0000000)
#define IN_CLASSC_NET 0xffffff00
#define IN_CLASSC_NSHIFT 8
#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
#define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000)
#define IN_CLASSD(a) ((((unsigned) (a)) & 0xf0000000) == 0xe0000000)
#define IN_MULTICAST(a) IN_CLASSD(a)
#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xe0000000) == 0xe0000000)
#define IN_BADCLASS(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000)
#define IN_EXPERIMENTAL(a) ((((unsigned) (a)) & 0xe0000000) == 0xe0000000)
#define IN_BADCLASS(a) ((((unsigned) (a)) & 0xf0000000) == 0xf0000000)
/* Address to accept any incoming messages. */
#define INADDR_ANY ((unsigned long int) 0x00000000)
#define INADDR_ANY ((unsigned) 0x00000000)
/* Address to send to all hosts. */
#define INADDR_BROADCAST ((unsigned long int) 0xffffffff)
#define INADDR_BROADCAST ((unsigned) 0xffffffff)
/* Address indicating an error return. */
#define INADDR_NONE 0xffffffff
+1 -1
View File
@@ -33,7 +33,7 @@
* @(#)tcp.h 8.1 (Berkeley) 6/10/93
*/
typedef u_long tcp_seq;
typedef unsigned int tcp_seq;
/*
* TCP header.
* Per RFC 793, September, 1981.
+3 -1
View File
@@ -36,13 +36,15 @@
#ifndef _RWHOD_H_
#define _RWHOD_H_
#include <sys/types.h>
/*
* rwho protocol packet format.
*/
struct outmp {
char out_line[8]; /* tty name */
char out_name[8]; /* user id */
long out_time; /* time on */
int32_t out_time; /* time on */
};
struct whod {
+5 -3
View File
@@ -54,6 +54,8 @@
* stream connection through which the conversation takes place.
*/
#include <sys/types.h>
/*
* Client->server request message format.
*/
@@ -62,10 +64,10 @@ typedef struct {
u_char type; /* request type, see below */
u_char answer; /* not used */
u_char pad;
u_long id_num; /* message id */
u_int32_t id_num; /* message id */
struct osockaddr addr; /* old (4.3) style */
struct osockaddr ctl_addr; /* old (4.3) style */
long pid; /* caller's process id */
int32_t pid; /* caller's process id */
#define NAME_SIZE 12
char l_name[NAME_SIZE];/* caller's name */
char r_name[NAME_SIZE];/* callee's name */
@@ -81,7 +83,7 @@ typedef struct {
u_char type; /* type of request message, see below */
u_char answer; /* respose to request message, see below */
u_char pad;
u_long id_num; /* message id */
u_int32_t id_num; /* message id */
struct osockaddr addr; /* address for establishing conversation */
} CTL_RESPONSE;
+10 -10
View File
@@ -52,8 +52,8 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94";
#include <ctype.h>
#include <string.h>
int __ivaliduser __P((FILE *, u_long, const char *, const char *));
static int __icheckhost __P((u_long, char *));
int __ivaliduser __P((FILE *, u_int32_t, const char *, const char *));
static int __icheckhost __P((u_int32_t, char *));
int
rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
@@ -65,7 +65,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
struct hostent *hp;
struct sockaddr_in sin, from;
fd_set reads;
long oldmask;
int32_t oldmask;
pid_t pid;
int s, lport, timo;
char c;
@@ -242,7 +242,7 @@ ruserok(rhost, superuser, ruser, luser)
int superuser;
{
struct hostent *hp;
u_long addr;
u_int32_t addr;
char **ap;
if ((hp = gethostbyname(rhost)) == NULL)
@@ -266,7 +266,7 @@ ruserok(rhost, superuser, ruser, luser)
*/
int
iruserok(raddr, superuser, ruser, luser)
u_long raddr;
u_int32_t raddr;
int superuser;
const char *ruser, *luser;
{
@@ -347,7 +347,7 @@ again:
int
__ivaliduser(hostf, raddr, luser, ruser)
FILE *hostf;
u_long raddr;
u_int32_t raddr;
const char *luser, *ruser;
{
register char *user, *p;
@@ -389,15 +389,15 @@ __ivaliduser(hostf, raddr, luser, ruser)
*/
static int
__icheckhost(raddr, lhost)
u_long raddr;
u_int32_t raddr;
register char *lhost;
{
register struct hostent *hp;
register u_long laddr;
register u_int32_t laddr;
register char **pp;
/* Try for raw ip address first. */
if (isdigit(*lhost) && (long)(laddr = inet_addr(lhost)) != -1)
if (isdigit(*lhost) && (int32_t)(laddr = inet_addr(lhost)) != -1)
return (raddr == laddr);
/* Better be a hostname. */
@@ -406,7 +406,7 @@ __icheckhost(raddr, lhost)
/* Spin through ip addresses. */
for (pp = hp->h_addr_list; *pp; ++pp)
if (!bcmp(&raddr, *pp, sizeof(u_long)))
if (!bcmp(&raddr, *pp, sizeof(u_int32_t)))
return (1);
/* No match. */
+5 -5
View File
@@ -1,6 +1,6 @@
# Makefile for intl subdirectory: message handling code from GNU gettext.
# 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
@@ -31,12 +31,12 @@ CPPFLAGS += -D'GNULOCALEDIR="$(localedir)"' \
ifdef gettext-srcdir
%.h:: $(gettext-srcdir)/intl/%.glibc; $(copysrc)
%.c:: $(gettext-srcdir)/intl/%.c; $(copysrc)
%.h:: $(gettext-srcdir)/intl/%.h; $(copysrc)
%.h:: ../gpl2lgpl.sed $(gettext-srcdir)/intl/%.glibc; $(copysrc)
%.c:: ../gpl2lgpl.sed $(gettext-srcdir)/intl/%.c; $(copysrc)
%.h:: ../gpl2lgpl.sed $(gettext-srcdir)/intl/%.h; $(copysrc)
define copysrc
cp -f $< $@.new
sed -f $^ > $@.new
chmod a-w $@.new
mv -f $@.new $@
test ! -d CVS || cvs commit -m'Updated from $<' $@
+14 -10
View File
@@ -1,19 +1,23 @@
/* bindtextdom.c -- implementation of the bindtextdomain(3) function
Copyright (C) 1995 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
This program is distributed in the hope that it will be useful,
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 General Public License for more details.
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 General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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. */
#ifdef HAVE_CONFIG_H
# include <config.h>
+14 -10
View File
@@ -1,19 +1,23 @@
/* dcgettext.c -- implementation of the dcgettext(3) function
Copyright (C) 1995 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
This program is distributed in the hope that it will be useful,
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 General Public License for more details.
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 General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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. */
#ifdef HAVE_CONFIG_H
# include <config.h>
+14 -10
View File
@@ -1,19 +1,23 @@
/* dgettext.c -- implementation of the dgettext(3) function
Copyright (C) 1995 Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
This program is distributed in the hope that it will be useful,
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 General Public License for more details.
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 General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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. */
#ifdef HAVE_CONFIG_H
# include <config.h>
+118 -42
View File
@@ -1,25 +1,30 @@
/* finddomain.c -- handle list of needed message catalogs
Copyright (C) 1995 Free Software Foundation, Inc.
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
This program is distributed in the hope that it will be useful,
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 General Public License for more details.
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 General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <sys/types.h>
@@ -63,20 +68,21 @@ void free ();
/* Rename the non ANSI C functions. This is required by the standard
because some ANSI C functions will require linking with this object
file and the name space must not be polluted. */
# define stpcpy __stpcpy
# define stpcpy(dest, src) __stpcpy(dest, src)
#endif
/* Encoding of locale name parts. */
#define CEN_REVISION 1
#define CEN_SPONSOR 2
#define CEN_SPECIAL 4
#define XPG_CODESET 8
#define TERRITORY 16
#define CEN_AUDIENCE 32
#define XPG_MODIFIER 64
#define CEN_REVISION 1
#define CEN_SPONSOR 2
#define CEN_SPECIAL 4
#define XPG_NORM_CODESET 8
#define XPG_CODESET 16
#define TERRITORY 32
#define CEN_AUDIENCE 64
#define XPG_MODIFIER 128
#define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE)
#define XPG_SPECIFIC (XPG_CODESET|XPG_MODIFIER)
#define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER)
/* List of already loaded domains. */
@@ -88,6 +94,7 @@ static struct loaded_domain *make_entry_rec PARAMS ((const char *dirname,
const char *language,
const char *territory,
const char *codeset,
const char *normalized_codeset,
const char *modifier,
const char *special,
const char *sponsor,
@@ -95,9 +102,13 @@ static struct loaded_domain *make_entry_rec PARAMS ((const char *dirname,
const char *domainname,
int do_allocate));
/* Normalize name of selected codeset. */
static const char *normalize_codeset PARAMS ((const char *codeset));
/* Substitution for systems lacking this function in their C library. */
#if !_LIBC && !HAVE_STPCPY
static char *stpcpy PARAMS ((char *dest, const char *src));
static char *stpcpy__ PARAMS ((char *dest, const char *src));
# define stpcpy(dest, src) stpcpy__ (dest, src)
#endif
@@ -116,6 +127,7 @@ _nl_find_domain (dirname, locale, domainname)
const char *modifier = NULL;
const char *territory = NULL;
const char *codeset = NULL;
const char *normalized_codeset = NULL;
const char *special = NULL;
const char *sponsor = NULL;
const char *revision = NULL;
@@ -141,13 +153,14 @@ _nl_find_domain (dirname, locale, domainname)
(2) sponsor
(3) special
(4) codeset
(5) territory
(6) audience/modifier
(5) normalized codeset
(6) territory
(7) audience/modifier
*/
/* If we have already tested for this locale entry there has to
be one data set in the list of loaded domains. */
retval = make_entry_rec (dirname, 0, locale, NULL, NULL, NULL,
retval = make_entry_rec (dirname, 0, locale, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, domainname, 0);
if (retval != NULL)
{
@@ -225,6 +238,15 @@ _nl_find_domain (dirname, locale, domainname)
++cp;
mask |= XPG_CODESET;
if (codeset != cp && codeset[0] != '\0')
{
normalized_codeset = normalize_codeset (codeset);
if (strcmp (codeset, normalized_codeset) == 0)
free ((char *) normalized_codeset);
else
mask |= XPG_NORM_CODESET;
}
}
}
@@ -297,8 +319,8 @@ _nl_find_domain (dirname, locale, domainname)
/* Create all possible locale entries which might be interested in
generalzation. */
retval = make_entry_rec (dirname, mask, language, territory, codeset,
modifier, special, sponsor, revision,
domainname, 1);
normalized_codeset, modifier, special, sponsor,
revision, domainname, 1);
if (retval == NULL)
/* This means we are out of core. */
return NULL;
@@ -331,13 +353,15 @@ _nl_find_domain (dirname, locale, domainname)
static struct loaded_domain *
make_entry_rec (dirname, mask, language, territory, codeset, modifier,
special, sponsor, revision, domain, do_allocate)
make_entry_rec (dirname, mask, language, territory, codeset,
normalized_codeset, modifier, special, sponsor, revision,
domain, do_allocate)
const char *dirname;
int mask;
const char *language;
const char *territory;
const char *codeset;
const char *normalized_codeset;
const char *modifier;
const char *special;
const char *sponsor;
@@ -358,23 +382,26 @@ make_entry_rec (dirname, mask, language, territory, codeset, modifier,
both syntaces set this is necessary to prevent constructing
illegal local names. */
/* FIXME: Rewrite because test is necessary only in first round. */
if ((mask & CEN_SPECIFIC) == 0 || (mask & XPG_SPECIFIC) == 0)
if ((mask & CEN_SPECIFIC) == 0 || (mask & XPG_SPECIFIC) == 0
|| ((mask & XPG_CODESET) != 0 && (mask & XPG_NORM_CODESET) != 0))
{
/* Allocate room for the full file name. */
filename = (char *) malloc (strlen (dirname) + 1
+ strlen (language)
+ ((mask & TERRITORY) != 0
? strlen (territory) : 0)
? strlen (territory) + 1 : 0)
+ ((mask & XPG_CODESET) != 0
? strlen (codeset) : 0)
? strlen (codeset) + 1 : 0)
+ ((mask & XPG_NORM_CODESET) != 0
? strlen (normalized_codeset) + 1 : 0)
+ ((mask & XPG_MODIFIER) != 0 ?
strlen (modifier) : 0)
strlen (modifier) + 1 : 0)
+ ((mask & CEN_SPECIAL) != 0
? strlen (special) : 0)
? strlen (special) + 1 : 0)
+ ((mask & CEN_SPONSOR) != 0
? strlen (sponsor) : 0)
? strlen (sponsor) + 1 : 0)
+ ((mask & CEN_REVISION) != 0
? strlen (revision) : 0) + 1
? strlen (revision) + 1 : 0) + 1
+ strlen (domain) + 1);
if (filename == NULL)
@@ -396,7 +423,12 @@ make_entry_rec (dirname, mask, language, territory, codeset, modifier,
if ((mask & XPG_CODESET) != 0)
{
*cp++ = '.';
cp = stpcpy (cp, codeset);
cp = stpcpy (cp, codeset);
}
if ((mask & XPG_NORM_CODESET) != 0)
{
*cp++ = '.';
cp = stpcpy (cp, normalized_codeset);
}
if ((mask & (XPG_MODIFIER | CEN_AUDIENCE)) != 0)
{
@@ -470,20 +502,64 @@ make_entry_rec (dirname, mask, language, territory, codeset, modifier,
}
entries = 0;
for (cnt = 126; cnt >= 0; --cnt)
for (cnt = 254; cnt >= 0; --cnt)
if (cnt < mask && (cnt & ~mask) == 0
&& ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0))
&& ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0)
&& ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0))
retval->successor[entries++] = make_entry_rec (dirname, cnt,
language, territory,
codeset, modifier,
special, sponsor,
revision, domain, 1);
codeset,
normalized_codeset,
modifier, special,
sponsor, revision,
domain, 1);
retval->successor[entries] = NULL;
return retval;
}
static const char *
normalize_codeset (codeset)
const char *codeset;
{
int len = 0;
int only_digit = 1;
const char *cp;
char *retval;
char *wp;
for (cp = codeset; cp[0] != '\0'; ++cp)
if (isalnum (cp[0]))
{
++len;
if (isalpha (cp[0]))
only_digit = 0;
}
retval = (char *) malloc ((only_digit ? 3 : 0) + len + 1);
if (retval != NULL)
{
if (only_digit)
wp = stpcpy (retval, "ISO");
else
wp = retval;
for (cp = codeset; cp[0] != '\0'; ++cp)
if (isalpha (cp[0]))
*wp++ = toupper (cp[0]);
else if (isdigit (cp[0]))
*wp++ = cp[0];
*wp = '\0';
}
return (const char *) retval;
}
/* @@ begin of epilog @@ */
/* We don't want libintl.a to depend on any other library. So we
@@ -492,7 +568,7 @@ make_entry_rec (dirname, mask, language, territory, codeset, modifier,
to be defined. */
#if !_LIBC && !HAVE_STPCPY
static char *
stpcpy (dest, src)
stpcpy__ (dest, src)
char *dest;
const char *src;
{
+14 -10
View File
@@ -1,19 +1,23 @@
/* gettext.c -- implementation of gettext(3) function
Copyright (C) 1995 Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
This program is distributed in the hope that it will be useful,
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 General Public License for more details.
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 General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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. */
#ifdef HAVE_CONFIG_H
# include <config.h>
+12 -9
View File
@@ -1,20 +1,23 @@
/* gettext.h - internal header for GNU gettext internationalization functions
Copyright (C) 1995 Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
This program is distributed in the hope that it will be useful,
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 General Public License for more details.
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. */
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#ifndef _GETTEXT_H
#define _GETTEXT_H 1
+16 -12
View File
@@ -1,19 +1,23 @@
/* gettextP.h -- header describing internals of gettext library
Copyright (C) 1995 Free Software Foundation, Inc.
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
This program is distributed in the hope that it will be useful,
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 General Public License for more details.
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 General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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. */
#ifndef _GETTEXTP_H
#define _GETTEXTP_H
@@ -46,7 +50,7 @@ SWAP (i)
struct loaded_domain
{
struct loaded_domain *next;
struct loaded_domain *successor[31];
struct loaded_domain *successor[63];
const char *filename;
int decided;
+14 -10
View File
@@ -1,19 +1,23 @@
/* hash-string - Implements a string hashing function.
Copyright (C) 1995 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
This program is distributed in the hope that it will be useful,
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 General Public License for more details.
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 General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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. */
#ifdef HAVE_VALUES_H
# include <values.h>
+5 -3
View File
@@ -1,9 +1,11 @@
/* libgettext.h -- Message catalogs for internationalization.
Copyright (C) 1995 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper.
This file is derived from the file libgettext.h in the GNU gettext package.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
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
@@ -16,8 +18,8 @@ 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. */
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#ifndef _LIBINTL_H
#define _LIBINTL_H 1
+14 -10
View File
@@ -1,19 +1,23 @@
/* loadmsgcat.c -- load needed message catalogs
Copyright (C) 1995 Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
This program is distributed in the hope that it will be useful,
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 General Public License for more details.
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 General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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. */
#ifdef HAVE_CONFIG_H
# include <config.h>
+14 -10
View File
@@ -1,19 +1,23 @@
/* localealias.c -- handle aliases for locale names
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
This program is distributed in the hope that it will be useful,
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 General Public License for more details.
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 General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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. */
#ifdef HAVE_CONFIG_H
# include <config.h>
+14 -10
View File
@@ -1,19 +1,23 @@
/* textdomain.c -- implementation of the textdomain(3) function
Copyright (C) 1995 Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
This program is distributed in the hope that it will be useful,
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 General Public License for more details.
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 General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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. */
#ifdef HAVE_CONFIG_H
# include <config.h>
+40 -22
View File
@@ -27,14 +27,13 @@ Cambridge, MA 02139, USA. */
We include config.h which is generated by configure.
It should define for us the following symbols:
* HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'.
* ASM_GLOBAL_DIRECTIVE with `.globl' or `.global'.
* HAVE_GNU_LD if using GNU ld, with support for weak symbols in a.out,
and for symbol set and warning messages extensions in a.out and ELF.
This implies HAVE_WEAK_SYMBOLS; set by --with-gnu-ld.
* HAVE_ELF if using ELF, which supports weak symbols.
This implies HAVE_WEAK_SYMBOLS; set by --with-elf.
* HAVE_WEAK_SYMBOLS if weak symbols are available in the assembler and
linker being used. Set by --with-weak-symbols.
* HAVE_ELF if using ELF, which supports weak symbols using `.weak'.
* HAVE_ASM_WEAK_DIRECTIVE if we have weak symbols using `.weak'.
* HAVE_ASM_WEAKEXT_DIRECTIVE if we have weak symbols using `.weakext'.
*/
@@ -47,7 +46,13 @@ Cambridge, MA 02139, USA. */
itself is being compiled, or just some generator program. */
#define _LIBC 1
/* Enable declarations of GNU extensions, since we are compiling them. */
#define _GNU_SOURCE 1
#include <config.h>
/* This disables sccsid/rcsid strings in lots of code of non-GNU origin. */
#define lint 1
/*
*/
@@ -76,23 +81,14 @@ extern const char _libc_intl_domainname[];
/*
*/
/* The symbols in all the user (non-_) macros are C symbols. Predefined
should be HAVE_WEAK_SYMBOLS and/or HAVE_ELF and/or HAVE_GNU_LD.
HAVE_WEAK_SYMBOLS is implied by the other two. HAVE_GNU_LD without
HAVE_ELF implies a.out. */
/* The symbols in all the user (non-_) macros are C symbols.
HAVE_GNU_LD without HAVE_ELF implies a.out. */
#ifndef HAVE_WEAK_SYMBOLS
#if defined (HAVE_ELF) || defined (HAVE_GNU_LD)
#if defined (HAVE_ASM_WEAK_DIRECTIVE) || defined (HAVE_ASM_WEAKEXT_DIRECTIVE)
#define HAVE_WEAK_SYMBOLS
#endif
#endif
#ifndef __SYMBOL_PREFIX
#ifdef HAVE_ELF
#define NO_UNDERSCORES
#else
#include <sysdep.h> /* Should define NO_UNDERSCORES. */
#endif
#ifdef NO_UNDERSCORES
#define __SYMBOL_PREFIX
#else
@@ -140,8 +136,21 @@ extern const char _libc_intl_domainname[];
#ifdef HAVE_WEAK_SYMBOLS
#ifdef ASSEMBLER
#ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
/* Define ALIAS as a weak alias for ORIGINAL.
If weak aliases are not available, this defines a strong alias. */
#define weak_alias(original, alias) \
.weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original)
/* Declare SYMBOL to be weak. */
#define weak_symbol(symbol) .weakext C_SYMBOL_NAME (symbol)
#else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
/* Define ALIAS as a weak alias for ORIGINAL.
If weak aliases are not available, this defines a strong alias. */
#define weak_alias(original, alias) \
@@ -151,12 +160,21 @@ extern const char _libc_intl_domainname[];
/* Declare SYMBOL to be weak. */
#define weak_symbol(symbol) .weak C_SYMBOL_NAME (symbol)
#else
#endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
#else /* ! ASSEMBLER */
#ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
#define weak_symbol(symbol) asm (".weakext " __SYMBOL_PREFIX #symbol);
#define weak_alias(original, alias) \
asm (".weakext " __SYMBOL_PREFIX #alias ", " __SYMBOL_PREFIX #original);
#else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
#define weak_symbol(symbol) asm (".weak " __SYMBOL_PREFIX #symbol);
#define weak_alias(original, alias) \
asm (".weak " __SYMBOL_PREFIX #alias "\n" \
__SYMBOL_PREFIX #alias " = " __SYMBOL_PREFIX #original);
#endif
#endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
#endif /* ! ASSEMBLER */
#else
#define weak_alias(original, alias) strong_alias(original, alias)
#define weak_symbol(symbol) /* Do nothing. */
@@ -170,7 +188,7 @@ extern const char _libc_intl_domainname[];
are better clued in to what we are doing. */
#undef strong_alias
#define strong_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((alias (#name)));
__typeof (name) aliasname __attribute__ ((alias (#name)));
#ifdef HAVE_WEAK_SYMBOLS
#undef weak_symbol
@@ -178,7 +196,7 @@ extern const char _libc_intl_domainname[];
extern __typeof (name) name __attribute__ ((weak));
#undef weak_alias
#define weak_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
__typeof (name) aliasname __attribute__ ((weak, alias (#name)));
#endif /* HAVE_WEAK_SYMBOLS. */
#endif /* Not ASSEMBLER, and GCC 2.8 or later. */
+19 -4
View File
@@ -511,26 +511,41 @@ int
DEFUN(_IO_sputbackc, (fp, c),
register _IO_FILE *fp AND int c)
{
int result;
if (fp->_IO_read_ptr > fp->_IO_read_base
&& (unsigned char)fp->_IO_read_ptr[-1] == (unsigned char)c)
{
fp->_IO_read_ptr--;
return (unsigned char)c;
result = (unsigned char)c;
}
return _IO_PBACKFAIL (fp, c);
else
result = _IO_PBACKFAIL (fp, c);
if (result != EOF)
fp->_flags &= ~_IO_EOF_SEEN;
return result;
}
int
DEFUN(_IO_sungetc, (fp),
register _IO_FILE *fp)
{
int result;
if (fp->_IO_read_ptr > fp->_IO_read_base)
{
fp->_IO_read_ptr--;
return (unsigned char)*fp->_IO_read_ptr;
result = (unsigned char)*fp->_IO_read_ptr;
}
else
return _IO_PBACKFAIL (fp, EOF);
result = _IO_PBACKFAIL (fp, EOF);
if (result != EOF)
fp->_flags &= ~_IO_EOF_SEEN;
return result;
}
#if 0 /* Work in progress */
+2
View File
@@ -78,3 +78,5 @@ _IO_setvbuf (fp, buf, mode, size)
}
return _IO_SETBUF (fp, buf, size) == NULL ? EOF : 0;
}
weak_alias (_IO_setvbuf, setvbuf)
+15 -1
View File
@@ -101,12 +101,26 @@ Cambridge, MA 02139, USA. */
#define UINT_MAX 4294967295
#endif
#ifdef __alpha__
/* Minimum and maximum values a `signed long int' can hold. */
#define LONG_MAX 9223372036854775807L
#define LONG_MIN (- LONG_MAX - 1L)
/* Maximum value an `unsigned long int' can hold. (Minimum is 0.) */
#define ULONG_MAX 18446744073709551615L
#else
/* Minimum and maximum values a `signed long int' can hold. */
#define LONG_MIN INT_MIN
#define LONG_MAX INT_MAX
#define LONG_MIN INT_MIN
/* Maximum value an `unsigned long int' can hold. (Minimum is 0.) */
#define ULONG_MAX UINT_MAX
#endif
#endif /* limits.h */
#endif /* GCC 2. */
+321 -23
View File
@@ -3,7 +3,7 @@
#include "localeinfo.h"
#include <endian.h>
const char _nl_C_LC_CTYPE_class[] =
const char _nl_C_LC_CTYPE_class[768] =
/* 0x80 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
/* 0x86 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
/* 0x8c */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
@@ -33,19 +33,19 @@ const char _nl_C_LC_CTYPE_class[] =
/* 0x1c */ "\002\000" "\002\000" "\002\000" "\002\000" "\001\140" "\004\300"
/* 0x22 */ "\004\300" "\004\300" "\004\300" "\004\300" "\004\300" "\004\300"
/* 0x28 */ "\004\300" "\004\300" "\004\300" "\004\300" "\004\300" "\004\300"
/* 0x2e */ "\004\300" "\004\300" "\000\330" "\000\330" "\000\330" "\000\330"
/* 0x34 */ "\000\330" "\000\330" "\000\330" "\000\330" "\000\330" "\000\330"
/* 0x2e */ "\004\300" "\004\300" "\010\330" "\010\330" "\010\330" "\010\330"
/* 0x34 */ "\010\330" "\010\330" "\010\330" "\010\330" "\010\330" "\010\330"
/* 0x3a */ "\004\300" "\004\300" "\004\300" "\004\300" "\004\300" "\004\300"
/* 0x40 */ "\004\300" "\000\325" "\000\325" "\000\325" "\000\325" "\000\325"
/* 0x46 */ "\000\325" "\000\305" "\000\305" "\000\305" "\000\305" "\000\305"
/* 0x4c */ "\000\305" "\000\305" "\000\305" "\000\305" "\000\305" "\000\305"
/* 0x52 */ "\000\305" "\000\305" "\000\305" "\000\305" "\000\305" "\000\305"
/* 0x58 */ "\000\305" "\000\305" "\000\305" "\004\300" "\004\300" "\004\300"
/* 0x5e */ "\004\300" "\004\300" "\004\300" "\000\326" "\000\326" "\000\326"
/* 0x64 */ "\000\326" "\000\326" "\000\326" "\000\306" "\000\306" "\000\306"
/* 0x6a */ "\000\306" "\000\306" "\000\306" "\000\306" "\000\306" "\000\306"
/* 0x70 */ "\000\306" "\000\306" "\000\306" "\000\306" "\000\306" "\000\306"
/* 0x76 */ "\000\306" "\000\306" "\000\306" "\000\306" "\000\306" "\004\300"
/* 0x40 */ "\004\300" "\010\325" "\010\325" "\010\325" "\010\325" "\010\325"
/* 0x46 */ "\010\325" "\010\305" "\010\305" "\010\305" "\010\305" "\010\305"
/* 0x4c */ "\010\305" "\010\305" "\010\305" "\010\305" "\010\305" "\010\305"
/* 0x52 */ "\010\305" "\010\305" "\010\305" "\010\305" "\010\305" "\010\305"
/* 0x58 */ "\010\305" "\010\305" "\010\305" "\004\300" "\004\300" "\004\300"
/* 0x5e */ "\004\300" "\004\300" "\004\300" "\010\326" "\010\326" "\010\326"
/* 0x64 */ "\010\326" "\010\326" "\010\326" "\010\306" "\010\306" "\010\306"
/* 0x6a */ "\010\306" "\010\306" "\010\306" "\010\306" "\010\306" "\010\306"
/* 0x70 */ "\010\306" "\010\306" "\010\306" "\010\306" "\010\306" "\010\306"
/* 0x76 */ "\010\306" "\010\306" "\010\306" "\010\306" "\010\306" "\004\300"
/* 0x7c */ "\004\300" "\004\300" "\004\300" "\002\000" "\002\000" "\002\000"
/* 0x82 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
/* 0x88 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
@@ -69,8 +69,96 @@ const char _nl_C_LC_CTYPE_class[] =
/* 0xf4 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
/* 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"
;
#if BYTE_ORDER == LITTLE_ENDIAN
const char _nl_C_LC_CTYPE_toupper[] =
const char _nl_C_LC_CTYPE_toupper[1536] =
/* 0x80 */ "\200\000\000\000" "\201\000\000\000" "\202\000\000\000"
/* 0x83 */ "\203\000\000\000" "\204\000\000\000" "\205\000\000\000"
/* 0x86 */ "\206\000\000\000" "\207\000\000\000" "\210\000\000\000"
@@ -200,7 +288,7 @@ const char _nl_C_LC_CTYPE_toupper[] =
/* 0xfa */ "\372\000\000\000" "\373\000\000\000" "\374\000\000\000"
/* 0xfd */ "\375\000\000\000" "\376\000\000\000" "\377\000\000\000"
;
const char _nl_C_LC_CTYPE_tolower[] =
const char _nl_C_LC_CTYPE_tolower[1536] =
/* 0x80 */ "\200\000\000\000" "\201\000\000\000" "\202\000\000\000"
/* 0x83 */ "\203\000\000\000" "\204\000\000\000" "\205\000\000\000"
/* 0x86 */ "\206\000\000\000" "\207\000\000\000" "\210\000\000\000"
@@ -330,8 +418,96 @@ const char _nl_C_LC_CTYPE_tolower[] =
/* 0xfa */ "\372\000\000\000" "\373\000\000\000" "\374\000\000\000"
/* 0xfd */ "\375\000\000\000" "\376\000\000\000" "\377\000\000\000"
;
const char _nl_C_LC_CTYPE_names[1024] =
/* 0x00 */ "\000\000\000\000" "\001\000\000\000" "\002\000\000\000"
/* 0x03 */ "\003\000\000\000" "\004\000\000\000" "\005\000\000\000"
/* 0x06 */ "\006\000\000\000" "\007\000\000\000" "\010\000\000\000"
/* 0x09 */ "\011\000\000\000" "\012\000\000\000" "\013\000\000\000"
/* 0x0c */ "\014\000\000\000" "\015\000\000\000" "\016\000\000\000"
/* 0x0f */ "\017\000\000\000" "\020\000\000\000" "\021\000\000\000"
/* 0x12 */ "\022\000\000\000" "\023\000\000\000" "\024\000\000\000"
/* 0x15 */ "\025\000\000\000" "\026\000\000\000" "\027\000\000\000"
/* 0x18 */ "\030\000\000\000" "\031\000\000\000" "\032\000\000\000"
/* 0x1b */ "\033\000\000\000" "\034\000\000\000" "\035\000\000\000"
/* 0x1e */ "\036\000\000\000" "\037\000\000\000" "\040\000\000\000"
/* 0x21 */ "\041\000\000\000" "\042\000\000\000" "\043\000\000\000"
/* 0x24 */ "\044\000\000\000" "\045\000\000\000" "\046\000\000\000"
/* 0x27 */ "\047\000\000\000" "\050\000\000\000" "\051\000\000\000"
/* 0x2a */ "\052\000\000\000" "\053\000\000\000" "\054\000\000\000"
/* 0x2d */ "\055\000\000\000" "\056\000\000\000" "\057\000\000\000"
/* 0x30 */ "\060\000\000\000" "\061\000\000\000" "\062\000\000\000"
/* 0x33 */ "\063\000\000\000" "\064\000\000\000" "\065\000\000\000"
/* 0x36 */ "\066\000\000\000" "\067\000\000\000" "\070\000\000\000"
/* 0x39 */ "\071\000\000\000" "\072\000\000\000" "\073\000\000\000"
/* 0x3c */ "\074\000\000\000" "\075\000\000\000" "\076\000\000\000"
/* 0x3f */ "\077\000\000\000" "\100\000\000\000" "\101\000\000\000"
/* 0x42 */ "\102\000\000\000" "\103\000\000\000" "\104\000\000\000"
/* 0x45 */ "\105\000\000\000" "\106\000\000\000" "\107\000\000\000"
/* 0x48 */ "\110\000\000\000" "\111\000\000\000" "\112\000\000\000"
/* 0x4b */ "\113\000\000\000" "\114\000\000\000" "\115\000\000\000"
/* 0x4e */ "\116\000\000\000" "\117\000\000\000" "\120\000\000\000"
/* 0x51 */ "\121\000\000\000" "\122\000\000\000" "\123\000\000\000"
/* 0x54 */ "\124\000\000\000" "\125\000\000\000" "\126\000\000\000"
/* 0x57 */ "\127\000\000\000" "\130\000\000\000" "\131\000\000\000"
/* 0x5a */ "\132\000\000\000" "\133\000\000\000" "\134\000\000\000"
/* 0x5d */ "\135\000\000\000" "\136\000\000\000" "\137\000\000\000"
/* 0x60 */ "\140\000\000\000" "\141\000\000\000" "\142\000\000\000"
/* 0x63 */ "\143\000\000\000" "\144\000\000\000" "\145\000\000\000"
/* 0x66 */ "\146\000\000\000" "\147\000\000\000" "\150\000\000\000"
/* 0x69 */ "\151\000\000\000" "\152\000\000\000" "\153\000\000\000"
/* 0x6c */ "\154\000\000\000" "\155\000\000\000" "\156\000\000\000"
/* 0x6f */ "\157\000\000\000" "\160\000\000\000" "\161\000\000\000"
/* 0x72 */ "\162\000\000\000" "\163\000\000\000" "\164\000\000\000"
/* 0x75 */ "\165\000\000\000" "\166\000\000\000" "\167\000\000\000"
/* 0x78 */ "\170\000\000\000" "\171\000\000\000" "\172\000\000\000"
/* 0x7b */ "\173\000\000\000" "\174\000\000\000" "\175\000\000\000"
/* 0x7e */ "\176\000\000\000" "\177\000\000\000" "\200\000\000\000"
/* 0x81 */ "\201\000\000\000" "\202\000\000\000" "\203\000\000\000"
/* 0x84 */ "\204\000\000\000" "\205\000\000\000" "\206\000\000\000"
/* 0x87 */ "\207\000\000\000" "\210\000\000\000" "\211\000\000\000"
/* 0x8a */ "\212\000\000\000" "\213\000\000\000" "\214\000\000\000"
/* 0x8d */ "\215\000\000\000" "\216\000\000\000" "\217\000\000\000"
/* 0x90 */ "\220\000\000\000" "\221\000\000\000" "\222\000\000\000"
/* 0x93 */ "\223\000\000\000" "\224\000\000\000" "\225\000\000\000"
/* 0x96 */ "\226\000\000\000" "\227\000\000\000" "\230\000\000\000"
/* 0x99 */ "\231\000\000\000" "\232\000\000\000" "\233\000\000\000"
/* 0x9c */ "\234\000\000\000" "\235\000\000\000" "\236\000\000\000"
/* 0x9f */ "\237\000\000\000" "\240\000\000\000" "\241\000\000\000"
/* 0xa2 */ "\242\000\000\000" "\243\000\000\000" "\244\000\000\000"
/* 0xa5 */ "\245\000\000\000" "\246\000\000\000" "\247\000\000\000"
/* 0xa8 */ "\250\000\000\000" "\251\000\000\000" "\252\000\000\000"
/* 0xab */ "\253\000\000\000" "\254\000\000\000" "\255\000\000\000"
/* 0xae */ "\256\000\000\000" "\257\000\000\000" "\260\000\000\000"
/* 0xb1 */ "\261\000\000\000" "\262\000\000\000" "\263\000\000\000"
/* 0xb4 */ "\264\000\000\000" "\265\000\000\000" "\266\000\000\000"
/* 0xb7 */ "\267\000\000\000" "\270\000\000\000" "\271\000\000\000"
/* 0xba */ "\272\000\000\000" "\273\000\000\000" "\274\000\000\000"
/* 0xbd */ "\275\000\000\000" "\276\000\000\000" "\277\000\000\000"
/* 0xc0 */ "\300\000\000\000" "\301\000\000\000" "\302\000\000\000"
/* 0xc3 */ "\303\000\000\000" "\304\000\000\000" "\305\000\000\000"
/* 0xc6 */ "\306\000\000\000" "\307\000\000\000" "\310\000\000\000"
/* 0xc9 */ "\311\000\000\000" "\312\000\000\000" "\313\000\000\000"
/* 0xcc */ "\314\000\000\000" "\315\000\000\000" "\316\000\000\000"
/* 0xcf */ "\317\000\000\000" "\320\000\000\000" "\321\000\000\000"
/* 0xd2 */ "\322\000\000\000" "\323\000\000\000" "\324\000\000\000"
/* 0xd5 */ "\325\000\000\000" "\326\000\000\000" "\327\000\000\000"
/* 0xd8 */ "\330\000\000\000" "\331\000\000\000" "\332\000\000\000"
/* 0xdb */ "\333\000\000\000" "\334\000\000\000" "\335\000\000\000"
/* 0xde */ "\336\000\000\000" "\337\000\000\000" "\340\000\000\000"
/* 0xe1 */ "\341\000\000\000" "\342\000\000\000" "\343\000\000\000"
/* 0xe4 */ "\344\000\000\000" "\345\000\000\000" "\346\000\000\000"
/* 0xe7 */ "\347\000\000\000" "\350\000\000\000" "\351\000\000\000"
/* 0xea */ "\352\000\000\000" "\353\000\000\000" "\354\000\000\000"
/* 0xed */ "\355\000\000\000" "\356\000\000\000" "\357\000\000\000"
/* 0xf0 */ "\360\000\000\000" "\361\000\000\000" "\362\000\000\000"
/* 0xf3 */ "\363\000\000\000" "\364\000\000\000" "\365\000\000\000"
/* 0xf6 */ "\366\000\000\000" "\367\000\000\000" "\370\000\000\000"
/* 0xf9 */ "\371\000\000\000" "\372\000\000\000" "\373\000\000\000"
/* 0xfc */ "\374\000\000\000" "\375\000\000\000" "\376\000\000\000"
/* 0xff */ "\377\000\000\000"
;
#elif BYTE_ORDER == BIG_ENDIAN
const char _nl_C_LC_CTYPE_toupper[] =
const char _nl_C_LC_CTYPE_toupper[1536] =
/* 0x80 */ "\000\000\000\200" "\000\000\000\201" "\000\000\000\202"
/* 0x83 */ "\000\000\000\203" "\000\000\000\204" "\000\000\000\205"
/* 0x86 */ "\000\000\000\206" "\000\000\000\207" "\000\000\000\210"
@@ -461,7 +637,7 @@ const char _nl_C_LC_CTYPE_toupper[] =
/* 0xfa */ "\000\000\000\372" "\000\000\000\373" "\000\000\000\374"
/* 0xfd */ "\000\000\000\375" "\000\000\000\376" "\000\000\000\377"
;
const char _nl_C_LC_CTYPE_tolower[] =
const char _nl_C_LC_CTYPE_tolower[1536] =
/* 0x80 */ "\000\000\000\200" "\000\000\000\201" "\000\000\000\202"
/* 0x83 */ "\000\000\000\203" "\000\000\000\204" "\000\000\000\205"
/* 0x86 */ "\000\000\000\206" "\000\000\000\207" "\000\000\000\210"
@@ -591,18 +767,140 @@ const char _nl_C_LC_CTYPE_tolower[] =
/* 0xfa */ "\000\000\000\372" "\000\000\000\373" "\000\000\000\374"
/* 0xfd */ "\000\000\000\375" "\000\000\000\376" "\000\000\000\377"
;
const char _nl_C_LC_CTYPE_names[1024] =
/* 0x00 */ "\000\000\000\000" "\000\000\000\001" "\000\000\000\002"
/* 0x03 */ "\000\000\000\003" "\000\000\000\004" "\000\000\000\005"
/* 0x06 */ "\000\000\000\006" "\000\000\000\007" "\000\000\000\010"
/* 0x09 */ "\000\000\000\011" "\000\000\000\012" "\000\000\000\013"
/* 0x0c */ "\000\000\000\014" "\000\000\000\015" "\000\000\000\016"
/* 0x0f */ "\000\000\000\017" "\000\000\000\020" "\000\000\000\021"
/* 0x12 */ "\000\000\000\022" "\000\000\000\023" "\000\000\000\024"
/* 0x15 */ "\000\000\000\025" "\000\000\000\026" "\000\000\000\027"
/* 0x18 */ "\000\000\000\030" "\000\000\000\031" "\000\000\000\032"
/* 0x1b */ "\000\000\000\033" "\000\000\000\034" "\000\000\000\035"
/* 0x1e */ "\000\000\000\036" "\000\000\000\037" "\000\000\000\040"
/* 0x21 */ "\000\000\000\041" "\000\000\000\042" "\000\000\000\043"
/* 0x24 */ "\000\000\000\044" "\000\000\000\045" "\000\000\000\046"
/* 0x27 */ "\000\000\000\047" "\000\000\000\050" "\000\000\000\051"
/* 0x2a */ "\000\000\000\052" "\000\000\000\053" "\000\000\000\054"
/* 0x2d */ "\000\000\000\055" "\000\000\000\056" "\000\000\000\057"
/* 0x30 */ "\000\000\000\060" "\000\000\000\061" "\000\000\000\062"
/* 0x33 */ "\000\000\000\063" "\000\000\000\064" "\000\000\000\065"
/* 0x36 */ "\000\000\000\066" "\000\000\000\067" "\000\000\000\070"
/* 0x39 */ "\000\000\000\071" "\000\000\000\072" "\000\000\000\073"
/* 0x3c */ "\000\000\000\074" "\000\000\000\075" "\000\000\000\076"
/* 0x3f */ "\000\000\000\077" "\000\000\000\100" "\000\000\000\101"
/* 0x42 */ "\000\000\000\102" "\000\000\000\103" "\000\000\000\104"
/* 0x45 */ "\000\000\000\105" "\000\000\000\106" "\000\000\000\107"
/* 0x48 */ "\000\000\000\110" "\000\000\000\111" "\000\000\000\112"
/* 0x4b */ "\000\000\000\113" "\000\000\000\114" "\000\000\000\115"
/* 0x4e */ "\000\000\000\116" "\000\000\000\117" "\000\000\000\120"
/* 0x51 */ "\000\000\000\121" "\000\000\000\122" "\000\000\000\123"
/* 0x54 */ "\000\000\000\124" "\000\000\000\125" "\000\000\000\126"
/* 0x57 */ "\000\000\000\127" "\000\000\000\130" "\000\000\000\131"
/* 0x5a */ "\000\000\000\132" "\000\000\000\133" "\000\000\000\134"
/* 0x5d */ "\000\000\000\135" "\000\000\000\136" "\000\000\000\137"
/* 0x60 */ "\000\000\000\140" "\000\000\000\141" "\000\000\000\142"
/* 0x63 */ "\000\000\000\143" "\000\000\000\144" "\000\000\000\145"
/* 0x66 */ "\000\000\000\146" "\000\000\000\147" "\000\000\000\150"
/* 0x69 */ "\000\000\000\151" "\000\000\000\152" "\000\000\000\153"
/* 0x6c */ "\000\000\000\154" "\000\000\000\155" "\000\000\000\156"
/* 0x6f */ "\000\000\000\157" "\000\000\000\160" "\000\000\000\161"
/* 0x72 */ "\000\000\000\162" "\000\000\000\163" "\000\000\000\164"
/* 0x75 */ "\000\000\000\165" "\000\000\000\166" "\000\000\000\167"
/* 0x78 */ "\000\000\000\170" "\000\000\000\171" "\000\000\000\172"
/* 0x7b */ "\000\000\000\173" "\000\000\000\174" "\000\000\000\175"
/* 0x7e */ "\000\000\000\176" "\000\000\000\177" "\000\000\000\200"
/* 0x81 */ "\000\000\000\201" "\000\000\000\202" "\000\000\000\203"
/* 0x84 */ "\000\000\000\204" "\000\000\000\205" "\000\000\000\206"
/* 0x87 */ "\000\000\000\207" "\000\000\000\210" "\000\000\000\211"
/* 0x8a */ "\000\000\000\212" "\000\000\000\213" "\000\000\000\214"
/* 0x8d */ "\000\000\000\215" "\000\000\000\216" "\000\000\000\217"
/* 0x90 */ "\000\000\000\220" "\000\000\000\221" "\000\000\000\222"
/* 0x93 */ "\000\000\000\223" "\000\000\000\224" "\000\000\000\225"
/* 0x96 */ "\000\000\000\226" "\000\000\000\227" "\000\000\000\230"
/* 0x99 */ "\000\000\000\231" "\000\000\000\232" "\000\000\000\233"
/* 0x9c */ "\000\000\000\234" "\000\000\000\235" "\000\000\000\236"
/* 0x9f */ "\000\000\000\237" "\000\000\000\240" "\000\000\000\241"
/* 0xa2 */ "\000\000\000\242" "\000\000\000\243" "\000\000\000\244"
/* 0xa5 */ "\000\000\000\245" "\000\000\000\246" "\000\000\000\247"
/* 0xa8 */ "\000\000\000\250" "\000\000\000\251" "\000\000\000\252"
/* 0xab */ "\000\000\000\253" "\000\000\000\254" "\000\000\000\255"
/* 0xae */ "\000\000\000\256" "\000\000\000\257" "\000\000\000\260"
/* 0xb1 */ "\000\000\000\261" "\000\000\000\262" "\000\000\000\263"
/* 0xb4 */ "\000\000\000\264" "\000\000\000\265" "\000\000\000\266"
/* 0xb7 */ "\000\000\000\267" "\000\000\000\270" "\000\000\000\271"
/* 0xba */ "\000\000\000\272" "\000\000\000\273" "\000\000\000\274"
/* 0xbd */ "\000\000\000\275" "\000\000\000\276" "\000\000\000\277"
/* 0xc0 */ "\000\000\000\300" "\000\000\000\301" "\000\000\000\302"
/* 0xc3 */ "\000\000\000\303" "\000\000\000\304" "\000\000\000\305"
/* 0xc6 */ "\000\000\000\306" "\000\000\000\307" "\000\000\000\310"
/* 0xc9 */ "\000\000\000\311" "\000\000\000\312" "\000\000\000\313"
/* 0xcc */ "\000\000\000\314" "\000\000\000\315" "\000\000\000\316"
/* 0xcf */ "\000\000\000\317" "\000\000\000\320" "\000\000\000\321"
/* 0xd2 */ "\000\000\000\322" "\000\000\000\323" "\000\000\000\324"
/* 0xd5 */ "\000\000\000\325" "\000\000\000\326" "\000\000\000\327"
/* 0xd8 */ "\000\000\000\330" "\000\000\000\331" "\000\000\000\332"
/* 0xdb */ "\000\000\000\333" "\000\000\000\334" "\000\000\000\335"
/* 0xde */ "\000\000\000\336" "\000\000\000\337" "\000\000\000\340"
/* 0xe1 */ "\000\000\000\341" "\000\000\000\342" "\000\000\000\343"
/* 0xe4 */ "\000\000\000\344" "\000\000\000\345" "\000\000\000\346"
/* 0xe7 */ "\000\000\000\347" "\000\000\000\350" "\000\000\000\351"
/* 0xea */ "\000\000\000\352" "\000\000\000\353" "\000\000\000\354"
/* 0xed */ "\000\000\000\355" "\000\000\000\356" "\000\000\000\357"
/* 0xf0 */ "\000\000\000\360" "\000\000\000\361" "\000\000\000\362"
/* 0xf3 */ "\000\000\000\363" "\000\000\000\364" "\000\000\000\365"
/* 0xf6 */ "\000\000\000\366" "\000\000\000\367" "\000\000\000\370"
/* 0xf9 */ "\000\000\000\371" "\000\000\000\372" "\000\000\000\373"
/* 0xfc */ "\000\000\000\374" "\000\000\000\375" "\000\000\000\376"
/* 0xff */ "\000\000\000\377"
;
#else
#error "BYTE_ORDER" BYTE_ORDER " not handled."
#endif
const char _nl_C_LC_CTYPE_width[256] =
/* 0x00 */ "\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001"
/* 0x10 */ "\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001"
/* 0x20 */ "\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001"
/* 0x30 */ "\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001"
/* 0x40 */ "\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001"
/* 0x50 */ "\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001"
/* 0x60 */ "\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001"
/* 0x70 */ "\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001"
/* 0x80 */ "\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001"
/* 0x90 */ "\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001"
/* 0xa0 */ "\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001"
/* 0xb0 */ "\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001"
/* 0xc0 */ "\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001"
/* 0xd0 */ "\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001"
/* 0xe0 */ "\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001"
/* 0xf0 */ "\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001"
;
const struct locale_data _nl_C_LC_CTYPE =
const struct locale_data _nl_C_LC_CTYPE =
{
NULL, 0, /* no file mapped */
5,
13,
{
_nl_C_LC_CTYPE_class,
NULL, NULL,
_nl_C_LC_CTYPE_toupper,
_nl_C_LC_CTYPE_tolower
{ string: _nl_C_LC_CTYPE_class },
#if BYTE_ORDER == LITTLE_ENDIAN
{ string: NULL }, { string: NULL },
#endif
{ string: _nl_C_LC_CTYPE_toupper },
{ string: _nl_C_LC_CTYPE_tolower },
{ string: NULL },
#if BYTE_ORDER == BIG_ENDIAN
{ string: NULL },
#endif
{ string: _nl_C_LC_CTYPE_class32 },
{ string: _nl_C_LC_CTYPE_names },
#if BYTE_ORDER == BIG_ENDIAN
{ string: NULL },
#endif
{ word: 256 }, { word: 1 },
{ string: "upper\0" "lower\0" "alpha\0" "digit\0" "xdigit\0" "space\0"
"print\0" "graph\0" "blank\0" "cntrl\0" "punct\0" "alnum\0" },
{ string: "tolower\0" "toupper\0" },
{ string: _nl_C_LC_CTYPE_width }
}
};
+5 -5
View File
@@ -1,5 +1,5 @@
/* Generated by GNU locale 0.1.
Copyright (C) 1995 Free Software Foundation, Inc.
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. */
@@ -11,9 +11,9 @@ const struct locale_data _nl_C_LC_MESSAGES =
NULL, 0, /* no file mapped */
4,
{
"[yY][[:alpha:]]",
"[nN][[:alpha:]]",
"",
""
{ string: "[yY][[:alpha:]]" },
{ string: "[nN][[:alpha:]]" },
{ string: "" },
{ string: "" }
}
};
+16 -16
View File
@@ -1,5 +1,5 @@
/* Generated by GNU locale 0.1.
Copyright (C) 1995 Free Software Foundation, Inc.
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. */
@@ -11,20 +11,20 @@ const struct locale_data _nl_C_LC_MONETARY =
NULL, 0, /* no file mapped */
15,
{
"",
"",
"",
"",
"\177",
"",
"",
"\177",
"\177",
"\177",
"\177",
"\177",
"\177",
"\177",
"\177"
{ string: "" },
{ string: "" },
{ string: "" },
{ string: "" },
{ string: "\177" },
{ string: "" },
{ string: "" },
{ string: "\177" },
{ string: "\177" },
{ string: "\177" },
{ string: "\177" },
{ string: "\177" },
{ string: "\177" },
{ string: "\177" },
{ string: "\177" }
}
};
+4 -4
View File
@@ -1,5 +1,5 @@
/* Generated by GNU locale 0.1.
Copyright (C) 1995 Free Software Foundation, Inc.
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. */
@@ -11,8 +11,8 @@ const struct locale_data _nl_C_LC_NUMERIC =
NULL, 0, /* no file mapped */
3,
{
".",
"",
"\177"
{ string: "." },
{ string: "" },
{ string: "\177" }
}
};
+47 -46
View File
@@ -1,5 +1,5 @@
/* Generated by GNU locale 0.1.
Copyright (C) 1995 Free Software Foundation, Inc.
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. */
@@ -9,51 +9,52 @@ PARTICULAR PURPOSE. */
const struct locale_data _nl_C_LC_TIME =
{
NULL, 0, /* no file mapped */
44,
45,
{
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat",
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
"AM",
"PM",
"%a %b %d %H:%M:%S %Y",
"%m/%d/%y",
"%H:%M:%S",
NULL
{ string: "Sun" },
{ string: "Mon" },
{ string: "Tue" },
{ string: "Wed" },
{ string: "Thu" },
{ string: "Fri" },
{ string: "Sat" },
{ string: "Sunday" },
{ string: "Monday" },
{ string: "Tuesday" },
{ string: "Wednesday" },
{ string: "Thursday" },
{ string: "Friday" },
{ string: "Saturday" },
{ string: "Jan" },
{ string: "Feb" },
{ string: "Mar" },
{ string: "Apr" },
{ string: "May" },
{ string: "Jun" },
{ string: "Jul" },
{ string: "Aug" },
{ string: "Sep" },
{ string: "Oct" },
{ string: "Nov" },
{ string: "Dec" },
{ string: "January" },
{ string: "February" },
{ string: "March" },
{ string: "April" },
{ string: "May" },
{ string: "June" },
{ string: "July" },
{ string: "August" },
{ string: "September" },
{ string: "October" },
{ string: "November" },
{ string: "December" },
{ string: "AM" },
{ string: "PM" },
{ string: "%a %b %d %H:%M:%S %Y" },
{ string: "%m/%d/%y" },
{ string: "%H:%M:%S" },
{ string: "%I:%M:%S %p" },
{ string: NULL }
}
};
+20 -12
View File
@@ -13,8 +13,8 @@
# 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.
# not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Makefile for locales.
@@ -24,8 +24,10 @@ subdir := locale
headers = locale.h
distribute = localeinfo.h categories.def \
$(localedef-modules:=.c) $(locale-modules:=.c) \
$(lib-modules:=.c) config.h hash.h iso-4217.def \
keyword.gperf keyword.h localedef.h token.h
$(lib-modules:=.c) config.h simple-hash.h iso-4217.def \
charmap-kw.gperf charmap-kw.h locfile-token.h \
locfile-kw.gperf locfile-kw.h linereader.h \
locales.h locfile.h stringtrans.h
routines = setlocale loadlocale localeconv nl_langinfo
categories = ctype messages monetary numeric time collate
aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc
@@ -34,10 +36,12 @@ install-bin = localedef locale
extra-objs = $(localedef-modules:=.o) $(locale-modules:=.o) \
$(lib-modules:=.o)
localedef-modules := charmap locfile-lex locfile-parse locale-ctype \
monetary messages collate numeric
locale-modules := ctypedump
lib-modules := locfile-hash xmalloc
vpath %.c programs
vpath %.h programs
localedef-modules := $(categories:%=ld-%) charmap charset linereader \
locfile stringtrans
lib-modules := simple-hash xmalloc xstrdup
GPERF = gperf
@@ -45,14 +49,18 @@ GPERFFLAGS = -acCgopt -k1,2,5,$$
include ../Rules
keyword.h: keyword.gperf
$(GPERF) $(GPERFFLAGS) $< > $@.new
programs/%-kw.h: programs/%-kw.gperf
$(GPERF) $(GPERFFLAGS) -N $(@F:-kw.h=_hash) $< > $@.new
mv -f $@.new $@
$(objpfx)localedef: $(localedef-modules:%=$(objpfx)%.o)
$(objpfx)locale: $(locale-modules:%=$(objpfx)%.o)
$(objpfx)localedef $(objpfx)locale: $(lib-modules:%=$(objpfx)%.o)
CPPFLAGS += -DLOCALE_PATH='"$(localedir)"' -DCHARMAP_PATH='"$(nlsdir)/charmap"'
CPPFLAGS := -DLOCALE_PATH='"$(localedir)"' \
-DCHARMAP_PATH='"$(i18ndir)/charmap"' \
-DLOCSRCDIR='"$(i18ndir)/locales"' -DHAVE_CONFIG_H \
-Iliblib -Iprograms $(CPPFLAGS)
CFLAGS-locfile-lex.c = -Wno-write-strings
CFLAGS-charmap.c = -Wno-write-strings
CFLAGS-locfile.c = -Wno-write-strings
+3 -1
View File
@@ -1,4 +1,6 @@
/* Define a constant for the dgettext domainname for libc internal messages,
so the string constant is not repeated in dozens of object files. */
const char _libc_intl_domainname[] = "SYS_libc";
#include "../version.h"
const char _libc_intl_domainname[] = "SYS_GNU_libc-" VERSION;
+92 -69
View File
@@ -1,5 +1,5 @@
/* Definition of all available locale categories and their items. -*- C -*-
Copyright (C) 1995 Free Software Foundation, Inc.
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
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
@@ -32,88 +32,111 @@ Cambridge, MA 02139, USA. */
program code which loads this file.
The various value types for the items are `string', `stringarray', `byte'
and `bytearray'. These cover all possible values in the current locale
definitions. `min' and `max' can be individually used again. */
`bytearray', and `word'. These cover all possible values in the current
locale definitions. `min' and `max' can be individually used again. */
#ifndef NO_POSTLOAD
#define NO_POSTLOAD NULL
#endif
DEFINE_CATEGORY (LC_COLLATE, "LC_COLLATE",
(
{ 0 } /* No data encoding yet. */
), NO_POSTLOAD, collate_input, NULL, NULL )
DEFINE_CATEGORY
(
LC_COLLATE, "LC_COLLATE",
(
DEFINE_ELEMENT (_NL_COLLATE_NRULES, "collate-nrules", std, word)
DEFINE_ELEMENT (_NL_COLLATE_RULES, "collate-rules", std, string)
DEFINE_ELEMENT (_NL_COLLATE_HASH_SIZE, "collate-hash-size", std, word)
DEFINE_ELEMENT (_NL_COLLATE_HASH_LAYERS, "collate-hash-layers", std, word)
DEFINE_ELEMENT (_NL_COLLATE_TABLE_EB, "collate-table-eb", std, string)
DEFINE_ELEMENT (_NL_COLLATE_TABLE_EL, "collate-table-el", std, string)
DEFINE_ELEMENT (_NL_COLLATE_UNDEFINED, "collate-undefined", std, word)
DEFINE_ELEMENT (_NL_COLLATE_EXTRA_EB, "collate-extra-eb", std, string)
DEFINE_ELEMENT (_NL_COLLATE_EXTRA_EL, "collate-extra-el", std, string)
), _nl_postload_collate, collate_input, NULL, NULL)
/* The actual definition of ctype is meaningless here. It is hard coded in
the code because it has to be handled very specially. Only the names of
the functions are important. */
DEFINE_CATEGORY (LC_CTYPE, "LC_CTYPE",
(
{ _NL_CTYPE_CLASS, "ctype-class", std, string },
{ _NL_CTYPE_TOUPPER_EB, "ctype-toupper-eb", std, string },
{ _NL_CTYPE_TOLOWER_EB, "ctype-tolower-eb", std, string },
{ _NL_CTYPE_TOUPPER_EL, "ctype-toupper-el", std, string },
{ _NL_CTYPE_TOLOWER_EL, "ctype-tolower-el", std, string },
{ 0 }
), _nl_postload_ctype,
ctype_input, ctype_check, ctype_output )
the functions and the value types are important. */
DEFINE_CATEGORY
(
LC_CTYPE, "LC_CTYPE",
(
DEFINE_ELEMENT (_NL_CTYPE_CLASS, "ctype-class", std, string)
DEFINE_ELEMENT (_NL_CTYPE_TOUPPER_EB, "ctype-toupper-eb", std, string)
DEFINE_ELEMENT (_NL_CTYPE_TOLOWER_EB, "ctype-tolower-eb", std, string)
DEFINE_ELEMENT (_NL_CTYPE_TOUPPER_EL, "ctype-toupper-el", std, string)
DEFINE_ELEMENT (_NL_CTYPE_TOLOWER_EL, "ctype-tolower-el", std, string)
DEFINE_ELEMENT (_NL_CTYPE_NAMES_EB, "ctype-names-eb", std, string)
DEFINE_ELEMENT (_NL_CTYPE_NAMES_EL, "ctype-names-eb", std, string)
DEFINE_ELEMENT (_NL_CTYPE_HASH_SIZE, "ctype-hash-size", std, word)
DEFINE_ELEMENT (_NL_CTYPE_HASH_LAYERS, "ctype-hash-layers", std, word)
DEFINE_ELEMENT (_NL_CTYPE_CLASS_NAMES, "ctype-class-names", std, string)
DEFINE_ELEMENT (_NL_CTYPE_MAP_NAMES, "ctype-map-names", std, string)
DEFINE_ELEMENT (_NL_CTYPE_WIDTH, "ctype-width", std, bytearray)
), _nl_postload_ctype, ctype_input, ctype_check, ctype_output)
DEFINE_CATEGORY (LC_MONETARY, "LC_MONETARY",
(
{ INT_CURR_SYMBOL, "int_curr_symbol", std, string },
{ CURRENCY_SYMBOL, "currency_symbol", std, string },
{ MON_DECIMAL_POINT, "mon_decimal_point", std, string },
{ MON_THOUSANDS_SEP, "mon_thousands_sep", std, string },
{ MON_GROUPING, "mon_grouping", std, bytearray },
{ POSITIVE_SIGN, "positive_sign", std, string },
{ NEGATIVE_SIGN, "negative_sign", std, string },
{ INT_FRAC_DIGITS, "int_frac_digits", std, byte },
{ FRAC_DIGITS, "frac_digits", std, byte },
{ P_CS_PRECEDES, "p_cs_precedes", std, byte, 0, 1 },
{ P_SEP_BY_SPACE, "p_sep_by_space", std, byte, 0, 2 },
{ N_CS_PRECEDES, "n_cs_precedes", std, byte, 0, 1 },
{ N_SEP_BY_SPACE, "n_sep_by_space", std, byte, 0, 2 },
{ P_SIGN_POSN, "p_sign_posn", std, byte, 0, 4 },
{ N_SIGN_POSN, "n_sign_posn", std, byte, 0, 4 },
{ 0 }
), NO_POSTLOAD, NULL, monetary_check, NULL )
DEFINE_CATEGORY
(
LC_MONETARY, "LC_MONETARY",
(
DEFINE_ELEMENT (INT_CURR_SYMBOL, "int_curr_symbol", std, string)
DEFINE_ELEMENT (CURRENCY_SYMBOL, "currency_symbol", std, string)
DEFINE_ELEMENT (MON_DECIMAL_POINT, "mon_decimal_point", std, string)
DEFINE_ELEMENT (MON_THOUSANDS_SEP, "mon_thousands_sep", std, string)
DEFINE_ELEMENT (MON_GROUPING, "mon_grouping", std, bytearray)
DEFINE_ELEMENT (POSITIVE_SIGN, "positive_sign", std, string)
DEFINE_ELEMENT (NEGATIVE_SIGN, "negative_sign", std, string)
DEFINE_ELEMENT (INT_FRAC_DIGITS, "int_frac_digits", std, byte)
DEFINE_ELEMENT (FRAC_DIGITS, "frac_digits", std, byte)
DEFINE_ELEMENT (P_CS_PRECEDES, "p_cs_precedes", std, byte, 0, 1)
DEFINE_ELEMENT (P_SEP_BY_SPACE, "p_sep_by_space", std, byte, 0, 2)
DEFINE_ELEMENT (N_CS_PRECEDES, "n_cs_precedes", std, byte, 0, 1)
DEFINE_ELEMENT (N_SEP_BY_SPACE, "n_sep_by_space", std, byte, 0, 2)
DEFINE_ELEMENT (P_SIGN_POSN, "p_sign_posn", std, byte, 0, 4)
DEFINE_ELEMENT (N_SIGN_POSN, "n_sign_posn", std, byte, 0, 4)
), NO_POSTLOAD, NULL, monetary_check, NULL)
DEFINE_CATEGORY (LC_NUMERIC, "LC_NUMERIC",
(
{ DECIMAL_POINT, "decimal_point", std, string },
{ THOUSANDS_SEP, "thousands_sep", std, string },
{ GROUPING, "grouping", std, bytearray },
{ 0 }
), NO_POSTLOAD, NULL, numeric_check, NULL)
DEFINE_CATEGORY
(
LC_NUMERIC, "LC_NUMERIC",
(
DEFINE_ELEMENT (DECIMAL_POINT, "decimal_point", std, string)
DEFINE_ELEMENT (THOUSANDS_SEP, "thousands_sep", std, string)
DEFINE_ELEMENT (GROUPING, "grouping", std, bytearray)
), NO_POSTLOAD, NULL, numeric_check, NULL)
DEFINE_CATEGORY (LC_TIME, "LC_TIME",
(
{ ABDAY_1, "abday", std, stringarray, 7, 7 },
{ DAY_1, "day", std, stringarray, 7, 7 },
{ ABMON_1, "abmon", std, stringarray, 12, 12 },
{ MON_1, "mon", std, stringarray, 12, 12 },
{ AM_STR, "am_pm", std, stringarray, 2, 2 },
{ D_T_FMT, "d_t_fmt", std, string },
{ D_FMT, "d_fmt", std, string },
{ T_FMT, "t_fmt", std, string },
{ T_FMT_AMPM, "t_fmt_ampm", std, string },
{ ERA, "era", opt, string },
{ ERA_YEAR, "era_year", opt, string },
{ ERA_D_FMT, "era_d_fmt", opt, string },
{ ALT_DIGITS, "alt_digits", opt, stringarray, 0, 100 },
{ 0 }
), NO_POSTLOAD, NULL, NULL, NULL )
DEFINE_CATEGORY
(
LC_TIME, "LC_TIME",
(
DEFINE_ELEMENT (ABDAY_1, "abday", std, stringarray, 7, 7)
DEFINE_ELEMENT (DAY_1, "day", std, stringarray, 7, 7)
DEFINE_ELEMENT (ABMON_1, "abmon", std, stringarray, 12, 12)
DEFINE_ELEMENT (MON_1, "mon", std, stringarray, 12, 12)
DEFINE_ELEMENT (AM_STR, "am_pm", std, stringarray, 2, 2)
DEFINE_ELEMENT (D_T_FMT, "d_t_fmt", std, string)
DEFINE_ELEMENT (D_FMT, "d_fmt", std, string)
DEFINE_ELEMENT (T_FMT, "t_fmt", std, string)
DEFINE_ELEMENT (T_FMT_AMPM, "t_fmt_ampm", std, string)
DEFINE_ELEMENT (ERA, "era", opt, string)
DEFINE_ELEMENT (ERA_YEAR, "era_year", opt, string)
DEFINE_ELEMENT (ERA_D_FMT, "era_d_fmt", opt, string)
DEFINE_ELEMENT (ALT_DIGITS, "alt_digits", opt, stringarray, 0, 100)
DEFINE_ELEMENT (ERA_D_T_FMT, "era_d_t_fmt", opt, string)
DEFINE_ELEMENT (ERA_T_FMT, "era_t_fmt", opt, string)
), NO_POSTLOAD, NULL, NULL, NULL)
DEFINE_CATEGORY (LC_MESSAGES, "LC_MESSAGES",
(
{ YESEXPR, "yesexpr", std, string },
{ NOEXPR, "noexpr", std, string },
{ YESSTR, "yesstr", opt, string },
{ NOSTR, "nostr", opt, string },
{ 0 }
), NO_POSTLOAD, NULL, messages_check, NULL )
DEFINE_CATEGORY
(
LC_MESSAGES, "LC_MESSAGES",
(
DEFINE_ELEMENT (YESEXPR, "yesexpr", std, string)
DEFINE_ELEMENT (NOEXPR, "noexpr", std, string)
DEFINE_ELEMENT (YESSTR, "yesstr", opt, string)
DEFINE_ELEMENT (NOSTR, "nostr", opt, string)
), NO_POSTLOAD, NULL, messages_check, NULL)
-524
View File
@@ -1,524 +0,0 @@
/* Copyright (C) 1995 Free Software Foundation, Inc.
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 <ctype.h>
#include <errno.h>
#include <libintl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "localedef.h"
#include "hash.h"
/* Data structure for representing charmap database. */
struct charmap charmap_data;
/* Line number in charmap file. */
static unsigned int line_no;
/* Prototypes for local functions. */
static void read_prolog (FILE *infile);
static unsigned long read_body (FILE *infile);
/* Read complete table of symbolic names for character set from file. If
this file does not exist or is not readable a default file is tried.
If this also is not readable no character map is defined. */
void
charmap_read (const char *filename)
{
unsigned long max_char;
long path_max = pathconf (".", _PC_PATH_MAX);
char buf[path_max];
FILE *infile = NULL;
/* Initialize charmap data. */
charmap_data.codeset_name = NULL;
charmap_data.mb_cur_max = -1;
charmap_data.mb_cur_min = -1;
charmap_data.escape_char = '\\';
charmap_data.comment_char = '#';
if (filename != NULL)
{
strcpy (buf, filename);
infile = fopen (filename, "r");
if (infile == NULL && filename[0] != '/')
{
snprintf (buf, path_max, "%s/%s", CHARMAP_PATH, filename);
infile = fopen (buf, "r");
}
}
if (infile == NULL)
{
if (filename != NULL)
error (0, errno, gettext ("input file `%s' not found"), filename);
snprintf (buf, path_max, "%s/%s", CHARMAP_PATH, DEFAULT_CHARMAP);
infile = fopen (buf, "r");
if (infile == NULL)
error (4, errno, gettext ("input file `%s' not found"), filename);
}
charmap_data.filename = buf;
init_hash (&charmap_data.table, 500);
line_no = 0;
/* Read the prolog of the charmap file. */
read_prolog (infile);
/* Last works on the charmap tables global data. */
if (charmap_data.mb_cur_max == -1)
charmap_data.mb_cur_max = 1;
if (charmap_data.mb_cur_min == -1)
charmap_data.mb_cur_min = charmap_data.mb_cur_max;
if ((size_t) charmap_data.mb_cur_max > sizeof (long))
{
error (2, 0, gettext ("program limitation: for now only upto %Zu "
"bytes per character are allowed"), sizeof (long));
}
/* Now process all entries. */
max_char = read_body (infile);
/* We don't need the file anymore. */
fclose (infile);
/* Determine the optimal table size when using the simple modulo hashing
function. */
if (max_char >= 256)
{
int size;
/* Current best values, initialized to some never reached high value. */
int best_count = 10000;
int best_size = 10000;
int best_product = best_count * best_size;
/* Give warning. */
error (-1, 0, gettext ("computing character table size: this may take "
"a while"));
for (size = 256; size <= best_product; ++size)
{
/* Array with slot counters. */
int cnt[size];
/* Current character. */
int ch;
/* Maximal number of characters in any slot. */
int maxcnt = 0;
/* Product of current size and maximal count. */
int product = 0;
/* Iteration pointer through hashing table. */
char *ptr = NULL;
/* Initializes counters to zero. */
memset(cnt, 0, size * sizeof (int));
/* Iterate through whole hashing table. */
while (product < best_product
&& iterate_table (&charmap_data.table, (void **) &ptr,
(void **) &ch))
{
/* Increment slot counter. */
++cnt[ch % size];
/* Test for current maximum. */
if (cnt[ch % size] > maxcnt)
{
maxcnt = cnt[ch % size];
product = maxcnt * size;
}
}
if (product < best_product)
{
best_count = maxcnt;
best_size = size;
best_product = best_count * best_size;
}
}
charmap_data.hash_size = best_size;
charmap_data.hash_layers = best_count;
}
else
{
charmap_data.hash_size = 256;
charmap_data.hash_layers = 1;
}
}
#define SYNTAX_ERROR \
do { error (0, 0, gettext ("%s:%u: syntax error in charmap file"), \
charmap_data.filename, line_no); \
goto end_of_loop; } while (0)
/* Read the prolog of the charmap file until the line containing `CHARMAP'.
All possible entries are processed. */
static void
read_prolog (FILE *infile)
{
size_t bufsize = sysconf (_SC_LINE_MAX);
char buf[bufsize];
while (1)
{
char *cp = buf;
char len;
/* Read the next line. */
fgets (buf, bufsize, infile);
len = strlen (buf);
/* On EOF simply return. */
if (len == 0 || buf[len - 1] != '\n')
error (4, 0, gettext ("%s: unexpected end of file in charmap"),
charmap_data.filename);
/* This is the next line. */
++line_no;
/* Comments and empty lines are ignored. */
if (len == 1 || buf[0] == charmap_data.comment_char)
continue;
buf[len - 1] = '\0';
/* Throw away leading white spaces. This is not defined in POSIX.2
so don't do it if conformance is requested. */
if (!posix_conformance)
while (isspace (*cp))
++cp;
/* If `CHARMAP' is read the prolog is over. */
if (strncmp (cp, "CHARMAP", 7) == 0
&& (!posix_conformance || cp[7] == '\0'))
return;
/* Now it can be only one of special symbols defining the charmap
parameters. All are beginning with '<'. */
if (*cp != '<')
SYNTAX_ERROR;
++cp;
if (strncmp (cp, "code_set_name>", 14) == 0)
{
char *startp;
#define cp_to_arg(no,pred) \
cp += no; \
while (isspace (*cp)) \
++cp; \
if (*cp == '\0' || !pred (*cp)) \
SYNTAX_ERROR;
cp_to_arg (14,isgraph)
if (charmap_data.codeset_name != NULL)
{
error (0, 0, gettext ("%s:%u: duplicate code set name "
"specification"),
charmap_data.filename, line_no);
free (charmap_data.codeset_name);
}
startp = cp;
while (*cp != '\0' && isgraph (*cp) && !isspace (*cp))
++cp;
charmap_data.codeset_name = (char *) xmalloc (cp - startp + 1);
strncpy (startp, startp, cp - startp);
}
else if (strncmp (cp, "mb_cur_max>", 11) == 0)
{
int new_val;
cp_to_arg (11,isdigit)
if (charmap_data.mb_cur_max != -1)
error (0, 0,
gettext ("%s:%u: duplicate definition of mb_cur_max"),
charmap_data.filename, line_no);
new_val = (int) strtol (cp, &cp, posix_conformance ? 10 : 0);
if (new_val < 1)
error (0, 0, gettext ("%s:%u: illegal value for mb_cur_max: %d"),
charmap_data.filename, line_no, new_val);
else
charmap_data.mb_cur_max = new_val;
}
else if (strncmp (cp, "mb_cur_min>", 11) == 0)
{
int new_val;
cp_to_arg (11,isdigit)
if (charmap_data.mb_cur_max != -1)
error (0, 0,
gettext ("%s:%u: duplicate definition of mb_cur_min"),
charmap_data.filename, line_no);
new_val = (int) strtol (cp, &cp, posix_conformance ? 10 : 0);
if (new_val < 1)
error (0, 0, gettext ("%s:%u: illegal value for mb_cur_min: %d"),
charmap_data.filename, line_no, new_val);
else
charmap_data.mb_cur_min = new_val;
}
else if (strncmp (cp, "escape_char>", 12) == 0)
{
cp_to_arg (12, isgraph)
charmap_data.escape_char = *cp;
}
else if (strncmp (cp, "comment_char>", 13) == 0)
{
cp_to_arg (13, isgraph)
charmap_data.comment_char = *cp;
}
else
SYNTAX_ERROR;
end_of_loop:
}
}
#undef cp_to_arg
static unsigned long
read_body (FILE *infile)
{
unsigned long max_char = 0;
size_t bufsize = sysconf (_SC_LINE_MAX);
char buf[bufsize];
char name_str[bufsize / 2];
char code_str[bufsize / 2];
while (1)
{
char *cp = buf;
size_t len;
/* Read the next line. */
fgets (buf, bufsize, infile);
len = strlen (buf);
/* On EOF simply return. */
if (len == 0)
error (0, 0, gettext ("%s: `END CHARMAP' is missing"),
charmap_data.filename);
/* This is the next line. */
++line_no;
if (len == bufsize - 1)
{
error (0, 0, gettext ("%s:%u: line too long; use `getconf "
"LINE_MAX' to get the current maximum line"
"length"), charmap_data.filename, line_no);
do
{
fgets (buf, bufsize, infile);
len = strlen (buf);
}
while (len == bufsize - 1);
continue;
}
/* Comments and empty lines are ignored. */
if (len == 1 || buf[0] == charmap_data.comment_char)
continue;
buf[len - 1] = '\0';
/* Throw away leading white spaces. This is not defined in POSIX.2
so don't do it if conformance is requested. */
if (!posix_conformance)
while (isspace (*cp))
++cp;
if (*cp == '<')
{
char *end1p, *end2p, *start2p;
size_t cnt = 0;
unsigned long char_value = 0;
if (sscanf (cp + 1, "%s %s", name_str, code_str) != 2)
SYNTAX_ERROR;
end1p = cp = name_str;
while (*cp != '\0' && *cp != '>')
{
if (*cp == charmap_data.escape_char)
if (*++cp == '\0')
SYNTAX_ERROR;
*end1p++ = *cp++;
}
if (*cp == '\0')
/* No final '>'. Make error condition. */
end1p = name_str;
else
++cp;
*end1p = '\0';
if (*cp == '.' && *++cp == '.' && *++cp == '.' && *++cp == '<')
{
/* This might be the alternate form. */
start2p = end2p = ++cp;
while (*cp != '\0' && *cp != '>')
{
if (*cp == charmap_data.escape_char)
if (*++cp == '\0')
SYNTAX_ERROR;
*end2p = *cp++;
}
if (*cp == '\0')
/* NO final '>'. Make error condition. */
end2p = start2p;
else
++cp;
}
else
start2p = end2p = NULL;
if (end1p == name_str || (start2p != NULL && start2p != end2p)
|| *cp != '\0'
|| *code_str != charmap_data.escape_char)
SYNTAX_ERROR;
cp = code_str;
do
{
char *begin;
long val;
switch (*++cp)
{
case 'd':
val = strtol ((begin = cp + 1), &cp, 10);
break;
case 'x':
val = strtol ((begin = cp + 1), &cp, 16);
break;
default:
val = strtol ((begin = cp), &cp, 8);
break;
}
if (begin == cp)
SYNTAX_ERROR;
if (posix_conformance && cp - begin < 2)
error (0, 0, gettext ("%s:%u: byte constant has less than "
"two digits"),
charmap_data.filename, line_no);
if (val < 0 || val > 255)
{
error (0, 0, gettext ("%s:%u: character encoding must be "
"given in 8-bit bytes"),
charmap_data.filename, line_no);
goto end_of_loop;
}
if (cnt < (size_t) charmap_data.mb_cur_max)
{
if (cnt < sizeof (long)) /* FIXME */
char_value = (char_value << 8) | val;
}
else
{
error (0, 0, gettext ("%s:%u: number of bytes in character "
"definition exceeds `mb_cur_max'"),
charmap_data.filename, line_no);
break;
}
++cnt;
}
while (*cp == charmap_data.escape_char);
/* Ignore the rest of the line (comment). */
if (end2p == NULL)
{
if (insert_entry (&charmap_data.table, name_str,
end1p - name_str, (void *) char_value))
error (0, 0, gettext ("%s:%u: duplicate entry"),
charmap_data.filename, line_no);
max_char = MAX (max_char, char_value);
}
else
{
char *en1, *en2, *start1p;
long n1, n2, n;
start1p = name_str;
while (*start1p == *start2p && !isdigit (*start1p)
&& start1p < end1p)
++start1p, ++start2p;
n1 = strtol (start1p, &en1, 10);
n2 = strtol (start2p, &en2, 10);
if (en1 - start1p != en2 - start2p || en1 != end1p
|| en2 != end2p)
SYNTAX_ERROR;
if (n1 > n2)
error (0, 0, gettext ("%s:%u: starting character is bigger "
"than last"),
charmap_data.filename, line_no);
n = n1;
while (n <= n2)
{
snprintf(start1p, en1 - start1p, "%0*d", en1 - start1p, n);
if (insert_entry (&charmap_data.table, name_str,
en1 - name_str,
(void *) (char_value + n - n1)))
error (0, 0, gettext ("%s:%u: duplicate entry"),
charmap_data.filename, line_no);
max_char = MAX (max_char, char_value + n - n1);
++n;
}
}
}
else
{
if (strncmp (cp, "END CHARMAP", 11) == 0)
return max_char;
SYNTAX_ERROR;
}
end_of_loop:
}
return max_char;
}
/*
* Local Variables:
* mode:c
* c-basic-offset:2
* End:
*/
-212
View File
@@ -1,212 +0,0 @@
/* Copyright (C) 1995 Free Software Foundation, Inc.
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 <langinfo.h>
#include <libintl.h>
#include "localedef.h"
#include "token.h"
/* defined in locfile-lex.c: flag to indicate that unknown element names
are allowed. */
extern int reject_new_char;
#define SYNTAX_ERROR \
error (0, 0, gettext ("%s:%Zd: syntax error in locale definition file"), \
locfile_data.filename, locfile_data.line_no);
void
collate_input (int token)
{
int read_order_start = 0;
while (1)
{
char *ptr;
int len;
if (token == TOK_END)
/* This is the end of the category. */
{
token = xlocfile_lex (&ptr, &len);
if (token != _NL_NUM_LC_COLLATE)
{
error (0, 0, gettext ("%s:%Zd: category `%s' does not end "
"with `END %s'"), locfile_data.filename,
locfile_data.line_no, "LC_COLLATE", "LC_COLLATE");
ignore_to_eol (0, 0);
}
else
ignore_to_eol (0, 1);
/* Start next category. */
break;
}
#if 0
/* Process line. */
if (read_order_start == 0)
/* We're still in the preambel. */
{
switch (token)
{
case TOK_COLLATING_ELEMENT:
reject_new_char = 0;
token = xlocfile_lex (&ptr, &len);
reject_new_char = 1;
if (token == TOK_CHAR)
{
error (0, 0, gettext ("%s:%Zd: symbolic name must not be "
"duplicate name in charmap"),
locfile_data.filename, locfile_data.line_no);
ignore_to_eol (0, 0);
break;
}
else if (token != TOK_ILL_CHAR)
{
SYNTAX_ERROR;
ignore_to_eol (0, 0);
break;
}
else
{
char elem_name[len + 1];
memcpy (elem_name, ptr, len);
elem_name[len] = '\0';
/* Test whether defined in symbol table. */
token = xlocfile_lex (&ptr, &len);
if (token != TOK_FROM)
{
SYNTAX_ERROR;
ignore_to_eol (0, 0);
break;
}
token = xlocfile_lex (&ptr, &len);
if (token != TOK_STRING)
{
SYNTAX_ERROR;
ignore_to_eol (0, 0);
break;
}
/* Insert collating element into table. */
/* Rest of the line should be empty. */
ignore_to_eol (0, 1);
}
break;
case TOK_COLLATING_SYMBOL:
reject_new_char = 0;
token = xlocfile_lex (&ptr, &len);
reject_new_char = 1;
if (token == TOK_CHAR)
{
error (0, 0, gettext ("%s:%Zd: symbolic name must not "
"duplicate name in charmap"),
locfile_data.filename, locfile_data.line_no);
ignore_to_eol (0, 0);
break;
}
else if (token != TOK_ILL_CHAR)
{
SYNTAX_ERROR;
ignore_to_eol (0, 0);
break;
}
else
{
/* Test whether defined in element table. */
/* Insert collating symbol into table. */
ignore_to_eol (0, 1);
}
case TOK_ORDER_START:
nsort_rules = 0;
do
{
token = xlocfile_lex (&ptr, &len);
if (nsort_rules == 0 && token == ENDOFLINE)
break;
if (token != TOK_BACKWARD && token != TOK_FORWARD
&& token != TOK_POSITION)
{
SYNTAX_ERROR;
break;
}
switch (token)
{
case TOK_BACKWARD:
if ((sort_rule[nsort_rules] & FORWARD_BIT) != 0)
error (0, 0, gettext ("%s:%Zd: directives `forward' "
"and `backward' are mutually "
"exclusive"),
locfile_data.filename, locfile_data.lineno);
else
sort_rule[nsort_rules] |= BACKWARD_BIT;
break;
case TOK_FORWARD:
if ((sort_rule[nsort_rules] & BACKWARD_BIT) != 0)
error (0, 0, gettext ("%s:%Zd: directives `forward' "
"and `backward' are mutually "
"exclusive"),
locfile_data.filename, locfile_data.lineno);
else
sort_rule[nsort_rules] |= FORWARD_BIT;
break;
case TOK_POSITION:
sort_rule[nsort_rules] |= POSITION_BIT;
break;
}
++nsort_rules;
}
break;
default:
SYNTAX_ERROR;
ignore_to_eol (token, 0);
}
}
else
{
}
#endif
ignore_to_eol(token,0);
/* Get next token. */
token = xlocfile_lex (&ptr, &len);
}
}
/*
* Local Variables:
* mode:c
* c-basic-offset:2
* End:
*/
-163
View File
@@ -1,163 +0,0 @@
/* Copyright (C) 1995 Free Software Foundation, Inc.
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 <ctype.h>
#include <endian.h>
#include <stdlib.h>
#include <stdio.h>
#include <netinet/in.h> /* Just for htons() */
#include "localedef.h"
#include "localeinfo.h"
/* FIXME: these values should be part of the LC_CTYPE information. */
#define mb_cur_max 1
#define mb_cur_min 1
#define SWAP32(v) \
((u32) (((((u32) (v)) & 0x000000ff) << 24) \
| ((((u32) (v)) & 0x0000ff00) << 8) \
| ((((u32) (v)) & 0x00ff0000) >> 8) \
| ((((u32) (v)) & 0xff000000) >> 24)))
static inline void
print_short_in_char (unsigned short val)
{
const unsigned char *p = (const unsigned char *) &val;
printf ("\"\\%03o\\%03o\"", p[0], p[1]);
}
static inline void
print_int_in_char (unsigned int val)
{
const unsigned char *p = (const unsigned char *) &val;
printf ("\"\\%03o\\%03o\\%03o\\%03o\"", p[0], p[1], p[2], p[3]);
}
int
ctype_output (void)
{
int ch;
int result = 0;
const char *locname = (getenv ("LC_ALL") ?: getenv ("LC_CTYPE") ?:
getenv ("LANG") ?: "POSIX");
puts ("#include <endian.h>\n");
if (mb_cur_max == 1)
{
printf ("const char _nl_%s_LC_CTYPE_class[] = \n", locname);
for (ch = -128; ch < (1 << (8 * MB_CUR_MAX)); ++ch)
{
if (((ch + 128) % 6) == 0)
printf (" /* 0x%02x */ ", ch < 0 ? 256 + ch : ch);
print_short_in_char (htons (__ctype_b [ch < 0 ? 256 + ch : ch]));
fputc (((ch + 128) % 6) == 5 ? '\n' : ' ', stdout);
}
puts (";");
}
printf ("#if BYTE_ORDER == %s\n",
BYTE_ORDER == LITTLE_ENDIAN ? "LITTLE_ENDIAN" : "BIG_ENDIAN");
if (mb_cur_max == 1)
{
printf ("const char _nl_%s_LC_CTYPE_toupper[] = \n", locname);
for (ch = -128; ch < (1 << (8 * MB_CUR_MAX)); ++ch)
{
if (((ch + 128) % 3) == 0)
printf (" /* 0x%02x */ ", ch < 0 ? 256 + ch : ch);
print_int_in_char (__ctype_toupper[ch < 0 ? 256 + ch : ch]);
fputc (((ch + 128) % 3) == 2 ? '\n' : ' ', stdout);
}
puts (";");
printf ("const char _nl_%s_LC_CTYPE_tolower[] = \n", locname);
for (ch = -128; ch < (1 << (8 * MB_CUR_MAX)); ++ch)
{
if (((ch + 128) % 3) == 0)
printf (" /* 0x%02x */ ", ch < 0 ? 256 + ch : ch);
print_int_in_char (__ctype_tolower[ch < 0 ? 256 + ch : ch]);
fputc (((ch + 128) % 3) == 2 ? '\n' : ' ', stdout);
}
puts (";");
}
else
/* not implemented */;
printf ("#elif BYTE_ORDER == %s\n",
BYTE_ORDER == LITTLE_ENDIAN ? "BIG_ENDIAN" : "LITTLE_ENDIAN");
if (mb_cur_max == 1)
{
printf ("const char _nl_%s_LC_CTYPE_toupper[] = \n", locname);
for (ch = -128; ch < (1 << (8 * MB_CUR_MAX)); ++ch)
{
if (((ch + 128) % 3) == 0)
printf (" /* 0x%02x */ ", ch < 0 ? 256 + ch : ch);
print_int_in_char (SWAP32 (__ctype_toupper[ch < 0 ? 256 + ch : ch]));
fputc (((ch + 128) % 3) == 2 ? '\n' : ' ', stdout);
}
puts (";");
printf ("const char _nl_%s_LC_CTYPE_tolower[] = \n", locname);
for (ch = -128; ch < (1 << (8 * MB_CUR_MAX)); ++ch)
{
if (((ch + 128) % 3) == 0)
printf (" /* 0x%02x */ ", ch < 0 ? 256 + ch : ch);
print_int_in_char (SWAP32 (__ctype_tolower[ch < 0 ? 256 + ch : ch]));
fputc (((ch + 128) % 3) == 2 ? '\n' : ' ', stdout);
}
puts (";");
}
else
/* not implemented */;
puts ("#else\n#error \"BYTE_ORDER\" BYTE_ORDER \" not handled.\"\n#endif\n");
printf("const struct locale_data _nl_%s_LC_CTYPE = \n\
{\n\
NULL, 0, /* no file mapped */\n\
5,\n\
{\n\
_nl_C_LC_CTYPE_class,\n\
#ifdef BYTE_ORDER == LITTLE_ENDIAN\n\
NULL, NULL,\n\
#endif\n\
_nl_C_LC_CTYPE_toupper,\n\
_nl_C_LC_CTYPE_tolower,\n\
#ifdef BYTE_ORDER == BIG_ENDIAN\n\
NULL, NULL,\n\
#endif\n\
}\n\
};\n", locname);
return result;
}
/*
* Local Variables:
* mode:c
* c-basic-offset:2
* End:
*/
-50
View File
@@ -1,50 +0,0 @@
/* Copyright (C) 1995 Free Software Foundation, Inc.
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. */
#ifndef _HASH_H
#define _HASH_H
#include <obstack.h>
typedef struct hash_table
{
unsigned long size;
unsigned long filled;
void *first;
void *table;
struct obstack mem_pool;
}
hash_table;
int init_hash (hash_table *htab, unsigned long init_size);
int delete_hash(hash_table *htab);
int insert_entry (hash_table *htab, const char *key, size_t keylen,
void *data);
int find_entry (hash_table *htab, const char *key, size_t keylen,
void **result);
int iterate_table (hash_table *htab, void **ptr, void **result);
#endif /* hash.h */
/*
* Local Variables:
* mode:c
* c-basic-offset:2
* End:
*/
-77
View File
@@ -1,77 +0,0 @@
%{
/* `strncmp' is used for comparison. */
#include <string.h>
/* This file defines `enum token'. */
#include "token.h"
%}
struct locale_keyword { char *name; enum token token_id; };
%%
END, TOK_END
IGNORE, TOK_IGNORE
LC_COLLATE, _NL_NUM_LC_COLLATE
LC_CTYPE, _NL_NUM_LC_CTYPE
LC_MESSAGES, _NL_NUM_LC_MESSAGES
LC_MONETARY, _NL_NUM_LC_MONETARY
LC_NUMERIC, _NL_NUM_LC_NUMERIC
LC_TIME, _NL_NUM_LC_TIME
UNDEFINED, TOK_UNDEFINED
abday, ABDAY_1
abmon, ABMON_1
alpha, TOK_ALPHA
alt_digits, ALT_DIGITS
am_pm, AM_STR
backward, TOK_BACKWARD
blank, TOK_BLANK
cntrl, TOK_CNTRL
collating_element, TOK_COLLATING_ELEMENT
collating_symbol, TOK_COLLATING_SYMBOL
comment_char, TOK_COMMENT_CHAR
copy, TOK_COPY
currency_symbol, CURRENCY_SYMBOL
d_fmt, D_FMT
d_t_fmt, D_T_FMT
day, DAY_1
decimal_point, DECIMAL_POINT
digit, TOK_DIGIT
era, ERA
era_d_fmt, ERA_D_FMT
era_year, ERA_YEAR
escape_char, TOK_ESCAPE_CHAR
forward, TOK_FORWARD
frac_digits, FRAC_DIGITS
from, TOK_FROM
graph, TOK_GRAPH
grouping, GROUPING
int_curr_symbol, INT_CURR_SYMBOL
int_frac_digits, INT_FRAC_DIGITS
lower, TOK_LOWER
mon, MON_1
mon_decimal_point, MON_DECIMAL_POINT
mon_grouping, MON_GROUPING
mon_thousands_sep, MON_THOUSANDS_SEP
n_cs_precedes, N_CS_PRECEDES
n_sep_by_space, N_SEP_BY_SPACE
n_sign_posn, N_SIGN_POSN
negative_sign, NEGATIVE_SIGN
noexpr, NOEXPR
nostr, NOSTR
order_end, TOK_ORDER_END
order_start, TOK_ORDER_START
p_cs_precedes, P_CS_PRECEDES
p_sep_by_space, P_SEP_BY_SPACE
p_sign_posn, P_SIGN_POSN
position, TOK_POSITION
positive_sign, POSITIVE_SIGN
print, TOK_PRINT
punct, TOK_PUNCT
space, TOK_SPACE
t_fmt, T_FMT
t_fmt_ampm, T_FMT_AMPM
thousands_sep, THOUSANDS_SEP
tolower, TOK_TOLOWER
toupper, TOK_TOUPPER
upper, TOK_UPPER
xdigit, TOK_XDIGIT
yesexpr, YESEXPR
yesstr, YESSTR
-180
View File
@@ -1,180 +0,0 @@
/* C code produced by gperf version 2.5 (GNU C++ version) */
/* Command-line: gperf -acCgopt -k1,2,5, keyword.gperf */
/* `strncmp' is used for comparison. */
#include <string.h>
/* This file defines `enum token'. */
#include "token.h"
struct locale_keyword { char *name; enum token token_id; };
#define TOTAL_KEYWORDS 68
#define MIN_WORD_LENGTH 3
#define MAX_WORD_LENGTH 17
#define MIN_HASH_VALUE 4
#define MAX_HASH_VALUE 140
/* maximum key range = 137, duplicates = 0 */
#ifdef __GNUC__
inline
#endif
static unsigned int
hash (register const char *str, register int len)
{
static const unsigned char asso_values[] =
{
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
141, 141, 141, 141, 141, 141, 141, 0, 141, 65,
5, 0, 141, 30, 141, 141, 0, 141, 0, 95,
141, 141, 0, 141, 45, 10, 141, 141, 141, 141,
141, 141, 141, 141, 141, 5, 141, 10, 85, 0,
20, 0, 40, 35, 30, 10, 141, 0, 30, 15,
15, 0, 0, 141, 55, 0, 0, 80, 141, 15,
10, 0, 141, 141, 141, 141, 141, 141,
};
register int hval = len;
switch (hval)
{
default:
case 5:
hval += asso_values[str[4]];
case 4:
case 3:
case 2:
hval += asso_values[str[1]];
case 1:
hval += asso_values[str[0]];
}
return hval;
}
#ifdef __GNUC__
inline
#endif
const struct locale_keyword *
in_word_set (register const char *str, register int len)
{
static const struct locale_keyword wordlist[] =
{
{"",}, {"",}, {"",}, {"",},
{"copy", TOK_COPY},
{"space", TOK_SPACE},
{"yesstr", YESSTR},
{"toupper", TOK_TOUPPER},
{"position", TOK_POSITION},
{"",},
{"t_fmt", T_FMT},
{"escape_char", TOK_ESCAPE_CHAR},
{"comment_char", TOK_COMMENT_CHAR},
{"positive_sign", POSITIVE_SIGN},
{"",},
{"t_fmt_ampm", T_FMT_AMPM},
{"",},
{"yesexpr", YESEXPR},
{"mon", MON_1},
{"p_sep_by_space", P_SEP_BY_SPACE},
{"LC_NUMERIC", _NL_NUM_LC_NUMERIC},
{"noexpr", NOEXPR},
{"tolower", TOK_TOLOWER},
{"p_cs_precedes", P_CS_PRECEDES},
{"UNDEFINED", TOK_UNDEFINED},
{"",},
{"collating_symbol", TOK_COLLATING_SYMBOL},
{"collating_element", TOK_COLLATING_ELEMENT},
{"negative_sign", NEGATIVE_SIGN},
{"",},
{"d_fmt", D_FMT},
{"",},
{"mon_thousands_sep", MON_THOUSANDS_SEP},
{"day", DAY_1},
{"n_sep_by_space", N_SEP_BY_SPACE},
{"digit", TOK_DIGIT},
{"IGNORE", TOK_IGNORE},
{"LC_TIME", _NL_NUM_LC_TIME},
{"n_cs_precedes", N_CS_PRECEDES},
{"",},
{"int_curr_symbol", INT_CURR_SYMBOL},
{"",}, {"",},
{"thousands_sep", THOUSANDS_SEP},
{"",},
{"am_pm", AM_STR},
{"xdigit", TOK_XDIGIT},
{"",},
{"decimal_point", DECIMAL_POINT},
{"",},
{"cntrl", TOK_CNTRL},
{"p_sign_posn", P_SIGN_POSN},
{"mon_decimal_point", MON_DECIMAL_POINT},
{"LC_CTYPE", _NL_NUM_LC_CTYPE},
{"",},
{"alpha", TOK_ALPHA},
{"",},
{"forward", TOK_FORWARD},
{"era", ERA},
{"",},
{"print", TOK_PRINT},
{"",},
{"mon_grouping", MON_GROUPING},
{"era_year", ERA_YEAR},
{"",}, {"",},
{"n_sign_posn", N_SIGN_POSN},
{"",},
{"END", TOK_END},
{"",},
{"alt_digits", ALT_DIGITS},
{"",},
{"d_t_fmt", D_T_FMT},
{"",}, {"",},
{"nostr", NOSTR},
{"LC_MESSAGES", _NL_NUM_LC_MESSAGES},
{"",}, {"",}, {"",},
{"int_frac_digits", INT_FRAC_DIGITS},
{"",}, {"",}, {"",},
{"era_d_fmt", ERA_D_FMT},
{"punct", TOK_PUNCT},
{"",}, {"",}, {"",}, {"",},
{"lower", TOK_LOWER},
{"",}, {"",}, {"",}, {"",},
{"currency_symbol", CURRENCY_SYMBOL},
{"",}, {"",},
{"grouping", GROUPING},
{"from", TOK_FROM},
{"abday", ABDAY_1},
{"",}, {"",}, {"",}, {"",},
{"LC_COLLATE", _NL_NUM_LC_COLLATE},
{"LC_MONETARY", _NL_NUM_LC_MONETARY},
{"",}, {"",}, {"",}, {"",},
{"frac_digits", FRAC_DIGITS},
{"",}, {"",}, {"",},
{"abmon", ABMON_1},
{"",}, {"",},
{"backward", TOK_BACKWARD},
{"order_end", TOK_ORDER_END},
{"blank", TOK_BLANK},
{"order_start", TOK_ORDER_START},
{"",}, {"",}, {"",},
{"graph", TOK_GRAPH},
{"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
{"",}, {"",}, {"",}, {"",}, {"",},
{"upper", TOK_UPPER},
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{
register int key = hash (str, len);
if (key <= MAX_HASH_VALUE && key >= 0)
{
register const char *s = wordlist[key].name;
if (*s == *str && !strncmp (str + 1, s + 1, len - 1))
return &wordlist[key];
}
}
return 0;
}
+25 -4
View File
@@ -1,5 +1,5 @@
/* nl_langinfo -- Access to locale-dependent parameters.
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
@@ -98,9 +98,25 @@ typedef enum
ERA_YEAR, /* Year in alternate era format. */
ERA_D_FMT, /* Date in alternate era format. */
ALT_DIGITS, /* Alternate symbols for digits. */
ERA_D_T_FMT, /* Date and time in alternate era format. */
ERA_T_FMT, /* Time in alternate era format. */
_NL_NUM_LC_TIME, /* Number of indices in LC_TIME category. */
/* LC_COLLATE category: text sorting.
This information is accessed by the strcoll and strxfrm functions.
These `nl_langinfo' names are used only internally. */
_NL_COLLATE_NRULES = _NL_ITEM (LC_COLLATE, 0),
_NL_COLLATE_RULES,
_NL_COLLATE_HASH_SIZE,
_NL_COLLATE_HASH_LAYERS,
_NL_COLLATE_TABLE_EB,
_NL_COLLATE_TABLE_EL,
_NL_COLLATE_UNDEFINED,
_NL_COLLATE_EXTRA_EB,
_NL_COLLATE_EXTRA_EL,
_NL_NUM_LC_COLLATE,
/* LC_CTYPE category: character classification.
This information is accessed by the functions in <ctype.h>.
These `nl_langinfo' names are used only internally. */
@@ -109,6 +125,14 @@ typedef enum
_NL_CTYPE_TOLOWER_EB,
_NL_CTYPE_TOUPPER_EL,
_NL_CTYPE_TOLOWER_EL,
_NL_CTYPE_CLASS32,
_NL_CTYPE_NAMES_EB,
_NL_CTYPE_NAMES_EL,
_NL_CTYPE_HASH_SIZE,
_NL_CTYPE_HASH_LAYERS,
_NL_CTYPE_CLASS_NAMES,
_NL_CTYPE_MAP_NAMES,
_NL_CTYPE_WIDTH,
_NL_NUM_LC_CTYPE,
/* LC_MONETARY category: formatting of monetary quantities.
@@ -144,9 +168,6 @@ typedef enum
NOSTR, /* Output string for ``no''. */
_NL_NUM_LC_MESSAGES,
/* Stubs for unfinished categories. */
_NL_NUM_LC_COLLATE = _NL_ITEM (LC_COLLATE, 0),
/* This marks the highest value used. */
_NL_NUM
} nl_item;
+28 -3
View File
@@ -1,5 +1,5 @@
/* Define current locale data for LC_COLLATE category.
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
@@ -14,9 +14,34 @@ 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. */
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "localeinfo.h"
#include <endian.h>
_NL_CURRENT_DEFINE (LC_COLLATE);
const u32_t *__collate_table;
const u32_t *__collate_extra;
void
_nl_postload_collate (void)
{
#if BYTE_ORDER == BIG_ENDIAN
#define bo(x) x##_EB
#elif BYTE_ORDER == LITTLE_ENDIAN
#define bo(x) x##_EL
#else
#error bizarre byte order
#endif
#define paste(a,b) paste1(a,b)
#define paste1(a,b) a##b
#define current(x) \
((const unsigned int *) _NL_CURRENT (LC_COLLATE, paste(_NL_COLLATE_,x)))
__collate_table = current (bo (TABLE));
__collate_extra = current (bo (EXTRA));
}
+4 -1
View File
@@ -1,5 +1,5 @@
/* Define current locale data for LC_CTYPE category.
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
@@ -47,7 +47,10 @@ _nl_postload_ctype (void)
((const unsigned int *) _NL_CURRENT (LC_CTYPE, paste(_NL_CTYPE_,x)) \
+ 128)
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));
}
+28 -6
View File
@@ -1,5 +1,5 @@
/* Functions to read locale data files.
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
@@ -28,12 +28,31 @@ Cambridge, MA 02139, USA. */
#include "localeinfo.h"
const size_t _nl_category_num_items[] =
{
{
#define DEFINE_CATEGORY(category, category_name, items, a, b, c, d) \
[category] = _NL_ITEM_INDEX (_NL_NUM_##category),
[category] = _NL_ITEM_INDEX (_NL_NUM_##category),
#include "categories.def"
#undef DEFINE_CATEGORY
};
};
#define NO_PAREN(arg, rest...) arg, ##rest
#define DEFINE_CATEGORY(category, category_name, items, a, b, c, d) \
static const enum value_type _nl_value_type_##category[] = { NO_PAREN items };
#define DEFINE_ELEMENT(element, element_name, optstd, type, rest...) \
[_NL_ITEM_INDEX (element)] = type,
#include "categories.def"
#undef DEFINE_CATEGORY
static const enum value_type *_nl_value_types[] =
{
#define DEFINE_CATEGORY(category, category_name, items, a, b, c, d) \
[category] = _nl_value_type_##category,
#include "categories.def"
#undef DEFINE_CATEGORY
};
struct locale_data *
_nl_load_locale (int category, char **name)
@@ -178,7 +197,7 @@ _nl_load_locale (int category, char **name)
}
newdata = malloc (sizeof *newdata +
W (filedata->nstrings) * sizeof (char *));
W (filedata->nstrings) * sizeof (union locale_data_value));
if (! newdata)
goto puntmap;
@@ -194,7 +213,10 @@ _nl_load_locale (int category, char **name)
errno = EINVAL;
goto puntmap;
}
newdata->strings[i] = newdata->filedata + idx;
if (_nl_value_types[category][i] == word)
newdata->values[i].word = W (*((u32_t *) (newdata->filedata + idx)));
else
newdata->values[i].string = newdata->filedata + idx;
}
__close (fd);
-821
View File
@@ -1,821 +0,0 @@
/* Copyright (C) 1995 Free Software Foundation, Inc.
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 <alloca.h>
#include <fcntl.h>
#include <libintl.h>
#include <locale.h>
#include <localeinfo.h>
#include <langinfo.h>
#include <string.h>
#include <unistd.h>
#include <netinet/in.h>
#include <sys/uio.h>
#include "localedef.h"
#include "token.h"
/* Arrays representing ctype tables. They must be initialized for the
right size to hold the full charmap. */
static u16 *ctype_b;
static i32 *names_b, *toupper_b, *tolower_b;
/* For accessing the element of the (possibly sparse) array we use this
macro. */
#define ELEM(arr, idx) \
(arr)[({ int h = idx % charmap_data.hash_size; \
int n = 0; \
while (n < charmap_data.hash_layers \
&& names_b[n * charmap_data.hash_size + h] != idx) \
++n; \
if (n >= charmap_data.hash_layers) \
error (6, 0, gettext ("internal error in %s, line %u"), \
__FUNCTION__, __LINE__); \
n * charmap_data.hash_size + h; })]
/* The bit used for representing a special class. */
#define BITPOS(class) ((class) - TOK_UPPER)
#define BIT(class) (1 << BITPOS (class))
/* Remember which class or conversion is already done. */
static unsigned short class_done = 0;
static unsigned short toupper_done = 0;
static unsigned short tolower_done = 0;
#define SYNTAX_ERROR \
error (0, 0, gettext ("%s:%Zd: syntax error in locale definition file"), \
locfile_data.filename, locfile_data.line_no);
/* Prototypes for local functions. */
static void allocate_arrays (void);
static void set_class_defaults (void);
static int valid_char (int ch);
/* Read CTYPE category. The initial token is given as a parameter. */
void
ctype_input (int token)
{
char *ptr;
int len;
/* If necessary allocate arrays. */
allocate_arrays ();
while (token != TOK_END)
{
switch (token)
{
case TOK_UPPER: case TOK_LOWER: case TOK_ALPHA: case TOK_DIGIT:
case TOK_XDIGIT: case TOK_SPACE: case TOK_PRINT: case TOK_GRAPH:
case TOK_BLANK: case TOK_CNTRL: case TOK_PUNCT:
{
/* TAKE CARE: the order of the tokens in "token.h" determines
the bit used to indicate the membership in the class. This
also has to correspond to the values used in <ctype.h>. */
int bit = BIT (token);
int was_ell = 0;
int last = -1;
if ((class_done & bit) != 0)
{
char tmp[len + 1];
memcpy (tmp, ptr, len);
tmp[len] = '\0';
error (0, 0, gettext ("%s:%Zd: duplicate definiton of item "
"`%s' in category `LC_CTYPE'"),
locfile_data.filename, locfile_data.line_no, tmp);
}
class_done |= bit;
do
{
token = xlocfile_lex (&ptr, &len);
if (token == TOK_ENDOFLINE)
{
SYNTAX_ERROR;
break;
}
if (token == TOK_ELLIPSIS)
{
if (was_ell != 0 || last < 0)
{
error (0, 0, gettext ("%s:%Zd: illegal use of `...'"),
locfile_data.filename, locfile_data.line_no);
break;
}
was_ell = 1;
continue;
}
if (token != TOK_CHAR)
{
if (token != TOK_ILL_CHAR)
SYNTAX_ERROR;
was_ell = 0;
last = -1;
continue;
}
if (len < 0 || !valid_char (len))
{
was_ell = 0;
last = -1;
continue;
}
/* We have found a valid character. Include it to
the class' bit set. */
if (was_ell == 0)
{
ELEM (ctype_b, len) |= bit;
last = len;
}
else
{
int i;
if (last > len)
{
error (0, 0, gettext ("%s:%Zd: lower bound of "
"ellipsis not smaller"),
locfile_data.filename, locfile_data.line_no);
was_ell = 0;
last = -1;
continue;
}
for (i = last + 1; i <= len; ++i)
ELEM (ctype_b, i) |= bit;
last = -1;
}
was_ell = 0;
}
while ((token = locfile_lex (&ptr, &len)) == TOK_CHAR
&& len == ';');
/* Rest of the line should be empty. */
ignore_to_eol (token, 0);
}
break;
case TOK_TOUPPER: case TOK_TOLOWER:
{
int from;
int to = -1;
int is_upper = token == TOK_TOUPPER;
if (((is_upper ? toupper_done : tolower_done) & BIT (token)) != 0)
error (0, 0, gettext ("%s:%Zd: duplicate definition of item "
"`%s' in category `LC_CTYPE'"),
locfile_data.filename, locfile_data.line_no,
is_upper ? "toupper" : "tolower");
(is_upper ? toupper_done : tolower_done) |= BIT (token);
do
{
int ignore;
token = xlocfile_lex (&ptr, &len);
if (token != TOK_CHAR || len != '(')
{
SYNTAX_ERROR;
break;
}
token = xlocfile_lex (&ptr, &len);
if (token != TOK_CHAR && token != TOK_ILL_CHAR)
{
SYNTAX_ERROR;
break;
}
from = len;
ignore = token == TOK_ILL_CHAR;
token = xlocfile_lex (&ptr, &len);
if (token != TOK_CHAR || len != ',')
{
SYNTAX_ERROR;
break;
}
token = xlocfile_lex (&ptr, &len);
if (token != TOK_CHAR && token != TOK_ILL_CHAR)
{
SYNTAX_ERROR;
break;
}
to = len;
ignore |= token == TOK_ILL_CHAR;
token = xlocfile_lex (&ptr, &len);
if (token != TOK_CHAR || len != ')')
{
SYNTAX_ERROR;
break;
}
if (!ignore && valid_char (from) && valid_char (to))
/* Have a valid pair. */
ELEM (is_upper ? toupper_b : tolower_b, from) = to;
}
while ((token = locfile_lex (&ptr, &len)) == TOK_CHAR
&& len == ';');
/* Rest of the line should be empty. */
ignore_to_eol (token, 1);
}
break;
default:
SYNTAX_ERROR;
ignore_to_eol (0, 0);
break;
}
/* Read next token. */
token = xlocfile_lex (&ptr, &len);
}
token = xlocfile_lex (&ptr, &len);
if (token != _NL_NUM_LC_CTYPE)
{
error (0, 0, gettext ("%s:%Zd: category `%s' does not end with "
"`END %s'"), locfile_data.filename,
locfile_data.line_no, "LC_CTYPE", "LC_CTYPE");
ignore_to_eol (0, 0);
}
else
ignore_to_eol (0, posix_conformance);
}
void
ctype_check(void)
{
/* Here are a lot of things to check. See POSIX.2, table 2-6. */
#define NCLASS 11
static const struct
{
const char *name;
const char allow[NCLASS];
}
valid_table[NCLASS] =
{
/* The order is important. See token.h for more information.
M = Always, D = Default, - = Permitted, X = Mutually exclusive */
[BITPOS (TOK_UPPER)] = { "upper", "--MX-XDDXXX" },
[BITPOS (TOK_LOWER)] = { "lower", "--MX-XDDXXX" },
[BITPOS (TOK_ALPHA)] = { "alpha", "---X-XDDXXX" },
[BITPOS (TOK_DIGIT)] = { "digit", "XXX--XDDXXX" },
[BITPOS (TOK_XDIGIT)] = { "xdigit", "-----XDDXXX" },
[BITPOS (TOK_SPACE)] = { "space", "XXXXX------" },
[BITPOS (TOK_PRINT)] = { "print", "---------X-" },
[BITPOS (TOK_GRAPH)] = { "graph", "---------X-" },
[BITPOS (TOK_BLANK)] = { "blank", "XXXXXM-----" },
[BITPOS (TOK_CNTRL)] = { "cntrl", "XXXXX-XX--X" },
[BITPOS (TOK_PUNCT)] = { "punct", "XXXXX-DD-X-" }
};
int ch, cls1, cls2, eq, space_char;
u16 tmp;
/* Set default value for classes not specified. */
set_class_defaults ();
/* Check according to table. */
for (ch = 0; ch < charmap_data.hash_size * charmap_data.hash_layers; ++ch)
{
if (ch != 0 && names_b[ch] == 0)
continue;
tmp = ELEM (ctype_b, names_b[ch]);
for (cls1 = 0; cls1 < NCLASS; ++cls1)
if ((tmp & (1 << cls1)) != 0)
for (cls2 = 0; cls2 < NCLASS; ++cls2)
if (cls2 != cls1 && valid_table[cls1].allow[cls2] != '-')
{
eq = (tmp & (1 << cls2)) != 0;
switch (valid_table[cls1].allow[cls2])
{
case 'M':
if (!eq)
error (0, 0, gettext ("character '\\%o' in class `%s' "
"must be in class `%s'"), ch,
valid_table[cls1].name, valid_table[cls2].name);
break;
case 'X':
if (eq)
error (0, 0, gettext ("character '\\%o' inc class `%s' "
"must not be in class `%s'"), ch,
valid_table[cls1].name, valid_table[cls2].name);
break;
case 'D':
ELEM (ctype_b, names_b[ch]) |= 1 << cls2;
break;
default:
error (5, 0, gettext ("internal error in %s, line %u"),
__FUNCTION__, __LINE__);
}
}
}
/* ... and now test <SP> as a special case. */
if (find_entry (&charmap_data.table, "SP", 2, (void **) &space_char) == 0)
error (0, 0, gettext ("character <SP> not defined in character map"));
else if ((tmp = BITPOS (TOK_SPACE),
(ELEM (ctype_b, space_char) & BIT (TOK_SPACE)) == 0)
|| (tmp = BITPOS (TOK_BLANK),
(ELEM (ctype_b, space_char) & BIT (TOK_BLANK)) == 0))
error (0, 0, gettext ("<SP> character not in class `%s'"),
valid_table[tmp].name);
else if ((tmp = BITPOS (TOK_PUNCT),
(ELEM (ctype_b, space_char) & BIT (TOK_PUNCT)) != 0)
|| (tmp = BITPOS (TOK_GRAPH),
(ELEM (ctype_b, space_char) & BIT (TOK_GRAPH)) != 0))
error (0, 0, gettext ("<SP> character must not be in class `%s'"),
valid_table[tmp].name);
else
ELEM (ctype_b, space_char) |= BIT (TOK_PRINT);
}
/* These macros can change little to big endian and vice versa. */
#define SWAP16(v) \
((u16) (((((unsigned short) (v)) & 0x00ff) << 8) \
| ((((unsigned short) (v)) & 0xff00) >> 8)))
#define SWAP32(v) \
((u32) (((((u32) (v)) & 0x000000ff) << 24) \
| ((((u32) (v)) & 0x0000ff00) << 8) \
| ((((u32) (v)) & 0x00ff0000) >> 8) \
| ((((u32) (v)) & 0xff000000) >> 24)))
int
ctype_output (void)
{
char *path, *t;
int ch;
/* File descriptor for output file. */
int fd;
/* Magic number. */
i32 magic = LIMAGIC (LC_CTYPE);
/* Number of table. */
int tables = 6;
/* Number ints in leading information table. */
#if 0
i32 n = 2 + 2 * tables;
#else
i32 n = 5;
#endif
/* Values describing the character set. */
char mb_cur_min = (char) charmap_data.mb_cur_min;
char mb_cur_max = (char) charmap_data.mb_cur_max;
/* Optimal size of hashing table. */
i32 hash_size = charmap_data.hash_size;
i32 hash_layers = charmap_data.hash_layers;
/* Number of elements in the tables. */
int size = hash_size * charmap_data.hash_layers;
/* Positions of the tables. */
i32 pos[14] =
{
/* No, no. We don't play towers of Hanoi. This is a more or less
readable table of the offsets of the different strings in the
produced file. It is seperated in three columns which represent
the number of values with 1, 2, and 4 bytes. */
#if 0
4 * (2 + n),
1 + 4 * (2 + n),
2 + 4 * (2 + n),
2 + 4 * (3 + n),
2 + 4 * (4 + n),
2 + 2 * (128 + size) + 4 * (4 + n),
2 + 2 * (128 + size) + 4 * ((4 + n) + (size + 128)),
2 + 2 * (128 + size) + 4 * ((4 + n) + 2 * (size + 128)),
2 + 2 * (128 + size) + 4 * ((4 + n) + 2 * (size + 128) + 1 * size),
2 + 2 * (128 + size) + 4 * ((5 + n) + 2 * (size + 128) + 1 * size),
2 + 2 * (128 + size) + 4 * ((6 + n) + 2 * (size + 128) + 1 * size),
2 + 2 * (2 * (128 + size)) + 4 * ((6 + n) + 2 * (size + 128) + 1 * size),
2 + 2 * (2 * (128 + size)) + 4 * ((6 + n) + 3 * (size + 128) + 1 * size),
2 + 2 * (2 * (128 + size)) + 4 * ((6 + n) + 4 * (size + 128) + 1 * size),
#else
4 * (2 + n),
2 * (128 + size) + 4 * (2 + n),
2 * (128 + size) + 4 * ((2 + n) + (size + 128)),
2 * (128 + size) + 4 * ((2 + n) + 2 * (size + 128)),
2 * (128 + size) + 4 * ((2 + n) + 3 * (size + 128)),
#endif
};
/* Parameter to writev. */
struct iovec iov[11] =
{
{ &magic, sizeof (i32) },
{ &n, sizeof (i32) },
#if 0
{ pos, sizeof (pos) },
{ &mb_cur_min, 1 },
{ &mb_cur_max, 1 },
{ &hash_size, sizeof (i32) },
{ &hash_layers, sizeof (i32) },
#else
{ pos, 5 * 4 },
#endif
{ ctype_b - 128, (size + 128) * sizeof (u16) },
{ toupper_b - 128, (size + 128) * sizeof (i32) },
{ tolower_b - 128, (size + 128) * sizeof (i32) },
{ names_b, size * sizeof (i32) }
};
int result = 0;
/* Now we can bring the representations into the right form. */
for (ch = -128; ch < -1; ++ch)
{
ctype_b[ch] = ctype_b[256 + ch];
toupper_b[ch] = toupper_b[256 + ch];
tolower_b[ch] = tolower_b[256 + ch];
}
/* Set value for EOF. */
ctype_b[-1] = 0;
toupper_b[-1] = -1;
tolower_b[-1] = -1;
for (ch = -128; ch < size; ++ch)
ctype_b[ch] = htons (ctype_b[ch]);
/* Construct the output filename from the argument given to
localedef on the command line. */
path = (char *) alloca (strlen (output_path) +
strlen (category[LC_CTYPE].name) + 1);
t = stpcpy (path, output_path);
strcpy (t, category[LC_CTYPE].name);
fd = creat (path, 0666);
if (fd == -1)
{
error (0, 0, gettext ("cannot open output file `%s': %m"), path);
result = 1;
}
else
{
int idx;
#if 0
if (writev (fd, iov, 10) == -1)
#else
if (writev (fd, iov, 6) == -1)
#endif
{
error (0, 0, gettext ("cannot write output file `%s': %m"), path);
result = 1;
goto close_and_return;
}
/* Now we have to write the three tables with different endianess. */
hash_size = SWAP32 (hash_size);
for (idx = -128; idx < size; ++idx)
{
ctype_b[idx] = SWAP16 (ctype_b[idx]);
toupper_b[idx] = SWAP32 (toupper_b[idx]);
tolower_b[idx] = SWAP32 (tolower_b[idx]);
if (idx >= 0)
names_b[idx] = SWAP32 (names_b[idx]);
}
#if 0
if (writev (fd, iov + 5, 6) == -1)
#else
if (writev (fd, iov + 3, 2) == -1)
#endif
{
error (0, 0, gettext ("cannot write output file `%s': %m"), path);
result = 1;
}
close_and_return:
close (fd);
}
return result;
}
/* If necessary allocate the memory for the arrays according to the
current character map. */
static void
allocate_arrays (void)
{
/* Init ctype data structures. */
if (ctype_b == NULL)
/* All data structures are not initialized yet. */
{
/* You wonder about this amount of memory? This is only because
some users do not manage to address the array with unsigned
values or data types with range >= 256. '\200' would result
in the array index -128. To help these poor people we
duplicate the entries for 128 upto 255 below the entry for \0. */
int ch, h, n;
char *ptr;
int size = charmap_data.hash_size * charmap_data.hash_layers;
ctype_b = xmalloc ((size - (-128)) * sizeof (u16));
bzero (ctype_b, (size - (-128)) * sizeof (u16));
ctype_b += 128;
names_b = xmalloc (size * sizeof (i32));
bzero (names_b, size * sizeof (i32));
toupper_b = xmalloc ((size - (-128)) * sizeof (i32));
bzero (toupper_b, (size - (-128)) * sizeof (i32));
toupper_b += 128;
tolower_b = xmalloc ((size - (-128)) * sizeof (i32));
bzero (tolower_b, (size - (-128)) * sizeof (i32));
tolower_b += 128;
ptr = NULL;
/* Mark the place of the NUL character as occupied. */
names_b[0] = 1;
while (iterate_table (&charmap_data.table, (void **) &ptr,
(void **) &ch))
{
/* We already handled the NUL character. */
if (ch == 0)
continue;
h = ch % charmap_data.hash_size;
n = 0;
while (names_b[h + n * charmap_data.hash_size] != 0)
++n;
names_b[h + n * charmap_data.hash_size] = ch;
toupper_b[h + n * charmap_data.hash_size] = ch;
tolower_b[h + n * charmap_data.hash_size] = ch;
}
/* Correct the value for NUL character. */
names_b[0] = 0;
}
}
static void
set_class_defaults (void)
{
/* These function defines the default values for the classes and conversions
according to POSIX.2 2.5.2.1.
It may seem that the order of these if-blocks is arbitrary but it is NOT.
Don't move them unless you know what you do! */
void set_default (int bit, int from, int to)
{
char tmp[4];
int ch;
/* Define string. */
strcpy (tmp, "<?>");
for (ch = from; ch <= to; ++ch)
{
int code;
tmp[1] = ch;
code = find_char (tmp + 1, 1);
if (code == -1)
error (5, 0, gettext ("character `%s' not defined while needed "
"as default value"), tmp);
ELEM (ctype_b, code) |= bit;
}
}
/* If necessary allocate arrays. */
allocate_arrays ();
/* Set default values if keyword was not present. */
if ((class_done & BIT (TOK_UPPER)) == 0)
/* "If this keyword [lower] is not specified, the lowercase letters
`A' through `Z', ..., shall automatically belong to this class,
with implementation defined character values." */
set_default (BIT (TOK_UPPER), 'A', 'Z');
if ((class_done & BIT (TOK_LOWER)) == 0)
/* "If this keyword [lower] is not specified, the lowercase letters
`a' through `z', ..., shall automatically belong to this class,
with implementation defined character values." */
set_default (BIT (TOK_LOWER), 'a', 'z');
if ((class_done & BIT (TOK_DIGIT)) == 0)
/* "If this keyword [digit] is not specified, the digits `0' through
`9', ..., shall automatically belong to this class, with
implementation-defined character values." */
set_default (BIT (TOK_DIGIT), '0', '9');
if ((class_done & BIT (TOK_SPACE)) == 0)
/* "If this keyword [space] is not specified, the characters <space>,
<form-feed>, <newline>, <carriage-return>, <tab>, and
<vertical-tab>, ..., shall automatically belong to this class,
with implementtation-defined character values." */
{
int code;
code = find_char ("space", 5);
if (code == -1)
error (5, 0, gettext ("character `%s' not defined while needed as "
"default value"), "<space>");
ELEM (ctype_b, code) |= BIT (TOK_SPACE);
code = find_char ("form-feed", 9);
if (code == -1)
error (5, 0, gettext ("character `%s' not defined while needed as "
"default value"), "<form-feed>");
ELEM (ctype_b, code) |= BIT (TOK_SPACE);
code = find_char ("newline", 7);
if (code == -1)
error (5, 0, gettext ("character `%s' not defined while needed as "
"default value"), "<newline>");
ELEM (ctype_b, code) |= BIT (TOK_SPACE);
code = find_char ("carriage-return", 15);
if (code == -1)
error (5, 0, gettext ("character `%s' not defined while needed as "
"default value"), "<carriage-return>");
ELEM (ctype_b, code) |= BIT (TOK_SPACE);
code = find_char ("tab", 3);
if (code == -1)
error (5, 0, gettext ("character `%s' not defined while needed as "
"default value"), "<tab>");
ELEM (ctype_b, code) |= BIT (TOK_SPACE);
code = find_char ("vertical-tab", 11);
if (code == -1)
error (5, 0, gettext ("character `%s' not defined while needed as "
"default value"), "<vertical-tab>");
ELEM (ctype_b, code) |= BIT (TOK_SPACE);
}
if ((class_done & BIT (TOK_XDIGIT)) == 0)
/* "If this keyword is not specified, the digits `0' to `9', the
uppercase letters `A' through `F', and the lowercase letters `a'
through `f', ..., shell automatically belong to this class, with
implementation defined character values." */
{
if ((class_done & BIT (TOK_XDIGIT)) == 0)
set_default (BIT (TOK_XDIGIT), '0', '9');
if ((class_done & BIT (TOK_XDIGIT)) == 0)
set_default (BIT (TOK_XDIGIT), 'A', 'F');
if ((class_done & BIT (TOK_XDIGIT)) == 0)
set_default (BIT (TOK_XDIGIT), 'a', 'f');
}
if ((class_done & BIT (TOK_BLANK)) == 0)
/* "If this keyword [blank] is unspecified, the characters <space> and
<tab> shall belong to this character class." */
{
int code;
code = find_char ("space", 5);
if (code == -1)
error (5, 0, gettext ("character `%s' not defined while needed as "
"default value"), "<space>");
ELEM (ctype_b, code) |= BIT (TOK_BLANK);
code = find_char ("tab", 3);
if (code == -1)
error (5, 0, gettext ("character `%s' not defined while needed as "
"default value"), "<tab>");
ELEM (ctype_b, code) |= BIT (TOK_BLANK);
}
if ((class_done & BIT (TOK_GRAPH)) == 0)
/* "If this keyword [graph] is not specified, characters specified for
the keywords `upper', `lower', `alpha', `digit', `xdigit' and `punct',
shall belong to this character class." */
{
int ch;
unsigned short int mask = BIT (TOK_UPPER) | BIT (TOK_LOWER) |
BIT (TOK_ALPHA) | BIT (TOK_DIGIT) | BIT (TOK_XDIGIT) | BIT (TOK_PUNCT);
for (ch = 0; ch < charmap_data.hash_size * charmap_data.hash_layers;
++ch)
{
if (ch != 0 && names_b[ch] == 0)
continue;
if ((ELEM (ctype_b, names_b[ch]) & mask) != 0)
ELEM (ctype_b, names_b[ch]) |= BIT (TOK_GRAPH);
}
}
if ((class_done & BIT (TOK_PRINT)) == 0)
/* "If this keyword [print] is not provided, characters specified for
the keywords `upper', `lower', `alpha', `digit', `xdigit', `punct',
and the <space> character shall belong to this character class." */
{
int ch;
int space = find_char ("space", 5);
unsigned short int mask = BIT (TOK_UPPER) | BIT (TOK_LOWER) |
BIT (TOK_ALPHA) | BIT (TOK_DIGIT) | BIT (TOK_XDIGIT) | BIT (TOK_PUNCT);
if (space == -1)
error (5, 0, gettext ("character `%s' not defined while needed as "
"default value"), "<space>");
for (ch = 0; ch < charmap_data.hash_size * charmap_data.hash_layers;
++ch)
{
if (ch != 0 && names_b[ch] == 0)
continue;
if ((ELEM (ctype_b, names_b[ch]) & mask) != 0)
ELEM (ctype_b, names_b[ch]) |= BIT (TOK_PRINT);
}
ELEM (ctype_b, space) |= BIT (TOK_PRINT);
}
if (toupper_done == 0)
/* "If this keyword [toupper] is not spcified, the lowercase letters
`a' through `z', and their corresponding uppercase letters `A' to
`Z', ..., shall automatically be included, with implementation-
defined character values." */
{
char tmp[4];
int ch;
strcpy (tmp, "<?>");
for (ch = 'a'; ch <= 'z'; ++ch)
{
int code_to, code_from;
tmp[1] = ch;
code_from = find_char (tmp + 1, 1);
if (code_from == -1)
error (5, 0, gettext ("character `%s' not defined while needed "
"as default value"), tmp);
/* This conversion is implementation defined. */
tmp[1] = ch + ('A' - 'a');
code_to = find_char (tmp + 1, 1);
if (code_to == -1)
error (5, 0, gettext ("character `%s' not defined while needed "
"as default value"), tmp);
ELEM (toupper_b, code_from) = code_to;
}
}
if (tolower_done == 0)
/* "If this keyword [tolower] is not specified, the mapping shall be
the reverse mapping of the one specified to `toupper'." */
{
int ch;
for (ch = 0; ch < charmap_data.hash_size * charmap_data.hash_layers;
++ch)
{
if (ch != 0 && names_b[ch] == 0)
continue;
if (toupper_b[ch] != names_b[ch])
ELEM (tolower_b, toupper_b[ch]) = names_b[ch];
}
}
}
/* Test whether the given character is valid for the current charmap. */
static int
valid_char (int ch)
{
/* FIXME: this assumes 32-bit integers. */
int ok = ch >= 0
&& (charmap_data.mb_cur_max < 4
? ch < 1 << (8 * charmap_data.mb_cur_max) : 1);
return ok;
}
/*
* Local Variables:
* mode:c
* c-basic-offset:2
* End:
*/
+7 -7
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1992, 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
@@ -29,12 +29,12 @@ __BEGIN_DECLS
/* These are the possibilities for the first argument to setlocale.
The code assumes that LC_ALL is the highest value, and zero the lowest. */
#define LC_COLLATE 0
#define LC_CTYPE 1
#define LC_MONETARY 2
#define LC_NUMERIC 3
#define LC_TIME 4
#define LC_MESSAGES 5
#define LC_CTYPE 0
#define LC_NUMERIC 1
#define LC_TIME 2
#define LC_COLLATE 3
#define LC_MONETARY 4
#define LC_MESSAGES 5
#define LC_ALL 6
-259
View File
@@ -1,259 +0,0 @@
/* Copyright (C) 1995 Free Software Foundation, Inc.
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 <getopt.h>
#include <libintl.h>
#include <locale.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <errno.h>
#include "error.h"
#include "localedef.h"
/* The charmap file used. If none given DEFAULT_CHARMAP is used. */
static char *charmap_file;
/* If set output is always written, even when warning are given. */
static int force_output;
/* The input file name. */
static char *input_file;
/* Path leading to the destination directory for the produced files. */
char *output_path;
/* If this is defined be POSIX conform. */
int posix_conformance;
/* If not zero give a lot more messages. */
int verbose;
/* Long options. */
static const struct option long_options[] =
{
{ "charmap", required_argument, NULL, 'f' },
{ "debug", no_argument, NULL, 'd' },
{ "help", no_argument, NULL, 'h' },
{ "force", no_argument, NULL, 'c' },
{ "inputfile", required_argument, NULL, 'i' },
{ "posix", no_argument, &posix_conformance, 1 },
{ "verbose", no_argument, &verbose, 1},
{ "version", no_argument, NULL, 'V' },
{ NULL, 0, NULL, 0 }
};
/* Prototypes for local functions. */
static void usage (int status) __attribute__ ((noreturn));
static int construct_output_path (const char *path);
int
main(int argc, char *argv[])
{
int optchar;
int cannot_write;
int do_help = 0;
int do_version = 0;
/* Set initial values for global varaibles. */
charmap_file = NULL;
force_output = 0;
input_file = 0;
posix_conformance = getenv ("POSIXLY_CORRECT") != NULL;
verbose = 0;
/* Set locale. Do not set LC_ALL because the other categories must
not be affected (acccording to POSIX.2). */
setlocale (LC_MESSAGES, "");
setlocale (LC_CTYPE, "");
/* Initialize the message catalog. */
textdomain (PACKAGE);
while ((optchar = getopt_long (argc, argv, "cdf:hi:vV", long_options, NULL))
!= EOF)
switch (optchar)
{
case '\0':
break;
case 'c':
force_output = 1;
break;
case 'f':
if (charmap_file != NULL)
error (0, 0, gettext ("\"%s %s\" overwrites old option \"%s\""),
"-f", optarg, charmap_file);
charmap_file = optarg;
break;
case 'h':
do_help = 1;
break;
case 'i':
if (input_file != NULL)
error (0, 0, gettext ("\"%s %s\" overwrites old option \"%s\""),
"-i", optarg, input_file);
input_file = optarg;
break;
case 'v':
verbose = 1;
break;
case 'V':
do_version = 1;
break;
default:
usage (4);
break;
}
/* POSIX.2 requires to be verbose about missing characters in the
character map. */
verbose |= posix_conformance;
/* Version information is requested. */
if (do_version)
{
fprintf (stderr, "GNU %s %s\n", PACKAGE, VERSION);
exit (EXIT_SUCCESS);
}
/* Help is requested. */
if (do_help)
usage (0);
if (argc - optind != 1)
/* We need exactly one non-option parameter. */
usage (4);
/* The parameter describes the output path of the constructed files.
If the files cannot be written return a non-zero value. */
cannot_write = construct_output_path (argv[optind]);
/* Now that the parameters are processed we have to reset the local
ctype locale. (POSIX.2 4.35.5.2) */
setlocale (LC_CTYPE, "POSIX");
/* Look whether the system really allows locale definitions. */
if (sysconf (_SC_2_LOCALEDEF) < 0)
error (3, 0,
gettext ("warning: system does not define `_POSIX2_LOCALEDEF'"));
/* Process charmap file. */
charmap_read (charmap_file);
/* Now read the locale file. */
locfile_read (input_file);
/* Check all categories for consistency. */
categories_check ();
/* We are now able to write the data files. If warning were given we
do it only if it is explicitly requested (--force). */
if (error_message_count == 0 || force_output != 0)
if (cannot_write != 0)
error (0, 0, gettext ("cannot write output file `%s': %s"),
output_path, strerror (cannot_write));
else
categories_write ();
else
error (0, 0,
gettext ("no output file produced because warning were issued"));
exit (EXIT_SUCCESS);
}
/* Display usage information and exit. */
static void
usage(int status)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, gettext ("Try `%s --help' for more information.\n"),
program_invocation_name);
else
printf(gettext ("\
Usage: %s [OPTION]... name\n\
Mandatory arguments to long options are mandatory for short options too.\n\
-c, --force create output even if warning messages have been issued\n\
-h, --help display this help and exit\n\
-V, --version output version information and exit\n\
\n\
-i, --inputfile=FILE source definitions are found in FILE\n\
-f, --charmap=FILE symbolic character names defined in FILE\n\
\n\
-v, --verbose print more messages\n\
--posix be strictly POSIX conform\n\
\n\
System's directory for character maps: %s\n\
locale files : %s\n\
"), program_invocation_name, CHARMAP_PATH, LOCALE_PATH);
exit (status);
}
/* The parameter to localedef describes the output path. If it does
contain a '/' character it is a relativ path. Otherwise it names the
locale this definition is for. */
static int
construct_output_path (const char *path)
{
int result = 0;
if (strchr (path, '/') == NULL)
{
/* This is a system path. */
int path_max_len = pathconf (LOCALE_PATH, _PC_PATH_MAX) + 1;
output_path = (char *) xmalloc (path_max_len);
snprintf (output_path, path_max_len, "%s/%s", LOCALE_PATH, path);
}
else
{
char *t;
/* This is a user path. */
output_path = malloc (strlen (path) + 2);
t = stpcpy (output_path, path);
*t = '\0';
}
if (euidaccess (output_path, W_OK) == -1)
/* Perhaps the directory does not exist now. Try to create it. */
if (errno == ENOENT)
{
if (mkdir (output_path, 0777) == -1)
result = errno;
}
else
result = errno;
if (result == 0)
strcat (output_path, "/");
return result;
}
/*
* Local Variables:
* mode:c
* c-basic-offset:2
* End:
*/
-196
View File
@@ -1,196 +0,0 @@
/* Copyright (C) 1995 Free Software Foundation, Inc.
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. */
#ifndef _LOCALEDEF_H
#define _LOCALEDEF_H 1
#define __need_wchar_t
#include <stddef.h>
#include "config.h"
#include "hash.h"
/* Needed always. */
#define MAX(a, b) ({typeof (a) _a = (a); typeof (b) _b = (b); \
_a > _b ? _a : _b; })
#define MIN(a, b) ({typeof (a) _a = (a); typeof (b) _b = (b); \
_a < _b ? _a : _b; })
/* Determine number of elements in ARR. */
#define NELEMS(arr) ((sizeof (arr)) / (sizeof (arr[0])))
/* I simply love these GCC features ... :) */
#define NO_PAREN(arg, rest...) arg, ##rest
/* The character set used in the locale is defined in a character map file.
The information of the file is stored in the following struct. */
struct charmap
{
char *filename;
char *codeset_name;
int mb_cur_min;
int mb_cur_max;
char escape_char;
char comment_char;
hash_table table;
int hash_size;
int hash_layers;
};
/* Data structure for representing charmap database. */
extern struct charmap charmap_data;
/* We can map the types of the entries into four categories. */
enum value_type { none, string, stringarray, byte, bytearray, integer };
/* Definition of the data structure which represents a category and its
items. */
struct category
{
int cat_id;
const char *name;
size_t number;
struct cat_item
{
int item_id;
const char *name;
enum { std, opt } status;
enum value_type value_type;
int min;
int max;
} *item_desc;
char **item_value;
void (*infct)(int);
void (*checkfct)(void);
int (*outfct)(void);
int filled;
char *copy_locale;
};
/* This a the structure which contains all information about all
categories. */
extern struct category category[];
/* The function used to load the contents of a charmap file into the
the global variable `charmap_data'. */
void charmap_read (const char *filename);
/* Find a character constant given by its name in the hash table. */
static inline wchar_t find_char (const char *name, size_t len)
{
wchar_t retval;
if (find_entry (&charmap_data.table, name, len, (void **) &retval) != 0)
return retval;
else
return -1;
}
/* Path to the directory the output files are written in. */
extern char *output_path;
/* If this is defined be POSIX conform. */
extern int posix_conformance;
/* If not zero give a lot more messages. */
extern int verbose;
/* This structure contains all informations about the status of of
reading the locale definition file. */
struct locfile_data
{
const char *filename;
char escape_char;
char comment_char;
size_t bufsize;
char *buf;
char *strbuf;
size_t buf_ptr;
int continue_line;
size_t returned_tokens;
size_t line_no;
};
/* The status variable. */
extern struct locfile_data locfile_data;
/* Open the locale definition file. */
void locfile_open (const char *fname);
/* Return the next token from the locale definition file. */
int locfile_lex (char **token, int *token_len);
/* Dito, but check for EOF. */
int xlocfile_lex (char **token, int *token_len);
/* Ignore the rest of the line. First TOKEN given if != 0. Warn about
anything other than end of line if WARN_FLAG nonzero. */
void ignore_to_eol (int token, int warn_flag);
/* Code a character with UTF-8 if the character map has multi-byte
characters. */
int char_to_utf (char *buf, int char_val);
/* Read the locale defintion file FNAME and fill the appropriate
data structures. */
void locfile_read (const char *fname);
/* Check categories for consistency. */
void categories_check (void);
/* Write out the binary representation of the category data. */
void categories_write (void);
/* Treat reading the LC_COLLATE definition. */
void collate_input (int token);
/* Treat reading the LC_CTYPE definition. */
void ctype_input (int token);
void ctype_check (void);
int ctype_output (void);
/* Treat reading the LC_MONETARY definition. */
void monetary_check (void);
/* Treat reading the LC_MESSAGES definition. */
void messages_check (void);
/* Treat reading the LC_NUMERIC definition. */
void numeric_check (void);
/* Print an error message, possibly with NLS. */
void error (int status, int errnum, const char *format, ...)
__attribute__ ((format (printf, 3, 4)));
/* Library functions. */
void *xmalloc (size_t n);
void *xcalloc (size_t n, size_t s);
void *xrealloc (void *p, size_t n);
/*
* Local Variables:
* mode:c
* c-basic-offset:2
* End:
*/
#endif /* _LOCALEDEF_H */
+54 -9
View File
@@ -1,5 +1,5 @@
/* localeinfo.h -- declarations for internal libc locale interfaces
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
@@ -25,17 +25,51 @@ Cambridge, MA 02139, USA. */
#include <sys/types.h>
/* Magic number at the beginning of a locale data file for CATEGORY. */
#define LIMAGIC(category) (0x051472CA ^ (category))
#define LIMAGIC(category) (0x960316de ^ (category))
/* Two special weight constants for the collation data. */
#define FORWARD_CHAR 0xfffffffd
#define ELLIPSIS_CHAR 0xfffffffe
#define IGNORE_CHAR 0xffffffff
/* Structure describing locale data in core for a category. */
struct locale_data
{
const char *filedata; /* Region mapping the file data. */
off_t filesize; /* Size of the file (and the region). */
{
const char *filedata; /* Region mapping the file data. */
off_t filesize; /* Size of the file (and the region). */
unsigned int nstrings; /* Number of strings below. */
const char *strings[0]; /* Items, usually pointers into `filedata'. */
};
unsigned int nstrings; /* Number of strings below. */
union locale_data_value
{
const char *string;
unsigned int word;
}
values[0]; /* Items, usually pointers into `filedata'. */
};
/* We know three kinds of collation sorting rules. */
enum coll_sort_rule
{
illegal_0__,
sort_forward,
sort_backward,
illegal_3__,
sort_position,
sort_forward_position,
sort_backward_position,
sort_mask
};
/* We can map the types of the entries into four categories. */
enum value_type
{
none,
string,
stringarray,
byte,
bytearray,
word
};
/* For each category declare the variable for the current locale data. */
@@ -49,7 +83,11 @@ extern const struct locale_data * *const _nl_current[LC_ALL];
/* Extract the current CATEGORY locale's string for ITEM. */
#define _NL_CURRENT(category, item) \
(_nl_current_##category->strings[_NL_ITEM_INDEX (item)])
(_nl_current_##category->values[_NL_ITEM_INDEX (item)].string)
/* Extract the current CATEGORY locale's word for ITEM. */
#define _NL_CURRENT_WORD(category, item) \
(_nl_current_##category->values[_NL_ITEM_INDEX (item)].word)
/* This is used in lc-CATEGORY.c to define _nl_current_CATEGORY. */
#define _NL_CURRENT_DEFINE(category) \
@@ -65,4 +103,11 @@ extern struct locale_data *_nl_load_locale (int category, char **name);
extern void _nl_free_locale (struct locale_data *);
/* XXX For now. */
typedef unsigned int u32_t;
/* Global variables for LC_COLLATE category data. */
extern const u32_t *__collate_table;
extern const u32_t *__collate_extra;
#endif /* localeinfo.h */
-254
View File
@@ -1,254 +0,0 @@
/* Copyright (C) 1995 Free Software Foundation, Inc.
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 <obstack.h>
#include <stdlib.h>
#include <string.h>
#include <values.h>
#include "hash.h"
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
void *xmalloc (size_t n);
typedef struct hash_entry
{
int used;
char *key;
void *data;
struct hash_entry *next;
}
hash_entry;
/* Prototypes for local functions. */
static size_t lookup (hash_table *htab, const char *key, size_t keylen,
unsigned long hval);
static unsigned long compute_hashval(const char *key, size_t keylen);
static unsigned long next_prime(unsigned long seed);
static int is_prime(unsigned long candidate);
int
init_hash(hash_table *htab, unsigned long init_size)
{
/* We need the size to be a prime. */
init_size = next_prime (init_size);
/* Initialize the data structure. */
htab->size = init_size;
htab->filled = 0;
htab->first = NULL;
htab->table = calloc (init_size + 1, sizeof (hash_entry));
obstack_init (&htab->mem_pool);
return htab->table == NULL;
}
int
delete_hash(hash_table *htab)
{
free (htab->table);
obstack_free (&htab->mem_pool, NULL);
return 0;
}
int
insert_entry (hash_table *htab, const char *key, size_t keylen, void *data)
{
unsigned long hval = compute_hashval (key, keylen);
hash_entry *table = (hash_entry *) htab->table;
size_t idx = lookup (htab, key, keylen, hval);
if (table[idx].used)
/* We don't want to overwrite the old value. */
return 1;
else
{
hash_entry **p;
/* An empty bucket has been found. */
table[idx].used = hval;
table[idx].key = obstack_copy0 (&htab->mem_pool, key, keylen);
table[idx].data = data;
/* List the new value in the ordered list. */
for (p = (hash_entry **) &htab->first; *p != NULL && (*p)->data < data;
p = &(*p)->next);
if (*p == NULL || (*p)->data > data)
/* Insert new value in the list. */
{
table[idx].next = *p;
*p = &table[idx];
}
++htab->filled;
if (100 * htab->filled > 90 * htab->size)
{
/* Resize the table. */
unsigned long old_size = htab->size;
htab->size = next_prime (htab->size * 2);
htab->filled = 0;
htab->first = NULL;
htab->table = calloc (htab->size, sizeof (hash_entry));
for (idx = 1; idx <= old_size; ++idx)
if (table[idx].used)
insert_entry (htab, table[idx].key, strlen(table[idx].key),
table[idx].data);
free (table);
}
return 0;
}
/* NOTREACHED */
}
int
find_entry (hash_table *htab, const char *key, size_t keylen, void **result)
{
hash_entry *table = (hash_entry *) htab->table;
size_t idx = lookup (htab, key, keylen, compute_hashval (key, keylen));
int retval;
retval = table[idx].used;
*result = retval ? table[idx].data : NULL;
return retval;
}
int
iterate_table (hash_table *htab, void **ptr, void **result)
{
if (*ptr == NULL)
*ptr = (void *) htab->first;
else
{
*ptr = (void *) (((hash_entry *) *ptr)->next);
if (*ptr == NULL)
return 0;
}
*result = ((hash_entry *) *ptr)->data;
return 1;
}
static size_t
lookup (hash_table *htab, const char *key, size_t keylen, unsigned long hval)
{
unsigned long hash;
size_t idx;
hash_entry *table = (hash_entry *) htab->table;
/* First hash function: simply take the modul but prevent zero. */
hash = 1 + hval % htab->size;
idx = hash;
if (table[idx].used)
{
if (table[idx].used == hval && table[idx].key[keylen] == '\0'
&& strncmp (key, table[idx].key, keylen) == 0)
return idx;
/* Second hash function as suggested in [Knuth]. */
hash = 1 + hash % (htab->size - 2);
do
{
if (idx <= hash)
idx = htab->size + idx - hash;
else
idx -= hash;
/* If entry is found use it. */
if (table[idx].used == hval && table[idx].key[keylen] == '\0'
&& strncmp (key, table[idx].key, keylen) == 0)
return idx;
}
while (table[idx].used);
}
return idx;
}
static unsigned long
compute_hashval(const char *key, size_t keylen)
{
size_t cnt;
unsigned long hval, g;
/* Compute the hash value for the given string. */
cnt = 0;
hval = keylen;
while (cnt < keylen)
{
hval <<= 4;
hval += key[cnt++];
g = hval & (0xf << (LONGBITS - 4));
if (g != 0)
{
hval ^= g >> (LONGBITS - 8);
hval ^= g;
}
}
return hval;
}
static unsigned long
next_prime(unsigned long seed)
{
/* Make it definitely odd. */
seed |= 1;
while (!is_prime (seed))
seed += 2;
return seed;
}
static int
is_prime(unsigned long candidate)
{
/* No even number and none less than 10 will be passwd here. */
unsigned long div = 3;
unsigned long sq = div * div;
while (sq < candidate && candidate % div != 0)
{
++div;
sq += 4 * div;
++div;
}
return candidate % div != 0;
}
/*
* Local Variables:
* mode:c
* c-basic-offset:2
* End:
*/
-533
View File
@@ -1,533 +0,0 @@
/* Copyright (C) 1995 Free Software Foundation, Inc.
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 <ctype.h>
#include <langinfo.h>
#include <libintl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "localedef.h"
#include "token.h"
/* Include the hashing table for the keywords. */
const struct locale_keyword* in_word_set (register const char *str,
register int len);
#include "keyword.h"
/* Contains the status of reading the locale definition file. */
struct locfile_data locfile_data;
/* This is a flag used while collation input. This is the only place
where element names beside the ones defined in the character map are
allowed. There we must not give error messages. */
int reject_new_char = 1;
/* Prototypes for local functions. */
static int get_char (void);
#define LD locfile_data
/* Opens the locale definition file and initializes the status data structure
for following calls of `locfile_lex'. */
void
locfile_open (const char *fname)
{
if (fname == NULL)
/* We read from stdin. */
LD.filename = "<stdin>";
else
{
if (freopen (fname, "r", stdin) == NULL)
error (4, 0, gettext ("input file `%s' not found"), fname);
LD.filename = fname;
}
/* Set default values. */
LD.escape_char = '\\';
LD.comment_char = '#';
LD.bufsize = sysconf (_SC_LINE_MAX);
LD.buf = (char *) xmalloc (LD.bufsize);
LD.strbuf = (char *) xmalloc (LD.bufsize);
LD.buf_ptr = LD.returned_tokens = LD.line_no = 0;
/* Now sign that we want immediately read a line. */
LD.continue_line = 1;
LD.buf[LD.buf_ptr] = '\0';
}
int
xlocfile_lex (char **token, int *token_len)
{
int retval = locfile_lex (token, token_len);
if (retval == 0)
/* I.e. end of file. */
error (4, 0, gettext ("%s: unexpected end of file in locale defintion "
"file"), locfile_data.filename);
return retval;
}
int
locfile_lex (char **token, int *token_len)
{
int start_again;
int retval = 0;
do
{
int start_ptr;
start_again = 0;
/* Read the next line. Skip over empty lines and comments. */
if ((LD.buf[LD.buf_ptr] == '\0' && LD.continue_line != 0)
|| LD.buf_ptr >= LD.bufsize
|| (posix_conformance == 0 && LD.buf[LD.buf_ptr] == LD.comment_char))
do
{
size_t linelen;
LD.buf_ptr = 0;
if (fgets (LD.buf, LD.bufsize, stdin) == NULL)
{
/* This makes subsequent calls also return EOF. */
LD.buf[0] = '\0';
return 0;
}
/* Increment line number counter. */
++LD.line_no;
/* We now have to look whether this line is continued and
whether it at all fits into our buffer. */
linelen = strlen (LD.buf);
if (linelen == LD.bufsize - 1)
/* The did not fit into the buffer. */
error (2, 0, gettext ("%s:%Zd: line too long; use "
"`getconf LINE_MAX' to get the maximum "
"line length"), LD.filename, LD.line_no);
/* Remove '\n' at end of line. */
if (LD.buf[linelen - 1] == '\n')
LD.buf[--linelen] = '\0';
if (linelen > 0 && LD.buf[linelen - 1] == LD.escape_char)
{
LD.buf[--linelen] = '\0';
LD.continue_line = 1;
}
else
LD.continue_line = 0;
while (isspace (LD.buf[LD.buf_ptr]))
++LD.buf_ptr;
/* We are not so restrictive and allow white spaces before
a comment. */
if (posix_conformance == 0
&& LD.buf[LD.buf_ptr] == LD.comment_char
&& LD.buf_ptr != 0)
error (0, 0, gettext ("%s:%Zd: comment does not start in "
"column 1"), LD.filename, LD.line_no);
}
while (LD.buf[LD.buf_ptr] == '\0'
|| LD.buf[LD.buf_ptr] == LD.comment_char);
/* Get information for return values. */
*token = LD.buf + LD.buf_ptr;
start_ptr = LD.buf_ptr;
/* If no further character is in the line this is the end of a logical
line. This information is needed in the parser. */
if (LD.buf[LD.buf_ptr] == '\0')
{
LD.buf_ptr = LD.bufsize;
retval = TOK_ENDOFLINE;
}
else if (isalpha (LD.buf[LD.buf_ptr]))
/* The token is an identifier. The POSIX standard does not say
what characters might be contained but offical POSIX locale
definition files contain beside alnum characters '_', '-' and
'+'. */
{
const struct locale_keyword *kw;
do
++LD.buf_ptr;
while (isalnum (LD.buf[LD.buf_ptr]) || LD.buf[LD.buf_ptr] == '_'
|| LD.buf[LD.buf_ptr] == '-' || LD.buf[LD.buf_ptr] == '+');
/* Look in table of keywords. */
kw = in_word_set (*token, LD.buf_ptr - start_ptr);
if (kw == NULL)
retval = TOK_IDENT;
else
{
if (kw->token_id == TOK_ESCAPE_CHAR
|| kw->token_id == TOK_COMMENT_CHAR)
/* `escape_char' and `comment_char' are keywords for the
lexer. Do not give them to the parser. */
{
start_again = 1;
if (!isspace (LD.buf[LD.buf_ptr])
|| (posix_conformance && LD.returned_tokens > 0))
error (0, 0, gettext ("%s:%Zd: syntax error in locale "
"definition file"),
LD.filename, LD.line_no);
do
++LD.buf_ptr;
while (isspace (LD.buf[LD.buf_ptr]));
kw->token_id == TOK_ESCAPE_CHAR
? LD.escape_char
: LD.comment_char = LD.buf[LD.buf_ptr++];
ignore_to_eol (0, posix_conformance);
}
else
/* It is one of the normal keywords. */
retval = kw->token_id;
}
*token_len = LD.buf_ptr - start_ptr;
}
else if (LD.buf[LD.buf_ptr] == '"')
/* Read a string. All symbolic character descriptions are expanded.
This has to be done in a local buffer because a simple symbolic
character like <A> may expand to upto 6 bytes. */
{
char *last = LD.strbuf;
++LD.buf_ptr;
while (LD.buf[LD.buf_ptr] != '"')
{
int pre = LD.buf_ptr;
int char_val = get_char (); /* token, token_len); */
if (char_val == 0)
{
error (4, 0, gettext ("%s:%Zd: unterminated string at end "
"of line"), LD.filename, LD.line_no);
/* NOTREACHED */
}
if (char_val > 0)
/* Unknown characters are simply not stored. */
last += char_to_utf (last, char_val);
else
{
char tmp[LD.buf_ptr - pre + 1];
memcpy (tmp, &LD.buf[pre], LD.buf_ptr - pre);
tmp[LD.buf_ptr - pre] = '\0';
error (0, 0, gettext ("%s:%Zd: character `%s' not defined"),
LD.filename, LD.line_no, tmp);
}
}
if (LD.buf[LD.buf_ptr] != '\0')
++LD.buf_ptr;
*last = '\0';
*token = LD.strbuf;
*token_len = last - LD.strbuf;
retval = TOK_STRING;
}
else if (LD.buf[LD.buf_ptr] == '.' && LD.buf[LD.buf_ptr + 1] == '.'
&& LD.buf[LD.buf_ptr + 2] == '.')
{
LD.buf_ptr += 3;
retval = TOK_ELLIPSIS;
}
else if (LD.buf[LD.buf_ptr] == LD.escape_char)
{
char *endp;
++LD.buf_ptr;
switch (LD.buf[LD.buf_ptr])
{
case 'x':
if (isdigit (LD.buf[++LD.buf_ptr]))
{
retval = strtol (&LD.buf[LD.buf_ptr], &endp, 16);
if (endp - (LD.buf + LD.buf_ptr) < 2 || retval > 255)
retval = 'x';
else
LD.buf_ptr = endp - LD.buf;
}
else
retval = 'x';
break;
case 'd':
if (isdigit (LD.buf[++LD.buf_ptr]))
{
retval = strtol (&LD.buf[LD.buf_ptr], &endp, 10);
if (endp - (LD.buf + LD.buf_ptr) < 2 || retval > 255)
retval = 'd';
else
LD.buf_ptr = endp - LD.buf;
}
else
retval = 'd';
break;
case '0'...'9':
retval = strtol (&LD.buf[LD.buf_ptr], &endp, 8);
if (endp - (LD.buf + LD.buf_ptr) < 2 || retval > 255)
retval = LD.buf[LD.buf_ptr++];
else
LD.buf_ptr = endp - LD.buf;
break;
case 'a':
retval = '\a';
++LD.buf_ptr;
break;
case 'b':
retval = '\b';
++LD.buf_ptr;
break;
case 'f':
retval = '\f';
++LD.buf_ptr;
break;
case 'n':
retval = '\n';
++LD.buf_ptr;
break;
case 'r':
retval = '\r';
++LD.buf_ptr;
break;
case 't':
retval = '\t';
++LD.buf_ptr;
break;
case 'v':
retval = '\v';
++LD.buf_ptr;
break;
default:
retval = LD.buf[LD.buf_ptr++];
break;
}
}
else if (isdigit (LD.buf[LD.buf_ptr]))
{
char *endp;
*token_len = strtol (&LD.buf[LD.buf_ptr], &endp, 10);
LD.buf_ptr = endp - LD.buf;
retval = TOK_NUMBER;
}
else if (LD.buf[LD.buf_ptr] == '-' && LD.buf[LD.buf_ptr + 1] == '1')
{
LD.buf_ptr += 2;
retval = TOK_MINUS1;
}
else
{
int ch = get_char (); /* token, token_len); */
if (ch != -1)
{
*token_len = ch;
retval = TOK_CHAR;
}
else
retval = TOK_ILL_CHAR;
}
/* Ignore white space. */
while (isspace (LD.buf[LD.buf_ptr]))
++LD.buf_ptr;
}
while (start_again != 0);
++LD.returned_tokens;
return retval;
}
/* Code a character with UTF-8 if the character map has multi-byte
characters. */
int
char_to_utf (char *buf, int char_val)
{
if (charmap_data.mb_cur_max == 1)
{
*buf++ = char_val;
return 1;
}
else
{
/* The number of bits coded in each character. */
#define CBPC 6
static struct coding_tab
{
int mask;
int val;
}
tab[] =
{
{ 0x7f, 0x00 },
{ 0x7ff, 0xc0 },
{ 0xffff, 0xe0 },
{ 0x1fffff, 0xf0 },
{ 0x3ffffff, 0xf8 },
{ 0x7fffffff, 0xfc },
{ 0, }
};
struct coding_tab *t;
int c;
int cnt = 1;
for (t = tab; char_val > t->mask; ++t, ++cnt)
;
c = cnt;
buf += cnt;
while (c > 1)
{
*--buf = 0x80 | (char_val & ((1 << CBPC) - 1));
char_val >>= CBPC;
--c;
}
*--buf = t->val | char_val;
return cnt;
}
}
/* Ignore rest of line upto ENDOFLINE token, starting with given token.
If WARN_FLAG is set warn about any token but ENDOFLINE. */
void
ignore_to_eol (int token, int warn_flag)
{
if (token == TOK_ENDOFLINE)
return;
if (LD.buf[LD.buf_ptr] != '\0' && warn_flag)
error (0, 0, gettext ("%s:%Zd: trailing garbage at end of line"),
locfile_data.filename, locfile_data.line_no);
while (LD.continue_line)
{
LD.continue_line = 0;
/* Increment line number counter. */
++LD.line_no;
if (fgets (LD.buf, LD.bufsize, stdin) != NULL)
{
/* We now have to look whether this line is continued and
whether it at all fits into our buffer. */
int linelen = strlen (LD.buf);
if (linelen == LD.bufsize - 1)
/* The did not fit into the buffer. */
error (2, 0, gettext ("%s:%Zd: line too long; use `getconf "
"LINE_MAX' to get the current maximum "
"line length"), LD.filename, LD.line_no);
/* Remove '\n' at end of line. */
if (LD.buf[linelen - 1] == '\n')
--linelen;
if (LD.buf[linelen - 1] == LD.escape_char)
LD.continue_line = 1;
}
}
/* This causes to begin the next line. */
LD.buf_ptr = LD.bufsize;
}
/* Return the value of the character at the beginning of the input buffer.
Symbolic character constants are expanded. */
static int
get_char (void)
{
if (LD.buf[LD.buf_ptr] == '<')
/* This is a symbolic character name. */
{
int char_val;
char *startp = LD.buf + (++LD.buf_ptr);
char *endp = startp;
while (LD.buf[LD.buf_ptr] != '>' && isprint (LD.buf[LD.buf_ptr]))
{
if (LD.buf[LD.buf_ptr] == '\0'
|| (LD.buf[LD.buf_ptr] == LD.escape_char
&& LD.buf[++LD.buf_ptr] == '\0'))
break;
*endp++ = LD.buf[LD.buf_ptr++];
}
if (LD.buf[LD.buf_ptr] != '>' && LD.buf[LD.buf_ptr] == '\0')
{
error (0, 0, gettext ("%s:%Zd: end of line in character symbol"),
LD.filename, LD.line_no);
if (startp == endp)
return -1;
}
else
++LD.buf_ptr;
char_val = find_char (startp, endp - startp);
if (char_val == -1 && verbose != 0 && reject_new_char != 0)
{
/* Locale defintions are often given very general. Missing
characters are only reported when explicitely requested. */
char tmp[endp - startp + 3];
tmp[0] = '<';
memcpy (tmp + 1, startp, endp - startp);
tmp[endp - startp + 1] = '>';
tmp[endp - startp + 2] = '\0';
error (0, 0, gettext ("%s:%Zd: character `%s' not defined"),
LD.filename, LD.line_no, tmp);
}
return char_val;
}
else
return (int) LD.buf[LD.buf_ptr++];
}
/*
* Local Variables:
* mode:c
* c-basic-offset:2
* End:
*/
-838
View File
@@ -1,838 +0,0 @@
/* Copyright (C) 1995 Free Software Foundation, Inc.
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 <errno.h>
#include <assert.h>
#include <dirent.h>
#include <fcntl.h>
#include <langinfo.h>
#include <libintl.h>
#include <limits.h>
#include <obstack.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/uio.h>
#include "localedef.h"
#include "localeinfo.h"
#include "token.h"
/* We don't have these constants defined because we don't use them. Give
default values. */
#define CTYPE_MB_CUR_MIN 0
#define CTYPE_MB_CUR_MAX 0
#define CTYPE_HASH_SIZE 0
#define CTYPE_HASH_LAYERS 0
#define CTYPE_CLASS 0
#define CTYPE_TOUPPER_EB 0
#define CTYPE_TOLOWER_EB 0
#define CTYPE_TOUPPER_EL 0
#define CTYPE_TOLOWER_EL 0
/* We have all categories defined in `categories.def'. Now construct
the description and data structure used for all categories. */
#define DEFINE_CATEGORY(category, name, items, postload, in, check, out) \
struct cat_item category##_desc[] = \
{ \
NO_PAREN items \
}; \
\
char *category##_values[NELEMS (category##_desc) - 1] = { NULL, };
#include "categories.def"
#undef DEFINE_CATEGORY
struct category category[] =
{
#define DEFINE_CATEGORY(category, name, items, postload, in, check, out) \
[category] = { _NL_NUM_##category, name, NELEMS (category##_desc) - 1, \
category##_desc, category##_values, in, check, out },
#include "categories.def"
#undef DEFINE_CATEGORY
};
#define NCATEGORIES NELEMS (category)
#define SYNTAX_ERROR \
error (0, 0, gettext ("%s:%Zd: syntax error in locale definition file"), \
locfile_data.filename, locfile_data.line_no)
/* Prototypes for local functions. */
static int get_byte (char *byte_ptr);
static char *is_locale_name (int cat_no, const char *str, int len);
/* Read a locale definition file FILE. The format is defined in
POSIX.2 2.5.3. */
void
locfile_read (const char *fname)
{
/* Pointer to text of last token. */
char *ptr;
/* Length of last token (or if NUMBER the value itself). */
int len;
/* The last returned token. */
int token;
/* For error correction we remember whether the last token was correct. */
int correct_token = 1;
/* Open the desired input file on stdin. */
locfile_open (fname);
while ((token = locfile_lex (&ptr, &len)) != 0)
{
int cat_no;
for (cat_no = 0; cat_no < NCATEGORIES; ++cat_no)
if (token == category[cat_no].cat_id)
break;
if (cat_no >= NCATEGORIES)
/* A syntax error occured. No valid category defintion starts. */
{
if (correct_token != 0)
error (0, 0, gettext ("%s:%Zd: locale category start expected"),
locfile_data.filename, locfile_data.line_no);
/* To prevent following errors mark as error case. */
correct_token = 0;
/* Synchronization point is the beginning of a new category.
Overread all line upto this silently. */
ignore_to_eol (0, 0);
continue;
}
/* Rest of the line should be empty. */
ignore_to_eol (0, 1);
/* Perhaps these category is already specified. We simply give a
warning and overwrite the values. */
if (category[cat_no].filled != 0)
error (0, 0, gettext ("%s:%Zd: multiple definition of locale "
"category %s"), locfile_data.filename,
locfile_data.line_no, category[cat_no].name);
/* We read the first token because this could be the copy statement. */
token = xlocfile_lex (&ptr, &len);
if (token == TOK_COPY)
/* Copying the definitions from an existing locale is requested. */
{
char *str;
/* Get the name of the locale to copy from. */
token = xlocfile_lex (&ptr, &len);
if (token != TOK_IDENT && token != TOK_STRING)
/* No name, then mark error and ignore everything upto next
start of an category section. */
{
/* To prevent following errors mark as error case. */
correct_token = 0;
/* Synchronization point is the beginning of a new category.
Overread all line upto this silently. */
ignore_to_eol (0, 0);
}
else if ((str = is_locale_name (cat_no, ptr, len)) != NULL)
/* Yes the name really names an existing locale file. We are
returned the complete file name. Store it so that we can
copy it in the output phase. */
{
category[cat_no].copy_locale = str;
category[cat_no].filled = 1;
ignore_to_eol (0, 1);
}
else
/* No, the name does not address a valid locale file. Mark
error case and ignore rest of category. */
{
char tmp[len + 1];
memcpy (tmp, ptr, len);
tmp[len] = '\0';
error (0, 0, gettext ("%s:%Zd: invalid locale `%s' in copy "
"statement"), locfile_data.filename,
locfile_data.line_no, tmp);
correct_token = 0;
ignore_to_eol (0, 0);
}
/* This should END as the next token. */
token = xlocfile_lex (&ptr, &len);
if (token == TOK_END)
/* This is the end of the category. */
{
token = xlocfile_lex (&ptr, &len);
if (token != category[cat_no].cat_id)
/* Wrong category name after END. */
{
error (0, 0, gettext ("%s:%Zd: category `%s' does not "
"end with `END %s'"),
locfile_data.filename, locfile_data.line_no,
category[cat_no].name, category[cat_no].name);
ignore_to_eol (0, 0);
}
else
ignore_to_eol (0, 1);
correct_token = 1;
}
else
/* No END following copy. Give error while not in error case. */
{
if (correct_token != 0)
error (0, 0, gettext ("%s:%Zd: `copy' must be sole rule"),
locfile_data.filename, locfile_data.line_no);
correct_token = 0;
ignore_to_eol (0, 0);
}
continue;
}
/* Now it's time to mark as mentioned in the locale file. */
category[cat_no].filled = 1;
if (category[cat_no].infct != NULL)
/* The category needs a special input handling. */
{
category[cat_no].infct(token);
continue;
}
/* Now process the given items. */
while (1)
{
int item_no;
if (token == TOK_END)
/* This is the end of the category. */
{
token = xlocfile_lex (&ptr, &len);
if (token != category[cat_no].cat_id)
{
error (0, 0, gettext ("%s:%Zd: category `%s' does not end "
"with `END %s'"),
locfile_data.filename, locfile_data.line_no,
category[cat_no].name, category[cat_no].name);
ignore_to_eol (0, 0);
}
else
ignore_to_eol (0, 1);
/* Start next category. */
break;
}
/* All other lines should describe valid items of the category. */
for (item_no = 0; item_no < category[cat_no].number; ++item_no)
if (category[cat_no].item_desc[item_no].item_id == token)
break;
if (item_no >= category[cat_no].number)
/* This is not a valid item of the category. */
{
SYNTAX_ERROR;
ignore_to_eol (0, 0);
token = xlocfile_lex (&ptr, &len);
/* And process next item. */
continue;
}
/* Test whether already a value is defined. */
if (category[cat_no].item_value[item_no] != NULL)
error (0, 0, gettext ("%s:%Zd: category item `%s' already "
"defined"),
locfile_data.filename, locfile_data.line_no,
category[cat_no].item_desc[item_no].name);
switch (category[cat_no].item_desc[item_no].value_type)
{
case string:
/* Get next token. This is the argument to the item. */
token = xlocfile_lex (&ptr, &len);
if (token != TOK_STRING)
SYNTAX_ERROR;
else
category[cat_no].item_value[item_no] = strdup (ptr);
ignore_to_eol (0, ptr != NULL);
break;
case stringarray:
/* This is a difficult case. The number of strings in
the array may vary. But for now its only necessary
with ALT_DIGITS from LC_TIME. This item is the last
so be can solve it by storing the number of string in
the first place and the string indeces following
that. */
{
int cnt;
char **buffer;
if (category[cat_no].item_value[item_no] != NULL)
buffer = (char **) category[cat_no].item_value[item_no];
else
buffer = (char **) xmalloc (
sizeof (char *) * category[cat_no].item_desc[item_no].max);
category[cat_no].item_value[item_no] = (char *) buffer;
/* As explained we may need a place to store the real number
of strings. */
if (category[cat_no].item_desc[item_no].min
!= category[cat_no].item_desc[item_no].max)
++buffer;
cnt = 0;
do
{
token = xlocfile_lex (&ptr, &len);
if (token != TOK_STRING)
{
SYNTAX_ERROR;
break;
}
if (cnt >= category[cat_no].item_desc[item_no].max)
{
error (0, 0, gettext ("%s:%Zd: too many elements "
"for item `%s`"),
locfile_data.filename, locfile_data.line_no,
category[cat_no].item_desc[item_no].name);
break;
}
buffer[cnt++] = strdup (ptr);
token = locfile_lex (&ptr, &len);
}
while (token == TOK_CHAR && len == ';');
ignore_to_eol (token, ptr != NULL);
if (cnt < category[cat_no].item_desc[item_no].min)
error (0, 0, gettext ("%s:%Zd: too few elements for item "
"`%s'"),
locfile_data.filename, locfile_data.line_no,
category[cat_no].item_desc[item_no].name);
if (category[cat_no].item_desc[item_no].min
!= category[cat_no].item_desc[item_no].max)
*(int *) category[cat_no].item_value[item_no] = cnt;
}
break;
case byte:
{
int ok;
category[cat_no].item_value[item_no] = (char *) xmalloc (
__alignof__ (char));
ok = get_byte (category[cat_no].item_value[item_no]);
ignore_to_eol (0, ok);
}
break;
case bytearray:
{
char *buffer;
int maxsize;
int cnt;
char byte;
int ok;
buffer = (char *) xmalloc ((maxsize = 30));
cnt = 0;
while ((ok = get_byte (&byte)))
{
if (cnt >= maxsize)
buffer = (char *) xmalloc ((maxsize *= 2));
buffer[cnt++] = byte;
token = locfile_lex (&ptr, &len);
if (token != TOK_CHAR || len != ';')
break;
}
buffer[cnt] = '\0';
category[cat_no].item_value[item_no] = buffer;
ignore_to_eol (token, ok);
}
break;
default:
error (5, 0, gettext ("internal error in %s, line %u"),
__FUNCTION__, __LINE__);
/* NOTREACHED */
}
/* Get next token. */
token = xlocfile_lex (&ptr, &len);
} /* while (1) */
}
}
/* Check given values for categories for consistency. */
void
categories_check (void)
{
int cat_no;
for (cat_no = 0; cat_no < NCATEGORIES; ++cat_no)
if (category[cat_no].copy_locale == NULL)
if (category[cat_no].filled != 0)
if (category[cat_no].checkfct)
category[cat_no].checkfct();
else
{
int item_no;
for (item_no = 0; item_no < category[cat_no].number; ++item_no)
if (category[cat_no].item_value[item_no] == NULL)
{
int errcode;
/* If the item is defined in the standard is it an error to
have it not defined. */
errcode = category[cat_no].item_desc[item_no].status == std
? 5 : 0;
error (errcode, 0, gettext ("item `%s' of category `%s' "
"undefined"),
category[cat_no].item_desc[item_no].name,
category[cat_no].name);
}
}
else
error (0, 0, gettext ("category `%s' not defined"),
category[cat_no].name);
}
/* Write out the binary representation of the category data which can be
loaded by setlocale(1). */
void
categories_write (void)
{
struct locale_file
{
int magic;
int n;
int idx[0];
} *data;
struct obstack obstk;
int cat_no;
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
obstack_init (&obstk);
for (cat_no = 0; cat_no < NCATEGORIES; ++cat_no)
{
int result = 0;
if (category[cat_no].copy_locale != NULL)
/* Simply copy the addressed locale file of the specified
category. Please note that this is tried before the distinction
between categories which need special handling is made. */
{
int source;
/* Open source file. */
source = open (category[cat_no].copy_locale, O_RDONLY);
if (source < 0)
error (0, 0, gettext ("cannot copy locale definition file `%s'"),
category[cat_no].copy_locale);
else
{
/* Construct file name of output file and open for writing. */
char path[strlen (output_path)
+ strlen(category[cat_no].name) + 1];
int dest;
char *t;
t = stpcpy (path, output_path);
strcpy (t, category[cat_no].name);
dest = creat (path, 0666);
if (dest == -1)
error (0, 0, gettext ("cannot open output file `%s': %m"),
path);
else
{
char buffer[BUFSIZ];
int size;
/* Copy the files. */
do
{
size = read (source, buffer, BUFSIZ);
write (dest, buffer, size);
}
while (size > 0);
close (dest);
/* Show success. */
puts (category[cat_no].name);
}
close (source);
}
/* Next category. */
continue;
}
if (category[cat_no].outfct)
result = category[cat_no].outfct();
else
{
char *path, *t;
int fd;
struct iovec *iov;
int item_no, len, slen, cnt;
int elems = 0;
/* Count number of elements. */
for (item_no = 0; item_no < category[cat_no].number; ++item_no)
{
switch (category[cat_no].item_desc[item_no].value_type)
{
case string:
case byte:
case bytearray:
++elems;
break;
case stringarray:
elems += category[cat_no].item_desc[item_no].max;
break;
default:
error (5, 0, gettext ("internal error in %s, line %u"),
__FUNCTION__, __LINE__);
/* NOTREACHED */
}
}
/* We now have the number of elements. We build the structure
and a helper structure for writing all out. */
len = sizeof (struct locale_file) + elems * sizeof (int);
data = obstack_alloc (&obstk, len);
iov = obstack_alloc (&obstk, (elems + 1) * sizeof (struct iovec));
data->magic = LIMAGIC (cat_no);
data->n = elems;
iov[0].iov_base = data;
iov[0].iov_len = len;
cnt = 0;
for (item_no = 0; item_no < category[cat_no].number; ++item_no)
if (category[cat_no].item_value[item_no] == NULL)
{
switch (category[cat_no].item_desc[item_no].value_type)
{
case string:
case byte:
case bytearray:
data->idx[cnt] = len;
++len; /* We reserve one single byte for this entry. */
iov[1 + cnt].iov_base = (char *) "";
iov[1 + cnt].iov_len = 1;
++cnt;
break;
case stringarray:
{
int max;
int nstr;
max = category[cat_no].item_desc[item_no].max;
for (nstr = 0; nstr < max; ++nstr)
{
data->idx[cnt] = len;
++len;
iov[1 + cnt].iov_base = (char *) "";
iov[1 + cnt].iov_len = 1;
++cnt;
}
}
}
}
else
switch (category[cat_no].item_desc[item_no].value_type)
{
case string:
case bytearray:
data->idx[cnt] = len;
slen = strlen (category[cat_no].item_value[item_no]) + 1;
len += slen;
iov[1 + cnt].iov_base = category[cat_no].item_value[item_no];
iov[1 + cnt].iov_len = slen;
++cnt;
break;
case byte:
data->idx[cnt] = len;
slen = 1;
len += slen;
iov[1 + cnt].iov_base = category[cat_no].item_value[item_no];
iov[1 + cnt].iov_len = slen;
++cnt;
break;
case stringarray:
{
int nstr, nact;
char **first;
if (category[cat_no].item_desc[item_no].min
== category[cat_no].item_desc[item_no].max)
{
nstr = category[cat_no].item_desc[item_no].min;
first = (char **) category[cat_no].item_value[item_no];
}
else
{
nstr = *(int *) category[cat_no].item_value[item_no];
first =
((char **) category[cat_no].item_value[item_no]) + 1;
}
nact = nstr;
while (nstr > 0)
{
data->idx[cnt] = len;
if (*first != NULL)
{
slen = strlen (*first) + 1;
iov[1 + cnt].iov_base = *first;
}
else
{
slen = 1;
iov[1 + cnt].iov_base = (char *) "";
}
len += slen;
iov[1 + cnt].iov_len = slen;
++cnt;
++first;
--nstr;
}
while (nact < category[cat_no].item_desc[item_no].max)
{
data->idx[cnt] = len;
len += 1;
iov[1 + cnt].iov_base = (char *) "";
iov[1 + cnt].iov_len = 1;
++cnt;
++nact;
}
}
break;
default:
/* Cannot happen. */
break;
}
assert (cnt <= elems);
/* Construct the output filename from the argument given to
localedef on the command line. */
path = (char *) obstack_alloc (&obstk, strlen (output_path) +
2 * strlen (category[cat_no].name) + 5);
t = stpcpy (path, output_path);
strcpy (t, category[cat_no].name);
fd = creat (path, 0666);
if (fd == -1)
{
/* Check whether it failed because the named file is a directory.
In that case we use the file .../LC_xxx/SYS_LC_xxx, as the
loading functions of the C Library do. */
struct stat st;
if (stat (path, &st) == 0 && S_ISDIR (st.st_mode))
{
stpcpy (stpcpy (strchr (path, '\0'), "/SYS_"),
category[cat_no].name);
fd = creat (path, 0666);
}
}
if (fd == -1)
{
error (0, 0, gettext ("cannot open output file `%s': %m"),
path);
result = 1;
}
else
{
if (writev (fd, iov, cnt + 1) == -1)
{
error (0, 0, gettext ("cannot write output file `%s': %m"),
path);
result = 1;
}
if (elems==0) write(fd, &elems, 10);
close (fd);
}
/* The old data is not needed anymore, but keep the obstack
intact. */
obstack_free (&obstk, data);
}
if (result == 0)
puts (category[cat_no].name);
}
/* Now the whole obstack can be removed. */
obstack_free (&obstk, NULL);
}
/* Get the representation of a number. This is a positive integer or
the number -1 which is handled as a special symbol by the scanner. */
static int
get_byte (char *byte_ptr)
{
int token;
char *ptr;
int len;
token = locfile_lex (&ptr, &len);
if (token != TOK_NUMBER && token != TOK_MINUS1)
/* None of the valid number format. */
{
error (0, 0, gettext ("%s:%Zd: number expected"),
locfile_data.filename, locfile_data.line_no);
*byte_ptr = 0;
return 0;
}
if (token == TOK_MINUS1)
{
*byte_ptr = CHAR_MAX;
return 1;
}
if (len > CHAR_MAX)
/* The value of the numbers has to be less than CHAR_MAX. This is
ok for the information they have to express. */
{
error (0, 0, gettext ("%s:%Zd: invalid number"),
locfile_data.filename, locfile_data.line_no);
*byte_ptr = 0;
return 0;
}
*byte_ptr = len;
return 1;
}
/* Test whether the string STR with length LEN is the name of an existing
locale and whether a file for category CAT_NO is found in this directory.
This categories are looked for in the system locale definition file
directory.
Return the complete file name for the category file. */
static char *
is_locale_name (int cat_no, const char *str, int len)
{
static char **locale_names = NULL;
static int max_count = 0;
static int locale_count = 0;
int cnt, exist, fd;
char *fname;
struct stat st;
if (locale_names == NULL)
/* Read in the list of all available locales. */
{
DIR *dir;
struct dirent *dirent;
/* LOCALE_NAMES is not NULL anymore, but LOCALE_COUNT == 0. */
++locale_names;
dir = opendir (LOCALE_PATH);
if (dir == NULL)
{
error (1, errno, gettext ("cannot read locale directory `%s'"),
LOCALE_PATH);
return NULL;
}
/* Now we can look for all files in the directory. */
while ((dirent = readdir (dir)) != NULL)
if (strcmp (dirent->d_name, ".") != 0
&& strcmp (dirent->d_name, "..") != 0)
{
if (max_count == 0)
locale_names = (char **) xmalloc ((max_count = 10)
* sizeof (char *));
else if (locale_count >= max_count)
locale_names = (char **) xrealloc (locale_names,
(max_count *= 2)
* sizeof (char *));
locale_names[locale_count++] = strdup (dirent->d_name);
}
closedir (dir);
}
for (cnt = 0; cnt < locale_count; ++cnt)
if (strncmp (str, locale_names[cnt], len) == 0
&& locale_names[cnt][len] == '\0')
break;
if (cnt >= locale_count)
return NULL;
/* Now search for this specific locale file. */
asprintf (&fname, "%s/%s/%s", LOCALE_PATH, locale_names[cnt],
category[cat_no].name);
fd = open (fname, O_RDONLY);
if (fd < 0)
{
free (fname);
return NULL;
}
exist = fstat (fd, &st);
close (fd);
if (exist < 0)
{
free (fname);
return NULL;
}
return fname;
}
/*
* Local Variables:
* mode:c
* c-basic-offset:2
* End:
*/
-76
View File
@@ -1,76 +0,0 @@
/* Copyright (C) 1995 Free Software Foundation, Inc.
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 <langinfo.h>
#include <libintl.h>
#include <locale.h>
#include <stdio.h>
#include <regex.h>
#include "localedef.h"
/* These are defined in locfile-parse.c. */
extern struct cat_item LC_MESSAGES_desc[];
extern char *LC_MESSAGES_values[];
void
messages_check(void)
{
int item_no;
/* First general check for existence. */
for (item_no = 0; item_no < category[LC_MESSAGES].number; ++item_no)
if (LC_MESSAGES_values[item_no] == NULL)
{
int errcode;
errcode = LC_MESSAGES_desc[item_no].status == std ? 5 : 0;
error (errcode, 0, gettext ("item `%s' of category `%s' undefined"),
LC_MESSAGES_desc[item_no].name, "LC_MESSAGES");
}
else
{
/* Some fields need special tests. */
if (LC_MESSAGES_desc[item_no].item_id == YESEXPR
|| LC_MESSAGES_desc[item_no].item_id == NOEXPR)
/* The expression has to be a POSIX extended regular expression. */
{
regex_t re;
int result;
result = regcomp (&re, LC_MESSAGES_values[item_no], REG_EXTENDED);
if (result != 0)
{
char errbuf[BUFSIZ];
(void) regerror (result, &re, errbuf, BUFSIZ);
error (0, 0, gettext ("no correct regular expression for "
"item `%s' in category `%s': %s"),
LC_MESSAGES_desc[item_no].name, "LC_MESSAGES", errbuf);
}
}
}
}
/*
* Local Variables:
* mode:c
* c-basic-offset:2
* End:
*/
-132
View File
@@ -1,132 +0,0 @@
/* Copyright (C) 1995 Free Software Foundation, Inc.
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 <langinfo.h>
#include <libintl.h>
#include <stdlib.h>
#include <string.h>
#include "localedef.h"
#include "token.h"
/* The content iof the field int_curr_symbol has to be taken from
ISO-4217. We test for correct values. */
#define DEFINE_INT_CURR(str) str,
static const char *const valid_int_curr[] =
{
# include "iso-4217.def"
};
#define NVALID_INT_CURR ((sizeof (valid_int_curr) \
/ sizeof (valid_int_curr[0])))
#undef DEFINE_INT_CURR
/* These are defined in locfile-parse.c. */
extern struct cat_item LC_MONETARY_desc[];
extern char *LC_MONETARY_values[];
static int _curr_strcmp(const char *s1, const char **s2);
void
monetary_check(void)
{
int item_no, val;
for (item_no = 0; LC_MONETARY_desc[item_no].item_id != 0; ++item_no)
/* Test whether the entry has been defined. Byte values are simply
stored. */
if (LC_MONETARY_values[item_no] == NULL)
{
int errcode;
errcode = LC_MONETARY_desc[item_no].status = std ? 5 : 0;
error (errcode, 0, gettext ("item `%s' of category `%s' undefined"),
LC_MONETARY_desc[item_no].name, "LC_MONETARY");
}
else
switch (LC_MONETARY_desc[item_no].item_id)
{
case INT_CURR_SYMBOL:
if (strlen (LC_MONETARY_values[item_no]) != 4)
error (0, 0,
gettext ("item `%s' of category `%s' has wrong length"),
LC_MONETARY_desc[item_no].name, "LC_MONETARY");
else if (bsearch (LC_MONETARY_values[item_no], valid_int_curr,
NVALID_INT_CURR, sizeof (char *),
(comparison_fn_t) _curr_strcmp) == NULL)
error (0, 0, gettext ("item `%s' does not correspond to any "
"valid name in ISO-4217"),
LC_MONETARY_desc[item_no].name);
break;
case P_CS_PRECEDES:
case P_SEP_BY_SPACE:
case N_CS_PRECEDES:
case N_SEP_BY_SPACE:
case P_SIGN_POSN:
case N_SIGN_POSN:
val = (int) *(char *) LC_MONETARY_values[item_no];
if (val < LC_MONETARY_desc[item_no].min
|| val > LC_MONETARY_desc[item_no].max)
error (0, 0, gettext ("value for item `%s' in category `%s' "
"must be in range %d...%d"),
LC_MONETARY_desc[item_no].name, "LC_MONETARY",
LC_MONETARY_desc[item_no].min,
LC_MONETARY_desc[item_no].max);
break;
case MON_DECIMAL_POINT:
/* The decimal point must not be empty. This is not said
explicitly in POSIX but ANSI C (ISO/IEC 9899) says in
4.4.2.1 it has to be != "". */
if (LC_MONETARY_values[item_no][0] == '\0')
error (0, 0,
gettext ("item `%s' in category `%s' must not be empty"),
LC_MONETARY_desc[item_no].name, "LC_MONETARY");
break;
case CURRENCY_SYMBOL:
case MON_THOUSANDS_SEP:
case MON_GROUPING:
case POSITIVE_SIGN:
case NEGATIVE_SIGN:
case INT_FRAC_DIGITS:
case FRAC_DIGITS:
/* Everything is ok for these values. */
break;
default:
error (5, 0, gettext ("Internal error in %s, line %u"),
__FUNCTION__, __LINE__);
/* NOTREACHED */
}
}
static int
_curr_strcmp(const char *s1, const char **s2)
{
return strcmp (s1, *s2);
}
/*
* Local Variables:
* mode:c
* c-basic-offset:2
* End:
*/
+2 -2
View File
@@ -1,5 +1,5 @@
/* nl_langinfo -- User interface for extracting locale-dependent parameters.
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
@@ -62,5 +62,5 @@ nl_langinfo (item)
}
/* Return the string for the specified item. */
return (char *) data->strings[index];
return (char *) data->values[index].string;
}
-62
View File
@@ -1,62 +0,0 @@
/* Copyright (C) 1995 Free Software Foundation, Inc.
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 <langinfo.h>
#include <libintl.h>
#include <locale.h>
#include "localedef.h"
/* These are defined in locfile-parse.c. */
extern struct cat_item LC_NUMERIC_desc[];
extern char *LC_NUMERIC_values[];
void
numeric_check(void)
{
int item_no;
/* First general check for existence. */
for (item_no = 0; item_no < category[LC_NUMERIC].number; ++item_no)
if (LC_NUMERIC_values[item_no] == NULL)
{
int errcode;
errcode = LC_NUMERIC_desc[item_no].status = std ? 5 : 0;
error (errcode, 0, gettext ("item `%s' of category `%s' undefined"),
LC_NUMERIC_desc[item_no].name, "LC_NUMERIC");
}
else
{
if (LC_NUMERIC_desc[item_no].item_id == DECIMAL_POINT
&& LC_NUMERIC_values[item_no][0] == '\0')
/* The decimal point must not be empty. This is not said
explicitly in POSIX but ANSI C (ISO/IEC 9899) says in
4.4.2.1 it has to be != "". */
error (0, 0,
gettext ("item `%s' in category `%s' must not be empty"),
LC_NUMERIC_desc[item_no].name, "LC_NUMERIC");
}
}
/*
* Local Variables:
* mode:c
* c-basic-offset:2
* End:
*/
+40
View File
@@ -0,0 +1,40 @@
%{
/* 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>.
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 <string.h>
#include "locfile-token.h"
%}
struct keyword_t ;
%%
code_set_name, tok_code_set_name, 1
mb_cur_max, tok_mb_cur_max, 1
mb_cur_min, tok_mb_cur_min, 1
escape_char, tok_escape_char, 1
comment_char, tok_comment_char, 1
g0esc, tok_g0esc, 1
g1esc, tok_g1esc, 1
g2esc, tok_g2esc, 1
g3esc, tok_g3esc, 1
CHARMAP, tok_charmap, 0
END, tok_end, 0
WIDTH, tok_width, 0
WIDTH_VARIABLE, tok_width_variable, 0
WIDTH_DEFAULT, tok_width_default, 0
+117
View File
@@ -0,0 +1,117 @@
/* C code produced by gperf version 2.5 (GNU C++ version) */
/* Command-line: gperf -acCgopt -k1,2,5,$ -N charmap_hash programs/charmap-kw.gperf */
/* 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>.
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 <string.h>
#include "locfile-token.h"
struct keyword_t ;
#define TOTAL_KEYWORDS 14
#define MIN_WORD_LENGTH 3
#define MAX_WORD_LENGTH 14
#define MIN_HASH_VALUE 3
#define MAX_HASH_VALUE 25
/* maximum key range = 23, duplicates = 0 */
#ifdef __GNUC__
inline
#endif
static unsigned int
hash (register const char *str, register int len)
{
static const unsigned char asso_values[] =
{
26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 26, 26, 26, 26, 14, 10,
15, 4, 26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 26, 26, 26, 0, 0, 0,
26, 26, 0, 0, 26, 26, 26, 0, 0, 26,
0, 26, 26, 26, 5, 26, 26, 0, 26, 26,
26, 26, 26, 26, 26, 0, 26, 26, 0, 0,
26, 0, 26, 0, 26, 26, 26, 26, 26, 0,
15, 0, 0, 26, 0, 0, 26, 0, 26, 26,
0, 26, 26, 26, 26, 26, 26, 26,
};
register int hval = len;
switch (hval)
{
default:
case 5:
hval += asso_values[(int) str[4]];
case 4:
case 3:
case 2:
hval += asso_values[(int) str[1]];
case 1:
hval += asso_values[(int) str[0]];
break;
}
return hval + asso_values[(int) str[len - 1]];
}
#ifdef __GNUC__
inline
#endif
const struct keyword_t *
charmap_hash (register const char *str, register int len)
{
static const struct keyword_t wordlist[] =
{
{"",}, {"",}, {"",},
{"END", tok_end, 0},
{"",},
{"WIDTH", tok_width, 0},
{"",},
{"CHARMAP", tok_charmap, 0},
{"",},
{"g3esc", tok_g3esc, 1},
{"mb_cur_max", tok_mb_cur_max, 1},
{"escape_char", tok_escape_char, 1},
{"comment_char", tok_comment_char, 1},
{"code_set_name", tok_code_set_name, 1},
{"WIDTH_VARIABLE", tok_width_variable, 0},
{"g1esc", tok_g1esc, 1},
{"",}, {"",},
{"WIDTH_DEFAULT", tok_width_default, 0},
{"g0esc", tok_g0esc, 1},
{"g2esc", tok_g2esc, 1},
{"",}, {"",}, {"",}, {"",},
{"mb_cur_min", tok_mb_cur_min, 1},
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{
register int key = hash (str, len);
if (key <= MAX_HASH_VALUE && key >= 0)
{
register const char *s = wordlist[key].name;
if (*s == *str && !strncmp (str + 1, s + 1, len - 1))
return &wordlist[key];
}
}
return 0;
}
+593
View File
@@ -0,0 +1,593 @@
/* 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>.
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. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <ctype.h>
#include <errno.h>
#include <libintl.h>
#include <obstack.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "error.h"
#include "linereader.h"
#include "charset.h"
/* Uncomment following line for production version. */
/* define NDEBUG 1 */
#include <assert.h>
/* Define the lookup function. */
#include "charmap-kw.h"
void *xmalloc (size_t __n);
/* Prototypes for local functions. */
static struct charset_t *parse_charmap (const char *filename);
struct charset_t *
charmap_read (const char *filename)
{
const char *pathnfile;
struct charset_t *result = NULL;
if (filename != NULL)
{
if (euidaccess (filename, R_OK) >= 0)
pathnfile = filename;
else
{
char *cp = xmalloc (strlen (filename) + sizeof CHARMAP_PATH + 1);
stpcpy (stpcpy (stpcpy (cp, CHARMAP_PATH), "/"), filename);
pathnfile = (const char *) cp;
}
result = parse_charmap (pathnfile);
if (result == NULL)
error (0, errno, _("character map file `%s' not found"), filename);
}
if (result == NULL)
{
pathnfile = CHARMAP_PATH "/" DEFAULT_CHARMAP;
result = parse_charmap (pathnfile);
if (result == NULL)
error (4, errno, _("default character map file `%s' not found"),
DEFAULT_CHARMAP);
}
return result;
}
static struct charset_t *
parse_charmap (const char *filename)
{
struct linereader *cmfile;
struct charset_t *result;
int state;
enum token_t expected_tok = tok_error;
const char *expected_str = NULL;
char *from_name = NULL;
char *to_name = NULL;
/* Determine path. */
cmfile = lr_open (filename, charmap_hash);
if (cmfile == NULL)
{
if (strchr (filename, '/') == NULL)
{
/* Look in the systems charmap directory. */
char *buf = xmalloc (strlen (filename) + 1 + sizeof (CHARMAP_PATH));
stpcpy (stpcpy (stpcpy (buf, CHARMAP_PATH), "/"), filename);
cmfile = lr_open (buf, charmap_hash);
if (cmfile == NULL)
free (buf);
}
if (cmfile == NULL)
return NULL;
}
/* Allocate room for result. */
result = (struct charset_t *) xmalloc (sizeof (struct charset_t));
memset (result, '\0', sizeof (struct charset_t));
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
obstack_init (&result->mem_pool);
if (init_hash (&result->char_table, 256))
{
free (result);
return NULL;
}
/* We use a state machine to describe the charmap description file
format. */
state = 1;
while (1)
{
/* What's on? */
struct token *now = lr_token (cmfile, NULL);
enum token_t nowtok = now->tok;
struct token *arg;
if (nowtok == tok_eof)
break;
switch (state)
{
case 1:
/* The beginning. We expect the special declarations, EOL or
`CHARMAP'. */
if (nowtok == tok_eol)
/* Ignore empty lines. */
continue;
if (nowtok == tok_charmap)
{
from_name = NULL;
to_name = NULL;
/* We have to set up the real work. Fill in some
default values. */
if (result->mb_cur_max == 0)
result->mb_cur_max = 1;
if (result->mb_cur_min == 0)
result->mb_cur_min = result->mb_cur_max;
if (result->mb_cur_min > result->mb_cur_max)
{
error (0, 0, _("\
%s: <mb_cur_max> must be greater than <mb_cur_min>\n"),
cmfile->fname);
result->mb_cur_min = result->mb_cur_max;
}
lr_ignore_rest (cmfile, 1);
state = 2;
continue;
}
if (nowtok != tok_code_set_name && nowtok != tok_mb_cur_max
&& nowtok != tok_mb_cur_min && nowtok != tok_escape_char
&& nowtok != tok_comment_char && nowtok != tok_g0esc
&& nowtok != tok_g1esc && nowtok != tok_g2esc
&& nowtok != tok_g3esc)
{
lr_error (cmfile, _("syntax error in prolog: %s"),
_("illegal definition"));
lr_ignore_rest (cmfile, 0);
continue;
}
/* We know that we need an argument. */
arg = lr_token (cmfile, NULL);
switch (nowtok)
{
case tok_code_set_name:
if (arg->tok != tok_ident)
{
badarg:
lr_error (cmfile, _("syntax error in prolog: %s"),
_("bad argument"));
lr_ignore_rest (cmfile, 0);
continue;
}
result->code_set_name = obstack_copy0 (&result->mem_pool,
arg->val.str.start,
arg->val.str.len);
lr_ignore_rest (cmfile, 1);
continue;
case tok_mb_cur_max:
case tok_mb_cur_min:
if (arg->tok != tok_number)
goto badarg;
if (arg->val.num < 1 || arg->val.num > 4)
{
lr_error (cmfile,
_("value for <%s> must lie between 1 and 4"),
nowtok == tok_mb_cur_min ? "mb_cur_min"
: "mb_cur_max");
lr_ignore_rest (cmfile, 0);
continue;
}
if ((nowtok == tok_mb_cur_max && result->mb_cur_min != 0
&& arg->val.num < result->mb_cur_min)
|| (nowtok == tok_mb_cur_min && result->mb_cur_max != 0
&& arg->val.num > result->mb_cur_max))
{
lr_error (cmfile, _("\
value of <mb_cur_max> must be greater than the value of <mb_cur_min>"));
lr_ignore_rest (cmfile, 0);
continue;
}
if (nowtok == tok_mb_cur_max)
result->mb_cur_max = arg->val.num;
else
result->mb_cur_min = arg->val.num;
lr_ignore_rest (cmfile, 1);
continue;
case tok_escape_char:
case tok_comment_char:
if (arg->tok != tok_ident)
goto badarg;
if (arg->val.str.len != 1)
{
lr_error (cmfile, _("\
argument to <%s> must be a single character"),
nowtok == tok_escape_char ? "escape_char"
: "comment_char");
lr_ignore_rest (cmfile, 0);
continue;
}
if (nowtok == tok_escape_char)
cmfile->escape_char = *arg->val.str.start;
else
cmfile->comment_char = *arg->val.str.start;
lr_ignore_rest (cmfile, 1);
continue;
case tok_g0esc:
case tok_g1esc:
case tok_g2esc:
case tok_g3esc:
lr_ignore_rest (cmfile, 0); /* XXX */
continue;
default:
/* Cannot happen. */
assert (! "Should not happen");
}
break;
case 2:
/* We have seen `CHARMAP' and now are in the body. Each line
must have the format "%s %s %s\n" or "%s...%s %s %s\n". */
if (nowtok == tok_eol)
/* Ignore empty lines. */
continue;
if (nowtok == tok_end)
{
expected_tok = tok_charmap;
expected_str = "CHARMAP";
state = 90;
continue;
}
if (nowtok != tok_bsymbol)
{
lr_error (cmfile, _("syntax error in %s definition: %s"),
"CHARMAP", _("no symbolic name given"));
lr_ignore_rest (cmfile, 0);
continue;
}
/* If the previous line was not completely correct free the
used memory. */
if (from_name != NULL)
obstack_free (&result->mem_pool, from_name);
from_name = (char *) obstack_copy0 (&result->mem_pool,
now->val.str.start,
now->val.str.len);
to_name = NULL;
state = 3;
continue;
case 3:
/* We have two possibilities: We can see an ellipsis or an
encoding value. */
if (nowtok == tok_ellipsis)
{
state = 4;
continue;
}
/* FALLTHROUGH */
case 5:
if (nowtok != tok_charcode && nowtok != tok_ucs2
&& nowtok != tok_ucs4)
{
lr_error (cmfile, _("syntax error in %s definition: %s"),
"CHARMAP", _("illegal encoding given"));
lr_ignore_rest (cmfile, 0);
state = 2;
continue;
}
if (nowtok == tok_charcode)
/* Write char value in table. */
charset_new_char (cmfile, result, now->val.charcode.nbytes,
now->val.charcode.val, from_name, to_name);
else
/* Determine ISO 10646 value and write into table. */
charset_new_unicode (cmfile, result, now->val.charcode.nbytes,
now->val.charcode.val, from_name, to_name);
/* Ignore trailing comment silently. */
lr_ignore_rest (cmfile, 0);
from_name = NULL;
to_name = NULL;
state = 2;
continue;
case 4:
if (nowtok != tok_bsymbol)
{
lr_error (cmfile, _("syntax error in %s definition: %s"),
"CHARMAP",
_("no symbolic name given for end of range"));
lr_ignore_rest (cmfile, 0);
continue;
}
/* If the previous line was not completely correct free the
used memory. */
to_name = (char *) obstack_copy0 (&result->mem_pool,
cmfile->token.val.str.start,
cmfile->token.val.str.len);
state = 3;
continue;
case 90:
if (nowtok != expected_tok)
lr_error (cmfile, _("\
`%1$s' definition does not end with `END %1$s'"), expected_str);
lr_ignore_rest (cmfile, nowtok == expected_tok);
state = 91;
continue;
case 91:
/* Waiting for WIDTH... */
if (nowtok == tok_width_default)
{
state = 92;
continue;
}
if (nowtok == tok_width)
{
lr_ignore_rest (cmfile, 1);
state = 93;
continue;
}
if (nowtok == tok_width_variable)
{
lr_ignore_rest (cmfile, 1);
state = 98;
continue;
}
lr_error (cmfile, _("\
only WIDTH definitions are allowed to follow the CHARMAP definition"));
lr_ignore_rest (cmfile, 0);
continue;
case 92:
if (nowtok != tok_number)
lr_error (cmfile, _("value for %s must be an integer"),
"WIDTH_DEFAULT");
else
result->width_default = now->val.num;
lr_ignore_rest (cmfile, nowtok == tok_number);
state = 91;
continue;
case 93:
/* We now expect `END WIDTH' or lines of the format "%s %d\n" or
"%s...%s %d\n". */
if (nowtok == tok_eol)
/* ignore empty lines. */
continue;
if (nowtok == tok_end)
{
expected_tok = tok_width;
expected_str = "WIDTH";
state = 90;
continue;
}
if (nowtok != tok_bsymbol)
{
lr_error (cmfile, _("syntax error in %s definition: %s"),
"WIDTH", _("no symbolic name given"));
lr_ignore_rest (cmfile, 0);
continue;
}
if (from_name != NULL)
obstack_free (&result->mem_pool, from_name);
from_name = (char *) obstack_copy0 (&result->mem_pool,
now->val.str.start,
now->val.str.len);
to_name = NULL;
state = 94;
continue;
case 94:
if (nowtok == tok_ellipsis)
state = 95;
case 96:
if (nowtok != tok_number)
lr_error (cmfile, _("value for %s must be an integer"),
"WIDTH");
else
{
/* XXX Store width for chars. */
from_name = NULL;
}
lr_ignore_rest (cmfile, nowtok == tok_number);
state = 93;
continue;
case 95:
if (nowtok != tok_bsymbol)
{
lr_error (cmfile, _("syntax error in %s definition: %s"),
"WIDTH", _("no symbolic name given for end of range"));
lr_ignore_rest (cmfile, 0);
state = 93;
continue;
}
to_name = (char *) obstack_copy0 (&result->mem_pool,
now->val.str.start,
now->val.str.len);
lr_ignore_rest (cmfile, 1);
state = 96;
continue;
case 98:
/* We now expect `END WIDTH_VARIABLE' or lines of the format
"%s\n" or "%s...%s\n". */
if (nowtok == tok_eol)
/* ignore empty lines. */
continue;
if (nowtok == tok_end)
{
expected_tok = tok_width_variable;
expected_str = "WIDTH_VARIABLE";
state = 90;
continue;
}
if (nowtok != tok_bsymbol)
{
lr_error (cmfile, _("syntax error in %s definition: %s"),
"WIDTH_VARIABLE", _("no symbolic name given"));
lr_ignore_rest (cmfile, 0);
continue;
}
if (from_name != NULL)
obstack_free (&result->mem_pool, from_name);
from_name = (char *) obstack_copy0 (&result->mem_pool,
now->val.str.start,
now->val.str.len);
to_name = NULL;
state = 99;
continue;
case 99:
if (nowtok == tok_ellipsis)
state = 100;
/* Store info. */
from_name = NULL;
/* Warn */
state = 98;
continue;
case 100:
if (nowtok != tok_bsymbol)
lr_error (cmfile, _("syntax error in %s definition: %s"),
"WIDTH_VARIABLE",
_("no symbolic name given for end of range"));
else
{
to_name = (char *) obstack_copy0 (&result->mem_pool,
now->val.str.start,
now->val.str.len);
/* XXX Enter value into table. */
}
lr_ignore_rest (cmfile, nowtok == tok_bsymbol);
state = 98;
continue;
default:
error (5, 0, _("%s: error in state machine"), __FILE__);
/* NOTREACHED */
}
break;
}
if (state != 91)
error (0, 0, _("%s: premature end of file"), cmfile->fname);
lr_close (cmfile);
return result;
}
+132
View File
@@ -0,0 +1,132 @@
/* 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>.
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. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <alloca.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "error.h"
#include "charset.h"
static void
insert_char (struct linereader *lr, struct charset_t *cs, int bytes,
unsigned int value, const char *from, const char *to);
void
charset_new_char (struct linereader *lr, struct charset_t *cs, int bytes,
unsigned int value, const char *from, const char *to)
{
if (bytes < cs->mb_cur_min)
lr_error (lr, _("too few bytes in character encoding"));
else if (bytes > cs->mb_cur_max)
lr_error (lr, _("too many bytes in character encoding"));
else
insert_char (lr, cs, bytes, value, from, to);
}
void
charset_new_unicode (struct linereader *lr, struct charset_t *cs, int bytes,
unsigned int value, const char *from, const char *to)
{
/* For now: perhaps <Uxxxx> support will be removed again... */
insert_char (lr, cs, bytes, value, from, to);
}
unsigned int
charset_find_value (const struct charset_t *cs, const char *name, size_t len)
{
void *result;
if (find_entry ((hash_table *) &cs->char_table, name, len, &result) < 0)
return ILLEGAL_CHAR_VALUE;
return (unsigned int) result;
}
static void
insert_char (struct linereader *lr, struct charset_t *cs, int bytes,
unsigned int value, const char *from, const char *to)
{
const char *cp;
char *buf;
int prefix_len, len1, len2;
unsigned int from_nr, to_nr, cnt;
if (to == NULL)
{
if (insert_entry (&cs->char_table, from, strlen (from), (void *) value)
< 0)
lr_error (lr, _("duplicate character name `%s'"), from);
return;
}
/* We have a range: the names must have names with equal prefixes
and an equal number of digits, where the second number is greater
or equal than the first. */
len1 = strlen (from);
len2 = strlen (to);
if (len1 != len2)
{
illegal_range:
lr_error (lr, _("illegal names for character range"));
return;
}
cp = &from[len1 - 1];
while (isdigit (*cp) && cp >= from)
--cp;
prefix_len = (cp - from) + 1;
if (cp == &from[len1 - 1] || strncmp (from, to, prefix_len) != 0)
goto illegal_range;
from_nr = strtoul (&from[prefix_len], NULL, 10);
to_nr = strtoul (&to[prefix_len], NULL, 10);
if (from_nr > to_nr)
{
lr_error (lr, _("upper limit in range is not smaller then lower limit"));
return;
}
buf = alloca (len1 + 1);
memcpy (buf, from, prefix_len);
for (cnt = from_nr; cnt <= to_nr; ++cnt)
{
sprintf (&buf[prefix_len], "%0d", cnt);
if (insert_entry (&cs->char_table, buf, len1, (void *) cnt) < 0)
lr_error (lr, _("duplicate character name `%s'"), buf);
}
}
+61
View File
@@ -0,0 +1,61 @@
/* 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>.
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 _CHARSET_H
#define _CHARSET_H
#include <obstack.h>
#include "simple-hash.h"
#include "linereader.h"
struct charset_t
{
const char *code_set_name;
int mb_cur_min;
int mb_cur_max;
int width_default;
struct obstack mem_pool;
hash_table char_table;
};
/* We need one value to mark the error case. Let's use 0xffffffff.
I.e., it is placed in the last page of ISO 10646. For now only the
first is used and we have plenty of room. */
#define ILLEGAL_CHAR_VALUE 0xffffffffu
/* Prototypes for charmap handling functions. */
struct charset_t *charmap_read (const char *filename);
/* Prototypes for funciton to insert new character. */
void charset_new_char (struct linereader *lr, struct charset_t *cs, int bytes,
unsigned int value, const char *from, const char *to);
void charset_new_unicode (struct linereader *lr, struct charset_t *cs,
int bytes, unsigned int value, const char *from,
const char *to);
unsigned int charset_find_value (const struct charset_t *__cs,
const char *__name, size_t __len);
#endif /* charset.h */
+32
View File
@@ -0,0 +1,32 @@
#ifndef _LD_CONFIG_H
#define _LD_CONFIG_H
/* Use the internal textdomain used for libc messages. */
#define PACKAGE _libc_intl_domainname
#ifndef VERSION
/* Get libc version number. */
#include "../../version.h"
#endif
#define DEFAULT_CHARMAP "POSIX"
#ifndef PARAMS
# if __STDC__
# define PARAMS(args) args
# else
# define PARAMS(args) ()
# endif
#endif
#define HAVE_VPRINTF 1
typedef int wint_t;
typedef unsigned short int u16_t;
#include_next <config.h>
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+237
View File
@@ -0,0 +1,237 @@
/* 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>.
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. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <alloca.h>
#include <langinfo.h>
#include <string.h>
#include <sys/uio.h>
#ifdef HAVE_REGEX
# include <regex.h>
#else
# include <rx.h>
#endif
/* Undefine following line in production version. */
/* #define NDEBUG 1 */
#include <assert.h>
#include "locales.h"
#include "stringtrans.h"
#include "localeinfo.h"
void *xmalloc (size_t __n);
/* The real definition of the struct for the LC_MESSAGES locale. */
struct locale_messages_t
{
const char *yesexpr;
const char *noexpr;
const char *yesstr;
const char *nostr;
};
void
messages_startup (struct linereader *lr, struct localedef_t *locale,
struct charset_t *charset)
{
struct locale_messages_t *messages;
/* It is important that we always use UCS1 encoding for strings now. */
encoding_method = ENC_UCS1;
locale->categories[LC_MESSAGES].messages = messages =
(struct locale_messages_t *) xmalloc (sizeof (struct locale_messages_t));
memset (messages, '\0', sizeof (struct locale_messages_t));
}
void
messages_finish (struct localedef_t *locale)
{
struct locale_messages_t *messages
= locale->categories[LC_MESSAGES].messages;
/* The fields YESSTR and NOSTR are optional. */
if (messages->yesexpr == NULL)
error (0, 0, _("field `%s' in category `%s' undefined"),
"yesexpr", "LC_MESSAGES");
else
{
int result;
regex_t re;
/* Test whether it are correct regular expressions. */
result = regcomp (&re, messages->yesexpr, REG_EXTENDED);
if (result != 0)
{
char errbuf[BUFSIZ];
(void) regerror (result, &re, errbuf, BUFSIZ);
error (0, 0, _("\
no correct regular expression for field `%s' in category `%s': %s"),
"yesexpr", "LC_MESSAGES", errbuf);
}
}
if (messages->noexpr == NULL)
error (0, 0, _("field `%s' in category `%s' undefined"),
"noexpr", "LC_MESSAGES");
else
{
int result;
regex_t re;
/* Test whether it are correct regular expressions. */
result = regcomp (&re, messages->noexpr, REG_EXTENDED);
if (result != 0)
{
char errbuf[BUFSIZ];
(void) regerror (result, &re, errbuf, BUFSIZ);
error (0, 0, _("\
no correct regular expression for field `%s' in category `%s': %s"),
"noexpr", "LC_MESSAGES", errbuf);
}
}
}
void
messages_output (struct localedef_t *locale, const char *output_path)
{
struct locale_messages_t *messages
= locale->categories[LC_MESSAGES].messages;
struct iovec iov[2 + _NL_ITEM_INDEX (_NL_NUM_LC_MESSAGES)];
struct locale_file data;
u32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_MESSAGES)];
size_t cnt = 0;
if ((locale->binary & (1 << LC_MESSAGES)) != 0)
{
iov[0].iov_base = messages;
iov[0].iov_len = locale->len[LC_MESSAGES];
write_locale_data (output_path, "LC_MESSAGES", 1, iov);
return;
}
data.magic = LIMAGIC (LC_MESSAGES);
data.n = _NL_ITEM_INDEX (_NL_NUM_LC_MESSAGES);
iov[cnt].iov_base = (void *) &data;
iov[cnt].iov_len = sizeof (data);
++cnt;
iov[cnt].iov_base = (void *) idx;
iov[cnt].iov_len = sizeof (idx);
++cnt;
idx[cnt - 2] = iov[0].iov_len + iov[1].iov_len;
iov[cnt].iov_base = (void *) (messages->yesexpr ?: "");
iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1;
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) (messages->noexpr ?: "");
iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1;
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) (messages->yesstr ?: "");
iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1;
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) (messages->nostr ?: "");
iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1;
assert (cnt + 1 == 2 + _NL_ITEM_INDEX (_NL_NUM_LC_MESSAGES));
write_locale_data (output_path, "LC_MESSAGES",
2 + _NL_ITEM_INDEX (_NL_NUM_LC_MESSAGES), iov);
}
void
messages_add (struct linereader *lr, struct localedef_t *locale,
enum token_t tok, struct token *code,
struct charset_t *charset)
{
struct locale_messages_t *messages
= locale->categories[LC_MESSAGES].messages;
switch (tok)
{
case tok_yesexpr:
if (code->val.str.start == NULL)
{
lr_error (lr, _("unknown character in field `%s' of category `%s'"),
"yesexpr", "LC_MESSAGES");
messages->yesexpr = "";
}
else
messages->yesexpr = code->val.str.start;
break;
case tok_noexpr:
if (code->val.str.start == NULL)
{
lr_error (lr, _("unknown character in field `%s' of category `%s'"),
"noexpr", "LC_MESSAGES");
messages->noexpr = "";
}
else
messages->noexpr = code->val.str.start;
break;
case tok_yesstr:
if (code->val.str.start == NULL)
{
lr_error (lr, _("unknown character in field `%s' of category `%s'"),
"yesstr", "LC_MESSAGES");
messages->yesstr = "";
}
else
messages->yesstr = code->val.str.start;
break;
case tok_nostr:
if (code->val.str.start == NULL)
{
lr_error (lr, _("unknown character in field `%s' of category `%s'"),
"nostr", "LC_MESSAGES");
messages->nostr = "";
}
else
messages->nostr = code->val.str.start;
break;
default:
assert (! "unknown token in category `LC_MESSAGES': should not happen");
}
}
+385
View File
@@ -0,0 +1,385 @@
/* 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>.
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. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <langinfo.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
/* Undefine following line in production version. */
/* #define NDEBUG 1 */
#include <assert.h>
#include "locales.h"
#include "localeinfo.h"
#include "stringtrans.h"
void *xmalloc (size_t __n);
void *xrealloc (void *__ptr, size_t __n);
/* The real definition of the struct for the LC_NUMERIC locale. */
struct locale_monetary_t
{
const char *int_curr_symbol;
const char *currency_symbol;
const char *mon_decimal_point;
const char *mon_thousands_sep;
char *mon_grouping;
size_t mon_grouping_max;
size_t mon_grouping_act;
const char *positive_sign;
const char *negative_sign;
signed char int_frac_digits;
signed char frac_digits;
signed char p_cs_precedes;
signed char p_sep_by_space;
signed char n_cs_precedes;
signed char n_sep_by_space;
signed char p_sign_posn;
signed char n_sign_posn;
};
/* The content iof the field int_curr_symbol has to be taken from
ISO-4217. We test for correct values. */
#define DEFINE_INT_CURR(str) str,
static const char *const valid_int_curr[] =
{
# include "../iso-4217.def"
};
#define NR_VALID_INT_CURR ((sizeof (valid_int_curr) \
/ sizeof (valid_int_curr[0])))
#undef DEFINE_INT_CURR
/* Prototypes for local functions. */
static int curr_strcmp(const char *s1, const char **s2);
void
monetary_startup (struct linereader *lr, struct localedef_t *locale,
struct charset_t *charset)
{
struct locale_monetary_t *monetary;
/* It is important that we always use UCS1 encoding for strings now. */
encoding_method = ENC_UCS1;
locale->categories[LC_MONETARY].monetary = monetary =
(struct locale_monetary_t *) xmalloc (sizeof (struct locale_monetary_t));
memset (monetary, '\0', sizeof (struct locale_monetary_t));
monetary->mon_grouping_max = 80;
monetary->mon_grouping =
(char *) xmalloc (monetary->mon_grouping_max);
monetary->mon_grouping_act = 0;
monetary->int_frac_digits = -2;
monetary->frac_digits = -2;
monetary->p_cs_precedes = -2;
monetary->p_sep_by_space = -2;
monetary->n_cs_precedes = -2;
monetary->n_sep_by_space = -2;
monetary->p_sign_posn = -2;
monetary->n_sign_posn = -2;
}
void
monetary_finish (struct localedef_t *locale)
{
struct locale_monetary_t *monetary
= locale->categories[LC_MONETARY].monetary;
#define TEST_ELEM(cat) \
if (monetary->cat == NULL) \
error (0, 0, _("field `%s' in category `%s' not defined"), \
#cat, "LC_MONETARY")
TEST_ELEM (int_curr_symbol);
TEST_ELEM (currency_symbol);
TEST_ELEM (mon_decimal_point);
TEST_ELEM (mon_thousands_sep);
TEST_ELEM (positive_sign);
TEST_ELEM (negative_sign);
/* The international currency symbol must come from ISO 4217. */
if (monetary->int_curr_symbol != NULL)
{
if (strlen (monetary->int_curr_symbol) != 4)
error (0, 0, _("\
value of field `int_curr_symbol' in category `LC_MONETARY' has wrong length"));
else if (bsearch (monetary->int_curr_symbol, valid_int_curr,
NR_VALID_INT_CURR, sizeof (const char *),
(comparison_fn_t) curr_strcmp) == NULL)
error (0, 0, _("\
value of field `int_curr_symbol' in category `LC_MONETARY' does \
not correspond to a valid name in ISO 4217"));
}
/* The decimal point must not be empty. This is not said explicitly
in POSIX but ANSI C (ISO/IEC 9899) says in 4.4.2.1 it has to be
!= "". */
if (monetary->mon_decimal_point[0] == '\0')
{
error (0, 0, _("\
value for field `%s' in category `%s' must not be the empty string"),
"mon_decimal_point", "LC_MONETARY");
}
if (monetary->mon_grouping_act == 0)
error (0, 0, _("field `%s' in category `%s' not defined"),
"mon_grouping", "LC_MONETARY");
#undef TEST_ELEM
#define TEST_ELEM(cat, min, max) \
if (monetary->cat == -2) \
error (0, 0, _("field `%s' in category `%s' not defined"), \
#cat, "LC_MONETARY"); \
else if (monetary->cat < min || monetary->cat > max) \
error (0, 0, _("\
value for field `%s' in category `%s' must be in range %d...%d"), \
#cat, "LC_MONETARY", min, max)
TEST_ELEM (int_frac_digits, -128, 127); /* No range check. */
TEST_ELEM (frac_digits, -128, 127); /* No range check. */
TEST_ELEM (p_cs_precedes, -1, 1);
TEST_ELEM (p_sep_by_space, -1, 2);
TEST_ELEM (n_cs_precedes, -1, 1);
TEST_ELEM (n_sep_by_space, -1, 2);
TEST_ELEM (p_sign_posn, -1, 4);
TEST_ELEM (n_sign_posn, -1, 4);
}
void
monetary_output (struct localedef_t *locale, const char *output_path)
{
struct locale_monetary_t *monetary
= locale->categories[LC_MONETARY].monetary;
struct iovec iov[2 + _NL_ITEM_INDEX (_NL_NUM_LC_MONETARY)];
struct locale_file data;
u32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_MONETARY)];
size_t cnt = 0;
if ((locale->binary & (1 << LC_MONETARY)) != 0)
{
iov[0].iov_base = monetary;
iov[0].iov_len = locale->len[LC_MONETARY];
write_locale_data (output_path, "LC_MONETARY", 1, iov);
return;
}
data.magic = LIMAGIC (LC_MONETARY);
data.n = _NL_ITEM_INDEX (_NL_NUM_LC_MONETARY);
iov[cnt].iov_base = (void *) &data;
iov[cnt].iov_len = sizeof (data);
++cnt;
iov[cnt].iov_base = (void *) idx;
iov[cnt].iov_len = sizeof (idx);
++cnt;
idx[cnt - 2] = iov[0].iov_len + iov[1].iov_len;
iov[cnt].iov_base = (void *) (monetary->int_curr_symbol ?: "");
iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1;
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) (monetary->currency_symbol ?: "");
iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1;
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) (monetary->mon_decimal_point ?: "");
iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1;
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) (monetary->mon_thousands_sep ?: "");
iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1;
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = alloca (monetary->mon_grouping_act + 1);
iov[cnt].iov_len = monetary->mon_grouping_act + 1;
memcpy (iov[cnt].iov_base, monetary->mon_grouping,
monetary->mon_grouping_act);
((char *) iov[cnt].iov_base)[monetary->mon_grouping_act] = '\0';
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) (monetary->positive_sign ?: "");
iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1;
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) (monetary->negative_sign ?: "");
iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1;
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) &monetary->int_frac_digits;
iov[cnt].iov_len = 1;
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) &monetary->frac_digits;
iov[cnt].iov_len = 1;
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) &monetary->p_cs_precedes;
iov[cnt].iov_len = 1;
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) &monetary->p_sep_by_space;
iov[cnt].iov_len = 1;
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) &monetary->n_cs_precedes;
iov[cnt].iov_len = 1;
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) &monetary->n_sep_by_space;
iov[cnt].iov_len = 1;
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) &monetary->p_sign_posn;
iov[cnt].iov_len = 1;
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) &monetary->n_sign_posn;
iov[cnt].iov_len = 1;
assert (cnt + 1 == 2 + _NL_ITEM_INDEX (_NL_NUM_LC_MONETARY));
write_locale_data (output_path, "LC_MONETARY",
2 + _NL_ITEM_INDEX (_NL_NUM_LC_MONETARY), iov);
}
void
monetary_add (struct linereader *lr, struct localedef_t *locale,
enum token_t tok, struct token *code,
struct charset_t *charset)
{
struct locale_monetary_t *monetary
= locale->categories[LC_MONETARY].monetary;
switch (tok)
{
#define STR_ELEM(cat) \
case tok_##cat: \
if (monetary->cat != NULL) \
lr_error (lr, _("\
field `%s' in category `%s' declared more than once"), \
#cat, "LC_MONETARY"); \
else if (code->val.str.start == NULL) \
{ \
lr_error (lr, _("unknown character in field `%s' of category `%s'"),\
#cat, "LC_MONETARY"); \
monetary->cat = ""; \
} \
else \
monetary->cat = code->val.str.start; \
break
STR_ELEM (int_curr_symbol);
STR_ELEM (currency_symbol);
STR_ELEM (mon_decimal_point);
STR_ELEM (mon_thousands_sep);
STR_ELEM (positive_sign);
STR_ELEM (negative_sign);
#define INT_ELEM(cat) \
case tok_##cat: \
if (monetary->cat != -2) \
lr_error (lr, _("\
field `%s' in category `%s' declared more than once"), \
#cat, "LC_MONETARY"); \
else \
monetary->cat = code->val.num; \
break
INT_ELEM (int_frac_digits);
INT_ELEM (frac_digits);
INT_ELEM (p_cs_precedes);
INT_ELEM (p_sep_by_space);
INT_ELEM (n_cs_precedes);
INT_ELEM (n_sep_by_space);
INT_ELEM (p_sign_posn);
INT_ELEM (n_sign_posn);
case tok_mon_grouping:
if (monetary->mon_grouping_act == monetary->mon_grouping_max)
{
monetary->mon_grouping_max *= 2;
monetary->mon_grouping =
(char *) xrealloc (monetary->mon_grouping,
monetary->mon_grouping_max);
}
if (monetary->mon_grouping[monetary->mon_grouping_act - 1]
== '\177')
lr_error (lr, _("\
`-1' must be last entry in `%s' field in `%s' category"),
"mon_grouping", "LC_MONETARY");
else
{
if (code->tok == tok_minus1)
monetary->mon_grouping[monetary->mon_grouping_act++] = '\177';
else if (code->val.num == 0)
lr_error (lr, _("\
values for field `%s' in category `%s' must not be zero"),
"mon_grouping", "LC_MONETARY");
else if (code->val.num > 126)
lr_error (lr, _("\
values for field `%s' in category `%s' must be smaller than 127"),
"mon_grouping", "LC_MONETARY");
else
monetary->mon_grouping[monetary->mon_grouping_act++]
= code->val.num;
}
break;
default:
assert (! "unknown token in category `LC_MONETARY': should not happen");
}
}
static int
curr_strcmp(const char *s1, const char **s2)
{
return strcmp (s1, *s2);
}
+208
View File
@@ -0,0 +1,208 @@
/* 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>.
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. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <langinfo.h>
#include <string.h>
/* Undefine following line in production version. */
/* #define NDEBUG 1 */
#include <assert.h>
#include "locales.h"
#include "localeinfo.h"
#include "stringtrans.h"
void *xmalloc (size_t __n);
void *xrealloc (void *__ptr, size_t __n);
/* The real definition of the struct for the LC_NUMERIC locale. */
struct locale_numeric_t
{
const char *decimal_point;
const char *thousands_sep;
char *grouping;
size_t grouping_max;
size_t grouping_act;
};
void
numeric_startup (struct linereader *lr, struct localedef_t *locale,
struct charset_t *charset)
{
struct locale_numeric_t *numeric;
/* It is important that we always use UCS1 encoding for strings now. */
encoding_method = ENC_UCS1;
locale->categories[LC_NUMERIC].numeric = numeric =
(struct locale_numeric_t *) xmalloc (sizeof (struct locale_numeric_t));
memset (numeric, '\0', sizeof (struct locale_numeric_t));
numeric->grouping_max = 80;
numeric->grouping = (char *) xmalloc (numeric->grouping_max);
numeric->grouping_act = 0;
}
void
numeric_finish (struct localedef_t *locale)
{
struct locale_numeric_t *numeric = locale->categories[LC_NUMERIC].numeric;
#define TEST_ELEM(cat) \
if (numeric->cat == NULL) \
error (0, 0, _("field `%s' in category `%s' not defined"), \
#cat, "LC_NUMERIC")
TEST_ELEM (decimal_point);
TEST_ELEM (thousands_sep);
/* The decimal point must not be empty. This is not said explicitly
in POSIX but ANSI C (ISO/IEC 9899) says in 4.4.2.1 it has to be
!= "". */
if (numeric->decimal_point[0] == '\0')
{
error (0, 0, _("\
value for field `%s' in category `%s' must not be the empty string"),
"decimal_point", "LC_NUMERIC");
}
if (numeric->grouping_act == 0)
error (0, 0, _("field `%s' in category `%s' not defined"),
"grouping", "LC_NUMERIC");
}
void
numeric_output (struct localedef_t *locale, const char *output_path)
{
struct locale_numeric_t *numeric = locale->categories[LC_NUMERIC].numeric;
struct iovec iov[2 + _NL_ITEM_INDEX (_NL_NUM_LC_NUMERIC)];
struct locale_file data;
u32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_NUMERIC)];
size_t cnt = 0;
if ((locale->binary & (1 << LC_NUMERIC)) != 0)
{
iov[0].iov_base = numeric;
iov[0].iov_len = locale->len[LC_NUMERIC];
write_locale_data (output_path, "LC_NUMERIC", 1, iov);
return;
}
data.magic = LIMAGIC (LC_NUMERIC);
data.n = _NL_ITEM_INDEX (_NL_NUM_LC_NUMERIC);
iov[cnt].iov_base = (void *) &data;
iov[cnt].iov_len = sizeof (data);
++cnt;
iov[cnt].iov_base = (void *) idx;
iov[cnt].iov_len = sizeof (idx);
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) (numeric->decimal_point ?: "");
iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1;
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) (numeric->thousands_sep ?: "");
iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1;
++cnt;
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = alloca (numeric->grouping_act + 1);
iov[cnt].iov_len = numeric->grouping_act + 1;
memcpy (iov[cnt].iov_base, numeric->grouping, numeric->grouping_act);
((char *) iov[cnt].iov_base)[numeric->grouping_act] = '\0';
assert (cnt + 1 == 2 + _NL_ITEM_INDEX (_NL_NUM_LC_NUMERIC));
write_locale_data (output_path, "LC_NUMERIC",
2 + _NL_ITEM_INDEX (_NL_NUM_LC_NUMERIC), iov);
}
void
numeric_add (struct linereader *lr, struct localedef_t *locale,
enum token_t tok, struct token *code,
struct charset_t *charset)
{
struct locale_numeric_t *numeric = locale->categories[LC_NUMERIC].numeric;
switch (tok)
{
#define STR_ELEM(cat) \
case tok_##cat: \
if (numeric->cat != NULL) \
lr_error (lr, _("\
field `%s' in category `%s' declared more than once"), \
#cat, "LC_NUMERIC"); \
else if (code->val.str.start == NULL) \
{ \
lr_error (lr, _("unknown character in field `%s' of category `%s'"),\
#cat, "LC_NUMERIC"); \
numeric->cat = ""; \
} \
else \
numeric->cat = code->val.str.start; \
break
STR_ELEM (decimal_point);
STR_ELEM (thousands_sep);
case tok_grouping:
if (numeric->grouping_act == numeric->grouping_max)
{
numeric->grouping_max *= 2;
numeric->grouping = (char *) xrealloc (numeric->grouping,
numeric->grouping_max);
}
if (numeric->grouping_act > 0
&& (numeric->grouping[numeric->grouping_act - 1] == '\177'))
{
lr_error (lr, _("\
`-1' must be last entry in `%s' field in `%s' category"),
"grouping", "LC_NUMERIC");
--numeric->grouping_act;
}
if (code->tok == tok_minus1)
numeric->grouping[numeric->grouping_act++] = '\177';
else if (code->val.num > 126)
lr_error (lr, _("\
values for field `%s' in category `%s' must be smaller than 127"),
"grouping", "LC_NUMERIC");
else
numeric->grouping[numeric->grouping_act++] = code->val.num;
break;
default:
assert (! "unknown token in category `LC_NUMERIC': should not happen");
}
}

Some files were not shown because too many files have changed in this diff Show More