]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
libtextstyle: Add a second argument to the 'flush' operations.
authorBruno Haible <bruno@clisp.org>
Tue, 12 Mar 2019 18:27:02 +0000 (19:27 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 12 Mar 2019 18:27:53 +0000 (19:27 +0100)
* gnulib-local/lib/ostream.oo.h (ostream_flush_scope_t): New type.
(ostream::flush): Add scope parameter.

* gnulib-local/lib/file-ostream.oo.c: Include <unistd.h>, <termios.h>.
(file_ostream::flush): Add a scope parameter.
* gnulib-local/modules/file-ostream (Depends-on): Add 'fsync'.
(configure.ac): Check for tcdrain.

* gnulib-local/lib/fd-ostream.oo.c: Include <unistd.h>, <termios.h>.
(fd_ostream::flush): Add a scope parameter.
(fd_ostream::free): Update flush call.
* gnulib-local/modules/fd-ostream (Depends-on): Add 'fsync'.
(configure.ac): Check for tcdrain.

* gnulib-local/lib/term-ostream.oo.c: Include <unistd.h>, <termios.h>.
(term_ostream::flush): Add scope parameter.
(term_ostream::free): Update flush call.
* gnulib-local/m4/term-ostream.m4 (gl_TERM_OSTREAM): Check for tcdrain.
* gnulib-local/modules/term-ostream (Depends-on): Add 'fsync'.

* gnulib-local/lib/memory-ostream.oo.c (memory_ostream::flush): Add scope
parameter.

* gnulib-local/lib/iconv-ostream.oo.c (iconv_ostream::flush): Add scope
parameter.

* gnulib-local/lib/html-ostream.oo.c (html_ostream::flush): Add scope parameter.
Emit closing </span> tags.

* gnulib-local/lib/fd-styled-ostream.oo.c (fd_styled_ostream::flush): Add scope
parameter.
* gnulib-local/lib/term-styled-ostream.oo.c (term_styled_ostream::flush): Add
scope parameter.
* gnulib-local/lib/html-styled-ostream.oo.c (html_styled_ostream::flush): Add
scope parameter.

* libtextstyle/lib/textstyle.h (ostream_flush_scope_t): New type.
(ostream_flush, styled_ostream_flush, file_ostream_flush, fd_ostream_flush,
term_ostream_flush, memory_ostream_flush, iconv_ostream_flush,
html_ostream_flush, term_styled_ostream_flush, html_styled_ostream_flush): Add
scope parameter.
* libtextstyle/doc/libtextstyle.texi (The ostream class): Add scope parameter to
flush method.
* libtextstyle/NEWS: Mention the change.

18 files changed:
gnulib-local/lib/fd-ostream.oo.c
gnulib-local/lib/fd-styled-ostream.oo.c
gnulib-local/lib/file-ostream.oo.c
gnulib-local/lib/html-ostream.oo.c
gnulib-local/lib/html-styled-ostream.oo.c
gnulib-local/lib/iconv-ostream.oo.c
gnulib-local/lib/memory-ostream.oo.c
gnulib-local/lib/ostream.oo.h
gnulib-local/lib/term-ostream.oo.c
gnulib-local/lib/term-styled-ostream.oo.c
gnulib-local/m4/term-ostream.m4
gnulib-local/modules/fd-ostream
gnulib-local/modules/file-ostream
gnulib-local/modules/term-ostream
libtextstyle/.gitignore
libtextstyle/NEWS
libtextstyle/doc/libtextstyle.texi
libtextstyle/lib/textstyle.h

index e87b6d22c619d8a1a87312003eb8a4c7162464ae..cd0235d0ba3a8ce83d851d42c6504e952b7862a4 100644 (file)
@@ -1,5 +1,5 @@
 /* Output stream referring to a file descriptor.
-   Copyright (C) 2006-2007 Free Software Foundation, Inc.
+   Copyright (C) 2006-2007, 2019 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2006.
 
    This program is free software: you can redistribute it and/or modify
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
+#if HAVE_TCDRAIN
+# include <termios.h>
+#endif
 
 #include "error.h"
 #include "full-write.h"
@@ -123,7 +127,7 @@ fd_ostream::write_mem (fd_ostream_t stream, const void *data, size_t len)
 }
 
 static void
-fd_ostream::flush (fd_ostream_t stream)
+fd_ostream::flush (fd_ostream_t stream, ostream_flush_scope_t scope)
 {
   if (stream->buffer != NULL && stream->avail < BUFSIZE)
     {
@@ -132,12 +136,21 @@ fd_ostream::flush (fd_ostream_t stream)
         error (EXIT_FAILURE, errno, _("error writing to %s"), stream->filename);
       stream->avail = BUFSIZE;
     }
+  if (scope == FLUSH_ALL)
+    {
+      /* For streams connected to a disk file:  */
+      fsync (stream->fd);
+      #if HAVE_TCDRAIN
+      /* For streams connected to a terminal:  */
+      tcdrain (stream->fd);
+      #endif
+    }
 }
 
 static void
 fd_ostream::free (fd_ostream_t stream)
 {
-  fd_ostream_flush (stream);
+  fd_ostream_flush (stream, FLUSH_THIS_STREAM);
   free (stream->filename);
   free (stream);
 }
