diff options
author | Bruno Haible <bruno@clisp.org> | 2001-10-26 10:01:20 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2001-10-26 10:01:20 +0000 |
commit | 4ee9eb65d3945455fddcf70f71f15fbc4f77f916 (patch) | |
tree | 3ed19a2b828d742e5892e8723289de1565e73848 | |
parent | bcc925e8db2bf51fbc01170780bc4969c5c50099 (diff) | |
download | external_gettext-4ee9eb65d3945455fddcf70f71f15fbc4f77f916.zip external_gettext-4ee9eb65d3945455fddcf70f71f15fbc4f77f916.tar.gz external_gettext-4ee9eb65d3945455fddcf70f71f15fbc4f77f916.tar.bz2 |
Regenerated.
-rw-r--r-- | ABOUT-NLS | 255 | ||||
-rw-r--r-- | Makefile.in | 1 | ||||
-rw-r--r-- | aclocal.m4 | 8 | ||||
-rw-r--r-- | config.h.in | 6 | ||||
-rwxr-xr-x | configure | 59 | ||||
-rw-r--r-- | doc/Makefile.in | 20 | ||||
-rw-r--r-- | intl-java/Makefile.in | 3 | ||||
-rw-r--r-- | intl/plural.c | 68 | ||||
-rw-r--r-- | lib/Makefile.in | 1 | ||||
-rw-r--r-- | m4/Makefile.in | 1 | ||||
-rw-r--r-- | man/Makefile.in | 1 | ||||
-rw-r--r-- | misc/Makefile.in | 1 | ||||
-rw-r--r-- | projects/Makefile.in | 1 | ||||
-rw-r--r-- | src/Makefile.in | 1 | ||||
-rw-r--r-- | src/po-gram-gen.c | 41 | ||||
-rw-r--r-- | src/po-hash-gen.c | 55 | ||||
-rw-r--r-- | src/po-hash-gen.h | 2 | ||||
-rw-r--r-- | src/x-java.c | 299 | ||||
-rw-r--r-- | tests/Makefile.in | 1 |
19 files changed, 514 insertions, 310 deletions
@@ -164,122 +164,128 @@ Available Packages ================== Languages are not equally supported in all packages. The following -matrix shows the current state of internationalization, as of May 2001. -The matrix shows, in regard of each package, for which languages PO -files have been submitted to translation coordination, with a +matrix shows the current state of internationalization, as of September +2001. The matrix shows, in regard of each package, for which languages +PO files have been submitted to translation coordination, with a translation percentage of at least 50%. - Ready PO files bg cs da de el en eo es et fi fr gl he hr id it - +-------------------------------------------------+ - a2ps | [] [] | - bash | [] [] [] [] | - bfd | | - binutils | | - bison | [] [] [] [] | - clisp | [] [] [] [] | - cpio | [] [] [] [] | - diffutils | [] [] [] [] [] [] [] | - enscript | [] [] | - error | [] [] | - fetchmail | | - fileutils | [] [] [] [] [] [] [] | - findutils | [] [] [] [] [] [] [] [] | - flex | [] [] [] | - gas | | - gawk | [] | - gcal | | - gcc | [] | - gettext | [] [] [] [] [] [] [] [] [] | - gnupg | [] [] [] [] [] | - gprof | | - grep | [] [] [] [] [] [] [] | - hello | [] [] [] [] [] [] [] [] [] [] | - id-utils | [] [] [] | - indent | [] [] [] [] [] | - jpilot | | - kbd | | - ld | | - libc | [] [] [] [] [] [] [] [] | - lilypond | | - lynx | [] [] [] | - m4 | [] [] [] [] [] [] [] | - make | [] [] [] [] [] | - nano | [] | - opcodes | | - parted | [] [] | - ptx | [] [] [] [] [] [] [] | - python | | - recode | [] [] [] [] [] [] [] [] [] | - sed | [] [] [] [] [] [] [] [] [] [] | - sh-utils | [] [] [] [] [] [] [] [] [] | - sharutils | [] [] [] [] [] [] [] | - soundtracker | | - sp | | - tar | [] [] [] [] [] [] [] [] | - texinfo | [] [] [] [] [] | - textutils | [] [] [] [] [] [] [] | - util-linux | [] [] | - wdiff | [] [] | - wget | [] [] [] [] [] [] [] [] [] | - +-------------------------------------------------+ - bg cs da de el en eo es et fi fr gl he hr id it - 0 13 24 30 11 1 8 21 13 1 28 18 3 0 8 10 + Ready PO files bg cs da de el en eo es et fi fr gl he hr id it ja + +----------------------------------------------------+ + a2ps | [] [] [] | + bash | [] [] [] [] | + bfd | | + binutils | [] | + bison | [] [] [] [] [] | + clisp | [] [] [] [] | + cpio | [] [] [] [] [] | + diffutils | [] [] [] [] [] [] [] | + enscript | [] [] | + error | [] [] | + fetchmail | | + fileutils | [] [] [] [] [] [] [] [] | + findutils | [] [] [] [] [] [] [] [] | + flex | [] [] [] | + freetype | | + gas | | + gawk | [] [] | + gcal | | + gcc | | + gettext | [] [] [] [] [] [] [] [] [] [] | + gnupg | [] [] [] [] [] [] [] | + gprof | | + grep | [] [] [] [] [] [] [] [] | + hello | [] [] [] [] [] [] [] [] [] [] [] | + id-utils | [] [] [] | + indent | [] [] [] [] [] | + jpilot | [] | + kbd | | + ld | [] | + libc | [] [] [] [] [] [] [] [] | + lilypond | [] | + lynx | [] [] [] [] | + m4 | [] [] [] [] [] [] [] [] | + make | [] [] [] [] [] [] | + mysecretdiary | [] | + nano | [] [] [] | + opcodes | | + parted | [] [] [] | + ptx | [] [] [] [] [] [] [] | + python | | + recode | [] [] [] [] [] [] [] [] [] | + sed | [] [] [] [] [] [] [] [] [] [] [] [] | + sh-utils | [] [] [] [] [] [] [] [] [] [] | + sharutils | [] [] [] [] [] [] [] [] | + sketch | | + soundtracker | [] [] [] | + sp | | + tar | [] [] [] [] [] [] [] [] | + texinfo | [] [] [] [] [] [] | + textutils | [] [] [] [] [] [] [] [] | + util-linux | [] [] | + wdiff | [] [] [] | + wget | [] [] [] [] [] [] [] [] [] [] | + +----------------------------------------------------+ + bg cs da de el en eo es et fi fr gl he hr id it ja + 0 14 24 32 11 1 8 23 13 1 33 22 4 0 7 9 18 - ja ko lv nl no pl pt pt_BR ru sk sl sv tr uk zh - +-------------------------------------------------+ - a2ps | [] [] [] | 5 - bash | | 4 - bfd | | 0 - binutils | | 0 - bison | [] [] [] | 7 - clisp | [] | 5 - cpio | [] [] [] [] [] | 9 - diffutils | [] [] [] | 10 - enscript | [] [] [] | 5 - error | [] | 3 - fetchmail | | 0 - fileutils | [] [] [] [] [] [] [] [] [] [] | 17 - findutils | [] [] [] [] [] [] [] [] | 16 - flex | [] [] [] | 6 - gas | | 0 - gawk | | 1 - gcal | | 0 - gcc | [] | 2 - gettext | [] [] [] [] [] [] [] [] [] | 18 - gnupg | [] [] [] [] | 9 - gprof | | 0 - grep | [] [] [] | 10 - hello | [] [] [] [] [] [] [] [] [] [] [] | 21 - id-utils | [] [] [] | 6 - indent | [] [] [] [] [] [] [] | 12 - jpilot | | 0 - kbd | [] | 1 - ld | | 0 - libc | [] [] [] [] [] [] [] [] [] | 17 - lilypond | [] | 1 - lynx | [] [] [] [] [] | 8 - m4 | [] [] [] [] [] | 12 - make | [] [] [] [] [] [] [] | 12 - nano | | 1 - opcodes | | 0 - parted | [] [] [] | 5 - ptx | [] [] [] [] [] [] [] | 14 - python | | 0 - recode | [] [] [] [] | 13 - sed | [] [] [] [] [] [] [] [] | 18 - sh-utils | [] [] [] [] [] [] [] [] [] [] [] | 20 - sharutils | [] [] [] [] | 11 - soundtracker | | 0 - sp | | 0 - tar | [] [] [] [] [] [] [] [] [] | 17 - texinfo | [] [] | 7 - textutils | [] [] [] [] [] [] [] [] | 15 - util-linux | [] [] | 4 - wdiff | [] [] | 4 - wget | [] [] [] [] [] [] | 15 - +-------------------------------------------------+ - 31 teams ja ko lv nl no pl pt pt_BR ru sk sl sv tr uk zh - 50 domains 17 9 1 23 6 17 1 13 26 9 11 19 17 1 2 361 + ko lv nb nl nn no pl pt pt_BR ru sk sl sv tr uk zh + +----------------------------------------------------+ + a2ps | [] [] [] | 6 + bash | | 4 + bfd | | 0 + binutils | | 1 + bison | [] | 6 + clisp | [] | 5 + cpio | [] [] [] [] [] | 10 + diffutils | [] [] [] [] | 11 + enscript | [] [] [] | 5 + error | [] [] | 4 + fetchmail | | 0 + fileutils | [] [] [] [] [] [] [] [] [] | 17 + findutils | [] [] [] [] [] [] [] [] | 16 + flex | [] [] [] | 6 + freetype | | 0 + gas | | 0 + gawk | [] | 3 + gcal | | 0 + gcc | | 0 + gettext | [] [] [] [] [] [] [] [] | 18 + gnupg | [] [] [] | 10 + gprof | | 0 + grep | [] [] [] [] | 12 + hello | [] [] [] [] [] [] [] [] [] [] [] | 22 + id-utils | [] [] [] | 6 + indent | [] [] [] [] [] [] [] | 12 + jpilot | | 1 + kbd | [] | 1 + ld | | 1 + libc | [] [] [] [] [] [] [] [] | 16 + lilypond | [] [] | 3 + lynx | [] [] [] [] | 8 + m4 | [] [] [] [] | 12 + make | [] [] [] [] [] [] | 12 + mysecretdiary | | 1 + nano | [] | 4 + opcodes | [] | 1 + parted | [] [] | 5 + ptx | [] [] [] [] [] [] [] [] | 15 + python | | 0 + recode | [] [] [] [] | 13 + sed | [] [] [] [] [] [] [] | 19 + sh-utils | [] [] [] [] [] [] [] [] [] [] [] | 21 + sharutils | [] [] [] | 11 + sketch | | 0 + soundtracker | | 3 + sp | | 0 + tar | [] [] [] [] [] [] [] | 15 + texinfo | [] | 7 + textutils | [] [] [] [] [] [] [] [] | 16 + util-linux | [] [] | 4 + wdiff | [] [] [] [] | 7 + wget | [] [] [] [] [] [] [] | 17 + +----------------------------------------------------+ + 33 teams ko lv nb nl nn no pl pt pt_BR ru sk sl sv tr uk zh + 53 domains 9 1 6 20 0 6 17 1 13 25 10 11 23 21 2 2 387 Some counters in the preceding matrix are higher than the number of visible blocks let us expect. This is because a few extra PO files are @@ -292,9 +298,9 @@ distributed as such by its maintainer. There might be an observable lag between the mere existence a PO file and its wide availability in a distribution. - If May 2001 seems to be old, you may fetch a more recent copy of -this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date -matrix with full percentage details can be found at + If September 2001 seems to be old, you may fetch a more recent copy +of this `ABOUT-NLS' file on most GNU archive sites. The most +up-to-date matrix with full percentage details can be found at `http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'. Using `gettext' in new packages @@ -302,14 +308,15 @@ Using `gettext' in new packages If you are writing a freely available program and want to internationalize it you are welcome to use GNU `gettext' in your -package. Of course the GNU General Public License applies to your -sources from then on if you include `gettext' directly in your -distribution but since you are writing free software anyway this is no -restriction. - - Once the sources are change appropriately and the setup can handle to -use of `gettext' the only thing missing are the translations. The Free -Translation Project is also available for packages which are not +package. Of course you have to respect the GNU Library General Public +License which covers the use of the GNU `gettext' library. This means +in particular that even non-free programs can use `libintl' as a shared +library, whereas only free software can use `libintl' as a static +library or use modified versions of `libintl'. + + Once the sources are changed appropriately and the setup can handle +to use of `gettext' the only thing missing are the translations. The +Free Translation Project is also available for packages which are not developed inside the GNU project. Therefore the information given above applies also for every other Free Software Project. Contact `translation@iro.umontreal.ca' to make the `.pot' files available to diff --git a/Makefile.in b/Makefile.in index ca793ef..8ed8c2a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -109,7 +109,6 @@ RANLIB = @RANLIB@ STDBOOL_H = @STDBOOL_H@ STRIP = @STRIP@ TESTJAVA = @TESTJAVA@ -TEXI2HTML = @TEXI2HTML@ TEXI2PDF = @TEXI2PDF@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ @@ -4617,9 +4617,9 @@ AC_DEFUN([AM_GNU_GETTEXT], AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ stdlib.h string.h unistd.h sys/param.h]) - AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \ -getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strcasecmp strdup \ -strtoul tsearch __argz_count __argz_stringify __argz_next]) + AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ +geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ +strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) AM_ICONV AM_LANGINFO_CODESET @@ -4724,7 +4724,7 @@ return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "" INTLOBJS="\$(GETTOBJS)" BUILD_INCLUDED_LIBINTL=yes USE_INCLUDED_LIBINTL=yes - INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV" + INTLLIBS="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV" LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi diff --git a/config.h.in b/config.h.in index 36994c1..28fb5e9 100644 --- a/config.h.in +++ b/config.h.in @@ -100,6 +100,9 @@ /* Define if you have the fgets_unlocked function. */ #undef HAVE_FGETS_UNLOCKED +/* Define if you have the getc_unlocked function. */ +#undef HAVE_GETC_UNLOCKED + /* Define if you have the getcwd function. */ #undef HAVE_GETCWD @@ -169,6 +172,9 @@ /* Define if you have the posix_spawn function. */ #undef HAVE_POSIX_SPAWN +/* Define if you have the putc_unlocked function. */ +#undef HAVE_PUTC_UNLOCKED + /* Define if you have the putenv function. */ #undef HAVE_PUTENV @@ -6567,8 +6567,8 @@ fi fi -for ac_func in getcwd mblen memcpy posix_spawn raise select strerror uname \ -utime utimes +for ac_func in getcwd mblen memcpy posix_spawn putc_unlocked raise select \ +strerror uname utime utimes do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:6575: checking for $ac_func" >&5 @@ -9051,9 +9051,9 @@ else fi done - for ac_func in feof_unlocked fgets_unlocked getcwd getegid geteuid \ -getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strcasecmp strdup \ -strtoul tsearch __argz_count __argz_stringify __argz_next + for ac_func in feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ +geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ +strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:9060: checking for $ac_func" >&5 @@ -9530,7 +9530,7 @@ done INTLOBJS="\$(GETTOBJS)" BUILD_INCLUDED_LIBINTL=yes USE_INCLUDED_LIBINTL=yes - INTLLIBS="\$(top_builddir)/intl/libintl.la $LIBICONV" + INTLLIBS="\${top_builddir}/intl/libintl.la $LIBICONV" LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi @@ -9937,49 +9937,10 @@ else echo "$ac_t""no" 1>&6 fi -# Extract the first word of "texi2html", so it can be a program name with args. -set dummy texi2html; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:9944: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_TEXI2HTML'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$TEXI2HTML" in - /*) - ac_cv_path_TEXI2HTML="$TEXI2HTML" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_TEXI2HTML="$TEXI2HTML" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_TEXI2HTML="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_TEXI2HTML" && ac_cv_path_TEXI2HTML="$ac_aux_dir_abs/missing texi2html" - ;; -esac -fi -TEXI2HTML="$ac_cv_path_TEXI2HTML" -if test -n "$TEXI2HTML"; then - echo "$ac_t""$TEXI2HTML" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -CROSS_COMPILING=$cross_compiling - # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:9983: checking for $ac_word" >&5 +echo "configure:9944: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10013,6 +9974,9 @@ else fi +CROSS_COMPILING=$cross_compiling + + test -d intl || mkdir intl echo "GNU gettext library from $PACKAGE-$VERSION" > intl/VERSION cat > intl/ChangeLog.inst <<EOF @@ -10249,9 +10213,8 @@ s%@lispdir@%$lispdir%g s%@aclocaldir@%$aclocaldir%g s%@DVIPS@%$DVIPS%g s%@TEXI2PDF@%$TEXI2PDF%g -s%@TEXI2HTML@%$TEXI2HTML%g -s%@CROSS_COMPILING@%$CROSS_COMPILING%g s%@PERL@%$PERL%g +s%@CROSS_COMPILING@%$CROSS_COMPILING%g CEOF EOF diff --git a/doc/Makefile.in b/doc/Makefile.in index 86c74d8..71f47bc 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -123,10 +123,6 @@ lispdir = @lispdir@ DVIPS = @DVIPS@ -D600 -# Documentation in HTML format. -TEXI2HTML = @TEXI2HTML@ - - # Documentation in Portable Document Format. TEXI2PDF = @TEXI2PDF@ @@ -144,7 +140,13 @@ RM = rm -f MAKEINFO = env LANG= LANGUAGE= @MAKEINFO@ info_TEXINFOS = gettext.texi -gettext_TEXINFOS = iso-639.texi iso-3166.texi +# List of texinfo sources @included by gettext.texi, excluding version.texi. +gettext_TEXINFOS = \ + xgettext.texi msginit.texi msgmerge.texi msgcat.texi msgconv.texi \ + msggrep.texi msgexec.texi msguniq.texi msgcomm.texi msgcmp.texi \ + msgattrib.texi msgen.texi msgfmt.texi msgunfmt.texi \ + iso-639.texi iso-3166.texi + EXTRA_DIST = iso-639.sed iso-3166.sed ISO_639 ISO_3166 nls.texi matrix.texi $(EXTRA_DIST_html) @@ -153,6 +155,10 @@ CLEANFILES = gettext.pdf gettext.html # gettext.dvi and gettext.ps are already known to automake. MAINTAINERCLEANFILES = gettext_*.html SUFFIXES = .pdf + + +# Documentation in HTML format. +TEXI2HTML = @PERL@ $(srcdir)/texi2html subdir = doc mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h @@ -474,8 +480,8 @@ gettext.html: gettext.texi version.texi $(gettext_TEXINFOS) $(TEXI2HTML) -expandinfo -number -monolithic `if test -f gettext.texi; then echo gettext.texi; else echo $(srcdir)/gettext.texi; fi` gettext_toc.html: gettext.texi version.texi $(gettext_TEXINFOS) - case "$(TEXI2HTML)" in \ - *"/missing texi2html") \ + case "@PERL@" in \ + *"/missing perl") \ $(TEXI2HTML) -expandinfo -number -split_chapter `if test -f gettext.texi; then echo gettext.texi; else echo $(srcdir)/gettext.texi; fi` || exit 0 ;; \ *) $(RM) gettext_*.html ; \ $(TEXI2HTML) -expandinfo -number -split_chapter `if test -f gettext.texi; then echo gettext.texi; else echo $(srcdir)/gettext.texi; fi` ;; \ diff --git a/intl-java/Makefile.in b/intl-java/Makefile.in index 247ba2a..cf15bbd 100644 --- a/intl-java/Makefile.in +++ b/intl-java/Makefile.in @@ -108,7 +108,6 @@ RANLIB = @RANLIB@ STDBOOL_H = @STDBOOL_H@ STRIP = @STRIP@ TESTJAVA = @TESTJAVA@ -TEXI2HTML = @TEXI2HTML@ TEXI2PDF = @TEXI2PDF@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ @@ -268,7 +267,9 @@ libintl.jar: gnu/gettext/GettextResource.class install-data-local: install-java-@BUILDJAVA@ install-java-no: + $(mkinstalldirs) $(DESTDIR)$(jardir) install-java-yes: all-java-yes + $(mkinstalldirs) $(DESTDIR)$(jardir) $(INSTALL_DATA) libintl.jar $(DESTDIR)$(jardir)/libintl.jar installdirs-local: diff --git a/intl/plural.c b/intl/plural.c index 8191335..d2668e5 100644 --- a/intl/plural.c +++ b/intl/plural.c @@ -23,19 +23,20 @@ Copyright (C) 2000, 2001 Free Software Foundation, Inc. Written by Ulrich Drepper <drepper@cygnus.com>, 2000. - 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) + This program 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, or (at your option) any later version. This program 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ /* The bison generated parser uses alloca. AIX 3 forces us to put this declaration at the beginning of the file. The declaration in bison's @@ -50,29 +51,24 @@ #endif #include <stdlib.h> -#include "gettextP.h" - -/* Names for the libintl functions are a problem. They must not clash - with existing names and they should follow ANSI C. But this source - code is also used in GNU C Library where the names have a __ - prefix. So we have to make a difference here. */ -#ifdef _LIBC -# define FREE_EXPRESSION __gettext_free_exp -#else -# define FREE_EXPRESSION gettext_free_exp__ -# define __gettextparse gettextparse__ +#include "plural-exp.h" + +/* The main function generated by the parser is called __gettextparse, + but we want it to be called PLURAL_PARSE. */ +#ifndef _LIBC +# define __gettextparse PLURAL_PARSE #endif #define YYLEX_PARAM &((struct parse_args *) arg)->cp #define YYPARSE_PARAM arg -#line 52 "plural.y" +#line 48 "plural.y" typedef union { unsigned long int num; enum operator op; struct expression *exp; } YYSTYPE; -#line 58 "plural.y" +#line 54 "plural.y" /* Prototypes for local functions. */ static struct expression *new_exp PARAMS ((int nargs, enum operator op, @@ -234,8 +230,8 @@ static const short yyrhs[] = { 17, #if YYDEBUG != 0 static const short yyrline[] = { 0, - 177, 185, 189, 193, 197, 201, 205, 209, 213, 217, - 221, 226 + 173, 181, 185, 189, 193, 197, 201, 205, 209, 213, + 217, 222 }; #endif @@ -845,7 +841,7 @@ yyreduce: switch (yyn) { case 1: -#line 178 "plural.y" +#line 174 "plural.y" { if (yyvsp[0].exp == NULL) YYABORT; @@ -853,68 +849,68 @@ case 1: ; break;} case 2: -#line 186 "plural.y" +#line 182 "plural.y" { yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp); ; break;} case 3: -#line 190 "plural.y" +#line 186 "plural.y" { yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp); ; break;} case 4: -#line 194 "plural.y" +#line 190 "plural.y" { yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp); ; break;} case 5: -#line 198 "plural.y" +#line 194 "plural.y" { yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); ; break;} case 6: -#line 202 "plural.y" +#line 198 "plural.y" { yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); ; break;} case 7: -#line 206 "plural.y" +#line 202 "plural.y" { yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); ; break;} case 8: -#line 210 "plural.y" +#line 206 "plural.y" { yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); ; break;} case 9: -#line 214 "plural.y" +#line 210 "plural.y" { yyval.exp = new_exp_1 (lnot, yyvsp[0].exp); ; break;} case 10: -#line 218 "plural.y" +#line 214 "plural.y" { yyval.exp = new_exp_0 (var); ; break;} case 11: -#line 222 "plural.y" +#line 218 "plural.y" { if ((yyval.exp = new_exp_0 (num)) != NULL) yyval.exp->val.num = yyvsp[0].num; ; break;} case 12: -#line 227 "plural.y" +#line 223 "plural.y" { yyval.exp = yyvsp[-1].exp; ; @@ -1141,7 +1137,7 @@ yyerrhandle: } return 1; } -#line 232 "plural.y" +#line 228 "plural.y" void diff --git a/lib/Makefile.in b/lib/Makefile.in index b6e91fc..7708dd0 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -109,7 +109,6 @@ RANLIB = @RANLIB@ STDBOOL_H = @STDBOOL_H@ STRIP = @STRIP@ TESTJAVA = @TESTJAVA@ -TEXI2HTML = @TEXI2HTML@ TEXI2PDF = @TEXI2PDF@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ diff --git a/m4/Makefile.in b/m4/Makefile.in index 97b807e..c2fbee4 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -109,7 +109,6 @@ RANLIB = @RANLIB@ STDBOOL_H = @STDBOOL_H@ STRIP = @STRIP@ TESTJAVA = @TESTJAVA@ -TEXI2HTML = @TEXI2HTML@ TEXI2PDF = @TEXI2PDF@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ diff --git a/man/Makefile.in b/man/Makefile.in index f16efbb..a2c5d5a 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -107,7 +107,6 @@ RANLIB = @RANLIB@ STDBOOL_H = @STDBOOL_H@ STRIP = @STRIP@ TESTJAVA = @TESTJAVA@ -TEXI2HTML = @TEXI2HTML@ TEXI2PDF = @TEXI2PDF@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ diff --git a/misc/Makefile.in b/misc/Makefile.in index 719f820..9f6e48e 100644 --- a/misc/Makefile.in +++ b/misc/Makefile.in @@ -109,7 +109,6 @@ RANLIB = @RANLIB@ STDBOOL_H = @STDBOOL_H@ STRIP = @STRIP@ TESTJAVA = @TESTJAVA@ -TEXI2HTML = @TEXI2HTML@ TEXI2PDF = @TEXI2PDF@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ diff --git a/projects/Makefile.in b/projects/Makefile.in index 4bc474f..8a4e07f 100644 --- a/projects/Makefile.in +++ b/projects/Makefile.in @@ -109,7 +109,6 @@ RANLIB = @RANLIB@ STDBOOL_H = @STDBOOL_H@ STRIP = @STRIP@ TESTJAVA = @TESTJAVA@ -TEXI2HTML = @TEXI2HTML@ TEXI2PDF = @TEXI2PDF@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ diff --git a/src/Makefile.in b/src/Makefile.in index 66f923e..98017e1 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -108,7 +108,6 @@ RANLIB = @RANLIB@ STDBOOL_H = @STDBOOL_H@ STRIP = @STRIP@ TESTJAVA = @TESTJAVA@ -TEXI2HTML = @TEXI2HTML@ TEXI2PDF = @TEXI2PDF@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ diff --git a/src/po-gram-gen.c b/src/po-gram-gen.c index d9ba087..9e09e11 100644 --- a/src/po-gram-gen.c +++ b/src/po-gram-gen.c @@ -20,13 +20,16 @@ # include "config.h" #endif +/* Specification. */ +#include "po-gram.h" + #include <stdio.h> +#include <stdlib.h> #include "str-list.h" #include "po-lex.h" -#include "po-gram.h" #include "error.h" -#include "system.h" +#include "xmalloc.h" #include "libgettext.h" #include "po.h" @@ -86,7 +89,7 @@ static long plural_counter; po_gram_error_at_line (&(value2).pos, _("inconsistent use of #~")); -#line 103 "po-gram-gen.y" +#line 106 "po-gram-gen.y" typedef union { struct { char *string; lex_pos_ty pos; bool obsolete; } string; @@ -160,8 +163,8 @@ static const short yyrhs[] = { -1, #if YYDEBUG != 0 static const short yyrline[] = { 0, - 123, 124, 125, 126, 127, 131, 138, 156, 174, 182, - 190, 199, 210, 214, 229, 251, 258, 269 + 126, 127, 128, 129, 130, 134, 141, 159, 177, 185, + 193, 202, 213, 217, 232, 254, 261, 272 }; #endif @@ -764,13 +767,13 @@ yyreduce: switch (yyn) { case 6: -#line 132 "po-gram-gen.y" +#line 135 "po-gram-gen.y" { po_callback_domain (yyvsp[0].string.string); ; break;} case 7: -#line 139 "po-gram-gen.y" +#line 142 "po-gram-gen.y" { char *string2 = string_list_concat_destroy (&yyvsp[-2].stringlist.stringlist); char *string4 = string_list_concat_destroy (&yyvsp[0].stringlist.stringlist); @@ -790,7 +793,7 @@ case 7: ; break;} case 8: -#line 157 "po-gram-gen.y" +#line 160 "po-gram-gen.y" { char *string2 = string_list_concat_destroy (&yyvsp[-2].stringlist.stringlist); @@ -810,7 +813,7 @@ case 8: ; break;} case 9: -#line 175 "po-gram-gen.y" +#line 178 "po-gram-gen.y" { check_obsolete (yyvsp[-2].pos, yyvsp[-1].stringlist); check_obsolete (yyvsp[-2].pos, yyvsp[0].string); @@ -820,7 +823,7 @@ case 9: ; break;} case 10: -#line 183 "po-gram-gen.y" +#line 186 "po-gram-gen.y" { check_obsolete (yyvsp[-2].pos, yyvsp[-1].stringlist); check_obsolete (yyvsp[-2].pos, yyvsp[0].rhs); @@ -830,7 +833,7 @@ case 10: ; break;} case 11: -#line 191 "po-gram-gen.y" +#line 194 "po-gram-gen.y" { check_obsolete (yyvsp[-1].pos, yyvsp[0].stringlist); po_gram_error_at_line (&yyvsp[-1].pos.pos, _("missing `msgstr' section")); @@ -838,7 +841,7 @@ case 11: ; break;} case 12: -#line 200 "po-gram-gen.y" +#line 203 "po-gram-gen.y" { check_obsolete (yyvsp[-1].pos, yyvsp[0].stringlist); plural_counter = 0; @@ -848,13 +851,13 @@ case 12: ; break;} case 13: -#line 211 "po-gram-gen.y" +#line 214 "po-gram-gen.y" { yyval.rhs = yyvsp[0].rhs; ; break;} case 14: -#line 215 "po-gram-gen.y" +#line 218 "po-gram-gen.y" { check_obsolete (yyvsp[-1].rhs, yyvsp[0].rhs); yyval.rhs.rhs.msgstr = (char *) xmalloc (yyvsp[-1].rhs.rhs.msgstr_len + yyvsp[0].rhs.rhs.msgstr_len); @@ -868,7 +871,7 @@ case 14: ; break;} case 15: -#line 230 "po-gram-gen.y" +#line 233 "po-gram-gen.y" { check_obsolete (yyvsp[-4].pos, yyvsp[-3].pos); check_obsolete (yyvsp[-4].pos, yyvsp[-2].number); @@ -889,7 +892,7 @@ case 15: ; break;} case 16: -#line 252 "po-gram-gen.y" +#line 255 "po-gram-gen.y" { string_list_init (&yyval.stringlist.stringlist); string_list_append (&yyval.stringlist.stringlist, yyvsp[0].string.string); @@ -898,7 +901,7 @@ case 16: ; break;} case 17: -#line 259 "po-gram-gen.y" +#line 262 "po-gram-gen.y" { check_obsolete (yyvsp[-1].stringlist, yyvsp[0].string); yyval.stringlist.stringlist = yyvsp[-1].stringlist.stringlist; @@ -908,7 +911,7 @@ case 17: ; break;} case 18: -#line 270 "po-gram-gen.y" +#line 273 "po-gram-gen.y" { po_callback_comment (yyvsp[0].string.string); ; @@ -1135,4 +1138,4 @@ yyerrhandle: } return 1; } -#line 274 "po-gram-gen.y" +#line 277 "po-gram-gen.y" diff --git a/src/po-hash-gen.c b/src/po-hash-gen.c index c229dad..68d8208 100644 --- a/src/po-hash-gen.c +++ b/src/po-hash-gen.c @@ -19,10 +19,13 @@ # include "config.h" #endif +/* Specification. */ +#include "po-hash.h" + #include <stdio.h> +#include <stdlib.h> -#include <system.h> -#include "po-hash.h" +#include "xmalloc.h" #include "po.h" /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc), @@ -73,13 +76,13 @@ #define yycheck po_hash_yycheck -#line 89 "po-hash-gen.y" +#line 92 "po-hash-gen.y" typedef union { char *string; - int number; + size_t number; } YYSTYPE; -#line 98 "po-hash-gen.y" +#line 101 "po-hash-gen.y" static const char *cur; @@ -154,20 +157,20 @@ static const char yytranslate[] = { 0, #if YYDEBUG != 0 static const short yyprhs[] = { 0, - 0, 1, 4, 8, 16, 25 + 0, 1, 4, 8, 10, 18, 27 }; static const short yyrhs[] = { -1, - 10, 11, 0, 3, 5, 4, 0, 7, 5, 3, - 6, 8, 5, 4, 0, 7, 5, 3, 6, 8, - 9, 5, 4, 0, 7, 5, 4, 0 + 10, 11, 0, 3, 5, 4, 0, 3, 0, 7, + 5, 3, 6, 8, 5, 4, 0, 7, 5, 3, + 6, 8, 9, 5, 4, 0, 7, 5, 4, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, - 129, 130, 134, 140, 146, 152 + 132, 133, 137, 143, 149, 155, 161 }; #endif @@ -181,16 +184,16 @@ static const char * const yytname[] = { "$","error","$undefined.","STRING", #endif static const short yyr1[] = { 0, - 10, 10, 11, 11, 11, 11 + 10, 10, 11, 11, 11, 11, 11 }; static const short yyr2[] = { 0, - 0, 2, 3, 7, 8, 3 + 0, 2, 3, 1, 7, 8, 3 }; static const short yydefact[] = { 1, - 0, 0, 0, 2, 0, 0, 3, 0, 6, 0, - 0, 0, 0, 4, 0, 5, 0, 0 + 0, 4, 0, 2, 0, 0, 3, 0, 7, 0, + 0, 0, 0, 5, 0, 6, 0, 0 }; static const short yydefgoto[] = { 1, @@ -763,7 +766,7 @@ yyreduce: switch (yyn) { case 3: -#line 135 "po-hash-gen.y" +#line 138 "po-hash-gen.y" { /* GNU style */ po_callback_comment_filepos (yyvsp[-2].string, yyvsp[0].number); @@ -771,23 +774,31 @@ case 3: ; break;} case 4: -#line 141 "po-hash-gen.y" +#line 144 "po-hash-gen.y" +{ + /* GNU style, without line number (e.g. from Pascal .rst) */ + po_callback_comment_filepos (yyvsp[0].string, (size_t)(-1)); + free (yyvsp[0].string); + ; + break;} +case 5: +#line 150 "po-hash-gen.y" { /* SunOS style */ po_callback_comment_filepos (yyvsp[-4].string, yyvsp[0].number); free (yyvsp[-4].string); ; break;} -case 5: -#line 147 "po-hash-gen.y" +case 6: +#line 156 "po-hash-gen.y" { /* Solaris style */ po_callback_comment_filepos (yyvsp[-5].string, yyvsp[0].number); free (yyvsp[-5].string); ; break;} -case 6: -#line 153 "po-hash-gen.y" +case 7: +#line 162 "po-hash-gen.y" { /* GNU style, but STRING is `file'. Esoteric, but it happened. */ @@ -1016,7 +1027,7 @@ yyerrhandle: } return 1; } -#line 160 "po-hash-gen.y" +#line 169 "po-hash-gen.y" @@ -1026,7 +1037,7 @@ yylex () static char *buf; static size_t bufmax; size_t bufpos; - int n; + size_t n; int c; for (;;) diff --git a/src/po-hash-gen.h b/src/po-hash-gen.h index a4dc2f9..3d63722 100644 --- a/src/po-hash-gen.h +++ b/src/po-hash-gen.h @@ -1,7 +1,7 @@ typedef union { char *string; - int number; + size_t number; } YYSTYPE; #define STRING 257 #define NUMBER 258 diff --git a/src/x-java.c b/src/x-java.c index fde59f8..97a109b 100644 --- a/src/x-java.c +++ b/src/x-java.c @@ -431,13 +431,16 @@ char *yytext; # include <config.h> #endif +#include <ctype.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include "message.h" #include "x-java.h" #include "xgettext.h" -#include "system.h" +#include "xmalloc.h" +#include "strstr.h" typedef enum { @@ -480,6 +483,24 @@ typedef struct } char_buf; +typedef struct _object_list +{ + int num_obj; + int max_num_obj; + void **objects; +} object_list; + +#define INITIAL_OBJECT_LIST_SIZE 10 +#define OBJECT_LIST_GROWTH 10 + +typedef struct _java_keyword +{ + char *keyword; + int msgid_arg; + int msgid_plural_arg; +} java_keyword; + + /* Prototypes for local functions. Needed to ensure compiler checking of function argument counts despite of K&R C function definition syntax. */ static char_buf *create_char_buf PARAMS ((void)); @@ -492,7 +513,7 @@ static inline bool isplus PARAMS ((char *s)); static inline bool isdot PARAMS ((char *s)); static char *translate_esc PARAMS ((char *s)); static bool do_compare PARAMS ((const char *s1, const char *s2)); -static bool is_keyword PARAMS ((const char *s)); +static java_keyword *is_keyword PARAMS ((const char *s)); static void free_global PARAMS ((void)); @@ -546,7 +567,17 @@ update_line_no (c) parser_global->line_no++; } -#line 550 "x-java.c-tmp" +static void +strip_ending_spaces (str) + char *str; +{ + int len = strlen (str); + + while (isspace (str[len--])) + ; + str[len] = '\0'; +} +#line 581 "x-java.c-tmp" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -697,10 +728,10 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 146 "./x-java.l" +#line 177 "./x-java.l" -#line 704 "x-java.c-tmp" +#line 735 "x-java.c-tmp" if ( yy_init ) { @@ -785,7 +816,7 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 148 "./x-java.l" +#line 179 "./x-java.l" { int c; int last; @@ -804,18 +835,19 @@ YY_RULE_SETUP } str = get_string (charbuf); destroy_charbuf (charbuf); + strip_ending_spaces (str); parser_global->comment = str; return JAVA_COMMENT; } YY_BREAK case 2: YY_RULE_SETUP -#line 170 "./x-java.l" +#line 202 "./x-java.l" YY_BREAK case 3: YY_RULE_SETUP -#line 171 "./x-java.l" +#line 203 "./x-java.l" { int c; char *str; @@ -833,7 +865,7 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 186 "./x-java.l" +#line 218 "./x-java.l" { parser_global->word = yytext; return JAVA_WORD; @@ -841,7 +873,7 @@ YY_RULE_SETUP YY_BREAK case 5: YY_RULE_SETUP -#line 191 "./x-java.l" +#line 223 "./x-java.l" { parser_global->flow = yytext; return JAVA_FLOW; @@ -849,7 +881,7 @@ YY_RULE_SETUP YY_BREAK case 6: YY_RULE_SETUP -#line 196 "./x-java.l" +#line 228 "./x-java.l" { parser_global->operator = yytext; return JAVA_OPERATOR; @@ -857,12 +889,12 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -#line 201 "./x-java.l" +#line 233 "./x-java.l" /* ignore whitespace */ YY_BREAK case 8: YY_RULE_SETUP -#line 203 "./x-java.l" +#line 235 "./x-java.l" { parser_global->comment = xstrdup (yytext + 2); return JAVA_COMMENT; @@ -870,29 +902,29 @@ YY_RULE_SETUP YY_BREAK case 9: YY_RULE_SETUP -#line 207 "./x-java.l" +#line 239 "./x-java.l" parser_global->line_no++; YY_BREAK case 10: YY_RULE_SETUP -#line 208 "./x-java.l" +#line 240 "./x-java.l" YY_BREAK case 11: YY_RULE_SETUP -#line 209 "./x-java.l" +#line 241 "./x-java.l" YY_BREAK case YY_STATE_EOF(INITIAL): -#line 210 "./x-java.l" +#line 242 "./x-java.l" return -1; YY_BREAK case 12: YY_RULE_SETUP -#line 211 "./x-java.l" +#line 243 "./x-java.l" ECHO; YY_BREAK -#line 896 "x-java.c-tmp" +#line 928 "x-java.c-tmp" case YY_END_OF_BUFFER: { @@ -1776,7 +1808,7 @@ int main() return 0; } #endif -#line 211 "./x-java.l" +#line 243 "./x-java.l" static char * @@ -1831,18 +1863,142 @@ translate_esc (s) return n; } +static object_list * +object_list_alloc () +{ + object_list *list = xmalloc (sizeof (object_list)); + list->max_num_obj = INITIAL_OBJECT_LIST_SIZE; + list->num_obj = 0; + list->objects = xmalloc (sizeof (void *) * INITIAL_OBJECT_LIST_SIZE); + return list; +} + +static void +object_list_destroy (list) + object_list *list; +{ + free (list->objects); + free (list); +} + +static int +get_num_objects (list) + const object_list *list; +{ + return list->num_obj; +} + +static void * +get_object (list, i) + const object_list *list; + int i; +{ + return list->objects[i]; +} + +static void +add_object (list, object) + object_list *list; + void *object; +{ + if (list->num_obj + 1 >= list->max_num_obj) + { + // resize + list->max_num_obj += OBJECT_LIST_GROWTH; + list->objects = + xrealloc (list->objects, list->max_num_obj * sizeof (void *)); + } + list->objects[list->num_obj ++] = object; +} + /* options */ static bool extract_all_strings = false; void -x_java_extract_all () +x_java_extract_all () { extract_all_strings = true; } -static string_list_ty *java_keywords = NULL; + +static java_keyword * +alloc_keyword (keyword, arg1, arg2) + const char *keyword; + int arg1; + int arg2; +{ + java_keyword *jk = xmalloc (sizeof (java_keyword)); + jk->keyword = xstrdup (keyword); + jk->msgid_arg = arg1; + jk->msgid_plural_arg = arg2; + return jk; +} + +static object_list *java_keywords = NULL; + + +/** + * Extract the keyword from a keyword indata string. + */ +static char * +extract_keyword (key) + const char *key; +{ + char *s = strchr (key, ':'); + char *new_string; + + new_string = xstrdup (key); + if (s != NULL) + new_string[s - key] = '\0'; + return new_string; +} + +/** + * Extract the msgid arg number from a keyword indata string. + */ +static int +extract_msgid_arg (key) + const char *key; +{ + char *s = strchr (key, ':'); + int arg; + + if (s != NULL) + { + s ++; + arg = strtol (s, &s, 10); + } + else + { + arg = 1; + } + return arg; +} + +/** + * Extract the msgid plural arg number from a keyword indata string, + * if any. + */ +static int +extract_msgid_plural_arg (key) + const char *key; +{ + char *s = strchr (key, ','); + int arg; + if (s != NULL) + { + s ++; + arg = strtol (s, &s, 10); + } + else + { + arg = 0; + } + return arg; +} + /** * Try to match a string against the keyword. If substring_match is @@ -1862,16 +2018,22 @@ do_compare (s1, s2) /** * Check if a string is a keyword or not. */ -static bool +static java_keyword * is_keyword (s) const char *s; { int i; + int num_keywords = get_num_objects (java_keywords); + java_keyword *kw; - for (i = 0; i < java_keywords->nitems; i++) - if (do_compare (s, java_keywords->item[i])) - return true; - return false; + for (i = 0; i < num_keywords; i++) + { + kw = (java_keyword *) get_object (java_keywords, i); + + if (do_compare (s, kw->keyword)) + return kw; + } + return NULL; } /** @@ -1881,18 +2043,29 @@ void x_java_keyword (keyword) const char *keyword; { - if (keyword == NULL) { - if (java_keywords != NULL) { - string_list_destroy (java_keywords); - java_keywords = NULL; + int arg1; + int arg2; + char *kw; + + if (keyword == NULL) + { + if (java_keywords != NULL) + { + object_list_destroy (java_keywords); + java_keywords = NULL; + } + return; } - return; - } if (java_keywords == NULL) - java_keywords = string_list_alloc (); + { + java_keywords = object_list_alloc (); + } - string_list_append (java_keywords, keyword); + kw = extract_keyword (keyword); + arg1 = extract_msgid_arg (keyword); + arg2 = extract_msgid_plural_arg (keyword); + add_object (java_keywords, alloc_keyword (kw, arg1, arg2)); } @@ -1935,13 +2108,17 @@ extract_java (f, real_filename, logical_filename, mdlp) PARSER_STATE last_state = STATE_NONE; char *str; char *key; + message_ty *plural; message_list_ty *mlp = mdlp->item[0]->messages; + java_keyword *current_keyword = NULL; + java_keyword *keyword; + int argument_counter = 0; if (java_keywords == NULL) { /* ops, no standard keywords */ x_java_keyword ("gettext"); /* GettextResource.gettext */ - x_java_keyword ("ngettext"); /* GettextResource.ngettext */ + x_java_keyword ("ngettext:1,2"); /* GettextResource.ngettext */ x_java_keyword ("getString"); /* ResourceBundle.getString */ } @@ -1957,6 +2134,11 @@ extract_java (f, real_filename, logical_filename, mdlp) { case JAVA_WORD: + if (state == STATE_KEYWORD) + { + last_state = STATE_KEYWORD; + argument_counter ++; + } if (state == STATE_INVOCATION) { char *k2; @@ -1972,10 +2154,13 @@ extract_java (f, real_filename, logical_filename, mdlp) } /* For java we try to match both things like object.methodCall() and methodCall(). */ - if (is_keyword (key) || is_keyword (parser_global->word)) + if ((keyword = is_keyword (key)) != NULL + || (keyword = is_keyword (parser_global->word)) != NULL) { + current_keyword = keyword; free (key); state = STATE_KEYWORD; + argument_counter = 1; } break; @@ -2018,10 +2203,43 @@ extract_java (f, real_filename, logical_filename, mdlp) lex_pos_ty pos; pos.file_name = logical_file_name; pos.line_number = parser_global->line_no; - state = STATE_NONE; - last_state = STATE_NONE; + if (extract_all_strings) + { + remember_a_message (mlp, str, &pos); + } + else if (!extract_all_strings + && argument_counter == current_keyword->msgid_arg) + { + plural = remember_a_message (mlp, str, &pos); + if (current_keyword->msgid_plural_arg == 0) + { + /** + * we don't expect any plural arg, reset state + */ + state = STATE_NONE; + last_state = STATE_NONE; + argument_counter = 0; + } + else + { + argument_counter ++; + } - remember_a_message (mlp, str, &pos); + } + else if (!extract_all_strings && + argument_counter == current_keyword->msgid_plural_arg) + { + remember_a_message_plural (plural, str, &pos); + state = STATE_NONE; + last_state = STATE_NONE; + argument_counter = 0; + } + } + + if (extract_all_strings) + { + state = STATE_NONE; + last_state = STATE_NONE; } if (state == STATE_WORD && isdot (parser_global->flow)) @@ -2033,6 +2251,7 @@ extract_java (f, real_filename, logical_filename, mdlp) case JAVA_COMMENT: state = STATE_NONE; + last_state = STATE_NONE; xgettext_comment_add (parser_global->comment); break; diff --git a/tests/Makefile.in b/tests/Makefile.in index 9acd408..6efb88f 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -109,7 +109,6 @@ RANLIB = @RANLIB@ STDBOOL_H = @STDBOOL_H@ STRIP = @STRIP@ TESTJAVA = @TESTJAVA@ -TEXI2HTML = @TEXI2HTML@ TEXI2PDF = @TEXI2PDF@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ |