]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
xgettext: Simplify calling convention of remember_a_message.
authorBruno Haible <bruno@clisp.org>
Sun, 4 Nov 2018 19:23:36 +0000 (20:23 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 4 Nov 2018 23:25:34 +0000 (00:25 +0100)
* gettext-tools/src/xg-message.h (remember_a_message,
remember_a_message_plural): Add is_utf8, comment_is_utf8 arguments.
* gettext-tools/src/xg-message.c (remember_a_message,
remember_a_message_plural): Likewise.
* gettext-tools/src/xg-arglist-parser.c (arglist_parser_done): Update callers.
* gettext-tools/src/x-awk.c (extract_parenthesized): Likewise.
* gettext-tools/src/x-c.c (extract_parenthesized): Likewise.
* gettext-tools/src/x-csharp.c (extract_parenthesized): Likewise.
* gettext-tools/src/x-desktop.c (extract_desktop_handle_pair): Likewise.
* gettext-tools/src/x-elisp.c (read_object): Likewise.
* gettext-tools/src/x-java.c (extract_parenthesized): Likewise.
* gettext-tools/src/x-javascript.c (extract_balanced): Likewise.
* gettext-tools/src/x-librep.c (read_object): Likewise.
* gettext-tools/src/x-lisp.c (read_object): Likewise.
* gettext-tools/src/x-lua.c (extract_balanced): Likewise.
* gettext-tools/src/x-perl.c (extract_variable, interpolate_keywords,
extract_balanced): Likewise.
* gettext-tools/src/x-php.c (extract_balanced): Likewise.
* gettext-tools/src/x-python.c (extract_balanced): Likewise.
* gettext-tools/src/x-rst.c (extract_rst, extract_rsj): Likewise.
* gettext-tools/src/x-scheme.c (read_object): Likewise.
* gettext-tools/src/x-sh.c (read_word, read_command): Likewise.
* gettext-tools/src/x-smalltalk.c (extract_smalltalk): Likewise.
* gettext-tools/src/x-tcl.c (read_command): Likewise.
* gettext-tools/src/x-vala.c (extract_balanced): Likewise.
* gettext-tools/src/x-ycp.c (extract_parenthesized): Likewise.
* gettext-tools/src/xgettext.c (xgettext_its_extract_callback): Likewise.

24 files changed:
gettext-tools/src/x-awk.c
gettext-tools/src/x-c.c
gettext-tools/src/x-csharp.c
gettext-tools/src/x-desktop.c
gettext-tools/src/x-elisp.c
gettext-tools/src/x-java.c
gettext-tools/src/x-javascript.c
gettext-tools/src/x-librep.c
gettext-tools/src/x-lisp.c
gettext-tools/src/x-lua.c
gettext-tools/src/x-perl.c
gettext-tools/src/x-php.c
gettext-tools/src/x-python.c
gettext-tools/src/x-rst.c
gettext-tools/src/x-scheme.c
gettext-tools/src/x-sh.c
gettext-tools/src/x-smalltalk.c
gettext-tools/src/x-tcl.c
gettext-tools/src/x-vala.c
gettext-tools/src/x-ycp.c
gettext-tools/src/xg-arglist-parser.c
gettext-tools/src/xg-message.c
gettext-tools/src/xg-message.h
gettext-tools/src/xgettext.c

index b97e298068f93ba282b1f29eb56976f7ac6f4f7c..993aa3aab7a6bbb2dd7465b8f0fe5e92ba834120 100644 (file)
@@ -788,8 +788,8 @@ extract_parenthesized (message_list_ty *mlp,
             pos.line_number = token.line_number;
 
             if (extract_all)
-              remember_a_message (mlp, NULL, token.string, inner_context, &pos,
-                                  NULL, savable_comment);
+              remember_a_message (mlp, NULL, token.string, false, inner_context,
+                                  &pos, NULL, savable_comment, false);
             else
               arglist_parser_remember (argparser, arg, token.string,
                                        inner_context,
@@ -807,8 +807,8 @@ extract_parenthesized (message_list_ty *mlp,
             pos.file_name = logical_file_name;
             pos.line_number = token.line_number;
 
-            remember_a_message (mlp, NULL, token.string, inner_context, &pos,
-                                NULL, savable_comment);
+            remember_a_message (mlp, NULL, token.string, false, inner_context,
+                                &pos, NULL, savable_comment, false);
           }
           next_is_argument = false;
           next_context_iter = null_context_list_iterator;
index a8a0b84fa1119d302db905e8f5ee0b15c1c5fa54..09f474c240bd09129f24836433499cb46dc409cf 100644 (file)
@@ -2303,17 +2303,19 @@ extract_parenthesized (message_list_ty *mlp,
           {
             char *string = mixed_string_contents (token.mixed_string);
             mixed_string_free (token.mixed_string);
-            xgettext_current_source_encoding = po_charset_utf8;
             if (extract_all)
-              remember_a_message (mlp, NULL, string, inner_context,
-                                  &token.pos, NULL, token.comment);
+              remember_a_message (mlp, NULL, string, true, inner_context,
+                                  &token.pos, NULL, token.comment, false);
             else
-              arglist_parser_remember (argparser, arg, string,
-                                       inner_context,
-                                       token.pos.file_name,
-                                       token.pos.line_number,
-                                       token.comment);
-            xgettext_current_source_encoding = xgettext_global_source_encoding;
+              {
+                xgettext_current_source_encoding = po_charset_utf8;
+                arglist_parser_remember (argparser, arg, string,
+                                         inner_context,
+                                         token.pos.file_name,
+                                         token.pos.line_number,
+                                         token.comment);
+                xgettext_current_source_encoding = xgettext_global_source_encoding;
+              }
             drop_reference (token.comment);
           }
           next_context_iter = null_context_list_iterator;
index c5a8e5ff6021b27f5d1cb16a0d2c0a52ac8fcc94..cfa6ea622bd0e3fa201a1b83aa81e3ddfa1d55b1 100644 (file)
@@ -2018,16 +2018,18 @@ extract_parenthesized (message_list_ty *mlp, token_type_ty terminator,
             pos.file_name = logical_file_name;
             pos.line_number = token.line_number;
 
-            xgettext_current_source_encoding = po_charset_utf8;
             if (extract_all)
-              remember_a_message (mlp, NULL, string, inner_context,
-                                  &pos, NULL, token.comment);
+              remember_a_message (mlp, NULL, string, true, inner_context,
+                                  &pos, NULL, token.comment, true);
             else
-              arglist_parser_remember (argparser, arg, string,
-                                       inner_context,
-                                       pos.file_name, pos.line_number,
-                                       token.comment);
-            xgettext_current_source_encoding = xgettext_global_source_encoding;
+              {
+                xgettext_current_source_encoding = po_charset_utf8;
+                arglist_parser_remember (argparser, arg, string,
+                                         inner_context,
+                                         pos.file_name, pos.line_number,
+                                         token.comment);
+                xgettext_current_source_encoding = xgettext_global_source_encoding;
+              }
           }
           drop_reference (token.comment);
           next_context_iter = null_context_list_iterator;
index f0987918d118c57289006afb4b2802c2a2f41e18..fc3d7e1fa788815c6d19d31f5294d7da42085339 100644 (file)
@@ -125,9 +125,9 @@ extract_desktop_handle_pair (struct desktop_reader_ty *reader,
       bool is_list = (bool) keyword_value;
 
       remember_a_message (extract_reader->mlp, NULL,
-                          desktop_unescape_string (value, is_list),
+                          desktop_unescape_string (value, is_list), false,
                           null_context, key_pos,
-                          NULL, savable_comment);
+                          NULL, savable_comment, false);
     }
   savable_comment_reset ();
 }
index 75360eeedfe0ef03926f7dba69793acd154c6a34..3fff84f9065e86256b53aa1e66fd8b1e1e5d07e3 100644 (file)
@@ -895,8 +895,9 @@ read_object (struct object *op, bool first_in_list, bool new_backquote_flag,
 
                 pos.file_name = logical_file_name;
                 pos.line_number = op->line_number_at_start;
-                remember_a_message (mlp, NULL, string_of_object (op),
-                                    null_context, &pos, NULL, savable_comment);
+                remember_a_message (mlp, NULL, string_of_object (op), false,
+                                    null_context, &pos, NULL, savable_comment,
+                                    false);
               }
             last_non_comment_line = line_number;
             return;
index 8e8477d5073984c3c0d0be45954994061c2e9b2e..e019f4e5a57c1fc6418bd49c1d90ed5627b15627 100644 (file)
@@ -1217,16 +1217,18 @@ extract_parenthesized (message_list_ty *mlp, token_type_ty terminator,
             pos.file_name = logical_file_name;
             pos.line_number = token.line_number;
 
-            xgettext_current_source_encoding = po_charset_utf8;
             if (extract_all)
-              remember_a_message (mlp, NULL, string, inner_context,
-                                  &pos, NULL, token.comment);
+              remember_a_message (mlp, NULL, string, true, inner_context,
+                                  &pos, NULL, token.comment, true);
             else
-              arglist_parser_remember (argparser, arg, string,
-                                       inner_context,
-                                       pos.file_name, pos.line_number,
-                                       token.comment);
-            xgettext_current_source_encoding = xgettext_global_source_encoding;
+              {
+                xgettext_current_source_encoding = po_charset_utf8;
+                arglist_parser_remember (argparser, arg, string,
+                                         inner_context,
+                                         pos.file_name, pos.line_number,
+                                         token.comment);
+                xgettext_current_source_encoding = xgettext_global_source_encoding;
+              }
           }
           drop_reference (token.comment);
           next_context_iter = null_context_list_iterator;
index c2599dafe8d3c1250f42c3d8de336130ae51719f..0dea9c07994ba67d0e2b7edce7cf090dcb292b95 100644 (file)
@@ -1518,16 +1518,18 @@ extract_balanced (message_list_ty *mlp,
             pos.file_name = logical_file_name;
             pos.line_number = token.line_number;
 
-            xgettext_current_source_encoding = po_charset_utf8;
             if (extract_all)
-              remember_a_message (mlp, NULL, string, inner_context,
-                                  &pos, NULL, token.comment);
+              remember_a_message (mlp, NULL, string, true, inner_context,
+                                  &pos, NULL, token.comment, true);
             else
-              arglist_parser_remember (argparser, arg, string,
-                                       inner_context,
-                                       pos.file_name, pos.line_number,
-                                       token.comment);
-            xgettext_current_source_encoding = xgettext_current_file_source_encoding;
+              {
+                xgettext_current_source_encoding = po_charset_utf8;
+                arglist_parser_remember (argparser, arg, string,
+                                         inner_context,
+                                         pos.file_name, pos.line_number,
+                                         token.comment);
+                xgettext_current_source_encoding = xgettext_current_file_source_encoding;
+              }
           }
           drop_reference (token.comment);
           next_context_iter = null_context_list_iterator;
index 4fbc3073225b39b4dfc6d5eb8e7b742c7724662a..552e58beb2242942ba3f49d88f40bc5f5f115d91 100644 (file)
@@ -831,8 +831,9 @@ read_object (struct object *op, flag_context_ty outer_context)
 
                 pos.file_name = logical_file_name;
                 pos.line_number = op->line_number_at_start;
-                remember_a_message (mlp, NULL, string_of_object (op),
-                                    null_context, &pos, NULL, savable_comment);
+                remember_a_message (mlp, NULL, string_of_object (op), false,
+                                    null_context, &pos, NULL, savable_comment,
+                                    false);
               }
             last_non_comment_line = line_number;
             return;
index ec6fadf4928b8c82af41e15aaa0f4ad9a8b2442d..0680c17dc9bb98ad3d4ab26ddc69f159e898efd5 100644 (file)
@@ -1191,9 +1191,9 @@ read_object (struct object *op, flag_context_ty outer_context)
 
                     pos.file_name = logical_file_name;
                     pos.line_number = op->line_number_at_start;
-                    remember_a_message (mlp, NULL, string_of_object (op),
+                    remember_a_message (mlp, NULL, string_of_object (op), false,
                                         null_context, &pos,
-                                        NULL, savable_comment);
+                                        NULL, savable_comment, false);
                   }
                 last_non_comment_line = line_number;
                 return;
