⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glib.h

📁 本文档详细介绍了在WINDOWS下用VC6.0编译ORTP的方法,还有要用到的4个头文件
💻 H
📖 第 1 页 / 共 5 页
字号:
	guint      is_setup : 1;
	GHook     *hooks;
	GMemChunk *hook_memchunk;
	GHookFreeFunc  hook_free; /* virtual function */
	GHookFreeFunc  hook_destroy; /* virtual function */
};

struct _GHook
{
	gpointer   data;
	GHook     *next;
	GHook     *prev;
	guint      ref_count;
	guint      hook_id;
	guint      flags;
	gpointer   func;
	GDestroyNotify destroy;
};

#define G_HOOK_ACTIVE(hook)     ((((GHook*) hook)->flags & \
											G_HOOK_FLAG_ACTIVE) != 0)
#define G_HOOK_IN_CALL(hook)        ((((GHook*) hook)->flags & \
											G_HOOK_FLAG_IN_CALL) != 0)
#define G_HOOK_IS_VALID(hook)       (((GHook*) hook)->hook_id != 0 && \
										 G_HOOK_ACTIVE (hook))
#define G_HOOK_IS_UNLINKED(hook)    (((GHook*) hook)->next == NULL && \
										 ((GHook*) hook)->prev == NULL && \
										 ((GHook*) hook)->hook_id == 0 && \
										 ((GHook*) hook)->ref_count == 0)

void     g_hook_list_init       (GHookList      *hook_list,
										 guint           hook_size);
void     g_hook_list_clear      (GHookList      *hook_list);
GHook*   g_hook_alloc           (GHookList      *hook_list);
void     g_hook_free            (GHookList      *hook_list,
										 GHook          *hook);
void     g_hook_ref         (GHookList      *hook_list,
										 GHook          *hook);
void     g_hook_unref           (GHookList      *hook_list,
										 GHook          *hook);
gboolean g_hook_destroy         (GHookList      *hook_list,
										 guint           hook_id);
void     g_hook_destroy_link        (GHookList      *hook_list,
										 GHook          *hook);
void     g_hook_prepend         (GHookList      *hook_list,
										 GHook          *hook);
void     g_hook_insert_before       (GHookList      *hook_list,
										 GHook          *sibling,
										 GHook          *hook);
void     g_hook_insert_sorted       (GHookList      *hook_list,
										 GHook          *hook,
										 GHookCompareFunc    func);
GHook*   g_hook_get         (GHookList      *hook_list,
										 guint           hook_id);
GHook*   g_hook_find            (GHookList      *hook_list,
										 gboolean        need_valids,
										 GHookFindFunc       func,
										 gpointer        data);
GHook*   g_hook_find_data       (GHookList      *hook_list,
										 gboolean        need_valids,
										 gpointer        data);
GHook*   g_hook_find_func       (GHookList      *hook_list,
										 gboolean        need_valids,
										 gpointer        func);
GHook*   g_hook_find_func_data      (GHookList      *hook_list,
										 gboolean        need_valids,
										 gpointer        func,
										 gpointer        data);
/* return the first valid hook, and increment its reference count */
GHook*   g_hook_first_valid     (GHookList      *hook_list,
										 gboolean        may_be_in_call);
/* return the next valid hook with incremented reference count, and
 * decrement the reference count of the original hook
 */
GHook*   g_hook_next_valid      (GHookList      *hook_list,
										 GHook          *hook,
										 gboolean        may_be_in_call);

/* GHookCompareFunc implementation to insert hooks sorted by their id */
gint     g_hook_compare_ids     (GHook          *new_hook,
										 GHook          *sibling);

/* convenience macros */
#define  g_hook_append( hook_list, hook )  \
		 g_hook_insert_before ((hook_list), NULL, (hook))

/* invoke all valid hooks with the (*GHookFunc) signature.
 */
void     g_hook_list_invoke     (GHookList      *hook_list,
										 gboolean        may_recurse);
/* invoke all valid hooks with the (*GHookCheckFunc) signature,
 * and destroy the hook if FALSE is returned.
 */
void     g_hook_list_invoke_check   (GHookList      *hook_list,
										 gboolean        may_recurse);
/* invoke a marshaller on all valid hooks.
 */
void     g_hook_list_marshal        (GHookList      *hook_list,
										 gboolean        may_recurse,
										 GHookMarshaller     marshaller,
										 gpointer        data);
void     g_hook_list_marshal_check  (GHookList      *hook_list,
										 gboolean        may_recurse,
										 GHookCheckMarshaller    marshaller,
										 gpointer        data);


/* Fatal error handlers.
 * g_on_error_query() will prompt the user to either
 * [E]xit, [H]alt, [P]roceed or show [S]tack trace.
 * g_on_error_stack_trace() invokes gdb, which attaches to the current
 * process and shows a stack trace.
 * These function may cause different actions on non-unix platforms.
 * The prg_name arg is required by gdb to find the executable, if it is
 * passed as NULL, g_on_error_query() will try g_get_prgname().
 */
