]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Perl needs two formatstring parsers, not just one.
authorBruno Haible <bruno@clisp.org>
Sun, 15 Jun 2003 13:45:55 +0000 (13:45 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:10:41 +0000 (12:10 +0200)
18 files changed:
gettext-tools/src/ChangeLog
gettext-tools/src/x-awk.h
gettext-tools/src/x-c.h
gettext-tools/src/x-elisp.h
gettext-tools/src/x-glade.h
gettext-tools/src/x-java.h
gettext-tools/src/x-librep.h
gettext-tools/src/x-lisp.h
gettext-tools/src/x-perl.h
gettext-tools/src/x-php.h
gettext-tools/src/x-po.h
gettext-tools/src/x-properties.h
gettext-tools/src/x-python.h
gettext-tools/src/x-rst.h
gettext-tools/src/x-smalltalk.h
gettext-tools/src/x-tcl.h
gettext-tools/src/x-ycp.h
gettext-tools/src/xgettext.c

index 949afa467132950c0cc70bff1977b5167f091249..40cf7dc2f0fdd5a459d990b447d3eb67f2775083 100644 (file)
@@ -1,3 +1,30 @@
+2003-06-15  Bruno Haible  <bruno@clisp.org>
+
+       * xgettext.c (current_formatstring_parser1,
+       current_formatstring_parser2): New variables, replacing
+       current_formatstring_parser.
+       (remember_a_message, remember_a_message_plural): Try both
+       formatstring parsers.
+       (language_to_extractor): Allow two formatstring parsers per language,
+       not just one.
+       * x-perl.h (SCANNERS_PERL): Add formatstring_c as secondary format
+       string parser.
+       * x-awk.h (SCANNERS_AWK): Update.
+       * x-c.h (SCANNERS_C): Update.
+       * x-elisp.h (SCANNERS_ELISP): Update.
+       * x-glade.h (SCANNERS_GLADE): Update.
+       * x-java.h (SCANNERS_JAVA): Update.
+       * x-librep.h (SCANNERS_LIBREP): Update.
+       * x-lisp.h (SCANNERS_LISP): Update.
+       * x-php.h (SCANNERS_PHP): Update.
+       * x-po.h (SCANNERS_PO): Update.
+       * x-properties.h (SCANNERS_PROPERTIES): Update.
+       * x-python.h (SCANNERS_PYTHON): Update.
+       * x-rst.h (SCANNERS_RST): Update.
+       * x-smalltalk.h (SCANNERS_SMALLTALK): Update.
+       * x-tcl.h (SCANNERS_TCL): Update.
+       * x-ycp.h (SCANNERS_YCP): Update.
+
 2003-06-15  Bruno Haible  <bruno@clisp.org>
 
        * x-perl.c (case_whitespace): New macro.
index a9a2c7f56cfb7d1d7481aee3401e89f2c136ec99..44ca341dbc13db5a41bffe7ae82bd67976d7541e 100644 (file)
@@ -1,5 +1,5 @@
 /* xgettext awk backend.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2002.
 
    This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
   { "awk",    "awk"   },                                               \
 
 #define SCANNERS_AWK \
-  { "awk",        extract_awk, &formatstring_awk },                    \
+  { "awk",        extract_awk, &formatstring_awk, NULL },              \
 
 /* Scan an awk file and add its translatable strings to mdlp.  */
 extern void extract_awk (FILE *fp, const char *real_filename,
index 738e19f2a01abd9bffedc45b976fbf457b031ef1..ed1fd3058c20cf92a9385334f8df42403a210de3 100644 (file)
@@ -1,5 +1,5 @@
 /* xgettext C/C++/ObjectiveC backend.
-   Copyright (C) 2001-2002 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software; you can redistribute it and/or modify
@@ -31,9 +31,9 @@
   { "m",      "ObjectiveC" },                                          \
 
 #define SCANNERS_C \
-  { "C",          extract_c, &formatstring_c },                                \
-  { "C++",        extract_c, &formatstring_c },                                \
-  { "ObjectiveC", extract_c, &formatstring_c },                                \
+  { "C",          extract_c, &formatstring_c, NULL },                  \
+  { "C++",        extract_c, &formatstring_c, NULL },                  \
+  { "ObjectiveC", extract_c, &formatstring_c, NULL },                  \
 
 /* Scan a C/C++/ObjectiveC file and add its translatable strings to mdlp.  */
 extern void extract_c (FILE *fp, const char *real_filename,
index 9dfe1d658e91ad61c1ab58f9d33ff3bb85db7304..a9d338e9dda71a90c901af17b5015ff5d3b1724e 100644 (file)
@@ -1,5 +1,5 @@
 /* xgettext Emacs Lisp backend.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2002.
 
    This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
   { "el",        "EmacsLisp"     },                                    \
 
 #define SCANNERS_ELISP \
-  { "EmacsLisp",  extract_elisp, &formatstring_elisp },                        \
+  { "EmacsLisp",  extract_elisp, &formatstring_elisp, NULL },          \
 
 /* Scan an Emacs Lisp file and add its translatable strings to mdlp.  */
 extern void extract_elisp (FILE *fp, const char *real_filename,
index 0e750ff8fa4f0d40c375c0e60338af4034f3baf8..b7872fd0d92b18b8744bfd85d1651e6836a4eb0b 100644 (file)
@@ -22,7 +22,7 @@
   { "glade2",    "glade"    },                                         \
 
 #define SCANNERS_GLADE \
-  { "glade",      extract_glade, NULL },                               \
+  { "glade",      extract_glade, NULL, NULL },                         \
 
 /* Scan a glade XML file and add its translatable strings to mdlp.  */
 extern void extract_glade (FILE *fp, const char *real_filename,
index fd30fcd38a9f0e652750b5b64a6db43c6872a96e..50d17f6abf69ed0a1a3ac0fc41640c990db18034 100644 (file)
@@ -1,5 +1,5 @@
 /* xgettext Java backend.
-   Copyright (C) 2001-2002 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003 Free Software Foundation, Inc.
    Written by Tommy Johansson <tommy.johansson@kanalen.org>, 2001.
 
    This program is free software; you can redistribute it and/or modify
@@ -20,7 +20,7 @@
   { "java",    "Java"  },                                              \
 
 #define SCANNERS_JAVA \
-  { "Java",        extract_java, &formatstring_java },                 \
+  { "Java",        extract_java, &formatstring_java, NULL },           \
 
 extern void extract_java (FILE *fp, const char *real_filename,
                          const char *logical_filename,
index 9280d7efdc8c45a1420147c3384fcf36041622f8..2dc4cc5f5626b31eb10cafc3fcd49fece573631b 100644 (file)
@@ -1,5 +1,5 @@
 /* xgettext librep backend.
-   Copyright (C) 2001-2002 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
   { "jl",        "librep"     },                                       \
 
 #define SCANNERS_LIBREP \
-  { "librep",     extract_librep, &formatstring_librep },              \
+  { "librep",     extract_librep, &formatstring_librep, NULL },                \
 
 /* Scan a librep file and add its translatable strings to mdlp.  */
 extern void extract_librep (FILE *fp, const char *real_filename,
index b7377b1f8a2a690b5b4a39a48797609fb8dc4665..63c447cd2e5872b06a5aa15d17929da630a03450 100644 (file)
@@ -1,5 +1,5 @@
 /* xgettext Lisp backend.
-   Copyright (C) 2001-2002 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
   { "lisp",      "Lisp"     },                                         \
 
 #define SCANNERS_LISP \
-  { "Lisp",       extract_lisp, &formatstring_lisp },                  \
+  { "Lisp",       extract_lisp, &formatstring_lisp, NULL },            \
 
 /* Scan a Lisp file and add its translatable strings to mdlp.  */
 extern void extract_lisp (FILE *fp, const char *real_filename,
index 3e7031fee97c46ceac293e0ee066bb906260ed4f..28f3e4ebb984d7da5d7afcefe6f12c951bf9473a 100644 (file)
@@ -24,7 +24,7 @@
   { "cgi",   "perl"   },                                               \
 
 #define SCANNERS_PERL \
-  { "perl",        extract_perl, &formatstring_perl },                 \
+  { "perl",        extract_perl, &formatstring_c, &formatstring_perl },        \
 
 /* Scan a Perl file and add its translatable strings to mdlp.  */
 extern void extract_perl (FILE *fp, const char *real_filename,
index 603e40079cd9f549da0bec7f1638666a1bae6b78..7ec6cddaf8b495e75829972eb3e2452702810ae1 100644 (file)
@@ -1,5 +1,5 @@
 /* xgettext PHP backend.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2002.
 
    This program is free software; you can redistribute it and/or modify
@@ -23,7 +23,7 @@
   { "php4",   "PHP"   },                                               \
 
 #define SCANNERS_PHP \
-  { "PHP",        extract_php, &formatstring_php },                    \
+  { "PHP",        extract_php, &formatstring_php, NULL },              \
 
 /* Scan a PHP file and add its translatable strings to mdlp.  */
 extern void extract_php (FILE *fp, const char *real_filename,
index 986d6e2da0ff0ac6bdcedd4aacf216ad3da8fed1..72ae8b05a8e373abad72f9368089f4c4302c89d0 100644 (file)
@@ -1,5 +1,5 @@
 /* xgettext PO backend.
-   Copyright (C) 2001-2002 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software; you can redistribute it and/or modify
@@ -22,7 +22,7 @@
   { "pot",    "PO"    },                                               \
 
 #define SCANNERS_PO \
-  { "PO", extract_po, NULL },                                          \
+  { "PO", extract_po, NULL, NULL },                                    \
 
 /* Scan a PO file and add its translatable strings to mdlp.  */
 extern void extract_po (FILE *fp, const char *real_filename,
index e9e5f1e91f4cba8dcb5871d2de8b560ce6471ddb..10c1acb0491272067e069cdaa2ca6df4d2c8702d 100644 (file)
@@ -21,7 +21,7 @@
   { "properties", "JavaProperties" },                                  \
 
 #define SCANNERS_PROPERTIES \
-  { "JavaProperties", extract_properties, NULL },                      \
+  { "JavaProperties", extract_properties, NULL, NULL },                        \
 
 /* Scan a JavaProperties file and add its translatable strings to mdlp.  */
 extern void extract_properties (FILE *fp, const char *real_filename,
index e2edeeec4a2c9f700320b97595171271429d8b2e..af96927d00211d94c2786c9e118e5430b672b1e4 100644 (file)
@@ -1,5 +1,5 @@
 /* xgettext Python backend.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2002.
 
    This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
   { "py",        "Python"   },                                         \
 
 #define SCANNERS_PYTHON \
-  { "Python",     extract_python, &formatstring_python },              \
+  { "Python",     extract_python, &formatstring_python, NULL },                \
 
 /* Scan a Python file and add its translatable strings to mdlp.  */
 extern void extract_python (FILE *fp, const char *real_filename,
index de0b152bf3db3a715d7993409c42c1bdd184e091..4dfe206e7d89423a6235c7a30980d01920c7f8d1 100644 (file)
@@ -1,5 +1,5 @@
 /* xgettext RST backend.
-   Copyright (C) 2001-2002 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
   { "rst",    "RST"   },                                               \
 
 #define SCANNERS_RST \
-  { "RST",        extract_rst, &formatstring_pascal },                 \
+  { "RST",        extract_rst, &formatstring_pascal, NULL },           \
 
 /* Scan an RST file and add its translatable strings to mdlp.  */
 extern void extract_rst (FILE *fp, const char *real_filename,
index ca5a9eb5fb6964d2e7fd6b45902c3fd1e1156c03..407ce44619b59d1ce525d1d7f70841f511697516 100644 (file)
@@ -1,5 +1,5 @@
 /* xgettext Smalltalk backend.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2002.
 
    This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
   { "st",     "Smalltalk"   },                                         \
 
 #define SCANNERS_SMALLTALK \
-  { "Smalltalk",  extract_smalltalk, &formatstring_smalltalk },                \
+  { "Smalltalk",  extract_smalltalk, &formatstring_smalltalk, NULL },  \
 
 /* Scan a Smalltalk file and add its translatable strings to mdlp.  */
 extern void extract_smalltalk (FILE *fp, const char *real_filename,
index 494171184ed1eb4edc45f48dcc3923ee208a1dd7..13d1551934e0c506d4b3ff8b93a4e573fb60851b 100644 (file)
@@ -1,5 +1,5 @@
 /* xgettext Tcl Lisp backend.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2002.
 
    This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
   { "tcl",       "Tcl"           },                                    \
 
 #define SCANNERS_TCL \
-  { "Tcl",        extract_tcl, &formatstring_tcl },                    \
+  { "Tcl",        extract_tcl, &formatstring_tcl, NULL },              \
 
 /* Scan a Tcl file and add its translatable strings to mdlp.  */
 extern void extract_tcl (FILE *fp, const char *real_filename,
index 3cd31e49121b17ef84b5c89915c32a4765426421..e092452fdbbefbdfe34b9874ce98910e26089f8f 100644 (file)
@@ -1,5 +1,5 @@
 /* xgettext YCP backend.
-   Copyright (C) 2001-2002 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
   { "ycp",    "YCP"   },                                               \
 
 #define SCANNERS_YCP \
-  { "YCP",        extract_ycp, &formatstring_ycp },                    \
+  { "YCP",        extract_ycp, &formatstring_ycp, NULL },              \
 
 /* Scan an YCP file and add its translatable strings to mdlp.  */
 extern void extract_ycp (FILE *fp, const char *real_filename,
index a2287d2cd0e4090fefb230259e74b809d650671d..c72ca0751eb2701b99abe1dd394a7945536d9196 100644 (file)
@@ -1005,7 +1005,8 @@ extract_from_file (const char *file_name, extractor_func extractor,
 
 /* Language dependent format string parser.
    NULL if the language has no notion of format strings.  */
-static struct formatstring_parser *current_formatstring_parser;
+static struct formatstring_parser *current_formatstring_parser1;
+static struct formatstring_parser *current_formatstring_parser2;
 
 
 /* Convert the given string from xgettext_current_source_encoding to
@@ -1182,7 +1183,8 @@ meta information, not the empty string.\n")));
   for (i = 0; i < NFORMATS; i++)
     {
       if (is_format[i] == undecided
-         && formatstring_parsers[i] == current_formatstring_parser)
+         && (formatstring_parsers[i] == current_formatstring_parser1
+             || formatstring_parsers[i] == current_formatstring_parser2))
        {
          struct formatstring_parser *parser = formatstring_parsers[i];
          char *invalid_reason = NULL;
@@ -1269,7 +1271,8 @@ remember_a_message_plural (message_ty *mp, char *string, lex_pos_ty *pos)
         the msgid, whether the msgid is a format string, examine the
         msgid_plural.  This is a heuristic.  */
       for (i = 0; i < NFORMATS; i++)
-       if (formatstring_parsers[i] == current_formatstring_parser
+       if ((formatstring_parsers[i] == current_formatstring_parser1
+            || formatstring_parsers[i] == current_formatstring_parser2)
            && (mp->is_format[i] == undecided || mp->is_format[i] == possible))
          {
            struct formatstring_parser *parser = formatstring_parsers[i];
@@ -1445,7 +1448,8 @@ language_to_extractor (const char *name)
   {
     const char *name;
     extractor_func func;
-    struct formatstring_parser *formatstring_parser;
+    struct formatstring_parser *formatstring_parser1;
+    struct formatstring_parser *formatstring_parser2;
   };
 
   static table_ty table[] =
@@ -1476,7 +1480,8 @@ language_to_extractor (const char *name)
     if (strcasecmp (name, tp->name) == 0)
       {
        /* XXX Ugly side effect.  */
-       current_formatstring_parser = tp->formatstring_parser;
+       current_formatstring_parser1 = tp->formatstring_parser1;
+       current_formatstring_parser2 = tp->formatstring_parser2;
 
        return tp->func;
       }