]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
libtextstyle: Generalize fd-styled-ostream to noop-styled-ostream.
authorBruno Haible <bruno@clisp.org>
Tue, 2 Apr 2019 15:52:29 +0000 (17:52 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 2 Apr 2019 15:52:29 +0000 (17:52 +0200)
* gnulib-local/lib/noop-styled-ostream.oo.h: New file, based on
gnulib-local/lib/fd-styled-ostream.oo.h.
* gnulib-local/lib/noop-styled-ostream.oo.c: New file, based on
gnulib-local/lib/fd-styled-ostream.oo.c.
* gnulib-local/modules/noop-styled-ostream: New file, based on
gnulib-local/modules/fd-styled-ostream.
* gnulib-local/Makefile.am (EXTRA_DIST): Remove lib/fd-styled-ostream.oo.[hc]
and modules/fd-styled-ostream. Add lib/noop-styled-ostream.oo.[hc] and
modules/noop-styled-ostream.
* libtextstyle/woe32dll/c++noop-styled-ostream.cc: New file, based on
libtextstyle/woe32dll/c++fd-styled-ostream.cc.
* libtextstyle/gnulib-local/modules/noop-styled-ostream.diff: New file, based
on libtextstyle/gnulib-local/modules/fd-styled-ostream.diff.
* gnulib-local/lib/fd-styled-ostream.oo.h: Remove file.
* gnulib-local/lib/fd-styled-ostream.oo.c: Remove file.
* gnulib-local/modules/fd-styled-ostream: Remove file.
* libtextstyle/woe32dll/c++fd-styled-ostream.cc: Remove file.
* libtextstyle/gnulib-local/modules/fd-styled-ostream.diff: Remove file.
* libtextstyle/autogen.sh (GNULIB_MODULES): Add noop-styled-ostream. Remove
fd-styled-ostream.
* libtextstyle/lib/misc.c: Include noop-styled-ostream.h, fd-ostream.h.
(styled_ostream_create): Call fd_ostream_create and noop_styled_ostream_create
instead of fd_styled_ostream_create.
* libtextstyle/lib/textstyle.h (noop_styled_ostream_t): New type.
(noop_styled_ostream_*): New declarations.
* libtextstyle/doc/libtextstyle.texi (The noop_styled_ostream class): New
subsection.

15 files changed:
gnulib-local/Makefile.am
gnulib-local/lib/fd-styled-ostream.oo.c [deleted file]
gnulib-local/lib/noop-styled-ostream.oo.c [new file with mode: 0644]
gnulib-local/lib/noop-styled-ostream.oo.h [moved from gnulib-local/lib/fd-styled-ostream.oo.h with 59% similarity]
gnulib-local/modules/fd-styled-ostream [deleted file]
gnulib-local/modules/noop-styled-ostream [new file with mode: 0644]
libtextstyle/.gitignore
libtextstyle/autogen.sh
libtextstyle/doc/libtextstyle.texi
libtextstyle/gnulib-local/modules/fd-styled-ostream.diff [deleted file]
libtextstyle/gnulib-local/modules/noop-styled-ostream.diff [new file with mode: 0644]
libtextstyle/lib/misc.c
libtextstyle/lib/textstyle.h
libtextstyle/woe32dll/c++fd-styled-ostream.cc [deleted file]
libtextstyle/woe32dll/c++noop-styled-ostream.cc [new file with mode: 0644]

index ddab7032bce683fd35c08fb4f9ff721b708467ea..2d110d8f9f92e5745d908c88a66c70f4b8c8dfcf 100644 (file)
@@ -37,8 +37,6 @@ lib/error-progname.h \
 lib/exitfail.h.diff \
 lib/fd-ostream.oo.c \
 lib/fd-ostream.oo.h \
-lib/fd-styled-ostream.oo.c \
-lib/fd-styled-ostream.oo.h \
 lib/file-ostream.oo.c \
 lib/file-ostream.oo.h \
 lib/fnmatch.c.diff \
@@ -230,6 +228,8 @@ lib/markup.h \
 lib/memory-ostream.oo.c \
 lib/memory-ostream.oo.h \
 lib/moo.h \
+lib/noop-styled-ostream.oo.c \
+lib/noop-styled-ostream.oo.h \
 lib/obstack.h.diff \
 lib/ostream.oo.c \
 lib/ostream.oo.h \
@@ -270,7 +270,6 @@ modules/basename \
 modules/closeout \
 modules/error-progname \
 modules/fd-ostream \
-modules/fd-styled-ostream \
 modules/file-ostream \
 modules/fnmatch.diff \
 modules/gettext-runtime-misc \
@@ -287,6 +286,7 @@ modules/markup \
 modules/memory-ostream \
 modules/moo \
 modules/moo-tests \
+modules/noop-styled-ostream \
 modules/ostream \
 modules/styled-ostream \
 modules/termcap \
diff --git a/gnulib-local/lib/fd-styled-ostream.oo.c b/gnulib-local/lib/fd-styled-ostream.oo.c
deleted file mode 100644 (file)
index 8cf6462..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Output stream with no-op styling, referring to a file descriptor.
-   Copyright (C) 2006, 2019 Free Software Foundation, Inc.
-   Written by Bruno Haible <bruno@clisp.org>, 2019.
-
-   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
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include "fd-styled-ostream.h"
-
-#include "fd-ostream.h"
-
-#include "xalloc.h"
-
-
-struct fd_styled_ostream : struct styled_ostream
-{
-fields:
-  /* The destination stream.  */
-  fd_ostream_t destination;
-};
-
-/* Implementation of ostream_t methods.  */
-
-static void
-fd_styled_ostream::write_mem (fd_styled_ostream_t stream,
-                              const void *data, size_t len)
-{
-  fd_ostream_write_mem (stream->destination, data, len);
-}
-
-static void
-fd_styled_ostream::flush (fd_styled_ostream_t stream, ostream_flush_scope_t scope)
-{
-  fd_ostream_flush (stream->destination, scope);
-}
-
-static void
-fd_styled_ostream::free (fd_styled_ostream_t stream)
-{
-  fd_ostream_free (stream->destination);
-  free (stream);
-}
-
-/* Implementation of styled_ostream_t methods.  */
-
-static void
-fd_styled_ostream::begin_use_class (fd_styled_ostream_t stream,
-                                    const char *classname)
-{
-}
-
-static void
-fd_styled_ostream::end_use_class (fd_styled_ostream_t stream,
-                                  const char *classname)
-{
-}
-
-static void
-fd_styled_ostream::flush_to_current_style (fd_styled_ostream_t stream)
-{
-  fd_ostream_flush (stream->destination, FLUSH_THIS_STREAM);
-}
-
-/* Constructor.  */
-
-fd_styled_ostream_t
-fd_styled_ostream_create (int fd, const char *filename)
-{
-  fd_styled_ostream_t stream =
-    XMALLOC (struct fd_styled_ostream_representation);
-
-  stream->base.base.vtable = &fd_styled_ostream_vtable;
-  stream->destination = fd_ostream_create (fd, filename, true);
-
-  return stream;
-}
diff --git a/gnulib-local/lib/noop-styled-ostream.oo.c b/gnulib-local/lib/noop-styled-ostream.oo.c
new file mode 100644 (file)
index 0000000..f24cffb
--- /dev/null
@@ -0,0 +1,91 @@
+/* Output stream with no-op styling.
+   Copyright (C) 2006, 2019 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2019.
+
+   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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "noop-styled-ostream.h"
+
+#include "xalloc.h"
+
+
+struct noop_styled_ostream : struct styled_ostream
+{
+fields:
+  /* The destination stream.  */
+  ostream_t destination;
+  bool own_destination;
+};
+
+/* Implementation of ostream_t methods.  */
+
+static void
+noop_styled_ostream::write_mem (noop_styled_ostream_t stream,
+                                const void *data, size_t len)
+{
+  ostream_write_mem (stream->destination, data, len);
+}
+
+static void
+noop_styled_ostream::flush (noop_styled_ostream_t stream,
+                            ostream_flush_scope_t scope)
+{
+  ostream_flush (stream->destination, scope);
+}
+
+static void
+noop_styled_ostream::free (noop_styled_ostream_t stream)
+{
+  if (stream->own_destination)
+    ostream_free (stream->destination);
+  free (stream);
+}
+
+/* Implementation of styled_ostream_t methods.  */
+
+static void
+noop_styled_ostream::begin_use_class (noop_styled_ostream_t stream,
+                                      const char *classname)
+{
+}
+
+static void
+noop_styled_ostream::end_use_class (noop_styled_ostream_t stream,
+                                    const char *classname)
+{
+}
+
+static void
+noop_styled_ostream::flush_to_current_style (noop_styled_ostream_t stream)
+{
+  ostream_flush (stream->destination, FLUSH_THIS_STREAM);
+}
+
+/* Constructor.  */
+
+noop_styled_ostream_t
+noop_styled_ostream_create (ostream_t destination, bool pass_ownership)
+{
+  noop_styled_ostream_t stream =
+    XMALLOC (struct noop_styled_ostream_representation);
+
+  stream->base.base.vtable = &noop_styled_ostream_vtable;
+  stream->destination = destination;
+  stream->own_destination = pass_ownership;
+
+  return stream;
+}
similarity index 59%
rename from gnulib-local/lib/fd-styled-ostream.oo.h
rename to gnulib-local/lib/noop-styled-ostream.oo.h
index 04eaaff5d743c78a147df3eb095edb1cc4abf0c0..fa64e1c87c41ed889aaf1b21320accd50ef483dc 100644 (file)
@@ -1,4 +1,4 @@
-/* Output stream with no-op styling, referring to a file descriptor.
+/* Output stream with no-op styling.
    Copyright (C) 2006, 2019 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2019.
 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
 
-#ifndef _FD_STYLED_OSTREAM_H
-#define _FD_STYLED_OSTREAM_H
+#ifndef _NOOP_STYLED_OSTREAM_H
+#define _NOOP_STYLED_OSTREAM_H
+
+#include <stdbool.h>
 
 #include "styled-ostream.h"
 
 
-struct fd_styled_ostream : struct styled_ostream
+struct noop_styled_ostream : struct styled_ostream
 {
 methods:
 };
@@ -32,16 +34,18 @@ extern "C" {
 #endif
 
 
-/* Create an output stream referring to the file descriptor FD, that supports
+/* Create an output stream that delegates to DESTINATION and that supports
    the styling operations as no-ops.
-   FILENAME is used only for error messages.
-   Note that the resulting stream must be closed before FD can be closed.  */
-extern fd_styled_ostream_t
-       fd_styled_ostream_create (int fd, const char *filename);
+   If PASS_OWNERSHIP is true, closing the resulting stream will automatically
+   close the DESTINATION.
+   Note that if PASS_OWNERSHIP is false, the resulting stream must be closed
+   before DESTINATION can be closed.  */
+extern noop_styled_ostream_t
+       noop_styled_ostream_create (ostream_t destination, bool pass_ownership);
 
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* _FD_STYLED_OSTREAM_H */
+#endif /* _NOOP_STYLED_OSTREAM_H */
diff --git a/gnulib-local/modules/fd-styled-ostream b/gnulib-local/modules/fd-styled-ostream
deleted file mode 100644 (file)
index 1b8582a..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-Description:
-Output stream with no-op styling, referring to a file descriptor.
-
-Files:
-lib/fd-styled-ostream.oo.h
-lib/fd-styled-ostream.oo.c
-
-Depends-on:
-styled-ostream
-fd-ostream
-xalloc
-
-configure.ac:
-
-Makefile.am:
-if !WOE32DLL
-lib_SOURCES += fd-styled-ostream.c
-else
-lib_SOURCES += ../woe32dll/c++fd-styled-ostream.cc
-endif
-# This is a Makefile rule that generates multiple files at once; see the
-# automake documentation, node "Multiple Outputs", for details.
-$(srcdir)/fd-styled-ostream.h : $(top_srcdir)/build-aux/moopp fd-styled-ostream.oo.h fd-styled-ostream.oo.c styled-ostream.oo.h ostream.oo.h
-       $(top_srcdir)/build-aux/moopp $(MOOPPFLAGS) $(srcdir)/fd-styled-ostream.oo.c $(srcdir)/fd-styled-ostream.oo.h $(srcdir)/styled-ostream.oo.h $(srcdir)/ostream.oo.h
-$(srcdir)/fd-styled-ostream.c $(srcdir)/fd_styled_ostream.priv.h $(srcdir)/fd_styled_ostream.vt.h : fd-styled-ostream.h
-       @test -f $@ || { \
-         trap 'rm -rf fd-styled-ostream.lock' 1 2 13 15; \
-         if mkdir fd-styled-ostream.lock 2>/dev/null; then \
-           echo "$(top_srcdir)/build-aux/moopp $(MOOPPFLAGS) $(srcdir)/fd-styled-ostream.oo.c $(srcdir)/fd-styled-ostream.oo.h $(srcdir)/styled-ostream.oo.h $(srcdir)/ostream.oo.h"; \
-           $(top_srcdir)/build-aux/moopp $(MOOPPFLAGS) $(srcdir)/fd-styled-ostream.oo.c $(srcdir)/fd-styled-ostream.oo.h $(srcdir)/styled-ostream.oo.h $(srcdir)/ostream.oo.h; \
-           result=$$?; rm -rf fd-styled-ostream.lock; exit $$result; \
-         else \
-           while test -d fd-styled-ostream.lock; do sleep 1; done; \
-           test -f $(srcdir)/fd-styled-ostream.h; \
-         fi; \
-       }
-BUILT_SOURCES += fd-styled-ostream.h fd-styled-ostream.c fd_styled_ostream.priv.h fd_styled_ostream.vt.h
-MAINTAINERCLEANFILES += fd-styled-ostream.h fd-styled-ostream.c fd_styled_ostream.priv.h fd_styled_ostream.vt.h
-EXTRA_DIST += fd-styled-ostream.h fd-styled-ostream.c fd_styled_ostream.priv.h fd_styled_ostream.vt.h
-
-Include:
-"fd-styled-ostream.h"
-
-License:
-GPL
-
-Maintainer:
-Bruno Haible
-
diff --git a/gnulib-local/modules/noop-styled-ostream b/gnulib-local/modules/noop-styled-ostream
new file mode 100644 (file)
index 0000000..9fcd12c
--- /dev/null
@@ -0,0 +1,49 @@
+Description:
+Output stream with no-op styling.
+
+Files:
+lib/noop-styled-ostream.oo.h
+lib/noop-styled-ostream.oo.c
+
+Depends-on:
+styled-ostream
+stdbool
+xalloc
+
+configure.ac:
+
+Makefile.am:
+if !WOE32DLL
+lib_SOURCES += noop-styled-ostream.c
+else
+lib_SOURCES += ../woe32dll/c++noop-styled-ostream.cc
+endif
+# This is a Makefile rule that generates multiple files at once; see the
+# automake documentation, node "Multiple Outputs", for details.
+$(srcdir)/noop-styled-ostream.h : $(top_srcdir)/build-aux/moopp noop-styled-ostream.oo.h noop-styled-ostream.oo.c styled-ostream.oo.h ostream.oo.h
+       $(top_srcdir)/build-aux/moopp $(MOOPPFLAGS) $(srcdir)/noop-styled-ostream.oo.c $(srcdir)/noop-styled-ostream.oo.h $(srcdir)/styled-ostream.oo.h $(srcdir)/ostream.oo.h
+$(srcdir)/noop-styled-ostream.c $(srcdir)/noop_styled_ostream.priv.h $(srcdir)/noop_styled_ostream.vt.h : noop-styled-ostream.h
+       @test -f $@ || { \
+         trap 'rm -rf noop-styled-ostream.lock' 1 2 13 15; \
+         if mkdir noop-styled-ostream.lock 2>/dev/null; then \
+           echo "$(top_srcdir)/build-aux/moopp $(MOOPPFLAGS) $(srcdir)/noop-styled-ostream.oo.c $(srcdir)/noop-styled-ostream.oo.h $(srcdir)/styled-ostream.oo.h $(srcdir)/ostream.oo.h"; \
+           $(top_srcdir)/build-aux/moopp $(MOOPPFLAGS) $(srcdir)/noop-styled-ostream.oo.c $(srcdir)/noop-styled-ostream.oo.h $(srcdir)/styled-ostream.oo.h $(srcdir)/ostream.oo.h; \
+           result=$$?; rm -rf noop-styled-ostream.lock; exit $$result; \
+         else \
+           while test -d noop-styled-ostream.lock; do sleep 1; done; \
+           test -f $(srcdir)/noop-styled-ostream.h; \
+         fi; \
+       }
+BUILT_SOURCES += noop-styled-ostream.h noop-styled-ostream.c noop_styled_ostream.priv.h noop_styled_ostream.vt.h
+MAINTAINERCLEANFILES += noop-styled-ostream.h noop-styled-ostream.c noop_styled_ostream.priv.h noop_styled_ostream.vt.h
+EXTRA_DIST += noop-styled-ostream.h noop-styled-ostream.c noop_styled_ostream.priv.h noop_styled_ostream.vt.h
+
+Include:
+"noop-styled-ostream.h"
+
+License:
+GPL
+
+Maintainer:
+Bruno Haible
+
index 12e4908bee687fce31531620d4cc8a45cea0f16d..5dab4fbe747d07a54dd210c4cc735f9f7791b8a2 100644 (file)
@@ -49,8 +49,6 @@
 /lib/fd-hook.h
 /lib/fd-ostream.oo.c
 /lib/fd-ostream.oo.h