index 0d5ce6dc1775b38c2e9dffcbab7b7543582f00b5..f45d3e029e75bf7009fbfcb2261d2b605195337e 100644 (file)
@@ -1145,8 +1145,8 @@ extract_balanced (message_list_ty *mlp, token_type_ty delim,
             pos.line_number = token.line_number;
 
             if (extract_all)
-              remember_a_message (mlp, NULL, token.string, inner_context,
-                                  &pos, NULL, token.comment);
+              remember_a_message (mlp, NULL, token.string, false, inner_context,
+                                  &pos, NULL, token.comment, false);
             else
               {
                 /* A string immediately after a symbol means a function call.  */
index 59b8df0558d9a5e9292c4ec9ef23f2a28393ef59..f2b4365f080d9add59b0c7d27f66d634efaeb235 100644 (file)
@@ -1587,10 +1587,9 @@ extract_variable (message_list_ty *mlp, token_ty *tp, int first)
                         pos.line_number = line_number;
                         pos.file_name = logical_file_name;
 
-                        xgettext_current_source_encoding = po_charset_utf8;
                         remember_a_message (mlp, NULL, xstrdup (t1->string),
-                                            context, &pos, NULL, savable_comment);
-                        xgettext_current_source_encoding = xgettext_global_source_encoding;
+                                            true, context, &pos, NULL,
+                                            savable_comment, true);
                         free_token (t2);
                         free_token (t1);
                       }