void g_on_error_query (const gchar *prg_name);
void g_on_error_stack_trace (const gchar *prg_name);


/* Logging mechanism
 */
extern          const gchar     *g_log_domain_glib;
guint       g_log_set_handler   (const gchar    *log_domain,
										 GLogLevelFlags  log_levels,
										 GLogFunc    log_func,
										 gpointer    user_data);
void        g_log_remove_handler    (const gchar    *log_domain,
										 guint       handler_id);
void        g_log_default_handler   (const gchar    *log_domain,
										 GLogLevelFlags  log_level,
										 const gchar    *message,
										 gpointer    unused_data);
void        g_log           (const gchar    *log_domain,
										 GLogLevelFlags  log_level,
										 const gchar    *format,
										 ...) G_GNUC_PRINTF (3, 4);
void        g_logv          (const gchar    *log_domain,
										 GLogLevelFlags  log_level,
										 const gchar    *format,
										 va_list     args);
GLogLevelFlags  g_log_set_fatal_mask    (const gchar    *log_domain,
										 GLogLevelFlags  fatal_mask);
GLogLevelFlags  g_log_set_always_fatal  (GLogLevelFlags  fatal_mask);
#ifndef G_LOG_DOMAIN
#define G_LOG_DOMAIN    ((gchar*) 0)
#endif  /* G_LOG_DOMAIN */
#ifdef  __GNUC__
#define g_error(format, args...)    g_log (G_LOG_DOMAIN, \
													 G_LOG_LEVEL_ERROR, \
													 format, ##args)
#define g_message(format, args...)  g_log (G_LOG_DOMAIN, \
													 G_LOG_LEVEL_MESSAGE, \
													 format, ##args)
#define g_warning(format, args...)  g_log (G_LOG_DOMAIN, \
													 G_LOG_LEVEL_WARNING, \
													 format, ##args)
#else   /* !__GNUC__ */
static void
g_error (const gchar *format,
		 ...)
{
	va_list args;
	va_start (args, format);
	g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
	va_end (args);
}
static void
g_message (const gchar *format,
			 ...)
{
	va_list args;
	va_start (args, format);
	g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format, args);
	va_end (args);
}
static void
g_warning (const gchar *format,
			 ...)
{
	va_list args;
	va_start (args, format);
	g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, format, args);
	va_end (args);
}
#endif  /* !__GNUC__ */

typedef void    (*GPrintFunc)       (const gchar    *string);
void        g_print         (const gchar    *format,
										 ...) G_GNUC_PRINTF (1, 2);
GPrintFunc  g_set_print_handler (GPrintFunc  func);
void        g_printerr      (const gchar    *format,
										 ...) G_GNUC_PRINTF (1, 2);
GPrintFunc  g_set_printerr_handler  (GPrintFunc  func);

/* deprecated compatibility functions, use g_log_set_handler() instead */
typedef void        (*GErrorFunc)       (const gchar *str);
typedef void        (*GWarningFunc)     (const gchar *str);
GErrorFunc   g_set_error_handler   (GErrorFunc   func);
GWarningFunc g_set_warning_handler (GWarningFunc func);
GPrintFunc   g_set_message_handler (GPrintFunc func);


/* Memory allocation and debugging
 */
#ifdef USE_DMALLOC

#define g_malloc(size)       ((gpointer) MALLOC (size))
#define g_malloc0(size)      ((gpointer) CALLOC (char, size))
#define g_realloc(mem,size)  ((gpointer) REALLOC (mem, char, size))
#define g_free(mem)      FREE (mem)

#else /* !USE_DMALLOC */

gpointer g_malloc      (gulong    size);
gpointer g_malloc0     (gulong    size);
gpointer g_realloc     (gpointer  mem,
						gulong    size);
void     g_free        (gpointer  mem);

#endif /* !USE_DMALLOC */

void     g_mem_profile (void);
void     g_mem_check   (gpointer  mem);

/* Generic allocators
 */
GAllocator* g_allocator_new   (const gchar  *name,
									 guint         n_preallocs);
void        g_allocator_free  (GAllocator   *allocator);

#define G_ALLOCATOR_LIST    (1)
#define G_ALLOCATOR_SLIST   (2)
#define G_ALLOCATOR_NODE    (3)


/* "g_mem_chunk_new" creates a new memory chunk.
 * Memory chunks are used to allocate pieces of memory which are
 *  always the same size. Lists are a good example of such a data type.
 * The memory chunk allocates and frees blocks of memory as needed.
 *  Just be sure to call "g_mem_chunk_free" and not "g_free" on data
 *  allocated in a mem chunk. ("g_free" will most likely cause a seg
 *  fault...somewhere).
 *
 * Oh yeah, GMemChunk is an opaque data type. (You don't really
 *  want to know what's going on inside do you?)
 */

/* ALLOC_ONLY MemChunk's can only allocate memory. The free operation
 *  is interpreted as a no op. ALLOC_ONLY MemChunk's save 4 bytes per
 *  atom. (They are also useful for lists which use MemChunk to allocate
 *  memory but are also part of the MemChunk implementation).
 * ALLOC_AND_FREE MemChunk's can allocate and free memory.
 */

