278 Commits

Author SHA1 Message Date
Bruno Haible
5f955e8193 build: Remove duplicate file from version control.
* gettext-tools/examples/po/remove-potcdate.sed: Remove file.
* autogen.sh: Copy remove-potcdate.sed to
gettext-tools/examples/po/remove-potcdate.sed.
2025-10-19 08:34:24 +02:00
Bruno Haible
8c716a85ec New directory gettext-tools/wizard/po-templates/traditional/.
* gettext-tools/wizard/po-templates/traditional/*: New files, moved here from
gettext-runtime/po/.
* gettext-tools/wizard/po-templates/traditional/Makefile.in.in (install-data,
installdirs-data, uninstall-data, dist2): Remove special code for the
'gettext-tools' package.
* gettext-tools/wizard/po-templates/traditional/Makevars.template: Moved here
from gettext-tools/po/.
* autogen.sh: Copy the contents of the gettext-runtime/po/ and gettext-tools/po/
directories from gettext-tools/wizard/po-templates/traditional/.
* gettext-tools/wizard/Makefile.am (pkgdatadir, podir): New variables.
(po_DATA): Add po-templates/traditional/*.
(EXTRA_DIST): Likewise.
(uninstall-sources): Also remove $(podir)/Makevars.
* Makefile.am (distcheck-hook): Update.
2025-10-18 19:44:04 +02:00
Bruno Haible
eb25e838ad build: Make autogen.sh more reliable.
* autogen.sh: Fail if gnulib-tool fails.
2025-08-05 22:09:01 +02:00
Bruno Haible
3703298b8b Refactor: Use gnulib's 'options' module.
* autogen.sh (GNULIB_MODULES_RUNTIME_FOR_SRC, GNULIB_MODULES_TOOLS_FOR_SRC): Add
'options'. Remove 'getopt-gnu'.
* gettext-runtime/src/envsubst.c: Include options.h instead of <getopt.h>.
(long_options): Remove variable.
(main): Define options array here. Call start_options, get_next_option instead
of getopt_long().
* gettext-runtime/src/gettext.c: Likewise.
* gettext-runtime/src/ngettext.c: Likewise.
* gettext-runtime/src/printf_gettext.c: Likewise.
* gettext-runtime/src/printf_ngettext.c: Likewise.
* gettext-tools/src/cldr-plurals.c: Likewise.
* gettext-tools/src/hostname.c: Likewise.
* gettext-tools/src/msgattrib.c: Likewise.
* gettext-tools/src/msgcat.c: Likewise.
* gettext-tools/src/msgcmp.c: Likewise.
* gettext-tools/src/msgcomm.c: Likewise.
* gettext-tools/src/msgconv.c: Likewise.
* gettext-tools/src/msgen.c: Likewise.
* gettext-tools/src/msgexec.c: Likewise.
* gettext-tools/src/msgfilter.c: Likewise.
* gettext-tools/src/msgfmt.c: Likewise.
* gettext-tools/src/msggrep.c: Likewise.
* gettext-tools/src/msginit.c: Likewise.
* gettext-tools/src/msgmerge.c: Likewise.
* gettext-tools/src/msgunfmt.c: Likewise.
* gettext-tools/src/msguniq.c: Likewise.
* gettext-tools/src/recode-sr-latin.c: Likewise.
* gettext-tools/src/urlget.c: Likewise.
* gettext-tools/src/xgettext.c: Likewise.
* gettext-tools/tests/tstgettext.c: Likewise.
* gettext-tools/tests/tstngettext.c: Likewise.
2025-06-28 23:48:03 +02:00
Bruno Haible
3a763e6a6b build: Use module 'kwset' from gnulib.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_LIBGREP): Add kwset.
(GNULIB_MODULES_TOOLS_FOR_SRC_COMMON_DEPENDENCIES): Update.
* gettext-tools/libgrep/m-fgrep.c (Fcompile, Fexecute): Update for changed kwset
API.
* gettext-tools/libgrep/kwset.h: Remove file.
* gettext-tools/libgrep/kwset.c: Remove file.
* gettext-tools/libgrep/Makefile.am (libgrep_a_SOURCES): Remove kwset.h,
kwset.c.
2025-06-27 00:04:45 +02:00
Bruno Haible
a121288fc3 build: Update regarding current gnulib.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC_COMMON_DEPENDENCIES): Update.
2025-06-26 23:16:55 +02:00
Bruno Haible
22546c9c06 gettext-runtime: New programs 'printf_gettext', 'printf_ngettext'.
* autogen.sh (GNULIB_MODULES_RUNTIME_FOR_SRC): Add c-ctype, c-strtold,
fzprintf-posix, mbrtoc32, mbszero, quote, stdint-h, strtoimax, strtold,
strtoumax, xstrtold.
* gettext-runtime/src/printf-command.h: New file.
* gettext-runtime/src/printf-command.c: New file.
* gettext-runtime/src/printf_gettext.c: New file.
* gettext-runtime/src/Makefile.am (bin_PROGRAMS): Add printf_gettext,
printf_ngettext.
(noinst_LIBRARIES, libgrtsrc_a_SOURCES): New variables.
(printf_gettext_SOURCES, printf_gettext_CFLAGS, printf_gettext_LDFLAGS): New
variables.
(printf_ngettext_SOURCES, printf_ngettext_CFLAGS, printf_ngettext_LDFLAGS): New
variables.
(LDADD): Add libgrtsrc.a.
* gettext-runtime/po/POTFILES.in: Add src/printf-command.c,
src/printf_gettext.c, src/printf_ngettext.c.
* gettext-runtime/man/printf_gettext.x: New file.
* gettext-runtime/man/printf_ngettext.x: New file.
* gettext-runtime/man/Makefile.am (man_aux): Add printf_gettext.x,
printf_ngettext.x.
(man_MAN1GEN): Add printf_gettext.1, printf_ngettext.1.
(man_MAN1IN): Add printf_gettext.1.in, printf_ngettext.1.in.
(man_HTML1GEN): Add printf_gettext.1.html, printf_ngettext.1.html.
(man_HTML1IN): Add printf_gettext.1.html.in, printf_ngettext.1.html.in.
(printf_gettext.1, rintf_ngettext.1, printf_gettext.1.in, printf_ngettext.1.in):
Add dependencies.
(printf_gettext.1.html, printf_ngettext.1.html, printf_gettext.1.html.in,
printf_ngettext.1.html.in): Likewise.
* gettext-runtime/Makefile.am (distdir1): Depend on man/printf_gettext.1 and
man/printf_ngettext.1.
(man/printf_gettext.1, man/printf_ngettext.1): Depend on gen-man1.
(gen-man1): Make src/printf_gettext, src/printf_ngettext and printf_gettext.1,
printf_ngettext.1.
* gettext-runtime/doc/rt-printf_gettext.texi: New file.
* gettext-runtime/doc/rt-printf_ngettext.texi: New file.
* gettext-runtime/doc/Makefile.am (EXTRA_DIST): Add them.
* gettext-tools/doc/lang-sh.texi (printf_gettext Invocation,
printf_ngettext Invocation): New subsubsections.
* gettext-tools/doc/gettext.texi (@direntry): Add printf_gettext, .
* gettext-tools/doc/Makefile.am (gettext_TEXINFOS): Add rt-printf_gettext.texi,
rt-printf_ngettext.texi.
* gettext-runtime/NEWS: Mention the new programs.
* NEWS: Likewise.
* PACKAGING: Add the printf_gettext and printf_ngettext programs and their
documentation.
2025-06-25 04:16:03 +02:00
Bruno Haible
b6d13dc267 build: Fix build error on MSVC with --enable-shared.
* autogen.sh: Avoid the float-h-tests, since they reference the variables
gl_FLT_SNAN, gl_DBL_SNAN, gl_LDBL_SNAN.
2025-06-06 19:44:05 +02:00
Bruno Haible
f02b67c633 build: Fix MSVC builds with --enable-shared.
This was a regression in commit 8e914861708ed459a2ae8157eb60d89375ab46cd
from 2023-09-06.

Thanks to Kirill Makurin <maiddaisuki@outlook.com> for fruitful discussions.

* autogen.sh: Among the gnulib-tests, avoid the modules array-map-tests,
array-oset-tests, carray-list-tests, and uninorm/decomposing-form-tests, since
they use variables from libgettextlib.
* gettext-tools/configure.ac (GL_GNULIB_LIBUNISTRING_DLL_VARIABLE_NAME): New
variable.
(WOE32DLL): New C macro.
(DLL_VARIABLE): On MSVC with --enable-shared, define to '__declspec(dllexport)'
when compiling libgettextlib, and define to '__declspec(dllimport)' when
compiling the programs in src/.
(LIBGETTEXTSRC_DLL_VARIABLE): New C macro.
* gettext-tools/gnulib-lib/Makefile.am (AM_CPPFLAGS): Define the C macro
IN_LIBGETTEXTLIB.
* gettext-tools/src/Makefile.am (libgettextsrc_la_CPPFLAGS): Define the C macro
IN_LIBGETTEXTSRC.
* gettext-tools/src/format.h: Use LIBGETTEXTSRC_DLL_VARIABLE instead of
DLL_VARIABLE.
* gettext-tools/src/message.h: Likewise.
* gettext-tools/src/msgl-cat.h: Likewise.
* gettext-tools/src/plural-table.h: Likewise.
* gettext-tools/src/po-charset.h: Likewise.
* gettext-tools/src/po-error.h: Likewise.
* gettext-tools/src/read-catalog.h: Likewise.
* gettext-tools/src/read-po.h: Likewise.
* gettext-tools/src/read-properties.h: Likewise.
* gettext-tools/src/read-stringtable.h: Likewise.
* gettext-tools/src/sentence.h: Likewise.
* gettext-tools/src/write-po.h: Likewise.
* gettext-tools/src/write-properties.h: Likewise.
* gettext-tools/src/write-stringtable.h: Likewise.
* gettext-tools/src/xerror-handler.h: Likewise.
* gettext-tools/libgettextpo/Makefile.am (config.h): Override the value of
LIBGETTEXTSRC_DLL_VARIABLE.
* gettext-runtime/configure.ac (WOE32DLL): New C macro.
(DLL_VARIABLE): Define to empty always.
2025-06-05 21:43:23 +02:00
Bruno Haible
b5c42c062c Fix compilation error on MSVC due to conflict of different stdlib.h files.
Reported by Kirill Makurin <maiddaisuki@outlook.com> in
<https://lists.gnu.org/archive/html/bug-gettext/2025-05/msg00071.html>.

* autogen.sh: Change gnulib-tool invocation for libgrep.
* gettext-tools/configure.ac (AC_CONFIG_FILES): Add libgrep/gnulib-lib/Makefile.
* gettext-tools/libgrep/Makefile.am: Don't include Makefile.gnulib.
(SUBDIRS): New variable.
(noinst_LIBRARIES): Add libgrep.a.
(AM_CPPFLAGS): Add -I options for gnulib-lib subdirectory.
(libgrep_a_DEPENDENCIES): New variable.
* gettext-tools/libgrep/gnulib-lib/Makefile.am: New file.
* gettext-tools/src/Makefile.am (LIBGREP): Add ../libgrep/gnulib-lib/libgnu.a.
2025-06-05 21:43:15 +02:00
Bruno Haible
f744352a02 build: Mark automake 1.18 as supported.
* autogen.sh: Update comment.
* m4/fixautomake.m4 (FIX_MAKEFILE_DISTRIB): Likewise.
2025-05-31 15:24:26 +02:00
Bruno Haible
7f9ef13e48 doc: Update, now that autopull.sh does more than a gnulib checkout.
* autogen.sh: Update comments.
* HACKING: Improve formatting.
2025-05-16 11:31:00 +02:00
Bruno Haible
a6cafd7ae4 xgettext: Allow ignoring specific files in the POT-Creation-Date computation.
Reported by Vaclav Slavik <vaclav@slavik.io>
at <https://savannah.gnu.org/users/vslavik>.

* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add hashkey-string, set.
* gettext-tools/src/xgettext.c: Include gl_set.h, gl_xset.h, gl_hash_set.h,
hashkey-string.h.
(generated_files): New variables.
(long_options): New option '--generated'.
(main): Initialize generated_files. Handle the option '--generated'.
(usage): Document the option '--generated'.
(finalize_header): Filter out the generated_files from the file list.
* gettext-tools/doc/xgettext.texi: Document the option '--generated'.
* gettext-tools/tests/xgettext-git-1: Test the --generated option.
* NEWS: Mention the new option.
2025-05-04 18:44:22 +02:00
Bruno Haible
4d743ba206 xgettext: Give a hint about --no-git when max_vc_mtime() took more than 10 sec.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add getrusage.
* gettext-tools/src/xgettext.c: Include <sys/resource.h>.
(max_mtime): New function.
(finalize_header): Invoke it.
2025-05-02 17:02:17 +02:00
Bruno Haible
26c8529d0e xgettext: Add an option to opt-out of the use of git for the POT-Creation-Date.
Reported by Serhii Tereshchenko at <https://savannah.gnu.org/bugs/?66865>.

* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add stat-time.
* gettext-tools/src/xgettext.c: Include stat-time.h.
(xgettext_no_git): New variable.
(long_options): Add option '--no-git'.
(main): Handle the option --no-git.
(usage): Document the option --no-git.
(struct accumulator): New type, copied from gnulib/lib/vc-mtime.c.
(accumulate): New function, copied from gnulib/lib/vc-mtime.c.
(max_mtime_without_git): New function, based on gnulib/lib/vc-mtime.c.
(finalize_header): Conditionally invoke max_mtime_without_git instead of
max_vc_mtime.
* gettext-tools/doc/xgettext.texi: Document the option --no-git.
* NEWS: Mention the change.
2025-05-02 16:06:45 +02:00
Bruno Haible
edff5c9ab2 build: Take the mem-hash-map module from Gnulib now, part 2.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add next-prime.
* gettext-tools/src/write-mo.c: Include next-prime.h.
* gettext-tools/src/write-qt.c: Likewise.
2025-04-30 16:43:06 +02:00
Bruno Haible
6e2d484a30 Update to the newest gnulib.
* gnulib-local/lib/hash.h.diff: Remove file.
* gnulib-local/lib/hash.c.diff: Remove file.
* gnulib-local/Makefile.am (EXTRA_DIST): Remove them.
* autogen.sh: Avoid module hashcode-string1.
2025-04-30 13:25:22 +02:00
Bruno Haible
281658406b Modula-2 support: Add a unit test.
* autogen.sh (GNULIB_MODULES_TOOLS_OTHER): Add modula2, modula2comp-script.
* gettext-tools/configure.ac: Set and substitute BUILDMODULA2.
* gettext-tools/tests/init-env.in: Propagate MODULA2_CHOICE, BUILDMODULA2, M2C,
M2FLAGS.
* gettext-tools/tests/lang-modula2: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.
2025-04-25 03:20:42 +02:00
Bruno Haible
de3fff8d99 Modula-2 support: Add the runtime library.
* gnulib-local/m4/modula2.m4: New file.
* gnulib-local/modules/modula2: New file.
* gnulib-local/Makefile.am (EXTRA_DIST): Add modula2.m4 and the 'modula2'
module.
* autogen.sh (GNULIB_MODULES_RUNTIME_OTHER): Add modula2, modula2comp-script.
* gettext-runtime/intl-modula2/Libintl.def.in: New file.
* gettext-runtime/intl-modula2/Libintl.mod: New file.
* gettext-runtime/intl-modula2/LibintlFromC.def: New file.
* gettext-runtime/intl-modula2/Makefile.am: New file.
* gettext-runtime/intl-modula2/HACKING: New file.
* gettext-runtime/configure.ac: Invoke gt_MODULA2_CHOICE, gt_MODULA2COMP.
Determine VALUE_OF_LC_* for each LC_* constant. Set the variable BUILDMODULA2
and the Automake conditional BUILD_MODULA2.
* gettext-runtime/Makefile.am (SUBDIRS): Add intl-modula2.
* NEWS: Mention libintl_m2.so.
* gettext-runtime/NEWS: Likewise.
* PACKAGING: Add the interface and binary for the libintl_m2 library.
* DEPENDENCIES: Mention the Modula-2 compiler and runtime.
2025-04-25 03:16:21 +02:00
Bruno Haible
0f1ebb7871 D support: Add a unit test.
* autogen.sh (GNULIB_MODULES_TOOLS_OTHER): Add d, dcomp-script.
* gettext-tools/configure.ac: Set and substitute BUILDD.
* gettext-tools/tests/init-env.in: Propagate D_CHOICE, BUILDD.
* gettext-tools/tests/lang-d: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.
2025-04-01 17:34:58 +02:00
Bruno Haible
eaf1a8b271 D support: Add D support in the tools.
* autopull.sh: Check out tree-sitter-d. Set TREE_SITTER_D_VERSION.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add unistr/u16-check,
unistr/u16-to-u8, unistr/u32-check, unistr/u32-to-u8.
* gettext-tools/build-aux/tree-sitter-d-portability.diff: New file.
* gettext-tools/configure.ac: Set TREE_SITTER_D_VERSION.
* gettext-tools/Makefile.am (EXTRA_DIST): Add the tree-sitter-d source code and
patch.
* gettext-tools/doc/lang-d.texi: New file.
* gettext-tools/doc/Makefile.am (gettext_TEXINFOS): Add it.
* gettext-tools/doc/gettext.texi (PO Files): Mention d-format.
(No string concatenation): Mention string concatenation and string interpolation
in D.
(Translators for other Languages): New subsection "D Format Strings".
(List of Programming Languages): Include lang-d.texi.
* gettext-tools/doc/xgettext.texi: Document the -L D option.
* gettext-tools/src/message.h (format_d): New enum value.
(NFORMATS): Increment.
* gettext-tools/src/message.c (format_language, format_language_pretty): Add an
entry for format_d.
* gettext-tools/src/format-d.c: New file, based on
gettext-tools/src/format-lisp.c.
* gettext-tools/src/format.h (formatstring_d): New declaration.
* gettext-tools/src/format.c (formatstring_parsers): Add formatstring_d.
* gettext-tools/src/x-d.h: New file.
* gettext-tools/src/x-d.c: New file, based on gettext-tools/src/x-rust.c and
gettext-tools/src/x-go.c.
* gettext-tools/src/html5-entities.h: New file.
* gettext-tools/src/xgettext.c: Include x-d.h.
(flag_table_d): New variable.
(main): Invoke init_flag_table_d, x_d_extract_all, x_d_keyword.
(usage): Document the -L D option.
(xgettext_record_flag): Support format_d.
(language_to_extractor, extension_to_language): Support D.
* gettext-tools/src/xg-message.c (decide_is_format, remember_a_message_plural):
Add better heuristic for c-format and d-format.
* gettext-tools/src/FILES: Mention format-d.c, x-d.h, x-d.c, html5-entities.h.
* gettext-tools/src/Makefile.am (noinst_HEADERS): Add x-d.h, html5-entities.h.
(FORMAT_SOURCE): Add format-d.c.
(libxgettextts2_a_SOURCES): Add d-parser.c, d-scanner.c.
(xgettext_SOURCES): Add x-d.c.
* gettext-tools/libgettextpo/Makefile.am (libgettextpo_la_AUXSOURCES): Add
format-d.c.
* gettext-tools/po/POTFILES.in: Add src/format-d.c, src/x-d.c.
* gettext-tools/woe32dll/gettextsrc-exports.c: Export formatstring_d.
* gettext-tools/tests/format-d-1: New file.
* gettext-tools/tests/format-d-2: New file.
* gettext-tools/tests/xgettext-d-1: New file.
* gettext-tools/tests/xgettext-d-2: New file.
* gettext-tools/tests/xgettext-d-3: New file.
* gettext-tools/tests/xgettext-d-4: New file.
* gettext-tools/tests/xgettext-d-5: New file, based on
gettext-tools/tests/xgettext-rust-5.
* gettext-tools/tests/xgettext-d-6: New file, based on
gettext-tools/tests/xgettext-rust-7.
* gettext-tools/tests/testdata/dprog.utf-8.d: New file.
* gettext-tools/tests/testdata/dprog.utf-8+bom.d: New file, based on
gettext-tools/tests/testdata/dprog.utf-8.d.
* gettext-tools/tests/testdata/dprog.utf-16be.d: New file, based on
gettext-tools/tests/testdata/dprog.utf-8.d.
* gettext-tools/tests/testdata/dprog.utf-16le.d: New file, based on
gettext-tools/tests/testdata/dprog.utf-8.d.
* gettext-tools/tests/testdata/dprog.utf-32be.d: New file, based on
gettext-tools/tests/testdata/dprog.utf-8.d.
* gettext-tools/tests/testdata/dprog.utf-32le.d: New file, based on
gettext-tools/tests/testdata/dprog.utf-8.d.
* gettext-tools/tests/Makefile.am (TESTS): Add the new tests.
(EXTRA_DIST): Add the new testdata files.
* NEWS: Mention the D support.
2025-04-01 13:01:05 +02:00
Bruno Haible
0bc6dfc727 D support: Add the runtime library.
* gnulib-local/m4/d.m4: New file.
* gnulib-local/modules/d: New file.
* gnulib-local/Makefile.am (EXTRA_DIST): Add d.m4 and the 'd' module.
* autogen.sh (GNULIB_MODULES_RUNTIME_OTHER): Add d, dcomp-script.
* gettext-runtime/intl-d/Makefile.am: New file.
* gettext-runtime/intl-d/gnu/libintl/package.d: New file.
* gettext-runtime/intl-d/gnu/libintl/libintl.d: New file.
* gettext-runtime/intl-d/gnu/libintl/internal/low.d: New file.
* gettext-runtime/configure.ac: Invoke gt_D_CHOICE, gt_DCOMP. Set the variable
BUILDD and the Automake conditional BUILD_D.
* gettext-runtime/Makefile.am (SUBDIRS): Add intl-d.
* NEWS: Mention libintl_d.a.
* gettext-runtime/NEWS: Likewise.
* PACKAGING: Add the sources and binary for the libintl_d library.
* DEPENDENCIES: Mention the D compiler and runtime.
2025-04-01 02:38:25 +02:00
Bruno Haible
1fb7870670 Go: Add integration test.
* autogen.sh (GNULIB_MODULES_RUNTIME_FOR_SRC): Add gocomp-script.
* gettext-tools/tests/init-env.in (GO_CHOICE, GO): New variables.
* gettext-tools/tests/lang-go: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.
* HACKING: Document dependencies for lang-go.
2025-03-07 18:44:56 +01:00
Bruno Haible
893cde22c5 Add Go support.
* autopull.sh: Check out tree-sitter-go. Set TREE_SITTER_GO_VERSION.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add carray-list, hash-map,
hash-set, xlist, xmap, xset, xstring-buffer-reversed.
* gettext-tools/build-aux/tree-sitter-go-portability.diff: New file.
* gettext-tools/configure.ac: Set TREE_SITTER_GO_VERSION.
* gettext-tools/Makefile.am (EXTRA_DIST): Add the tree-sitter-go source code and
patch.
* gettext-tools/doc/lang-go.texi: New file.
* gettext-tools/doc/Makefile.am (gettext_TEXINFOS): Add it.
* gettext-tools/doc/gettext.texi (PO Files): Mention go-format.
(No string concatenation): Mention string concatenation in Go.
(Translators for other Languages): New subsection "Go Format Strings".
(List of Programming Languages): Include lang-go.texi.
* gettext-tools/doc/xgettext.texi: Document the -L Go option.
* gettext-tools/src/message.h (format_go): New enum value.
(NFORMATS): Increment.
* gettext-tools/src/message.c (format_language, format_language_pretty): Add an
entry for format_go.
* gettext-tools/src/format-go.c: New file.
* gettext-tools/src/format.h (formatstring_go): New declaration.
* gettext-tools/src/format.c (formatstring_parsers): Add formatstring_go.
* gettext-tools/src/x-go.h: New file.
* gettext-tools/src/x-go.c: New file.
* gettext-tools/src/xgettext.c: Include x-go.h.
(flag_table_go): New variable.
(main): Invoke init_flag_table_go, x_go_extract_all, x_go_keyword.
(usage): Document the -L Go option.
(xgettext_record_flag): Support format_go.
(language_to_extractor, extension_to_language): Support Go.
* gettext-tools/src/FILES: Mention format-go.c, x-go.h, x-go.c.
* gettext-tools/src/Makefile.am (noinst_HEADERS): Add x-go.h.
(FORMAT_SOURCE): Add format-go.c.
(libxgettextts2_a_SOURCES): Add go-parser.c.
(xgettext_SOURCES): Add x-go.c.
* gettext-tools/libgettextpo/Makefile.am (libgettextpo_la_AUXSOURCES): Add
format-go.c.
* gettext-tools/woe32dll/gettextsrc-exports.c: Export formatstring_go.
* gettext-tools/tests/format-go-1: New file.
* gettext-tools/tests/format-go-2: New file.
* gettext-tools/tests/xgettext-go-1: New file.
* gettext-tools/tests/xgettext-go-2: New file.
* gettext-tools/tests/xgettext-go-3: New file.
* gettext-tools/tests/xgettext-go-4: New file.
* gettext-tools/tests/xgettext-go-5: New file.
* gettext-tools/tests/xgettext-go-6: New file.
* gettext-tools/tests/xgettext-go-7: New file.
* gettext-tools/tests/xgettext-go-8: New file.
* gettext-tools/tests/xgettext-go-9: New file.
* gettext-tools/tests/xgettext-go-10: New file.
* gettext-tools/tests/xgettext-go-11: New file.
* gettext-tools/tests/xgettext-go-12: New file.
* gettext-tools/tests/xgettext-go-13: New file.
* gettext-tools/tests/xgettext-go-14: New file.
* gettext-tools/tests/xgettext-go-15: New file.
* gettext-tools/tests/xgettext-go-16: New file.
* gettext-tools/tests/xgettext-go-17: New file.
* gettext-tools/tests/xgettext-go-18: New file.
* gettext-tools/tests/xgettext-go-stackovfl-1: New file.
* gettext-tools/tests/xgettext-go-stackovfl-2: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add the new tests.
* NEWS: Mention the Go support.
2025-03-07 12:42:54 +01:00
Bruno Haible
2406f51927 xgettext: Implement a "reproducible" POT-Creation-Date value.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add vc-mtime.
* gettext-tools/src/xgettext.c: Include vc-mtime.h, msgl-header.h.
(has_some_mtimes, max_of_mtimes, some_mtimes_failed): New variables.
(long_options): Add --reference option.
(main): Implement --reference option. Invoke consider_vc_mtime for the
--files-from option.
(usage): Document the --reference option.
(consider_vc_mtime): New function.
(read_exclusion_file, extract_from_file, extract_from_xml_file: Invoke
consider_vc_mtime.
(construct_header): Don't compute the value of POT-Creation-Date here.
(finalize_header): Compute it here.
* gettext-tools/doc/xgettext.texi: Document the --reference option.
* NEWS: Mention the change.
2025-02-24 20:44:30 +01:00
Bruno Haible
3cbdb13073 xgettext: Rust: Support named format string arguments.
Reported by Kévin Commaille <zecakeh@tedomum.fr>
in <https://savannah.gnu.org/bugs/?56774>.

* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add unictype/property-xid-start,
unictype/property-xid-continue.
(GNULIB_MODULES_LIBGETTEXTPO): Likewise.
* gettext-tools/src/format-rust.c (struct named_arg): New type.
(struct spec): Add fields named_arg_count, named.
(named_arg_compare): New function.
(format_parse): Recognize named arguments.
(format_check): Search for differences also between the named arguments.
(format_print): Print also the named arguments.
* gettext-tools/tests/format-rust-1: Add test cases for named arguments.
* gettext-tools/tests/format-rust-2: Likewise.
* gettext-tools/doc/gettext.texi (rust-format): Describe rust-format in detail.
2025-02-11 11:39:58 +01:00
Bruno Haible
81add3eb2a xgettext: Rust: Fix xgettext-rust-stackovfl-* failures on MSVC 14/x86_64.
* autogen.sh (GNULIB_MODULES_TOOLS_OTHER): Add test-xfail.
* gettext-tools/src/Makefile.am (xgettext_LDFLAGS): On MSVC, use a larger
stack size.
2025-01-29 12:05:42 +01:00
Bruno Haible
e12c0558ad Add Rust support.
* autopull.sh (func_git_clone_shallow): New function, based on
gnulib/top/bootstrap-funclib.sh.
Check out tree-sitter and tree-sitter-rust.
Create gettext-tools/tree-sitter.cfg.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add strnlen,
unictype/property-white-space.
(GNULIB_MODULES_LIBGETTEXTPO): Likewise.
* gettext-tools/build-aux/tree-sitter-portability.diff: New file.
* gettext-tools/build-aux/tree-sitter-rust-portability.diff: New file.
* gettext-tools/configure.ac: Set TREE_SITTER_VERSION, TREE_SITTER_RUST_VERSION.
* gettext-tools/Makefile.am (EXTRA_DIST): Add the tree-sitter configuration,
source code, and patches.
* gettext-tools/doc/lang-rust.texi: New file.
* gettext-tools/doc/Makefile.am (gettext_TEXINFOS): Add it.
* gettext-tools/doc/gettext.texi (PO Files): Mention rust-format.
(Translators for other Languages): New subsection "Rust Format Strings".
(List of Programming Languages): Include lang-rust.texi.
* gettext-tools/doc/xgettext.texi: Document the -L Rust option.
* gettext-tools/src/message.h (format_rust): New enum value.
(NFORMATS): Increment.
* gettext-tools/src/message.c (format_language, format_language_pretty): Add an
entry for format_rust.
* gettext-tools/src/format-rust.c: New file.
* gettext-tools/src/format.h (formatstring_rust): New declaration.
* gettext-tools/src/format.c (formatstring_parsers): Add formatstring_rust.
* gettext-tools/src/x-rust.h: New file.
* gettext-tools/src/x-rust.c: New file.
* gettext-tools/src/xgettext.c: Include x-rust.h.
(main): Invoke init_flag_table_rust, x_rust_extract_all, x_rust_keyword.
(usage): Document the -L Rust option.
(xgettext_record_flag): Support format_rust.
(language_to_extractor, extension_to_language): Support Rust.
* gettext-tools/src/FILES: Mention format-rust.c, x-rust.h, x-rust.c.
* gettext-tools/src/Makefile.am (noinst_LIBRARIES): New variable.
(noinst_HEADERS): Add x-rust.h.
(AM_CPPFLAGS): Add a -I option for tree-sitter.
(FORMAT_SOURCE): Add format-rust.c.
(LIBXGETTEXTTS): New variable.
(libxgettextts1_a_SOURCES, libxgettextts1_a_CPPFLAGS): New variables.
(libxgettextts2_a_SOURCES, libxgettextts2_a_CPPFLAGS): New variables.
(xgettext_SOURCES): Add x-rust.c.
(xgettext_LDADD, xgettext_DEPENDENCIES): Add $(LIBXGETTEXTTS).
* gettext-tools/libgettextpo/Makefile.am (libgettextpo_la_AUXSOURCES): Add
format-rust.c.
* gettext-tools/woe32dll/gettextsrc-exports.c: Export formatstring_rust.
* gettext-tools/tests/format-rust-1: New file.
* gettext-tools/tests/format-rust-2: New file.
* gettext-tools/tests/xgettext-rust-1: Fix string literal concatenation test.
Fix -k options.
* gettext-tools/tests/xgettext-rust-2: Fix gettext invocations.
* gettext-tools/tests/xgettext-rust-3: Fix string literal concatenation test.
Test multiline strings.
* gettext-tools/tests/xgettext-rust-4: Tweak.
* gettext-tools/tests/xgettext-rust-5: Fix test identifier.
* gettext-tools/tests/xgettext-rust-6: New file.
* gettext-tools/tests/xgettext-rust-7: New file.
* gettext-tools/tests/xgettext-rust-stackovfl-1: New file.
* gettext-tools/tests/xgettext-rust-stackovfl-2: New file.
* gettext-tools/tests/xgettext-rust-stackovfl-3: New file.
* gettext-tools/tests/xgettext-rust-stackovfl-4: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add the new tests.
* check-copyright-headers (func_check_file): Ignore tree-sitter files.
* NEWS: Mention the Rust support.
2025-01-28 22:13:12 +01:00
Bruno Haible
c39e75be33 Temporarily revert "po: Rename Makefile.in.in to Makefile.in." 2025-01-24 00:12:57 +01:00
Bruno Haible
53e5da8c8d build: Improve package version handling.
* autogen.sh: Copy also m4/init-package-version.m4, m4/version-stamp.m4.
* configure.ac: Use gl_INIT_PACKAGE and gl_CONFIG_VERSION_STAMP.
* gettext-runtime/configure.ac: Use gl_INIT_PACKAGE.
* gettext-runtime/intl/configure.ac: Likewise.
* gettext-tools/configure.ac: Likewise.
* gettext-tools/examples/configure.ac: Likewise.
* Makefile.am (dist-tarball-version): New target.
($(top_srcdir)/.version): Remove target.
2025-01-23 10:13:43 +01:00
Bruno Haible
85d8d8e106 Refactor: Use function str_startswith.
* libtextstyle/gnulib-local/lib/term-ostream.oo.c (should_enable_hyperlinks):
Use str_startswith.
* libtextstyle/gnulib-local/modules/term-ostream (Depends-on): Add
str_startswith.
* gettext-tools/src/cldr-plural.y (yylex): Use str_startswith.
* gettext-tools/src/format-java.c (message_format_parse, choice_format_parse):
Likewise.
* gettext-tools/src/msgl-check.c (plural_help, check_header_entry): Likewise.
* gettext-tools/src/read-catalog-abstract.c (parse_comment_filepos): Likewise.
* gettext-tools/src/read-csharp.c (msgdomain_read_csharp): Likewise.
* gettext-tools/src/write-csharp.c (msgdomain_write_csharp): Likewise.
* gettext-tools/src/x-perl.c (skip_pod): Likewise.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC, GNULIB_MODULES_LIBGETTEXTPO): Add
str_startswith.
2025-01-08 10:03:23 +01:00
Bruno Haible
d2fbe62c40 Update after gnulib changed.
* autogen.sh (GNULIB_MODULES_RUNTIME_FOR_SRC, GNULIB_MODULES_TOOLS_FOR_SRC,
GNULIB_MODULES_TOOLS_FOR_SRC_COMMON_DEPENDENCIES, GNULIB_MODULES_TOOLS_OTHER,
GNULIB_MODULES_LIBGETTEXTPO): Use the new names of renamed gnulib modules.
* gnulib-local/modules/backupfile (Depends-on): Likewise.
* gnulib-local/modules/closeout (Depends-on): Likewise.
* gnulib-local/modules/libtextstyle-dummy (Depends-on): Likewise.
* gnulib-local/modules/libxml (Depends-on): Likewise.
* libtextstyle/gnulib-local/modules/fd-ostream (Depends-on): Likewise.
* libtextstyle/gnulib-local/modules/html-styled-ostream (Depends-on): Likewise.
* libtextstyle/gnulib-local/modules/iconv-ostream (Depends-on): Likewise.
* libtextstyle/gnulib-local/modules/memory-ostream (Depends-on): Likewise.
* libtextstyle/gnulib-local/modules/noop-styled-ostream (Depends-on): Likewise.
* libtextstyle/gnulib-local/modules/term-ostream (Depends-on): Likewise.
2024-12-28 09:17:56 +01:00
Bruno Haible
6927dbf2c1 po: Rename Makefile.in.in to Makefile.in.
* gettext-runtime/po/Makefile.in: Renamed from gettext-runtime/po/Makefile.in.in.
(distclean): Don't remove Makefile.in.
* gettext-runtime/m4/po.m4 (AM_PO_SUBDIRS): Remove the 'po-directories'
commands.
* gettext-runtime/configure.ac: Update AC_OUTPUT invocation.
* gettext-runtime/Makefile.am (maintainer-update-po): Update.
* gettext-tools/configure.ac: Update AC_OUTPUT invocation.
* gettext-tools/Makefile.am (maintainer-update-po): Update.
* gettext-tools/doc/gettext.texi (Translator advice, po/Rules-*, configure.ac,
Files under Version Control, Maintainers for other Languages): Update.
* gettext-tools/doc/gettextize.texi: Update.
* gettext-tools/examples/README: Update.
* gettext-tools/examples/hello-c/autoclean.sh: Update.
* gettext-tools/examples/hello-c-gnome/autoclean.sh: Likewise.
* gettext-tools/examples/hello-c-gnome3/autoclean.sh: Likewise.
* gettext-tools/examples/hello-c++/autoclean.sh: Likewise.
* gettext-tools/examples/hello-c++-gnome/autoclean.sh: Likewise.
* gettext-tools/examples/hello-c++-kde/autoclean.sh: Likewise.
* gettext-tools/examples/hello-c++20/autoclean.sh: Likewise.
* gettext-tools/examples/hello-objc/autoclean.sh: Likewise.
* gettext-tools/examples/hello-objc-gnome/autoclean.sh: Likewise.
* gettext-tools/misc/autopoint.in: Update search for po directories.
* gettext-tools/misc/gettextize.in: Treat Makefile.in like Makefile.in.in
before. Treat Makefile.in.in as a removed file.
* gettext-tools/tests/autopoint-2: Prepare for bumping ARCHIVE_VERSION.
* gettext-tools/tests/autopoint-3: Likewise.
* autogen.sh: Copy po/Makefile.in instead of po/Makefile.in.in.
* Makefile.am (distcheck-hook): Update.
* NEWS: Mention the change.
2024-12-10 04:32:36 +01:00
Bruno Haible
2e779cb324 Add installation information for the tarball users and from a git checkout.
We want to have an INSTALL file that contains installation instructions for
the tarball users. These instructions are necessarily package specific,
because they need to list the prerequisites or reference the DEPENDENCIES
file.

Additionally, many people who are not aware that tarballs are the primary
means for source code distribution of GNU packages check out the git repository
and then expect to see instructions for installing from that git checkout
in the INSTALL file. See e.g. <https://savannah.gnu.org/bugs/?62196>.

Unfortunately, both Automake (with strictness option = 'gnu') and 'bootstrap'
both contain code to copy the generic (not package specific) installation
instructions to the file 'INSTALL'. This is not what we want, so we disable
it. (Other packages handle this issue by putting part of the installation
instructions into the README file. This is suboptimal, because this is not
what the README file is for.)

* autogen.sh: Import INSTALL.generic from gnulib.
* INSTALL: Entirely rewritten, based on poke/INSTALL.
* Makefile.am (EXTRA_DIST): Add INSTALL.generic.
* libtextstyle/autogen.sh: Import INSTALL.generic from gnulib.
* libtextstyle/INSTALL: Entirely rewritten, based on poke/INSTALL.
* libtextstyle/Makefile.am (EXTRA_DIST): Add INSTALL.generic.
2024-11-27 11:40:31 +01:00
Bruno Haible
6dd0270bf6 Improve handling of Windows DLL directories when executing programs.
Reported by Michele Locati <mlocati@gmail.com>
at <https://savannah.gnu.org/bugs/?66356>.

Revert commit e2839b591c from 2019-05-01. Instead, use gnulib's new feature.

* gettext-tools/src/Makefile.am (DEFS): Define BINDIR.
* gettext-tools/src/msginit.c: Don't include configmake.h.
(main): Don't add BINDIR to PATH globally.
(get_user_email, language_team_address, plural_forms): Pass a dll_dirs argument
to create_pipe_in.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Remove configmake.
2024-10-23 09:39:50 +02:00
Bruno Haible
9a4589466b po: Assume a 'sed' that supports '#' for introducing comments.
This is standardized in POSIX since POSIX:2001 (= SUSv3).
It is supported on all platforms that I could test:
GNU, macOS 10.5, FreeBSD 5, NetBSD 7, OpenBSD 6, AIX 7, Solaris 10 and 11,
busybox (2019).

* gettext-runtime/po/remove-potcdate.sed: Renamed from
gettext-runtime/po/remove-potcdate.sin.
* gettext-runtime/po/Makefile.in.in (DISTFILES.common): Update.
(.SUFFIXES): Remove .sin.
(.sin.sed): Remove rule.
($(DOMAIN).pot-update): Use remove-potcdate.sed in $(srcdir).
(mostlyclean): Don't remove remove-potcdate.sed.
* autogen.sh: Update.
* Makefile.am (distcheck-hook): Update.
* gettext-tools/examples/po/remove-potcdate.sed: Renamed from
gettext-tools/examples/po/remove-potcdate.sin.
* gettext-tools/examples/po/Makefile.am ($(DOMAIN).pot-update): Use
remove-potcdate.sed in $(srcdir).
(MOSTLYCLEANFILES): Don't add remove-potcdate.sed.
(EXTRA_DIST): Update.
* gettext-tools/examples/hello-*/po/Makefile.am ($(DOMAIN).pot-update): Use
remove-potcdate.sed in $(srcdir).
(MOSTLYCLEANFILES): Don't add remove-potcdate.sed.
(EXTRA_DIST): Update.
* gettext-tools/examples/hello-objc-gnustep/po/GNUmakefile
($(DOMAIN).pot-update): Remove dependency on remove-potcdate.sed.
(internal-clean): Remove rule.
* gettext-tools/examples/hello-*/autogen.sh: Update.
* gettext-tools/examples/hello-*/autoclean.sh: Update.
2024-10-14 00:53:56 +02:00
Bruno Haible
fe3b543701 po: Assume a 'sed' that supports '#' for introducing comments.
This is standardized in POSIX since POSIX:2001 (= SUSv3).
It is supported on all platforms that I could test:
GNU, macOS 10.5, FreeBSD 5, NetBSD 7, OpenBSD 6, AIX 7, Solaris 10 and 11,
busybox (2019).