@@ -2017,10 +2016,8 @@ interpolate_keywords (message_list_ty *mlp, const char *string, int lineno)
               buffer[bufpos] = '\0';
               token.string = xstrdup (buffer);
               extract_quotelike_pass3 (&token, EXIT_FAILURE);
-              xgettext_current_source_encoding = po_charset_utf8;
-              remember_a_message (mlp, NULL, token.string, context, &pos,
-                                  NULL, savable_comment);
-              xgettext_current_source_encoding = xgettext_global_source_encoding;
+              remember_a_message (mlp, NULL, token.string, true, context, &pos,
+                                  NULL, savable_comment, true);
               /* FALLTHROUGH */
             default:
               context = null_context;
@@ -3317,10 +3314,8 @@ extract_balanced (message_list_ty *mlp,
 
               pos.file_name = logical_file_name;
               pos.line_number = tp->line_number;
-              xgettext_current_source_encoding = po_charset_utf8;
-              remember_a_message (mlp, NULL, string, inner_context, &pos,
-                                  NULL, tp->comment);
-              xgettext_current_source_encoding = xgettext_global_source_encoding;
+              remember_a_message (mlp, NULL, string, true, inner_context, &pos,
+                                  NULL, tp->comment, true);
             }
           else if (!skip_until_comma)
             {
index 211943247e960f11a89142c294866ec3c12953f2..1c5b1092f80a9305b1ef6ab5fa1bd093c868bba2 100644 (file)
@@ -1531,8 +1531,8 @@ extract_balanced (message_list_ty *mlp,
             pos.line_number = token.line_number;
 
             if (extract_all)
-              remember_a_message (mlp, NULL, token.string, inner_context,
-                                  &pos, NULL, token.comment);
+              remember_a_message (mlp, NULL, token.string, false, inner_context,
+                                  &pos, NULL, token.comment, false);
             else
               arglist_parser_remember (argparser, arg, token.string,
                                        inner_context,
index 50aa587c1de71b49bc2c0ffe37520ea2cd895df4..19f584678d30d54562e2c5096b8ae86f558c5dd5 100644 (file)
@@ -1633,16 +1633,18 @@ extract_balanced (message_list_ty *mlp,
             pos.file_name = logical_file_name;
             pos.line_number = token.line_number;
 
-            xgettext_current_source_encoding = po_charset_utf8;
             if (extract_all)
-              remember_a_message (mlp, NULL, string, inner_context,
-                                  &pos, NULL, token.comment);
+              remember_a_message (mlp, NULL, string, true, inner_context,
+                                  &pos, NULL, token.comment, true);
             else
-              arglist_parser_remember (argparser, arg, string,
-                                       inner_context,
-                                       pos.file_name, pos.line_number,
-                                       token.comment);
-            xgettext_current_source_encoding = xgettext_current_file_source_encoding;
+              {
+                xgettext_current_source_encoding = po_charset_utf8;
+                arglist_parser_remember (argparser, arg, string,
+                                         inner_context,
+                                         pos.file_name, pos.line_number,
+                                         token.comment);
+                xgettext_current_source_encoding = xgettext_current_file_source_encoding;
+              }
           }
           drop_reference (token.comment);
           next_context_iter = null_context_list_iterator;
index 860b43befe379b31d42859e69a84d40029b5aae9..d9705e11bf8984e11538d90d05a0fe945179595d 100644 (file)
@@ -228,7 +228,8 @@ extract_rst (FILE *f,
       pos.file_name = location;
       pos.line_number = (size_t)(-1);
 
-      remember_a_message (mlp, NULL, msgid, null_context, &pos, NULL, NULL);
+      remember_a_message (mlp, NULL, msgid, false, null_context, &pos, NULL,
+                          NULL, false);
 
       /* Here c is the last read character: EOF or '\n'.  */
       if (c == EOF)
@@ -634,8 +635,8 @@ extract_rsj (FILE *f,
                       pos.file_name = location;
                       pos.line_number = (size_t)(-1);
 
-                      remember_a_message (mlp, NULL, msgid, null_context, &pos,
-                                          NULL, NULL);
+                      remember_a_message (mlp, NULL, msgid, true, null_context,
+                                          &pos, NULL, NULL, false);
 
                       /* Parse a comma.  */
                       c = phase2_getc ();
index 262d650a42fbc265884e59aa159cb9084fdae4ce..2856b6a80024297a6d1dcbf4d3e38f20e057e49c 100644 (file)
@@ -1323,8 +1323,9 @@ read_object (struct object *op, flag_context_ty outer_context)
 
                 pos.file_name = logical_file_name;
                 pos.line_number = op->line_number_at_start;
-                remember_a_message (mlp, NULL, string_of_object (op),
-                                    null_context, &pos, NULL, savable_comment);
+                remember_a_message (mlp, NULL, string_of_object (op), false,
+                                    null_context, &pos, NULL, savable_comment,
+                                    false);
               }
             last_non_comment_line = line_number;
             return;
index a072f03a6fa741a7eeebcb97624fd299f361d38f..75f1708169168c93bff8494b8066dcee423cd90f 100644 (file)
@@ -1092,7 +1092,8 @@ read_word (struct word *wp, int looking_for, flag_context_ty context)
                       string.chars[string.charcount++] = (unsigned char) c;
                     }
                   remember_a_message (mlp, NULL, string_of_token (&string),
-                                      context, &pos, NULL, savable_comment);
+                                      false, context, &pos, NULL,
+                                      savable_comment, false);
                   free_token (&string);
 
                   error_with_progname = false;
@@ -1257,8 +1258,9 @@ read_command (int looking_for, flag_context_ty outer_context)
 
               pos.file_name = logical_file_name;
               pos.line_number = inner.line_number_at_start;
-              remember_a_message (mlp, NULL, string_of_word (&inner),
-                                  inner_context, &pos, NULL, savable_comment);
+              remember_a_message (mlp, NULL, string_of_word (&inner), false,
+                                  inner_context, &pos, NULL, savable_comment,
+                                  false);
             }
         }
 
