(root)/
gettext-0.22.4/
libtextstyle/
lib/
glib/
gstrfuncs.in.h
       1  /* GLIB - Library of useful routines for C programming
       2   * Copyright (C) 2006-2019 Free Software Foundation, Inc.
       3   *
       4   * This file is not part of the GNU gettext program, but is used with
       5   * GNU gettext.
       6   *
       7   * The original copyright notice is as follows:
       8   */
       9  
      10  /* GLIB - Library of useful routines for C programming
      11   * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
      12   *
      13   * This library is free software; you can redistribute it and/or
      14   * modify it under the terms of the GNU Lesser General Public
      15   * License as published by the Free Software Foundation; either
      16   * version 2 of the License, or (at your option) any later version.
      17   *
      18   * This library is distributed in the hope that it will be useful,
      19   * but WITHOUT ANY WARRANTY; without even the implied warranty of
      20   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      21   * Lesser General Public License for more details.
      22   *
      23   * You should have received a copy of the GNU Lesser General Public
      24   * License along with this library; if not, write to the
      25   * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
      26   * Boston, MA 02111-1307, USA.
      27   */
      28  
      29  /*
      30   * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
      31   * file for a list of people on the GLib Team.  See the ChangeLog
      32   * files for a list of changes.  These files are distributed with
      33   * GLib at ftp://ftp.gtk.org/pub/gtk/. 
      34   */
      35  
      36  /*
      37   * Modified by Bruno Haible for use as a gnulib module.
      38   */
      39  
      40  #ifndef __G_STRFUNCS_H__
      41  #define __G_STRFUNCS_H__
      42  
      43  #include <stdarg.h>
      44  #include <glib/gtypes.h>
      45  
      46  G_BEGIN_DECLS
      47  
      48  /* Functions like the ones in <ctype.h> that are not affected by locale. */
      49  typedef enum {
      50    G_ASCII_ALNUM  = 1 << 0,
      51    G_ASCII_ALPHA  = 1 << 1,
      52    G_ASCII_CNTRL  = 1 << 2,
      53    G_ASCII_DIGIT  = 1 << 3,
      54    G_ASCII_GRAPH  = 1 << 4,
      55    G_ASCII_LOWER  = 1 << 5,
      56    G_ASCII_PRINT  = 1 << 6,
      57    G_ASCII_PUNCT  = 1 << 7,
      58    G_ASCII_SPACE  = 1 << 8,
      59    G_ASCII_UPPER  = 1 << 9,
      60    G_ASCII_XDIGIT = 1 << 10
      61  } GAsciiType;
      62  
      63  GLIB_VAR const guint16 * const g_ascii_table;
      64  
      65  #define g_ascii_isalnum(c) \
      66    ((g_ascii_table[(guchar) (c)] & G_ASCII_ALNUM) != 0)
      67  
      68  #define g_ascii_isalpha(c) \
      69    ((g_ascii_table[(guchar) (c)] & G_ASCII_ALPHA) != 0)
      70  
      71  #define g_ascii_iscntrl(c) \
      72    ((g_ascii_table[(guchar) (c)] & G_ASCII_CNTRL) != 0)
      73  
      74  #define g_ascii_isdigit(c) \
      75    ((g_ascii_table[(guchar) (c)] & G_ASCII_DIGIT) != 0)
      76  
      77  #define g_ascii_isgraph(c) \
      78    ((g_ascii_table[(guchar) (c)] & G_ASCII_GRAPH) != 0)
      79  
      80  #define g_ascii_islower(c) \
      81    ((g_ascii_table[(guchar) (c)] & G_ASCII_LOWER) != 0)
      82  
      83  #define g_ascii_isprint(c) \
      84    ((g_ascii_table[(guchar) (c)] & G_ASCII_PRINT) != 0)
      85  
      86  #define g_ascii_ispunct(c) \
      87    ((g_ascii_table[(guchar) (c)] & G_ASCII_PUNCT) != 0)
      88  
      89  #define g_ascii_isspace(c) \
      90    ((g_ascii_table[(guchar) (c)] & G_ASCII_SPACE) != 0)
      91  
      92  #define g_ascii_isupper(c) \
      93    ((g_ascii_table[(guchar) (c)] & G_ASCII_UPPER) != 0)
      94  
      95  #define g_ascii_isxdigit(c) \
      96    ((g_ascii_table[(guchar) (c)] & G_ASCII_XDIGIT) != 0)
      97  
      98  #if 0
      99  gchar                 g_ascii_tolower  (gchar        c) G_GNUC_CONST;
     100  #endif
     101  gchar                 g_ascii_toupper  (gchar        c) G_GNUC_CONST;
     102  
     103  #if 0
     104  gint                  g_ascii_digit_value  (gchar    c) G_GNUC_CONST;
     105  gint                  g_ascii_xdigit_value (gchar    c) G_GNUC_CONST;
     106  
     107  /* String utility functions that modify a string argument or
     108   * return a constant string that must not be freed.
     109   */
     110  #define	 G_STR_DELIMITERS	"_-|> <."
     111  gchar*	              g_strdelimit     (gchar	     *string,
     112  					const gchar  *delimiters,
     113  					gchar	      new_delimiter);
     114  gchar*	              g_strcanon       (gchar        *string,
     115  					const gchar  *valid_chars,
     116  					gchar         substitutor);
     117  G_CONST_RETURN gchar* g_strerror       (gint	      errnum) G_GNUC_CONST;
     118  G_CONST_RETURN gchar* g_strsignal      (gint	      signum) G_GNUC_CONST;
     119  gchar*	              g_strreverse     (gchar	     *string);
     120  gsize	              g_strlcpy	       (gchar	     *dest,
     121  					const gchar  *src,
     122  					gsize         dest_size);
     123  gsize	              g_strlcat        (gchar	     *dest,
     124  					const gchar  *src,
     125  					gsize         dest_size);
     126  #endif
     127  gchar *               g_strstr_len     (const gchar  *haystack,
     128  					gssize        haystack_len,
     129  					const gchar  *needle);
     130  #if 0
     131  gchar *               g_strrstr        (const gchar  *haystack,
     132  					const gchar  *needle);
     133  gchar *               g_strrstr_len    (const gchar  *haystack,
     134  					gssize        haystack_len,
     135  					const gchar  *needle);
     136  
     137  gboolean              g_str_has_suffix (const gchar  *str,
     138  					const gchar  *suffix);
     139  gboolean              g_str_has_prefix (const gchar  *str,
     140  					const gchar  *prefix);
     141  
     142  /* String to/from double conversion functions */
     143  
     144  gdouble	              g_strtod         (const gchar  *nptr,
     145  					gchar	    **endptr);
     146  gdouble	              g_ascii_strtod   (const gchar  *nptr,
     147  					gchar	    **endptr);
     148  guint64		      g_ascii_strtoull (const gchar *nptr,
     149  					gchar      **endptr,
     150  					guint        base);
     151  gint64		      g_ascii_strtoll  (const gchar *nptr,
     152  					gchar      **endptr,
     153  					guint        base);
     154  #endif
     155  /* 29 bytes should enough for all possible values that
     156   * g_ascii_dtostr can produce.
     157   * Then add 10 for good measure */
     158  #define G_ASCII_DTOSTR_BUF_SIZE (29 + 10)
     159  gchar *               g_ascii_dtostr   (gchar        *buffer,
     160  					gint          buf_len,
     161  					gdouble       d);
     162  gchar *               g_ascii_formatd  (gchar        *buffer,
     163  					gint          buf_len,
     164  					const gchar  *format,
     165  					gdouble       d);
     166  
     167  #if 0
     168  /* removes leading spaces */
     169  gchar*                g_strchug        (gchar        *string);
     170  /* removes trailing spaces */
     171  gchar*                g_strchomp       (gchar        *string);
     172  /* removes leading & trailing spaces */
     173  #define g_strstrip( string )	g_strchomp (g_strchug (string))
     174  #endif
     175  
     176  gint                  g_ascii_strcasecmp  (const gchar *s1,
     177  					   const gchar *s2);
     178  #if 0
     179  gint                  g_ascii_strncasecmp (const gchar *s1,
     180  					   const gchar *s2,
     181  					   gsize        n);
     182  gchar*                g_ascii_strdown     (const gchar *str,
     183  					   gssize       len) G_GNUC_MALLOC;
     184  #endif
     185  gchar*                g_ascii_strup       (const gchar *str,
     186  					   gssize       len) G_GNUC_MALLOC;
     187  
     188  #if 0
     189  
     190  #ifndef G_DISABLE_DEPRECATED
     191  
     192  /* The following four functions are deprecated and will be removed in
     193   * the next major release. They use the locale-specific tolower and
     194   * toupper, which is almost never the right thing.
     195   */
     196  
     197  gint	              g_strcasecmp     (const gchar *s1,
     198  					const gchar *s2);
     199  gint	              g_strncasecmp    (const gchar *s1,
     200  					const gchar *s2,
     201  					guint        n);
     202  gchar*	              g_strdown	       (gchar	     *string);
     203  gchar*	              g_strup	       (gchar	     *string);
     204  
     205  #endif /* G_DISABLE_DEPRECATED */
     206  
     207  #endif
     208  
     209  /* String utility functions that return a newly allocated string which
     210   * ought to be freed with g_free from the caller at some point.
     211   */
     212  gchar*	              g_strdup	       (const gchar *str) G_GNUC_MALLOC;
     213  gchar*	              g_strdup_printf  (const gchar *format,
     214  					...) G_GNUC_PRINTF (1, 2) G_GNUC_MALLOC;
     215  #if 0
     216  gchar*	              g_strdup_vprintf (const gchar *format,
     217  					va_list      args) G_GNUC_MALLOC;
     218  #endif
     219  gchar*	              g_strndup	       (const gchar *str,
     220  					gsize        n) G_GNUC_MALLOC;  
     221  #if 0
     222  gchar*	              g_strnfill       (gsize        length,  
     223  					gchar        fill_char) G_GNUC_MALLOC;
     224  #endif
     225  gchar*	              g_strconcat      (const gchar *string1,
     226  					...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
     227  #if 0
     228  gchar*                g_strjoin	       (const gchar  *separator,
     229  					...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
     230  
     231  /* Make a copy of a string interpreting C string -style escape
     232   * sequences. Inverse of g_strescape. The recognized sequences are \b
     233   * \f \n \r \t \\ \" and the octal format.
     234   */
     235  gchar*                g_strcompress    (const gchar *source) G_GNUC_MALLOC;
     236  
     237  /* Copy a string escaping nonprintable characters like in C strings.
     238   * Inverse of g_strcompress. The exceptions parameter, if non-NULL, points
     239   * to a string containing characters that are not to be escaped.
     240   *
     241   * Deprecated API: gchar* g_strescape (const gchar *source);
     242   * Luckily this function wasn't used much, using NULL as second parameter
     243   * provides mostly identical semantics.
     244   */
     245  gchar*                g_strescape      (const gchar *source,
     246  					const gchar *exceptions) G_GNUC_MALLOC;
     247  
     248  gpointer              g_memdup	       (gconstpointer mem,
     249  					guint	       byte_size) G_GNUC_MALLOC;
     250  
     251  /* NULL terminated string arrays.
     252   * g_strsplit(), g_strsplit_set() split up string into max_tokens tokens
     253   * at delim and return a newly allocated string array.
     254   * g_strjoinv() concatenates all of str_array's strings, sliding in an
     255   * optional separator, the returned string is newly allocated.
     256   * g_strfreev() frees the array itself and all of its strings.
     257   * g_strdupv() copies a NULL-terminated array of strings
     258   * g_strv_length() returns the length of a NULL-terminated array of strings
     259   */
     260  gchar**	              g_strsplit       (const gchar  *string,
     261  					const gchar  *delimiter,
     262  					gint          max_tokens) G_GNUC_MALLOC;
     263  gchar **	      g_strsplit_set   (const gchar *string,
     264  					const gchar *delimiters,
     265  					gint         max_tokens) G_GNUC_MALLOC;
     266  gchar*                g_strjoinv       (const gchar  *separator,
     267  					gchar       **str_array) G_GNUC_MALLOC;
     268  void                  g_strfreev       (gchar       **str_array);
     269  gchar**               g_strdupv        (gchar       **str_array) G_GNUC_MALLOC;
     270  guint                 g_strv_length    (gchar       **str_array);
     271  
     272  gchar*                g_stpcpy         (gchar        *dest,
     273                                          const char   *src);
     274  
     275  G_CONST_RETURN gchar *g_strip_context  (const gchar *msgid, 
     276  					const gchar *msgval);
     277  
     278  #endif
     279  
     280  G_END_DECLS
     281  
     282  #endif /* __G_STRFUNCS_H__ */