index f709cfa60c074e7290b330ad50ecf21481513111..d3bb1e96eae1651cab7fc92a78f638ebc6a60f2d 100644 (file)
@@ -42,9 +42,9 @@ fd_styled_ostream::write_mem (fd_styled_ostream_t stream,
 }
 
 static void
-fd_styled_ostream::flush (fd_styled_ostream_t stream)
+fd_styled_ostream::flush (fd_styled_ostream_t stream, ostream_flush_scope_t scope)
 {
-  fd_ostream_flush (stream->destination);
+  fd_ostream_flush (stream->destination, scope);
 }
 
 static void
index b6034e822dc676df94d28ad4d1f2686e935beaf9..a62dc84c4dbe637ab89daccae6b3b8d930e05ed7 100644 (file)
@@ -1,5 +1,5 @@
 /* Output stream referring to an stdio FILE.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2019 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2006.
 
    This program is free software: you can redistribute it and/or modify
 #include "file-ostream.h"
 
 #include <stdlib.h>
+#include <unistd.h>
+#if HAVE_TCDRAIN
+# include <termios.h>
+#endif
 
 #include "xalloc.h"
 
@@ -40,10 +44,27 @@ file_ostream::write_mem (file_ostream_t stream, const void *data, size_t len)
 }
 
 static void
-file_ostream::flush (file_ostream_t stream)
+file_ostream::flush (file_ostream_t stream, ostream_flush_scope_t scope)
 {
-  /* This ostream has no internal buffer.  No need to fflush (stream->fp),
-     since it's external to this ostream.  */
+  /* This ostream has no internal buffer, therefore nothing to do for
+     scope == FLUSH_THIS_STREAM.  */
+  if (scope != FLUSH_THIS_STREAM)
+    {
+      fflush (stream->fp);
+      if (scope == FLUSH_ALL)
+        {
+          int fd = fileno (stream->fp);
+          if (fd >= 0)
+            {
+              /* For streams connected to a disk file:  */
+              fsync (fd);
+              #if HAVE_TCDRAIN
+              /* For streams connected to a terminal:  */
+              tcdrain (fd);
+              #endif
+            }
+        }
+    }
 }
 
 static void
index fecf4e5842af9865a87ec9674dbf7a2564f72d39..41df513fe244fc43ae0995f2ccc31deb9ef729d4 100644 (file)
@@ -166,8 +166,8 @@ html_ostream::write_mem (html_ostream_t stream, const void *data, size_t len)
                     size_t prev_class_stack_size = stream->curr_class_stack_size;
                     stream->curr_class_stack_size = 0;
                     emit_pending_spans (stream, false);
-                    ostream_write_str (stream->destination, "<br/>");
                     stream->curr_class_stack_size = prev_class_stack_size;
+                    ostream_write_str (stream->destination, "<br/>");
                     shrink_class_stack (stream);
                     verify_invariants (stream);
                   }
@@ -238,11 +238,22 @@ html_ostream::write_mem (html_ostream_t stream, const void *data, size_t len)
 }
 
 static void