index a2c6bd658f813aef1f58f1a79f87aa77469d21a6..73c2b038d70c0aa74831011fa6343a4fa6674c90 100644 (file)
@@ -535,8 +535,9 @@ extract_smalltalk (FILE *f,
                 lex_pos_ty pos;
                 pos.file_name = logical_file_name;
                 pos.line_number = token.line_number;
-                remember_a_message (mlp, NULL, token.string, null_context,
-                                    &pos, NULL, savable_comment);
+                remember_a_message (mlp, NULL, token.string, false,
+                                    null_context, &pos, NULL, savable_comment,
+                                    false);
                 state = 0;
                 break;
               }
@@ -545,9 +546,9 @@ extract_smalltalk (FILE *f,
                 lex_pos_ty pos;
                 pos.file_name = logical_file_name;
                 pos.line_number = token.line_number;
-                plural_mp = remember_a_message (mlp, NULL, token.string,
+                plural_mp = remember_a_message (mlp, NULL, token.string, false,
                                                 null_context, &pos,
-                                                NULL, savable_comment);
+                                                NULL, savable_comment, false);
                 state = 4;
                 break;
               }
@@ -557,9 +558,9 @@ extract_smalltalk (FILE *f,
                 pos.file_name = logical_file_name;
                 pos.line_number = token.line_number;
                 if (plural_mp != NULL)
-                  remember_a_message_plural (plural_mp, token.string,
+                  remember_a_message_plural (plural_mp, token.string, false,
                                              null_context, &pos,
-                                             savable_comment);
+                                             savable_comment, false);
                 state = 0;
                 break;
               }
