From: Bruno Haible Date: Tue, 2 Apr 2019 15:53:00 +0000 (+0200) Subject: Link the msg* and xgettext programs against libtextstyle. X-Git-Tag: v0.20~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4235833f1763b0bfe51238905bd5200f1a0fc947;p=thirdparty%2Fgettext.git Link the msg* and xgettext programs against libtextstyle. * libtextstyle/autogen.sh: Don't generate lib/color.h and lib/color.c. * libtextstyle/lib/color.h: Moved to here from gettext-tools/src/color.h. * libtextstyle/lib/color.c: Moved to here from gettext-tools/src/color.c. * autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Remove fd-ostream, file-ostream, html-styled-ostream, ostream, styled-ostream, term-styled-ostream. Add libxml. * gettext-tools/gnulib-lib/Makefile.am (MOOPPFLAGS): Remove customization. * gettext-tools/gnulib-tests/Makefile.am (test_term_ostream_LDADD): Remove customization. * gettext-tools/src/Makefile.am (noinst_HEADERS): Remove color.h. (AM_CPPFLAGS): Add -I directives to the libtextstyle/lib directory. (libgettextsrc_la_SOURCES): Remove color.c. (libgettextsrc_la_LDFLAGS): Link with libtextstyle.la. * gettext-tools/src/FILES: Update. * gettext-tools/src/write-catalog.h: Include instead of ostream.h. * gettext-tools/src/write-catalog.c: Include instead of color.h and *-ostream.h. (msgdomain_list_print): Use styled_ostream_create and noop_styled_ostream_create. * gettext-tools/src/write-po.h: Include instead of ostream.h. * gettext-tools/src/write-po.c: Include instead of *-ostream.h. (is_stylable): Remove function. (begin_css_class, end_css_class): Update. Mark as inline. * gettext-tools/src/write-properties.c: Include instead of ostream.h. * gettext-tools/src/write-stringtable.c: Likewise. * gettext-tools/src/msgattrib.c: Include instead of color.h. * gettext-tools/src/msgcat.c: Likewise. * gettext-tools/src/msgcomm.c: Likewise. * gettext-tools/src/msgconv.c: Likewise. * gettext-tools/src/msgen.c: Likewise. * gettext-tools/src/msgfilter.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/xgettext.c: Likewise. --- diff --git a/autogen.sh b/autogen.sh index 1642793f5..fb0af6e97 100755 --- a/autogen.sh +++ b/autogen.sh @@ -136,8 +136,6 @@ if ! $skip_gnulib; then error error-progname execute - fd-ostream - file-ostream filename findprog fnmatch @@ -151,11 +149,11 @@ if ! $skip_gnulib; then gettext gettext-h hash - html-styled-ostream iconv javacomp javaexec libunistring-optional + libxml localcharset locale localename @@ -169,7 +167,6 @@ if ! $skip_gnulib; then open opendir openmp - ostream pipe-filter-ii progname propername @@ -193,11 +190,9 @@ if ! $skip_gnulib; then strpbrk strtol strtoul - styled-ostream sys_select sys_stat sys_time - term-styled-ostream trim unictype/ctype-space unilbrk/ulc-width-linebreaks diff --git a/gettext-tools/gnulib-lib/Makefile.am b/gettext-tools/gnulib-lib/Makefile.am index 939b4ba38..73fa0abe6 100644 --- a/gettext-tools/gnulib-lib/Makefile.am +++ b/gettext-tools/gnulib-lib/Makefile.am @@ -58,9 +58,6 @@ endif # Rules generated and collected by gnulib-tool. include Makefile.gnulib -# Which classes to export from the shared library. -MOOPPFLAGS += --dllexport=styled_ostream - # OS/2 does not support a DLL name longer than 8 characters. if OS2 libgettextlib_la_LDFLAGS += -os2dllname gtlib diff --git a/gettext-tools/gnulib-tests/Makefile.am b/gettext-tools/gnulib-tests/Makefile.am index e30881a01..0d13afc3e 100644 --- a/gettext-tools/gnulib-tests/Makefile.am +++ b/gettext-tools/gnulib-tests/Makefile.am @@ -24,10 +24,6 @@ AUTOMAKE_OPTIONS += 1.11 color-tests # Ensure that test-quotearg.c finds libintl.h. AM_CPPFLAGS += -I../intl -# Ensure that test-term-ostream links correctly when using --disable-shared -# on macOS. -test_term_ostream_LDADD += @INTL_MACOSX_LIBS@ - # Remove .deps directories creates by 'configure'. # I would say that this left-over is an Automake 1.16.1 bug. diff --git a/gettext-tools/src/FILES b/gettext-tools/src/FILES index c88750388..2bbeb01f0 100644 --- a/gettext-tools/src/FILES +++ b/gettext-tools/src/FILES @@ -43,9 +43,6 @@ po-xerror.c Error handling during writing and reading of PO files. +-------------- Writing PO files -| color.h -| color.c -| Color and style handling. | write-catalog.h | write-catalog.c | Output of a list-of-messages. diff --git a/gettext-tools/src/Makefile.am b/gettext-tools/src/Makefile.am index d08d9d2e9..afd25f21b 100644 --- a/gettext-tools/src/Makefile.am +++ b/gettext-tools/src/Makefile.am @@ -39,7 +39,7 @@ noinst_HEADERS = pos.h message.h po-error.h po-xerror.h po-gram.h po-charset.h \ po-lex.h open-catalog.h read-catalog-abstract.h read-catalog.h \ read-po.h read-properties.h read-stringtable.h \ str-list.h \ -color.h write-catalog.h write-po.h write-properties.h write-stringtable.h \ +write-catalog.h write-po.h write-properties.h write-stringtable.h \ dir-list.h file-list.h po-gram-gen.h po-gram-gen2.h cldr-plural.h \ cldr-plural-exp.h locating-rule.h its.h search-path.h \ msgl-charset.h msgl-equal.h msgl-iconv.h msgl-ascii.h msgl-cat.h msgl-header.h \ @@ -75,6 +75,7 @@ AM_CPPFLAGS = \ -I.. -I$(top_srcdir) \ -I$(top_srcdir)/libgrep \ -I../gnulib-lib -I$(top_srcdir)/gnulib-lib \ + -I../../libtextstyle/lib -I$(top_srcdir)/../libtextstyle/lib \ -I../intl -I$(top_srcdir)/../gettext-runtime/intl DEFS = \ -DLOCALEDIR=\"$(localedir)\" -DBISON_LOCALEDIR=\"$(BISON_LOCALEDIR)\" \ @@ -149,7 +150,7 @@ FORMAT_SOURCE += \ # libgettextsrc contains all code that is needed by at least two programs. libgettextsrc_la_SOURCES = \ $(COMMON_SOURCE) read-catalog.c \ -color.c write-catalog.c write-properties.c write-stringtable.c write-po.c \ +write-catalog.c write-properties.c write-stringtable.c write-po.c \ msgl-ascii.c msgl-iconv.c msgl-equal.c msgl-cat.c msgl-header.c msgl-english.c \ msgl-check.c file-list.c msgl-charset.c po-time.c plural-exp.c plural-eval.c \ plural-table.c quote.h sentence.h sentence.c \ @@ -259,7 +260,7 @@ cldr_plurals_LDADD = libgettextsrc.la $(LDADD) # use iconv(). libgettextsrc_la_LDFLAGS = \ -release @VERSION@ \ - ../gnulib-lib/libgettextlib.la $(LTLIBUNISTRING) @LTLIBINTL@ @LTLIBICONV@ -lc -no-undefined + ../gnulib-lib/libgettextlib.la $(LTLIBUNISTRING) ../../libtextstyle/lib/libtextstyle.la @LTLIBINTL@ @LTLIBICONV@ -lc -no-undefined # OS/2 does not support a DLL name longer than 8 characters. if OS2 diff --git a/gettext-tools/src/msgattrib.c b/gettext-tools/src/msgattrib.c index cc345fe67..d57749004 100644 --- a/gettext-tools/src/msgattrib.c +++ b/gettext-tools/src/msgattrib.c @@ -27,6 +27,8 @@ #include #include +#include + #include "closeout.h" #include "dir-list.h" #include "error.h" @@ -43,7 +45,6 @@ #include "write-po.h" #include "write-properties.h" #include "write-stringtable.h" -#include "color.h" #include "propername.h" #include "xalloc.h" #include "gettext.h" diff --git a/gettext-tools/src/msgcat.c b/gettext-tools/src/msgcat.c index 53df1851d..08ee2ffcf 100644 --- a/gettext-tools/src/msgcat.c +++ b/gettext-tools/src/msgcat.c @@ -26,6 +26,8 @@ #include #include +#include + #include "closeout.h" #include "dir-list.h" #include "str-list.h" @@ -44,7 +46,6 @@ #include "write-po.h" #include "write-properties.h" #include "write-stringtable.h" -#include "color.h" #include "msgl-cat.h" #include "msgl-header.h" #include "propername.h" diff --git a/gettext-tools/src/msgcomm.c b/gettext-tools/src/msgcomm.c index 42e0a591f..d79c2eb0e 100644 --- a/gettext-tools/src/msgcomm.c +++ b/gettext-tools/src/msgcomm.c @@ -26,6 +26,8 @@ #include #include +#include + #include "closeout.h" #include "dir-list.h" #include "str-list.h" @@ -44,7 +46,6 @@ #include "write-po.h" #include "write-properties.h" #include "write-stringtable.h" -#include "color.h" #include "msgl-cat.h" #include "propername.h" #include "gettext.h" diff --git a/gettext-tools/src/msgconv.c b/gettext-tools/src/msgconv.c index eebbb0cb3..111c5eb73 100644 --- a/gettext-tools/src/msgconv.c +++ b/gettext-tools/src/msgconv.c @@ -27,6 +27,8 @@ #include #include +#include + #include "closeout.h" #include "dir-list.h" #include "error.h" @@ -43,7 +45,6 @@ #include "write-po.h" #include "write-properties.h" #include "write-stringtable.h" -#include "color.h" #include "msgl-iconv.h" #include "localcharset.h" #include "propername.h" diff --git a/gettext-tools/src/msgen.c b/gettext-tools/src/msgen.c index 143905d07..68849ef7a 100644 --- a/gettext-tools/src/msgen.c +++ b/gettext-tools/src/msgen.c @@ -27,6 +27,8 @@ #include #include +#include + #include "closeout.h" #include "dir-list.h" #include "error.h" @@ -45,7 +47,6 @@ #include "write-po.h" #include "write-properties.h" #include "write-stringtable.h" -#include "color.h" #include "propername.h" #include "gettext.h" diff --git a/gettext-tools/src/msgfilter.c b/gettext-tools/src/msgfilter.c index fa8c37bed..ad147f3da 100644 --- a/gettext-tools/src/msgfilter.c +++ b/gettext-tools/src/msgfilter.c @@ -30,6 +30,8 @@ #include #include +#include + #include "closeout.h" #include "dir-list.h" #include "error.h" @@ -47,7 +49,6 @@ #include "write-po.h" #include "write-properties.h" #include "write-stringtable.h" -#include "color.h" #include "msgl-charset.h" #include "xalloc.h" #include "findprog.h" diff --git a/gettext-tools/src/msggrep.c b/gettext-tools/src/msggrep.c index 462728ec8..b3ced0002 100644 --- a/gettext-tools/src/msggrep.c +++ b/gettext-tools/src/msggrep.c @@ -38,6 +38,8 @@ #include +#include + #include "closeout.h" #include "dir-list.h" #include "error.h" @@ -54,7 +56,6 @@ #include "write-po.h" #include "write-properties.h" #include "write-stringtable.h" -#include "color.h" #include "str-list.h" #include "msgl-charset.h" #include "xalloc.h" diff --git a/gettext-tools/src/msginit.c b/gettext-tools/src/msginit.c index d3a09abd6..d179d8ca4 100644 --- a/gettext-tools/src/msginit.c +++ b/gettext-tools/src/msginit.c @@ -49,6 +49,8 @@ # define HAVE_DIR 0 #endif +#include + #include "closeout.h" #include "error.h" #include "error-progname.h" @@ -66,7 +68,6 @@ #include "write-po.h" #include "write-properties.h" #include "write-stringtable.h" -#include "color.h" #include "po-charset.h" #include "localcharset.h" #include "localename.h" diff --git a/gettext-tools/src/msgmerge.c b/gettext-tools/src/msgmerge.c index e2f533ed6..be45c82e4 100644 --- a/gettext-tools/src/msgmerge.c +++ b/gettext-tools/src/msgmerge.c @@ -29,6 +29,8 @@ #include #include +#include + #include "closeout.h" #include "dir-list.h" #include "error.h" @@ -45,7 +47,6 @@ #include "write-po.h" #include "write-properties.h" #include "write-stringtable.h" -#include "color.h" #include "format.h" #include "xalloc.h" #include "xmalloca.h" diff --git a/gettext-tools/src/msgunfmt.c b/gettext-tools/src/msgunfmt.c index 876769124..59fa06839 100644 --- a/gettext-tools/src/msgunfmt.c +++ b/gettext-tools/src/msgunfmt.c @@ -27,6 +27,8 @@ #include #include +#include + #include "closeout.h" #include "error.h" #include "error-progname.h" @@ -44,7 +46,6 @@ #include "write-po.h" #include "write-properties.h" #include "write-stringtable.h" -#include "color.h" #include "propername.h" #include "gettext.h" diff --git a/gettext-tools/src/msguniq.c b/gettext-tools/src/msguniq.c index ddb7640aa..892ba89b2 100644 --- a/gettext-tools/src/msguniq.c +++ b/gettext-tools/src/msguniq.c @@ -27,6 +27,8 @@ #include #include +#include + #include "closeout.h" #include "dir-list.h" #include "str-list.h" @@ -44,7 +46,6 @@ #include "write-po.h" #include "write-properties.h" #include "write-stringtable.h" -#include "color.h" #include "msgl-cat.h" #include "propername.h" #include "gettext.h" diff --git a/gettext-tools/src/write-catalog.c b/gettext-tools/src/write-catalog.c index d67436f4c..354f7be12 100644 --- a/gettext-tools/src/write-catalog.c +++ b/gettext-tools/src/write-catalog.c @@ -34,8 +34,13 @@ # define STDOUT_FILENO 1 #endif -#include "ostream.h" -#include "file-ostream.h" +#ifdef GETTEXTDATADIR +# include +#else +# include "ostream.h" +# include "file-ostream.h" +#endif + #include "fwriteerror.h" #include "error-progname.h" #include "xvasprintf.h" @@ -51,12 +56,6 @@ # define ENABLE_COLOR 1 -# include "styled-ostream.h" -# include "term-styled-ostream.h" -# include "html-styled-ostream.h" -# include "fd-ostream.h" - -# include "color.h" # include "relocatable.h" # include "po-charset.h" # include "msgl-iconv.h" @@ -247,9 +246,7 @@ msgdomain_list_print (msgdomain_list_ty *mdlp, const char *filename, "GETTEXTSTYLESDIR", relocate (GETTEXTSTYLESDIR), "po-default.css"); stream = - term_styled_ostream_create (fd, filename, TTYCTL_AUTO, style_file_name); - if (stream == NULL) - stream = fd_ostream_create (fd, filename, true); + styled_ostream_create (fd, filename, TTYCTL_AUTO, style_file_name); output_syntax->print (mdlp, stream, page_width, debug); ostream_free (stream); @@ -312,10 +309,16 @@ msgdomain_list_print (msgdomain_list_ty *mdlp, const char *filename, ostream_free (html_stream); } else -#endif { - output_syntax->print (mdlp, stream, page_width, debug); + noop_styled_ostream_t styled_stream; + + styled_stream = noop_styled_ostream_create (stream, false); + output_syntax->print (mdlp, styled_stream, page_width, debug); + ostream_free (styled_stream); } +#else + output_syntax->print (mdlp, stream, page_width, debug); +#endif ostream_free (stream); diff --git a/gettext-tools/src/write-catalog.h b/gettext-tools/src/write-catalog.h index 6df2067d4..5f8138fe6 100644 --- a/gettext-tools/src/write-catalog.h +++ b/gettext-tools/src/write-catalog.h @@ -1,5 +1,5 @@ /* GNU gettext - internationalization aids - Copyright (C) 1995-1998, 2000-2003, 2006, 2008 Free Software Foundation, Inc. + Copyright (C) 1995-1998, 2000-2003, 2006, 2008, 2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,12 @@ #include -#include "ostream.h" +#ifdef GETTEXTDATADIR +# include +#else +# include "ostream.h" +#endif + #include "message.h" diff --git a/gettext-tools/src/write-po.c b/gettext-tools/src/write-po.c index d917e4cbf..1e2642a0a 100644 --- a/gettext-tools/src/write-po.c +++ b/gettext-tools/src/write-po.c @@ -35,6 +35,12 @@ # include #endif +#ifdef GETTEXTDATADIR +# include +#else +# include "ostream.h" +#endif + #include "c-ctype.h" #include "po-charset.h" #include "format.h" @@ -44,10 +50,6 @@ #include "xalloc.h" #include "xmalloca.h" #include "c-strstr.h" -#include "ostream.h" -#ifdef GETTEXTDATADIR -# include "styled-ostream.h" -#endif #include "xvasprintf.h" #include "po-xerror.h" #include "gettext.h" @@ -160,27 +162,20 @@ make_c_width_description_string (enum is_wrap do_wrap) When compiled in libgettextpo, don't enable styling support. */ #ifdef GETTEXTDATADIR -/* Return true if the stream is an instance of styled_ostream_t. */ -static inline bool -is_stylable (ostream_t stream) -{ - return IS_INSTANCE (stream, ostream, styled_ostream); -} +/* All ostream_t instances are in fact styled_ostream_t instances. */ /* Start a run of text belonging to a given CSS class. */ -static void +static inline void begin_css_class (ostream_t stream, const char *classname) { - if (is_stylable (stream)) - styled_ostream_begin_use_class ((styled_ostream_t) stream, classname); + styled_ostream_begin_use_class ((styled_ostream_t) stream, classname); } /* End a run of text belonging to a given CSS class. */ -static void +static inline void end_css_class (ostream_t stream, const char *classname) { - if (is_stylable (stream)) - styled_ostream_end_use_class ((styled_ostream_t) stream, classname); + styled_ostream_end_use_class ((styled_ostream_t) stream, classname); } #else diff --git a/gettext-tools/src/write-po.h b/gettext-tools/src/write-po.h index f0995ea67..37f676146 100644 --- a/gettext-tools/src/write-po.h +++ b/gettext-tools/src/write-po.h @@ -1,5 +1,5 @@ /* GNU gettext - internationalization aids - Copyright (C) 1995-1998, 2000-2003, 2006, 2008, 2014, 2018 Free Software + Copyright (C) 1995-1998, 2000-2003, 2006, 2008, 2014, 2018-2019 Free Software Foundation, Inc. This file was written by Peter Miller @@ -20,11 +20,16 @@ #ifndef _WRITE_PO_H #define _WRITE_PO_H -#include "ostream.h" -#include "message.h" - #include +#ifdef GETTEXTDATADIR +# include +#else +# include "ostream.h" +#endif + +#include "message.h" + #ifdef __cplusplus extern "C" { diff --git a/gettext-tools/src/write-properties.c b/gettext-tools/src/write-properties.c index 4c8bb70c9..19eb228c3 100644 --- a/gettext-tools/src/write-properties.c +++ b/gettext-tools/src/write-properties.c @@ -1,5 +1,5 @@ /* Writing Java .properties files. - Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc. + Copyright (C) 2003, 2005-2009, 2019 Free Software Foundation, Inc. Written by Bruno Haible , 2003. This program is free software: you can redistribute it and/or modify @@ -28,13 +28,14 @@ #include #include +#include + #include "error.h" #include "message.h" #include "msgl-ascii.h" #include "msgl-iconv.h" #include "po-charset.h" #include "unistr.h" -#include "ostream.h" #include "write-po.h" #include "xalloc.h" diff --git a/gettext-tools/src/write-stringtable.c b/gettext-tools/src/write-stringtable.c index dbba7e9ef..bf0f63de2 100644 --- a/gettext-tools/src/write-stringtable.c +++ b/gettext-tools/src/write-stringtable.c @@ -1,5 +1,5 @@ /* Writing NeXTstep/GNUstep .strings files. - Copyright (C) 2003, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2008, 2019 Free Software Foundation, Inc. Written by Bruno Haible , 2003. This program is free software: you can redistribute it and/or modify @@ -26,12 +26,13 @@ #include #include +#include + #include "message.h" #include "msgl-ascii.h" #include "msgl-iconv.h" #include "po-charset.h" #include "c-strstr.h" -#include "ostream.h" #include "xvasprintf.h" #include "write-po.h" diff --git a/gettext-tools/src/xgettext.c b/gettext-tools/src/xgettext.c index af3f4a2fa..67e9cb55d 100644 --- a/gettext-tools/src/xgettext.c +++ b/gettext-tools/src/xgettext.c @@ -39,6 +39,8 @@ #include #endif +#include + #include "rc-str-list.h" #include "xg-encoding.h" #include "xg-arglist-context.h" @@ -74,7 +76,6 @@ #include "write-po.h" #include "write-properties.h" #include "write-stringtable.h" -#include "color.h" #include "format.h" #include "propername.h" #include "sentence.h" diff --git a/libtextstyle/.gitignore b/libtextstyle/.gitignore index 5dab4fbe7..c7e870892 100644 --- a/libtextstyle/.gitignore +++ b/libtextstyle/.gitignore @@ -200,8 +200,6 @@ /build-aux/run-test /build-aux/test-driver.diff /build-aux/texinfo.tex -/lib/color.c -/lib/color.h /lib/declared.sh /lib/exported.sh.in /m4/exported.m4 diff --git a/libtextstyle/autogen.sh b/libtextstyle/autogen.sh index dd7765672..b0d566412 100755 --- a/libtextstyle/autogen.sh +++ b/libtextstyle/autogen.sh @@ -117,8 +117,6 @@ cp -p ../m4/woe32-dll.m4 m4/ cp -p ../build-aux/ltmain.sh build-aux/ cp -p ../gettext-tools/m4/exported.m4 m4/ cp -p ../gettext-tools/libgettextpo/exported.sh.in lib/ -sed -e 's/DLL_VARIABLE/LIBTEXTSTYLE_DLL_VARIABLE/g' < ../gettext-tools/src/color.h > lib/color.h -cp -p ../gettext-tools/src/color.c lib/ aclocal -I m4 -I gnulib-m4 autoconf diff --git a/gettext-tools/src/color.c b/libtextstyle/lib/color.c similarity index 100% rename from gettext-tools/src/color.c rename to libtextstyle/lib/color.c diff --git a/gettext-tools/src/color.h b/libtextstyle/lib/color.h similarity index 92% rename from gettext-tools/src/color.h rename to libtextstyle/lib/color.h index bec031a96..673338f72 100644 --- a/gettext-tools/src/color.h +++ b/libtextstyle/lib/color.h @@ -27,14 +27,14 @@ extern "C" { /* Whether to output a test page. */ -extern DLL_VARIABLE bool color_test_mode; +extern LIBTEXTSTYLE_DLL_VARIABLE bool color_test_mode; /* Color option. */ enum color_option { color_no, color_tty, color_yes, color_html }; -extern DLL_VARIABLE enum color_option color_mode; +extern LIBTEXTSTYLE_DLL_VARIABLE enum color_option color_mode; /* Style to use when coloring. */ -extern DLL_VARIABLE const char *style_file_name; +extern LIBTEXTSTYLE_DLL_VARIABLE const char *style_file_name; /* --color argument handling. Return an error indicator. */ extern bool handle_color_option (const char *option);