-html_ostream::flush (html_ostream_t stream)
+html_ostream::flush (html_ostream_t stream, ostream_flush_scope_t scope)
 {
-  /* There's nothing to do here, since stream->buf[] contains only a few
-     bytes that don't correspond to a character, and it's not worth closing
-     the open spans.  */
+  verify_invariants (stream);
+  /* stream->buf[] contains only a few bytes that don't correspond to a
+     character.  Can't flush it.  */
+  /* Close the open <span> tags, and prepare for reopening the same <span>
+     tags.  */
+  size_t prev_class_stack_size = stream->curr_class_stack_size;
+  stream->curr_class_stack_size = 0;
+  emit_pending_spans (stream, false);
+  stream->curr_class_stack_size = prev_class_stack_size;
+  shrink_class_stack (stream);
+  verify_invariants (stream);
+
+  if (scope != FLUSH_THIS_STREAM)
+    ostream_flush (stream->destination, scope);
 }
 
 static void
index 0bb081830d2e17f867eb4142db4ec515ed395a43..77201e1711156d88b9e2a55ba1147f9abb6b4c42 100644 (file)
@@ -59,9 +59,9 @@ html_styled_ostream::write_mem (html_styled_ostream_t stream,
 }
 
 static void
-html_styled_ostream::flush (html_styled_ostream_t stream)
+html_styled_ostream::flush (html_styled_ostream_t stream, ostream_flush_scope_t scope)
 {
-  html_ostream_flush (stream->html_destination);
+  html_ostream_flush (stream->html_destination, scope);
 }
 
 static void
index 715a9a659cf15e6eb61508e56cbc1c6d5c5e42eb..5c122c6faf7443a61b4bbdc579fa9ee8f97bb4cc 100644 (file)
@@ -1,5 +1,5 @@
 /* Output stream that converts the output to another encoding.
-   Copyright (C) 2006-2007, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2006-2007, 2010, 2019 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2006.
 
    This program is free software: you can redistribute it and/or modify
@@ -139,10 +139,13 @@ iconv_ostream::write_mem (iconv_ostream_t stream, const void *data, size_t len)
 }
 
 static void
-iconv_ostream::flush (iconv_ostream_t stream)
+iconv_ostream::flush (iconv_ostream_t stream, ostream_flush_scope_t scope)
 {
-  /* There's nothing we can do here, since stream->buf[] contains only a few
-     bytes that don't correspond to a character.  */
+  /* For scope == FLUSH_THIS_STREAM, there's nothing we can do here, since
+     stream->buf[] contains only a few bytes that don't correspond to a
+     character.  */
+  if (scope != FLUSH_THIS_STREAM)
+    ostream_flush (stream->destination, scope);
 }
 
 static void
index acdb66fcc13852f9c005291f8442108d120470a9..4c12b655ecfcb3e2ff7e099b8a296b0ef3e49e7c 100644 (file)
@@ -1,5 +1,5 @@
 /* Output stream that accumulates the output in memory.
-   Copyright (C) 2006-2007 Free Software Foundation, Inc.
+   Copyright (C) 2006-2007, 2019 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2006.
 
    This program is free software: you can redistribute it and/or modify
@@ -64,7 +64,7 @@ memory_ostream::write_mem (memory_ostream_t stream,
 }
 
 static void
-memory_ostream::flush (memory_ostream_t stream)
+memory_ostream::flush (memory_ostream_t stream, ostream_flush_scope_t scope)
 {
 }
 
index 7e33c1de2eba588b38cd1e47649ec5bd2e53e1e8..c1c9143388494d004e656610d891f56ba992d953 100644 (file)
@@ -1,5 +1,5 @@
 /* Abstract output stream data type.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2019 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2006.
 
    This program is free software: you can redistribute it and/or modify
 
 #include "moo.h"
 
+
+/* Describes the scope of a flush operation.  */
+typedef enum
+{
+  /* Flushes buffers in this ostream_t.
+     Use this value if you want to write to the underlying ostream_t.  */
+  FLUSH_THIS_STREAM = 0,
+  /* Flushes all buffers in the current process.
+     Use this value if you want to write to the same target through a
+     different file descriptor or a FILE stream.  */
+  FLUSH_THIS_PROCESS = 1,
+  /* Flushes buffers in the current process and attempts to flush the buffers
+     in the kernel.
+     Use this value so that some other process (or the kernel itself)
+     may write to the same target.  */
+  FLUSH_ALL = 2
+} ostream_flush_scope_t;
+
+
 /* An output stream is an object to which one can feed a sequence of bytes.  */
 
 struct ostream
