/lib/xvasprintf.h
/tests/
!/tests/Makefile.am
+!/tests/test-accessors.c
!/tests/test-instanceof.c
# Files brought in by "automake --add-missing --copy":
term_styled_ostream_t is_instance_of_term_styled_ostream
html_styled_ostream_t is_instance_of_html_styled_ostream
noop_styled_ostream_t is_instance_of_noop_styled_ostream
+* Added accessor functions:
+ TYPE FUNCTION
+ file_ostream_t file_ostream_get_stdio_stream
+ fd_ostream_t fd_ostream_get_descriptor
+ fd_ostream_t fd_ostream_get_filename
+ fd_ostream_t fd_ostream_is_buffered
+ term_ostream_t term_ostream_get_descriptor
+ term_ostream_t term_ostream_get_filename
+ term_ostream_t term_ostream_get_tty_control
+ term_ostream_t term_ostream_get_effective_tty_control
+ iconv_ostream_t iconv_ostream_get_from_encoding
+ iconv_ostream_t iconv_ostream_get_to_encoding
+ iconv_ostream_t iconv_ostream_get_destination
+ html_ostream_t html_ostream_get_destination
+ term_styled_ostream_t term_styled_ostream_get_destination
+ term_styled_ostream_t term_styled_ostream_get_css_filename
+ html_styled_ostream_t html_styled_ostream_get_destination
+ html_styled_ostream_t html_styled_ostream_get_html_destination
+ html_styled_ostream_t html_styled_ostream_get_css_filename
+ noop_styled_ostream_t noop_styled_ostream_get_destination
+ noop_styled_ostream_t noop_styled_ostream_is_owning_destination
New in 0.21:
* Added support for emitting hyperlinks.
* The styled_ostream class::
* ostream subclasses without styling::
* styled_ostream subclasses::
+* Accessors::
@end menu
@node The ostream class
@code{styled_ostream_end_use_class} calls must match properly.
@end deftypefn
-@deftypefn Function {const char *} styled_ostream_get_hyperlink_ref (styled_ostream_t@tie{}@var{stream})
+@deftypefn Function {const@tie{}char@tie{}*} styled_ostream_get_hyperlink_ref (styled_ostream_t@tie{}@var{stream})
Returns the referred URL of the currently set hyperlink, or @code{NULL}
if no hyperlink attribute is currently set.
@code{styled_ostream_set_hyperlink}.
@end deftypefn
-@deftypefn Function {const char *} styled_ostream_get_hyperlink_id (styled_ostream_t@tie{}@var{stream})
+@deftypefn Function {const@tie{}char@tie{}*} styled_ostream_get_hyperlink_id (styled_ostream_t@tie{}@var{stream})
Returns the id of the currently set hyperlink, or @code{NULL} if no
hyperlink attribute is currently set.
Gets/sets the text underline decoration.
@end deftypefn
-@deftypefn Function {const char *} term_ostream_get_hyperlink_ref (term_ostream_t@tie{}@var{stream})
+@deftypefn Function {const@tie{}char@tie{}*} term_ostream_get_hyperlink_ref (term_ostream_t@tie{}@var{stream})
Returns the referred URL of the currently set hyperlink, or @code{NULL}
if no hyperlink attribute is currently set.
@code{term_ostream_set_hyperlink}.
@end deftypefn
-@deftypefn Function {const char *} term_ostream_get_hyperlink_id (term_ostream_t@tie{}@var{stream})
+@deftypefn Function {const@tie{}char@tie{}*} term_ostream_get_hyperlink_id (term_ostream_t@tie{}@var{stream})
Returns the id of the currently set hyperlink, or @code{NULL} if no
hyperlink attribute is currently set.
must match properly.
@end deftypefn
-@deftypefn Function {const char *} html_ostream_get_hyperlink_ref (html_ostream_t@tie{}@var{stream})
+@deftypefn Function {const@tie{}char@tie{}*} html_ostream_get_hyperlink_ref (html_ostream_t@tie{}@var{stream})
Returns the referred URL of the currently set hyperlink, or @code{NULL}
if no hyperlink attribute is currently set.
must be closed before @code{@var{destination}} can be closed.
@end deftypefn
+@node Accessors
+@subsection Accessor functions
+
+The various concrete stream classes have methods that allow you to retrieve
+the arguments passed to the respective constructor function.
+
+Note: While these methods allow you to retrieve the underlying destination
+stream of various kinds of stream, it is not recommended to operate on both
+the stream and its underlying destination stream at the same time. Doing
+so can lead to undesired interactions between the two streams.
+
+The @code{file_ostream} class has this accessor method:
+
+@deftypefn Function {FILE@tie{}*} file_ostream_get_stdio_stream (file_ostream_t@tie{}@var{stream})
+@end deftypefn
+
+The @code{fd_ostream} class has these accessor methods:
+
+@deftypefn Function int fd_ostream_get_descriptor (fd_ostream_t@tie{}@var{stream})
+@end deftypefn
+@deftypefn Function {const@tie{}char@tie{}*} fd_ostream_get_filename (fd_ostream_t@tie{}@var{stream})
+@end deftypefn
+@deftypefn Function bool fd_ostream_is_buffered (fd_ostream_t@tie{}@var{stream})
+@end deftypefn
+
+The @code{term_ostream} class has these accessor methods:
+
+@deftypefn Function int term_ostream_get_descriptor (term_ostream_t@tie{}@var{stream})
+@end deftypefn
+@deftypefn Function {const@tie{}char@tie{}*} term_ostream_get_filename (term_ostream_t@tie{}@var{stream})
+@end deftypefn
+@deftypefn Function ttyctl_t term_ostream_get_tty_control (term_ostream_t@tie{}@var{stream})
+@end deftypefn
+@deftypefn Function ttyctl_t term_ostream_get_effective_tty_control (term_ostream_t@tie{}@var{stream})
+Returns the effective tty control of the stream (not @code{TTYCTL_AUTO}).
+@end deftypefn
+
+The @code{iconv_ostream} class has these accessor methods:
+
+@deftypefn Function {const@tie{}char@tie{}*} iconv_ostream_get_from_encoding (iconv_ostream_t@tie{}@var{stream})
+@end deftypefn
+@deftypefn Function {const@tie{}char@tie{}*} iconv_ostream_get_to_encoding (iconv_ostream_t@tie{}@var{stream})
+@end deftypefn
+@deftypefn Function ostream_t iconv_ostream_get_destination (iconv_ostream_t@tie{}@var{stream})
+@end deftypefn
+
+The @code{html_ostream} class has this accessor method:
+
+@deftypefn Function ostream_t html_ostream_get_destination (html_ostream_t@tie{}@var{stream})
+@end deftypefn
+
+The @code{term_styled_ostream} class has these accessor methods:
+
+@deftypefn Function term_ostream_t term_styled_ostream_get_destination (term_styled_ostream_t@tie{}@var{stream})
+@end deftypefn
+@deftypefn Function {const@tie{}char@tie{}*} term_styled_ostream_get_css_filename (term_styled_ostream_t@tie{}@var{stream})
+@end deftypefn
+
+The @code{html_styled_ostream} class has these accessor methods:
+
+@deftypefn Function ostream_t html_styled_ostream_get_destination (html_styled_ostream_t@tie{}@var{stream})
+@end deftypefn
+@deftypefn Function html_ostream_t html_styled_ostream_get_html_destination (html_styled_ostream_t@tie{}@var{stream})
+@end deftypefn
+@deftypefn Function {const@tie{}char@tie{}*} html_styled_ostream_get_css_filename (html_styled_ostream_t@tie{}@var{stream})
+@end deftypefn
+
+The @code{noop_styled_ostream} class has these accessor methods:
+
+@deftypefn Function ostream_t noop_styled_ostream_get_destination (noop_styled_ostream_t@tie{}@var{stream})
+@end deftypefn
+@deftypefn Function bool noop_styled_ostream_is_owning_destination (noop_styled_ostream_t@tie{}@var{stream})
+@end deftypefn
+
@node Debugging the styling code
@section Debugging the text styling support
return stream;
}
+/* Accessors. */
+
+static int
+fd_ostream::get_descriptor (fd_ostream_t stream)
+{
+ return stream->fd;
+}
+
+static const char *
+fd_ostream::get_filename (fd_ostream_t stream)
+{
+ return stream->filename;
+}
+
+static bool
+fd_ostream::is_buffered (fd_ostream_t stream)
+{
+ return stream->buffer != NULL;
+}
+
/* Instanceof test. */
bool
struct fd_ostream : struct ostream
{
methods:
+ /* Accessors. */
+ int get_descriptor (fd_ostream_t stream);
+ const char * get_filename (fd_ostream_t stream);
+ bool is_buffered (fd_ostream_t stream);
};
return stream;
}
+/* Accessors. */
+
+static FILE *
+file_ostream::get_stdio_stream (file_ostream_t stream)
+{
+ return stream->fp;
+}
+
/* Instanceof test. */
bool
struct file_ostream : struct ostream
{
methods:
+ /* Accessors. */
+ FILE * get_stdio_stream (file_ostream_t stream);
};
return stream;
}
+/* Accessors. */
+
+static ostream_t
+html_ostream::get_destination (html_ostream_t stream)
+{
+ return stream->destination;
+}
+
/* Instanceof test. */
bool
to the underlying stream, and they will be rendered like strings passed
to 'ostream_write_mem', 'ostream_write_str', or 'ostream_write_printf'. */
void flush_to_current_style (html_ostream_t stream);
+
+ /* Accessors. */
+ ostream_t get_destination (html_ostream_t stream);
};
fields:
/* The destination stream. */
ostream_t destination;
+ /* The CSS filename. */
+ char *css_filename;
/* A HTML aware wrapper around the destination stream. */
html_ostream_t html_destination;
/* The current hyperlink id. */
ostream_write_str (stream->destination, "</body>\n");
ostream_write_str (stream->destination, "</html>\n");
free (stream->hyperlink_id);
+ free (stream->css_filename);
free (stream);
}
stream->base.base.vtable = &html_styled_ostream_vtable;
stream->destination = destination;
+ stream->css_filename = xstrdup (css_filename);
stream->html_destination = html_ostream_create (destination);
stream->hyperlink_id = NULL;
return stream;
}
+/* Accessors. */
+
+static ostream_t
+html_styled_ostream::get_destination (html_styled_ostream_t stream)
+{
+ return stream->destination;
+}
+
+static html_ostream_t
+html_styled_ostream::get_html_destination (html_styled_ostream_t stream)
+{
+ return stream->html_destination;
+}
+
+static const char *
+html_styled_ostream::get_css_filename (html_styled_ostream_t stream)
+{
+ return stream->css_filename;
+}
+
/* Instanceof test. */
bool
#include <stdbool.h>
#include "styled-ostream.h"
+#include "html-ostream.h"
struct html_styled_ostream : struct styled_ostream
{
methods:
+ /* Accessors. */
+ ostream_t get_destination (html_styled_ostream_t stream);
+ html_ostream_t get_html_destination (html_styled_ostream_t stream);
+ const char * get_css_filename (html_styled_ostream_t stream);
};
return stream;
}
+/* Accessors. */
+
+static const char *
+iconv_ostream::get_from_encoding (iconv_ostream_t stream)
+{
+ return stream->from_encoding;
+}
+
+static const char *
+iconv_ostream::get_to_encoding (iconv_ostream_t stream)
+{
+ return stream->to_encoding;
+}
+
+static ostream_t
+iconv_ostream::get_destination (iconv_ostream_t stream)
+{
+ return stream->destination;
+}
+
/* Instanceof test. */
bool
abort ();
}
+/* Accessors. */
+
+static const char *
+iconv_ostream::get_from_encoding (iconv_ostream_t stream)
+{
+ abort ();
+}
+
+static const char *
+iconv_ostream::get_to_encoding (iconv_ostream_t stream)
+{
+ abort ();
+}
+
+static ostream_t
+iconv_ostream::get_destination (iconv_ostream_t stream)
+{
+ abort ();
+}
+
/* Instanceof test. */
bool
struct iconv_ostream : struct ostream
{
methods:
+ /* Accessors. */
+ const char * get_from_encoding (iconv_ostream_t stream);
+ const char * get_to_encoding (iconv_ostream_t stream);
+ ostream_t get_destination (iconv_ostream_t stream);
};
return stream;
}
+/* Accessors. */
+
+static ostream_t
+noop_styled_ostream::get_destination (noop_styled_ostream_t stream)
+{
+ return stream->destination;
+}
+
+static bool
+noop_styled_ostream::is_owning_destination (noop_styled_ostream_t stream)
+{
+ return stream->own_destination;
+}
+
/* Instanceof test. */
bool
struct noop_styled_ostream : struct styled_ostream
{
methods:
+ /* Accessors. */
+ ostream_t get_destination (noop_styled_ostream_t stream);
+ bool is_owning_destination (noop_styled_ostream_t stream);
};
bool volatile is_windows_console;
#endif
char *filename;
+ ttyctl_t tty_control;
/* Values from the terminal type's terminfo/termcap description.
See terminfo(5) for details. */
/* terminfo termcap */
}
#endif
stream->filename = xstrdup (filename);
+ stream->tty_control = tty_control;
/* Defaults. */
stream->max_colors = -1;
return stream;
}
+/* Accessors. */
+
+static int
+term_ostream::get_descriptor (term_ostream_t stream)
+{
+ return stream->fd;
+}
+
+static const char *
+term_ostream::get_filename (term_ostream_t stream)
+{
+ return stream->filename;
+}
+
+static ttyctl_t
+term_ostream::get_tty_control (term_ostream_t stream)
+{
+ return stream->tty_control;
+}
+
+static ttyctl_t
+term_ostream::get_effective_tty_control (term_ostream_t stream)
+{
+ return stream->control_data.tty_control;
+}
+
/* Instanceof test. */
bool
UNDERLINE_DEFAULT = UNDERLINE_OFF
} term_underline_t;
+/* Get ttyctl_t. */
+#define term_style_user_data term_ostream_representation
+#include "term-style-control.h"
+
struct term_ostream : struct ostream
{
methods:
passed to 'ostream_write_mem', 'ostream_write_str', or
'ostream_write_printf'. */
void flush_to_current_style (term_ostream_t stream);
-};
-/* Get ttyctl_t. */
-#define term_style_user_data term_ostream_representation
-#include "term-style-control.h"
+ /* Accessors. */
+ int get_descriptor (term_ostream_t stream);
+ const char * get_filename (term_ostream_t stream);
+ ttyctl_t get_tty_control (term_ostream_t stream);
+ ttyctl_t get_effective_tty_control (term_ostream_t stream);
+};
#ifdef __cplusplus
fields:
/* The destination stream. */
term_ostream_t destination;
+ /* The CSS filename. */
+ char *css_filename;
/* The CSS document. */
CRCascade *css_document;
/* The CSS matching engine. */
static void
term_styled_ostream::free (term_styled_ostream_t stream)
{
+ free (stream->css_filename);
term_ostream_free (stream->destination);
cr_cascade_destroy (stream->css_document);
cr_sel_eng_destroy (stream->css_engine);
stream->base.base.vtable = &term_styled_ostream_vtable;
stream->destination = term_ostream_create (fd, filename, tty_control);
+ stream->css_filename = xstrdup (css_filename);
if (cr_om_parser_simply_parse_file ((const guchar *) css_filename,
CR_UTF_8, /* CR_AUTO is not supported */
&css_file_contents) != CR_OK)
{
+ free (stream->css_filename);
term_ostream_free (stream->destination);
free (stream);
return NULL;
return stream;
}
+/* Accessors. */
+
+static term_ostream_t
+term_styled_ostream::get_destination (term_styled_ostream_t stream)
+{
+ return stream->destination;
+}
+
+static const char *
+term_styled_ostream::get_css_filename (term_styled_ostream_t stream)
+{
+ return stream->css_filename;
+}
+
/* Instanceof test. */
bool
struct term_styled_ostream : struct styled_ostream
{
methods:
+ /* Accessors. */
+ term_ostream_t get_destination (term_styled_ostream_t stream);
+ const char * get_css_filename (term_styled_ostream_t stream);
};
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, ostream_flush_scope_t scope);
extern void file_ostream_free (file_ostream_t first_arg);
+/* Accessors. */
+extern FILE *file_ostream_get_stdio_stream (file_ostream_t stream);
#ifdef __cplusplus
}
#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, ostream_flush_scope_t scope);
extern void fd_ostream_free (fd_ostream_t first_arg);
+/* Accessors. */
+extern int fd_ostream_get_descriptor (fd_ostream_t stream);
+extern const char *fd_ostream_get_filename (fd_ostream_t stream);
+extern bool fd_ostream_is_buffered (fd_ostream_t stream);
#ifdef __cplusplus
}
#endif
UNDERLINE_DEFAULT = UNDERLINE_OFF
} term_underline_t;
+/* The amount of control to take over the underlying tty in order to avoid
+ garbled output on the screen, due to interleaved output of escape sequences
+ and output from the kernel (such as when the kernel echoes user's input
+ or when the kernel prints '^C' after the user pressed Ctrl-C). */
+typedef enum
+{
+ TTYCTL_AUTO = 0, /* Automatic best-possible choice. */
+ TTYCTL_NONE, /* No control.
+ Result: Garbled output can occur, and the terminal can
+ be left in any state when the program is interrupted. */
+ TTYCTL_PARTIAL, /* Signal handling.
+ Result: Garbled output can occur, but the terminal will
+ be left in the default state when the program is
+ interrupted. */
+ TTYCTL_FULL /* Signal handling and disabling echo and flush-upon-signal.
+ Result: No garbled output, and the the terminal will
+ be left in the default state when the program is
+ interrupted. */
+} ttyctl_t;
+
/* term_ostream_t is a subtype of ostream_t. */
typedef ostream_t term_ostream_t;
passed to 'ostream_write_mem', 'ostream_write_str', or
'ostream_write_printf'. */
extern void term_ostream_flush_to_current_style (term_ostream_t first_arg);
+/* Accessors. */
+extern int term_ostream_get_descriptor (term_ostream_t stream);
+extern const char *term_ostream_get_filename (term_ostream_t stream);
+extern ttyctl_t term_ostream_get_tty_control (term_ostream_t stream);
+extern ttyctl_t term_ostream_get_effective_tty_control (term_ostream_t stream);
#ifdef __cplusplus
}
#endif
-/* The amount of control to take over the underlying tty in order to avoid
- garbled output on the screen, due to interleaved output of escape sequences
- and output from the kernel (such as when the kernel echoes user's input
- or when the kernel prints '^C' after the user pressed Ctrl-C). */
-typedef enum
-{
- TTYCTL_AUTO = 0, /* Automatic best-possible choice. */
- TTYCTL_NONE, /* No control.
- Result: Garbled output can occur, and the terminal can
- be left in any state when the program is interrupted. */
- TTYCTL_PARTIAL, /* Signal handling.
- Result: Garbled output can occur, but the terminal will
- be left in the default state when the program is
- interrupted. */
- TTYCTL_FULL /* Signal handling and disabling echo and flush-upon-signal.
- Result: No garbled output, and the the terminal will
- be left in the default state when the program is
- interrupted. */
-} ttyctl_t;
-
#ifdef __cplusplus
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, ostream_flush_scope_t scope);
extern void iconv_ostream_free (iconv_ostream_t first_arg);
+/* Accessors. */
+extern const char *iconv_ostream_get_from_encoding (iconv_ostream_t stream);
+extern const char *iconv_ostream_get_to_encoding (iconv_ostream_t stream);
+extern ostream_t iconv_ostream_get_destination (iconv_ostream_t stream);
#ifdef __cplusplus
}
#endif
to the underlying stream, and they will be rendered like strings passed
to 'ostream_write_mem', 'ostream_write_str', or 'ostream_write_printf'. */
extern void html_ostream_flush_to_current_style (html_ostream_t stream);
+/* Accessors. */
+extern ostream_t html_ostream_get_destination (html_ostream_t stream);
#ifdef __cplusplus
}
#endif
extern const char *term_styled_ostream_get_hyperlink_id (term_styled_ostream_t first_arg);
extern void term_styled_ostream_set_hyperlink (term_styled_ostream_t first_arg, const char *ref, const char *id);
extern void term_styled_ostream_flush_to_current_style (term_styled_ostream_t first_arg);
+/* Accessors. */
+extern term_ostream_t term_styled_ostream_get_destination (term_styled_ostream_t stream);
+extern const char *term_styled_ostream_get_css_filename (term_styled_ostream_t stream);
#ifdef __cplusplus
}
#endif
extern const char *html_styled_ostream_get_hyperlink_id (html_styled_ostream_t first_arg);
extern void html_styled_ostream_set_hyperlink (html_styled_ostream_t first_arg, const char *ref, const char *id);
extern void html_styled_ostream_flush_to_current_style (html_styled_ostream_t first_arg);
+/* Accessors. */
+extern ostream_t html_styled_ostream_get_destination (html_styled_ostream_t stream);
+extern html_ostream_t html_styled_ostream_get_html_destination (html_styled_ostream_t stream);
+extern const char *html_styled_ostream_get_css_filename (html_styled_ostream_t stream);
#ifdef __cplusplus
}
#endif
extern const char *noop_styled_ostream_get_hyperlink_id (noop_styled_ostream_t first_arg);
extern void noop_styled_ostream_set_hyperlink (noop_styled_ostream_t first_arg, const char *ref, const char *id);
extern void noop_styled_ostream_flush_to_current_style (noop_styled_ostream_t first_arg);
+/* Accessors. */
+extern ostream_t noop_styled_ostream_get_destination (noop_styled_ostream_t stream);
+extern bool noop_styled_ostream_is_owning_destination (noop_styled_ostream_t stream);
#ifdef __cplusplus
}
#endif
# Ensure that ../lib/config.h is seen before ../config.h.
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/lib -I$(top_builddir)
-TESTS += test-instanceof
-check_PROGRAMS += test-instanceof
-EXTRA_DIST += test-instanceof.c
+TESTS += \
+ test-instanceof \
+ test-accessors
+check_PROGRAMS += \
+ test-instanceof \
+ test-accessors
+EXTRA_DIST += \
+ test-instanceof.c \
+ test-accessors.c
AM_CPPFLAGS += -DSRCDIR=\"$(srcdir)/\"
--- /dev/null
+/* Test for the various accessor functions. */
+
+#include <config.h>
+
+#include "textstyle.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define ASSERT(x) if (!(x)) abort ()
+
+int
+main ()
+{
+ {
+ ostream_t stream = file_ostream_create (stdout);
+
+ ASSERT (file_ostream_get_stdio_stream (stream) == stdout);
+
+ ostream_free (stream);
+ }
+ {
+ ostream_t stream = fd_ostream_create (1, "(stdout)", false);
+
+ ASSERT (fd_ostream_get_descriptor (stream) == 1);
+ ASSERT (strcmp (fd_ostream_get_filename (stream), "(stdout)") == 0);
+ ASSERT (! fd_ostream_is_buffered (stream));
+
+ ostream_free (stream);
+ }
+ {
+ ostream_t stream = term_ostream_create (1, "(stdout)", TTYCTL_AUTO);
+
+ ASSERT (term_ostream_get_descriptor (stream) == 1);
+ ASSERT (strcmp (term_ostream_get_filename (stream), "(stdout)") == 0);
+ ASSERT (term_ostream_get_tty_control (stream) == TTYCTL_AUTO);
+ ASSERT (term_ostream_get_effective_tty_control (stream) == TTYCTL_FULL);
+
+ ostream_free (stream);
+ }
+#if LIBTEXTSTYLE_USES_ICONV
+ {
+ ostream_t stream1 = file_ostream_create (stdout);
+ ostream_t stream = iconv_ostream_create ("ISO-8859-1", "UTF-8", stream1);
+ ASSERT (strcmp (iconv_ostream_get_from_encoding (stream), "ISO-8859-1") == 0);
+ ASSERT (strcmp (iconv_ostream_get_to_encoding (stream), "UTF-8") == 0);
+ ASSERT (iconv_ostream_get_destination (stream) == stream1);
+
+ ostream_free (stream);
+ ostream_free (stream1);
+ }
+#endif
+ {
+ ostream_t stream1 = file_ostream_create (stdout);
+ ostream_t stream = html_ostream_create (stream1);
+
+ ASSERT (html_ostream_get_destination (stream) == stream1);
+
+ ostream_free (stream);
+ ostream_free (stream1);
+ }
+ {
+ ostream_t stream =
+ term_styled_ostream_create (1, "(stdout)", TTYCTL_AUTO,
+ SRCDIR "../adhoc-tests/hello-default.css");
+
+ ASSERT (is_instance_of_term_ostream (term_styled_ostream_get_destination (stream)));
+ ASSERT (strcmp (term_styled_ostream_get_css_filename (stream),
+ SRCDIR "../adhoc-tests/hello-default.css") == 0);
+
+ ostream_free (stream);
+ }
+ {
+ ostream_t stream1 = file_ostream_create (stdout);
+ ostream_t stream =
+ html_styled_ostream_create (stream1,
+ SRCDIR "../adhoc-tests/hello-default.css");
+
+ ASSERT (html_styled_ostream_get_destination (stream) == stream1);
+ ASSERT (is_instance_of_html_ostream (html_styled_ostream_get_html_destination (stream)));
+ ASSERT (strcmp (html_styled_ostream_get_css_filename (stream),
+ SRCDIR "../adhoc-tests/hello-default.css") == 0);
+
+ ostream_free (stream);
+ ostream_free (stream1);
+ }
+ {
+ ostream_t stream1 = file_ostream_create (stdout);
+ ostream_t stream = noop_styled_ostream_create (stream1, false);
+
+ ASSERT (noop_styled_ostream_get_destination (stream) == stream1);
+ ASSERT (!noop_styled_ostream_is_owning_destination (stream));
+
+ ostream_free (stream);
+ ostream_free (stream1);
+ }
+
+ return 0;
+}