]> git.ipfire.org Git - thirdparty/gettext.git/log
thirdparty/gettext.git
10 months agoxgettext: PHP: Support heredoc and nowdoc strings.
Bruno Haible [Sat, 21 Sep 2024 11:05:16 +0000 (13:05 +0200)] 
xgettext: PHP: Support heredoc and nowdoc strings.

Reported:
by Bodo Graumann <mail@bodograumann.de> at <https://savannah.gnu.org/bugs/?27740>,
at <https://savannah.gnu.org/bugs/?35944>,
by Cédric Anne <canne@teclib.com> at <https://savannah.gnu.org/bugs/?62158>.

* gettext-tools/src/x-php.c (TAB_WIDTH): New macro.
(process_heredoc): New function.
(phase4_get): Process the heredoc or nowdoc string, instead of blindly skipping
it.
* gettext-tools/tests/xgettext-php-1: Add tests of heredoc strings with embedded
expressions.
* gettext-tools/tests/xgettext-php-2: Expect spaces before a heredoc end label
to be eaten. Add tests of heredoc strings and nowdoc strings.
* NEWS: Mention the improvement.

10 months agodoc: Expand section about preparing strings.
Bruno Haible [Thu, 19 Sep 2024 21:26:28 +0000 (23:26 +0200)] 
doc: Expand section about preparing strings.

* gettext-tools/doc/gettext.texi (Triggering): Mention a few more Gnulib
modules.
(Preparing Strings): Turn subheadings into subsections.
(No string concatenation): Mention string concatenation operators and
strings with embedded expressions in various programming languages.
* NEWS: Mention it.

10 months agoxgettext: Perl: Recognize strings with embedded expressions.
Bruno Haible [Thu, 19 Sep 2024 21:25:11 +0000 (23:25 +0200)] 
xgettext: Perl: Recognize strings with embedded expressions.

* gettext-tools/src/x-perl.c (enum token_type_ty, token_ty,
struct token_stack_ty): Moved.
(struct perl_extractor): New type.
(fp, linebuf, linebuf_size, linesize, linepos, eaten_here, end_of_file,
last_comment_line, last_non_comment_line, nesting_depth, last_token_type,
token_stack): Remove variables.
(perl_extractor_init_rest): New function.
(phase1_getc): Add a 'struct perl_extractor *' parameter. Read from a string
if fp == NULL.
(phase1_ungetc, get_here_document, skip_pod, phase2_getc, phase2_ungetc,
extract_quotelike_pass1, extract_quotelike_pass1_utf8): Add a
'struct perl_extractor *' parameter.
(extract_perl_input): New declaration.
(extract_quotelike): Add a 'struct perl_extractor *' parameter.
(extract_triple_quotelike): Add a 'struct perl_extractor *' parameter. Remove
mlp parameter.
(extract_quotelike_pass3): Add a 'struct perl_extractor *' parameter.
(extract_variable): Add a 'struct perl_extractor *' parameter. Remove mlp
parameter.
(interpolate_keywords): Likewise. Rename states wait_quote → seen_lbrace,
dquote → lbrace_dquote, squote → lbrace_squote, barekey → lbrace_barekey. Add
handling of bracket-enclosed expressions in strings.
(x_perl_prelex, x_perl_lex): Add a 'struct perl_extractor *' parameter. Remove
mlp parameter.
(x_perl_unlex): Add a 'struct perl_extractor *' parameter.
(collect_message, extract_balanced): Add a 'struct perl_extractor *' parameter.
Remove mlp parameter.
(extract_perl_input): New function, extracted from extract_perl.
(extract_perl): Use it. Create a 'struct perl_extractor'.
* gettext-tools/tests/xgettext-perl-5: Add tests of strings with embedded
expressions.
* NEWS: Mention the change.

10 months agoxgettext: Perl: Report warnings instead of fatal errors.
Bruno Haible [Thu, 19 Sep 2024 10:34:02 +0000 (12:34 +0200)] 
xgettext: Perl: Report warnings instead of fatal errors.

* gettext-tools/doc/lang-perl.texi (Interpolation I, Interpolation II): Say
"unsupported" instead of "invalid". Say "warning" instead of "fatal error".
* gettext-tools/doc/gettext.texi: Update menu.
* gettext-tools/src/x-perl.c (token_type_string_interpol): New enum item.
(token2string): Handle token_type_string_interpol.
(extract_quotelike_pass3): Remove error_level parameter; use IF_SEVERITY_WARNING
instead. Say "unsupported" instead of "invalid". When encountering an
unsupported variable interpolation, change the token's type to
token_type_string_interpol.
(interpolate_keywords): After calling extract_quotelike_pass3, test the token's
type.
(prefer_regexp_over_division): Handle token_type_string_interpol.
(collect_message): Remove error_level parameter; use IF_SEVERITY_WARNING
instead. After calling extract_quotelike_pass3, test the token's type. Possibly
return NULL.
(extract_balanced): Handle token_type_string_interpol. Test the return value of
collect_message.
* NEWS: Mention the change.

10 months agoxgettext: PHP: Code style.
Bruno Haible [Wed, 18 Sep 2024 21:38:48 +0000 (23:38 +0200)] 
xgettext: PHP: Code style.

* gettext-tools/src/x-php.c (phase4_get): Trivial changes.

10 months agoxgettext: PHP: Recognize strings with embedded expressions.
Bruno Haible [Wed, 18 Sep 2024 21:37:32 +0000 (23:37 +0200)] 
xgettext: PHP: Recognize strings with embedded expressions.

* gettext-tools/src/x-php.c (enum token_type_ty, struct token_ty): Moved.
(struct php_extractor): New type.
(fp, phase1_pushback, phase1_pushback_length, phase2_pushback,
phase2_pushback_length, buffer, bufmax, buflen, last_comment_line,
last_non_comment_line, phase3_pushback, phase3_pushback_length,
phase4_pushback, phase4_pushback_length, phase5_last, paren_nesting_depth,
bracket_nesting_depth): Remove variables.
(php_extractor_init_rest): New function.
(extract_php_input): New declaration.
(phase1_getc): Add a 'struct php_extractor *' parameter. Read from a string
if fp == NULL.
(phase1_ungetc, skip_html, comment_start, comment_add, comment_line_end,
phase3_getc, phase3_ungetc): Add a 'struct php_extractor *' parameter.
(phase4_get): Likewise. Add handling of embedded expressions in strings.
(phase4_unget, x_php_lex): Add a 'struct php_extractor *' parameter.
(extract_balanced): Add a 'struct php_extractor *' parameter. Remove mlp
parameter.
(extract_php_input): New function, extracted from extract_php.
(extract_php): Use it. Create a 'struct php_extractor'.
* gettext-tools/tests/xgettext-php-1: Add tests of strings with embedded
expressions.
* NEWS: Mention the change.

10 months agoxgettext: PHP: Disallow character \x7f in identifiers.
Bruno Haible [Wed, 18 Sep 2024 18:26:42 +0000 (20:26 +0200)] 
xgettext: PHP: Disallow character \x7f in identifiers.

* gettext-tools/src/x-php.c (phase4_get): Don't allow character \x7f in symbol
tokens.

10 months agoxgettext: C#: Recognize strings with embedded expressions.
Bruno Haible [Wed, 18 Sep 2024 15:00:04 +0000 (17:00 +0200)] 
xgettext: C#: Recognize strings with embedded expressions.

* gettext-tools/src/x-csharp.c (token_type_template, token_type_ltemplate,
token_type_mtemplate, token_type_rtemplate): New enum items.
(free_token): Treat token_type_template like token_type_string_literal.
(accumulate_escaped): Accept a second delimiter argument. Return the delimiter.
(template_literal_depth, brace_depths, brace_depths_alloc): New variables,
copied from x-javascript.c.
(new_brace_depth_level): New function, copied from x-javascript.c.
(phase6_get): Recognize strings with embedded expressions. Handle braces in a
nested manner.
(extract_parenthesized): Handle the token types token_type_template,
token_type_ltemplate, token_type_mtemplate, token_type_rtemplate.
(extract_csharp): Initialize template_literal_depth and call
new_brace_depth_level.
* gettext-tools/tests/xgettext-csharp-5: Add tests of strings with embedded
expressions.
* NEWS: Mention the change.

10 months agotests: Add xgettext tests regarding strings with embedded expressions.
Bruno Haible [Tue, 17 Sep 2024 22:05:48 +0000 (00:05 +0200)] 
tests: Add xgettext tests regarding strings with embedded expressions.

* gettext-tools/tests/xgettext-sh-1: Add tests of strings with embedded
expressions.
* gettext-tools/tests/xgettext-python-1: Likewise.
* gettext-tools/tests/xgettext-tcl-2: Likewise.
* gettext-tools/tests/xgettext-ruby-2: Likewise.
* gettext-tools/tests/xgettext-javascript-3: Likewise.

10 months agoUpdate copyright year.
Bruno Haible [Mon, 16 Sep 2024 16:45:27 +0000 (18:45 +0200)] 
Update copyright year.

10 months agobuild: Fix "make distcheck" after the line-breaking algorithm changed.
Bruno Haible [Mon, 16 Sep 2024 16:43:22 +0000 (18:43 +0200)] 
build: Fix "make distcheck" after the line-breaking algorithm changed.

