From: Daiki Ueno Date: Mon, 12 May 2014 06:18:38 +0000 (+0900) Subject: build: Fix Woe32 cross build X-Git-Tag: v0.19~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d334ae2924f898a2856ace4f1ef44e3fc8c9d5a;p=thirdparty%2Fgettext.git build: Fix Woe32 cross build * msgfmt.c (add_languages): New function split from get_languages. (get_languages): Use add_languages instead of manually parsing LINGUAS envvar with strtok_r possibly provided by libgettextlib. * x-c.h (literalstring_c): Remove unnecessary DLL_VARIABLE. * xgettext.c (arglist_parser_alloc): Use LET_NONE instead of 0. (arglist_parser_remember): Likewise. * xgettext.h (enum literalstring_escape_type): New enum value LET_NONE. * woe32dll/gettextsrc-exports.c: Don't export line_comment and po_lex_iconv if undefined. --- diff --git a/gettext-tools/ChangeLog b/gettext-tools/ChangeLog index d1a878307..c806aa722 100644 --- a/gettext-tools/ChangeLog +++ b/gettext-tools/ChangeLog @@ -1,3 +1,9 @@ +2014-05-12 Daiki Ueno + + build: Fix Woe32 cross build + * woe32dll/gettextsrc-exports.c: Don't export line_comment and + po_lex_iconv if undefined. + 2014-04-22 Daiki Ueno build: Use git-version-gen intead of version.sh diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index ddf70f374..6f662a449 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,15 @@ +2014-05-12 Daiki Ueno + + * msgfmt.c (add_languages): New function split from get_languages. + (get_languages): Use add_languages instead of manually parsing + LINGUAS envvar with strtok_r. + + * x-c.h (literalstring_c): Remove unnecessary DLL_VARIABLE. + * xgettext.c (arglist_parser_alloc): Use LET_NONE instead of 0. + (arglist_parser_remember): Likewise. + * xgettext.h (enum literalstring_escape_type): New enum value + LET_NONE. + 2014-05-10 Guido Flohr msgattrib: Add --empty option to clear msgstr diff --git a/gettext-tools/src/msgfmt.c b/gettext-tools/src/msgfmt.c index 5a5184d59..2a0c6cc38 100644 --- a/gettext-tools/src/msgfmt.c +++ b/gettext-tools/src/msgfmt.c @@ -1268,6 +1268,30 @@ read_catalog_file_msgfmt (char *filename, catalog_input_format_ty input_syntax) fclose (fp); } +static void +add_languages (string_list_ty *languages, const char *line, size_t length) +{ + char *start; + + /* Split the line by whitespace and build the languages list. */ + for (start = (char *) line; start - line < length; ) + { + char *p; + + /* Skip whitespace before the string. */ + while (*start == ' ' || *start == '\t') + start++; + + p = start; + while (*p != '\0' && *p != ' ' && *p != '\t') + p++; + + *p = '\0'; + string_list_append_unique (languages, start); + start = p + 1; + } +} + /* Compute the languages list by reading the "LINGUAS" envvar or the LINGUAS file under DIRECTORY. */ static string_list_ty * @@ -1279,19 +1303,7 @@ get_languages (const char *directory) languages = string_list_alloc (); envval = getenv ("LINGUAS"); if (envval) - { - char *saveptr; - for (; ; envval = NULL) - { - char *language = strtok_r (envval, " \t", &saveptr); - - if (!language) - break; - - string_list_append_unique (languages, language); - free (language); - } - } + add_languages (languages, envval, strlen (envval)); else { char *linguas_file_name; @@ -1344,23 +1356,7 @@ get_languages (const char *directory) if (*line_buf == '\0' || *line_buf == '#') continue; - /* Split the line by whitespace and build the languages list. */ - for (start = line_buf; start - line_buf < len; ) - { - char *p; - - /* Skip whitespace before the string. */ - while (*start == ' ' || *start == '\t') - start++; - - p = start; - while (*p != '\0' && *p != ' ' && *p != '\t') - p++; - - *p = '\0'; - string_list_append_unique (languages, start); - start = p + 1; - } + add_languages (languages, line_buf, len); } free (line_buf); diff --git a/gettext-tools/src/x-c.h b/gettext-tools/src/x-c.h index 85a31414f..64e4953ff 100644 --- a/gettext-tools/src/x-c.h +++ b/gettext-tools/src/x-c.h @@ -84,7 +84,7 @@ extern void init_flag_table_objc (void); extern void init_flag_table_gcc_internal (void); -extern DLL_VARIABLE struct literalstring_parser literalstring_c; +extern struct literalstring_parser literalstring_c; #ifdef __cplusplus diff --git a/gettext-tools/src/xgettext.c b/gettext-tools/src/xgettext.c index 891613efa..eb3a66025 100644 --- a/gettext-tools/src/xgettext.c +++ b/gettext-tools/src/xgettext.c @@ -2684,17 +2684,17 @@ arglist_parser_alloc (message_list_ty *mlp, const struct callshapes *shapes) ap->alternative[i].argtotal = shapes->shapes[i].argtotal; ap->alternative[i].xcomments = shapes->shapes[i].xcomments; ap->alternative[i].msgctxt = NULL; - ap->alternative[i].msgctxt_escape = 0; + ap->alternative[i].msgctxt_escape = LET_NONE; ap->alternative[i].msgctxt_pos.file_name = NULL; ap->alternative[i].msgctxt_pos.line_number = (size_t)(-1); ap->alternative[i].msgid = NULL; - ap->alternative[i].msgid_escape = 0; + ap->alternative[i].msgid_escape = LET_NONE; ap->alternative[i].msgid_context = null_context; ap->alternative[i].msgid_pos.file_name = NULL; ap->alternative[i].msgid_pos.line_number = (size_t)(-1); ap->alternative[i].msgid_comment = NULL; ap->alternative[i].msgid_plural = NULL; - ap->alternative[i].msgid_plural_escape = 0; + ap->alternative[i].msgid_plural_escape = LET_NONE; ap->alternative[i].msgid_plural_context = null_context; ap->alternative[i].msgid_plural_pos.file_name = NULL; ap->alternative[i].msgid_plural_pos.line_number = (size_t)(-1); @@ -2819,7 +2819,7 @@ arglist_parser_remember (struct arglist_parser *ap, { arglist_parser_remember_literal (ap, argnum, string, context, file_name, line_number, - comment, 0); + comment, LET_NONE); } bool diff --git a/gettext-tools/src/xgettext.h b/gettext-tools/src/xgettext.h index baba1de27..c852ae32e 100644 --- a/gettext-tools/src/xgettext.h +++ b/gettext-tools/src/xgettext.h @@ -251,6 +251,7 @@ extern refcounted_string_list_ty * enum literalstring_escape_type { + LET_NONE = 0, LET_ANSI_C = 1 << 0, LET_UNICODE = 1 << 1 }; diff --git a/gettext-tools/woe32dll/gettextsrc-exports.c b/gettext-tools/woe32dll/gettextsrc-exports.c index d4bf02133..fc63e0bde 100644 --- a/gettext-tools/woe32dll/gettextsrc-exports.c +++ b/gettext-tools/woe32dll/gettextsrc-exports.c @@ -15,6 +15,10 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "woe32dll/export.h" VARIABLE(allow_duplicates) @@ -56,7 +60,6 @@ VARIABLE(input_format_po) VARIABLE(input_format_properties) VARIABLE(input_format_stringtable) VARIABLE(less_than) -VARIABLE(line_comment) VARIABLE(more_than) VARIABLE(msgcomm_mode) VARIABLE(omit_header) @@ -72,7 +75,9 @@ VARIABLE(po_error) VARIABLE(po_error_at_line) VARIABLE(po_gram_lval) VARIABLE(po_lex_charset) +#if HAVE_ICONV VARIABLE(po_lex_iconv) +#endif VARIABLE(po_lex_weird_cjk) VARIABLE(po_multiline_error) VARIABLE(po_multiline_warning)