* gettext-tools/src/write-catalog.h: Include xerror-handler.h.
(struct catalog_output_format): Add xerror_handler_ty parameter to the print
method.
(msgdomain_list_print): Add xerror_handler_ty parameter.
* gettext-tools/src/write-catalog.c: Include xerror-handler.h instead of
po-xerror.h.
(msgdomain_list_print): Add xerror_handler_ty parameter. Use it for error
handling.
* gettext-tools/src/write-po.c: Include xerror-handler.h instead of po-xerror.h.
(wrap, message_print, message_print_obsolete, msgdomain_list_print_po): Add
xerror_handler_ty parameter. Use it for error handling.
* gettext-tools/src/write-properties.c: Include xerror-handler.h.
(write_properties, msgdomain_list_print_properties): Add xerror_handler_ty
parameter. Use it for error handling.
* gettext-tools/src/write-stringtable.c: Include xerror-handler.h.
(write_stringtable, msgdomain_list_print_stringtable): Add xerror_handler_ty
parameter. Use it for error handling.
* gettext-tools/libgettextpo/gettext-po.c (po_file_write): Pass a
stack-allocated xerror_handler to msgdomain_list_print.
* gettext-tools/src/msgl-iconv.h: Include xerror-handler.h.
(iconv_message_list, iconv_msgdomain_list): Add xerror_handler_ty parameter.
* gettext-tools/src/msgl-iconv.c: Include xerror-handler.h instead of
po-xerror.h.
(conversion_error, convert_string, convert_string_list, convert_prev_msgid,
convert_msgid, convert_msgstr, iconv_message_list_internal, iconv_message_list,
iconv_msgdomain_list): Add xerror_handler_ty parameter. Use it for error
handling.
(convert_string_directly, convert_string_desc_directly): Use the default
xerror_handler.
* gettext-tools/src/msgattrib.c: Include xerror-handler.h.
(main): Use the default xerror_handler.
* gettext-tools/src/msgcat.c: Include xerror-handler.h.
(main): Use the default xerror_handler.
* gettext-tools/src/msgcmp.c: Include xerror-handler.h.
(compare): Use the default xerror_handler.
* gettext-tools/src/msgcomm.c: Include xerror-handler.h.
(main): Use the default xerror_handler.
* gettext-tools/src/msgconv.c: Include xerror-handler.h.
(main): Use the default xerror_handler.
* gettext-tools/src/msgen.c: Include xerror-handler.h.
(main): Use the default xerror_handler.
* gettext-tools/src/msgfilter.c: Include xerror-handler.h.
(main): Use the default xerror_handler.
* gettext-tools/src/msgfmt.c: Include xerror-handler.h.
(msgfmt_operand_list_add_from_directory): Use the default xerror_handler.
* gettext-tools/src/msggrep.c: Include xerror-handler.h.
(main): Use the default xerror_handler.
* gettext-tools/src/msginit.c: Include xerror-handler.h.
(main): Use the default xerror_handler.
* gettext-tools/src/msgl-cat.c: Include xerror-handler.h.
(catenate_msgdomain_list): Use the default xerror_handler.
* gettext-tools/src/msgmerge.c: Include xerror-handler.h.
(main, merge): Use the default xerror_handler.
* gettext-tools/src/msgunfmt.c: Include xerror-handler.h.
(main): Use the default xerror_handler.
* gettext-tools/src/msguniq.c: Include xerror-handler.h.
(main): Use the default xerror_handler.
* gettext-tools/src/write-csharp.c: Include xerror-handler.h.
(msgdomain_write_csharp): Use the default xerror_handler.
* gettext-tools/src/write-desktop.c: Include xerror-handler.h.
(msgdomain_write_desktop): Use the default xerror_handler.
* gettext-tools/src/write-java.c: Include xerror-handler.h.
(msgdomain_write_java): Use the default xerror_handler.
* gettext-tools/src/write-mo.c: Include xerror-handler.h.
(msgdomain_write_mo): Use the default xerror_handler.
* gettext-tools/src/write-qt.c: Include xerror-handler.h.
(msgdomain_write_qt): Use the default xerror_handler.
* gettext-tools/src/write-resources.c: Include xerror-handler.h.
(msgdomain_write_csharp_resources): Use the default xerror_handler.
* gettext-tools/src/write-tcl.c: Include xerror-handler.h.
(msgdomain_write_tcl): Use the default xerror_handler.
* gettext-tools/src/write-xml.c: Include xerror-handler.h.
(msgdomain_write_xml): Use the default xerror_handler.
* gettext-tools/src/x-po.c (extract): Use the default xerror_handler.
* gettext-tools/src/xgettext.c: Include xerror-handler.h.
(main, finalize_header): Use the default xerror_handler.
po_file_t
po_file_write (po_file_t file, const char *filename, po_xerror_handler_t handler)
{
- /* Establish error handler around msgdomain_list_print(). */
- po_xerror =
- (void (*) (int, const message_ty *, const char *, size_t, size_t, int, const char *))
- handler->xerror;
- po_xerror2 =
- (void (*) (int, const message_ty *, const char *, size_t, size_t, int, const char *, const message_ty *, const char *, size_t, size_t, int, const char *))
- handler->xerror2;
-
- msgdomain_list_print (file->mdlp, filename, &output_format_po, true, false);
+ /* Establish error handler for msgdomain_list_print(). */
+ unsigned int error_count = 0;
+ struct xerror_handler local_xerror_handler =
+ {
+ (void (*) (int, const message_ty *, const char *, size_t, size_t, int, const char *))
+ handler->xerror,
+ (void (*) (int, const message_ty *, const char *, size_t, size_t, int, const char *, const message_ty *, const char *, size_t, size_t, int, const char *))
+ handler->xerror2,
+ &error_count
+ };
- /* Restore error handler. */
- po_xerror = textmode_xerror;
- po_xerror2 = textmode_xerror2;
+ msgdomain_list_print (file->mdlp, filename, &output_format_po,
+ &local_xerror_handler, true, false);
return file;
}
#include "write-po.h"
#include "write-properties.h"
#include "write-stringtable.h"
+#include "xerror-handler.h"
#include "propername.h"
#include "xalloc.h"
#include "gettext.h"
msgdomain_list_sort_by_msgid (result);
/* Write the PO file. */
- msgdomain_list_print (result, output_file, output_syntax, force_po, false);
+ msgdomain_list_print (result, output_file, output_syntax,
+ textmode_xerror_handler, force_po, false);
exit (EXIT_SUCCESS);
}
#include "write-po.h"
#include "write-properties.h"
#include "write-stringtable.h"
+#include "xerror-handler.h"
#include "msgl-cat.h"
#include "msgl-header.h"
#include "propername.h"
msgdomain_list_set_header_field (result, "Language:", catalogname);
/* Write the PO file. */
- msgdomain_list_print (result, output_file, output_syntax, force_po, false);
+ msgdomain_list_print (result, output_file, output_syntax,
+ textmode_xerror_handler, force_po, false);
exit (error_message_count > 0 ? EXIT_FAILURE : EXIT_SUCCESS);
}
#include "read-stringtable.h"
#include "xmalloca.h"
#include "po-xerror.h"
+#include "xerror-handler.h"
#include "xvasprintf.h"
#include "po-charset.h"
#include "msgl-iconv.h"
}
}
if (was_utf8)
- def = iconv_msgdomain_list (def, po_charset_utf8, true, fn1);
+ def = iconv_msgdomain_list (def, po_charset_utf8, true, fn1,
+ textmode_xerror_handler);
}
/* Determine canonicalized encoding name of the definitions now, after
#include "write-po.h"
#include "write-properties.h"
#include "write-stringtable.h"
+#include "xerror-handler.h"
#include "msgl-cat.h"
#include "propername.h"
#include "gettext.h"
msgdomain_list_sort_by_msgid (result);
/* Write the PO file. */
- msgdomain_list_print (result, output_file, output_syntax, force_po, false);
+ msgdomain_list_print (result, output_file, output_syntax,
+ textmode_xerror_handler, force_po, false);
exit (error_message_count > 0 ? EXIT_FAILURE : EXIT_SUCCESS);
}
#include "write-properties.h"
#include "write-stringtable.h"
#include "msgl-iconv.h"
+#include "xerror-handler.h"
#include "localcharset.h"
#include "propername.h"
#include "gettext.h"
/* Convert if and only if the output syntax supports different encodings. */
if (!output_syntax->requires_utf8)
- result = iconv_msgdomain_list (result, to_code, true, input_file);
+ result = iconv_msgdomain_list (result, to_code, true, input_file,
+ textmode_xerror_handler);
/* Sort the results. */
if (sort_by_filepos)
msgdomain_list_sort_by_msgid (result);
/* Write the merged message list out. */
- msgdomain_list_print (result, output_file, output_syntax, force_po, false);
+ msgdomain_list_print (result, output_file, output_syntax,
+ textmode_xerror_handler, force_po, false);
exit (EXIT_SUCCESS);
}
#include "write-po.h"
#include "write-properties.h"
#include "write-stringtable.h"
+#include "xerror-handler.h"
#include "propername.h"
#include "gettext.h"
msgdomain_list_set_header_field (result, "Language:", catalogname);
/* Write the merged message list out. */
- msgdomain_list_print (result, output_file, output_syntax, force_po, false);
+ msgdomain_list_print (result, output_file, output_syntax,
+ textmode_xerror_handler, force_po, false);
exit (EXIT_SUCCESS);
}
#include "xsetenv.h"
#include "filters.h"
#include "msgl-iconv.h"
+#include "xerror-handler.h"
#include "po-charset.h"
#include "propername.h"
#include "gettext.h"
filter = serbian_to_latin;
/* Convert the input to UTF-8 first. */
- result = iconv_msgdomain_list (result, po_charset_utf8, true, input_file);
+ result = iconv_msgdomain_list (result, po_charset_utf8, true, input_file,
+ textmode_xerror_handler);
}
else if (strcmp (sub_name, "quot") == 0 && sub_argc == 1)
{
filter = ascii_quote_to_unicode;
/* Convert the input to UTF-8 first. */
- result = iconv_msgdomain_list (result, po_charset_utf8, true, input_file);
+ result = iconv_msgdomain_list (result, po_charset_utf8, true, input_file,
+ textmode_xerror_handler);
}
else if (strcmp (sub_name, "boldquot") == 0 && sub_argc == 1)
{
filter = ascii_quote_to_unicode_bold;
/* Convert the input to UTF-8 first. */
- result = iconv_msgdomain_list (result, po_charset_utf8, true, input_file);
+ result = iconv_msgdomain_list (result, po_charset_utf8, true, input_file,
+ textmode_xerror_handler);
}
else
{
msgdomain_list_sort_by_msgid (result);
/* Write the merged message list out. */
- msgdomain_list_print (result, output_file, output_syntax, force_po, false);
+ msgdomain_list_print (result, output_file, output_syntax,
+ textmode_xerror_handler, force_po, false);
exit (EXIT_SUCCESS);
}
#include "read-stringtable.h"
#include "read-desktop.h"
#include "po-xerror.h"
+#include "xerror-handler.h"
#include "po-charset.h"
#include "msgl-check.h"
#include "msgl-iconv.h"
}
/* Convert the messages to Unicode. */
- iconv_message_list (mlp, NULL, po_charset_utf8, NULL);
+ iconv_message_list (mlp, NULL, po_charset_utf8, NULL,
+ textmode_xerror_handler);
msgfmt_operand_list_append (operands, language, mlp);
}
#include "write-po.h"
#include "write-properties.h"
#include "write-stringtable.h"
+#include "xerror-handler.h"
#include "str-list.h"
#include "msgl-charset.h"
#include "xalloc.h"
msgdomain_list_sort_by_msgid (result);
/* Write the merged message list out. */
- msgdomain_list_print (result, output_file, output_syntax, force_po, false);
+ msgdomain_list_print (result, output_file, output_syntax,
+ textmode_xerror_handler, force_po, false);
exit (EXIT_SUCCESS);
}
#include "write-po.h"
#include "write-properties.h"
#include "write-stringtable.h"
+#include "xerror-handler.h"
#include "po-charset.h"
#include "localcharset.h"
#include "localename.h"
result = update_msgstr_plurals (result);
/* Write the modified message list out. */
- msgdomain_list_print (result, output_file, output_syntax, true, false);
+ msgdomain_list_print (result, output_file, output_syntax,
+ textmode_xerror_handler, true, false);
if (!no_translator)
fprintf (stderr, "\n");
#include "msgl-ofn.h"
#include "msgl-equal.h"
#include "msgl-iconv.h"
+#include "xerror-handler.h"
#include "xalloc.h"
#include "xmalloca.h"
#include "c-strstr.h"
if (!(to_code == NULL && canon_charsets[n][k] == canon_to_code))
if (iconv_message_list (mdlp->item[k]->messages,
canon_charsets[n][k], canon_to_code,
- files[n]))
+ files[n], textmode_xerror_handler))
{
multiline_error (xstrdup (""),
xasprintf (_("\
/* Message list charset and locale charset handling.
- Copyright (C) 2001-2003, 2005-2009, 2019-2023 Free Software Foundation, Inc.
+ Copyright (C) 2001-2024 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
#include "xmalloca.h"
#include "c-strstr.h"
#include "xvasprintf.h"
-#include "po-xerror.h"
+#include "xerror-handler.h"
#include "gettext.h"
#define _(str) gettext (str)
#if HAVE_ICONV
-_GL_NORETURN_FUNC static void conversion_error (const struct conversion_context* context);
+_GL_NORETURN_FUNC static void
+conversion_error (const struct conversion_context* context,
+ xerror_handler_ty xeh);
static void
-conversion_error (const struct conversion_context* context)
+conversion_error (const struct conversion_context* context,
+ xerror_handler_ty xeh)
{
if (context->to_code == po_charset_utf8)
/* If a conversion to UTF-8 fails, the problem lies in the input. */
- po_xerror (PO_SEVERITY_FATAL_ERROR, context->message, NULL, 0, 0, false,
- xasprintf (_("%s: input is not valid in \"%s\" encoding"),
- context->from_filename, context->from_code));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, context->message, NULL, 0, 0, false,
+ xasprintf (_("%s: input is not valid in \"%s\" encoding"),
+ context->from_filename, context->from_code));
else
- po_xerror (PO_SEVERITY_FATAL_ERROR, context->message, NULL, 0, 0, false,
- xasprintf (_("%s: error while converting from \"%s\" encoding to \"%s\" encoding"),
- context->from_filename, context->from_code,
- context->to_code));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, context->message, NULL, 0, 0, false,
+ xasprintf (_("%s: error while converting from \"%s\" encoding to \"%s\" encoding"),
+ context->from_filename, context->from_code,
+ context->to_code));
/* NOTREACHED */
abort ();
}
&& strlen (result) == resultlen - 1)
return result;
- conversion_error (context);
+ conversion_error (context, textmode_xerror_handler);
/* NOTREACHED */
return NULL;
}
cd, &result, &resultlen) == 0)
return string_desc_new_addr (resultlen, result);
- conversion_error (context);
+ conversion_error (context, textmode_xerror_handler);
/* NOTREACHED */
return string_desc_new_empty ();
}
static char *
convert_string (const iconveh_t *cd, const char *string,
- const struct conversion_context* context)
+ const struct conversion_context* context,
+ xerror_handler_ty xeh)
{
size_t len = strlen (string) + 1;
char *result = NULL;
&& strlen (result) == resultlen - 1)
return result;
- conversion_error (context);
+ conversion_error (context, xeh);
/* NOTREACHED */
return NULL;
}
static void
convert_string_list (const iconveh_t *cd, string_list_ty *slp,
- const struct conversion_context* context)
+ const struct conversion_context* context,
+ xerror_handler_ty xeh)
{
size_t i;
if (slp != NULL)
for (i = 0; i < slp->nitems; i++)
- slp->item[i] = convert_string (cd, slp->item[i], context);
+ slp->item[i] = convert_string (cd, slp->item[i], context, xeh);
}
static void
convert_prev_msgid (const iconveh_t *cd, message_ty *mp,
- const struct conversion_context* context)
+ const struct conversion_context* context,
+ xerror_handler_ty xeh)
{
if (mp->prev_msgctxt != NULL)
- mp->prev_msgctxt = convert_string (cd, mp->prev_msgctxt, context);
+ mp->prev_msgctxt = convert_string (cd, mp->prev_msgctxt, context, xeh);
if (mp->prev_msgid != NULL)
- mp->prev_msgid = convert_string (cd, mp->prev_msgid, context);
+ mp->prev_msgid = convert_string (cd, mp->prev_msgid, context, xeh);
if (mp->prev_msgid_plural != NULL)
- mp->prev_msgid_plural = convert_string (cd, mp->prev_msgid_plural, context);
+ mp->prev_msgid_plural =
+ convert_string (cd, mp->prev_msgid_plural, context, xeh);
}
static void
convert_msgid (const iconveh_t *cd, message_ty *mp,
- const struct conversion_context* context)
+ const struct conversion_context* context,
+ xerror_handler_ty xeh)
{
if (mp->msgctxt != NULL)
- mp->msgctxt = convert_string (cd, mp->msgctxt, context);
- mp->msgid = convert_string (cd, mp->msgid, context);
+ mp->msgctxt = convert_string (cd, mp->msgctxt, context, xeh);
+ mp->msgid = convert_string (cd, mp->msgid, context, xeh);
if (mp->msgid_plural != NULL)
- mp->msgid_plural = convert_string (cd, mp->msgid_plural, context);
+ mp->msgid_plural = convert_string (cd, mp->msgid_plural, context, xeh);
}
static void
convert_msgstr (const iconveh_t *cd, message_ty *mp,
- const struct conversion_context* context)
+ const struct conversion_context* context,
+ xerror_handler_ty xeh)
{
char *result = NULL;
size_t resultlen = 0;
}
}
- conversion_error (context);
+ conversion_error (context, xeh);
}
#endif
const char *canon_from_code,
const char *canon_to_code,
bool update_header,
- const char *from_filename)
+ const char *from_filename,
+ xerror_handler_ty xeh)
{
bool canon_from_code_overridden = (canon_from_code != NULL);
bool msgids_changed;
|| is_ascii_message_list (mlp)))
canon_charset = po_charset_ascii;
else
- po_xerror (PO_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0,
- false,
- xasprintf (_("present charset \"%s\" is not a portable encoding name"),
- charset));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0,
+ false,
+ xasprintf (_("present charset \"%s\" is not a portable encoding name"),
+ charset));
}
}
else
if (canon_from_code == NULL)
canon_from_code = canon_charset;
else if (canon_from_code != canon_charset)
- po_xerror (PO_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0,
- false,
- xasprintf (_("two different charsets \"%s\" and \"%s\" in input file"),
- canon_from_code, canon_charset));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0,
+ false,
+ xasprintf (_("two different charsets \"%s\" and \"%s\" in input file"),
+ canon_from_code, canon_charset));
}
freea (charset);
if (is_ascii_message_list (mlp))
canon_from_code = po_charset_ascii;
else
- po_xerror (PO_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
- _("input file doesn't contain a header entry with a charset specification"));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
+ _("input file doesn't contain a header entry with a charset specification"));
}
msgids_changed = false;
struct conversion_context context;
if (iconveh_open (canon_to_code, canon_from_code, &cd) < 0)
- po_xerror (PO_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
- xasprintf (_("Cannot convert from \"%s\" to \"%s\". %s relies on iconv(), and iconv() does not support this conversion."),
- canon_from_code, canon_to_code,
- last_component (program_name)));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
+ xasprintf (_("Cannot convert from \"%s\" to \"%s\". %s relies on iconv(), and iconv() does not support this conversion."),
+ canon_from_code, canon_to_code,
+ last_component (program_name)));
context.from_code = canon_from_code;
context.to_code = canon_to_code;
|| !is_ascii_string (mp->msgid))
msgids_changed = true;
context.message = mp;
- convert_string_list (&cd, mp->comment, &context);
- convert_string_list (&cd, mp->comment_dot, &context);
- convert_prev_msgid (&cd, mp, &context);
- convert_msgid (&cd, mp, &context);
- convert_msgstr (&cd, mp, &context);
+ convert_string_list (&cd, mp->comment, &context, xeh);
+ convert_string_list (&cd, mp->comment_dot, &context, xeh);
+ convert_prev_msgid (&cd, mp, &context, xeh);
+ convert_msgid (&cd, mp, &context, xeh);
+ convert_msgstr (&cd, mp, &context, xeh);
}
iconveh_close (&cd);
if (msgids_changed)
if (message_list_msgids_changed (mlp))
- po_xerror (PO_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
- xasprintf (_("Conversion from \"%s\" to \"%s\" introduces duplicates: some different msgids become equal."),
- canon_from_code, canon_to_code));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
+ xasprintf (_("Conversion from \"%s\" to \"%s\" introduces duplicates: some different msgids become equal."),
+ canon_from_code, canon_to_code));
#else
- po_xerror (PO_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
- xasprintf (_("Cannot convert from \"%s\" to \"%s\". %s relies on iconv(). This version was built without iconv()."),
- canon_from_code, canon_to_code,
- last_component (program_name)));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
+ xasprintf (_("Cannot convert from \"%s\" to \"%s\". %s relies on iconv(). This version was built without iconv()."),
+ canon_from_code, canon_to_code,
+ last_component (program_name)));
#endif
}
bool
iconv_message_list (message_list_ty *mlp,
const char *canon_from_code, const char *canon_to_code,
- const char *from_filename)
+ const char *from_filename, xerror_handler_ty xeh)
{
return iconv_message_list_internal (mlp,
canon_from_code, canon_to_code, true,
- from_filename);
+ from_filename, xeh);
}
msgdomain_list_ty *
iconv_msgdomain_list (msgdomain_list_ty *mdlp,
const char *to_code,
bool update_header,
- const char *from_filename)
+ const char *from_filename,
+ xerror_handler_ty xeh)
{
const char *canon_to_code;
size_t k;
/* Canonicalize target encoding. */
canon_to_code = po_charset_canonicalize (to_code);
if (canon_to_code == NULL)
- po_xerror (PO_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
- xasprintf (_("target charset \"%s\" is not a portable encoding name."),
- to_code));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
+ xasprintf (_("target charset \"%s\" is not a portable encoding name."),
+ to_code));
/* Test whether the control characters required for escaping file names with
spaces are present in the target encoding. */
if (msgdomain_list_has_filenames_with_spaces (mdlp)
&& !(canon_to_code == po_charset_utf8
|| strcmp (canon_to_code, "GB18030") == 0))
- po_xerror (PO_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
- xasprintf (_("Cannot write the control characters that protect file names with spaces in the %s encoding"),
- canon_to_code));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
+ xasprintf (_("Cannot write the control characters that protect file names with spaces in the %s encoding"),
+ canon_to_code));
for (k = 0; k < mdlp->nitems; k++)
iconv_message_list_internal (mdlp->item[k]->messages,
mdlp->encoding, canon_to_code, update_header,
- from_filename);
+ from_filename, xeh);
mdlp->encoding = canon_to_code;
return mdlp;
/* Message list character set conversion.
- Copyright (C) 2001-2003, 2005-2006, 2009, 2023 Free Software Foundation, Inc.
+ Copyright (C) 2001-2024 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
#include "string-desc.h"
#include "message.h"
+#include "xerror-handler.h"
#ifdef __cplusplus
iconv_message_list (message_list_ty *mlp,
const char *canon_from_code,
const char *canon_to_code,
- const char *from_filename);
+ const char *from_filename,
+ xerror_handler_ty xerror_handler);
/* Converts all the message lists in MDLP to the encoding TO_CODE.
UPDATE_HEADER specifies whether to update the "charset=..." specification
iconv_msgdomain_list (msgdomain_list_ty *mdlp,
const char *to_code,
bool update_header,
- const char *from_filename);
+ const char *from_filename,
+ xerror_handler_ty xerror_handler);
/* Tests whether the message list MLP could be converted to CANON_TO_CODE.
The (already canonicalized) encoding before conversion can be passed as
#include "plural-count.h"
#include "msgl-check.h"
#include "po-xerror.h"
+#include "xerror-handler.h"
#include "xvasprintf.h"
#include "backupfile.h"
#include "copy-file.h"
}
/* Write the merged message list out. */
- msgdomain_list_print (result, output_file, output_syntax, true,
- false);
+ msgdomain_list_print (result, output_file, output_syntax,
+ textmode_xerror_handler, true, false);
}
}
else
{
/* Write the merged message list out. */
msgdomain_list_print (result, output_file, output_syntax,
+ textmode_xerror_handler,
for_msgfmt || force_po, false);
}
}
if (was_utf8)
{
- def = iconv_msgdomain_list (def, po_charset_utf8, true, fn1);
+ def = iconv_msgdomain_list (def, po_charset_utf8, true, fn1,
+ textmode_xerror_handler);
if (compendiums != NULL)
for (k = 0; k < compendiums->nitems; k++)
iconv_message_list (compendiums->item[k], NULL, po_charset_utf8,
- compendium_filenames->item[k]);
+ compendium_filenames->item[k],
+ textmode_xerror_handler);
}
else if (compendiums != NULL && compendiums->nitems > 0)
{
for (k = 0; k < compendiums->nitems; k++)
iconv_message_list (compendiums->item[k],
NULL, canon_charset,
- compendium_filenames->item[k]);
+ compendium_filenames->item[k],
+ textmode_xerror_handler);
conversion_done = true;
}
}
{
/* It's too hairy to find out what would be the optimal target
encoding. So, convert everything to UTF-8. */
- def = iconv_msgdomain_list (def, po_charset_utf8, true, fn1);
+ def = iconv_msgdomain_list (def, po_charset_utf8, true, fn1,
+ textmode_xerror_handler);
if (compendiums != NULL)
for (k = 0; k < compendiums->nitems; k++)
iconv_message_list (compendiums->item[k],
NULL, po_charset_utf8,
- compendium_filenames->item[k]);
+ compendium_filenames->item[k],
+ textmode_xerror_handler);
}
}
}
#include "write-po.h"
#include "write-properties.h"
#include "write-stringtable.h"
+#include "xerror-handler.h"
#include "propername.h"
#include "gettext.h"
msgdomain_list_sort_by_msgid (result);
/* Write the resulting message list to the given .po file. */
- msgdomain_list_print (result, output_file, output_syntax, force_po, false);
+ msgdomain_list_print (result, output_file, output_syntax,
+ textmode_xerror_handler, force_po, false);
/* No problems. */
exit (EXIT_SUCCESS);
#include "write-po.h"
#include "write-properties.h"
#include "write-stringtable.h"
+#include "xerror-handler.h"
#include "msgl-cat.h"
#include "propername.h"
#include "gettext.h"
msgdomain_list_sort_by_msgid (result);
/* Write the PO file. */
- msgdomain_list_print (result, output_file, output_syntax, force_po, false);
+ msgdomain_list_print (result, output_file, output_syntax,
+ textmode_xerror_handler, force_po, false);
exit (error_message_count > 0 ? EXIT_FAILURE : EXIT_SUCCESS);
}
/* GNU gettext - internationalization aids
- Copyright (C) 1995-1998, 2000-2008, 2012, 2019-2020 Free Software
- Foundation, Inc.
+ Copyright (C) 1995-2024 Free Software Foundation, Inc.
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
#include "fwriteerror.h"
#include "error-progname.h"
#include "xvasprintf.h"
-#include "po-xerror.h"
+#include "xerror-handler.h"
#include "gettext.h"
/* Our regular abbreviation. */
void
msgdomain_list_print (msgdomain_list_ty *mdlp, const char *filename,
catalog_output_format_ty output_syntax,
+ xerror_handler_ty xeh,
bool force, bool debug)
{
bool to_stdout;
if (!output_syntax->supports_multiple_domains && mdlp->nitems > 1)
{
if (output_syntax->alternative_is_po)
- po_xerror (PO_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
- _("Cannot output multiple translation domains into a single file with the specified output format. Try using PO file syntax instead."));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
+ _("Cannot output multiple translation domains into a single file with the specified output format. Try using PO file syntax instead."));
else
- po_xerror (PO_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
- _("Cannot output multiple translation domains into a single file with the specified output format."));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
+ _("Cannot output multiple translation domains into a single file with the specified output format."));
}
else
{
if (has_context != NULL)
{
error_with_progname = false;
- po_xerror (PO_SEVERITY_FATAL_ERROR, NULL,
- has_context->file_name, has_context->line_number,
- (size_t)(-1), false,
- _("message catalog has context dependent translations, but the output format does not support them."));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL,
+ has_context->file_name, has_context->line_number,
+ (size_t)(-1), false,
+ _("message catalog has context dependent translations, but the output format does not support them."));
error_with_progname = true;
}
}
{
error_with_progname = false;
if (output_syntax->alternative_is_java_class)
- po_xerror (PO_SEVERITY_FATAL_ERROR, NULL,
- has_plural->file_name, has_plural->line_number,
- (size_t)(-1), false,
- _("message catalog has plural form translations, but the output format does not support them. Try generating a Java class using \"msgfmt --java\", instead of a properties file."));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL,
+ has_plural->file_name, has_plural->line_number,
+ (size_t)(-1), false,
+ _("message catalog has plural form translations, but the output format does not support them. Try generating a Java class using \"msgfmt --java\", instead of a properties file."));
else
- po_xerror (PO_SEVERITY_FATAL_ERROR, NULL,
- has_plural->file_name, has_plural->line_number,
- (size_t)(-1), false,
- _("message catalog has plural form translations, but the output format does not support them."));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL,
+ has_plural->file_name, has_plural->line_number,
+ (size_t)(-1), false,
+ _("message catalog has plural form translations, but the output format does not support them."));
error_with_progname = true;
}
}
if (fd < 0)
{
const char *errno_description = strerror (errno);
- po_xerror (PO_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
- xasprintf ("%s: %s",
- xasprintf (_("cannot create output file \"%s\""),
- filename),
- errno_description));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
+ xasprintf ("%s: %s",
+ xasprintf (_("cannot create output file \"%s\""),
+ filename),
+ errno_description));
}
}
else
"po-default.css");
stream =
styled_ostream_create (fd, filename, TTYCTL_AUTO, style_file_name);
- output_syntax->print (mdlp, stream, page_width, debug);
+ output_syntax->print (mdlp, stream, page_width, xeh, debug);
ostream_free (stream);
/* Make sure nothing went wrong. */
if (close (fd) < 0)
{
const char *errno_description = strerror (errno);
- po_xerror (PO_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
- xasprintf ("%s: %s",
- xasprintf (_("error while writing \"%s\" file"),
- filename),
- errno_description));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
+ xasprintf ("%s: %s",
+ xasprintf (_("error while writing \"%s\" file"),
+ filename),
+ errno_description));
}
}
else
if (fp == NULL)
{
const char *errno_description = strerror (errno);
- po_xerror (PO_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
- xasprintf ("%s: %s",
- xasprintf (_("cannot create output file \"%s\""),
- filename),
- errno_description));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
+ xasprintf ("%s: %s",
+ xasprintf (_("cannot create output file \"%s\""),
+ filename),
+ errno_description));
}
}
else
if (mdlp->encoding != po_charset_utf8)
{
mdlp = msgdomain_list_copy (mdlp, 0);
- mdlp = iconv_msgdomain_list (mdlp, po_charset_utf8, false, NULL);
+ mdlp = iconv_msgdomain_list (mdlp, po_charset_utf8, false, NULL,
+ xeh);
}
style_file_prepare ("PO_STYLE",
"GETTEXTSTYLESDIR", relocate (GETTEXTSTYLESDIR),
"po-default.css");
html_stream = html_styled_ostream_create (stream, style_file_name);
- output_syntax->print (mdlp, html_stream, page_width, debug);
+ output_syntax->print (mdlp, html_stream, page_width, xeh, debug);
ostream_free (html_stream);
}
else
noop_styled_ostream_t styled_stream;
styled_stream = noop_styled_ostream_create (stream, false);
- output_syntax->print (mdlp, styled_stream, page_width, debug);
+ output_syntax->print (mdlp, styled_stream, page_width, xeh, debug);
ostream_free (styled_stream);
}
#else
- output_syntax->print (mdlp, stream, page_width, debug);
+ output_syntax->print (mdlp, stream, page_width, xeh, debug);
/* Don't call ostream_free if file_ostream_create is a dummy. */
if (stream != fp)
#endif
if (fwriteerror (fp))
{
const char *errno_description = strerror (errno);
- po_xerror (PO_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
- xasprintf ("%s: %s",
- xasprintf (_("error while writing \"%s\" file"),
- filename),
- errno_description));
+ xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
+ xasprintf ("%s: %s",
+ xasprintf (_("error while writing \"%s\" file"),
+ filename),
+ errno_description));
}
}
}
/* GNU gettext - internationalization aids
- Copyright (C) 1995-1998, 2000-2003, 2006, 2008, 2019, 2021 Free Software Foundation, Inc.
+ Copyright (C) 1995-2024 Free Software Foundation, Inc.
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
#include <textstyle.h>
#include "message.h"
+#include "xerror-handler.h"
#ifdef __cplusplus
struct catalog_output_format
{
/* Outputs a list of domains of messages to a stream. */
- void (*print) (msgdomain_list_ty *mdlp, ostream_t stream, size_t page_width, bool debug);
+ void (*print) (msgdomain_list_ty *mdlp, ostream_t stream, size_t page_width,
+ xerror_handler_ty xerror_handler, bool debug);
/* Whether the print function requires the MDLP to be encoded in UTF-8
encoding. */
msgdomain_list_print (msgdomain_list_ty *mdlp,
const char *filename,
catalog_output_format_ty output_syntax,
+ xerror_handler_ty xerror_handler,
bool force, bool debug);
/* Sort MDLP destructively according to the given criterion. */
#include "message.h"
#include "msgfmt.h"
#include "msgl-iconv.h"
+#include "xerror-handler.h"
#include "msgl-header.h"
#include "plural-exp.h"
#include "po-charset.h"
retval = 1;
/* Convert the messages to Unicode. */
- iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL);
+ iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL,
+ textmode_xerror_handler);
/* Support for "reproducible builds": Delete information that may vary
between builds in the same conditions. */
#include <error.h>
#include "msgl-iconv.h"
+#include "xerror-handler.h"
#include "msgl-header.h"
#include "po-charset.h"
#include "read-catalog.h"
msgfmt_operand_list_ty operands;
/* Convert the messages to Unicode. */
- iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL);
+ iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL,
+ textmode_xerror_handler);
/* Support for "reproducible builds": Delete information that may vary
between builds in the same conditions. */
#include "message.h"
#include "msgfmt.h"
#include "msgl-iconv.h"
+#include "xerror-handler.h"
#include "msgl-header.h"
#include "plural-exp.h"
#include "po-charset.h"
retval = 1;
/* Convert the messages to Unicode. */
- iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL);
+ iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL,
+ textmode_xerror_handler);
/* Support for "reproducible builds": Delete information that may vary
between builds in the same conditions. */
#include "xmalloca.h"
#include "po-charset.h"
#include "msgl-iconv.h"
+#include "xerror-handler.h"
#include "msgl-header.h"
#include "binary-io.h"
#include "supersede.h"
It is also helpful for performance on glibc systems, since most
locales nowadays have UTF-8 as locale encoding, whereas some PO
files still are encoded in EUC-JP or so. */
- iconv_message_list (mlp, NULL, po_charset_utf8, input_file);
+ iconv_message_list (mlp, NULL, po_charset_utf8, input_file,
+ textmode_xerror_handler);
}
/* Support for "reproducible builds": Delete information that may vary
/* GNU gettext - internationalization aids
- Copyright (C) 1995-1998, 2000-2010, 2012, 2014-2015, 2018-2021, 2023 Free Software Foundation, Inc.
+ Copyright (C) 1995-2024 Free Software Foundation, Inc.
This file was written by Peter Miller <millerp@canb.auug.org.au>
#include "c-strstr.h"
#include "xvasprintf.h"
#include "verify.h"
-#include "po-xerror.h"
+#include "xerror-handler.h"
#include "gettext.h"
/* Our regular abbreviation. */
const char *line_prefix, int extra_indent, const char *css_class,
const char *name, const char *value,
enum is_wrap do_wrap, size_t page_width,
- const char *charset)
+ const char *charset, xerror_handler_ty xeh)
{
const char *canon_charset;
char *fmtdir;
{
if (errno == EILSEQ)
{
- po_xerror (PO_SEVERITY_ERROR, mp, NULL, 0, 0, false,
- _("invalid multibyte sequence"));
+ xeh->xerror (CAT_SEVERITY_ERROR, mp, NULL, 0, 0,
+ false,
+ _("invalid multibyte sequence"));
continue;
}
else if (errno == EINVAL)
/* This could happen if an incomplete
multibyte sequence at the end of input
bytes. */
- po_xerror (PO_SEVERITY_ERROR, mp, NULL, 0, 0, false,
- _("incomplete multibyte sequence"));
+ xeh->xerror (CAT_SEVERITY_ERROR, mp, NULL, 0, 0,
+ false,
+ _("incomplete multibyte sequence"));
continue;
}
else
char *error_message =
xasprintf (_("internationalized messages should not contain the '\\%c' escape sequence"),
c);
- po_xerror (PO_SEVERITY_WARNING, mp, NULL, 0, 0, false,
- error_message);
+ xeh->xerror (CAT_SEVERITY_WARNING, mp, NULL, 0, 0, false,
+ error_message);
free (error_message);
}
}
{
if (errno == EILSEQ)
{
- po_xerror (PO_SEVERITY_ERROR, mp, NULL, 0, 0,
- false, _("invalid multibyte sequence"));
+ xeh->xerror (CAT_SEVERITY_ERROR, mp, NULL, 0, 0,
+ false, _("invalid multibyte sequence"));
continue;
}
else
static void
message_print (const message_ty *mp, ostream_t stream,
const char *charset, size_t page_width, bool blank_line,
- bool debug)
+ xerror_handler_ty xeh, bool debug)
{
int extra_indent;
begin_css_class (stream, class_previous_comment);
if (mp->prev_msgctxt != NULL)
wrap (mp, stream, "#| ", 0, class_previous, "msgctxt", mp->prev_msgctxt,
- mp->do_wrap, page_width, charset);
+ mp->do_wrap, page_width, charset, xeh);
if (mp->prev_msgid != NULL)
wrap (mp, stream, "#| ", 0, class_previous, "msgid", mp->prev_msgid,
- mp->do_wrap, page_width, charset);
+ mp->do_wrap, page_width, charset, xeh);
if (mp->prev_msgid_plural != NULL)
wrap (mp, stream, "#| ", 0, class_previous, "msgid_plural",
- mp->prev_msgid_plural, mp->do_wrap, page_width, charset);
+ mp->prev_msgid_plural, mp->do_wrap, page_width, charset, xeh);
end_css_class (stream, class_previous_comment);
extra_indent = (mp->prev_msgctxt != NULL || mp->prev_msgid != NULL
|| mp->prev_msgid_plural != NULL
This will cause problems to translators who use a character encoding\n\
different from yours. Consider using a pure ASCII msgctxt instead.\n\
%s\n"), mp->msgctxt);
- po_xerror (PO_SEVERITY_WARNING, mp, NULL, 0, 0, true, warning_message);
+ xeh->xerror (CAT_SEVERITY_WARNING, mp, NULL, 0, 0, true, warning_message);
free (warning_message);
}
if (!is_ascii_string (mp->msgid)
This will cause problems to translators who use a character encoding\n\
different from yours. Consider using a pure ASCII msgid instead.\n\
%s\n"), mp->msgid);
- po_xerror (PO_SEVERITY_WARNING, mp, NULL, 0, 0, true, warning_message);
+ xeh->xerror (CAT_SEVERITY_WARNING, mp, NULL, 0, 0, true, warning_message);
free (warning_message);
}
if (mp->msgctxt != NULL)
wrap (mp, stream, NULL, extra_indent, class_msgid, "msgctxt", mp->msgctxt,
- mp->do_wrap, page_width, charset);
+ mp->do_wrap, page_width, charset, xeh);
wrap (mp, stream, NULL, extra_indent, class_msgid, "msgid", mp->msgid,
- mp->do_wrap, page_width, charset);
+ mp->do_wrap, page_width, charset, xeh);
if (mp->msgid_plural != NULL)
wrap (mp, stream, NULL, extra_indent, class_msgid, "msgid_plural",
- mp->msgid_plural, mp->do_wrap, page_width, charset);
+ mp->msgid_plural, mp->do_wrap, page_width, charset, xeh);
if (mp->msgid_plural == NULL)
wrap (mp, stream, NULL, extra_indent, class_msgstr, "msgstr", mp->msgstr,
- mp->do_wrap, page_width, charset);
+ mp->do_wrap, page_width, charset, xeh);
else
{
char prefix_buf[20];
{
sprintf (prefix_buf, "msgstr[%u]", i);
wrap (mp, stream, NULL, extra_indent, class_msgstr, prefix_buf, p,
- mp->do_wrap, page_width, charset);
+ mp->do_wrap, page_width, charset, xeh);
}
}
static void
message_print_obsolete (const message_ty *mp, ostream_t stream,
const char *charset, size_t page_width, bool blank_line,
- bool debug)
+ xerror_handler_ty xeh, bool debug)
{
int extra_indent;
begin_css_class (stream, class_previous_comment);
if (mp->prev_msgctxt != NULL)
wrap (mp, stream, "#~| ", 0, class_previous, "msgctxt", mp->prev_msgctxt,
- mp->do_wrap, page_width, charset);
+ mp->do_wrap, page_width, charset, xeh);
if (mp->prev_msgid != NULL)
wrap (mp, stream, "#~| ", 0, class_previous, "msgid", mp->prev_msgid,
- mp->do_wrap, page_width, charset);
+ mp->do_wrap, page_width, charset, xeh);
if (mp->prev_msgid_plural != NULL)
wrap (mp, stream, "#~| ", 0, class_previous, "msgid_plural",
- mp->prev_msgid_plural, mp->do_wrap, page_width, charset);
+ mp->prev_msgid_plural, mp->do_wrap, page_width, charset, xeh);
end_css_class (stream, class_previous_comment);
extra_indent = (mp->prev_msgctxt != NULL || mp->prev_msgid != NULL
|| mp->prev_msgid_plural != NULL
This will cause problems to translators who use a character encoding\n\
different from yours. Consider using a pure ASCII msgctxt instead.\n\
%s\n"), mp->msgctxt);
- po_xerror (PO_SEVERITY_WARNING, mp, NULL, 0, 0, true, warning_message);
+ xeh->xerror (CAT_SEVERITY_WARNING, mp, NULL, 0, 0, true, warning_message);
free (warning_message);
}
if (!is_ascii_string (mp->msgid)
This will cause problems to translators who use a character encoding\n\
different from yours. Consider using a pure ASCII msgid instead.\n\
%s\n"), mp->msgid);
- po_xerror (PO_SEVERITY_WARNING, mp, NULL, 0, 0, true, warning_message);
+ xeh->xerror (CAT_SEVERITY_WARNING, mp, NULL, 0, 0, true, warning_message);
free (warning_message);
}
if (mp->msgctxt != NULL)
wrap (mp, stream, "#~ ", extra_indent, class_msgid, "msgctxt", mp->msgctxt,
- mp->do_wrap, page_width, charset);
+ mp->do_wrap, page_width, charset, xeh);
wrap (mp, stream, "#~ ", extra_indent, class_msgid, "msgid", mp->msgid,
- mp->do_wrap, page_width, charset);
+ mp->do_wrap, page_width, charset, xeh);
if (mp->msgid_plural != NULL)
wrap (mp, stream, "#~ ", extra_indent, class_msgid, "msgid_plural",
- mp->msgid_plural, mp->do_wrap, page_width, charset);
+ mp->msgid_plural, mp->do_wrap, page_width, charset, xeh);
if (mp->msgid_plural == NULL)
wrap (mp, stream, "#~ ", extra_indent, class_msgstr, "msgstr", mp->msgstr,
- mp->do_wrap, page_width, charset);
+ mp->do_wrap, page_width, charset, xeh);
else
{
char prefix_buf[20];
{
sprintf (prefix_buf, "msgstr[%u]", i);
wrap (mp, stream, "#~ ", extra_indent, class_msgstr, prefix_buf, p,
- mp->do_wrap, page_width, charset);
+ mp->do_wrap, page_width, charset, xeh);
}
}
static void
msgdomain_list_print_po (msgdomain_list_ty *mdlp, ostream_t stream,
- size_t page_width, bool debug)
+ size_t page_width, xerror_handler_ty xeh, bool debug)
{
size_t j, k;
bool blank_line;
if (!mlp->item[j]->obsolete)
{
message_print (mlp->item[j], stream, charset, page_width,
- blank_line, debug);
+ blank_line, xeh, debug);
blank_line = true;
}
if (mlp->item[j]->obsolete)
{
message_print_obsolete (mlp->item[j], stream, charset, page_width,
- blank_line, debug);
+ blank_line, xeh, debug);
blank_line = true;
}
#include "msgl-ascii.h"
#include "msgl-iconv.h"
#include "po-charset.h"
+#include "xerror-handler.h"
#include "unistr.h"
#include "write-po.h"
#include "xalloc.h"
/* Writes an entire message list to the stream. */
static void
write_properties (ostream_t stream, message_list_ty *mlp,
- const char *canon_encoding, size_t page_width, bool debug)
+ const char *canon_encoding, size_t page_width,
+ xerror_handler_ty xeh, bool debug)
{
bool blank_line;
size_t j, i;
/* Convert the messages to Unicode. */
- iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL);
+ iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL, xeh);
for (j = 0; j < mlp->nitems; ++j)
{
message_ty *mp = mlp->item[j];
/* Output the contents of a PO file in Java .properties syntax. */
static void
msgdomain_list_print_properties (msgdomain_list_ty *mdlp, ostream_t stream,
- size_t page_width, bool debug)
+ size_t page_width, xerror_handler_ty xeh,
+ bool debug)
{
message_list_ty *mlp;
mlp = mdlp->item[0]->messages;
else
mlp = message_list_alloc (false);
- write_properties (stream, mlp, mdlp->encoding, page_width, debug);
+ write_properties (stream, mlp, mdlp->encoding, page_width, xeh, debug);
}
/* Describes a PO file in Java .properties syntax. */
#include "message.h"
#include "po-charset.h"
#include "msgl-iconv.h"
+#include "xerror-handler.h"
#include "msgl-header.h"
#include "hash-string.h"
#include "unistr.h"
}
/* Convert the messages to Unicode. */
- iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL);
+ iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL,
+ textmode_xerror_handler);
/* Determine whether mlp has non-ISO-8859-1 msgctxt entries. */
{
#include "message.h"
#include "msgfmt.h"
#include "msgl-iconv.h"
+#include "xerror-handler.h"
#include "msgl-header.h"
#include "po-charset.h"
#include "xalloc.h"
}
/* Convert the messages to Unicode. */
- iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL);
+ iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL,
+ textmode_xerror_handler);
/* Support for "reproducible builds": Delete information that may vary
between builds in the same conditions. */
/* Writing NeXTstep/GNUstep .strings files.
- Copyright (C) 2003-2023 Free Software Foundation, Inc.
+ Copyright (C) 2003-2024 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software: you can redistribute it and/or modify
#include "msgl-ascii.h"
#include "msgl-iconv.h"
#include "po-charset.h"
+#include "xerror-handler.h"
#include "c-strstr.h"
#include "xvasprintf.h"
#include "write-po.h"
/* Writes an entire message list to the stream. */
static void
write_stringtable (ostream_t stream, message_list_ty *mlp,
- const char *canon_encoding, size_t page_width, bool debug)
+ const char *canon_encoding, size_t page_width,
+ xerror_handler_ty xeh, bool debug)
{
bool blank_line;
size_t j;
/* Convert the messages to Unicode. */
- iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL);
+ iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL, xeh);
/* Output the BOM. */
if (!is_ascii_message_list (mlp))
/* Output the contents of a PO file in .strings syntax. */
static void
msgdomain_list_print_stringtable (msgdomain_list_ty *mdlp, ostream_t stream,
- size_t page_width, bool debug)
+ size_t page_width, xerror_handler_ty xeh,
+ bool debug)
{
message_list_ty *mlp;
mlp = mdlp->item[0]->messages;
else
mlp = message_list_alloc (false);
- write_stringtable (stream, mlp, mdlp->encoding, page_width, debug);
+ write_stringtable (stream, mlp, mdlp->encoding, page_width, xeh, debug);
}
/* Describes a PO file in .strings syntax. */
#include "xerror.h"
#include "message.h"
#include "msgl-iconv.h"
+#include "xerror-handler.h"
#include "msgl-header.h"
#include "po-charset.h"
#include "xalloc.h"
}
/* Convert the messages to Unicode. */
- iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL);
+ iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL,
+ textmode_xerror_handler);
/* Support for "reproducible builds": Delete information that may vary
between builds in the same conditions. */
#include <error.h>
#include "msgl-iconv.h"
+#include "xerror-handler.h"
#include "msgl-header.h"
#include "po-charset.h"
#include "read-catalog.h"
msgfmt_operand_list_ty operands;
/* Convert the messages to Unicode. */
- iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL);
+ iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL,
+ textmode_xerror_handler);
/* Support for "reproducible builds": Delete information that may vary
between builds in the same conditions. */
/* Convert the messages to UTF-8.
finalize_header() expects this. */
message_list_ty *mlp = mdlp->item[0]->messages;
- iconv_message_list (mlp, NULL, po_charset_utf8, logical_filename);
+ iconv_message_list (mlp, NULL, po_charset_utf8, logical_filename,
+ textmode_xerror_handler);
}
}
#include "message.h"
#include "pos.h"
#include "po-xerror.h"
+#include "xerror-handler.h"
#include "po-charset.h"
#include "msgl-iconv.h"
#include "msgl-ascii.h"
extract_from_file (file_name, po_extractor, mdlp);
if (!is_ascii_msgdomain_list (mdlp))
- mdlp = iconv_msgdomain_list (mdlp, po_charset_utf8, true, file_name);
+ mdlp = iconv_msgdomain_list (mdlp, po_charset_utf8, true, file_name,
+ textmode_xerror_handler);
dir_list_restore (saved_directory_list);
}
}
/* Write the PO file. */
- msgdomain_list_print (mdlp, file_name, output_syntax, force_po, do_debug);
+ msgdomain_list_print (mdlp, file_name, output_syntax, textmode_xerror_handler,
+ force_po, do_debug);
if (its_locating_rules)
locating_rule_list_free (its_locating_rules);
{
message_list_ty *mlp = mdlp->item[0]->messages;
- iconv_message_list (mlp, po_charset_utf8, po_charset_utf8, NULL);
+ iconv_message_list (mlp, po_charset_utf8, po_charset_utf8, NULL,
+ textmode_xerror_handler);
}
}
}