* gettext-runtime/po/insert-header.sed: Renamed from
gettext-runtime/po/insert-header.sin.
* gettext-runtime/po/Rules-quot (DISTFILES.common.extra1): Update.
(en@quot.insert-header, en@boldquot.insert-header): Use insert-header.sed
instead of insert-header.sin.
* autogen.sh: Update.
* Makefile.am (distcheck-hook): Update.
* gettext-tools/examples/hello-*/autogen.sh: Update.
* gettext-tools/doc/gettext.texi (po/LINGUAS): Update.
2024-10-14 00:40:05 +02:00
Bruno Haible
d6a757e166 its: Support DocBook XML, part 2.
Reported by Guillem Jover <guillem@hadrons.org>
at <https://savannah.gnu.org/bugs/?52415>.

* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add xstring-desc.
* gettext-tools/src/its.c: Include xstring-desc.h, c-ctype.h, unistr.h.
(SIZEOF): New macro.
(its_extension_escape_rule_constructor, its_extension_escape_rule_eval): Handle
the 'unescape-if' attribute.
(starts_with_character_reference): Add an ucs_p parameter.
(_its_encode_special_chars_for_merge): Update.
(set_doc_encoding_utf8, _its_is_valid_simple_gen_xml, _its_is_valid_simple_xml,
is_valid_xhtml_element, _its_is_valid_simple_xhtml, is_valid_html_element,
is_no_end_html_element, _its_is_valid_simple_html, _its_set_simple_xml_content,
_its_set_simple_html_content): New functions.
(its_merge_context_merge_node): Implement the 'unescape-if' attribute.
* gettext-tools/src/its-extensions.xsd (EscapeRuleType): Add 'unescape-if'
attribute.
* gettext-tools/its/docbook4.its: Add an <escapeRule>.
* gettext-tools/its/docbook5.its: Likewise.
* gettext-tools/tests/xgettext-docbook-1: New file.
* gettext-tools/tests/msgfmt-xml-5: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add them.
* gettext-tools/doc/gettext.texi (ITS Rules): Document the 'unescape-if'
attribute of the escapeRule.
* NEWS: Mention the change.
2024-10-13 12:49:40 +02:00
Bruno Haible
5ac77f9935 Improve C# support on Cygwin.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add cygpath.
* gettext-tools/src/read-csharp.c: Include cygpath.h.
(msgdomain_read_csharp): Convert the directory passed to msgunfmt.net.exe from
Cygwin to Windows syntax.
* gettext-tools/src/read-resources.c: Include cygpath.h.
(read_resources_file): Convert the file name passed to msgunfmt.net.exe from
Cygwin to Windows syntax.
* gettext-tools/src/write-resources.c: Include cygpath.h.
(msgdomain_write_csharp_resources): Convert the file name passed to
msgfmt.net.exe from Cygwin to Windows syntax.
2024-10-07 20:39:07 +02:00
Bruno Haible
446241c7ca its: Fix the value of the xml:lang attribute inserted by msgfmt.
Reported by Matthias Klumpp <matthias@tenstral.net>
at <https://savannah.gnu.org/bugs/?64025>.

* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add bcp47.
* gettext-tools/src/its.c: Include "bcp47.h".
(its_merge_context_merge_node): Convert the language / locale name to BCP 47
syntax before storing it in the xml:lang attribute.
* gettext-tools/tests/msgfmt-xml-3: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.
* NEWS: Mention the change.
2024-10-03 22:34:14 +02:00
Bruno Haible
629ba077a6 build: Fix compilation error on mingw (regression 2024-09-26).
* autogen.sh (GNULIB_MODULES_LIBGETTEXTPO_OTHER): Add mixin/printf-posix.
2024-09-30 00:11:46 +02:00
Bruno Haible
63709a2089 Modernize: Use gnulib's string-buffer module for accumulating strings.
* autogen.sh (GNULIB_MODULES_RUNTIME_FOR_SRC, GNULIB_MODULES_TOOLS_FOR_SRC): Add
xstring-buffer.
* gettext-runtime/src/envsubst.c: Include string-buffer.h.
(subst_from_stdin): Use a stack-allocated string_buffer instead of 3 local
variables and micro-optimized ad-hoc code.
* gettext-tools/src/cldr-plural.y: Include string-buffer.h.
(yylex): Use a stack-allocated string_buffer instead of 3 local variables and
micro-optimized ad-hoc code.
* gettext-tools/src/cldr-plurals.c: Include string-buffer.h instead of xalloc.h.
(extract_rules): Use a stack-allocated string_buffer instead of 3 local
variables and micro-optimized ad-hoc code.
* gettext-tools/src/its.c: Include string-buffer.h.
(_its_collect_text_content): Use a stack-allocated string_buffer instead of 3
local variables and micro-optimized ad-hoc code.
* gettext-tools/src/read-desktop.c: Include string-buffer.h.
(desktop_lex): Use a stack-allocated string_buffer instead of 3 local variables
and micro-optimized ad-hoc code.
* gettext-tools/src/read-properties.c: Include string-buffer.h.
(properties_parse): Use a stack-allocated string_buffer instead of 3 local
variables and micro-optimized ad-hoc code.
* gettext-tools/src/x-awk.c: Include string-buffer.h.
(phase2_getc, phase3_get): Use a stack-allocated string_buffer instead of 3
local variables and micro-optimized ad-hoc code.
* gettext-tools/src/x-c.c: Include string-buffer.h.
(phase5_get): Use a stack-allocated string_buffer instead of 3 local variables
and micro-optimized ad-hoc code.
* gettext-tools/src/x-java.c: Include string-buffer.h.
(phase5_get): Use a stack-allocated string_buffer instead of 3 local variables
and micro-optimized ad-hoc code.
* gettext-tools/src/x-javascript.c: Include string-buffer.h.
(phase5_get): Use a stack-allocated string_buffer instead of 3 local variables
and micro-optimized ad-hoc code.
* gettext-tools/src/x-lua.c: Include string-buffer.h.
(string_buf_length, string_buf_alloc, string_buf): Remove variables.
(string_start, string_add, string_end): Remove functions.
(phase3_get): Use a stack-allocated string_buffer instead of 3 local variables
and micro-optimized ad-hoc code.
* gettext-tools/src/x-perl.c: Include string-buffer.h.
(get_here_document, phase2_getc, extract_quotelike_pass1,
extract_quotelike_pass3, extract_variable, interpolate_keywords, x_perl_prelex):
Use a stack-allocated string_buffer instead of 3 local variables and
micro-optimized ad-hoc code.
* gettext-tools/src/x-php.c: Include string-buffer.h.
(process_heredoc, phase4_get): Use a stack-allocated string_buffer instead of 3
local variables and micro-optimized ad-hoc code.
* gettext-tools/src/x-python.c: Include string-buffer.h.
(phase5_get): Use a stack-allocated string_buffer instead of 3 local variables
and micro-optimized ad-hoc code.
* gettext-tools/src/x-rst.c: Include string-buffer.h.
(buffer, bufmax): Remove variables.
(buffer): New variable.
(extract_rst, parse_integer): Use a stack-allocated string_buffer instead of 3
local variables and micro-optimized ad-hoc code.
(extract_rsj): Update.
* gettext-tools/src/x-smalltalk.c: Include string-buffer.h.
(phase2_get): Use a stack-allocated string_buffer instead of 3 local variables
and micro-optimized ad-hoc code.
* gettext-tools/src/x-vala.c: Include string-buffer.h.
(phase3_get): Use a stack-allocated string_buffer instead of 3 local variables
and micro-optimized ad-hoc code.
* gettext-tools/src/x-ycp.c: Include string-buffer.h.
(phase2_getc, phase5_get): Use a stack-allocated string_buffer instead of 3
local variables and micro-optimized ad-hoc code.
2024-09-26 13:12:14 +02:00
Bruno Haible
b16a715304 xgettext: Use sf-istream from Gnulib.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add sf-istream.
* gettext-tools/src/x-perl.c: Include sf-istream.h.
(struct perl_extractor): Replace fp, input, input_end fields with a single
sf_istream_t.
(phase1_getc, get_here_document, skip_pod, interpolate_keywords, extract_perl):
Update.
* gettext-tools/src/x-php.c: Include sf-istream.h.
(struct php_extractor): Replace fp, input, input_end fields with a single
sf_istream_t.
(phase1_getc): Simplify.
(process_heredoc, phase4_get, extract_php): Update.
2024-09-26 13:12:13 +02:00
Bruno Haible
d5cd59cbc6 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.
2024-08-16 22:37:41 +02:00
Bruno Haible
d65c188776 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.
2024-08-07 20:04:26 +02:00
Bruno Haible
8bd6c8f702 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.
2024-08-07 19:35:38 +02:00
Bruno Haible
afc3f4029a 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.
2024-08-05 01:32:32 +02:00
Bruno Haible
a4d91dd1d1 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.
2024-08-05 01:03:55 +02:00
Bruno Haible
ac65ad5981 Declare expected test failures on native Windows.
* autogen.sh (GNULIB_MODULES_TOOLS_TESTS): Add test-xfail.
* gettext-tools/tests/Makefile.am (XFAIL_TESTS): New variable.
2024-07-19 05:37:47 +02:00
Bruno Haible
07346905bd build: Switch to autoconf 2.72, automake 1.17.
* autogen.sh: Update comments.
2024-07-12 17:11:27 +02:00