* gettext-runtime/po/Makefile.in.in (.po.gmo, $(POFILES)): In the gettext-tools
package, when not cross-compiling, use the locally built msg* programs.
* gettext-tools/configure.ac: When not cross-compiling, set MSGMERGE and
MSGMERGE_FOR_MSGFMT_OPTION to point to locally built msgmerge program.

10 months agotests: Fix a test failure.
Bruno Haible [Mon, 16 Sep 2024 14:00:53 +0000 (16:00 +0200)] 
tests: Fix a test failure.

* gettext-tools/tests/xgettext-ruby-2: Skip the test if 'rxgettext' is not
found.

10 months agoUpdate after gnulib changed.
Bruno Haible [Sun, 15 Sep 2024 22:47:22 +0000 (00:47 +0200)] 
Update after gnulib changed.

* gettext-tools/tests/msgmerge-28: Update expected test result.
* gettext-tools/tests/mm-viet.out: Likewise.

10 months agoUpdate to the newest gnulib.
Bruno Haible [Sun, 15 Sep 2024 21:21:14 +0000 (23:21 +0200)] 
Update to the newest gnulib.

10 months agotests: Add xgettext tests regarding string concatenation.
Bruno Haible [Wed, 11 Sep 2024 12:20:57 +0000 (14:20 +0200)] 
tests: Add xgettext tests regarding string concatenation.

* gettext-tools/tests/xgettext-sh-1: Add string concatenation tests.
* gettext-tools/tests/xgettext-lua-1: Add a string concatenation test.
* gettext-tools/tests/xgettext-vala-1: Likewise.
* gettext-tools/tests/xgettext-javascript-3: Enhance the string concatenation
test.
* gettext-tools/tests/xgettext-csharp-5: Update comment.
* gettext-tools/tests/xgettext-csharp-6: Likewise.
* gettext-tools/tests/xgettext-java-5: Likewise.
* gettext-tools/tests/xgettext-java-6: Likewise.
* gettext-tools/tests/xgettext-lua-2: Likewise.
* gettext-tools/tests/xgettext-perl-7: Likewise.
* gettext-tools/tests/xgettext-php-3: Likewise.
* gettext-tools/tests/xgettext-python-1: Likewise.
* gettext-tools/tests/xgettext-python-2: Likewise.
* gettext-tools/tests/xgettext-python-4: Likewise.
* gettext-tools/tests/xgettext-ruby-1: Likewise.
* gettext-tools/tests/xgettext-sh-5: Likewise.
* gettext-tools/tests/xgettext-ruby-2: New file, based on
gettext-tools/tests/xgettext-csharp-6.
* gettext-tools/tests/Makefile.am (TESTS): Add it.

10 months agoxgettext: awk: Recognize string concatenation.
Bruno Haible [Wed, 11 Sep 2024 12:09:34 +0000 (14:09 +0200)] 
xgettext: awk: Recognize string concatenation.

* gettext-tools/src/x-awk.c (SIZEOF): New macro.
(phase3_pushback, phase3_pushback_length): New variables.
(phase3_get): Renamed from x_awk_lex. Return pushed-back token if present.
(phase3_unget): New function.
(string_concat_free1): New function.
(phase4_get): New function.
(extract_parenthesized): Invoke phase4_get instead of x_awk_lex.
(extract_awk): Initialize phase3_pushback_length.
* gettext-tools/tests/xgettext-awk-1: Add test cases for string concatenation.
* NEWS: Mention the improvement.

10 months agoxgettext: Smalltalk: Recognize string concatenation.
Bruno Haible [Wed, 11 Sep 2024 12:09:29 +0000 (14:09 +0200)] 
xgettext: Smalltalk: Recognize string concatenation.

* gettext-tools/src/x-smalltalk.c (struct token_ty): Add field 'comment'.
(free_token): New function.
(phase2_get): Fill in tp->comment.
(phase3_pushback): Increase size.
(phase3_get): Fill in tp->comment. Do reference counting.
(string_concat_free1): New function.
(phase4_pushback, phase4_pushback_length): New variables.
(phase4_get, phase4_unget): New functions.
(extract_smalltalk): Initialize phase4_pushback_length. Call phase4_get instead
of phase3_get, phase4_unget instead of phase3_unget. Use the comment stored in
the token. Call free_token.
* gettext-tools/tests/xgettext-smalltalk-1: Add a test case of string
concatenation.
* NEWS: Mention the improvement.

10 months agoxgettext: Ruby: Make the --omit-header option work.
Bruno Haible [Wed, 11 Sep 2024 12:09:24 +0000 (14:09 +0200)] 
xgettext: Ruby: Make the --omit-header option work.

* gettext-tools/src/x-ruby.c (is_not_header): New function.
(extract_ruby): If --omit-header is specified, remove the header entry at the
end.

10 months agoxgettext: Refactor.
Bruno Haible [Wed, 11 Sep 2024 12:09:08 +0000 (14:09 +0200)] 
xgettext: Refactor.

* gettext-tools/src/x-awk.c (SE_QUOTES): Renamed from P7_QUOTES.
(get_string_element): Renamed from phase7_getc.
(x_awk_lex): Update.
* gettext-tools/src/x-c.c (SE_EOF): Renamed from P7_EOF.
(SE_QUOTES): Renamed from P7_QUOTES.
(SE_QUOTE): Renamed from P7_QUOTE.
(SE_NEWLINE): Renamed from P7_NEWLINE.
(get_string_element): Renamed from phase7_getc.
(unget_string_element): Renamed from phase7_ungetc.
(phase5_get): Update.
* gettext-tools/src/x-vala.c (SE_EOF): Renamed from P7_EOF.
(SE_QUOTES): Renamed from P7_QUOTES.
(SE_QUOTE): Renamed from P7_QUOTE.
(SE_NEWLINE): Renamed from P7_NEWLINE.
(get_string_element): Renamed from phase7_getc.
(unget_string_element): Renamed from phase7_ungetc.
(phase3_get): Update.
* gettext-tools/src/x-ycp.c (SE_QUOTES): Renamed from P7_QUOTES.
(get_string_element): Renamed from phase7_getc.
(phase5_get): Update.

10 months agodoc: Document the <inttypes.h> macros for translators.
Bruno Haible [Tue, 10 Sep 2024 15:12:28 +0000 (17:12 +0200)] 
doc: Document the <inttypes.h> macros for translators.

Reported by Mingye Wang <arthur200126@gmail.com>
at <https://savannah.gnu.org/bugs/?66195>.

* gettext-tools/doc/gettext.texi (c-format, objc-format): Mention the
<inttypes.h> macro placeholders.

10 months agobuild: Fix build failure when people set DESTDIR already during 'make'.
Bruno Haible [Tue, 10 Sep 2024 11:41:03 +0000 (13:41 +0200)] 
build: Fix build failure when people set DESTDIR already during 'make'.

Reported by Henrik Holst <henrik.holst@outlook.com> in
<https://lists.gnu.org/archive/html/bug-gettext/2024-09/msg00005.html>.

* gettext-tools/src/Makefile.am (textstyle.h): Pass an empty DESTDIR to
libtextstyle/lib/Makefile.

10 months agodoc: Discourage --omit-header.
Bruno Haible [Tue, 10 Sep 2024 09:28:28 +0000 (11:28 +0200)] 
doc: Discourage --omit-header.

* gettext-tools/doc/msgcomm.texi: Document the effects of --omit-header.
* gettext-tools/doc/xgettext.texi: Likewise.

10 months agoxgettext: Deprecate --trigraphs.
Bruno Haible [Tue, 10 Sep 2024 09:38:42 +0000 (11:38 +0200)] 
xgettext: Deprecate --trigraphs.

* gettext-tools/src/xgettext.c (usage): Mark option --trigraphs as deprecated.
* gettext-tools/doc/xgettext.texi: Likewise.

11 months agoxgettext: C: Fix undefined behaviour.
Bruno Haible [Tue, 10 Sep 2024 01:58:05 +0000 (03:58 +0200)] 
xgettext: C: Fix undefined behaviour.

* gettext-tools/src/x-c.c (phase7_getc): Declare n as 'unsigned int', to avoid
signed integer overflow.
* gettext-tools/tests/xg-c-escape-3.c: Add two more test cases.
* gettext-tools/tests/xgettext-c-escape-3: Update expected test result.

11 months agoDrop workarounds for glibc 2.1 and Solaris 9.
Bruno Haible [Mon, 9 Sep 2024 14:10:31 +0000 (16:10 +0200)] 
Drop workarounds for glibc 2.1 and Solaris 9.

* gettext-tools/src/read-po-lex.c (po_lex_charset_set): Remove glibc 2.1 and
Solaris 9 workarounds.
* gettext-tools/src/recode-sr-latin.c (process): Likewise.
* gettext-tools/src/write-po.c (wrap): Likewise.
* gettext-tools/src/x-python.c (set_current_file_source_encoding): Likewise.
* gettext-tools/src/xgettext.c (main): Likewise.
* libtextstyle/gnulib-local/lib/iconv-ostream.oo.c (iconv_ostream::free,
iconv_ostream_create): Likewise.

11 months agodoc: Add comments.
Bruno Haible [Sun, 8 Sep 2024 08:04:53 +0000 (10:04 +0200)] 
doc: Add comments.

* gettext-tools/doc/lang-sh.texi: Add a comment.