@@ -33,7 +52,7 @@ methods:
   void write_mem (ostream_t stream, const void *data, size_t len);
 
   /* Bring buffered data to its destination.  */
-  void flush (ostream_t stream);
+  void flush (ostream_t stream, ostream_flush_scope_t scope);
 
   /* Close and free a stream.  */
   void free (ostream_t stream);
index 167cf99a51848f188b7f777b66cb7db33bf4ec20..797acbc4431d1b5e51f6820c982d664a6a472a7f 100644 (file)
 #include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
+#if HAVE_TCDRAIN
+# include <termios.h>
+#endif
 
 #include "error.h"
 #include "fatal-signal.h"
@@ -1605,15 +1609,24 @@ term_ostream::write_mem (term_ostream_t stream, const void *data, size_t len)
 }
 
 static void
-term_ostream::flush (term_ostream_t stream)
+term_ostream::flush (term_ostream_t stream, ostream_flush_scope_t scope)
 {
   output_buffer (stream);
+  if (scope == FLUSH_ALL)
+    {
+      /* For streams connected to a disk file:  */
+      fsync (stream->fd);
+      #if HAVE_TCDRAIN
+      /* For streams connected to a terminal:  */
+      tcdrain (stream->fd);
+      #endif
+    }
 }
 
 static void
 term_ostream::free (term_ostream_t stream)
 {
-  term_ostream_flush (stream);
+  term_ostream_flush (stream, FLUSH_THIS_STREAM);
   free (stream->filename);
   if (stream->set_a_foreground != NULL)
     free (stream->set_a_foreground);
index 69ca68452f2cc0891f8d3a592f6f7627dc363788..9ab96d702034bfdec00183da4dcd1687b4c54688 100644 (file)
@@ -96,9 +96,9 @@ term_styled_ostream::write_mem (term_styled_ostream_t stream,
 }
 
 static void
-term_styled_ostream::flush (term_styled_ostream_t stream)
+term_styled_ostream::flush (term_styled_ostream_t stream, ostream_flush_scope_t scope)
 {
-  term_ostream_flush (stream->destination);
+  term_ostream_flush (stream->destination, scope);
 }
 
 static void
index 0fd8691f17b15eee2d2f48553bc83dfd31a70de3..e3906c8cbdbf1bee8f66ce745e434ba761a741ae 100644 (file)
@@ -1,5 +1,5 @@
-# term-ostream.m4 serial 1
-dnl Copyright (C) 2006 Free Software Foundation, Inc.
+# term-ostream.m4 serial 2
+dnl Copyright (C) 2006, 2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -7,4 +7,5 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_TERM_OSTREAM],
 [
   AC_REQUIRE([AC_C_INLINE])
+  AC_CHECK_FUNCS_ONCE([tcdrain])
 ])
index 99e1f87445d843a8faf7ac49273ef9809208191f..b0f854c787513c894a066f7f9e7edb0f9672027c 100644 (file)
@@ -10,10 +10,12 @@ ostream
 error
 stdlib
 full-write
+fsync
 gettext
 xalloc
 
 configure.ac:
+AC_CHECK_FUNCS_ONCE([tcdrain])
 
 Makefile.am:
 lib_SOURCES += fd-ostream.c
index 23dff47fa1283602b7afd017e2eef17281c4927a..dea3cd65c1232e4b0e9fd953f4fc3aa9827a7b26 100644 (file)
@@ -7,9 +7,11 @@ lib/file-ostream.oo.c
 
 Depends-on:
 ostream
+fsync
 xalloc
 
 configure.ac:
+AC_CHECK_FUNCS_ONCE([tcdrain])
 
 Makefile.am:
 lib_SOURCES += file-ostream.c
index da38fa1027d644a5d6d2b7eba0d28c45ff53617f..2264b308eb9c8bb718f09234d676e415dff29e8e 100644 (file)
@@ -13,6 +13,7 @@ stdlib
 fatal-signal
 sigprocmask
 full-write
