(root)/
texinfo-7.1/
info/
util.h
       1  #ifndef UTIL_H
       2  #define UTIL_H
       3  
       4  #include "nodes.h"
       5  #include "window.h"
       6  #include "search.h"
       7  
       8  #if HAVE_ICONV
       9  # include <iconv.h>
      10  #endif
      11  
      12  FILE_BUFFER *file_buffer_of_window (WINDOW *window);
      13  
      14  char *node_printed_rep (NODE *node);
      15  
      16  /* Return a pointer to the part of PATHNAME that simply defines the file. */
      17  char *filename_non_directory (char *pathname);
      18  
      19  /* Return non-zero if NODE is one especially created by Info. */
      20  int internal_info_node_p (NODE *node);
      21  
      22  /* Make NODE appear to be one especially created by Info, and give it NAME. */
      23  void name_internal_node (NODE *node, char *name);
      24  
      25  /* Return the window displaying NAME, the name of an internally created
      26     Info window. */
      27  WINDOW *get_internal_info_window (char *name);
      28  
      29  /* Used with multibyte iterator mbi_iterator_t. */
      30  #define ITER_SETBYTES(iter,n) ((iter).cur.bytes = n)
      31  #define ITER_LIMIT(iter) ((iter).limit - (iter).cur.ptr)
      32  
      33  int ansi_escape (mbi_iterator_t iter, size_t *plen);
      34  
      35  /* Return a pointer to a string which is the printed representation
      36     of CHARACTER if it were printed at HPOS. */
      37  char *printed_representation (mbi_iterator_t *iter,
      38                                       int *delim, size_t pl_chars,
      39                                       size_t *pchars, size_t *pbytes);
      40  
      41  
      42  struct text_buffer
      43  {
      44    char *base;
      45    size_t size;
      46    size_t off;
      47  };
      48  
      49  #define MIN_TEXT_BUF_ALLOC 512
      50  
      51  void text_buffer_init (struct text_buffer *buf);
      52  void text_buffer_free (struct text_buffer *buf);
      53  void text_buffer_alloc (struct text_buffer *buf, size_t len);
      54  size_t text_buffer_vprintf (struct text_buffer *buf, const char *format,
      55  			    va_list ap);
      56  size_t text_buffer_space_left (struct text_buffer *buf);
      57  #if HAVE_ICONV
      58  size_t text_buffer_iconv (struct text_buffer *buf, iconv_t iconv_state,
      59                            ICONV_CONST char **inbuf, size_t *inbytesleft);
      60  #endif
      61  size_t text_buffer_add_string (struct text_buffer *buf, const char *str,
      62  			       size_t len);
      63  size_t text_buffer_fill (struct text_buffer *buf, int c, size_t len);
      64  void text_buffer_add_char (struct text_buffer *buf, int c);
      65  size_t text_buffer_printf (struct text_buffer *buf, const char *format, ...);
      66  #define text_buffer_reset(buf) ((buf)->off = 0)
      67  #define text_buffer_base(buf) ((buf)->base)
      68  #define text_buffer_off(buf) ((buf)->off)
      69  
      70  #if defined(__MSDOS__) || defined(__MINGW32__)
      71  int fncmp (const char *fn1, const char *fn2);
      72  #else
      73  # define fncmp(s,t) strcmp(s,t)
      74  #endif
      75  
      76  #endif /* UTIL_H */
      77