11 months agodoc: Enhance doc about format strings in JavaScript.
Bruno Haible [Sun, 8 Sep 2024 08:02:23 +0000 (10:02 +0200)] 
doc: Enhance doc about format strings in JavaScript.

* gettext-tools/doc/lang-javascript.texi (JavaScript): Document how to get a
decent 'format' method.

11 months agodoc: Update regarding PO file editors.
Bruno Haible [Sun, 8 Sep 2024 15:25:27 +0000 (17:25 +0200)] 
doc: Update regarding PO file editors.

* gettext-tools/doc/gettext.texi (Editing): Add some text.
(Web based localization): New section.
(Lokalize): Renamed from KBabel. Add some text.
(Gtranslator): Add some text.
(Poedit): New section.

11 months agodoc: Fix formatting with texi2html.
Bruno Haible [Sun, 8 Sep 2024 07:58:39 +0000 (09:58 +0200)] 
doc: Fix formatting with texi2html.

* gettext-tools/doc/gettext.texi: Write '@itemize @bullet', not just '@itemize'.
* gettext-tools/doc/xgettext.texi: Likewise.

11 months agoReplace FSF snail-mail addresses with URLs.
Bruno Haible [Sun, 1 Sep 2024 13:58:21 +0000 (15:58 +0200)] 
Replace FSF snail-mail addresses with URLs.

* build-aux/texi2html: Update GPL license notice.

11 months agoUpdate translators' disclaimer.
Bruno Haible [Sun, 1 Sep 2024 13:48:26 +0000 (15:48 +0200)] 
Update translators' disclaimer.

* gettext-tools/misc/DISCLAIM: Untabify. Integrate some changes from the
FSF (2010).

11 months agobuild: Fix shared library support in 32-bit mode on FreeBSD/powerpc64.
Bruno Haible [Sat, 24 Aug 2024 13:52:05 +0000 (15:52 +0200)] 
build: Fix shared library support in 32-bit mode on FreeBSD/powerpc64.

Patch from <https://savannah.gnu.org/patch/index.php?10469>.

* m4/libtool.m4: On FreeBSD, fix shlibpath_var.

11 months agoxgetcwd: Port to native Windows.
Bruno Haible [Wed, 21 Aug 2024 07:18:22 +0000 (09:18 +0200)] 
xgetcwd: Port to native Windows.

Use a variant of the gnulib module 'xgetcwd' instead of our own (older) one.

* gnulib-local/lib/xgetcwd.h: Remove file.
* gnulib-local/lib/xgetcwd.c: Remove file.
* gnulib-local/modules/xgetcwd: Remove file.
* gnulib-local/modules/xgetcwd.diff: New file.
* gnulib-local/Makefile.am (EXTRA_DIST): Update.

11 months agomsgfmt: Tcl: Produce the same output on native Windows as elsewhere.
Bruno Haible [Tue, 20 Aug 2024 13:30:23 +0000 (15:30 +0200)] 
msgfmt: Tcl: Produce the same output on native Windows as elsewhere.

* gettext-tools/src/write-tcl.c (msgdomain_write_tcl): Invoke fopen with 'b'
flag, so as to force Unix newlines.

11 months agoxgettext: Scheme: Recognize datum-comments, part 2.
Bruno Haible [Tue, 20 Aug 2024 09:48:37 +0000 (11:48 +0200)] 
xgettext: Scheme: Recognize datum-comments, part 2.

* gettext-tools/src/x-scheme.c (read_object): Avoid reference to uninitialized
variable context_iter for arg > 0.

11 months agotests: Improve portability.
Bruno Haible [Fri, 16 Aug 2024 23:50:27 +0000 (01:50 +0200)] 
tests: Improve portability.

* gettext-tools/tests/lang-javascript: Don't use '${DIFF} -u', since AIX diff
does not support the -u option.
* gettext-tools/tests/xgettext-vala-6: Likewise.

11 months agoxgettext: Scheme: Recognize hexadecimal escape sequences in string literals.
Bruno Haible [Fri, 16 Aug 2024 23:29:02 +0000 (01:29 +0200)] 
xgettext: Scheme: Recognize hexadecimal escape sequences in string literals.

* gettext-tools/src/x-scheme.c (accumulate_escaped): Recognize \x, \u, \U escape
sequences.
* gettext-tools/tests/xgettext-scheme-7: Test also some \x escape sequences.
* gettext-tools/tests/xgettext-scheme-8: Test also some \x, \u, \U escape
sequences.

11 months agoxgettext: Scheme: Prepare for recognizing more escape sequences in string literals.
Bruno Haible [Fri, 16 Aug 2024 21:44:53 +0000 (23:44 +0200)] 
xgettext: Scheme: Prepare for recognizing more escape sequences in string literals.

* gettext-tools/src/x-scheme.c (accumulate_escaped): New function, extracted
from read_object.
(struct object): Add field 'mixed_string'.
(free_object): Free field 'mixed_string'.
(string_of_object): Implement differently for objects of type t_string.
(read_object): Use accumulate_escaped. Invoke mixed_string_alloc_utf8 instead of
mixed_string_alloc_simple.

11 months agoxgettext: Scheme: In language Scheme, handle backslash-newline as specified in R6RS.
Bruno Haible [Fri, 16 Aug 2024 20:40:10 +0000 (22:40 +0200)] 
xgettext: Scheme: In language Scheme, handle backslash-newline as specified in R6RS.

Reported by Florent Angly <florent.angly@gmail.com>
at <https://savannah.gnu.org/bugs/?59262>.

* gettext-tools/src/x-scheme.c (read_object): Do R6RS-compliant interpretation
of backslash-newline if follow_guile is false.
* gettext-tools/tests/xgettext-scheme-7: New file.
* gettext-tools/tests/xgettext-scheme-8: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add them.

11 months agoxgettext: Scheme: #!fold-case and #!no-fold-case directives.
Bruno Haible [Fri, 16 Aug 2024 20:36:30 +0000 (22:36 +0200)] 
xgettext: Scheme: #!fold-case and #!no-fold-case directives.

Reported by Florent Angly <florent.angly@gmail.com>
at <https://savannah.gnu.org/bugs/?61987>.

* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add unicase/u8-casefold,
uninorm/nfc.
* gettext-tools/src/x-scheme.c: Include unicase.h, uninorm.h.
(SIZEOF): New macro.
(phase0_getc): Renamed from do_getc. Remove line_number handling.
(phase0_ungetc): Renamed from do_ungetc. Remove line_number handling.
(MAX_PHASE1_PUSHBACK): New macro.
(phase1_pushback, phase1_pushback_length): New variables.
(phase1_getc, phase1_ungetc): New functions.
(casefold): New variable.
(read_token): Use phase1_getc, phase1_ungetc instead of do_getc, do_ungetc.
(read_object): Likewise. If casefold is true, apply Unicode case-folding to
symbols before looking them up in the hash table. Recognize all #! directives
supported by Guile.
(extract_whole_file): Initialize phase1_pushback_length, casefold.
* gettext-tools/tests/xgettext-scheme-6: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.

11 months agoxgettext: Scheme: Recognize datum-comments.
Bruno Haible [Fri, 16 Aug 2024 20:32:58 +0000 (22:32 +0200)] 
xgettext: Scheme: Recognize datum-comments.

Reported by Florent Angly <florent.angly@gmail.com>
at <https://savannah.gnu.org/bugs/?61882>.

* gettext-tools/src/x-scheme.c (datum_comment_nesting_depth): New variable.
(read_object): Omit the normal processing of list elements if
datum_comment_nesting_depth is non-zero. Recognize datum comments.
(extract_whole_file): Initialize datum_comment_nesting_depth.
* gettext-tools/tests/xgettext-scheme-1: Add a test case with a datum comment.
* NEWS: Mention the change.

11 months agoxgettext: Scheme: Understand both '-L Scheme' and '-L Guile'.
Bruno Haible [Fri, 16 Aug 2024 19:05:47 +0000 (21:05 +0200)] 
xgettext: Scheme: Understand both '-L Scheme' and '-L Guile'.

* gettext-tools/src/x-scheme.h (EXTENSIONS_SCHEME): Associate the language
Guile, not Scheme, with the extension .scm.
(SCANNERS_SCHEME): Add info about the 'Guile' language.
(extract_guile): New declaration.
* gettext-tools/src/x-scheme.c (follow_guile): New variable.
(extract_whole_file): Renamed from extract_scheme.
(extract_scheme, extract_guile): New functions.
* gettext-tools/src/xgettext.c (usage): List Guile as a possible argument for
the '-L' option.
* gettext-tools/doc/xgettext.texi: Document 'Guile' as possible argument for
the '-L' option.
* gettext-tools/doc/lang-scheme.texi (Scheme): Explain the difference between
'-L Scheme' and '-L Guile'.
* NEWS: Mention the change.

11 months agoxgettext: Scheme: More tests.
Bruno Haible [Fri, 16 Aug 2024 19:04:21 +0000 (21:04 +0200)] 
xgettext: Scheme: More tests.

* gettext-tools/tests/xgettext-scheme-5: New file, based on
gettext-tools/tests/xgettext-5.
* gettext-tools/tests/Makefile.am (TESTS): Add it.

11 months agoxgettext: Scheme: Reorganize tests.
Bruno Haible [Fri, 16 Aug 2024 18:53:13 +0000 (20:53 +0200)] 
xgettext: Scheme: Reorganize tests.

