]> git.draconx.ca Git - gob-dx.git/blobdiff - src/util.h
Allow building against Glib 1.x.
[gob-dx.git] / src / util.h
index 9d0d0cb4c6b4c226e48fe97a4e4df019efd39c5b..03a12d12fbd0701efad6f1cb003b204f908554dd 100644 (file)
@@ -1,5 +1,7 @@
 /* GOB C Preprocessor
  * Copyright (C) 1999-2000 the Free Software Foundation.
+ * Copyright (C) 2000 Eazel, Inc.
+ * Copyright (C) 2022 Nick Bowler
  *
  * Author: George Lebl
  *
  * USA.
  */
 
-#ifndef _UTIL_H_
-#define _UTIL_H_
+#ifndef UTIL_H
+#define UTIL_H
 
-/* print an error, or warning (if 'is_warn') referring to 'line' */
-void print_error(int is_warn, char *error, int line);
+#include <glib.h>
+
+struct _Class;
+struct _Type;
+
+enum {
+       GOB_WARN,
+       GOB_ERROR
+};
+
+/* print an error, or warning referring to 'line'
+ * (line can be 0 or negative for no line) */
+void error_print(int type, int line, const char *error);
+void error_printf(int type, int line, const char *error, ...) G_GNUC_PRINTF (3, 4);
 
 /* remove the : separator from a typename */
-char * remove_sep(char *base);
+char * remove_sep(const char *base);
 /* replace the : separator from a typename with a different character*/
-char * replace_sep(char *base, char r);
+char * replace_sep(const char *base, char r);
+
+#if !HAVE_G_STRING_APPEND_PRINTF
+#  define g_string_append_printf g_string_sprintfa
+#  define g_string_printf g_string_sprintf
+#endif
+
+char *gob_strup(char *s);
+char *gob_strdown(char *s);
+
+#if HAVE_G_ASCII_STRCASECMP
+static inline int gob_strcasecmp(const char *s1, const char *s2)
+{
+       return g_ascii_strcasecmp(s1, s2);
+}
+#else
+int gob_strcasecmp(const char *s1, const char *s2);
+#endif
+
+char * gob_str_delete_quotes(char *str);
 
 /*separate the namespace part and then replace rest of
   separators with r*/
-void separns_replace_sep(char *base, char **ns, char **name, char r);
+void separns_replace_sep(const char *base, char **ns, char **name, char r);
 
 /* make a macro with some prefix before the name but after
    namespace */
-char * make_pre_macro(char *base, char *pre);
+char * make_pre_macro(const char *base,const  char *pre);
 
-/* get a name usable for a cast from a GTK+ type (without GTK_TYPE_)*/
-const char * get_cast(char *type, gboolean simple_only);
+/* get a name usable for a cast from a GObject (without G_TYPE_)*/
+const char *get_cast(const char *type, gboolean simple_only);
+struct _Type *get_tree_type(const char *type, gboolean simple_only);
+char *get_type(const struct _Type *t, gboolean postfix_to_stars);
 
-#endif
+enum {
+       SPECIAL_2POINTER,
+       SPECIAL_3POINTER,
+       SPECIAL_INT_POINTER,
+       SPECIAL_LAST
+};
+
+/* returns TRUE if there are any special types at all */
+gboolean setup_special_array(struct _Class *c, gboolean *special_array);
+
+char * make_me_type (const char *type, const char *alt);
 
+#endif /* UTIL_H */