+fsync
 gettext-h
 terminfo-h
 xalloc
index 78009428f7301b44cfc18e39f2d3466d3b1e8b68..fc318084275ac9fe3d4b78e0dacfdd89120b6a2d 100644 (file)
@@ -57,6 +57,7 @@
 /lib/float+.h
 /lib/float.c
 /lib/float.in.h
+/lib/fsync.c
 /lib/full-write.c
 /lib/full-write.h
 /lib/getprogname.c
index 371f6e2e68d8d2beda40f5be2622785ce8e776f9..ec3064ae242c01242ad2ef6f0286868893bd675b 100644 (file)
@@ -1,3 +1,7 @@
+New in 0.6:
+* The ostream_t operation 'flush' now takes an additional argument, of type
+  ostream_flush_scope_t.
+
 New in 0.5:
 
 * The libtextstyle library can now be built and installed independently
index f7cb5df54735387a359b027ff846c2f705854f42..764fd74b074b7e7b99349014c46421519dda48a2 100644 (file)
@@ -681,7 +681,7 @@ Writes a sequence of bytes to a stream.
 Writes a string's contents to a stream.
 @end deftypefn
 
-@deftypefn Function void ostream_flush (ostream_t@tie{}@var{stream})
+@deftypefn Function void ostream_flush (ostream_t@tie{}@var{stream}, ostream_flush_scope_t@tie{}@var{scope})
 Brings buffered data to its destination.
 @end deftypefn
 
index f70baa8f11d794db061cfefb3a02ced02d48f969..f17766780a331d7d1f0dcd579a9b8e111c69ed9f 100644 (file)
 
 /* ----------------------------- From ostream.h ----------------------------- */
 
+/* Describes the scope of a flush operation.  */
+typedef enum
+{
+  /* Flushes buffers in this ostream_t.
+     Use this value if you want to write to the underlying ostream_t.  */
+  FLUSH_THIS_STREAM = 0,
+  /* Flushes all buffers in the current process.
+     Use this value if you want to write to the same target through a
+     different file descriptor or a FILE stream.  */
+  FLUSH_THIS_PROCESS = 1,
+  /* Flushes buffers in the current process and attempts to flush the buffers
+     in the kernel.
+     Use this value so that some other process (or the kernel itself)
+     may write to the same target.  */
+  FLUSH_ALL = 2
+} ostream_flush_scope_t;
+
+
 /* An output stream is an object to which one can feed a sequence of bytes.  */
 
 struct any_ostream_representation;
@@ -39,7 +57,7 @@ typedef struct any_ostream_representation * ostream_t;
 extern "C" {
 #endif
 extern void ostream_write_mem (ostream_t first_arg, const void *data, size_t len);
-extern void ostream_flush (ostream_t first_arg);
+extern void ostream_flush (ostream_t first_arg, ostream_flush_scope_t scope);
 extern void ostream_free (ostream_t first_arg);
 #ifdef __cplusplus
 }