* gettext-tools/tests/xgettext-scheme-format-1: Renamed from
gettext-tools/tests/xgettext-scheme-5.
* gettext-tools/tests/xgettext-scheme-format-2: Renamed from
gettext-tools/tests/xgettext-scheme-6.
* gettext-tools/tests/Makefile.am (TESTS): Update.

11 months agomsginit: Update information about zh_TW translation team.
Bruno Haible [Fri, 16 Aug 2024 14:54:49 +0000 (16:54 +0200)] 
msginit: Update information about zh_TW translation team.

Reported by Buug Worm <buugworm@gmail.com>
at <https://savannah.gnu.org/bugs/?66094>.

* gettext-tools/projects/KDE/teams.url: Update URL.
* gettext-tools/projects/KDE/teams.html: Update information about zh_TW
translation team.
* gettext-tools/projects/TP/teams.html: Likewise.

11 months agotests: Prefer 'cat <<\EOF' to 'cat <<EOF' whenever possible.
Bruno Haible [Fri, 16 Aug 2024 08:36:06 +0000 (10:36 +0200)] 
tests: Prefer 'cat <<\EOF' to 'cat <<EOF' whenever possible.

Rationale: Not interpreting $ and \ in the here documents is a better default
than interpreting them.

* gettext-tools/tests/*: Write 'cat <<\EOF' instead of 'cat <<EOF', when no
shell dollar-substitution and backslash-interpretation is needed.

11 months agoxgettext: Python: Change escape sequences interpretation to follow Python 3.
Bruno Haible [Wed, 14 Aug 2024 16:18:37 +0000 (18:18 +0200)] 
xgettext: Python: Change escape sequences interpretation to follow Python 3.

Reported by Serhii Tereshchenko <serg.partizan@gmail.com> at
<https://savannah.gnu.org/bugs/?65778>.

* gettext-tools/src/x-python.c (phase7_getuc): Update comments for Python 3.
Don't interpret \u sequences in raw bytes and raw strings.
(phase5_get): Recognize bytes prefixes 'b' and 'B'. For f-strings, invoke
phase7_getuc with interpret_unicode = true, not false.
* gettext-tools/tests/xgettext-python-1: Update for Python 3.
* gettext-tools/tests/xgettext-python-5: Likewise.
* NEWS: Mention the change.

11 months agoImprove handling of non-BMP characters with Tcl 9.0.
Bruno Haible [Mon, 12 Aug 2024 20:06:10 +0000 (22:06 +0200)] 
Improve handling of non-BMP characters with Tcl 9.0.

* gettext-tools/src/write-tcl.c (hexdigit): New variable.
(write_tcl8_string): Renamed from write_tcl_string. Enable the escaping of
braces.
(write_tcl9_string, is_entirely_ucs2, write_tcl_string): New functions.
* gettext-tools/tests/msgfmt-tcl-1: New file.
* gettext-tools/tests/testdata/tcltest_pl.po: New file.
* gettext-tools/tests/testdata/tcltest_pl.msg: New file.
* gettext-tools/tests/msgfmt-tcl-2: New file.
* gettext-tools/tests/testdata/tcltest_cs.po: New file.
* gettext-tools/tests/testdata/tcltest_cs.msg: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add msgfmt-tcl-1, msgfmt-tcl-2.
(EXTRA_DIST): Add the new testdata files.
* NEWS: Mention the change.

11 months agolibintl: Remove conditionals for libglocale.
Bruno Haible [Mon, 12 Aug 2024 11:09:56 +0000 (13:09 +0200)] 
libintl: Remove conditionals for libglocale.

libglocale was a short-lived project in 2005 that was never completed.

* gettext-runtime/intl/dcigettext.c: Assume IN_LIBGLOCALE is not defined.
* gettext-runtime/intl/libgnuintl.in.h: Likewise.
* gettext-runtime/intl/loadmsgcat.c: Likewise.
* gettext-runtime/intl/localealias.c: Likewise.
* gettext-runtime/intl/plural-exp.h: Likewise.
* gettext-runtime/intl/gettextP.h: Likewise.
(gl_dcigettext): Remove declaration.
* gettext-runtime/intl/Makefile.am (libgnuintl.h, libintl.h): Remove the
IN_LIBGLOCALE handling.

11 months agobuild: Update .gitignore: Automake no longer needs or installs elisp-comp.
Bruno Haible [Mon, 12 Aug 2024 11:09:33 +0000 (13:09 +0200)] 
build: Update .gitignore: Automake no longer needs or installs elisp-comp.

11 months agobuild: Update .gitignore: moopp is now exclusively used by libtextstyle.
Bruno Haible [Mon, 12 Aug 2024 11:09:29 +0000 (13:09 +0200)] 
build: Update .gitignore: moopp is now exclusively used by libtextstyle.

11 months agobuild: Update .gitignore: Better sorting.
Bruno Haible [Mon, 12 Aug 2024 11:09:25 +0000 (13:09 +0200)] 
build: Update .gitignore: Better sorting.

11 months agolibgettextpo: Update .gitignore.
Bruno Haible [Mon, 12 Aug 2024 11:09:21 +0000 (13:09 +0200)] 
libgettextpo: Update .gitignore.

11 months agolibgettextpo: Use a multithread-safe alternative to strerror(), part 2.
Bruno Haible [Mon, 12 Aug 2024 11:09:17 +0000 (13:09 +0200)] 
libgettextpo: Use a multithread-safe alternative to strerror(), part 2.

11 months agolibgettextpo: Remove static variable error_with_progname, part 2.
Bruno Haible [Mon, 12 Aug 2024 11:09:13 +0000 (13:09 +0200)] 
libgettextpo: Remove static variable error_with_progname, part 2.

* gettext-tools/src/read-po-lex.h: Don't include error-progname.h.
* gettext-tools/src/format-scheme.c: Likewise.
* gettext-tools/src/read-desktop.c: Likewise.
* gettext-tools/src/x-desktop.c: Likewise.

12 months agobuild: Fix a check-copyright-headers failure.
Bruno Haible [Fri, 9 Aug 2024 07:00:41 +0000 (09:00 +0200)] 
build: Fix a check-copyright-headers failure.

* gettext-tools/libgettextpo/multithread-safe.txt: Add a license header.

12 months agolibgettextpo: Now multithread-safe.
Bruno Haible [Wed, 7 Aug 2024 18:20:36 +0000 (20:20 +0200)] 
libgettextpo: Now multithread-safe.

* gettext-tools/libgettextpo/multithread-safe.txt: New file.
* gettext-tools/libgettextpo/Makefile.am (EXTRA_DIST): Add it.
* gettext-tools/doc/gettext.html (libgettextpo): Document multithread-safety.
* NEWS: Mention it.

12 months agolibgettextpo: Use a multithread-safe alternative to strerror().
Bruno Haible [Wed, 7 Aug 2024 18:04:26 +0000 (20:04 +0200)] 
libgettextpo: Use a multithread-safe alternative to strerror().

* autogen.sh (GNULIB_MODULES_LIBGETTEXTPO): Add xstrerror.
* gnulib-local/lib/markup.c: Include xstrerror.h.
(unescape_string_inplace): Use xstrerror instead of strerror.
* gnulib-local/modules/markup (Depends-on): Add xstrerror.
* gettext-tools/src/read-po-lex.c: Include xstrerror.h.
(mbfile_getc, lex_getc): Use xstrerror instead of strerror.
* gettext-tools/src/read-properties.c: Include xstrerror.h.
(properties_parse): Use xstrerror instead of strerror.
* gettext-tools/src/read-stringtable.c: Include xstrerror.h.
(phase1_getc): Use xstrerror instead of strerror.
* gettext-tools/src/write-catalog.c: Include xstrerror.h.
(msgdomain_list_print): Use xstrerror instead of strerror.

12 months agolibgettextpo: Remove static variable error_with_progname.
Bruno Haible [Wed, 7 Aug 2024 17:19:26 +0000 (19:19 +0200)] 
libgettextpo: Remove static variable error_with_progname.

Inside libgettextpo, assignments to error_with_progname are undesired.
Outside libgettextpo, they are redundant.

* gettext-tools/src/read-po-lex.c: Don't include error-progname.h.
* gettext-tools/src/read-properties.c: Don't include error-progname.h.
(read_escaped_string): Remove assignments to error_with_progname.
* gettext-tools/src/read-stringtable.c: Don't include error-progname.h.
* gettext-tools/src/write-catalog.c: Don't include error-progname.h.
(msgdomain_list_print): Remove assignments to error_with_progname.
* autogen.sh (GNULIB_MODULES_LIBGETTEXTPO): Remove error-progname.

12 months agobuild: Avoid "Missing copyright header" error for std-gnu11.m4.
Bruno Haible [Mon, 5 Aug 2024 20:44:54 +0000 (22:44 +0200)] 
build: Avoid "Missing copyright header" error for std-gnu11.m4.

* check-copyright-headers (func_check_file): Search for the copyright notice
in the first 20 lines.

12 months agoFix compilation error on MSVC.
Bruno Haible [Mon, 5 Aug 2024 20:19:00 +0000 (22:19 +0200)] 
Fix compilation error on MSVC.

* gettext-tools/src/msgmerge.c (silent_error_logger): Conditionalize the
__attribute__ annotation.

12 months agoUpdate to the newest gnulib.
Bruno Haible [Mon, 5 Aug 2024 06:17:21 +0000 (08:17 +0200)] 
Update to the newest gnulib.

12 months agolibgettextpo: Make function po_format_list() multithread-safe.
Bruno Haible [Sun, 4 Aug 2024 23:32:32 +0000 (01:32 +0200)] 
libgettextpo: Make function po_format_list() multithread-safe.

* autogen.sh (GNULIB_MODULES_LIBGETTEXTPO): Add 'once'.
* gettext-tools/libgettextpo/gettext-po.c: Include glthread/once.h.
(all_formats): New variable.
(all_formats_init): New function, extracted from po_format_list.
(all_formats_init_once): New variable.
(po_format_list): Invoke all_formats_init once.

12 months agolibgettextpo: Don't use static variable gram_max_allowed_errors.
Bruno Haible [Sat, 3 Aug 2024 12:28:32 +0000 (14:28 +0200)] 
libgettextpo: Don't use static variable gram_max_allowed_errors.

* gettext-tools/src/read-po.h (gram_max_allowed_errors): New declaration.
* gettext-tools/src/read-po-lex.h (gram_max_allowed_errors): Remove declaration.
* gettext-tools/src/read-po.c: Include <limits.h>.
(gram_max_allowed_errors): Moved to here. Change initial value to UINT_MAX.
* gettext-tools/src/read-po-lex.c: Include read-po.h.
(gram_max_allowed_errors): Remove variable.
* gettext-tools/libgettextpo/gettext-po.c: Don't include read-po-lex.h.
(po_file_read): Don't assign gram_max_allowed_errors.
* gettext-tools/src/msgattrib.c (main): Initialize gram_max_allowed_errors.
* gettext-tools/src/msgcat.c (main): Likewise.
* gettext-tools/src/msgcomm.c (main): Likewise.
* gettext-tools/src/msgconv.c (main): Likewise.
* gettext-tools/src/msgen.c (main): Likewise.
* gettext-tools/src/msgexec.c (main): Likewise.
* gettext-tools/src/msgfilter.c (main): Likewise.
* gettext-tools/src/msggrep.c (main): Likewise.
* gettext-tools/src/msginit.c (main): Likewise.
* gettext-tools/src/msguniq.c (main): Likewise.
* gettext-tools/src/xgettext.c (main): Likewise.
* gettext-tools/src/msgcmp.c: Don't include read-po-lex.h.
* gettext-tools/src/msgmerge.c: Likewise.
* gettext-tools/src/msgfmt.c: Don't include read-po-lex.h.
(main): Initialize gram_max_allowed_errors.

12 months agoRefactor: Remove code duplication.
Bruno Haible [Sat, 3 Aug 2024 11:10:46 +0000 (13:10 +0200)] 
Refactor: Remove code duplication.

* gettext-tools/src/po-xerror.h: Include xerror-handler.h. Remove all
declarations.
(PO_SEVERITY_*): Define as aliases of CAT_SEVERITY_*.
(po_xerror, po_xerror2): New macros.
* gettext-tools/src/po-xerror.c: Remove file.
* gettext-tools/src/Makefile.am (COMMON_SOURCE): Remove po-xerror.c.
* gettext-tools/src/msgmerge.c (silent_xerror2): New function.
(match_domain): Pass a stack-allocated xerror_handler to check_plural_eval.
* gettext-tools/woe32dll/gettextsrc-exports.c (po_xerror, po_xerror2): Remove
exports.
* gettext-tools/po/POTFILES.in: Add src/xerror-handler.c. Remove
src/po-xerror.c.

12 months agolibgettextpo: Remove unused object files.
Bruno Haible [Sat, 3 Aug 2024 10:21:26 +0000 (12:21 +0200)] 
libgettextpo: Remove unused object files.

* gettext-tools/src/read-po-lex.h: Don't include xerror.h.
* gettext-tools/libgettextpo/Makefile.am (libgettextpo_la_AUXSOURCES): Remove
po-xerror.c and po-error.c.
* autogen.sh (GNULIB_MODULES_LIBGETTEXTPO): Remove xerror.

12 months agoAdd an xerror_handler parameter to check_message and check_message_list.
Bruno Haible [Sat, 3 Aug 2024 10:14:48 +0000 (12:14 +0200)] 
Add an xerror_handler parameter to check_message and check_message_list.

* gettext-tools/src/msgl-check.h: Include xerror-handler.h.
(check_plural_eval, check_message, check_message_list): Add xerror_handler_ty
parameter.
* gettext-tools/src/msgl-check.c (check_plural_eval, check_plural, check_pair,
check_header_entry, check_message, check_message_list): Add xerror_handler_ty
parameter. Use it for error handling.
(struct formatstring_error_logger_locals): Add xeh field.
(formatstring_error_logger): Use it for error handling.
* gettext-tools/libgettextpo/gettext-po.c: Don't include po-xerror.h.
(po_file_check_all, po_message_check_all): Pass a stack-allocated xerror_handler
to check_message_list.
(po_message_check_format): Pass a stack-allocated xerror_handler to
check_message.
* gettext-tools/src/msgfmt.c (main, msgfmt_operand_list_add_from_directory): Use
the default xerror_handler.
* gettext-tools/src/msgmerge.c (match_domain): Likewise.

12 months agoAdd an xerror_handler parameter to msgdomain_list_print.
Bruno Haible [Sat, 3 Aug 2024 09:40:26 +0000 (11:40 +0200)] 
Add an xerror_handler parameter to msgdomain_list_print.

* 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.

12 months agoAdd an xerror_handler parameter to read_catalog_stream.
Bruno Haible [Sat, 3 Aug 2024 01:11:18 +0000 (03:11 +0200)] 
Add an xerror_handler parameter to read_catalog_stream.

* gettext-tools/src/read-catalog-abstract.h: Include xerror-handler.h.
(ABSTRACT_CATALOG_READER_TY): Add xeh field.
(catalog_reader_alloc): Add xerror_handler parameter.
* gettext-tools/src/read-catalog-abstract.c: Include xerror-handler.h instead of
po-xerror.h.
(catalog_reader_alloc): Add xerror_handler parameter.
(catalog_reader_parse): Use catr->xeh for error handling.
* gettext-tools/src/read-catalog.h: Include xerror-handler.h.
(default_catalog_reader_alloc, read_catalog_stream): Add xerror_handler
parameter.
* gettext-tools/src/read-catalog.c: Include xerror-handler.h instead of
po-xerror.h.
(default_set_domain, default_add_message): Use catr->xeh for error handling.
(default_catalog_reader_alloc, read_catalog_stream): Add xerror_handler
parameter.
* gettext-tools/src/read-po-lex.h: Include read-catalog-abstract.h.
(po_gram_error_at_line): Add catr parameter.
* gettext-tools/src/read-po-lex.c: Include xerror-handler.h instead of
po-xerror.h.
(po_gram_error): Use ps->catr->xeh for error handling.
(po_gram_error_at_line): Add catr parameter. Use catr->xeh for error handling.
(po_lex_charset_set, mbfile_getc, lex_getc): Use ps->catr->xeh for error
handling.
(keyword_p, po_gram_lex): Update invocations of po_gram_error_at_line.
* gettext-tools/src/read-po-gram.y: Update invocations of po_gram_error_at_line.
* gettext-tools/src/read-properties.c: Include xerror-handler.h instead of
po-xerror.h.
(phase4_getuc, read_escaped_string): Add catr parameter. Use catr->xeh for error
handling.
(properties_parse): Use catr->xeh for error handling.
* gettext-tools/src/read-stringtable.c: Include xerror-handler.h instead of
po-xerror.h.
(phase1_getc, phase2_getc, phase3_getc): Add catr parameter. Use catr->xeh for
error handling.
(phase4_getc): Update.
(read_string, stringtable_parse): Use catr->xeh for error handling.
* gettext-tools/libgettextpo/gettext-po.c (po_file_read): Pass a stack-allocated
xerror_handler to read_catalog_stream.
* gettext-tools/src/msgfmt.c: Include xerror-handler.h.
(read_catalog_file_msgfmt): Use the default xerror_handler.
* gettext-tools/src/read-catalog-file.c: Include xerror-handler.h.
(read_catalog_file): Use the default xerror_handler.
* gettext-tools/src/read-csharp.c: Include xerror-handler.h.
(execute_and_read_po_output): Use the default xerror_handler.
* gettext-tools/src/read-java.c: Include xerror-handler.h.
(execute_and_read_po_output): Use the default xerror_handler.
* gettext-tools/src/read-resources.c: Include xerror-handler.h.
(execute_and_read_po_output): Use the default xerror_handler.
* gettext-tools/src/read-tcl.c: Include xerror-handler.h.
(msgdomain_read_tcl): Use the default xerror_handler.
* gettext-tools/src/x-po.c: Include xerror-handler.h.
(extract): Use the default xerror_handler.
* gettext-tools/src/xgettext.c: Include xerror-handler.h.
(read_exclusion_file): Use the default xerror_handler.

12 months agoAdd xerror-handler.
Bruno Haible [Fri, 2 Aug 2024 22:40:17 +0000 (00:40 +0200)] 
Add xerror-handler.

* gettext-tools/src/xerror-handler.h: New file, based on gettext-tools/src/po-xerror.h.
* gettext-tools/src/xerror-handler.c: New file, based on gettext-tools/src/po-xerror.c.
* gettext-tools/src/Makefile.am (noinst_HEADERS): Add xerror-handler.h.
(COMMON_SOURCE): Add xerror-handler.c.
* gettext-tools/src/FILES: Update.
* gettext-tools/woe32dll/gettextsrc-exports.c (textmode_xerror_handler_struct):
New export.

12 months agoRefactor: Remove K&R C cruft.
Bruno Haible [Sat, 3 Aug 2024 00:15:22 +0000 (02:15 +0200)] 
Refactor: Remove K&R C cruft.

* gettext-tools/src/read-po-lex.c: Remove VARARGS1 and VARARGS2 comments.

12 months agolibgettextpo: Remove backward compatibility with versions < 0.15 (July 2006).
Bruno Haible [Fri, 2 Aug 2024 20:57:06 +0000 (22:57 +0200)] 
libgettextpo: Remove backward compatibility with versions < 0.15 (July 2006).

* gettext-tools/libgettextpo/gettext-po.c (_GL_NO_INLINE_ERROR): Remove macro.
Don't include <error.h>, <stdbool.h>, <stdarg.h>, xerror.h, po-error.h,
format.h.
(orig_error, orig_error_at_line): Remove variables.
(void_multiline_warning, void_multiline_error): Remove functions.
(po_file_read_v2, po_file_read, po_file_write, po_error_logger,
po_message_check_format): Remove functions.
* gettext-tools/libgettextpo/gettext-po.in.h (struct po_error_handler): Update
comment.
* gettext-tools/src/po-xerror.c: Update comment.

12 months agoRefactor: Don't use po_gram_error_at_line outside the PO file reader.
Bruno Haible [Fri, 2 Aug 2024 20:33:13 +0000 (22:33 +0200)] 
Refactor: Don't use po_gram_error_at_line outside the PO file reader.

* gettext-tools/src/msgcmp.c: Include po-xerror.h, xvasprintf.h.
(match_domain, compare): Use po_xerror, po_xerror2 instead of
po_gram_error_at_line.
* gettext-tools/src/msgfmt.c: Include po-xerror.h.
(msgfmt_set_domain): Use po_xerror instead of po_gram_error_at_line.
* gettext-tools/src/msgmerge.c: Include xvasprintf.h.
(match_domain): Use po_xerror, po_xerror2 instead of po_gram_error_at_line.
* gettext-tools/src/read-catalog.c (default_set_domain): Use po_xerror instead
of po_gram_error_at_line.
* gettext-tools/src/xgettext.c: Include po-xerror.h.
(exclude_directive_domain): Use po_xerror instead of po_gram_error_at_line.

12 months agoRename some files, part 2.
Bruno Haible [Fri, 2 Aug 2024 20:28:46 +0000 (22:28 +0200)] 
Rename some files, part 2.

12 months agoRename some files.
Bruno Haible [Fri, 2 Aug 2024 02:40:40 +0000 (04:40 +0200)] 
Rename some files.

* gettext-tools/src/read-po-internal.h: Renamed from
gettext-tools/src/po-gram.h.
* gettext-tools/src/read-po-lex.h: Renamed from gettext-tools/src/po-lex.h.
* gettext-tools/src/read-po-lex.c: Renamed from gettext-tools/src/po-lex.c.
* gettext-tools/src/read-po-gram.y: Renamed from
gettext-tools/src/po-gram-gen.y.
* gettext-tools/src/*.h: Update.
* gettext-tools/src/*.c: Update.
* gettext-tools/src/FILES: Update.
* gettext-tools/src/Makefile.am: Update.
* gettext-tools/libgettextpo/Makefile.am: Update.

12 months agoRefactor includes.
Bruno Haible [Fri, 2 Aug 2024 02:17:50 +0000 (04:17 +0200)] 
Refactor includes.

* gettext-tools/src/read-catalog-abstract.h: Include <stdio.h>. Don't include
po-lex.h.
* gettext-tools/src/read-catalog.c: Include po-lex.h.
* gettext-tools/src/msgcmp.c: Include po-lex.h.
* gettext-tools/src/msgfmt.c: Likewise.
* gettext-tools/src/msgmerge.c: Likewise.
* gettext-tools/src/xgettext.c: Likewise.
* gettext-tools/libgettextpo/gettext-po.c: Likewise.
* gettext-tools/src/x-po.c: Include <error.h>. Don't include po-lex.h.
* gettext-tools/src/read-desktop.h: Include pos.h. Don't include po-lex.h.
* gettext-tools/src/read-desktop.c: Don't include po-lex.h.

12 months agolibgettextpo: Remove static variable gram_pos.
Bruno Haible [Thu, 1 Aug 2024 21:34:37 +0000 (23:34 +0200)] 
libgettextpo: Remove static variable gram_pos.

* gettext-tools/src/po-gram.h (struct po_parser_state): Add field gram_pos.
* gettext-tools/src/po-lex.h (gram_pos): Remove declaration.
* gettext-tools/src/po-lex.c (gram_pos): Remove variable.
(po_gram_error, lex_start, lex_end, lex_getc, lex_ungetc, keyword_p,
po_gram_lex): Access ps->gram_pos instead of gram_pos.
* gettext-tools/src/po-gram-gen.y: Access ps->gram_pos instead of gram_pos.
* gettext-tools/woe32dll/gettextsrc-exports.c (gram_pos): Remove export.

12 months agoRemove some uses of global variable gram_pos.
Bruno Haible [Thu, 1 Aug 2024 21:08:21 +0000 (23:08 +0200)] 
Remove some uses of global variable gram_pos.

* gettext-tools/src/msgfmt.c (msgfmt_comment_special): Use the file name from
the catalog reader instead of gram_pos.
* gettext-tools/src/read-desktop.c (gram_pos): Remove declaration.
(pos): New variable.
(phase2_getc, phase2_ungetc, desktop_lex, desktop_parse): Use it instead of
gram_pos.
* gettext-tools/src/read-properties.c (gram_pos): Remove declaration.
(pos): New variable.
(phase2_getc, phase2_ungetc, phase4_getuc, read_escaped_string,
properties_parse): Use it instead of gram_pos.
* gettext-tools/src/read-stringtable.c (gram_pos): Remove declaration.
(pos): New variable.
(phase3_getc, phase3_ungetc, stringtable_parse): Use it instead of gram_pos.
(read_string): Likewise. Rename a parameter.
(conv_from_ucs4): Rename a local variable.

12 months agoRefactor directive_domain and set_domain methods.
Bruno Haible [Thu, 1 Aug 2024 20:47:17 +0000 (22:47 +0200)] 
Refactor directive_domain and set_domain methods.

* gettext-tools/src/read-catalog-abstract.h
(abstract_catalog_reader_class_ty::directive_domain): Add name_pos parameter.
(catalog_reader_seen_domain): Likewise.
* gettext-tools/src/read-catalog-abstract.c (call_directive_domain,
catalog_reader_seen_domain): Likewise.
* gettext-tools/src/read-catalog.h
(default_catalog_reader_class_ty::set_domain): Add name_pos parameter.
(default_directive_domain, default_set_domain): Likewise.
* gettext-tools/src/read-catalog.c (call_set_domain, default_directive_domain):
Likewise.
(default_set_domain): Add name_pos parameter. Use it instead of the global
variable gram_pos.
* gettext-tools/src/msgfmt.c (msgfmt_set_domain): Likewise.
* gettext-tools/src/xgettext.c (exclude_directive_domain): Likewise.
* gettext-tools/src/po-gram-gen.y: Update catalog_reader_seen_domain invocation.

12 months agoRefactor read-desktop.h.
Bruno Haible [Thu, 1 Aug 2024 20:24:48 +0000 (22:24 +0200)] 
Refactor read-desktop.h.

Rename the parameter of type 'struct desktop_reader_ty *' to reader.

* gettext-tools/src/read-desktop.h (struct desktop_reader_class_ty): Change
parameter names of methods.

12 months agolibgettextpo: Remove static variables 'buf', 'bufmax'.
Bruno Haible [Thu, 1 Aug 2024 15:40:17 +0000 (17:40 +0200)] 
libgettextpo: Remove static variables 'buf', 'bufmax'.

* gettext-tools/src/po-gram.h (struct po_parser_state): Add fields buf, bufmax.
* gettext-tools/src/po-lex.c (lex_start): Initialize them.
(lex_end): Free the buf field.
(po_gram_lex): Use these fields instead of static variables.

12 months agobuild: Enable Automake's dependency tracking.
Bruno Haible [Thu, 1 Aug 2024 15:27:36 +0000 (17:27 +0200)] 
build: Enable Automake's dependency tracking.

Quite often, after changing a struct defined in a .h file, I see "make check"
fail. After "make clean; make", "make check" passes again. This wastes my time.
Unlike 20 years ago, I don't want think about which .o files I need to erase
and rebuild. Build times are now much smaller than they were 20 years ago,
especially when configuring with --disable-shared and CFLAGS="-ggdb".

* gnulib-local/modules/gettext-runtime-misc (configure.ac): Don't augment
AUTOMAKE_OPTIONS.
* gettext-runtime/Makefile.am (AUTOMAKE_OPTIONS): Remove 'no-dependencies'.
* gettext-runtime/intl/Makefile.am (AUTOMAKE_OPTIONS): Likewise.
* gettext-runtime/libasprintf/Makefile.am (AUTOMAKE_OPTIONS): Likewise.
* gettext-runtime/src/Makefile.am (AUTOMAKE_OPTIONS): Likewise.
* gettext-runtime/tests/Makefile.am (AUTOMAKE_OPTIONS): Likewise.
* libtextstyle/Makefile.am (AUTOMAKE_OPTIONS): Likewise.
* libtextstyle/lib/Makefile.am (AUTOMAKE_OPTIONS): Likewise.
* gettext-tools/Makefile.am (AUTOMAKE_OPTIONS): Likewise.
* gettext-tools/gnulib-lib/Makefile.am (AUTOMAKE_OPTIONS): Likewise.
* gettext-tools/libgettextpo/Makefile.am (AUTOMAKE_OPTIONS): Likewise.
* gettext-tools/libgrep/Makefile.am (AUTOMAKE_OPTIONS): Likewise.
* gettext-tools/src/Makefile.am (AUTOMAKE_OPTIONS): Likewise.
* gettext-tools/system-tests/Makefile.am (AUTOMAKE_OPTIONS): Likewise.
* gettext-tools/tests/Makefile.am (AUTOMAKE_OPTIONS): Likewise.
* gettext-tools/tests/gnulib-lib/Makefile.am (AUTOMAKE_OPTIONS): Likewise.
* Makefile.am (AUTOMAKE_OPTIONS): Likewise.

12 months agoRefactor read-catalog-abstract.[hc], read-catalog.[hc], part 2.
Bruno Haible [Thu, 1 Aug 2024 20:21:56 +0000 (22:21 +0200)] 
Refactor read-catalog-abstract.[hc], read-catalog.[hc], part 2.

Rename the parameter of type 'struct default_catalog_reader_ty *' to dcatr.

* gettext-tools/src/read-catalog.h (this): Remove macro.
(struct default_catalog_reader_class_ty): Change parameter names of methods.

12 months agolibgettextpo: Remove static variable pass_comments.
Bruno Haible [Mon, 29 Jul 2024 00:44:40 +0000 (02:44 +0200)] 
libgettextpo: Remove static variable pass_comments.

* gettext-tools/src/read-catalog-abstract.h (ABSTRACT_CATALOG_READER_TY): Add
pass_comments field.
* gettext-tools/src/read-catalog-abstract.c (catalog_reader_alloc): Initialize
pass_comments field.
* gettext-tools/src/read-catalog.c (default_parse_brief): Assign the
pass_comments field, instead of calling po_lex_pass_comments.
* gettext-tools/src/po-lex.h (po_lex_pass_comments): Remove declaration.
* gettext-tools/src/po-lex.c (pass_comments): Remove variable.
(po_gram_lex): Update.
(po_lex_pass_comments): Remove function.

12 months agolibgettextpo: Remove static variable pass_obsolete_entries.
Bruno Haible [Mon, 29 Jul 2024 00:11:43 +0000 (02:11 +0200)] 
libgettextpo: Remove static variable pass_obsolete_entries.

* gettext-tools/src/read-catalog-abstract.h (ABSTRACT_CATALOG_READER_TY): Add
pass_obsolete_entries field.
* gettext-tools/src/read-catalog-abstract.c (catalog_reader_alloc): Initialize
the pass_obsolete_entries field.
* gettext-tools/src/read-catalog.c (read_catalog_stream): Assign the
pass_obsolete_entries field, instead of calling po_lex_pass_obsolete_entries.
* gettext-tools/src/msgfmt.c (read_catalog_file_msgfmt): Likewise.
* gettext-tools/src/po-lex.h (pass_obsolete_entries): Remove declaration.
(po_lex_pass_obsolete_entries): Remove declaration.
* gettext-tools/src/po-lex.c (pass_obsolete_entries): Remove variable.
(po_lex_pass_obsolete_entries): Remove function.
* gettext-tools/src/po-gram-gen.y: Update.
* gettext-tools/woe32dll/gettextsrc-exports.c (pass_obsolete_entries): Remove
export.

12 months agolibgettextpo: Remove static variables po_lex_charset, po_lex_iconv, po_lex_isolate_...
Bruno Haible [Sun, 28 Jul 2024 19:32:56 +0000 (21:32 +0200)] 
libgettextpo: Remove static variables po_lex_charset, po_lex_iconv, po_lex_isolate_*, po_lex_weird_cjk.

* gettext-tools/src/read-catalog-abstract.h (ABSTRACT_CATALOG_READER_TY): Add
fields po_lex_isolate_start, po_lex_isolate_end.
* gettext-tools/src/read-catalog-abstract.c (catalog_reader_alloc): Initialize
the new abstract_catalog_reader_ty fields.
(parse_comment_filepos): Update.
* gettext-tools/src/po-gram.h: Include <iconv.h>.
(struct po_parser_state): Add fields po_lex_charset, po_lex_iconv,
po_lex_weird_cjk.
* gettext-tools/src/po-lex.h (lex_end): Add a 'struct po_parser_state *'
parameter.
(po_lex_charset_set): New declaration, moved here from po-charset.h.
* gettext-tools/src/po-lex.c: Include xmalloca.h, basename-lgpl.h, progname.h,
c-strstr.h.
(po_lex_charset_init, po_lex_charset_set, po_lex_charset_close): Moved here from
po-charset.c. Take a 'struct po_parser_state *' as argument.
(mb_width, mbfile_getc, lex_start): Update.
(lex_end): Add a 'struct po_parser_state *' parameter.
* gettext-tools/src/po-charset.h (po_lex_charset, po_lex_isolate_start,
po_lex_isolate_end, po_lex_iconv, po_lex_weird_cjk): Remove declarations.
(po_lex_charset_init, po_lex_charset_set, po_lex_charset_close): Remove
declarations.
* gettext-tools/src/po-charset.c: Don't include <stdlib.h>, xmalloca.h,
xvasprintf.h, po-xerror.h, basename-lgpl.h, progname.h, c-strstr.h.
(po_lex_charset, po_lex_isolate_start, po_lex_isolate_end, po_lex_iconv,
po_lex_weird_cjk): Remove variables.
(po_lex_charset_init, po_lex_charset_set, po_lex_charset_close): Moved to
po-lex.c.
* gettext-tools/src/po-gram-gen.y: Update.
* gettext-tools/src/read-po.c (po_parse): Update.
* gettext-tools/woe32dll/gettextsrc-exports.c (po_lex_charset,
po_lex_isolate_start, po_lex_isolate_end, po_lex_iconv, po_lex_weird_cjk):
Remove exports.

12 months agoRefactor.
Bruno Haible [Sun, 28 Jul 2024 19:44:14 +0000 (21:44 +0200)] 
Refactor.

* gettext-tools/src/its.c (struct its_rule_class_ty): Change parameter names of
methods.
(its_rule_destructor, its_translate_rule_constructor, its_translate_rule_eval,
its_localization_note_rule_constructor, its_localization_note_rule_eval,
its_element_within_text_rule_constructor, its_element_within_text_rule_eval,
its_preserve_space_rule_constructor, its_preserve_space_rule_eval,
its_extension_context_rule_constructor, its_extension_context_rule_eval,
its_extension_escape_rule_constructor, its_extension_escape_rule_eval,
its_rule_destroy): Rename parameter 'pop' to 'rule'.
(its_rule_alloc): Rename local variable 'pop' to 'rule'.

12 months agoRefactor: Rename local variables of type '*_catalog_reader_ty *'.
Bruno Haible [Sun, 28 Jul 2024 20:00:01 +0000 (22:00 +0200)] 
Refactor: Rename local variables of type '*_catalog_reader_ty *'.

* gettext-tools/src/xgettext.c (read_exclusion_file): Rename local variable
'pop' to 'catr'.
* gettext-tools/src/read-catalog.c (read_catalog_stream): Rename local variable
'pop' to 'dcatr'.

12 months agoRefactor read-catalog-special.[hc], part 2.
Bruno Haible [Sun, 28 Jul 2024 18:34:25 +0000 (20:34 +0200)] 
Refactor read-catalog-special.[hc], part 2.

* gettext-tools/src/read-catalog.c: Include read-catalog-special.h.
* gettext-tools/src/xg-message.c: Include read-catalog-special.h instead of
read-catalog-abstract.h.
* gettext-tools/src/x-ruby.c: Likewise.

12 months agoRefactor.
Bruno Haible [Sun, 28 Jul 2024 17:26:22 +0000 (19:26 +0200)] 
Refactor.

* gettext-tools/src/read-catalog-abstract.h (catalog_reader_seen_domain):
Renamed from po_callback_domain.
(catalog_reader_seen_message): Renamed from po_callback_message.
(catalog_reader_seen_comment): Renamed from po_callback_comment.
(catalog_reader_seen_comment_dot): Renamed from po_callback_comment_dot.
(catalog_reader_seen_comment_filepos): Renamed from po_callback_comment_filepos.
(catalog_reader_seen_comment_special): Renamed from po_callback_comment_special.
(catalog_reader_seen_generic_comment): Renamed from
po_callback_comment_dispatcher.
* gettext-tools/src/read-catalog-abstract.c (catalog_reader_seen_domain):
Renamed from po_callback_domain.
(catalog_reader_seen_message): Renamed from po_callback_message.
(catalog_reader_seen_comment): Renamed from po_callback_comment.
(catalog_reader_seen_comment_dot): Renamed from po_callback_comment_dot.
(catalog_reader_seen_comment_filepos): Renamed from po_callback_comment_filepos.
(catalog_reader_seen_comment_special): Renamed from po_callback_comment_special.
(parse_comment_filepos, parse_comment_solaris_filepos): Update.
(catalog_reader_seen_generic_comment): Renamed from
po_callback_comment_dispatcher. Update.
* gettext-tools/src/po-gram-gen.y: Update.
* gettext-tools/src/read-properties.c (properties_parse): Update.
* gettext-tools/src/read-stringtable.c (special_comment_finish,
comment_line_end, stringtable_parse): Update.

12 months agoRefactor.
Bruno Haible [Sun, 28 Jul 2024 17:05:05 +0000 (19:05 +0200)] 
Refactor.

* gettext-tools/src/read-catalog-abstract.c (parse_comment_filepos): Renamed
from po_parse_comment_filepos.
(parse_comment_solaris_filepos): Renamed from po_parse_comment_solaris_filepos.
(po_callback_comment_dispatcher): Update.

12 months agoRefactor.
Bruno Haible [Sun, 28 Jul 2024 15:30:53 +0000 (17:30 +0200)] 
Refactor.

* gettext-tools/src/read-catalog-special.h (parse_comment_special): Renamed from
po_parse_comment_special.
* gettext-tools/src/read-catalog-special.c (parse_comment_special): Renamed from
po_parse_comment_special.
* gettext-tools/src/read-catalog.c (default_comment_special): Update.
* gettext-tools/src/xg-message.c (remember_a_message): Update.
* gettext-tools/src/x-ruby.c (extract_ruby): Update.
* gettext-tools/src/xgettext.c (xgettext_record_flag): Update comment.

12 months agoRefactor.
Bruno Haible [Sun, 28 Jul 2024 15:02:45 +0000 (17:02 +0200)] 
Refactor.

* gettext-tools/src/read-catalog-special.h: New file, extracted from
gettext-tools/src/read-catalog-abstract.h.
* gettext-tools/src/read-catalog-special.c: New file, extracted from
gettext-tools/src/read-catalog-abstract.c.
* gettext-tools/src/read-catalog-abstract.h (po_parse_comment_special): Remove
declaration.
* gettext-tools/src/read-catalog-abstract.c: Don't include <limits.h>.
(po_parse_comment_special): Moved to read-catalog-special.c.
* gettext-tools/src/Makefile.am (noinst_HEADERS): Add read-catalog-special.h.
(libgettextsrc_la_SOURCES): Add read-catalog-special.c.
* gettext-tools/src/FILES: Update.
* gettext-tools/libgettextpo/Makefile.am (libgettextpo_la_AUXSOURCES): Add
../src/read-catalog-special.c.

12 months agolibgettextpo: Remove static variable callback_arg.
Bruno Haible [Sun, 28 Jul 2024 14:08:25 +0000 (16:08 +0200)] 
libgettextpo: Remove static variable callback_arg.

* gettext-tools/src/read-catalog-abstract.h (po_callback_domain,
po_callback_message, po_callback_comment, po_callback_comment_dot,
po_callback_comment_filepos, po_callback_comment_special,
po_callback_comment_dispatcher): Add a first parameter 'catr'.
* gettext-tools/src/read-catalog-abstract.c (callback_arg): Remove variable.
(parse_start, parse_end): Remove functions.
(catalog_reader_parse): Inline them here.
(po_callback_domain, po_callback_message, po_callback_comment,
po_callback_comment_dot, po_callback_comment_filepos,
po_callback_comment_special, po_parse_comment_filepos,
po_parse_comment_solaris_filepos, po_callback_comment_dispatcher): Add a first
parameter 'catr'.
* gettext-tools/src/po-gram.h: Include read-catalog-abstract.h.
(struct po_parser_state): Add field 'catr'.
* gettext-tools/src/read-po.c (po_parse): Initialize the 'catr' field.
* gettext-tools/src/po-gram-gen.y: Pass ps->catr to po_callback_message,
po_callback_comment_dispatcher, po_callback_domain.
* gettext-tools/src/read-properties.c (properties_parse): Pass catr to
po_callback_comment_dispatcher, po_callback_message.
* gettext-tools/src/read-stringtable.c (special_comment_finish,
comment_line_end, phase4_getc, read_string): Add a first parameter 'catr'.
(stringtable_parse): Pass catr to the functions that need it.

12 months agoRefactor.
Bruno Haible [Sun, 28 Jul 2024 12:29:22 +0000 (14:29 +0200)] 
Refactor.

Rename the parameter of type 'abstract_catalog_reader_ty *' to catr.
Rename the parameter of type 'default_catalog_reader_ty *' to dcatr.
Rename the parameter of type 'msgfmt_catalog_reader_ty *' to mcatr.

* gettext-tools/src/read-catalog-abstract.h (abstract_catalog_reader_class_ty):
Change first parameter name of all methods.
(struct catalog_input_format): Likewise.
(catalog_reader_parse, catalog_reader_free): Change first parameter name.
* gettext-tools/src/read-catalog-abstract.c (catalog_reader_alloc): Rename local
variable 'pop'.
(catalog_reader_free, call_parse_brief, call_parse_debrief,
call_directive_domain, call_directive_message, call_comment, call_comment_dot,
call_comment_filepos, call_comment_special, parse_start, parse_end,
catalog_reader_parse): Change first parameter name.
* gettext-tools/src/read-catalog.h (default_constructor, default_destructor,
default_parse_brief, default_parse_debrief, default_directive_domain,
default_directive_message, default_comment, default_comment_dot,
default_comment_filepos, default_comment_special, default_set_domain,
 default_add_message): Change first parameter name.
* gettext-tools/src/read-catalog.c (call_set_domain, call_add_message,
call_frob_new_message, default_constructor, default_destructor,
default_parse_brief, default_parse_debrief, default_copy_comment_state,
default_reset_comment_state, default_directive_domain,
default_directive_message, default_comment, default_comment_dot,
default_comment_filepos, default_comment_special, default_set_domain,
default_add_message): Change first parameter name.
* gettext-tools/src/msgfmt.c (msgfmt_constructor, msgfmt_parse_debrief,
msgfmt_set_domain, msgfmt_add_message, msgfmt_frob_new_message,
msgfmt_comment_special): Change first parameter name.
(read_catalog_file_msgfmt): Rename local variable 'pop'.
* gettext-tools/src/x-po.c (extract): Rename local variable 'pop'.
* gettext-tools/src/xgettext.c (exclude_directive_domain,
exclude_directive_message): Change first parameter name.
* gettext-tools/src/read-po.c (po_parse): Change first parameter name.
* gettext-tools/src/read-properties.c (properties_parse): Likewise.
* gettext-tools/src/read-stringtable.c (stringtable_parse): Likewise.

12 months agoRefactor.
Bruno Haible [Sun, 28 Jul 2024 11:42:43 +0000 (13:42 +0200)] 
Refactor.

* gettext-tools/src/read-catalog-abstract.h: Improve comments.
* gettext-tools/src/read-catalog-abstract.c: Likewise.
* gettext-tools/src/read-catalog.h: Likewise.
* gettext-tools/src/read-catalog.c: Likewise.

12 months agoRefactor.
Bruno Haible [Sun, 28 Jul 2024 11:24:29 +0000 (13:24 +0200)] 
Refactor.

* gettext-tools/src/read-catalog-abstract.h
(abstract_catalog_reader_class_ty::comment_filepos): Change parameter names.
(po_callback_comment_filepos): Likewise.
* gettext-tools/src/read-catalog-abstract.c (call_comment_filepos,
po_callback_comment_filepos): Likewise.
* gettext-tools/src/read-catalog.h (default_comment_filepos): Likewise.
* gettext-tools/src/read-catalog.c (default_comment_filepos): Likewise.

12 months agoRefactor.
Bruno Haible [Sun, 28 Jul 2024 07:41:17 +0000 (09:41 +0200)] 
Refactor.

* gettext-tools/src/message.h (message_comment_filepos): Change parameter names.
* gettext-tools/src/message.c (message_comment_filepos): Likewise.

12 months agopo-mode: Avoid a compiler warning in Emacs 28.
Bruno Haible [Sat, 27 Jul 2024 20:13:02 +0000 (22:13 +0200)] 
po-mode: Avoid a compiler warning in Emacs 28.

Reported by Vincent Lefèvre <vincent@vinc17.net> via Santiago Vila
at <https://lists.gnu.org/archive/html/bug-gettext/2024-06/msg00031.html>.

* gettext-tools/emacs/po-mode.el (po-mode-version-string): Bump version.
(po-mode): Use write-contents-functions instead of write-contents-hooks.

12 months agoxgettext: PO: Fix error when a --exclude-file option is present (regression 2023...
Bruno Haible [Sat, 27 Jul 2024 19:05:27 +0000 (21:05 +0200)] 
xgettext: PO: Fix error when a --exclude-file option is present (regression 2023-03-10).

Reported by Nicolas Peugnet <n.peugnet@free.fr> via Santiago Vila
at <https://lists.gnu.org/archive/html/bug-gettext/2024-07/msg00030.html>.

* gettext-tools/src/x-po.c (extract_add_message): If the message is the header
entry and is among the messages to exclude, save the header charset from it
before discarding it.
* gettext-tools/tests/xgettext-po-5: New file, based on
gettext-tools/tests/xgettext-po-3.
* gettext-tools/tests/Makefile.am (TESTS): Add it.