-/lib/fd-styled-ostream.oo.c
-/lib/fd-styled-ostream.oo.h
 /lib/file-ostream.oo.c
 /lib/file-ostream.oo.h
 /lib/filename.h
 /lib/msvc-inval.h
 /lib/msvc-nothrow.c
 /lib/msvc-nothrow.h
+/lib/noop-styled-ostream.oo.c
+/lib/noop-styled-ostream.oo.h
 /lib/obstack.c
 /lib/obstack.h
 /lib/ostream.oo.c
 /lib/libtextstyle.sym.in
 /lib/fd-ostream.c
 /lib/fd-ostream.h
-/lib/fd-styled-ostream.c
-/lib/fd-styled-ostream.h
 /lib/fd_ostream.priv.h
 /lib/fd_ostream.vt.h
-/lib/fd_styled_ostream.priv.h
-/lib/fd_styled_ostream.vt.h
 /lib/file-ostream.c
 /lib/file-ostream.h
 /lib/file_ostream.priv.h
 /lib/memory-ostream.h
 /lib/memory_ostream.priv.h
 /lib/memory_ostream.vt.h
+/lib/noop-styled-ostream.c
+/lib/noop-styled-ostream.h
+/lib/noop_styled_ostream.priv.h
+/lib/noop_styled_ostream.vt.h
 /lib/ostream.c
 /lib/ostream.h
 /lib/ostream.priv.h