@@ -71,7 +89,7 @@ typedef ostream_t styled_ostream_t;
 extern "C" {
 #endif
 extern void styled_ostream_write_mem (styled_ostream_t first_arg, const void *data, size_t len);
-extern void styled_ostream_flush (styled_ostream_t first_arg);
+extern void styled_ostream_flush (styled_ostream_t first_arg, ostream_flush_scope_t scope);
 extern void styled_ostream_free (styled_ostream_t first_arg);
 extern void styled_ostream_begin_use_class (styled_ostream_t first_arg, const char *classname);
 extern void styled_ostream_end_use_class (styled_ostream_t first_arg, const char *classname);
@@ -89,7 +107,7 @@ typedef ostream_t file_ostream_t;
 extern "C" {
 #endif
 extern void file_ostream_write_mem (file_ostream_t first_arg, const void *data, size_t len);
-extern void file_ostream_flush (file_ostream_t first_arg);
+extern void file_ostream_flush (file_ostream_t first_arg, ostream_flush_scope_t scope);
 extern void file_ostream_free (file_ostream_t first_arg);
 #ifdef __cplusplus
 }
@@ -119,7 +137,7 @@ typedef ostream_t fd_ostream_t;
 extern "C" {
 #endif
 extern void fd_ostream_write_mem (fd_ostream_t first_arg, const void *data, size_t len);
-extern void fd_ostream_flush (fd_ostream_t first_arg);
+extern void fd_ostream_flush (fd_ostream_t first_arg, ostream_flush_scope_t scope);
 extern void fd_ostream_free (fd_ostream_t first_arg);
 #ifdef __cplusplus
 }
@@ -188,7 +206,7 @@ typedef ostream_t term_ostream_t;
 extern "C" {
 #endif
 extern void term_ostream_write_mem (term_ostream_t first_arg, const void *data, size_t len);
-extern void term_ostream_flush (term_ostream_t first_arg);
+extern void term_ostream_flush (term_ostream_t first_arg, ostream_flush_scope_t scope);
 extern void term_ostream_free (term_ostream_t first_arg);
 extern term_color_t term_ostream_rgb_to_color (term_ostream_t first_arg, int red, int green, int blue);
 extern term_color_t term_ostream_get_color (term_ostream_t first_arg);
@@ -253,7 +271,7 @@ typedef ostream_t memory_ostream_t;
 extern "C" {
 #endif
 extern void memory_ostream_write_mem (memory_ostream_t first_arg, const void *data, size_t len);
-extern void memory_ostream_flush (memory_ostream_t first_arg);
+extern void memory_ostream_flush (memory_ostream_t first_arg, ostream_flush_scope_t scope);
 extern void memory_ostream_free (memory_ostream_t first_arg);
 extern void memory_ostream_contents (memory_ostream_t first_arg, const void **bufp, size_t *buflenp);
 #ifdef __cplusplus
@@ -285,7 +303,7 @@ typedef ostream_t iconv_ostream_t;
 extern "C" {
 #endif
 extern void iconv_ostream_write_mem (iconv_ostream_t first_arg, const void *data, size_t len);
-extern void iconv_ostream_flush (iconv_ostream_t first_arg);
+extern void iconv_ostream_flush (iconv_ostream_t first_arg, ostream_flush_scope_t scope);
 extern void iconv_ostream_free (iconv_ostream_t first_arg);
 #ifdef __cplusplus
 }
@@ -319,7 +337,7 @@ typedef ostream_t html_ostream_t;
 extern "C" {
 #endif
 extern void html_ostream_write_mem (html_ostream_t first_arg, const void *data, size_t len);
-extern void html_ostream_flush (html_ostream_t first_arg);
+extern void html_ostream_flush (html_ostream_t first_arg, ostream_flush_scope_t scope);
 extern void html_ostream_free (html_ostream_t first_arg);
 extern void html_ostream_begin_span (html_ostream_t first_arg, const char *classname);
 extern void html_ostream_end_span (html_ostream_t first_arg, const char *classname);
@@ -356,7 +374,7 @@ typedef styled_ostream_t term_styled_ostream_t;
 extern "C" {
 #endif
 extern void term_styled_ostream_write_mem (term_styled_ostream_t first_arg, const void *data, size_t len);
-extern void term_styled_ostream_flush (term_styled_ostream_t first_arg);
+extern void term_styled_ostream_flush (term_styled_ostream_t first_arg, ostream_flush_scope_t scope);
 extern void term_styled_ostream_free (term_styled_ostream_t first_arg);
 extern void term_styled_ostream_begin_use_class (term_styled_ostream_t first_arg, const char *classname);
 extern void term_styled_ostream_end_use_class (term_styled_ostream_t first_arg, const char *classname);
@@ -395,7 +413,7 @@ typedef styled_ostream_t html_styled_ostream_t;
 extern "C" {
 #endif
 extern void html_styled_ostream_write_mem (html_styled_ostream_t first_arg, const void *data, size_t len);
-extern void html_styled_ostream_flush (html_styled_ostream_t first_arg);
+extern void html_styled_ostream_flush (html_styled_ostream_t first_arg, ostream_flush_scope_t scope);
 extern void html_styled_ostream_free (html_styled_ostream_t first_arg);
 extern void html_styled_ostream_begin_use_class (html_styled_ostream_t first_arg, const char *classname);
 extern void html_styled_ostream_end_use_class (html_styled_ostream_t first_arg, const char *classname);