(root)/
gettext-0.22.4/
gettext-tools/
libgettextpo/
textstyle.in.h
       1  /* Dummy replacement for part of the public API of the libtextstyle library.
       2     Copyright (C) 2006-2007, 2019-2023 Free Software Foundation, Inc.
       3  
       4     This program is free software: you can redistribute it and/or modify
       5     it under the terms of the GNU General Public License as published by
       6     the Free Software Foundation, either version 3 of the License, or
       7     (at your option) any later version.
       8  
       9     This program is distributed in the hope that it will be useful,
      10     but WITHOUT ANY WARRANTY; without even the implied warranty of
      11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12     GNU General Public License for more details.
      13  
      14     You should have received a copy of the GNU General Public License
      15     along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
      16  
      17  /* Written by Bruno Haible <bruno@clisp.org>, 2019.  */
      18  
      19  /* This file is used as replacement when libtextstyle with its include file
      20     <textstyle.h> is not found.
      21     It supports the essential API and implements it in a way that does not
      22     provide text styling.  That is, it produces plain text output via <stdio.h>
      23     FILE objects.
      24     Thus, it allows a package to be build with or without a dependency to
      25     libtextstyle, with very few occurrences of '#if HAVE_LIBTEXTSTYLE'.
      26  
      27     Restriction:
      28     It assumes that freopen() is not being called on stdout and stderr.  */
      29  
      30  #ifndef _TEXTSTYLE_H
      31  #define _TEXTSTYLE_H
      32  
      33  /* This file uses _GL_ATTRIBUTE_MAYBE_UNUSED, HAVE_TCDRAIN.  */
      34  #if !_GL_CONFIG_H_INCLUDED
      35   #error "Please include config.h first."
      36  #endif
      37  
      38  #include <errno.h>
      39  #include <stdarg.h>
      40  #include <stddef.h>
      41  #include <stdio.h>
      42  #include <stdlib.h>
      43  #include <string.h>
      44  #include <unistd.h>
      45  #if HAVE_TCDRAIN
      46  # include <termios.h>
      47  #endif
      48  
      49  /* An __attribute__ __format__ specifier for a function that takes a format
      50     string and arguments, where the format string directives are the ones
      51     standardized by ISO C99 and POSIX.
      52     _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD  */
      53  /* __gnu_printf__ is supported in GCC >= 4.4.  */
      54  #ifndef _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD
      55  # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
      56  #  define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__
      57  # else
      58  #  define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__
      59  # endif
      60  #endif
      61  
      62  /* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if
      63     the entity is not used.  The compiler should not warn if the entity is not
      64     used.  */
      65  #ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
      66  # if 0 /* no GCC or clang version supports this yet */
      67  #  define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
      68  # elif defined __GNUC__ || defined __clang__
      69  #  define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__))
      70  # else
      71  #  define _GL_ATTRIBUTE_MAYBE_UNUSED
      72  # endif
      73  #endif
      74  
      75  /* ----------------------------- From ostream.h ----------------------------- */
      76  
      77  /* Describes the scope of a flush operation.  */
      78  typedef enum
      79  {
      80    /* Flushes buffers in this ostream_t.
      81       Use this value if you want to write to the underlying ostream_t.  */
      82    FLUSH_THIS_STREAM = 0,
      83    /* Flushes all buffers in the current process.
      84       Use this value if you want to write to the same target through a
      85       different file descriptor or a FILE stream.  */
      86    FLUSH_THIS_PROCESS = 1,
      87    /* Flushes buffers in the current process and attempts to flush the buffers
      88       in the kernel.
      89       Use this value so that some other process (or the kernel itself)
      90       may write to the same target.  */
      91    FLUSH_ALL = 2
      92  } ostream_flush_scope_t;
      93  
      94  
      95  /* An output stream is an object to which one can feed a sequence of bytes.  */
      96  
      97  typedef FILE * ostream_t;
      98  
      99  static inline void
     100  ostream_write_mem (ostream_t stream, const void *data, size_t len)
     101  {
     102    if (len > 0)
     103      fwrite (data, 1, len, stream);
     104  }
     105  
     106  static inline void
     107  ostream_flush (ostream_t stream, ostream_flush_scope_t scope)
     108  {
     109    fflush (stream);
     110    if (scope == FLUSH_ALL)
     111      {
     112        int fd = fileno (stream);
     113        if (fd >= 0)
     114          {
     115            /* For streams connected to a disk file:  */
     116            fsync (fd);
     117            #if HAVE_TCDRAIN
     118            /* For streams connected to a terminal:  */
     119            {
     120              int retval;
     121  
     122              do
     123                retval = tcdrain (fd);
     124              while (retval < 0 && errno == EINTR);
     125            }
     126            #endif
     127          }
     128      }
     129  }
     130  
     131  static inline void
     132  ostream_free (ostream_t stream)
     133  {
     134    if (stream == stdin || stream == stderr)
     135      fflush (stream);
     136    else
     137      fclose (stream);
     138  }
     139  
     140  static inline void
     141  ostream_write_str (ostream_t stream, const char *string)
     142  {
     143    ostream_write_mem (stream, string, strlen (string));
     144  }
     145  
     146  static inline ptrdiff_t ostream_printf (ostream_t stream,
     147                                          const char *format, ...)
     148  #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || defined __clang__
     149    __attribute__ ((__format__ (_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 2, 3)))
     150  #endif
     151    ;
     152  static inline ptrdiff_t
     153  ostream_printf (ostream_t stream, const char *format, ...)
     154  {
     155    va_list args;
     156    char *temp_string;
     157    ptrdiff_t ret;
     158  
     159    va_start (args, format);
     160    ret = vasprintf (&temp_string, format, args);
     161    va_end (args);
     162    if (ret >= 0)
     163      {
     164        if (ret > 0)
     165          ostream_write_str (stream, temp_string);
     166        free (temp_string);
     167      }
     168    return ret;
     169  }
     170  
     171  static inline ptrdiff_t ostream_vprintf (ostream_t stream,
     172                                           const char *format, va_list args)
     173  #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || defined __clang__
     174    __attribute__ ((__format__ (_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 2, 0)))
     175  #endif
     176    ;
     177  static inline ptrdiff_t
     178  ostream_vprintf (ostream_t stream, const char *format, va_list args)
     179  {
     180    char *temp_string;
     181    ptrdiff_t ret = vasprintf (&temp_string, format, args);
     182    if (ret >= 0)
     183      {
     184        if (ret > 0)
     185          ostream_write_str (stream, temp_string);
     186        free (temp_string);
     187      }
     188    return ret;
     189  }
     190  
     191  /* ------------------------- From styled-ostream.h ------------------------- */
     192  
     193  typedef ostream_t styled_ostream_t;
     194  
     195  #define styled_ostream_write_mem ostream_write_mem
     196  #define styled_ostream_flush ostream_flush
     197  #define styled_ostream_free ostream_free
     198  
     199  static inline void
     200  styled_ostream_begin_use_class (_GL_ATTRIBUTE_MAYBE_UNUSED styled_ostream_t stream,
     201                                  _GL_ATTRIBUTE_MAYBE_UNUSED const char *classname)
     202  {
     203  }
     204  
     205  static inline void
     206  styled_ostream_end_use_class (_GL_ATTRIBUTE_MAYBE_UNUSED styled_ostream_t stream,
     207                                _GL_ATTRIBUTE_MAYBE_UNUSED const char *classname)
     208  {
     209  }
     210  
     211  static inline const char *
     212  styled_ostream_get_hyperlink_ref (_GL_ATTRIBUTE_MAYBE_UNUSED styled_ostream_t stream)
     213  {
     214    return NULL;
     215  }
     216  
     217  static inline const char *
     218  styled_ostream_get_hyperlink_id (_GL_ATTRIBUTE_MAYBE_UNUSED styled_ostream_t stream)
     219  {
     220    return NULL;
     221  }
     222  
     223  static inline void
     224  styled_ostream_set_hyperlink (_GL_ATTRIBUTE_MAYBE_UNUSED styled_ostream_t stream,
     225                                _GL_ATTRIBUTE_MAYBE_UNUSED const char *ref,
     226                                _GL_ATTRIBUTE_MAYBE_UNUSED const char *id)
     227  {
     228  }
     229  
     230  static inline void
     231  styled_ostream_flush_to_current_style (_GL_ATTRIBUTE_MAYBE_UNUSED styled_ostream_t stream)
     232  {
     233  }
     234  
     235  static inline bool
     236  is_instance_of_styled_ostream (_GL_ATTRIBUTE_MAYBE_UNUSED ostream_t stream)
     237  {
     238    return false;
     239  }
     240  
     241  /* -------------------------- From file-ostream.h -------------------------- */
     242  
     243  typedef ostream_t file_ostream_t;
     244  
     245  #define file_ostream_write_mem ostream_write_mem
     246  #define file_ostream_flush ostream_flush
     247  #define file_ostream_free ostream_free
     248  
     249  static inline FILE *
     250  file_ostream_get_stdio_stream (file_ostream_t stream)
     251  {
     252    return stream;
     253  }
     254  
     255  static inline file_ostream_t
     256  file_ostream_create (FILE *fp)
     257  {
     258    return fp;
     259  }
     260  
     261  static inline bool
     262  is_instance_of_file_ostream (_GL_ATTRIBUTE_MAYBE_UNUSED ostream_t stream)
     263  {
     264    return true;
     265  }
     266  
     267  /* --------------------------- From fd-ostream.h --------------------------- */
     268  
     269  typedef ostream_t fd_ostream_t;
     270  
     271  #define fd_ostream_write_mem ostream_write_mem
     272  #define fd_ostream_flush ostream_flush
     273  #define fd_ostream_free ostream_free
     274  
     275  static inline int
     276  fd_ostream_get_descriptor (fd_ostream_t stream)
     277  {
     278    return fileno (stream);
     279  }
     280  
     281  static inline const char *
     282  fd_ostream_get_filename (_GL_ATTRIBUTE_MAYBE_UNUSED fd_ostream_t stream)
     283  {
     284    return NULL;
     285  }
     286  
     287  static inline bool
     288  fd_ostream_is_buffered (_GL_ATTRIBUTE_MAYBE_UNUSED fd_ostream_t stream)
     289  {
     290    return false;
     291  }
     292  
     293  static inline fd_ostream_t
     294  fd_ostream_create (int fd, _GL_ATTRIBUTE_MAYBE_UNUSED const char *filename,
     295                     _GL_ATTRIBUTE_MAYBE_UNUSED bool buffered)
     296  {
     297    if (fd == 1)
     298      return stdout;
     299    else if (fd == 2)
     300      return stderr;
     301    else
     302      return fdopen (fd, "w");
     303  }
     304  
     305  static inline bool
     306  is_instance_of_fd_ostream (ostream_t stream)
     307  {
     308    return fileno (stream) >= 0;
     309  }
     310  
     311  /* -------------------------- From term-ostream.h -------------------------- */
     312  
     313  typedef int term_color_t;
     314  enum
     315  {
     316    COLOR_DEFAULT = -1  /* unknown */
     317  };
     318  
     319  typedef enum
     320  {
     321    WEIGHT_NORMAL = 0,
     322    WEIGHT_BOLD,
     323    WEIGHT_DEFAULT = WEIGHT_NORMAL
     324  } term_weight_t;
     325  
     326  typedef enum
     327  {
     328    POSTURE_NORMAL = 0,
     329    POSTURE_ITALIC, /* same as oblique */
     330    POSTURE_DEFAULT = POSTURE_NORMAL
     331  } term_posture_t;
     332  
     333  typedef enum
     334  {
     335    UNDERLINE_OFF = 0,
     336    UNDERLINE_ON,
     337    UNDERLINE_DEFAULT = UNDERLINE_OFF
     338  } term_underline_t;
     339  
     340  typedef enum
     341  {
     342    TTYCTL_AUTO = 0,  /* Automatic best-possible choice.  */
     343    TTYCTL_NONE,      /* No control.
     344                         Result: Garbled output can occur, and the terminal can
     345                         be left in any state when the program is interrupted.  */
     346    TTYCTL_PARTIAL,   /* Signal handling.
     347                         Result: Garbled output can occur, but the terminal will
     348                         be left in the default state when the program is
     349                         interrupted.  */
     350    TTYCTL_FULL       /* Signal handling and disabling echo and flush-upon-signal.
     351                         Result: No garbled output, and the terminal will
     352                         be left in the default state when the program is
     353                         interrupted.  */
     354  } ttyctl_t;
     355  
     356  typedef ostream_t term_ostream_t;
     357  
     358  #define term_ostream_write_mem ostream_write_mem
     359  #define term_ostream_flush ostream_flush
     360  #define term_ostream_free ostream_free
     361  
     362  static inline term_color_t
     363  term_ostream_rgb_to_color (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream,
     364                             _GL_ATTRIBUTE_MAYBE_UNUSED int red,
     365                             _GL_ATTRIBUTE_MAYBE_UNUSED int green,
     366                             _GL_ATTRIBUTE_MAYBE_UNUSED int blue)
     367  {
     368    return COLOR_DEFAULT;
     369  }
     370  
     371  static inline term_color_t
     372  term_ostream_get_color (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream)
     373  {
     374    return COLOR_DEFAULT;
     375  }
     376  
     377  static inline void
     378  term_ostream_set_color (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream,
     379                          _GL_ATTRIBUTE_MAYBE_UNUSED term_color_t color)
     380  {
     381  }
     382  
     383  static inline term_color_t
     384  term_ostream_get_bgcolor (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream)
     385  {
     386    return COLOR_DEFAULT;
     387  }
     388  
     389  static inline void
     390  term_ostream_set_bgcolor (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream,
     391                            _GL_ATTRIBUTE_MAYBE_UNUSED term_color_t color)
     392  {
     393  }
     394  
     395  static inline term_weight_t
     396  term_ostream_get_weight (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream)
     397  {
     398    return WEIGHT_DEFAULT;
     399  }
     400  
     401  static inline void
     402  term_ostream_set_weight (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream,
     403                           _GL_ATTRIBUTE_MAYBE_UNUSED term_weight_t weight)
     404  {
     405  }
     406  
     407  static inline term_posture_t
     408  term_ostream_get_posture (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream)
     409  {
     410    return POSTURE_DEFAULT;
     411  }
     412  
     413  static inline void
     414  term_ostream_set_posture (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream,
     415                            _GL_ATTRIBUTE_MAYBE_UNUSED term_posture_t posture)
     416  {
     417  }
     418  
     419  static inline term_underline_t
     420  term_ostream_get_underline (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream)
     421  {
     422    return UNDERLINE_DEFAULT;
     423  }
     424  
     425  static inline void
     426  term_ostream_set_underline (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream,
     427                              _GL_ATTRIBUTE_MAYBE_UNUSED term_underline_t underline)
     428  {
     429  }
     430  
     431  static inline const char *
     432  term_ostream_get_hyperlink_ref (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream)
     433  {
     434    return NULL;
     435  }
     436  
     437  static inline const char *
     438  term_ostream_get_hyperlink_id (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream)
     439  {
     440    return NULL;
     441  }
     442  
     443  static inline void
     444  term_ostream_set_hyperlink (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream,
     445                              _GL_ATTRIBUTE_MAYBE_UNUSED const char *ref,
     446                              _GL_ATTRIBUTE_MAYBE_UNUSED const char *id)
     447  {
     448  }
     449  
     450  static inline void
     451  term_ostream_flush_to_current_style (term_ostream_t stream)
     452  {
     453    fflush (stream);
     454  }
     455  
     456  #define term_ostream_get_descriptor fd_ostream_get_descriptor
     457  #define term_ostream_get_filename fd_ostream_get_filename
     458  
     459  static inline ttyctl_t
     460  term_ostream_get_tty_control (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream)
     461  {
     462    return TTYCTL_NONE;
     463  }
     464  
     465  static inline ttyctl_t
     466  term_ostream_get_effective_tty_control (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream)
     467  {
     468    return TTYCTL_NONE;
     469  }
     470  
     471  static inline term_ostream_t
     472  term_ostream_create (int fd, const char *filename,
     473                       _GL_ATTRIBUTE_MAYBE_UNUSED ttyctl_t tty_control)
     474  {
     475    return fd_ostream_create (fd, filename, true);
     476  }
     477  
     478  #define is_instance_of_term_ostream is_instance_of_fd_ostream
     479  
     480  /* ------------------------- From memory-ostream.h ------------------------- */
     481  
     482  typedef ostream_t memory_ostream_t;
     483  
     484  #define memory_ostream_write_mem ostream_write_mem
     485  #define memory_ostream_flush ostream_flush
     486  #define memory_ostream_free ostream_free
     487  
     488  static inline void
     489  memory_ostream_contents (_GL_ATTRIBUTE_MAYBE_UNUSED memory_ostream_t stream,
     490                           const void **bufp, size_t *buflenp)
     491  {
     492    *bufp = NULL;
     493    *buflenp = 0;
     494  }
     495  
     496  static inline memory_ostream_t
     497  memory_ostream_create (void)
     498  {
     499    /* Not supported without the real libtextstyle.  */
     500    abort ();
     501    return NULL;
     502  }
     503  
     504  static inline bool
     505  is_instance_of_memory_ostream (_GL_ATTRIBUTE_MAYBE_UNUSED ostream_t stream)
     506  {
     507    return false;
     508  }
     509  
     510  /* -------------------------- From html-ostream.h -------------------------- */
     511  
     512  typedef ostream_t html_ostream_t;
     513  
     514  #define html_ostream_write_mem ostream_write_mem
     515  #define html_ostream_flush ostream_flush
     516  #define html_ostream_free ostream_free
     517  
     518  static inline void
     519  html_ostream_begin_span (_GL_ATTRIBUTE_MAYBE_UNUSED html_ostream_t stream,
     520                           _GL_ATTRIBUTE_MAYBE_UNUSED const char *classname)
     521  {
     522  }
     523  
     524  static inline void
     525  html_ostream_end_span (_GL_ATTRIBUTE_MAYBE_UNUSED html_ostream_t stream,
     526                         _GL_ATTRIBUTE_MAYBE_UNUSED const char *classname)
     527  {
     528  }
     529  
     530  static inline const char *
     531  html_ostream_get_hyperlink_ref (_GL_ATTRIBUTE_MAYBE_UNUSED html_ostream_t stream)
     532  {
     533    return NULL;
     534  }
     535  
     536  static inline void
     537  html_ostream_set_hyperlink_ref (_GL_ATTRIBUTE_MAYBE_UNUSED html_ostream_t stream,
     538                                  _GL_ATTRIBUTE_MAYBE_UNUSED const char *ref)
     539  {
     540  }
     541  
     542  static inline void
     543  html_ostream_flush_to_current_style (_GL_ATTRIBUTE_MAYBE_UNUSED html_ostream_t stream)
     544  {
     545  }
     546  
     547  static inline ostream_t
     548  html_ostream_get_destination (_GL_ATTRIBUTE_MAYBE_UNUSED html_ostream_t stream)
     549  {
     550    return NULL;
     551  }
     552  
     553  static inline html_ostream_t
     554  html_ostream_create (ostream_t destination)
     555  {
     556    /* Not supported without the real libtextstyle.  */
     557    abort ();
     558    return NULL;
     559  }
     560  
     561  static inline bool
     562  is_instance_of_html_ostream (_GL_ATTRIBUTE_MAYBE_UNUSED ostream_t stream)
     563  {
     564    return false;
     565  }
     566  
     567  /* ----------------------- From term-styled-ostream.h ----------------------- */
     568  
     569  typedef styled_ostream_t term_styled_ostream_t;
     570  
     571  #define term_styled_ostream_write_mem ostream_write_mem
     572  #define term_styled_ostream_flush ostream_flush
     573  #define term_styled_ostream_free ostream_free
     574  #define term_styled_ostream_begin_use_class styled_ostream_begin_use_class
     575  #define term_styled_ostream_end_use_class styled_ostream_end_use_class
     576  #define term_styled_ostream_get_hyperlink_ref styled_ostream_get_hyperlink_ref
     577  #define term_styled_ostream_get_hyperlink_id styled_ostream_get_hyperlink_id
     578  #define term_styled_ostream_set_hyperlink styled_ostream_set_hyperlink
     579  #define term_styled_ostream_flush_to_current_style styled_ostream_flush_to_current_style
     580  
     581  static inline term_ostream_t
     582  term_styled_ostream_get_destination (term_styled_ostream_t stream)
     583  {
     584    return stream;
     585  }
     586  
     587  static inline const char *
     588  term_styled_ostream_get_css_filename (_GL_ATTRIBUTE_MAYBE_UNUSED term_styled_ostream_t stream)
     589  {
     590    return NULL;
     591  }
     592  
     593  static inline term_styled_ostream_t
     594  term_styled_ostream_create (int fd, const char *filename,
     595                              _GL_ATTRIBUTE_MAYBE_UNUSED ttyctl_t tty_control,
     596                              _GL_ATTRIBUTE_MAYBE_UNUSED const char *css_filename)
     597  {
     598    return fd_ostream_create (fd, filename, true);
     599  }
     600  
     601  #define is_instance_of_term_styled_ostream is_instance_of_term_ostream
     602  
     603  /* ----------------------- From html-styled-ostream.h ----------------------- */
     604  
     605  typedef styled_ostream_t html_styled_ostream_t;
     606  
     607  #define html_styled_ostream_write_mem ostream_write_mem
     608  #define html_styled_ostream_flush ostream_flush
     609  #define html_styled_ostream_free ostream_free
     610  #define html_styled_ostream_begin_use_class styled_ostream_begin_use_class
     611  #define html_styled_ostream_end_use_class styled_ostream_end_use_class
     612  #define html_styled_ostream_get_hyperlink_ref styled_ostream_get_hyperlink_ref
     613  #define html_styled_ostream_get_hyperlink_id styled_ostream_get_hyperlink_id
     614  #define html_styled_ostream_set_hyperlink styled_ostream_set_hyperlink
     615  #define html_styled_ostream_flush_to_current_style styled_ostream_flush_to_current_style
     616  
     617  static inline ostream_t
     618  html_styled_ostream_get_destination (_GL_ATTRIBUTE_MAYBE_UNUSED html_styled_ostream_t stream)
     619  {
     620    return NULL;
     621  }
     622  
     623  static inline html_ostream_t
     624  html_styled_ostream_get_html_destination (_GL_ATTRIBUTE_MAYBE_UNUSED html_styled_ostream_t stream)
     625  {
     626    return NULL;
     627  }
     628  
     629  static inline const char *
     630  html_styled_ostream_get_css_filename (_GL_ATTRIBUTE_MAYBE_UNUSED html_styled_ostream_t stream)
     631  {
     632    return NULL;
     633  }
     634  
     635  static inline html_styled_ostream_t
     636  html_styled_ostream_create (_GL_ATTRIBUTE_MAYBE_UNUSED ostream_t destination,
     637                              _GL_ATTRIBUTE_MAYBE_UNUSED const char *css_filename)
     638  {
     639    /* Not supported without the real libtextstyle.  */
     640    abort ();
     641    return NULL;
     642  }
     643  
     644  static inline bool
     645  is_instance_of_html_styled_ostream (_GL_ATTRIBUTE_MAYBE_UNUSED ostream_t stream)
     646  {
     647    return false;
     648  }
     649  
     650  /* ----------------------- From noop-styled-ostream.h ----------------------- */
     651  
     652  typedef styled_ostream_t noop_styled_ostream_t;
     653  
     654  #define noop_styled_ostream_write_mem ostream_write_mem
     655  #define noop_styled_ostream_flush ostream_flush
     656  #define noop_styled_ostream_free ostream_free
     657  #define noop_styled_ostream_begin_use_class styled_ostream_begin_use_class
     658  #define noop_styled_ostream_end_use_class styled_ostream_end_use_class
     659  #define noop_styled_ostream_get_hyperlink_ref styled_ostream_get_hyperlink_ref
     660  #define noop_styled_ostream_get_hyperlink_id styled_ostream_get_hyperlink_id
     661  #define noop_styled_ostream_set_hyperlink styled_ostream_set_hyperlink
     662  #define noop_styled_ostream_flush_to_current_style styled_ostream_flush_to_current_style
     663  
     664  static inline ostream_t
     665  noop_styled_ostream_get_destination (noop_styled_ostream_t stream)
     666  {
     667    return stream;
     668  }
     669  
     670  static inline bool
     671  noop_styled_ostream_is_owning_destination (_GL_ATTRIBUTE_MAYBE_UNUSED noop_styled_ostream_t stream)
     672  {
     673    return true;
     674  }
     675  
     676  static inline noop_styled_ostream_t
     677  noop_styled_ostream_create (ostream_t destination, bool pass_ownership)
     678  {
     679    if (!pass_ownership)
     680      /* Not supported without the real libtextstyle.  */
     681      abort ();
     682    return destination;
     683  }
     684  
     685  static inline bool
     686  is_instance_of_noop_styled_ostream (_GL_ATTRIBUTE_MAYBE_UNUSED ostream_t stream)
     687  {
     688    return false;
     689  }
     690  
     691  /* ------------------------------ From color.h ------------------------------ */
     692  
     693  #define color_test_mode false
     694  
     695  enum color_option { color_no, color_tty, color_yes, color_html };
     696  #define color_mode color_no
     697  
     698  #define style_file_name NULL
     699  
     700  static inline bool
     701  handle_color_option (_GL_ATTRIBUTE_MAYBE_UNUSED const char *option)
     702  {
     703    return false;
     704  }
     705  
     706  static inline void
     707  handle_style_option (_GL_ATTRIBUTE_MAYBE_UNUSED const char *option)
     708  {
     709  }
     710  
     711  static inline void
     712  print_color_test (void)
     713  {
     714    /* Not supported without the real libtextstyle.  */
     715    abort ();
     716  }
     717  
     718  static inline void
     719  style_file_prepare (_GL_ATTRIBUTE_MAYBE_UNUSED const char *style_file_envvar,
     720                      _GL_ATTRIBUTE_MAYBE_UNUSED const char *stylesdir_envvar,
     721                      _GL_ATTRIBUTE_MAYBE_UNUSED const char *stylesdir_after_install,
     722                      _GL_ATTRIBUTE_MAYBE_UNUSED const char *default_style_file)
     723  {
     724  }
     725  
     726  /* ------------------------------ From misc.h ------------------------------ */
     727  
     728  static inline styled_ostream_t
     729  styled_ostream_create (int fd, const char *filename,
     730                         _GL_ATTRIBUTE_MAYBE_UNUSED ttyctl_t tty_control,
     731                         _GL_ATTRIBUTE_MAYBE_UNUSED const char *css_filename)
     732  {
     733    return fd_ostream_create (fd, filename, true);
     734  }
     735  
     736  static inline void
     737  libtextstyle_set_failure_exit_code (_GL_ATTRIBUTE_MAYBE_UNUSED int exit_code)
     738  {
     739  }
     740  
     741  #endif /* _TEXTSTYLE_H */