index d1980dfc4d1e8fbd5b4c5ccd171de51e7e23a513..dd7765672ee3548c48fbab4e15817eb64540cc2c 100755 (executable)
@@ -80,8 +80,8 @@ if test $skip_gnulib = false; then
         memory-ostream
         term-ostream
       styled-ostream
-        fd-styled-ostream
         html-styled-ostream
+        noop-styled-ostream
         term-styled-ostream
       filename
       isatty
index 174487c6fe589091a0b4affb4da05dcb6c66f4d7..a9ca095c77ab97cd45bc9152aba4cd1a1063acb1 100644 (file)
@@ -990,6 +990,7 @@ can be closed.
 @menu
 * The term_styled_ostream class::  Styled output to a terminal.
 * The html_styled_ostream class::  Styled output to an HTML file.
+* The noop_styled_ostream class::  No-op styling.
 @end menu
 
 @node The term_styled_ostream class
@@ -1052,6 +1053,27 @@ Note: The resulting stream must be closed before @code{@var{destination}}
 can be closed.
 @end deftypefn
 
+@node The noop_styled_ostream class
+@subsubsection The @code{noop_styled_ostream} class
+
+The @code{noop_styled_ostream} class supports the styled output operations
+to any destination.  The text is output to the given destination; the
+styling operations, however, do nothing.  Its type is
+@samp{noop_styled_ostream_t}.  It is a subclass of @samp{styled_ostream_t}.
+
+It can be instantiated through this function:
+
+@deftypefn Function noop_styled_ostream_t noop_styled_ostream_create (ostream_t@tie{}@var{destination}, bool@tie{}@var{pass_ownership})
+Creates an output stream that delegates to @code{@var{destination}} and
+that supports the styling operations as no-ops.
+
+If @code{@var{pass_ownership}} is @code{true}, closing the resulting
+stream will automatically close the @code{@var{destination}}.
+
+Note: If @code{@var{pass_ownership}} is @code{false}, the resulting stream
+must be closed before @code{@var{destination}} can be closed.
+@end deftypefn
+
 @node What to document
 @section Documenting the text styling support
 