#define G_ALLOC_ONLY      1
#define G_ALLOC_AND_FREE  2

GMemChunk* g_mem_chunk_new     (gchar     *name,
								gint       atom_size,
								gulong     area_size,
								gint       type);
void       g_mem_chunk_destroy (GMemChunk *mem_chunk);
gpointer   g_mem_chunk_alloc   (GMemChunk *mem_chunk);
gpointer   g_mem_chunk_alloc0  (GMemChunk *mem_chunk);
void       g_mem_chunk_free    (GMemChunk *mem_chunk,
								gpointer   mem);
void       g_mem_chunk_clean   (GMemChunk *mem_chunk);
void       g_mem_chunk_reset   (GMemChunk *mem_chunk);
void       g_mem_chunk_print   (GMemChunk *mem_chunk);
void       g_mem_chunk_info    (void);

/* Ah yes...we have a "g_blow_chunks" function.
 * "g_blow_chunks" simply compresses all the chunks. This operation
 *  consists of freeing every memory area that should be freed (but
 *  which we haven't gotten around to doing yet). And, no,
 *  "g_blow_chunks" doesn't follow the naming scheme, but it is a
 *  much better name than "g_mem_chunk_clean_all" or something
 *  similar.
 */
void g_blow_chunks (void);


/* Timer
 */
GTimer* g_timer_new (void);
void    g_timer_destroy (GTimer  *timer);
void    g_timer_start   (GTimer  *timer);
void    g_timer_stop    (GTimer  *timer);
void    g_timer_reset   (GTimer  *timer);
gdouble g_timer_elapsed (GTimer  *timer,
						 gulong  *microseconds);


/* String utility functions that modify a string argument or
 * return a constant string that must not be freed.
 */
#define  G_STR_DELIMITERS   "_-|> <."
gchar*   g_strdelimit       (gchar       *string,
								 const gchar *delimiters,
								 gchar        new_delimiter);
gdouble  g_strtod       (const gchar *nptr,
								 gchar      **endptr);
gchar*   g_strerror     (gint         errnum);
gchar*   g_strsignal        (gint         signum);
gint     g_strcasecmp       (const gchar *s1,
								 const gchar *s2);
gint     g_strncasecmp      (const gchar *s1,
								 const gchar *s2,
								 guint        n);
void     g_strdown      (gchar       *string);
void     g_strup        (gchar       *string);
void     g_strreverse       (gchar       *string);
/* removes leading spaces */
gchar*   g_strchug              (gchar        *string);
/* removes trailing spaces */
gchar*  g_strchomp              (gchar        *string);
/* removes leading & trailing spaces */
#define g_strstrip( string )    g_strchomp (g_strchug (string))

/* String utility functions that return a newly allocated string which
 * ought to be freed from the caller at some point.
 */
gchar*   g_strdup       (const gchar *str);
gchar*   g_strdup_printf    (const gchar *format,
								 ...) G_GNUC_PRINTF (1, 2);
gchar*   g_strdup_vprintf   (const gchar *format,
								 va_list      args);
gchar*   g_strndup      (const gchar *str,
								 guint        n);
gchar*   g_strnfill     (guint        length,
								 gchar        fill_char);
gchar*   g_strconcat        (const gchar *string1,
								 ...); /* NULL terminated */
gchar*   g_strjoin      (const gchar  *separator,
								 ...); /* NULL terminated */
gchar*   g_strescape        (gchar        *string);
gpointer g_memdup       (gconstpointer mem,
								 guint         byte_size);

/* NULL terminated string arrays.
 * g_strsplit() splits up string into max_tokens tokens at delim and
 * returns a newly allocated string array.
 * g_strjoinv() concatenates all of str_array's strings, sliding in an
 * optional separator, the returned string is newly allocated.
 * g_strfreev() frees the array itself and all of its strings.
 */
gchar**  g_strsplit     (const gchar  *string,
								 const gchar  *delimiter,
								 gint          max_tokens);
gchar*   g_strjoinv     (const gchar  *separator,
								 gchar       **str_array);
void     g_strfreev     (gchar       **str_array);



/* calculate a string size, guarranteed to fit format + args.
 */
guint   g_printf_string_upper_bound (const gchar* format,
										 va_list      args);


/* Retrive static string info
 */
gchar*  g_get_user_name     (void);
gchar*  g_get_real_name     (void);
gchar*  g_get_home_dir      (void);
gchar*  g_get_tmp_dir       (void);
gchar*  g_get_prgname       (void);
void    g_set_prgname       (const gchar *prgname);


/* Miscellaneous utility functions
 */
guint   g_parse_debug_string    (const gchar *string,
								 GDebugKey   *keys,
								 guint        nkeys);
gint    g_snprintf      (gchar       *string,
								 gulong       n,
								 gchar const *format,
								 ...) G_GNUC_PRINTF (3, 4);
gint    g_vsnprintf     (gchar       *string,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -