mirror of
git://sourceware.org/git/glibc.git
synced 2026-09-09 05:59:27 +08:00
Compare commits
112
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30de3b18a5 | ||
|
|
b80510574c | ||
|
|
27e00f3f17 | ||
|
|
ac157523bd | ||
|
|
46a7c97679 | ||
|
|
0daf278545 | ||
|
|
b7407d6362 | ||
|
|
c475b8f594 | ||
|
|
7a1c652d58 | ||
|
|
a141dd342d | ||
|
|
8c1442d02f | ||
|
|
43efc10333 | ||
|
|
ffcf96345f | ||
|
|
0393dfd6c2 | ||
|
|
19bc17a905 | ||
|
|
53f770e0f9 | ||
|
|
3ef987a23c | ||
|
|
c0621444ed | ||
|
|
81e4d60c7b | ||
|
|
5775972dec | ||
|
|
857fa1b81d | ||
|
|
25c931a18c | ||
|
|
edc1601c51 | ||
|
|
036a272548 | ||
|
|
ce563359af | ||
|
|
38bb44bc19 | ||
|
|
d7193325fc | ||
|
|
948c3e72ec | ||
|
|
213afb94b6 | ||
|
|
4d58533340 | ||
|
|
d3669add24 | ||
|
|
c8cf0b14ed | ||
|
|
c224a18a90 | ||
|
|
b20e47cb14 | ||
|
|
e384537164 | ||
|
|
9b431e31e1 | ||
|
|
5aab07eb56 | ||
|
|
6025c399e9 | ||
|
|
d3b7d2ac93 | ||
|
|
e5ba41ce24 | ||
|
|
8d71c7b0e4 | ||
|
|
52e9a9d118 | ||
|
|
6c46dada59 | ||
|
|
1177c8babf | ||
|
|
dd0e4e0c8b | ||
|
|
d25d5f6a50 | ||
|
|
3f92886a4c | ||
|
|
45667a533a | ||
|
|
5ac0712ca5 | ||
|
|
b49d86bd21 | ||
|
|
f7eac6eb50 | ||
|
|
1521668f2a | ||
|
|
5d8a006d2c | ||
|
|
3cf11a4b33 | ||
|
|
d43e047895 | ||
|
|
9a0d30bdb1 | ||
|
|
e9ef1cf37a | ||
|
|
bba51ac77a | ||
|
|
e49639955f | ||
|
|
c3d3967cd2 | ||
|
|
661fa17673 | ||
|
|
36ff88f69e | ||
|
|
48a65a2993 | ||
|
|
6b628d3634 | ||
|
|
bc47d7a85b | ||
|
|
e9607dbeb9 | ||
|
|
4a9af5c708 | ||
|
|
01fec49ca6 | ||
|
|
d1c57d0c40 | ||
|
|
b7459e56bd | ||
|
|
92777700d2 | ||
|
|
a182affdd9 | ||
|
|
f2e235b9b8 | ||
|
|
0ddc0d1604 | ||
|
|
bfc04a9ff1 | ||
|
|
be10a86854 | ||
|
|
1cbca0d93c | ||
|
|
7c97bb094e | ||
|
|
9b19f55dc8 | ||
|
|
9e3db9cd59 | ||
|
|
a1c46301bb | ||
|
|
de1b40af73 | ||
|
|
e335fa388a | ||
|
|
c6de696871 | ||
|
|
ae4c4dae36 | ||
|
|
d2c2312316 | ||
|
|
13987e686c | ||
|
|
46d7de1907 | ||
|
|
4eea716e2d | ||
|
|
2a072de4a1 | ||
|
|
363113d02a | ||
|
|
3585d6bf30 | ||
|
|
01f3e03bcd | ||
|
|
38334018ff | ||
|
|
dbdb6189d5 | ||
|
|
afced61c8f | ||
|
|
d592cd699d | ||
|
|
a7cb7644cf | ||
|
|
889a9677fd | ||
|
|
25f9784eb8 | ||
|
|
1fe58993bc | ||
|
|
63f8940402 | ||
|
|
808c413c90 | ||
|
|
47665862cd | ||
|
|
bdf2af37da | ||
|
|
186588d6bf | ||
|
|
3038e60115 | ||
|
|
932be5efa3 | ||
|
|
6a032d8158 | ||
|
|
56f778c958 | ||
|
|
a482b5a595 | ||
|
|
4ca84cff3b |
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -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)
|
||||
@@ -170,8 +170,8 @@ mv -f $@.new $@
|
||||
test ! -d CVS || cvs commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
|
||||
endef
|
||||
|
||||
configure: configure.in; $(autoconf-it)
|
||||
%/configure: %/configure.in; $(autoconf-it)
|
||||
configure: configure.in aclocal.m4; $(autoconf-it)
|
||||
%/configure: %/configure.in aclocal.m4; $(autoconf-it)
|
||||
|
||||
.PHONY: dist
|
||||
dist: $(tardir).tar.gz $(tardir)-crypt.tar.gz
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Make the TAGS files.
|
||||
|
||||
# Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1992, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -98,7 +98,7 @@ ifdef subdir
|
||||
ifdef tags_sources
|
||||
$(ETAGS) -o $@ $^
|
||||
else
|
||||
# No sources. Create a dummy file.
|
||||
# No sources. Create a dummy file.
|
||||
touch $@
|
||||
endif # tags_sources
|
||||
else # parent
|
||||
@@ -114,3 +114,62 @@ $(subdirs:%=%/TAGS):
|
||||
$(MAKE) -C $(@D) no_deps=t $(@F)
|
||||
|
||||
endif # subdir
|
||||
|
||||
ifndef XGETTEXT
|
||||
XGETTEXT = xgettext
|
||||
endif
|
||||
|
||||
P = $(..)po
|
||||
|
||||
ifdef subdir
|
||||
domain = $(subdir)
|
||||
else
|
||||
domain = libc-top
|
||||
endif
|
||||
|
||||
define extract
|
||||
@rm -f $@.new
|
||||
$(XGETTEXT) --keyword=_ --keyword=N_ --sort-output -d - \
|
||||
$(XGETTEXTFLAGS-$(@F)) > $@.new $^
|
||||
mv -f $@.new $@
|
||||
endef
|
||||
|
||||
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: $(common-objpfx)siglist.c; $(extract)
|
||||
$P/errlist.pot: $(..)sysdeps/mach/hurd/errlist.c; $(extract)
|
||||
|
||||
# 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
|
||||
$(XGETTEXT) -d - -n -s --omit-header $^ > $@.new
|
||||
mv -f $@.new $@
|
||||
test ! -d CVS || cvs ci -m'Regenerated from source files' $@
|
||||
|
||||
$(subdirs:%=$P/%.pot): $P/%.pot: FORCE
|
||||
$(MAKE) -C $* no_deps=t ../$@
|
||||
FORCE:
|
||||
endif
|
||||
|
||||
+7
-11
@@ -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
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ ifndef +link
|
||||
+link = $(CC) -nostdlib -nostartfiles -o $@ \
|
||||
$(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) \
|
||||
$(addprefix $(csu-objpfx),start.o $(+preinit)) \
|
||||
$(^:$(common-objpfx)libc%=$(link-libc)) \
|
||||
$(filter-out $(common-objpfx)libc%,$^) $(link-libc) \
|
||||
$(addprefix $(csu-objpfx),$(+postinit))
|
||||
endif
|
||||
ifndef config-LDFLAGS
|
||||
@@ -291,7 +291,7 @@ endif
|
||||
endif
|
||||
ifndef link-libc
|
||||
ifeq (yes,$(build-shared))
|
||||
link-libc = -Wl,-rpath-link=$(common-objdir) -Wl,-rpath=$(default-rpath) \
|
||||
link-libc = -Wl,-rpath-link=$(common-objdir) \
|
||||
$(common-objpfx)libc.so$(libc.so-version) $(gnulib)
|
||||
# Choose the default search path for the dynamic linker based on
|
||||
# where we will install libraries.
|
||||
@@ -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))
|
||||
@@ -450,7 +445,8 @@ ifeq (yes,$(build-profile))
|
||||
# Under --enable-profile, we will build a static library of profiled objects.
|
||||
# The profiled object files are named foo.po.
|
||||
object-suffixes += .po
|
||||
CFLAGS-.po = -p
|
||||
CPPFLAGS-.po = -DPROF
|
||||
CFLAGS-.po = -pg
|
||||
libtype.po = lib%_p.a
|
||||
endif
|
||||
ifeq (yes,$(build-omitfp))
|
||||
|
||||
@@ -36,8 +36,8 @@ mv -f $@.new $@
|
||||
test ! -d CVS || cvs commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
|
||||
endef
|
||||
|
||||
configure: configure.in; $(autoconf-it)
|
||||
%/configure: %/configure.in; $(autoconf-it)
|
||||
configure: configure.in aclocal.m4; $(autoconf-it)
|
||||
%/configure: %/configure.in aclocal.m4; $(autoconf-it)
|
||||
|
||||
include Makeconfig
|
||||
|
||||
@@ -52,9 +52,9 @@ endif
|
||||
|
||||
# These are the subdirectories containing the library source.
|
||||
subdirs = csu assert ctype db locale intl math setjmp signal stdlib \
|
||||
stdio-common $(stdio) malloc string time dirent grp pwd \
|
||||
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
|
||||
|
||||
@@ -65,6 +65,15 @@ endif
|
||||
# Add -I switches to get the right sysdep directories.
|
||||
# `+includes' in Makeconfig references $(+sysdep-includes).
|
||||
+sysdep-includes := $(addprefix -I,$(+sysdep_dirs))
|
||||
|
||||
# The name of the symbol table archive member. The default is suitable for
|
||||
# BSD style archives. It can be overridden in sysdep Makefiles when SYSV
|
||||
# style archive are used.
|
||||
ifeq (no,$(elf))
|
||||
ar-symtab-name = __.SYMDEF
|
||||
else
|
||||
ar-symtab-name = # The null name is used in ELF archives.
|
||||
endif
|
||||
|
||||
# Include any system-specific makefiles.
|
||||
|
||||
@@ -267,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.
|
||||
@@ -349,7 +359,7 @@ ARFLAGS := r$(verbose)
|
||||
lib: lib-noranlib $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))
|
||||
|
||||
# Pattern rule for libraries: depend on the __.SYMDEF member updated by ranlib.
|
||||
lib%.a: lib%.a(__.SYMDEF) ;
|
||||
lib%.a: lib%.a($(ar-symtab-name)) ;
|
||||
|
||||
libobjs: $(foreach o,$(object-suffixes),\
|
||||
$(common-objpfx)$(patsubst %,$(libtype$o),c)(\
|
||||
@@ -392,21 +402,18 @@ endif
|
||||
|
||||
endif
|
||||
|
||||
# Rules to update the __.SYMDEF member with ranlib.
|
||||
# To consolidate, each flavor library's __.SYMDEF member
|
||||
# depends on the imaginary intermediate file `symdef.SUFFIX',
|
||||
# where SUFFIX is that flavor's object suffix; then a pattern rule
|
||||
# "remakes" symdef.% depending on all the libc.a(foo.%) files in $(objects).
|
||||
$(common-objpfx)$(patsubst %,$(libtype.o),c)(__.SYMDEF): symdef.o
|
||||
$(common-objpfx)$(patsubst %,$(libtype.so),c)(__.SYMDEF): symdef.so
|
||||
$(common-objpfx)$(patsubst %,$(libtype.po),c)(__.SYMDEF): symdef.po
|
||||
$(common-objpfx)$(patsubst %,$(libtype.go),c)(__.SYMDEF): symdef.go
|
||||
symdef.%: $(foreach o,$(object-suffixes),\
|
||||
$(common-objpfx)$(patsubst %,$(libtype$o),c)(\
|
||||
$(patsubst $(objpfx)%.o,%.%,$(objects)))) \
|
||||
$(filter subdir_lib,$(firstword $(subdir) subdir_lib))
|
||||
# The last line above makes it also depend on subdir_lib for the parent.
|
||||
$(RANLIB) $(common-objpfx)$(patsubst %,$(libtype.$*),c)
|
||||
# Rules to update the $(ar-symtab-name) member with ranlib,
|
||||
# one for each object flavor.
|
||||
define o-iterator-doit
|
||||
$(common-objpfx)$(patsubst %,$(libtype$o),c)($(ar-symtab-name)): \
|
||||
$(common-objpfx)$(patsubst %,$(libtype$o),c)(\
|
||||
$(patsubst $(objpfx)%.o,%$o,$(objects))) \
|
||||
$(filter subdir_lib,$(firstword $(subdir) subdir_lib)); \
|
||||
$$(RANLIB) $$(common-objpfx)$$(patsubst %,$$(libtype$o),c)
|
||||
endef
|
||||
object-suffixes-left = $(object-suffixes)
|
||||
include $(o-iterator)
|
||||
|
||||
|
||||
# This makes all the object files.
|
||||
.PHONY: objects objs
|
||||
@@ -443,13 +450,11 @@ $(make-target-directory)
|
||||
$(INSTALL_DATA) $< $@
|
||||
endef
|
||||
|
||||
# Make the target directory if it doesn't exist. Because of make's
|
||||
# directory cache, this will produce the `mkdir' command when the directory
|
||||
# already exists, if it didn't exist at the start of the `make' run. The
|
||||
# `-' prefix ignores errors from mkdir, so there will just be some
|
||||
# gratuitous but harmless `File exists' messages.
|
||||
# Make the target directory if it doesn't exist, using the `mkinstalldirs'
|
||||
# script that does `mkdir -p' even if `mkdir' doesn't support that flag.
|
||||
define make-target-directory
|
||||
$(addprefix -mkdir ,$(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
|
||||
$(addprefix $(..)mkinstalldirs ,\
|
||||
$(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
|
||||
endef
|
||||
|
||||
# Any directory (parent or subdir) that has any object files to build
|
||||
@@ -568,7 +573,7 @@ define build-shlib
|
||||
$(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS) \
|
||||
-Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
|
||||
$(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
|
||||
-Wl,-rpath-link=$(common-objdir) -Wl,-rpath=$(libdir) \
|
||||
-Wl,-rpath-link=$(common-objdir) \
|
||||
-Wl,--whole-archive $^ $(LDLIBS-$(@F:lib%.so=%).so)
|
||||
endef
|
||||
|
||||
@@ -605,7 +610,8 @@ 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
|
||||
# This is always used in $(common-objdir), so we use no directory name.
|
||||
BUILD_CFLAGS = -include config.h
|
||||
|
||||
# Support the GNU standard name for this target.
|
||||
.PHONY: check
|
||||
@@ -613,7 +619,12 @@ check: tests
|
||||
|
||||
.PHONY: TAGS
|
||||
TAGS: distinfo $(..)MakeTAGS
|
||||
$(MAKE) $(addprefix -f ,$^)
|
||||
$(MAKE) $(addprefix -f ,$^) $@
|
||||
|
||||
$(..)po/%.pot: distinfo $(..)MakeTAGS FORCE
|
||||
$(MAKE) $(addprefix -f ,$(filter-out FORCE,$^)) $@
|
||||
FORCE:
|
||||
|
||||
|
||||
.PHONY: echo-headers
|
||||
echo-headers:
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -38,6 +38,9 @@ export subdir := $(subdir)
|
||||
.PHONY: all
|
||||
all: objs lib others
|
||||
|
||||
others: $(addprefix $(objpfx),$(extra-objs) \
|
||||
$(install-lib) $(install-bin) $(install-sbin))
|
||||
|
||||
ifneq "$(findstring env,$(origin headers))" ""
|
||||
headers :=
|
||||
endif
|
||||
|
||||
Vendored
+26
-5
@@ -51,9 +51,10 @@ trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
|
||||
# Note: order is significant - the case branches are not exclusive.
|
||||
|
||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
alpha:OSF1:V*:*)
|
||||
alpha:OSF1:[VX]*:*)
|
||||
# After 1.2, OSF1 uses "V1.3" for uname -r.
|
||||
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'`
|
||||
# After 4.x, OSF1 uses "X4.x" for uname -r.
|
||||
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VX]//'`
|
||||
exit 0 ;;
|
||||
alpha:OSF1:*:*)
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
@@ -62,6 +63,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
21064:Windows_NT:50:3)
|
||||
echo alpha-dec-winnt3.5
|
||||
exit 0 ;;
|
||||
Amiga*:UNIX_System_V:4.0:*)
|
||||
echo m68k-cbm-sysv4
|
||||
exit 0;;
|
||||
amiga:NetBSD:*:*)
|
||||
echo m68k-cbm-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
@@ -320,6 +324,12 @@ EOF
|
||||
*:NetBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo i386-unknown-cygwin32
|
||||
exit 0 ;;
|
||||
p*:CYGWIN*:*)
|
||||
echo powerpcle-unknown-cygwin32
|
||||
exit 0 ;;
|
||||
*:GNU:*:*)
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
exit 0 ;;
|
||||
@@ -327,12 +337,16 @@ EOF
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
# first see if it will tell us.
|
||||
ld_help_string=`ld --help 2>&1`
|
||||
if echo $ld_help_string | grep >/dev/null 2>&1 "supported emulations: elf_i[345]86"; then
|
||||
if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i[345]86"; then
|
||||
echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
|
||||
elif echo $ld_help_string | grep >/dev/null 2>&1 "supported emulations: i[345]86linux"; then
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86linux"; then
|
||||
echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0
|
||||
elif echo $ld_help_string | grep >/dev/null 2>&1 "supported emulations: i[345]86coff"; then
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86coff"; then
|
||||
echo "${UNAME_MACHINE}-unknown-linuxcoff" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
|
||||
echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
|
||||
echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0
|
||||
elif test "${UNAME_MACHINE}" = "alpha" ; then
|
||||
echo alpha-unknown-linux ; exit 0
|
||||
else
|
||||
@@ -437,6 +451,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
|
||||
|
||||
+36
-13
@@ -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,22 +31,25 @@
|
||||
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
|
||||
/* */
|
||||
/* These symbols might be defined by some sysdeps configures. */
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
#ifndef _LIBC
|
||||
|
||||
/* These symbols might be defined by some sysdeps configures.
|
||||
They are used only in miscellaneous generator programs, not
|
||||
in compiling libc itself. */
|
||||
|
||||
/* sysdeps/generic/configure.in */
|
||||
#undef HAVE_PSIGNAL
|
||||
|
||||
/* sysdeps/unix/configure.in */
|
||||
#undef HAVE_STRERROR
|
||||
|
||||
/* sysdeps/unix/common/configure.in */
|
||||
#undef HAVE_SYS_SIGLIST
|
||||
#undef HAVE__SYS_SIGLIST
|
||||
@@ -49,3 +59,16 @@
|
||||
#undef HAVE__CTYPE__
|
||||
#undef HAVE__CTYPE
|
||||
#undef HAVE__LOCP
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
#ifdef _LIBC
|
||||
|
||||
/* The zic and zdump programs need these definitions. */
|
||||
|
||||
#define HAVE_STRERROR 1
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,7 +15,6 @@ config-sysdirs = @sysnames@
|
||||
config-defines = @DEFS@
|
||||
|
||||
elf = @elf@
|
||||
weak-symbols = @weak@
|
||||
have-initfini = @libc_cv_have_initfini@
|
||||
|
||||
# Configuration options.
|
||||
|
||||
Vendored
+16
-7
@@ -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
|
||||
;;
|
||||
@@ -127,6 +128,9 @@ case $os in
|
||||
-windowsnt*)
|
||||
os=`echo $os | sed -e 's/windowsnt/winnt/'`
|
||||
;;
|
||||
-psos*)
|
||||
os=-psos
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode aliases for certain CPU-COMPANY combinations.
|
||||
@@ -136,10 +140,10 @@ case $basic_machine in
|
||||
tahoe | i[3456]86 | i860 | m68k | m68000 | m88k | ns32k | arm \
|
||||
| arme[lb] | pyramid \
|
||||
| tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
|
||||
| alpha | we32k | ns16k | clipper | sparclite | i370 | sh \
|
||||
| powerpc | powerpcle | sparc64 | 1750a | dsp16xx | mips64 | mipsel \
|
||||
| alpha | we32k | ns16k | clipper | i370 | sh \
|
||||
| powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
|
||||
| pdp11 | mips64el | mips64orion | mips64orionel \
|
||||
| sparc)
|
||||
| sparc | sparclet | sparclite | sparc64)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
# Object if more than one company name word.
|
||||
@@ -230,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
|
||||
;;
|
||||
@@ -645,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* \
|
||||
@@ -654,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*)
|
||||
| -cygwin32* | -pe* | -psos* | -moss* )
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-sunos5*)
|
||||
@@ -880,6 +888,7 @@ case $basic_machine in
|
||||
;;
|
||||
-aux*)
|
||||
vendor=apple
|
||||
;;
|
||||
esac
|
||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||
;;
|
||||
|
||||
@@ -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-*)
|
||||
@@ -520,12 +518,9 @@ fi
|
||||
|
||||
ac_ext=c
|
||||
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
|
||||
ac_cpp='echo $CPP $CPPFLAGS 1>&5;
|
||||
$CPP $CPPFLAGS'
|
||||
ac_compile='echo ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5;
|
||||
${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5'
|
||||
ac_link='echo ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5;
|
||||
${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5'
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
|
||||
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
|
||||
|
||||
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
|
||||
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
|
||||
@@ -623,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
|
||||
@@ -724,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.
|
||||
@@ -1150,12 +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 1154 "configure"
|
||||
#line 1147 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <assert.h>
|
||||
Syntax Error
|
||||
EOF
|
||||
eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (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
|
||||
:
|
||||
@@ -1164,12 +1158,13 @@ else
|
||||
rm -rf conftest*
|
||||
CPP="${CC-cc} -E -traditional-cpp"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1168 "configure"
|
||||
#line 1162 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <assert.h>
|
||||
Syntax Error
|
||||
EOF
|
||||
eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (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
|
||||
:
|
||||
@@ -1218,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 1222 "configure"
|
||||
#line 1217 "configure"
|
||||
#include "confdefs.h"
|
||||
#define __need_size_t
|
||||
#define __need_wchar_t
|
||||
@@ -1234,7 +1229,7 @@ size_t size; wchar_t wchar;
|
||||
if (&size == NULL || &wchar == NULL) abort ();
|
||||
; return 0; }
|
||||
EOF
|
||||
if eval $ac_compile; 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
|
||||
@@ -1341,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 1345 "configure"
|
||||
#line 1340 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
int main() { return 0; }
|
||||
@@ -1350,7 +1345,7 @@ asm (".section .init");
|
||||
asm (".section .fini");
|
||||
; return 0; }
|
||||
EOF
|
||||
if eval $ac_compile; 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
|
||||
@@ -1370,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=
|
||||
@@ -1382,9 +1479,14 @@ for dir in $sysnames; do
|
||||
echo "$ac_t""running configure fragment for $dir" 1>&4
|
||||
. $sysdep_dir/$dir/configure
|
||||
fi
|
||||
|
||||
if test -z "$uname"; then
|
||||
{ test -r $sysdep_dir/$dir/uname.c || test -r $sysdep_dir/$dir/uname.S; } \
|
||||
&& uname=$dir
|
||||
if test -r $sysdep_dir/$dir/uname.c ||
|
||||
test -r $sysdep_dir/$dir/uname.S ||
|
||||
{ test -r $sysdep_dir/$dir/syscalls.list &&
|
||||
grep '^uname[ ]' $sysdep_dir/$dir/syscalls.list >/dev/null; }; then
|
||||
uname=$dir
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -1452,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
|
||||
@@ -1470,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
|
||||
|
||||
|
||||
@@ -1569,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 ;;
|
||||
@@ -1635,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
|
||||
@@ -1743,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
|
||||
|
||||
+76
-10
@@ -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=
|
||||
@@ -418,13 +484,16 @@ for dir in $sysnames; do
|
||||
AC_MSG_RESULT(running configure fragment for $dir)
|
||||
. $sysdep_dir/$dir/configure
|
||||
fi
|
||||
[
|
||||
if test -z "$uname"; then
|
||||
if test -r $sysdep_dir/$dir/uname.c ||
|
||||
test -r $sysdep_dir/$dir/uname.S ||
|
||||
{ test -r $sysdep_dir/$dir/syscalls.list &&
|
||||
grep '^uname[ ]' $sysdep_dir/$dir/syscalls.list >/dev/null; }; then
|
||||
uname=$dir
|
||||
fi
|
||||
fi
|
||||
]dnl
|
||||
done
|
||||
|
||||
AC_LINK_FILES(`echo $libc_link_sources`, `echo $libc_link_dests`)
|
||||
@@ -495,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
|
||||
@@ -505,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
|
||||
|
||||
+3
-6
@@ -70,13 +70,10 @@ _init (void)
|
||||
gcrt1.o to reference a symbol which would be defined by some library
|
||||
module which has a constructor; but then user code's constructors
|
||||
would come first, and not be profiled. */
|
||||
extern volatile void __gmon_start__ (void) __attribute__ ((weak));
|
||||
/* This volatile variable is necessary to avoid GCC optimizing
|
||||
out the test. */
|
||||
register volatile void (*g) (void) = &__gmon_start__;
|
||||
extern void __gmon_start__ (void) __attribute__ ((weak));
|
||||
weak_symbol (__gmon_start__)
|
||||
if (g)
|
||||
(*g) ();
|
||||
if (__gmon_start__)
|
||||
__gmon_start__ ();
|
||||
|
||||
/* End the here document containing the .init prologue code.
|
||||
Then fetch the .section directive just written and append that
|
||||
|
||||
+9
-5
@@ -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
@@ -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. */
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
*.gz *.Z *.tar *.tgz
|
||||
=*
|
||||
TODO COPYING* AUTHORS copyr-* copying.*
|
||||
glibc-*
|
||||
distinfo
|
||||
@@ -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
-3
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -21,11 +21,11 @@
|
||||
#
|
||||
subdir := dirent
|
||||
|
||||
headers := dirent.h
|
||||
headers := dirent.h direntry.h
|
||||
routines := opendir closedir readdir rewinddir \
|
||||
seekdir telldir scandir alphasort \
|
||||
getdents dirfd
|
||||
distribute := direct.h dirstream.h
|
||||
distribute := dirstream.h
|
||||
|
||||
tests := list tst-seekdir
|
||||
|
||||
|
||||
+35
-17
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -29,30 +29,48 @@ __BEGIN_DECLS
|
||||
|
||||
#include <gnu/types.h>
|
||||
|
||||
/* This file defines `struct dirent'.
|
||||
|
||||
/* Directory entry structure.
|
||||
It defines the macro `_DIRENT_HAVE_D_NAMLEN' iff there is a `d_namlen'
|
||||
member that gives the length of `d_name'.
|
||||
|
||||
This structure is laid out identically to the `struct direct' that
|
||||
represents directory entries in the GNU Hurd and in BSD 4.4 (and
|
||||
incidentally, on disk in the Berkeley fast file system). The `readdir'
|
||||
implementations for GNU and BSD know this; you must change them if you
|
||||
change this structure. */
|
||||
It defines the macro `_DIRENT_HAVE_D_RECLEN' iff there is a `d_reclen'
|
||||
member that gives the size of the entire directory entry. */
|
||||
|
||||
struct dirent
|
||||
{
|
||||
__ino_t d_fileno; /* File serial number. */
|
||||
unsigned short int d_reclen; /* Length of the whole `struct dirent'. */
|
||||
unsigned char d_type; /* File type, possibly unknown. */
|
||||
unsigned char d_namlen; /* Length of the file name. */
|
||||
|
||||
/* Only this member is in the POSIX standard. */
|
||||
char d_name[1]; /* File name (actually longer). */
|
||||
};
|
||||
#include <direntry.h>
|
||||
|
||||
#if defined(__USE_BSD) || defined(__USE_MISC)
|
||||
#define d_ino d_fileno /* Backward compatibility. */
|
||||
#endif
|
||||
|
||||
/* These macros extract size information from a `struct dirent *'.
|
||||
They may evaluate their argument multiple times, so it must not
|
||||
have side effects. Each of these may involve a relatively costly
|
||||
call to `strlen' on some systems, so these values should be cached.
|
||||
|
||||
_D_EXACT_NAMLEN (DP) returns the length of DP->d_name, not including
|
||||
its terminating null character.
|
||||
|
||||
_D_ALLOC_NAMLEN (DP) returns a size at least (_D_EXACT_NAMLEN (DP) + 1);
|
||||
that is, the allocation size needed to hold the DP->d_name string.
|
||||
Use this macro when you don't need the exact length, just an upper bound.
|
||||
This macro is less likely to require calling `strlen' than _D_EXACT_NAMLEN.
|
||||
*/
|
||||
|
||||
#ifdef _DIRENT_HAVE_D_NAMLEN
|
||||
#define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
|
||||
#define _D_ALLOC_NAMLEN(d) (_D_EXACT_NAMLEN (d) + 1)
|
||||
#else
|
||||
#define _D_EXACT_NAMLEN(d) (strlen ((d)->d_name))
|
||||
#ifdef _DIRENT_HAVE_D_RECLEN
|
||||
#define _D_ALLOC_NAMLEN(d) (((char *) (d) + (d)->d_reclen) - &(d)->d_name[0])
|
||||
#else
|
||||
#define _D_ALLOC_NAMLEN(d) (sizeof (d)->d_name > 1 ? sizeof (d)->d_name : \
|
||||
_D_EXACT_NAMLEN (d) + 1)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __USE_BSD
|
||||
/* File types for `d_type'. */
|
||||
enum
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ DEFUN(scandir, (dir, namelist, select, cmp),
|
||||
v = new;
|
||||
}
|
||||
|
||||
dsize = &d->d_name[d->d_namlen + 1] - (char *) d;
|
||||
dsize = &d->d_name[_D_ALLOC_NAMLEN (d)] - (char *) d;
|
||||
v[i] = (struct dirent *) malloc (dsize);
|
||||
if (v[i] == NULL)
|
||||
goto lose;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
+11
-3
@@ -33,6 +33,8 @@ rtld-routines := rtld $(addprefix dl-,minimal load lookup object reloc \
|
||||
distribute = $(rtld-routines:=.c) dynamic-link.h do-rel.h \
|
||||
soinit.c sofini.c ldd.sh.in linux-compat.c
|
||||
|
||||
all: # Make this the default target; it will be defined in Rules.
|
||||
|
||||
include ../Makeconfig
|
||||
|
||||
ifeq (yes,$(build-shared))
|
||||
@@ -59,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
@@ -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)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
/* On-demand PLT fixup for shared objects.
|
||||
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
|
||||
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 <link.h>
|
||||
#include "dynamic-link.h"
|
||||
|
||||
/* Figure out the right type, Rel or Rela. */
|
||||
#define elf_machine_rel 1
|
||||
#define elf_machine_rela 2
|
||||
#if elf_machine_relplt == elf_machine_rel
|
||||
#define PLTREL Elf32_Rel
|
||||
#elif elf_machine_relplt == elf_machine_rela
|
||||
#define PLTREL Elf32_Rela
|
||||
#else
|
||||
#error "dl-machine.h bug: elf_machine_relplt not rel or rela"
|
||||
#endif
|
||||
#undef elf_machine_rel
|
||||
#undef elf_machine_rela
|
||||
|
||||
/* We need to define the function as a local symbol so that the reference
|
||||
in the trampoline code will be a local PC-relative call. Tell the
|
||||
compiler not to worry that the function appears not to be called. */
|
||||
|
||||
static Elf32_Addr fixup (
|
||||
#ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
|
||||
ELF_MACHINE_RUNTIME_FIXUP_ARGS,
|
||||
#endif
|
||||
struct link_map *l, Elf32_Word reloc_offset)
|
||||
__attribute__ ((unused));
|
||||
|
||||
/* This function is called through a special trampoline from the PLT the
|
||||
first time each PLT entry is called. We must perform the relocation
|
||||
specified in the PLT of the given shared object, and return the resolved
|
||||
function address to the trampoline, which will restart the original call
|
||||
to that address. Future calls will bounce directly from the PLT to the
|
||||
function. */
|
||||
|
||||
static Elf32_Addr
|
||||
fixup (
|
||||
#ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
|
||||
ELF_MACHINE_RUNTIME_FIXUP_ARGS,
|
||||
#endif
|
||||
struct link_map *l, Elf32_Word reloc_offset)
|
||||
{
|
||||
const Elf32_Sym *const symtab
|
||||
= (const Elf32_Sym *) (l->l_addr + l->l_info[DT_SYMTAB]->d_un.d_ptr);
|
||||
const char *strtab =
|
||||
(const char *) (l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr);
|
||||
|
||||
const PLTREL *const reloc
|
||||
= (const void *) (l->l_addr + l->l_info[DT_JMPREL]->d_un.d_ptr +
|
||||
reloc_offset);
|
||||
|
||||
const Elf32_Sym *definer;
|
||||
Elf32_Addr loadbase;
|
||||
struct link_map *scope, *real_next;
|
||||
|
||||
/* Look up the symbol's run-time value. */
|
||||
|
||||
real_next = l->l_next;
|
||||
if (l->l_info[DT_SYMBOLIC])
|
||||
{
|
||||
l->l_next = _dl_loaded;
|
||||
if (l->l_prev)
|
||||
l->l_prev->l_next = real_next;
|
||||
scope = l;
|
||||
}
|
||||
else
|
||||
scope = _dl_loaded;
|
||||
|
||||
definer = &symtab[ELF32_R_SYM (reloc->r_info)];
|
||||
loadbase = _dl_lookup_symbol (strtab + definer->st_name, &definer,
|
||||
scope, l->l_name, 0);
|
||||
|
||||
/* Restore list frobnication done above for DT_SYMBOLIC. */
|
||||
l->l_next = real_next;
|
||||
if (l->l_prev)
|
||||
l->l_prev->l_next = l;
|
||||
|
||||
/* Apply the relocation with that value. */
|
||||
elf_machine_relplt (l, reloc, loadbase, definer);
|
||||
|
||||
return *(Elf32_Addr *) (l->l_addr + reloc->r_offset);
|
||||
}
|
||||
|
||||
|
||||
/* This macro is defined in dl-machine.h to define the entry point called
|
||||
by the PLT. The `fixup' function above does the real work, but a little
|
||||
more twiddling is needed to get the stack right and jump to the address
|
||||
finally resolved. */
|
||||
|
||||
ELF_MACHINE_RUNTIME_TRAMPOLINE
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/* Inline functions for dynamic linking.
|
||||
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
|
||||
@@ -43,7 +43,7 @@ elf_get_dynamic_info (Elf32_Dyn *dyn, Elf32_Dyn *info[DT_NUM + DT_PROCNUM])
|
||||
dyn->d_tag < DT_LOPROC + DT_PROCNUM)
|
||||
info[dyn->d_tag - DT_LOPROC + DT_NUM] = dyn;
|
||||
else
|
||||
assert (! "bad dynamic tag");
|
||||
assert (! "bad dynamic tag");
|
||||
dyn++;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -439,6 +439,34 @@ typedef struct
|
||||
#define AT_GID 13 /* Real gid */
|
||||
#define AT_EGID 14 /* Effective gid */
|
||||
|
||||
/* Motorola 68k specific definitions. */
|
||||
|
||||
/* m68k relocs. */
|
||||
|
||||
#define R_68K_NONE 0 /* No reloc */
|
||||
#define R_68K_32 1 /* Direct 32 bit */
|
||||
#define R_68K_16 2 /* Direct 16 bit */
|
||||
#define R_68K_8 3 /* Direct 8 bit */
|
||||
#define R_68K_PC32 4 /* PC relative 32 bit */
|
||||
#define R_68K_PC16 5 /* PC relative 16 bit */
|
||||
#define R_68K_PC8 6 /* PC relative 8 bit */
|
||||
#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */
|
||||
#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */
|
||||
#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */
|
||||
#define R_68K_GOT32O 10 /* 32 bit GOT offset */
|
||||
#define R_68K_GOT16O 11 /* 16 bit GOT offset */
|
||||
#define R_68K_GOT8O 12 /* 8 bit GOT offset */
|
||||
#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */
|
||||
#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */
|
||||
#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */
|
||||
#define R_68K_PLT32O 16 /* 32 bit PLT offset */
|
||||
#define R_68K_PLT16O 17 /* 16 bit PLT offset */
|
||||
#define R_68K_PLT8O 18 /* 8 bit PLT offset */
|
||||
#define R_68K_COPY 19 /* Copy symbol at runtime */
|
||||
#define R_68K_GLOB_DAT 20 /* Create GOT entry */
|
||||
#define R_68K_JMP_SLOT 21 /* Create PLT entry */
|
||||
#define R_68K_RELATIVE 22 /* Adjust by program base */
|
||||
|
||||
/* Intel 80386 specific definitions. */
|
||||
|
||||
/* i386 relocs. */
|
||||
|
||||
+23
-11
@@ -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. */
|
||||
|
||||
+5
-11
@@ -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
|
||||
|
||||
|
||||
+12
-4
@@ -21,9 +21,9 @@
|
||||
#
|
||||
subdir := gmon
|
||||
|
||||
headers := sys/gmon.h machine-gmon.h
|
||||
|
||||
routines := gmon mcount profil
|
||||
headers := sys/gmon.h sys/gmon_out.h
|
||||
distribute := machine-gmon.h
|
||||
routines := gmon mcount profil bb_init_func bb_exit_func
|
||||
|
||||
include ../Rules
|
||||
|
||||
@@ -32,6 +32,14 @@ CFLAGS-mcount.c := -fno-omit-frame-pointer
|
||||
|
||||
# We cannot compile mcount.c with -pg because that would
|
||||
# create resursive calls. Just copy the normal static object.
|
||||
$(objpfx)mcount.po: $(objpfx)mcount.o
|
||||
# On systems where `profil' is not a system call, the same
|
||||
# problem exists for the internal functions in profil.c.
|
||||
|
||||
noprof := mcount
|
||||
ifeq (,$(filter profil,$(unix-syscalls)))
|
||||
noprof += profil
|
||||
endif
|
||||
|
||||
$(noprof:%=$(objpfx)%.po): %.po: %.o
|
||||
rm -f $@
|
||||
ln $< $@
|
||||
|
||||
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
+14
-3
@@ -38,6 +38,10 @@ static char sccsid[] = "@(#)mcount.c 8.1 (Berkeley) 6/4/93";
|
||||
#include <sys/param.h>
|
||||
#include <sys/gmon.h>
|
||||
|
||||
/* This file provides the machine-dependent definitions of the _MCOUNT_DECL
|
||||
and MCOUNT macros. */
|
||||
#include "machine-gmon.h"
|
||||
|
||||
/*
|
||||
* mcount is called on entry to each function compiled with the profiling
|
||||
* switch set. _mcount(), which is declared in a machine-dependent way
|
||||
@@ -48,7 +52,7 @@ static char sccsid[] = "@(#)mcount.c 8.1 (Berkeley) 6/4/93";
|
||||
* _mcount updates data structures that represent traversals of the
|
||||
* program's call graph edges. frompc and selfpc are the return
|
||||
* address and function address that represents the given call graph edge.
|
||||
*
|
||||
*
|
||||
* Note: the original BSD code used the same variable (frompcindex) for
|
||||
* both frompcindex and frompc. Any reasonable, modern compiler will
|
||||
* perform this optimization.
|
||||
@@ -63,6 +67,7 @@ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */
|
||||
#ifdef KERNEL
|
||||
register int s;
|
||||
#endif
|
||||
int i;
|
||||
|
||||
p = &_gmonparam;
|
||||
/*
|
||||
@@ -85,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) {
|
||||
/*
|
||||
@@ -154,7 +165,7 @@ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */
|
||||
*frompcindex = toindex;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
done:
|
||||
#ifdef KERNEL
|
||||
|
||||
+16
-10
@@ -37,20 +37,25 @@
|
||||
#define _SYS_GMON_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <machine-gmon.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).
|
||||
@@ -138,6 +143,7 @@ struct gmonparam {
|
||||
u_long highpc;
|
||||
u_long textsize;
|
||||
u_long hashfraction;
|
||||
long log_hashfraction;
|
||||
};
|
||||
extern struct gmonparam _gmonparam;
|
||||
|
||||
|
||||
@@ -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_ */
|
||||
+2
-2
@@ -37,7 +37,7 @@ user-interfaces := $(addprefix hurd/,\
|
||||
process process_request \
|
||||
msg msg_reply msg_request \
|
||||
exec exec_startup crash interrupt \
|
||||
fs fsys io term socket ifsock)
|
||||
fs fsys io term tioctl socket ifsock)
|
||||
server-interfaces := hurd/msg
|
||||
|
||||
routines = hurdstartup hurdinit \
|
||||
@@ -51,7 +51,7 @@ routines = hurdstartup hurdinit \
|
||||
fopenport \
|
||||
vpprintf \
|
||||
ports-get ports-set hurdports hurdmsg \
|
||||
$(sig) $(dtable) hurdinline port-cleanup # report-wait
|
||||
$(sig) $(dtable) hurdinline port-cleanup report-wait
|
||||
sig = hurdsig hurdfault faultexc siginfo hurd-raise preempt-sig \
|
||||
trampoline longjmp-ts catch-exc exc2signal hurdkill sigunwind \
|
||||
thread-self thread-cancel intr-msg catch-signal
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+6
-4
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -29,9 +29,11 @@ DEFUN(fchroot, (fd), int fd)
|
||||
error_t err;
|
||||
file_t dir;
|
||||
|
||||
err = HURD_DPORT_USE (fd, (dir = __file_name_lookup_under (port, "",
|
||||
O_EXEC, 0),
|
||||
errno));
|
||||
err = HURD_DPORT_USE (fd,
|
||||
({
|
||||
dir = __file_name_lookup_under (port, "", O_EXEC, 0);
|
||||
dir == MACH_PORT_NULL ? errno : 0;
|
||||
}));
|
||||
|
||||
if (! err)
|
||||
_hurd_port_set (&_hurd_ports[INIT_PORT_CRDIR], dir);
|
||||
|
||||
+6
-3
@@ -1,5 +1,5 @@
|
||||
/* User-registered handlers for specific `ioctl' requests.
|
||||
Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -22,6 +22,7 @@ Cambridge, MA 02139, USA. */
|
||||
|
||||
#define __need___va_list
|
||||
#include <stdarg.h>
|
||||
#include <ioctls.h>
|
||||
|
||||
|
||||
/* Type of handler function, called like ioctl to do its entire job. */
|
||||
@@ -30,7 +31,8 @@ typedef int (*ioctl_handler_t) (int fd, int request, void *arg);
|
||||
/* Structure that records an ioctl handler. */
|
||||
struct ioctl_handler
|
||||
{
|
||||
int first_request, last_request; /* Range of handled request values. */
|
||||
/* Range of handled _IOC_NOTYPE (REQUEST) values. */
|
||||
int first_request, last_request;
|
||||
|
||||
/* Handler function, called like ioctl to do its entire job. */
|
||||
ioctl_handler_t handler;
|
||||
@@ -54,7 +56,8 @@ extern int hurd_register_ioctl_handler (int first_request, int last_request,
|
||||
#define _HURD_HANDLE_IOCTLS(handler, first, last) \
|
||||
static const struct ioctl_handler handler##_ioctl_handler \
|
||||
__attribute__ ((__unused__)) = \
|
||||
{ (first), (last), (int (*) (int, int, void *)) (handler), NULL }; \
|
||||
{ _IOC_NOTYPE (first), _IOC_NOTYPE (last), \
|
||||
(int (*) (int, int, void *)) (handler), NULL }; \
|
||||
text_set_element (_hurd_ioctl_handler_lists, ##handler##_ioctl_handler)
|
||||
|
||||
/* Define a library-internal handler for a single ioctl command. */
|
||||
|
||||
+13
-1
@@ -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 */
|
||||
|
||||
+17
-5
@@ -113,6 +113,8 @@ _hurdsig_fault_init (void)
|
||||
struct machine_thread_state state;
|
||||
mach_port_t sigexc;
|
||||
|
||||
/* Allocate a port to receive signal thread exceptions.
|
||||
We will move this receive right to the proc server. */
|
||||
err = __mach_port_allocate (__mach_task_self (),
|
||||
MACH_PORT_RIGHT_RECEIVE, &sigexc);
|
||||
assert_perror (err);
|
||||
@@ -120,16 +122,20 @@ _hurdsig_fault_init (void)
|
||||
MACH_PORT_RIGHT_RECEIVE, &forward_sigexc);
|
||||
assert_perror (err);
|
||||
|
||||
/* Allocate a port to receive the exception msgs forwarded
|
||||
from the proc server. */
|
||||
err = __mach_port_insert_right (__mach_task_self (), sigexc,
|
||||
sigexc, MACH_MSG_TYPE_MAKE_SEND);
|
||||
assert_perror (err);
|
||||
#if 0 /* XXX gdb bites */
|
||||
err = __thread_set_special_port (_hurd_msgport_thread,
|
||||
THREAD_EXCEPTION_PORT, sigexc);
|
||||
#endif
|
||||
__mach_port_deallocate (__mach_task_self (), sigexc);
|
||||
|
||||
/* Set the queue limit for this port to just one. The proc server will
|
||||
notice if we ever get a second exception while one remains queued and
|
||||
unreceived, and decide we are hopelessly buggy. */
|
||||
err = __mach_port_set_qlimit (__mach_task_self (), forward_sigexc, 1);
|
||||
assert_perror (err);
|
||||
|
||||
/* This state will be restored when we fault.
|
||||
It runs the function above. */
|
||||
memset (&state, 0, sizeof state);
|
||||
MACHINE_THREAD_STATE_SET_PC (&state, faulted);
|
||||
MACHINE_THREAD_STATE_SET_SP (&state, faultstack, sizeof faultstack);
|
||||
@@ -143,5 +149,11 @@ _hurdsig_fault_init (void)
|
||||
(natural_t *) &state,
|
||||
MACHINE_THREAD_STATE_COUNT));
|
||||
assert_perror (err);
|
||||
|
||||
/* Direct signal thread exceptions to the proc server. */
|
||||
err = __thread_set_special_port (_hurd_msgport_thread,
|
||||
THREAD_EXCEPTION_PORT, sigexc);
|
||||
__mach_port_deallocate (__mach_task_self (), sigexc);
|
||||
assert_perror (err);
|
||||
}
|
||||
|
||||
|
||||
+16
-6
@@ -1,5 +1,5 @@
|
||||
/* ioctl commands which must be done in the C library.
|
||||
Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
||||
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -36,6 +36,10 @@ _hurd_lookup_ioctl_handler (int request)
|
||||
void *const *ptr;
|
||||
const struct ioctl_handler *h;
|
||||
|
||||
/* Mask off the type bits, so that we see requests in a single group as a
|
||||
contiguous block of values. */
|
||||
request = _IOC_NOTYPE (request);
|
||||
|
||||
for (ptr = symbol_set_first_element (_hurd_ioctl_handler_lists);
|
||||
!symbol_set_end_p (_hurd_ioctl_handler_lists, ptr);
|
||||
++ptr)
|
||||
@@ -62,7 +66,7 @@ fioctl (int fd,
|
||||
switch (request)
|
||||
{
|
||||
default:
|
||||
err = EGRATUITOUS;
|
||||
err = ENOTTY;
|
||||
break;
|
||||
|
||||
case FIONREAD:
|
||||
@@ -97,7 +101,7 @@ fioctl (int fd,
|
||||
break;
|
||||
}
|
||||
|
||||
return err ? __hurd_fail (err) : 0;
|
||||
return err ? __hurd_dfail (fd, err) : 0;
|
||||
}
|
||||
|
||||
_HURD_HANDLE_IOCTLS (fioctl, FIOGETOWN, FIONREAD);
|
||||
@@ -112,7 +116,7 @@ fioclex (int fd,
|
||||
switch (request)
|
||||
{
|
||||
default:
|
||||
return __hurd_fail (EGRATUITOUS);
|
||||
return __hurd_fail (ENOTTY);
|
||||
case FIOCLEX:
|
||||
flag = FD_CLOEXEC;
|
||||
break;
|
||||
@@ -126,12 +130,13 @@ fioclex (int fd,
|
||||
_HURD_HANDLE_IOCTLS (fioclex, FIOCLEX, FIONCLEX);
|
||||
|
||||
#include <hurd/term.h>
|
||||
#include <hurd/tioctl.h>
|
||||
|
||||
static void
|
||||
rectty_dtable (mach_port_t cttyid)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
HURD_CRITICAL_BEGIN;
|
||||
__mutex_lock (&_hurd_dtable_lock);
|
||||
|
||||
@@ -222,6 +227,11 @@ tiocsctty (int fd,
|
||||
else if (err)
|
||||
return __hurd_fail (err);
|
||||
|
||||
/* Change the terminal's pgrp to ours. */
|
||||
err = HURD_DPORT_USE (fd, __tioctl_tiocspgrp (port, _hurd_pgrp));
|
||||
if (err)
|
||||
return __hurd_fail (err);
|
||||
|
||||
/* Make it our own. */
|
||||
_hurd_port_set (&_hurd_ports[INIT_PORT_CTTYID], cttyid);
|
||||
|
||||
@@ -256,7 +266,7 @@ tiocnotty (int fd,
|
||||
_hurd_port_set (&_hurd_ports[INIT_PORT_CTTYID], MACH_PORT_NULL);
|
||||
|
||||
/* Reset all the ctty ports in all the descriptors. */
|
||||
|
||||
|
||||
__USEPORT (CTTYID, (rectty_dtable (MACH_PORT_NULL), 0));
|
||||
|
||||
return 0;
|
||||
|
||||
+4
-1
@@ -133,7 +133,10 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
|
||||
#endif
|
||||
|
||||
/* An empty RETRYNAME indicates we have the final port. */
|
||||
if (retryname[0] == '\0')
|
||||
if (retryname[0] == '\0' &&
|
||||
/* If reauth'd, we must do one more retry on "" to give the new
|
||||
translator a chance to make a new port for us. */
|
||||
doretry == FS_RETRY_NORMAL)
|
||||
{
|
||||
/* We got a successful translation. Now apply any open-time
|
||||
action flags we were passed. */
|
||||
|
||||
@@ -449,10 +449,3 @@ _S_msg_set_dtable (mach_port_t process,
|
||||
kern_return_t
|
||||
_S_msg_startup_dosync (mach_port_t process)
|
||||
{ return EOPNOTSUPP; }
|
||||
|
||||
kern_return_t
|
||||
_S_msg_report_wait (mach_port_t process,
|
||||
mach_port_t thread,
|
||||
string_t wait_desc,
|
||||
int *wait_rpc)
|
||||
{ return EOPNOTSUPP; }
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
/* Report on what a thread in our task is waiting for.
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <hurd.h>
|
||||
#include <hurd/signal.h>
|
||||
#include <hurd/fd.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <hurd/msg_server.h>
|
||||
#include "thread_state.h"
|
||||
#include "intr-msg.h"
|
||||
|
||||
static void
|
||||
describe_number (string_t description, const char *flavor, int i)
|
||||
{
|
||||
char *p = __stpcpy (description, flavor);
|
||||
p += i / 10 + 1;
|
||||
*p = '\0';
|
||||
do
|
||||
{
|
||||
*--p = '0' + i % 10;
|
||||
i /= 10;
|
||||
} while (i != 0);
|
||||
assert (p[-1] == '#');
|
||||
}
|
||||
|
||||
static void
|
||||
describe_port (string_t description, mach_port_t port)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (port == __mach_task_self ())
|
||||
{
|
||||
strcpy (description, "task-self");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < _hurd_nports; ++i)
|
||||
if (port == _hurd_ports[i].port)
|
||||
{
|
||||
describe_number (description, "init#", i);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_hurd_init_dtable)
|
||||
{
|
||||
for (i = 0; i < _hurd_init_dtablesize; ++i)
|
||||
if (port == _hurd_init_dtable[i])
|
||||
{
|
||||
describe_number (description, "fd#", i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (_hurd_dtable)
|
||||
{
|
||||
for (i = 0; i < _hurd_dtablesize; ++i)
|
||||
if (_hurd_dtable[i] == NULL)
|
||||
continue;
|
||||
else if (port == _hurd_dtable[i]->port.port)
|
||||
{
|
||||
describe_number (description, "fd#", i);
|
||||
return;
|
||||
}
|
||||
else if (port == _hurd_dtable[i]->ctty.port)
|
||||
{
|
||||
describe_number (description, "bgfd#", i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
describe_number (description, "port#", port);
|
||||
}
|
||||
|
||||
|
||||
kern_return_t
|
||||
_S_msg_report_wait (mach_port_t msgport, thread_t thread,
|
||||
string_t description, int *msgid)
|
||||
{
|
||||
*msgid = 0;
|
||||
|
||||
if (thread == _hurd_msgport_thread)
|
||||
/* Cute. */
|
||||
strcpy (description, "msgport");
|
||||
else
|
||||
{
|
||||
/* Make sure this is really one of our threads. */
|
||||
|
||||
struct hurd_sigstate *ss;
|
||||
|
||||
__mutex_lock (&_hurd_siglock);
|
||||
for (ss = _hurd_sigstates; ss != NULL; ss = ss->next)
|
||||
if (ss->thread == thread)
|
||||
break;
|
||||
__mutex_unlock (&_hurd_siglock);
|
||||
if (ss == NULL)
|
||||
/* To hell with you. */
|
||||
return EINVAL;
|
||||
|
||||
if (ss->suspended != MACH_PORT_NULL)
|
||||
strcpy (description, "sigsuspend");
|
||||
else
|
||||
{
|
||||
/* Examine the thread's state to see if it is blocked in an RPC. */
|
||||
|
||||
struct machine_thread_state state;
|
||||
mach_msg_type_number_t count = MACHINE_THREAD_STATE_COUNT;
|
||||
error_t err;
|
||||
|
||||
err = __thread_get_state (thread, MACHINE_THREAD_STATE_FLAVOR,
|
||||
(integer_t *) &state, &count);
|
||||
if (err)
|
||||
return err;
|
||||
assert (count == MACHINE_THREAD_STATE_COUNT);
|
||||
if (SYSCALL_EXAMINE (&state, msgid))
|
||||
{
|
||||
/* Blocked in a system call. */
|
||||
if (*msgid == -25)
|
||||
/* mach_msg system call. Examine its parameters. */
|
||||
describe_port (description, MSG_EXAMINE (&state, msgid));
|
||||
else
|
||||
strcpy (description, "kernel");
|
||||
}
|
||||
else
|
||||
description[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
__mach_port_deallocate (__mach_task_self (), thread);
|
||||
return 0;
|
||||
}
|
||||
+6
-5
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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.
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
@@ -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
@@ -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
|
||||
|
||||
%:: $(gettext-srcdir)/intl/%.glibc; $(copysrc)
|
||||
%:: $(gettext-srcdir)/intl/%.c; $(copysrc)
|
||||
%:: $(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
@@ -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>
|
||||
|
||||
+40
-25
@@ -1,19 +1,23 @@
|
||||
/* dcgettext.c -- implemenatation of the dcgettext(3) function
|
||||
Copyright (C) 1995 Software Foundation, Inc.
|
||||
/* 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>
|
||||
@@ -24,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#ifdef __GNUC__
|
||||
# define alloca __builtin_alloca
|
||||
#else
|
||||
# ifdef HAVE_ALLOCA_H || defined _LIBC
|
||||
# if defined HAVE_ALLOCA_H || defined _LIBC
|
||||
# include <alloca.h>
|
||||
# else
|
||||
# ifdef _AIX
|
||||
@@ -151,10 +155,11 @@ const char _nl_default_dirname[] = GNULOCALEDIR;
|
||||
struct binding *_nl_domain_bindings;
|
||||
|
||||
/* Prototypes for local functions. */
|
||||
static char *find_msg __P ((struct loaded_domain *domain, const char *msgid));
|
||||
static const char *category_to_name __P((int category));
|
||||
static const char *guess_category_value __P((int category,
|
||||
const char *categoryname));
|
||||
static char *find_msg PARAMS ((struct loaded_domain *domain,
|
||||
const char *msgid));
|
||||
static const char *category_to_name PARAMS ((int category));
|
||||
static const char *guess_category_value PARAMS ((int category,
|
||||
const char *categoryname));
|
||||
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
@@ -182,6 +187,7 @@ DCGETTEXT (domainname, msgid, category)
|
||||
char *dirname, *xdomainname;
|
||||
char *single_locale;
|
||||
char *retval;
|
||||
int saved_errno = errno;
|
||||
|
||||
/* If no real MSGID is given return NULL. */
|
||||
if (msgid == NULL)
|
||||
@@ -233,9 +239,12 @@ DCGETTEXT (domainname, msgid, category)
|
||||
}
|
||||
|
||||
if (ret == NULL)
|
||||
/* We cannot get the current working directory. Don't signal an
|
||||
error but simply return the default string. */
|
||||
return (char *) msgid;
|
||||
{
|
||||
/* We cannot get the current working directory. Don't signal an
|
||||
error but simply return the default string. */
|
||||
errno = saved_errno;
|
||||
return (char *) msgid;
|
||||
}
|
||||
|
||||
/* We don't want libintl.a to depend on any other library. So
|
||||
we avoid the non-standard function stpcpy. In GNU C Library
|
||||
@@ -302,7 +311,10 @@ DCGETTEXT (domainname, msgid, category)
|
||||
domain. Return the MSGID. */
|
||||
if (strcmp (single_locale, "C") == 0
|
||||
|| strcmp (single_locale, "POSIX") == 0)
|
||||
return (char *) msgid;
|
||||
{
|
||||
errno = saved_errno;
|
||||
return (char *) msgid;
|
||||
}
|
||||
|
||||
|
||||
/* Find structure describing the message catalog matching the
|
||||
@@ -317,7 +329,7 @@ DCGETTEXT (domainname, msgid, category)
|
||||
{
|
||||
int cnt;
|
||||
|
||||
for (cnt = 0; domain->successor[cnt] != NULL; --cnt)
|
||||
for (cnt = 0; domain->successor[cnt] != NULL; ++cnt)
|
||||
{
|
||||
retval = find_msg (domain->successor[cnt], msgid);
|
||||
|
||||
@@ -327,7 +339,10 @@ DCGETTEXT (domainname, msgid, category)
|
||||
}
|
||||
|
||||
if (retval != NULL)
|
||||
return retval;
|
||||
{
|
||||
errno = saved_errno;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* NOTREACHED */
|
||||
@@ -375,8 +390,8 @@ find_msg (domain, msgid)
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (idx >= W (domain->must_swap, domain->hash_size) - incr)
|
||||
idx -= W (domain->must_swap, domain->hash_size) - incr;
|
||||
if (idx >= domain->hash_size - incr)
|
||||
idx -= domain->hash_size - incr;
|
||||
else
|
||||
idx += incr;
|
||||
|
||||
|
||||
+14
-10
@@ -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>
|
||||
|
||||
+129
-53
@@ -1,25 +1,30 @@
|
||||
/* finddomain.c -- handle list of needed message catalogs
|
||||
Copyright (C) 1995 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,41 +68,47 @@ 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. */
|
||||
static struct loaded_domain *_nl_loaded_domains;
|
||||
|
||||
/* Prototypes for local functions. */
|
||||
static struct loaded_domain *make_entry_rec __P ((const char *dirname,
|
||||
int mask,
|
||||
const char *language,
|
||||
const char *territory,
|
||||
const char *codeset,
|
||||
const char *modifier,
|
||||
const char *special,
|
||||
const char *sponsor,
|
||||
const char *revision,
|
||||
const char *domainname,
|
||||
int do_allocate));
|
||||
static struct loaded_domain *make_entry_rec PARAMS ((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,
|
||||
const char *revision,
|
||||
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 __P ((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
@@ -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
@@ -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
|
||||
|
||||
+27
-20
@@ -1,30 +1,34 @@
|
||||
/* gettextP.h -- header describing internals of gettext library
|
||||
Copyright (C) 1995 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
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
#ifndef __P
|
||||
#ifndef PARAMS
|
||||
# if __STDC__
|
||||
# define __P(args) args
|
||||
# define PARAMS(args) args
|
||||
# else
|
||||
# define __P(args) ()
|
||||
# define PARAMS(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -32,6 +36,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
# define W(flag, data) ((flag) ? SWAP (data) : (data))
|
||||
#endif
|
||||
|
||||
|
||||
static nls_uint32 SWAP PARAMS ((nls_uint32 i));
|
||||
|
||||
static inline nls_uint32
|
||||
SWAP (i)
|
||||
nls_uint32 i;
|
||||
@@ -43,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;
|
||||
@@ -64,12 +71,12 @@ struct binding
|
||||
char *dirname;
|
||||
};
|
||||
|
||||
struct loaded_domain *_nl_find_domain __P ((const char *__dirname,
|
||||
char *__locale,
|
||||
const char *__domainname));
|
||||
void _nl_load_domain __P ((struct loaded_domain *__domain));
|
||||
struct loaded_domain *_nl_find_domain PARAMS ((const char *__dirname,
|
||||
char *__locale,
|
||||
const char *__domainname));
|
||||
void _nl_load_domain PARAMS ((struct loaded_domain *__domain));
|
||||
|
||||
const char *_nl_expand_alias __P ((const char *__name));
|
||||
const char *_nl_expand_alias PARAMS ((const char *__name));
|
||||
|
||||
/* @@ begin of epilog @@ */
|
||||
|
||||
|
||||
+30
-20
@@ -1,19 +1,23 @@
|
||||
/* hash-string - Implements a string hashing function.
|
||||
Copyright (C) 1995 Software Foundation, Inc.
|
||||
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>
|
||||
@@ -21,22 +25,28 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
#ifndef BITSPERBYTE
|
||||
# define BITSPERBYTE 8
|
||||
#ifndef PARAMS
|
||||
# if __STDC__
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef LONGBITS
|
||||
# define LONGBITS (sizeof (long) * BITSPERBYTE)
|
||||
#endif /* LONGBITS */
|
||||
/* We assume to have `unsigned long int' value with at least 32 bits. */
|
||||
#define HASHWORDBITS 32
|
||||
|
||||
|
||||
/* Defines the so called `hashpjw' function by P.J. Weinberger
|
||||
[see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
|
||||
1986, 1987 Bell Telephone Laboratories, Inc.] */
|
||||
1986, 1987 Bell Telephone Laboratories, Inc.] */
|
||||
static unsigned long hash_string PARAMS ((const char *__str_param));
|
||||
|
||||
static inline unsigned long
|
||||
hash_string (str_param)
|
||||
const char *str_param;
|
||||
{
|
||||
unsigned long hval, g;
|
||||
unsigned long int hval, g;
|
||||
const char *str = str_param;
|
||||
|
||||
/* Compute the hash value for the given string. */
|
||||
@@ -45,10 +55,10 @@ hash_string (str_param)
|
||||
{
|
||||
hval <<= 4;
|
||||
hval += (unsigned long) *str++;
|
||||
g = hval & ((unsigned long) 0xf << (LONGBITS - 4));
|
||||
g = hval & ((unsigned long) 0xf << (HASHWORDBITS - 4));
|
||||
if (g != 0)
|
||||
{
|
||||
hval ^= g >> (LONGBITS - 8);
|
||||
hval ^= g >> (HASHWORDBITS - 8);
|
||||
hval ^= g;
|
||||
}
|
||||
}
|
||||
|
||||
+23
-19
@@ -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
|
||||
@@ -37,34 +39,36 @@ __BEGIN_DECLS
|
||||
/* Look up MSGID in the current default message catalog for the current
|
||||
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||
text). */
|
||||
extern char *gettext __P ((const char *__msgid));
|
||||
extern char *__gettext __P ((const char *__msgid));
|
||||
extern char *gettext __P ((__const char *__msgid));
|
||||
extern char *__gettext __P ((__const char *__msgid));
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current
|
||||
LC_MESSAGES locale. */
|
||||
extern char *dgettext __P ((const char *__domainname, const char *__msgid));
|
||||
extern char *__dgettext __P ((const char *__domainname, const char *__msgid));
|
||||
extern char *dgettext __P ((__const char *__domainname,
|
||||
__const char *__msgid));
|
||||
extern char *__dgettext __P ((__const char *__domainname,
|
||||
__const char *__msgid));
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||
locale. */
|
||||
extern char *dcgettext __P ((const char *__domainname, const char *__msgid,
|
||||
int __category));
|
||||
extern char *__dcgettext __P ((const char *__domainname, const char *__msgid,
|
||||
int __category));
|
||||
extern char *dcgettext __P ((__const char *__domainname,
|
||||
__const char *__msgid, int __category));
|
||||
extern char *__dcgettext __P ((__const char *__domainname,
|
||||
__const char *__msgid, int __category));
|
||||
|
||||
|
||||
/* Set the current default message catalog to DOMAINNAME.
|
||||
If DOMAINNAME is null, return the current default.
|
||||
If DOMAINNAME is "", reset to the default of "messages". */
|
||||
extern char *textdomain __P ((const char *__domainname));
|
||||
extern char *__textdomain __P ((const char *__domainname));
|
||||
extern char *textdomain __P ((__const char *__domainname));
|
||||
extern char *__textdomain __P ((__const char *__domainname));
|
||||
|
||||
/* Specify that the DOMAINNAME message catalog will be found
|
||||
in DIRNAME rather than in the system locale data base. */
|
||||
extern char *bindtextdomain __P ((const char *__domainname,
|
||||
const char *__dirname));
|
||||
extern char *__bindtextdomain __P ((const char *__domainname,
|
||||
const char *__dirname));
|
||||
extern char *bindtextdomain __P ((__const char *__domainname,
|
||||
__const char *__dirname));
|
||||
extern char *__bindtextdomain __P ((__const char *__domainname,
|
||||
__const char *__dirname));
|
||||
|
||||
|
||||
/* Optimized version of the function above. */
|
||||
@@ -73,9 +77,9 @@ extern char *__bindtextdomain __P ((const char *__domainname,
|
||||
`__builtin_constant_p' predicate in dcgettext would always return
|
||||
false. */
|
||||
|
||||
# define gettext (msgid) dgettext (NULL, msgid)
|
||||
# define gettext(msgid) dgettext (NULL, msgid)
|
||||
|
||||
# define dgettext (domainname, msgid) \
|
||||
# define dgettext(domainname, msgid) \
|
||||
dcgettext (domainname, msgid, LC_MESSAGES)
|
||||
|
||||
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
|
||||
|
||||
+14
-10
@@ -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>
|
||||
|
||||
+25
-19
@@ -1,19 +1,23 @@
|
||||
/* localealias.c -- handle aliases for locale names
|
||||
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. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
@@ -86,10 +90,10 @@ static size_t maxmap = 0;
|
||||
|
||||
|
||||
/* Prototypes for local functions. */
|
||||
static size_t read_alias_file __P ((const char *fname, int fname_len));
|
||||
static void extend_alias_table __P ((void));
|
||||
static int alias_compare __P ((const struct alias_map *map1,
|
||||
const struct alias_map *map2));
|
||||
static size_t read_alias_file PARAMS ((const char *fname, int fname_len));
|
||||
static void extend_alias_table PARAMS ((void));
|
||||
static int alias_compare PARAMS ((const struct alias_map *map1,
|
||||
const struct alias_map *map2));
|
||||
|
||||
|
||||
const char *
|
||||
@@ -109,9 +113,9 @@ _nl_expand_alias (name)
|
||||
if (nmap > 0)
|
||||
retval = (struct alias_map *) bsearch (&item, map, nmap,
|
||||
sizeof (struct alias_map),
|
||||
(int (*) (const void *,
|
||||
const void *))
|
||||
alias_compare);
|
||||
(int (*) PARAMS ((const void *,
|
||||
const void *))
|
||||
) alias_compare);
|
||||
else
|
||||
retval = NULL;
|
||||
|
||||
@@ -257,7 +261,7 @@ read_alias_file (fname, fname_len)
|
||||
|
||||
if (added > 0)
|
||||
qsort (map, nmap, sizeof (struct alias_map),
|
||||
(int (*) (const void *, const void *)) alias_compare);
|
||||
(int (*) PARAMS ((const void *, const void *))) alias_compare);
|
||||
|
||||
return added;
|
||||
}
|
||||
@@ -309,6 +313,8 @@ alias_compare (map1, map2)
|
||||
c2 = isupper (*p2) ? tolower (*p2) : *p2;
|
||||
if (c1 == '\0')
|
||||
break;
|
||||
++p1;
|
||||
++p2;
|
||||
}
|
||||
while (c1 == c2);
|
||||
|
||||
|
||||
+14
-10
@@ -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>
|
||||
|
||||
@@ -661,13 +661,16 @@ fts_build(sp, type)
|
||||
/* Read the directory, attaching each entry to the `link' pointer. */
|
||||
adjaddr = NULL;
|
||||
for (head = tail = NULL, nitems = 0; dp = readdir(dirp);) {
|
||||
int namlen;
|
||||
|
||||
if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
|
||||
continue;
|
||||
|
||||
if ((p = fts_alloc(sp, dp->d_name, (int)dp->d_namlen)) == NULL)
|
||||
namlen = _D_EXACT_NAMLEN (dp);
|
||||
if ((p = fts_alloc(sp, dp->d_name, namlen)) == NULL)
|
||||
goto mem1;
|
||||
if (dp->d_namlen > maxlen) {
|
||||
if (fts_palloc(sp, (size_t)dp->d_namlen)) {
|
||||
if (namlen > maxlen) {
|
||||
if (fts_palloc(sp, (size_t)namlen)) {
|
||||
/*
|
||||
* No more memory for path or structures. Save
|
||||
* errno, free up the current structure and the
|
||||
@@ -687,7 +690,7 @@ mem1: saved_errno = errno;
|
||||
maxlen = sp->fts_pathlen - sp->fts_cur->fts_pathlen - 1;
|
||||
}
|
||||
|
||||
p->fts_pathlen = len + dp->d_namlen + 1;
|
||||
p->fts_pathlen = len + namlen + 1;
|
||||
p->fts_parent = sp->fts_cur;
|
||||
p->fts_level = level;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1992, 1995 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ian Lance Taylor (ian@airs.com).
|
||||
|
||||
@@ -53,18 +53,21 @@ DEFUN (ftw_dir, (dirs, level, descriptors, dir, len, func),
|
||||
{
|
||||
struct stat s;
|
||||
int flag, retval, newlev;
|
||||
size_t namlen;
|
||||
|
||||
++got;
|
||||
|
||||
if (entry->d_name[0] == '.'
|
||||
&& (entry->d_namlen == 1 ||
|
||||
(entry->d_namlen == 2 && entry->d_name[1] == '.')))
|
||||
&& (entry->d_name[1] == '\0' ||
|
||||
(entry->d_name[1] == '.' && entry->d_name[2] == '\0')))
|
||||
{
|
||||
errno = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entry->d_namlen + len + 1 > PATH_MAX)
|
||||
namlen = _D_EXACT_NAMLEN (entry);
|
||||
|
||||
if (namlen + len + 1 > PATH_MAX)
|
||||
{
|
||||
#ifdef ENAMETOOLONG
|
||||
errno = ENAMETOOLONG;
|
||||
@@ -76,7 +79,7 @@ DEFUN (ftw_dir, (dirs, level, descriptors, dir, len, func),
|
||||
|
||||
dir[len] = '/';
|
||||
memcpy ((PTR) (dir + len + 1), (PTR) entry->d_name,
|
||||
entry->d_namlen + 1);
|
||||
namlen + 1);
|
||||
|
||||
if (stat (dir, &s) < 0)
|
||||
{
|
||||
@@ -110,7 +113,7 @@ DEFUN (ftw_dir, (dirs, level, descriptors, dir, len, func),
|
||||
{
|
||||
if (retval == 0)
|
||||
retval = ftw_dir (dirs, newlev, descriptors, dir,
|
||||
entry->d_namlen + len + 1, func);
|
||||
namlen + len + 1, func);
|
||||
if (dirs[newlev] != NULL)
|
||||
{
|
||||
int save;
|
||||
|
||||
+50
-30
@@ -1,6 +1,6 @@
|
||||
/* Support macros for making weak and strong aliases for symbols,
|
||||
and for using symbol sets and linker warnings with GNU ld.
|
||||
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
|
||||
@@ -27,25 +27,32 @@ 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'.
|
||||
|
||||
*/
|
||||
|
||||
/* This is defined for the compilation of all C library code. features.h
|
||||
tests this to avoid inclusion of stubs.h while compiling the library,
|
||||
before stubs.h has been generated. Some library code that is shared
|
||||
with other packages also tests this symbol to see if it is being
|
||||
compiled as part of the C library. We must define this before including
|
||||
config.h, because it makes some definitions conditional on whether libc
|
||||
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 is defined for the compilation of all C library code.
|
||||
features.h tests this to avoid inclusion of stubs.h while
|
||||
compiling the library, before stubs.h has been generated.
|
||||
Some library code that is shared with other packages also
|
||||
tests this symbol to see if it is being compiled as part
|
||||
of the C library. */
|
||||
#define _LIBC 1
|
||||
/* This disables sccsid/rcsid strings in lots of code of non-GNU origin. */
|
||||
#define lint 1
|
||||
/*
|
||||
|
||||
*/
|
||||
@@ -74,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
|
||||
@@ -138,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) \
|
||||
@@ -149,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. */
|
||||
@@ -168,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
|
||||
@@ -176,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. */
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
*.gz *.Z *.tar *.tgz
|
||||
=*
|
||||
TODO COPYING* AUTHORS copyr-* copying.*
|
||||
glibc-*
|
||||
|
||||
mpn-copy.mk
|
||||
distinfo
|
||||
@@ -12,4 +12,6 @@ DEFUN_VOID(_IO_register_cleanup)
|
||||
}
|
||||
|
||||
void (*_IO_cleanup_registration_needed)() = _IO_register_cleanup;
|
||||
#else
|
||||
void (*_IO_cleanup_registration_needed)() = NULL;
|
||||
#endif /* _G_HAVE_ATEXIT */
|
||||
|
||||
+4
-6
@@ -49,12 +49,6 @@ the executable file might be covered by the GNU General Public License. */
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
/* If this function pointer is non-zero, we should call it.
|
||||
It's supposed to make sure _IO_cleanup gets called on exit.
|
||||
We call it from _IO_file_doallocate, since that is likely
|
||||
to get called by any program that does buffered I/O. */
|
||||
void (*_IO_cleanup_registration_needed)();
|
||||
|
||||
/*
|
||||
* Allocate a file buffer, or switch to unbuffered I/O.
|
||||
* Per the ANSI C standard, ALL tty devices default to line buffered.
|
||||
@@ -72,6 +66,10 @@ DEFUN(_IO_file_doallocate, (fp),
|
||||
register char *p;
|
||||
struct stat st;
|
||||
|
||||
/* If _IO_cleanup_registration_needed is non-zero, we should call the
|
||||
function it points to. This is to make sure _IO_cleanup gets called
|
||||
on exit. We call it from _IO_file_doallocate, since that is likely
|
||||
to get called by any program that does buffered I/O. */
|
||||
if (_IO_cleanup_registration_needed)
|
||||
(*_IO_cleanup_registration_needed)();
|
||||
|
||||
|
||||
+19
-4
@@ -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 */
|
||||
|
||||
@@ -78,3 +78,5 @@ _IO_setvbuf (fp, buf, mode, size)
|
||||
}
|
||||
return _IO_SETBUF (fp, buf, size) == NULL ? EOF : 0;
|
||||
}
|
||||
|
||||
weak_alias (_IO_setvbuf, setvbuf)
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 }
|
||||
}
|
||||
};
|
||||
|
||||
+22
-13
@@ -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,20 +24,25 @@ 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
|
||||
others = localedef locale
|
||||
install-bin = localedef locale
|
||||
others = localedef# locale
|
||||
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
|
||||
vpath %.c programs
|
||||
vpath %.h programs
|
||||
|
||||
localedef-modules := $(categories:%=ld-%) charmap charset linereader \
|
||||
locfile stringtrans
|
||||
locale-modules := ctypedump
|
||||
lib-modules := locfile-hash xmalloc
|
||||
lib-modules := simple-hash xmalloc xstrdup
|
||||
|
||||
|
||||
GPERF = gperf
|
||||
@@ -45,14 +50,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
@@ -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
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
*/
|
||||
@@ -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:
|
||||
*/
|
||||
@@ -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
|
||||
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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);
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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:
|
||||
*/
|
||||
@@ -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
@@ -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 */
|
||||
|
||||
@@ -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:
|
||||
*/
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user