X-Git-Url: https://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/4ebed70c2119e843ce48ae4fa6076475d2100693..7f1f40bee65a4a3d3947ad8c50b535ea0754f629:/src/util.h diff --git a/src/util.h b/src/util.h index bb69ed2..03a12d1 100644 --- a/src/util.h +++ b/src/util.h @@ -1,6 +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 * @@ -23,6 +24,11 @@ #ifndef UTIL_H #define UTIL_H +#include + +struct _Class; +struct _Type; + enum { GOB_WARN, GOB_ERROR @@ -38,10 +44,24 @@ char * remove_sep(const char *base); /* replace the : separator from a typename with a different character*/ char * replace_sep(const char *base, char r); -char * gob_strup (char *s); -char * gob_strdown (char *s); -char * gob_str_delete_quotes(char *str); +#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*/ @@ -52,9 +72,9 @@ void separns_replace_sep(const char *base, char **ns, char **name, char r); char * make_pre_macro(const char *base,const char *pre); /* get a name usable for a cast from a GObject (without G_TYPE_)*/ -const char * get_cast (const char *type, gboolean simple_only); -Type * get_tree_type (const char *type, gboolean simple_only); -char * get_type (const Type *t, gboolean postfix_to_stars); +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); enum { SPECIAL_2POINTER, @@ -62,8 +82,9 @@ enum { SPECIAL_INT_POINTER, SPECIAL_LAST }; + /* returns TRUE if there are any special types at all */ -gboolean setup_special_array(Class *c, gboolean *special_array); +gboolean setup_special_array(struct _Class *c, gboolean *special_array); char * make_me_type (const char *type, const char *alt);