From: Bruno Haible Date: Sun, 24 Aug 2003 18:07:58 +0000 (+0000) Subject: New compilation unit plural-count.c. X-Git-Tag: v0.13~310 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f50ee79893eb955601dd2ae99f8bbe81fb56f0b;p=thirdparty%2Fgettext.git New compilation unit plural-count.c. --- diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index 54da418d5..63081f0b3 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,14 @@ +2003-08-24 Bruno Haible + + * plural-count.h: New file. + * plural-count.c: New file, extracted from msgmerge.c. + * Makefile.am (noinst_HEADERS): Add plural-count.h. + (msgmerge_SOURCES): Add plural-count.c. + * Makefile.msvc (msgmerge_OBJECTS): Add plural-count.obj. + (plural-count.obj): New rule. + * Makefile.vms (msgmerge_OBJECTS): Add plural-count.obj. + (plural-count.obj): New rule. + 2003-08-24 Bruno Haible Support for building DLLs on Windows. diff --git a/gettext-tools/src/Makefile.am b/gettext-tools/src/Makefile.am index 6bcadb0f2..7ad4999f9 100644 --- a/gettext-tools/src/Makefile.am +++ b/gettext-tools/src/Makefile.am @@ -38,11 +38,11 @@ noinst_HEADERS = pos.h message.h po-gram.h po-hash.h po-charset.h po-lex.h \ open-po.h read-po-abstract.h read-po.h read-properties.h str-list.h \ write-po.h write-properties.h dir-list.h file-list.h po-gram-gen.h \ po-gram-gen2.h po-hash-gen.h msgl-charset.h msgl-equal.h msgl-iconv.h \ -msgl-ascii.h msgl-cat.h msgl-english.h msgfmt.h msgunfmt.h read-mo.h \ -write-mo.h read-java.h write-java.h read-tcl.h write-tcl.h po-time.h \ -plural-table.h format.h xgettext.h x-c.h x-po.h x-python.h x-lisp.h x-elisp.h \ -x-librep.h x-smalltalk.h x-java.h x-properties.h x-awk.h x-ycp.h x-tcl.h \ -x-perl.h x-php.h x-rst.h x-glade.h +msgl-ascii.h msgl-cat.h msgl-english.h msgfmt.h msgunfmt.h plural-count.h \ +read-mo.h write-mo.h read-java.h write-java.h read-tcl.h write-tcl.h \ +po-time.h plural-table.h format.h xgettext.h x-c.h x-po.h x-python.h x-lisp.h \ +x-elisp.h x-librep.h x-smalltalk.h x-java.h x-properties.h x-awk.h x-ycp.h \ +x-tcl.h x-perl.h x-php.h x-rst.h x-glade.h EXTRA_DIST += FILES project-id ChangeLog.0 @@ -115,7 +115,7 @@ LIBUNINAME = ../libuniname/libuniname.a # Source dependencies. msgcmp_SOURCES = msgcmp.c msgfmt_SOURCES = msgfmt.c write-mo.c write-java.c write-tcl.c plural-eval.c -msgmerge_SOURCES = msgmerge.c +msgmerge_SOURCES = msgmerge.c plural-count.c msgunfmt_SOURCES = msgunfmt.c read-mo.c read-java.c read-tcl.c xgettext_SOURCES = xgettext.c \ x-c.c x-po.c x-python.c x-lisp.c x-elisp.c x-librep.c x-smalltalk.c \ diff --git a/gettext-tools/src/Makefile.msvc b/gettext-tools/src/Makefile.msvc index 61adcd392..139e49106 100644 --- a/gettext-tools/src/Makefile.msvc +++ b/gettext-tools/src/Makefile.msvc @@ -146,7 +146,7 @@ OBJECTS = \ msgcmp_OBJECTS = msgcmp.obj msgfmt_OBJECTS = msgfmt.obj write-mo.obj write-java.obj write-tcl.obj plural-eval.obj -msgmerge_OBJECTS = msgmerge.obj +msgmerge_OBJECTS = msgmerge.obj plural-count.obj msgunfmt_OBJECTS = msgunfmt.obj read-mo.obj read-java.obj read-tcl.obj xgettext_OBJECTS = xgettext.obj x-c.obj x-po.obj x-python.obj x-lisp.obj x-elisp.obj x-librep.obj x-smalltalk.obj x-java.obj x-awk.obj x-ycp.obj x-tcl.obj x-perl.obj x-php.obj x-rst.obj x-glade.obj msgattrib_OBJECTS = msgattrib.obj @@ -321,6 +321,9 @@ plural-eval.obj : plural-eval.c msgmerge.obj : msgmerge.c $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c msgmerge.c +plural-count.obj : plural-count.c + $(CC) $(INCLUDES) $(CFLAGS) -c plural-count.c + msgunfmt.obj : msgunfmt.c $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c msgunfmt.c diff --git a/gettext-tools/src/Makefile.vms b/gettext-tools/src/Makefile.vms index 3668c7204..d23c871ea 100644 --- a/gettext-tools/src/Makefile.vms +++ b/gettext-tools/src/Makefile.vms @@ -92,7 +92,7 @@ OBJECTS = \ msgcmp_OBJECTS = msgcmp.obj msgfmt_OBJECTS = msgfmt.obj, write-mo.obj, write-java.obj, write-tcl.obj, plural-eval.obj -msgmerge_OBJECTS = msgmerge.obj +msgmerge_OBJECTS = msgmerge.obj, plural-count.obj msgunfmt_OBJECTS = msgunfmt.obj, read-mo.obj, read-java.obj, read-tcl.obj xgettext_OBJECTS = xgettext.obj, x-c.obj, x-po.obj, x-python.obj, x-lisp.obj, x-elisp.obj, x-librep.obj, x-smalltalk.obj, x-java.obj, x-awk.obj, x-ycp.obj, x-tcl.obj, x-perl.obj, x-php.obj, x-rst.obj, x-glade.obj msgattrib_OBJECTS = msgattrib.obj @@ -251,6 +251,9 @@ plural-eval.obj : plural-eval.c msgmerge.obj : msgmerge.c $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS),"INSTALLPREFIX=""$(prefix)]""","INSTALLDIR=""$(bindir)]""") msgmerge.c +plural-count.obj : plural-count.c + $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS)) plural-count.c + msgunfmt.obj : msgunfmt.c $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS),"INSTALLPREFIX=""$(prefix)]""","INSTALLDIR=""$(bindir)]""") msgunfmt.c diff --git a/gettext-tools/src/plural-count.c b/gettext-tools/src/plural-count.c new file mode 100644 index 000000000..9b65a3645 --- /dev/null +++ b/gettext-tools/src/plural-count.c @@ -0,0 +1,37 @@ +/* Plural form count. + Copyright (C) 2003 Free Software Foundation, Inc. + Written by Bruno Haible , 2003. + + 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 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. + + 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. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "plural-exp.h" + + +/* Extract the number of plural forms from a header entry. */ + +unsigned long int +get_plural_count (const char *header) +{ + struct expression *plural; + unsigned long int nplurals; + + extract_plural_expression (header, &plural, &nplurals); + + return nplurals; +} diff --git a/gettext-tools/src/plural-count.h b/gettext-tools/src/plural-count.h new file mode 100644 index 000000000..5f98d5959 --- /dev/null +++ b/gettext-tools/src/plural-count.h @@ -0,0 +1,30 @@ +/* Plural form count. + Copyright (C) 2003 Free Software Foundation, Inc. + Written by Bruno Haible , 2003. + + 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 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. + + 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. */ + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Extract the number of plural forms from a header entry. */ +extern unsigned long int get_plural_count (const char *header); + + +#ifdef __cplusplus +} +#endif