index 78784e9aa74adfee6486ad1c741553195d09945c..43704c7d058993fb98d98c69a9962bddac90df12 100644 (file)
@@ -887,9 +887,9 @@ read_command (int looking_for, flag_context_ty outer_context)
 
                 pos.file_name = logical_file_name;
                 pos.line_number = inner.line_number_at_start;
-                remember_a_message (mlp, NULL, string_of_word (&inner),
+                remember_a_message (mlp, NULL, string_of_word (&inner), false,
                                     inner_context, &pos,
-                                    NULL, savable_comment);
+                                    NULL, savable_comment, false);
               }
           }
 
index f765f522256c832939fcb885e5d542ac3dd5cfa4..c0347693e9cd7c0177343b72dfed10ab0a190f55 100644 (file)
@@ -1330,12 +1330,12 @@ extract_balanced (message_list_ty *mlp, token_type_ty delim,
             pos.file_name = logical_file_name;
             pos.line_number = token.line_number;
 
-            xgettext_current_source_encoding = po_charset_utf8;
             if (extract_all)
-              remember_a_message (mlp, NULL, string, inner_context,
-                                  &pos, NULL, token.comment);
+              remember_a_message (mlp, NULL, string, true, inner_context,
+                                  &pos, NULL, token.comment, false);
             else
               {
+                xgettext_current_source_encoding = po_charset_utf8;
                 /* A string immediately after a symbol means a function call.  */
                 if (state)
                   {
@@ -1351,8 +1351,8 @@ extract_balanced (message_list_ty *mlp, token_type_ty delim,
                   arglist_parser_remember (argparser, arg, string,
                                            inner_context, pos.file_name,
                                            pos.line_number, token.comment);
+                xgettext_current_source_encoding = xgettext_global_source_encoding;
               }
-            xgettext_current_source_encoding = xgettext_global_source_encoding;
           }
           drop_reference (token.comment);
           next_context_iter = null_context_list_iterator;
index 0392718a812f7fe65f4c4ac80dbd903e4fb72188..e27ba12d02d2fe362c9d6634754a879bec52c21f 100644 (file)
@@ -681,8 +681,8 @@ extract_parenthesized (message_list_ty *mlp,
                 {
                   /* Seen an msgid.  */
                   plural_mp = remember_a_message (mlp, NULL, token.string,
-                                                  inner_context, &pos,
-                                                  NULL, token.comment);
+                                                  false, inner_context, &pos,
+                                                  NULL, token.comment, false);
                   plural_state = 1;
                   state = 2;
                 }
@@ -690,9 +690,9 @@ extract_parenthesized (message_list_ty *mlp,
                 {
                   /* Seen an msgid_plural.  */
                   if (plural_mp != NULL)
-                    remember_a_message_plural (plural_mp, token.string,
+                    remember_a_message_plural (plural_mp, token.string, false,
                                                inner_context, &pos,
-                                               token.comment);
+                                               token.comment, false);
                   state = 0;
                 }
               drop_reference (token.comment);
index bb97b41efd09077f13bf380abffdac74a72a7893..f15eee713c15efe81ca433fb19229020e98f3591 100644 (file)
@@ -478,14 +478,14 @@ arglist_parser_done (struct arglist_parser *ap, int argnum)
               }
 
             mp = remember_a_message (ap->mlp, best_cp->msgctxt, best_cp->msgid,
-                                     msgid_context,
+                                     false, msgid_context,
                                      &best_cp->msgid_pos,
-                                     NULL, best_cp->msgid_comment);
+                                     NULL, best_cp->msgid_comment, false);
             if (mp != NULL && best_cp->msgid_plural != NULL)
-              remember_a_message_plural (mp, best_cp->msgid_plural,
+              remember_a_message_plural (mp, best_cp->msgid_plural, false,
                                          msgid_plural_context,
                                          &best_cp->msgid_plural_pos,
-                                         NULL);
+                                         NULL, false);
           }
 
           if (best_cp->xcomments.nitems > 0)