diff --git a/libtextstyle/gnulib-local/modules/fd-styled-ostream.diff b/libtextstyle/gnulib-local/modules/fd-styled-ostream.diff
deleted file mode 100644 (file)
index cb6d948..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-*** fd-styled-ostream.orig
---- fd-styled-ostream
-***************
-*** 13,23 ****
-  configure.ac:
-  
-  Makefile.am:
-- if !WOE32DLL
-  lib_SOURCES += fd-styled-ostream.c
-- else
-- lib_SOURCES += ../woe32dll/c++fd-styled-ostream.cc
-- endif
-  # This is a Makefile rule that generates multiple files at once; see the
-  # automake documentation, node "Multiple Outputs", for details.
-  $(srcdir)/fd-styled-ostream.h : $(top_srcdir)/build-aux/moopp fd-styled-ostream.oo.h fd-styled-ostream.oo.c styled-ostream.oo.h ostream.oo.h
---- 13,19 ----
-  configure.ac:
-  
-  Makefile.am:
-  lib_SOURCES += fd-styled-ostream.c
-  # This is a Makefile rule that generates multiple files at once; see the
-  # automake documentation, node "Multiple Outputs", for details.
-  $(srcdir)/fd-styled-ostream.h : $(top_srcdir)/build-aux/moopp fd-styled-ostream.oo.h fd-styled-ostream.oo.c styled-ostream.oo.h ostream.oo.h
diff --git a/libtextstyle/gnulib-local/modules/noop-styled-ostream.diff b/libtextstyle/gnulib-local/modules/noop-styled-ostream.diff
new file mode 100644 (file)
index 0000000..cef0a06
--- /dev/null
@@ -0,0 +1,23 @@
+*** noop-styled-ostream.orig
+--- noop-styled-ostream
+***************
+*** 13,23 ****
+  configure.ac:
+  
+  Makefile.am:
+- if !WOE32DLL
+  lib_SOURCES += noop-styled-ostream.c
+- else
+- lib_SOURCES += ../woe32dll/c++noop-styled-ostream.cc
+- endif
+  # This is a Makefile rule that generates multiple files at once; see the
+  # automake documentation, node "Multiple Outputs", for details.
+  $(srcdir)/noop-styled-ostream.h : $(top_srcdir)/build-aux/moopp noop-styled-ostream.oo.h noop-styled-ostream.oo.c styled-ostream.oo.h ostream.oo.h
+--- 13,19 ----
+  configure.ac:
+  
+  Makefile.am:
+  lib_SOURCES += noop-styled-ostream.c
+  # This is a Makefile rule that generates multiple files at once; see the
+  # automake documentation, node "Multiple Outputs", for details.
+  $(srcdir)/noop-styled-ostream.h : $(top_srcdir)/build-aux/moopp noop-styled-ostream.oo.h noop-styled-ostream.oo.c styled-ostream.oo.h ostream.oo.h
index aed4001c6442fb4cfea63ae59db95d8a79d546e4..866fd212f619603c565d1cab5017e8ff31a0cc76 100644 (file)
@@ -21,7 +21,8 @@
 #include "misc.h"
 
 #include "term-styled-ostream.h"
