Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-05-18 08:30:23

0001 /* Public API of the libtextstyle library.
0002    Copyright (C) 2006-2007, 2019-2021 Free Software Foundation, Inc.
0003 
0004    This program is free software: you can redistribute it and/or modify
0005    it under the terms of the GNU General Public License as published by
0006    the Free Software Foundation; either version 3 of the License, or
0007    (at your option) any later version.
0008 
0009    This program is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012    GNU General Public License for more details.
0013 
0014    You should have received a copy of the GNU General Public License
0015    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
0016 
0017 /* Written by Bruno Haible <bruno@clisp.org>, 2006, 2019.  */
0018 
0019 #ifndef _TEXTSTYLE_H
0020 #define _TEXTSTYLE_H
0021 
0022 #include <stdarg.h>
0023 #include <stddef.h>
0024 #include <stdio.h>
0025 #include <textstyle/stdbool.h>
0026 #include <textstyle/woe32dll.h>
0027 
0028 /* Meta information.  */
0029 #include <textstyle/version.h>
0030 
0031 /* ----------------------------- From ostream.h ----------------------------- */
0032 
0033 /* Describes the scope of a flush operation.  */
0034 typedef enum
0035 {
0036   /* Flushes buffers in this ostream_t.
0037      Use this value if you want to write to the underlying ostream_t.  */
0038   FLUSH_THIS_STREAM = 0,
0039   /* Flushes all buffers in the current process.
0040      Use this value if you want to write to the same target through a
0041      different file descriptor or a FILE stream.  */
0042   FLUSH_THIS_PROCESS = 1,
0043   /* Flushes buffers in the current process and attempts to flush the buffers
0044      in the kernel.
0045      Use this value so that some other process (or the kernel itself)
0046      may write to the same target.  */
0047   FLUSH_ALL = 2
0048 } ostream_flush_scope_t;
0049 
0050 
0051 /* An output stream is an object to which one can feed a sequence of bytes.  */
0052 
0053 struct any_ostream_representation;
0054 typedef struct any_ostream_representation * ostream_t;
0055 
0056 /* Functions that invoke the methods.  */
0057 #ifdef __cplusplus
0058 extern "C" {
0059 #endif
0060 extern void ostream_write_mem (ostream_t first_arg, const void *data, size_t len);
0061 extern void ostream_flush (ostream_t first_arg, ostream_flush_scope_t scope);
0062 extern void ostream_free (ostream_t first_arg);
0063 #ifdef __cplusplus
0064 }
0065 #endif
0066 
0067 #ifdef __cplusplus
0068 extern "C" {
0069 #endif
0070 
0071 /* Write a string's contents to a stream.  */
0072 extern void ostream_write_str (ostream_t stream, const char *string);
0073 
0074 /* Writes formatted output to a stream.
0075    Returns the size of formatted output, or a negative value in case of an
0076    error.  */
0077 extern ptrdiff_t ostream_printf (ostream_t stream, const char *format, ...)
0078 #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3
0079   __attribute__ ((__format__ (__printf__, 2, 3)))
0080 #endif
0081   ;
0082 extern ptrdiff_t ostream_vprintf (ostream_t stream,
0083                                   const char *format, va_list args)
0084 #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3
0085   __attribute__ ((__format__ (__printf__, 2, 0)))
0086 #endif
0087   ;
0088 
0089 #ifdef __cplusplus
0090 }
0091 #endif
0092 
0093 /* ------------------------- From styled-ostream.h ------------------------- */
0094 
0095 /* A styled output stream is an object to which one can feed a sequence of
0096    bytes, marking some runs of text as belonging to specific CSS classes,
0097    where the rendering of the CSS classes is defined through a CSS (cascading
0098    style sheet).  */
0099 
0100 /* styled_ostream_t is a subtype of ostream_t.  */
0101 typedef ostream_t styled_ostream_t;
0102 
0103 /* Functions that invoke the methods.  */
0104 #ifdef __cplusplus
0105 extern "C" {
0106 #endif
0107 extern void styled_ostream_write_mem (styled_ostream_t first_arg, const void *data, size_t len);
0108 extern void styled_ostream_flush (styled_ostream_t first_arg, ostream_flush_scope_t scope);
0109 extern void styled_ostream_free (styled_ostream_t first_arg);
0110 extern void styled_ostream_begin_use_class (styled_ostream_t first_arg, const char *classname);
0111 extern void styled_ostream_end_use_class (styled_ostream_t first_arg, const char *classname);
0112 extern const char *styled_ostream_get_hyperlink_ref (styled_ostream_t first_arg);
0113 extern const char *styled_ostream_get_hyperlink_id (styled_ostream_t first_arg);
0114 extern void styled_ostream_set_hyperlink (styled_ostream_t first_arg, const char *ref, const char *id);
0115 /* Like styled_ostream_flush (first_arg, FLUSH_THIS_STREAM), except that it
0116    leaves the destination with the current text style enabled, instead
0117    of with the default text style.
0118    After calling this function, you can output strings without newlines(!)
0119    to the underlying stream, and they will be rendered like strings passed
0120    to 'ostream_write_mem', 'ostream_write_str', or 'ostream_write_printf'.  */
0121 extern void styled_ostream_flush_to_current_style (styled_ostream_t stream);
0122 #ifdef __cplusplus
0123 }
0124 #endif
0125 
0126 #ifdef __cplusplus
0127 extern "C" {
0128 #endif
0129 
0130 
0131 /* Test whether a given output stream is a styled_ostream.  */
0132 extern bool is_instance_of_styled_ostream (ostream_t stream);
0133 
0134 
0135 #ifdef __cplusplus
0136 }
0137 #endif
0138 
0139 /* -------------------------- From file-ostream.h -------------------------- */
0140 
0141 /* file_ostream_t is a subtype of ostream_t.  */
0142 typedef ostream_t file_ostream_t;
0143 
0144 /* Functions that invoke the methods.  */
0145 #ifdef __cplusplus
0146 extern "C" {
0147 #endif
0148 extern void file_ostream_write_mem (file_ostream_t first_arg, const void *data, size_t len);
0149 extern void file_ostream_flush (file_ostream_t first_arg, ostream_flush_scope_t scope);
0150 extern void file_ostream_free (file_ostream_t first_arg);
0151 /* Accessors.  */
0152 extern FILE *file_ostream_get_stdio_stream (file_ostream_t stream);
0153 #ifdef __cplusplus
0154 }
0155 #endif
0156 
0157 #ifdef __cplusplus
0158 extern "C" {
0159 #endif
0160 
0161 
0162 /* Create an output stream referring to FP.
0163    Note that the resulting stream must be closed before FP can be closed.  */
0164 extern file_ostream_t file_ostream_create (FILE *fp);
0165 
0166 
0167 /* Test whether a given output stream is a file_ostream.  */
0168 extern bool is_instance_of_file_ostream (ostream_t stream);
0169 
0170 
0171 #ifdef __cplusplus
0172 }
0173 #endif
0174 
0175 /* --------------------------- From fd-ostream.h --------------------------- */
0176 
0177 /* fd_ostream_t is a subtype of ostream_t.  */
0178 typedef ostream_t fd_ostream_t;
0179 
0180 /* Functions that invoke the methods.  */
0181 #ifdef __cplusplus
0182 extern "C" {
0183 #endif
0184 extern void fd_ostream_write_mem (fd_ostream_t first_arg, const void *data, size_t len);
0185 extern void fd_ostream_flush (fd_ostream_t first_arg, ostream_flush_scope_t scope);
0186 extern void fd_ostream_free (fd_ostream_t first_arg);
0187 /* Accessors.  */
0188 extern int fd_ostream_get_descriptor (fd_ostream_t stream);
0189 extern const char *fd_ostream_get_filename (fd_ostream_t stream);
0190 extern bool fd_ostream_is_buffered (fd_ostream_t stream);
0191 #ifdef __cplusplus
0192 }
0193 #endif
0194 
0195 #ifdef __cplusplus
0196 extern "C" {
0197 #endif
0198 
0199 
0200 /* Create an output stream referring to the file descriptor FD.
0201    FILENAME is used only for error messages.
0202    Note that the resulting stream must be closed before FD can be closed.  */
0203 extern fd_ostream_t fd_ostream_create (int fd, const char *filename,
0204                                        bool buffered);
0205 
0206 
0207 /* Test whether a given output stream is a fd_ostream.  */
0208 extern bool is_instance_of_fd_ostream (ostream_t stream);
0209 
0210 
0211 #ifdef __cplusplus
0212 }
0213 #endif
0214 
0215 /* -------------------------- From term-ostream.h -------------------------- */
0216 
0217 /* Querying and setting of text attributes.
0218    The stream has a notion of the current text attributes; they apply
0219    implicitly to all following output.  The attributes are automatically
0220    reset when the stream is closed.
0221    Note: Not all terminal types can actually render all attributes adequately.
0222    For example, xterm cannot render POSTURE_ITALIC nor the combination of
0223    WEIGHT_BOLD and UNDERLINE_ON.  */
0224 
0225 /* Colors are represented by indices >= 0 in a stream dependent format.  */
0226 typedef int term_color_t;
0227 /* The value -1 denotes the default (foreground or background) color.  */
0228 enum
0229 {
0230   COLOR_DEFAULT = -1  /* unknown */
0231 };
0232 
0233 typedef enum
0234 {
0235   WEIGHT_NORMAL = 0,
0236   WEIGHT_BOLD,
0237   WEIGHT_DEFAULT = WEIGHT_NORMAL
0238 } term_weight_t;
0239 
0240 typedef enum
0241 {
0242   POSTURE_NORMAL = 0,
0243   POSTURE_ITALIC, /* same as oblique */
0244   POSTURE_DEFAULT = POSTURE_NORMAL
0245 } term_posture_t;
0246 
0247 typedef enum
0248 {
0249   UNDERLINE_OFF = 0,
0250   UNDERLINE_ON,
0251   UNDERLINE_DEFAULT = UNDERLINE_OFF
0252 } term_underline_t;
0253 
0254 /* The amount of control to take over the underlying tty in order to avoid
0255    garbled output on the screen, due to interleaved output of escape sequences
0256    and output from the kernel (such as when the kernel echoes user's input
0257    or when the kernel prints '^C' after the user pressed Ctrl-C).  */
0258 typedef enum
0259 {
0260   TTYCTL_AUTO = 0,  /* Automatic best-possible choice.  */
0261   TTYCTL_NONE,      /* No control.
0262                        Result: Garbled output can occur, and the terminal can
0263                        be left in any state when the program is interrupted.  */
0264   TTYCTL_PARTIAL,   /* Signal handling.
0265                        Result: Garbled output can occur, but the terminal will
0266                        be left in the default state when the program is
0267                        interrupted.  */
0268   TTYCTL_FULL       /* Signal handling and disabling echo and flush-upon-signal.
0269                        Result: No garbled output, and the the terminal will
0270                        be left in the default state when the program is
0271                        interrupted.  */
0272 } ttyctl_t;
0273 
0274 /* term_ostream_t is a subtype of ostream_t.  */
0275 typedef ostream_t term_ostream_t;
0276 
0277 /* Functions that invoke the methods.  */
0278 #ifdef __cplusplus
0279 extern "C" {
0280 #endif
0281 extern void term_ostream_write_mem (term_ostream_t first_arg, const void *data, size_t len);
0282 extern void term_ostream_flush (term_ostream_t first_arg, ostream_flush_scope_t scope);
0283 extern void term_ostream_free (term_ostream_t first_arg);
0284 extern term_color_t term_ostream_rgb_to_color (term_ostream_t first_arg, int red, int green, int blue);
0285 extern term_color_t term_ostream_get_color (term_ostream_t first_arg);
0286 extern void term_ostream_set_color (term_ostream_t first_arg, term_color_t color);
0287 extern term_color_t term_ostream_get_bgcolor (term_ostream_t first_arg);
0288 extern void term_ostream_set_bgcolor (term_ostream_t first_arg, term_color_t color);
0289 extern term_weight_t term_ostream_get_weight (term_ostream_t first_arg);
0290 extern void term_ostream_set_weight (term_ostream_t first_arg, term_weight_t weight);
0291 extern term_posture_t term_ostream_get_posture (term_ostream_t first_arg);
0292 extern void term_ostream_set_posture (term_ostream_t first_arg, term_posture_t posture);
0293 extern term_underline_t term_ostream_get_underline (term_ostream_t first_arg);
0294 extern void term_ostream_set_underline (term_ostream_t first_arg, term_underline_t underline);
0295 extern const char *term_ostream_get_hyperlink_ref (term_ostream_t first_arg);
0296 extern const char *term_ostream_get_hyperlink_id (term_ostream_t first_arg);
0297 extern void term_ostream_set_hyperlink (term_ostream_t first_arg, const char *ref, const char *id);
0298 /* Like term_ostream_flush (first_arg, FLUSH_THIS_STREAM), except that it
0299    leaves the terminal with the current text attributes enabled, instead of
0300    with the default text attributes.
0301    After calling this function, you can output strings without newlines(!)
0302    to the underlying file descriptor, and they will be rendered like strings
0303    passed to 'ostream_write_mem', 'ostream_write_str', or
0304    'ostream_write_printf'.  */
0305 extern void term_ostream_flush_to_current_style (term_ostream_t first_arg);
0306 /* Accessors.  */
0307 extern int term_ostream_get_descriptor (term_ostream_t stream);
0308 extern const char *term_ostream_get_filename (term_ostream_t stream);
0309 extern ttyctl_t term_ostream_get_tty_control (term_ostream_t stream);
0310 extern ttyctl_t term_ostream_get_effective_tty_control (term_ostream_t stream);
0311 #ifdef __cplusplus
0312 }
0313 #endif
0314 
0315 #ifdef __cplusplus
0316 extern "C" {
0317 #endif
0318 
0319 
0320 /* Create an output stream referring to the file descriptor FD.
0321    FILENAME is used only for error messages.
0322    TTY_CONTROL specifies the amount of control to take over the underlying tty.
0323    The resulting stream will be line-buffered.
0324    Note that the resulting stream must be closed before FD can be closed.  */
0325 extern term_ostream_t
0326        term_ostream_create (int fd, const char *filename, ttyctl_t tty_control);
0327 
0328 
0329 /* Test whether a given output stream is a term_ostream.  */
0330 extern bool is_instance_of_term_ostream (ostream_t stream);
0331 
0332 
0333 #ifdef __cplusplus
0334 }
0335 #endif
0336 
0337 /* ------------------------- From memory-ostream.h ------------------------- */
0338 
0339 /* memory_ostream_t is a subtype of ostream_t.  */
0340 typedef ostream_t memory_ostream_t;
0341 
0342 /* Functions that invoke the methods.  */
0343 #ifdef __cplusplus
0344 extern "C" {
0345 #endif
0346 extern void memory_ostream_write_mem (memory_ostream_t first_arg, const void *data, size_t len);
0347 extern void memory_ostream_flush (memory_ostream_t first_arg, ostream_flush_scope_t scope);
0348 extern void memory_ostream_free (memory_ostream_t first_arg);
0349 extern void memory_ostream_contents (memory_ostream_t first_arg, const void **bufp, size_t *buflenp);
0350 #ifdef __cplusplus
0351 }
0352 #endif
0353 
0354 #ifdef __cplusplus
0355 extern "C" {
0356 #endif
0357 
0358 
0359 /* Create an output stream that accumulates the output in a memory buffer.  */
0360 extern memory_ostream_t memory_ostream_create (void);
0361 
0362 
0363 /* Test whether a given output stream is a memory_ostream.  */
0364 extern bool is_instance_of_memory_ostream (ostream_t stream);
0365 
0366 
0367 #ifdef __cplusplus
0368 }
0369 #endif
0370 
0371 /* -------------------------- From iconv-ostream.h -------------------------- */
0372 
0373 #if LIBTEXTSTYLE_USES_ICONV
0374 
0375 /* iconv_ostream_t is a subtype of ostream_t.  */
0376 typedef ostream_t iconv_ostream_t;
0377 
0378 /* Functions that invoke the methods.  */
0379 #ifdef __cplusplus
0380 extern "C" {
0381 #endif
0382 extern void iconv_ostream_write_mem (iconv_ostream_t first_arg, const void *data, size_t len);
0383 extern void iconv_ostream_flush (iconv_ostream_t first_arg, ostream_flush_scope_t scope);
0384 extern void iconv_ostream_free (iconv_ostream_t first_arg);
0385 /* Accessors.  */
0386 extern const char *iconv_ostream_get_from_encoding (iconv_ostream_t stream);
0387 extern const char *iconv_ostream_get_to_encoding (iconv_ostream_t stream);
0388 extern ostream_t iconv_ostream_get_destination (iconv_ostream_t stream);
0389 #ifdef __cplusplus
0390 }
0391 #endif
0392 
0393 #ifdef __cplusplus
0394 extern "C" {
0395 #endif
0396 
0397 
0398 /* Create an output stream that converts from FROM_ENCODING to TO_ENCODING,
0399    writing the result to DESTINATION.  */
0400 extern iconv_ostream_t iconv_ostream_create (const char *from_encoding,
0401                                              const char *to_encoding,
0402                                              ostream_t destination);
0403 
0404 
0405 /* Test whether a given output stream is an iconv_ostream.  */
0406 extern bool is_instance_of_iconv_ostream (ostream_t stream);
0407 
0408 
0409 #ifdef __cplusplus
0410 }
0411 #endif
0412 
0413 #endif /* LIBTEXTSTYLE_USES_ICONV */
0414 
0415 /* -------------------------- From html-ostream.h -------------------------- */
0416 
0417 /* html_ostream_t is a subtype of ostream_t.  */
0418 typedef ostream_t html_ostream_t;
0419 
0420 /* Functions that invoke the methods.  */
0421 #ifdef __cplusplus
0422 extern "C" {
0423 #endif
0424 extern void html_ostream_write_mem (html_ostream_t first_arg, const void *data, size_t len);
0425 extern void html_ostream_flush (html_ostream_t first_arg, ostream_flush_scope_t scope);
0426 extern void html_ostream_free (html_ostream_t first_arg);
0427 extern void html_ostream_begin_span (html_ostream_t first_arg, const char *classname);
0428 extern void html_ostream_end_span (html_ostream_t first_arg, const char *classname);
0429 extern const char *html_ostream_get_hyperlink_ref (html_ostream_t first_arg);
0430 extern void html_ostream_set_hyperlink_ref (html_ostream_t first_arg, const char *ref);
0431 /* Like html_ostream_flush (first_arg, FLUSH_THIS_STREAM), except that it
0432    leaves the destination with the current text style enabled, instead
0433    of with the default text style.
0434    After calling this function, you can output strings without newlines(!)
0435    to the underlying stream, and they will be rendered like strings passed
0436    to 'ostream_write_mem', 'ostream_write_str', or 'ostream_write_printf'.  */
0437 extern void html_ostream_flush_to_current_style (html_ostream_t stream);
0438 /* Accessors.  */
0439 extern ostream_t html_ostream_get_destination (html_ostream_t stream);
0440 #ifdef __cplusplus
0441 }
0442 #endif
0443 
0444 #ifdef __cplusplus
0445 extern "C" {
0446 #endif
0447 
0448 
0449 /* Create an output stream that takes input in the UTF-8 encoding and
0450    writes it in HTML form on DESTINATION.
0451    This stream produces a sequence of lines.  The caller is responsible
0452    for opening the <body><html> elements before and for closing them after
0453    the use of this stream.
0454    Note that the resulting stream must be closed before DESTINATION can be
0455    closed.  */
0456 extern html_ostream_t html_ostream_create (ostream_t destination);
0457 
0458 
0459 /* Test whether a given output stream is a html_ostream.  */
0460 extern bool is_instance_of_html_ostream (ostream_t stream);
0461 
0462 
0463 #ifdef __cplusplus
0464 }
0465 #endif
0466 
0467 /* ----------------------- From term-styled-ostream.h ----------------------- */
0468 
0469 /* term_styled_ostream_t is a subtype of styled_ostream_t.  */
0470 typedef styled_ostream_t term_styled_ostream_t;
0471 
0472 /* Functions that invoke the methods.  */
0473 #ifdef __cplusplus
0474 extern "C" {
0475 #endif
0476 extern void term_styled_ostream_write_mem (term_styled_ostream_t first_arg, const void *data, size_t len);
0477 extern void term_styled_ostream_flush (term_styled_ostream_t first_arg, ostream_flush_scope_t scope);
0478 extern void term_styled_ostream_free (term_styled_ostream_t first_arg);
0479 extern void term_styled_ostream_begin_use_class (term_styled_ostream_t first_arg, const char *classname);
0480 extern void term_styled_ostream_end_use_class (term_styled_ostream_t first_arg, const char *classname);
0481 extern const char *term_styled_ostream_get_hyperlink_ref (term_styled_ostream_t first_arg);
0482 extern const char *term_styled_ostream_get_hyperlink_id (term_styled_ostream_t first_arg);
0483 extern void term_styled_ostream_set_hyperlink (term_styled_ostream_t first_arg, const char *ref, const char *id);
0484 extern void term_styled_ostream_flush_to_current_style (term_styled_ostream_t first_arg);
0485 /* Accessors.  */
0486 extern term_ostream_t term_styled_ostream_get_destination (term_styled_ostream_t stream);
0487 extern const char *term_styled_ostream_get_css_filename (term_styled_ostream_t stream);
0488 #ifdef __cplusplus
0489 }
0490 #endif
0491 
0492 #ifdef __cplusplus
0493 extern "C" {
0494 #endif
0495 
0496 
0497 /* Create an output stream referring to the file descriptor FD, styled with
0498    the file CSS_FILENAME.
0499    FILENAME is used only for error messages.
0500    TTY_CONTROL specifies the amount of control to take over the underlying tty.
0501    Note that the resulting stream must be closed before FD can be closed.
0502    Return NULL upon failure.  */
0503 extern term_styled_ostream_t
0504        term_styled_ostream_create (int fd, const char *filename,
0505                                    ttyctl_t tty_control,
0506                                    const char *css_filename);
0507 
0508 
0509 /* Test whether a given output stream is a term_styled_ostream.  */
0510 extern bool is_instance_of_term_styled_ostream (ostream_t stream);
0511 
0512 
0513 #ifdef __cplusplus
0514 }
0515 #endif
0516 
0517 /* ----------------------- From html-styled-ostream.h ----------------------- */
0518 
0519 /* html_styled_ostream_t is a subtype of styled_ostream_t.  */
0520 typedef styled_ostream_t html_styled_ostream_t;
0521 
0522 /* Functions that invoke the methods.  */
0523 #ifdef __cplusplus
0524 extern "C" {
0525 #endif
0526 extern void html_styled_ostream_write_mem (html_styled_ostream_t first_arg, const void *data, size_t len);
0527 extern void html_styled_ostream_flush (html_styled_ostream_t first_arg, ostream_flush_scope_t scope);
0528 extern void html_styled_ostream_free (html_styled_ostream_t first_arg);
0529 extern void html_styled_ostream_begin_use_class (html_styled_ostream_t first_arg, const char *classname);
0530 extern void html_styled_ostream_end_use_class (html_styled_ostream_t first_arg, const char *classname);
0531 extern const char *html_styled_ostream_get_hyperlink_ref (html_styled_ostream_t first_arg);
0532 extern const char *html_styled_ostream_get_hyperlink_id (html_styled_ostream_t first_arg);
0533 extern void html_styled_ostream_set_hyperlink (html_styled_ostream_t first_arg, const char *ref, const char *id);
0534 extern void html_styled_ostream_flush_to_current_style (html_styled_ostream_t first_arg);
0535 /* Accessors.  */
0536 extern ostream_t html_styled_ostream_get_destination (html_styled_ostream_t stream);
0537 extern html_ostream_t html_styled_ostream_get_html_destination (html_styled_ostream_t stream);
0538 extern const char *html_styled_ostream_get_css_filename (html_styled_ostream_t stream);
0539 #ifdef __cplusplus
0540 }
0541 #endif
0542 
0543 #ifdef __cplusplus
0544 extern "C" {
0545 #endif
0546 
0547 
0548 /* Create an output stream that takes input in the UTF-8 encoding and
0549    writes it in HTML form on DESTINATION, styled with the file CSS_FILENAME.
0550    Note that the resulting stream must be closed before DESTINATION can be
0551    closed.  */
0552 extern html_styled_ostream_t
0553        html_styled_ostream_create (ostream_t destination,
0554                                    const char *css_filename);
0555 
0556 
0557 /* Test whether a given output stream is a html_styled_ostream.  */
0558 extern bool is_instance_of_html_styled_ostream (ostream_t stream);
0559 
0560 
0561 #ifdef __cplusplus
0562 }
0563 #endif
0564 
0565 /* ----------------------- From noop-styled-ostream.h ----------------------- */
0566 
0567 /* noop_styled_ostream_t is a subtype of styled_ostream_t.  */
0568 typedef styled_ostream_t noop_styled_ostream_t;
0569 
0570 /* Functions that invoke the methods.  */
0571 #ifdef __cplusplus
0572 extern "C" {
0573 #endif
0574 extern void noop_styled_ostream_write_mem (noop_styled_ostream_t first_arg, const void *data, size_t len);
0575 extern void noop_styled_ostream_flush (noop_styled_ostream_t first_arg, ostream_flush_scope_t scope);
0576 extern void noop_styled_ostream_free (noop_styled_ostream_t first_arg);
0577 extern void noop_styled_ostream_begin_use_class (noop_styled_ostream_t first_arg, const char *classname);
0578 extern void noop_styled_ostream_end_use_class (noop_styled_ostream_t first_arg, const char *classname);
0579 extern const char *noop_styled_ostream_get_hyperlink_ref (noop_styled_ostream_t first_arg);
0580 extern const char *noop_styled_ostream_get_hyperlink_id (noop_styled_ostream_t first_arg);
0581 extern void noop_styled_ostream_set_hyperlink (noop_styled_ostream_t first_arg, const char *ref, const char *id);
0582 extern void noop_styled_ostream_flush_to_current_style (noop_styled_ostream_t first_arg);
0583 /* Accessors.  */
0584 extern ostream_t noop_styled_ostream_get_destination (noop_styled_ostream_t stream);
0585 extern bool noop_styled_ostream_is_owning_destination (noop_styled_ostream_t stream);
0586 #ifdef __cplusplus
0587 }
0588 #endif
0589 
0590 #ifdef __cplusplus
0591 extern "C" {
0592 #endif
0593 
0594 
0595 /* Create an output stream that delegates to DESTINATION and that supports
0596    the styling operations as no-ops.
0597    If PASS_OWNERSHIP is true, closing the resulting stream will automatically
0598    close the DESTINATION.
0599    Note that if PASS_OWNERSHIP is false, the resulting stream must be closed
0600    before DESTINATION can be closed.  */
0601 extern noop_styled_ostream_t
0602        noop_styled_ostream_create (ostream_t destination, bool pass_ownership);
0603 
0604 
0605 /* Test whether a given output stream is a noop_styled_ostream.  */
0606 extern bool is_instance_of_noop_styled_ostream (ostream_t stream);
0607 
0608 
0609 #ifdef __cplusplus
0610 }
0611 #endif
0612 
0613 /* ------------------------------ From color.h ------------------------------ */
0614 
0615 #ifdef __cplusplus
0616 extern "C" {
0617 #endif
0618 
0619 
0620 /* Whether to output a test page.  */
0621 extern LIBTEXTSTYLE_DLL_VARIABLE bool color_test_mode;
0622 
0623 /* Color option.  */
0624 enum color_option { color_no, color_tty, color_yes, color_html };
0625 extern LIBTEXTSTYLE_DLL_VARIABLE enum color_option color_mode;
0626 
0627 /* Style to use when coloring.  */
0628 extern LIBTEXTSTYLE_DLL_VARIABLE const char *style_file_name;
0629 
0630 /* --color argument handling.  Return an error indicator.  */
0631 extern bool handle_color_option (const char *option);
0632 
0633 /* --style argument handling.  */
0634 extern void handle_style_option (const char *option);
0635 
0636 /* Print a color test page.  */
0637 extern void print_color_test (void);
0638 
0639 /* Assign a default value to style_file_name if necessary.
0640    STYLE_FILE_ENVVAR is an environment variable that, when set to a non-empty
0641    value, specifies the style file to use.  This environment variable is meant
0642    to be set by the user.
0643    STYLESDIR_ENVVAR is an environment variable that, when set to a non-empty
0644    value, specifies the directory with the style files, or NULL.  This is
0645    necessary for running the testsuite before "make install".
0646    STYLESDIR_AFTER_INSTALL is the directory with the style files after
0647    "make install".
0648    DEFAULT_STYLE_FILE is the file name of the default style file, relative to
0649    STYLESDIR.  */
0650 extern void style_file_prepare (const char *style_file_envvar,
0651                                 const char *stylesdir_envvar,
0652                                 const char *stylesdir_after_install,
0653                                 const char *default_style_file);
0654 
0655 
0656 #ifdef __cplusplus
0657 }
0658 #endif
0659 
0660 /* ------------------------------ From misc.h ------------------------------ */
0661 
0662 #ifdef __cplusplus
0663 extern "C" {
0664 #endif
0665 
0666 /* Create an output stream referring to the file descriptor FD, styled with
0667    the file CSS_FILENAME if possible.
0668    FILENAME is used only for error messages.
0669    TTY_CONTROL specifies the amount of control to take over the underlying tty.
0670    Note that the resulting stream must be closed before FD can be closed.  */
0671 extern styled_ostream_t
0672        styled_ostream_create (int fd, const char *filename,
0673                               ttyctl_t tty_control,
0674                               const char *css_filename);
0675 
0676 /* Set the exit value upon failure within libtextstyle.  */
0677 extern void libtextstyle_set_failure_exit_code (int exit_code);
0678 
0679 #ifdef __cplusplus
0680 }
0681 #endif
0682 
0683 /* ----------------------- Exported gnulib overrides ----------------------- */
0684 
0685 #if defined _WIN32 && ! defined __CYGWIN__
0686 
0687 # include <io.h>
0688 
0689 # ifdef __cplusplus
0690 extern "C" {
0691 # endif
0692 
0693 # if !((defined isatty && defined _GL_UNISTD_H) || defined GNULIB_overrides_isatty) /* don't override gnulib */
0694 extern int libtextstyle_isatty (int fd);
0695 #  undef isatty
0696 #  define isatty libtextstyle_isatty
0697 # endif
0698 
0699 # ifdef __cplusplus
0700 }
0701 # endif
0702 
0703 #endif
0704 
0705 /* ------------------------------------------------------------------------- */
0706 
0707 #endif /* _TEXTSTYLE_H */