index caf58cf4d9c7e21948dce35104de36592ba2e9a9..b1938407cca641fb32298983234d70fd9fbe79d3 100644 (file)
@@ -136,9 +136,9 @@ and a mapping instead of a tuple for the arguments.\n"),
 
 message_ty *
 remember_a_message (message_list_ty *mlp, char *msgctxt, char *msgid,
-                    flag_context_ty context, lex_pos_ty *pos,
+                    bool is_utf8, flag_context_ty context, lex_pos_ty *pos,
                     const char *extracted_comment,
-                    refcounted_string_list_ty *comment)
+                    refcounted_string_list_ty *comment, bool comment_is_utf8)
 {
   enum is_format is_format[NFORMATS];
   struct argument_range range;
@@ -173,9 +173,12 @@ remember_a_message (message_list_ty *mlp, char *msgctxt, char *msgid,
   for (i = 0; i < NSYNTAXCHECKS; i++)
     do_syntax_check[i] = undecided;
 
-  if (msgctxt != NULL)
-    CONVERT_STRING (msgctxt, lc_string);
-  CONVERT_STRING (msgid, lc_string);
+  if (!is_utf8)
+    {
+      if (msgctxt != NULL)
+        CONVERT_STRING (msgctxt, lc_string);
+      CONVERT_STRING (msgid, lc_string);
+    }
 
   if (msgctxt == NULL && msgid[0] == '\0' && !xgettext_omit_header)
     {
@@ -275,7 +278,8 @@ meta information, not the empty string.\n")));
         if (s == NULL)
           break;
 
-        CONVERT_STRING (s, lc_comment);
+        if (!comment_is_utf8)
+          CONVERT_STRING (s, lc_comment);
 
         /* To reduce the possibility of unwanted matches we do a two
            step match: the line must contain 'xgettext:' and one of
@@ -479,9 +483,10 @@ meta information, not the empty string.\n")));
 
 
 void
-remember_a_message_plural (message_ty *mp, char *string,
+remember_a_message_plural (message_ty *mp, char *string, bool is_utf8,
                            flag_context_ty context, lex_pos_ty *pos,
-                           refcounted_string_list_ty *comment)
+                           refcounted_string_list_ty *comment,
+                           bool comment_is_utf8)
 {
   char *msgid_plural;
   char *msgstr1;
@@ -493,7 +498,8 @@ remember_a_message_plural (message_ty *mp, char *string,
 
   savable_comment_to_xgettext_comment (comment);
 
-  CONVERT_STRING (msgid_plural, lc_string);
+  if (!is_utf8)
+    CONVERT_STRING (msgid_plural, lc_string);
 
   /* See if the message is already a plural message.  */
   if (mp->msgid_plural == NULL)
index 621cbbca1bbb139ee5c6b027f3af31e3cd51c799..83ba4a6a4168d71aeb49f7ae56b05ef32c77cee3 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef _XGETTEXT_MESSAGE_H
 #define _XGETTEXT_MESSAGE_H
 
+#include <stdbool.h>
+
 #include "message.h"
 #include "pos.h"
 #include "rc-str-list.h"
@@ -30,36 +32,46 @@ extern "C" {
 
 
 /* Add a message to the list of extracted messages.
-   msgctxt must be either NULL or a malloc()ed string; its ownership is passed
+   MSGCTXT must be either NULL or a malloc()ed string; its ownership is passed
    to the callee.
    MSGID must be a malloc()ed string; its ownership is passed to the callee.
+   IS_UTF8 must be true if MSGCTXT and MSGID have already been converted to
+   UTF-8.
    POS->file_name must be allocated with indefinite extent.
    EXTRACTED_COMMENT is a comment that needs to be copied into the POT file,
    or NULL.
    COMMENT may be savable_comment, or it may be a saved copy of savable_comment
    (then add_reference must be used when saving it, and drop_reference while
    dropping it).  Clear savable_comment.
+   COMMENT_IS_UTF8 must be true if COMMENT has already been converted to UTF-8.
    Return the new or found message, or NULL if the message is excluded.  */
 extern message_ty *remember_a_message (message_list_ty *mlp,
                                        char *msgctxt,
                                        char *msgid,
+                                       bool is_utf8,
                                        flag_context_ty context,
                                        lex_pos_ty *pos,
                                        const char *extracted_comment,
-                                       refcounted_string_list_ty *comment);
+                                       refcounted_string_list_ty *comment,
+                                       bool comment_is_utf8);
 
 /* Add an msgid_plural to a message previously returned by
    remember_a_message.
    STRING must be a malloc()ed string; its ownership is passed to the callee.
+   IS_UTF8 must be true if STRING has already been converted to UTF-8.
    POS->file_name must be allocated with indefinite extent.
    COMMENT may be savable_comment, or it may be a saved copy of savable_comment
    (then add_reference must be used when saving it, and drop_reference while
-   dropping it).  Clear savable_comment.  */
+   dropping it).  Clear savable_comment.
+   COMMENT_IS_UTF8 must be true if COMMENT has already been converted to UTF-8.
+ */
 extern void remember_a_message_plural (message_ty *mp,
                                        char *string,
+                                       bool is_utf8,
                                        flag_context_ty context,
                                        lex_pos_ty *pos,
-                                       refcounted_string_list_ty *comment);
+                                       refcounted_string_list_ty *comment,
+                                       bool comment_is_utf8);
 
 
 #ifdef __cplusplus
index 9c9c038419b52e8e6de66a55e9955f1b7c6ee6d6..63f7c3f7cf77644b3f01f259aecdc07857e515f6 100644 (file)
@@ -1795,8 +1795,9 @@ xgettext_its_extract_callback (message_list_ty *mlp,
   message = remember_a_message (mlp,
                                 msgctxt == NULL ? NULL : xstrdup (msgctxt),
                                 xstrdup (msgid),
+                                false,
                                 null_context, pos,
-                                extracted_comment, NULL);
+                                extracted_comment, NULL, false);
 
   if (add_itstool_comments)
     {