From: Bruno Haible Date: Mon, 31 Jul 2000 20:26:18 +0000 (+0000) Subject: Portability fixes. X-Git-Tag: v0.10.36~229 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df9bdbb270ba5ad80d5fde220039c974282887b5;p=thirdparty%2Fgettext.git Portability fixes. --- diff --git a/intl/ChangeLog b/intl/ChangeLog index 1b332ccad..8ab9155fe 100644 --- a/intl/ChangeLog +++ b/intl/ChangeLog @@ -1,3 +1,10 @@ +2000-07-31 Bruno Haible + + * plural.y: Include config.h. Needed to define 'inline' away for C + compilers that don't support it. + (yylex): Don't use gcc specific case range syntax. + * loadmsgcat.y (INIT_GERMANIC_PLURAL): New macro, for old compilers. + 2000-07-28 Bruno Haible Simplification: In all cases where $(gnulocaledir) is used, it is diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c index 8b26ea712..37af2d3a6 100644 --- a/intl/loadmsgcat.c +++ b/intl/loadmsgcat.c @@ -84,8 +84,11 @@ cached by one of GCC's features. */ int _nl_msg_cat_cntr; +#if defined __GNUC__ \ + || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) + /* These structs are the constant expression for the germanic plural - form determination. */ + form determination. It represents the expression "n != 1". */ static const struct expression plvar = { .operation = var, @@ -110,6 +113,37 @@ static struct expression germanic_plural = } }; +#define INIT_GERMANIC_PLURAL() + +#else + +/* For compilers without support for ISO C 99 struct/union initializers: + Initialization at run-time. */ + +static struct expression plvar; +static struct expression plone; +static struct expression germanic_plural; + +static void +init_germanic_plural () +{ + if (plone.val.num == 0) + { + plvar.operation = var; + + plone.operation = num; + plone.val.num = 1; + + germanic_plural.operation = not_equal; + germanic_plural.val.args2.left = &plvar; + germanic_plural.val.args2.right = &plone; + } +} + +#define INIT_GERMANIC_PLURAL() init_germanic_plural () + +#endif + /* Load the message catalogs specified by FILENAME. If it is no valid message catalog do nothing. */ @@ -369,6 +403,7 @@ _nl_load_domain (domain_file) for `one', the plural form otherwise. Yes, this is also what English is using since English is a Germanic language. */ no_plural: + INIT_GERMANIC_PLURAL (); domain->plural = &germanic_plural; domain->nplurals = 2; } diff --git a/intl/plural.y b/intl/plural.y index 9a1341bed..42aac280e 100644 --- a/intl/plural.y +++ b/intl/plural.y @@ -17,6 +17,10 @@ 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 #include #include "gettext.h" @@ -218,7 +222,8 @@ yylex (YYSTYPE *lval, const char **pexp) result = *exp++; switch (result) { - case '0' ... '9': + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': { unsigned long int n = exp[-1] - '0'; while (exp[0] >= '0' && exp[0] <= '9')