-#include "fd-styled-ostream.h"
+#include "noop-styled-ostream.h"
+#include "fd-ostream.h"
 #include "exitfail.h"
 
 extern int xmalloc_exit_failure;
@@ -35,7 +36,8 @@ styled_ostream_create (int fd, const char *filename, ttyctl_t tty_control,
 
   stream = term_styled_ostream_create (fd, filename, tty_control, css_filename);
   if (stream == NULL)
-    stream = fd_styled_ostream_create (fd, filename);
+    stream =
+      noop_styled_ostream_create (fd_ostream_create (fd, filename, true), true);
 
   return stream;
 }
index 4b79e52f6997e509ae3875b01652956ddb31b54f..0a76beba245f423d27df77ceb23951a9166070a3 100644 (file)
@@ -458,6 +458,44 @@ extern html_styled_ostream_t
                                    const char *css_filename);
 
 
+#ifdef __cplusplus
+}
+#endif
+
+/* ----------------------- From noop-styled-ostream.h ----------------------- */
+
+/* noop_styled_ostream_t is a subtype of styled_ostream_t.  */
+typedef styled_ostream_t noop_styled_ostream_t;
+
+/* Functions that invoke the methods.  */
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern void noop_styled_ostream_write_mem (noop_styled_ostream_t first_arg, const void *data, size_t len);
+extern void noop_styled_ostream_flush (noop_styled_ostream_t first_arg, ostream_flush_scope_t scope);
+extern void noop_styled_ostream_free (noop_styled_ostream_t first_arg);
+extern void noop_styled_ostream_begin_use_class (noop_styled_ostream_t first_arg, const char *classname);
+extern void noop_styled_ostream_end_use_class (noop_styled_ostream_t first_arg, const char *classname);
+extern void noop_styled_ostream_flush_to_current_style (noop_styled_ostream_t first_arg);
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Create an output stream that delegates to DESTINATION and that supports
+   the styling operations as no-ops.
+   If PASS_OWNERSHIP is true, closing the resulting stream will automatically
+   close the DESTINATION.
+   Note that if PASS_OWNERSHIP is false, the resulting stream must be closed
+   before DESTINATION can be closed.  */
+extern noop_styled_ostream_t
+       noop_styled_ostream_create (ostream_t destination, bool pass_ownership);
+
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/libtextstyle/woe32dll/c++fd-styled-ostream.cc b/libtextstyle/woe32dll/c++fd-styled-ostream.cc
deleted file mode 100644 (file)
index bbe4b2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include "../lib/fd-styled-ostream.c"
diff --git a/libtextstyle/woe32dll/c++noop-styled-ostream.cc b/libtextstyle/woe32dll/c++noop-styled-ostream.cc
new file mode 100644 (file)
index 0000000..e74fab1
--- /dev/null
@@ -0,0 +1 @@
+#include "../lib/noop-styled-ostream.c"