Файловый менеджер - Редактировать - /home/freeclou/app.optimyar.com/front-web/build/assets/styles/glib.zip
Назад
PK �w[� M�� � deprecated/gallocator.hnu �[��� /* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __G_ALLOCATOR_H__ #define __G_ALLOCATOR_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gtypes.h> G_BEGIN_DECLS typedef struct _GAllocator GAllocator; typedef struct _GMemChunk GMemChunk; #define G_ALLOC_ONLY 1 #define G_ALLOC_AND_FREE 2 #define G_ALLOCATOR_LIST 1 #define G_ALLOCATOR_SLIST 2 #define G_ALLOCATOR_NODE 3 #define g_chunk_new(type, chunk) ((type *) g_mem_chunk_alloc (chunk)) #define g_chunk_new0(type, chunk) ((type *) g_mem_chunk_alloc0 (chunk)) #define g_chunk_free(mem, mem_chunk) (g_mem_chunk_free (mem_chunk, mem)) #define g_mem_chunk_create(type, x, y) (g_mem_chunk_new (NULL, sizeof (type), 0, 0)) GLIB_DEPRECATED GMemChunk * g_mem_chunk_new (const gchar *name, gint atom_size, gsize area_size, gint type); GLIB_DEPRECATED void g_mem_chunk_destroy (GMemChunk *mem_chunk); GLIB_DEPRECATED gpointer g_mem_chunk_alloc (GMemChunk *mem_chunk); GLIB_DEPRECATED gpointer g_mem_chunk_alloc0 (GMemChunk *mem_chunk); GLIB_DEPRECATED void g_mem_chunk_free (GMemChunk *mem_chunk, gpointer mem); GLIB_DEPRECATED void g_mem_chunk_clean (GMemChunk *mem_chunk); GLIB_DEPRECATED void g_mem_chunk_reset (GMemChunk *mem_chunk); GLIB_DEPRECATED void g_mem_chunk_print (GMemChunk *mem_chunk); GLIB_DEPRECATED void g_mem_chunk_info (void); GLIB_DEPRECATED void g_blow_chunks (void); GLIB_DEPRECATED GAllocator * g_allocator_new (const gchar *name, guint n_preallocs); GLIB_DEPRECATED void g_allocator_free (GAllocator *allocator); GLIB_DEPRECATED void g_list_push_allocator (GAllocator *allocator); GLIB_DEPRECATED void g_list_pop_allocator (void); GLIB_DEPRECATED void g_slist_push_allocator (GAllocator *allocator); GLIB_DEPRECATED void g_slist_pop_allocator (void); GLIB_DEPRECATED void g_node_push_allocator (GAllocator *allocator); GLIB_DEPRECATED void g_node_pop_allocator (void); G_END_DECLS #endif /* __G_ALLOCATOR_H__ */ PK �w[7P�� � deprecated/gcache.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_CACHE_H__ #define __G_CACHE_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/glist.h> G_BEGIN_DECLS typedef struct _GCache GCache GLIB_DEPRECATED_TYPE_IN_2_26_FOR(GHashTable); typedef gpointer (*GCacheNewFunc) (gpointer key) GLIB_DEPRECATED_TYPE_IN_2_26; typedef gpointer (*GCacheDupFunc) (gpointer value) GLIB_DEPRECATED_TYPE_IN_2_26; typedef void (*GCacheDestroyFunc) (gpointer value) GLIB_DEPRECATED_TYPE_IN_2_26; G_GNUC_BEGIN_IGNORE_DEPRECATIONS /* Caches */ GLIB_DEPRECATED GCache* g_cache_new (GCacheNewFunc value_new_func, GCacheDestroyFunc value_destroy_func, GCacheDupFunc key_dup_func, GCacheDestroyFunc key_destroy_func, GHashFunc hash_key_func, GHashFunc hash_value_func, GEqualFunc key_equal_func); GLIB_DEPRECATED void g_cache_destroy (GCache *cache); GLIB_DEPRECATED gpointer g_cache_insert (GCache *cache, gpointer key); GLIB_DEPRECATED void g_cache_remove (GCache *cache, gconstpointer value); GLIB_DEPRECATED void g_cache_key_foreach (GCache *cache, GHFunc func, gpointer user_data); GLIB_DEPRECATED void g_cache_value_foreach (GCache *cache, GHFunc func, gpointer user_data); G_GNUC_END_IGNORE_DEPRECATIONS G_END_DECLS #endif /* __G_CACHE_H__ */ PK �w[���j j deprecated/gcompletion.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_COMPLETION_H__ #define __G_COMPLETION_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/glist.h> G_BEGIN_DECLS typedef struct _GCompletion GCompletion; typedef gchar* (*GCompletionFunc) (gpointer); /* GCompletion */ typedef gint (*GCompletionStrncmpFunc) (const gchar *s1, const gchar *s2, gsize n); struct _GCompletion { GList* items; GCompletionFunc func; gchar* prefix; GList* cache; GCompletionStrncmpFunc strncmp_func; }; GLIB_DEPRECATED_IN_2_26 GCompletion* g_completion_new (GCompletionFunc func); GLIB_DEPRECATED_IN_2_26 void g_completion_add_items (GCompletion* cmp, GList* items); GLIB_DEPRECATED_IN_2_26 void g_completion_remove_items (GCompletion* cmp, GList* items); GLIB_DEPRECATED_IN_2_26 void g_completion_clear_items (GCompletion* cmp); GLIB_DEPRECATED_IN_2_26 GList* g_completion_complete (GCompletion* cmp, const gchar* prefix, gchar** new_prefix); GLIB_DEPRECATED_IN_2_26 GList* g_completion_complete_utf8 (GCompletion *cmp, const gchar* prefix, gchar** new_prefix); GLIB_DEPRECATED_IN_2_26 void g_completion_set_compare (GCompletion *cmp, GCompletionStrncmpFunc strncmp_func); GLIB_DEPRECATED_IN_2_26 void g_completion_free (GCompletion* cmp); G_END_DECLS #endif /* __G_COMPLETION_H__ */ PK �w[]�^) ) deprecated/gmain.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_DEPRECATED_MAIN_H__ #define __G_DEPRECATED_MAIN_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gmain.h> G_BEGIN_DECLS /* ============== Compat main loop stuff ================== */ /** * g_main_new: * @is_running: set to %TRUE to indicate that the loop is running. This * is not very important since calling g_main_run() will set this * to %TRUE anyway. * * Creates a new #GMainLoop for th default main context. * * Returns: a new #GMainLoop * * Deprecated: 2.2: Use g_main_loop_new() instead */ #define g_main_new(is_running) g_main_loop_new (NULL, is_running) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_new) /** * g_main_run: * @loop: a #GMainLoop * * Runs a main loop until it stops running. * * Deprecated: 2.2: Use g_main_loop_run() instead */ #define g_main_run(loop) g_main_loop_run(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_run) /** * g_main_quit: * @loop: a #GMainLoop * * Stops the #GMainLoop. * If g_main_run() was called to run the #GMainLoop, it will now return. * * Deprecated: 2.2: Use g_main_loop_quit() instead */ #define g_main_quit(loop) g_main_loop_quit(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_quit) /** * g_main_destroy: * @loop: a #GMainLoop * * Frees the memory allocated for the #GMainLoop. * * Deprecated: 2.2: Use g_main_loop_unref() instead */ #define g_main_destroy(loop) g_main_loop_unref(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_unref) /** * g_main_is_running: * @loop: a #GMainLoop * * Checks if the main loop is running. * * Returns: %TRUE if the main loop is running * * Deprecated: 2.2: Use g_main_loop_is_running() instead */ #define g_main_is_running(loop) g_main_loop_is_running(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_is_running) /** * g_main_iteration: * @may_block: set to %TRUE if it should block (i.e. wait) until an event * source becomes ready. It will return after an event source has been * processed. If set to %FALSE it will return immediately if no event * source is ready to be processed. * * Runs a single iteration for the default #GMainContext. * * Returns: %TRUE if more events are pending. * * Deprecated: 2.2: Use g_main_context_iteration() instead. */ #define g_main_iteration(may_block) g_main_context_iteration (NULL, may_block) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_context_iteration) /** * g_main_pending: * * Checks if any events are pending for the default #GMainContext * (i.e. ready to be processed). * * Returns: %TRUE if any events are pending. * * Deprecated: 2.2: Use g_main_context_pending() instead. */ #define g_main_pending() g_main_context_pending (NULL) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_context_pending) /** * g_main_set_poll_func: * @func: the function to call to poll all file descriptors * * Sets the function to use for the handle polling of file descriptors * for the default main context. * * Deprecated: 2.2: Use g_main_context_set_poll_func() again */ #define g_main_set_poll_func(func) g_main_context_set_poll_func (NULL, func) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_context_set_poll_func) G_END_DECLS #endif /* __G_DEPRECATED_MAIN_H__ */ PK �w[l�V/b b deprecated/grel.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_REL_H__ #define __G_REL_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gtypes.h> G_BEGIN_DECLS typedef struct _GRelation GRelation; typedef struct _GTuples GTuples; struct _GTuples { guint len; }; /* GRelation * * Indexed Relations. Imagine a really simple table in a * database. Relations are not ordered. This data type is meant for * maintaining a N-way mapping. * * g_relation_new() creates a relation with FIELDS fields * * g_relation_destroy() frees all resources * g_tuples_destroy() frees the result of g_relation_select() * * g_relation_index() indexes relation FIELD with the provided * equality and hash functions. this must be done before any * calls to insert are made. * * g_relation_insert() inserts a new tuple. you are expected to * provide the right number of fields. * * g_relation_delete() deletes all relations with KEY in FIELD * g_relation_select() returns ... * g_relation_count() counts ... */ GLIB_DEPRECATED_IN_2_26 GRelation* g_relation_new (gint fields); GLIB_DEPRECATED_IN_2_26 void g_relation_destroy (GRelation *relation); GLIB_DEPRECATED_IN_2_26 void g_relation_index (GRelation *relation, gint field, GHashFunc hash_func, GEqualFunc key_equal_func); GLIB_DEPRECATED_IN_2_26 void g_relation_insert (GRelation *relation, ...); GLIB_DEPRECATED_IN_2_26 gint g_relation_delete (GRelation *relation, gconstpointer key, gint field); GLIB_DEPRECATED_IN_2_26 GTuples* g_relation_select (GRelation *relation, gconstpointer key, gint field); GLIB_DEPRECATED_IN_2_26 gint g_relation_count (GRelation *relation, gconstpointer key, gint field); GLIB_DEPRECATED_IN_2_26 gboolean g_relation_exists (GRelation *relation, ...); GLIB_DEPRECATED_IN_2_26 void g_relation_print (GRelation *relation); GLIB_DEPRECATED_IN_2_26 void g_tuples_destroy (GTuples *tuples); GLIB_DEPRECATED_IN_2_26 gpointer g_tuples_index (GTuples *tuples, gint index_, gint field); G_END_DECLS #endif /* __G_REL_H__ */ PK �w[���* �* deprecated/gthread.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_DEPRECATED_THREAD_H__ #define __G_DEPRECATED_THREAD_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gthread.h> G_BEGIN_DECLS G_GNUC_BEGIN_IGNORE_DEPRECATIONS typedef enum { G_THREAD_PRIORITY_LOW, G_THREAD_PRIORITY_NORMAL, G_THREAD_PRIORITY_HIGH, G_THREAD_PRIORITY_URGENT } GThreadPriority GLIB_DEPRECATED_TYPE_IN_2_32; struct _GThread { /*< private >*/ GThreadFunc func; gpointer data; gboolean joinable; GThreadPriority priority; }; typedef struct _GThreadFunctions GThreadFunctions GLIB_DEPRECATED_TYPE_IN_2_32; struct _GThreadFunctions { GMutex* (*mutex_new) (void); void (*mutex_lock) (GMutex *mutex); gboolean (*mutex_trylock) (GMutex *mutex); void (*mutex_unlock) (GMutex *mutex); void (*mutex_free) (GMutex *mutex); GCond* (*cond_new) (void); void (*cond_signal) (GCond *cond); void (*cond_broadcast) (GCond *cond); void (*cond_wait) (GCond *cond, GMutex *mutex); gboolean (*cond_timed_wait) (GCond *cond, GMutex *mutex, GTimeVal *end_time); void (*cond_free) (GCond *cond); GPrivate* (*private_new) (GDestroyNotify destructor); gpointer (*private_get) (GPrivate *private_key); void (*private_set) (GPrivate *private_key, gpointer data); void (*thread_create) (GThreadFunc func, gpointer data, gulong stack_size, gboolean joinable, gboolean bound, GThreadPriority priority, gpointer thread, GError **error); void (*thread_yield) (void); void (*thread_join) (gpointer thread); void (*thread_exit) (void); void (*thread_set_priority)(gpointer thread, GThreadPriority priority); void (*thread_self) (gpointer thread); gboolean (*thread_equal) (gpointer thread1, gpointer thread2); } GLIB_DEPRECATED_TYPE_IN_2_32; GLIB_VAR GThreadFunctions g_thread_functions_for_glib_use; GLIB_VAR gboolean g_thread_use_default_impl; GLIB_VAR guint64 (*g_thread_gettime) (void); GLIB_DEPRECATED_IN_2_32_FOR(g_thread_new) GThread *g_thread_create (GThreadFunc func, gpointer data, gboolean joinable, GError **error); GLIB_DEPRECATED_IN_2_32_FOR(g_thread_new) GThread *g_thread_create_full (GThreadFunc func, gpointer data, gulong stack_size, gboolean joinable, gboolean bound, GThreadPriority priority, GError **error); GLIB_DEPRECATED_IN_2_32 void g_thread_set_priority (GThread *thread, GThreadPriority priority); GLIB_DEPRECATED_IN_2_32 void g_thread_foreach (GFunc thread_func, gpointer user_data); #ifndef G_OS_WIN32 #include <sys/types.h> #include <pthread.h> #endif #define g_static_mutex_get_mutex g_static_mutex_get_mutex_impl GLIB_DEPRECATED_MACRO_IN_2_32 #define G_STATIC_MUTEX_INIT { NULL } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_mutex_init) typedef struct { GMutex *mutex; #ifndef G_OS_WIN32 /* only for ABI compatibility reasons */ pthread_mutex_t unused; #endif } GStaticMutex GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GMutex); #define g_static_mutex_lock(mutex) \ g_mutex_lock (g_static_mutex_get_mutex (mutex)) GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_mutex_lock) #define g_static_mutex_trylock(mutex) \ g_mutex_trylock (g_static_mutex_get_mutex (mutex)) GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_mutex_trylock) #define g_static_mutex_unlock(mutex) \ g_mutex_unlock (g_static_mutex_get_mutex (mutex)) GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_mutex_unlock) GLIB_DEPRECATED_IN_2_32_FOR(g_mutex_init) void g_static_mutex_init (GStaticMutex *mutex); GLIB_DEPRECATED_IN_2_32_FOR(g_mutex_clear) void g_static_mutex_free (GStaticMutex *mutex); GLIB_DEPRECATED_IN_2_32_FOR(GMutex) GMutex *g_static_mutex_get_mutex_impl (GStaticMutex *mutex); typedef struct _GStaticRecMutex GStaticRecMutex GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRecMutex); struct _GStaticRecMutex { /*< private >*/ GStaticMutex mutex; guint depth; /* ABI compat only */ union { #ifdef G_OS_WIN32 void *owner; #else pthread_t owner; #endif gdouble dummy; } unused; } GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRecMutex); #define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT, 0, { 0 } } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_rec_mutex_init) GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_init) void g_static_rec_mutex_init (GStaticRecMutex *mutex); GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_lock) void g_static_rec_mutex_lock (GStaticRecMutex *mutex); GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_try_lock) gboolean g_static_rec_mutex_trylock (GStaticRecMutex *mutex); GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_unlock) void g_static_rec_mutex_unlock (GStaticRecMutex *mutex); GLIB_DEPRECATED_IN_2_32 void g_static_rec_mutex_lock_full (GStaticRecMutex *mutex, guint depth); GLIB_DEPRECATED_IN_2_32 guint g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex); GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_free) void g_static_rec_mutex_free (GStaticRecMutex *mutex); typedef struct _GStaticRWLock GStaticRWLock GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRWLock); struct _GStaticRWLock { /*< private >*/ GStaticMutex mutex; GCond *read_cond; GCond *write_cond; guint read_counter; gboolean have_writer; guint want_to_read; guint want_to_write; } GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRWLock); #define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, 0, 0 } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_rw_lock_init) GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_init) void g_static_rw_lock_init (GStaticRWLock *lock); GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_lock) void g_static_rw_lock_reader_lock (GStaticRWLock *lock); GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_trylock) gboolean g_static_rw_lock_reader_trylock (GStaticRWLock *lock); GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_unlock) void g_static_rw_lock_reader_unlock (GStaticRWLock *lock); GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_lock) void g_static_rw_lock_writer_lock (GStaticRWLock *lock); GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_trylock) gboolean g_static_rw_lock_writer_trylock (GStaticRWLock *lock); GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_unlock) void g_static_rw_lock_writer_unlock (GStaticRWLock *lock); GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_free) void g_static_rw_lock_free (GStaticRWLock *lock); GLIB_DEPRECATED_IN_2_32 GPrivate * g_private_new (GDestroyNotify notify); typedef struct _GStaticPrivate GStaticPrivate GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GPrivate); struct _GStaticPrivate { /*< private >*/ guint index; } GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GPrivate); #define G_STATIC_PRIVATE_INIT { 0 } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(G_PRIVATE_INIT) GLIB_DEPRECATED_IN_2_32 void g_static_private_init (GStaticPrivate *private_key); GLIB_DEPRECATED_IN_2_32_FOR(g_private_get) gpointer g_static_private_get (GStaticPrivate *private_key); GLIB_DEPRECATED_IN_2_32_FOR(g_private_set) void g_static_private_set (GStaticPrivate *private_key, gpointer data, GDestroyNotify notify); GLIB_DEPRECATED_IN_2_32 void g_static_private_free (GStaticPrivate *private_key); GLIB_DEPRECATED_IN_2_32 gboolean g_once_init_enter_impl (volatile gsize *location); GLIB_DEPRECATED_IN_2_32 void g_thread_init (gpointer vtable); GLIB_DEPRECATED_IN_2_32 void g_thread_init_with_errorcheck_mutexes (gpointer vtable); GLIB_DEPRECATED_IN_2_32 gboolean g_thread_get_initialized (void); GLIB_VAR gboolean g_threads_got_initialized; #define g_thread_supported() (1) GLIB_DEPRECATED_MACRO_IN_2_32 GLIB_DEPRECATED_IN_2_32 GMutex * g_mutex_new (void); GLIB_DEPRECATED_IN_2_32 void g_mutex_free (GMutex *mutex); GLIB_DEPRECATED_IN_2_32 GCond * g_cond_new (void); GLIB_DEPRECATED_IN_2_32 void g_cond_free (GCond *cond); GLIB_DEPRECATED_IN_2_32 gboolean g_cond_timed_wait (GCond *cond, GMutex *mutex, GTimeVal *timeval); G_GNUC_END_IGNORE_DEPRECATIONS G_END_DECLS #endif /* __G_DEPRECATED_THREAD_H__ */ PK �w[��F�e e gdataset.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_DATASET_H__ #define __G_DATASET_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gquark.h> G_BEGIN_DECLS typedef struct _GData GData; typedef void (*GDataForeachFunc) (GQuark key_id, gpointer data, gpointer user_data); /* Keyed Data List */ GLIB_AVAILABLE_IN_ALL void g_datalist_init (GData **datalist); GLIB_AVAILABLE_IN_ALL void g_datalist_clear (GData **datalist); GLIB_AVAILABLE_IN_ALL gpointer g_datalist_id_get_data (GData **datalist, GQuark key_id); GLIB_AVAILABLE_IN_ALL void g_datalist_id_set_data_full (GData **datalist, GQuark key_id, gpointer data, GDestroyNotify destroy_func); typedef gpointer (*GDuplicateFunc) (gpointer data, gpointer user_data); GLIB_AVAILABLE_IN_2_34 gpointer g_datalist_id_dup_data (GData **datalist, GQuark key_id, GDuplicateFunc dup_func, gpointer user_data); GLIB_AVAILABLE_IN_2_34 gboolean g_datalist_id_replace_data (GData **datalist, GQuark key_id, gpointer oldval, gpointer newval, GDestroyNotify destroy, GDestroyNotify *old_destroy); GLIB_AVAILABLE_IN_ALL gpointer g_datalist_id_remove_no_notify (GData **datalist, GQuark key_id); GLIB_AVAILABLE_IN_ALL void g_datalist_foreach (GData **datalist, GDataForeachFunc func, gpointer user_data); /** * G_DATALIST_FLAGS_MASK: * * A bitmask that restricts the possible flags passed to * g_datalist_set_flags(). Passing a flags value where * flags & ~G_DATALIST_FLAGS_MASK != 0 is an error. */ #define G_DATALIST_FLAGS_MASK 0x3 GLIB_AVAILABLE_IN_ALL void g_datalist_set_flags (GData **datalist, guint flags); GLIB_AVAILABLE_IN_ALL void g_datalist_unset_flags (GData **datalist, guint flags); GLIB_AVAILABLE_IN_ALL guint g_datalist_get_flags (GData **datalist); #define g_datalist_id_set_data(dl, q, d) \ g_datalist_id_set_data_full ((dl), (q), (d), NULL) #define g_datalist_id_remove_data(dl, q) \ g_datalist_id_set_data ((dl), (q), NULL) #define g_datalist_set_data_full(dl, k, d, f) \ g_datalist_id_set_data_full ((dl), g_quark_from_string (k), (d), (f)) #define g_datalist_remove_no_notify(dl, k) \ g_datalist_id_remove_no_notify ((dl), g_quark_try_string (k)) #define g_datalist_set_data(dl, k, d) \ g_datalist_set_data_full ((dl), (k), (d), NULL) #define g_datalist_remove_data(dl, k) \ g_datalist_id_set_data ((dl), g_quark_try_string (k), NULL) /* Location Associated Keyed Data */ GLIB_AVAILABLE_IN_ALL void g_dataset_destroy (gconstpointer dataset_location); GLIB_AVAILABLE_IN_ALL gpointer g_dataset_id_get_data (gconstpointer dataset_location, GQuark key_id); GLIB_AVAILABLE_IN_ALL gpointer g_datalist_get_data (GData **datalist, const gchar *key); GLIB_AVAILABLE_IN_ALL void g_dataset_id_set_data_full (gconstpointer dataset_location, GQuark key_id, gpointer data, GDestroyNotify destroy_func); GLIB_AVAILABLE_IN_ALL gpointer g_dataset_id_remove_no_notify (gconstpointer dataset_location, GQuark key_id); GLIB_AVAILABLE_IN_ALL void g_dataset_foreach (gconstpointer dataset_location, GDataForeachFunc func, gpointer user_data); #define g_dataset_id_set_data(l, k, d) \ g_dataset_id_set_data_full ((l), (k), (d), NULL) #define g_dataset_id_remove_data(l, k) \ g_dataset_id_set_data ((l), (k), NULL) #define g_dataset_get_data(l, k) \ (g_dataset_id_get_data ((l), g_quark_try_string (k))) #define g_dataset_set_data_full(l, k, d, f) \ g_dataset_id_set_data_full ((l), g_quark_from_string (k), (d), (f)) #define g_dataset_remove_no_notify(l, k) \ g_dataset_id_remove_no_notify ((l), g_quark_try_string (k)) #define g_dataset_set_data(l, k, d) \ g_dataset_set_data_full ((l), (k), (d), NULL) #define g_dataset_remove_data(l, k) \ g_dataset_id_set_data ((l), g_quark_try_string (k), NULL) G_END_DECLS #endif /* __G_DATASET_H__ */ PK �w[��%�0 �0 gdate.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_DATE_H__ #define __G_DATE_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <time.h> #include <glib/gtypes.h> #include <glib/gquark.h> G_BEGIN_DECLS /* GDate * * Date calculations (not time for now, to be resolved). These are a * mutant combination of Steffen Beyer's DateCalc routines * (http://www.perl.com/CPAN/authors/id/STBEY/) and Jon Trowbridge's * date routines (written for in-house software). Written by Havoc * Pennington <hp@pobox.com> */ typedef gint32 GTime GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime); typedef guint16 GDateYear; typedef guint8 GDateDay; /* day of the month */ typedef struct _GDate GDate; /* enum used to specify order of appearance in parsed date strings */ typedef enum { G_DATE_DAY = 0, G_DATE_MONTH = 1, G_DATE_YEAR = 2 } GDateDMY; /* actual week and month values */ typedef enum { G_DATE_BAD_WEEKDAY = 0, G_DATE_MONDAY = 1, G_DATE_TUESDAY = 2, G_DATE_WEDNESDAY = 3, G_DATE_THURSDAY = 4, G_DATE_FRIDAY = 5, G_DATE_SATURDAY = 6, G_DATE_SUNDAY = 7 } GDateWeekday; typedef enum { G_DATE_BAD_MONTH = 0, G_DATE_JANUARY = 1, G_DATE_FEBRUARY = 2, G_DATE_MARCH = 3, G_DATE_APRIL = 4, G_DATE_MAY = 5, G_DATE_JUNE = 6, G_DATE_JULY = 7, G_DATE_AUGUST = 8, G_DATE_SEPTEMBER = 9, G_DATE_OCTOBER = 10, G_DATE_NOVEMBER = 11, G_DATE_DECEMBER = 12 } GDateMonth; #define G_DATE_BAD_JULIAN 0U #define G_DATE_BAD_DAY 0U #define G_DATE_BAD_YEAR 0U /* Note: directly manipulating structs is generally a bad idea, but * in this case it's an *incredibly* bad idea, because all or part * of this struct can be invalid at any given time. Use the functions, * or you will get hosed, I promise. */ struct _GDate { guint julian_days : 32; /* julian days representation - we use a * bitfield hoping that 64 bit platforms * will pack this whole struct in one big * int */ guint julian : 1; /* julian is valid */ guint dmy : 1; /* dmy is valid */ /* DMY representation */ guint day : 6; guint month : 4; guint year : 16; }; /* g_date_new() returns an invalid date, you then have to _set() stuff * to get a usable object. You can also allocate a GDate statically, * then call g_date_clear() to initialize. */ GLIB_AVAILABLE_IN_ALL GDate* g_date_new (void); GLIB_AVAILABLE_IN_ALL GDate* g_date_new_dmy (GDateDay day, GDateMonth month, GDateYear year); GLIB_AVAILABLE_IN_ALL GDate* g_date_new_julian (guint32 julian_day); GLIB_AVAILABLE_IN_ALL void g_date_free (GDate *date); GLIB_AVAILABLE_IN_2_56 GDate* g_date_copy (const GDate *date); /* check g_date_valid() after doing an operation that might fail, like * _parse. Almost all g_date operations are undefined on invalid * dates (the exceptions are the mutators, since you need those to * return to validity). */ GLIB_AVAILABLE_IN_ALL gboolean g_date_valid (const GDate *date); GLIB_AVAILABLE_IN_ALL gboolean g_date_valid_day (GDateDay day) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL gboolean g_date_valid_month (GDateMonth month) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL gboolean g_date_valid_year (GDateYear year) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL gboolean g_date_valid_weekday (GDateWeekday weekday) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL gboolean g_date_valid_julian (guint32 julian_date) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL gboolean g_date_valid_dmy (GDateDay day, GDateMonth month, GDateYear year) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GDateWeekday g_date_get_weekday (const GDate *date); GLIB_AVAILABLE_IN_ALL GDateMonth g_date_get_month (const GDate *date); GLIB_AVAILABLE_IN_ALL GDateYear g_date_get_year (const GDate *date); GLIB_AVAILABLE_IN_ALL GDateDay g_date_get_day (const GDate *date); GLIB_AVAILABLE_IN_ALL guint32 g_date_get_julian (const GDate *date); GLIB_AVAILABLE_IN_ALL guint g_date_get_day_of_year (const GDate *date); /* First monday/sunday is the start of week 1; if we haven't reached * that day, return 0. These are not ISO weeks of the year; that * routine needs to be added. * these functions return the number of weeks, starting on the * corrsponding day */ GLIB_AVAILABLE_IN_ALL guint g_date_get_monday_week_of_year (const GDate *date); GLIB_AVAILABLE_IN_ALL guint g_date_get_sunday_week_of_year (const GDate *date); GLIB_AVAILABLE_IN_ALL guint g_date_get_iso8601_week_of_year (const GDate *date); /* If you create a static date struct you need to clear it to get it * in a safe state before use. You can clear a whole array at * once with the ndates argument. */ GLIB_AVAILABLE_IN_ALL void g_date_clear (GDate *date, guint n_dates); /* The parse routine is meant for dates typed in by a user, so it * permits many formats but tries to catch common typos. If your data * needs to be strictly validated, it is not an appropriate function. */ GLIB_AVAILABLE_IN_ALL void g_date_set_parse (GDate *date, const gchar *str); GLIB_AVAILABLE_IN_ALL void g_date_set_time_t (GDate *date, time_t timet); G_GNUC_BEGIN_IGNORE_DEPRECATIONS GLIB_DEPRECATED_IN_2_62_FOR(g_date_set_time_t) void g_date_set_time_val (GDate *date, GTimeVal *timeval); GLIB_DEPRECATED_FOR(g_date_set_time_t) void g_date_set_time (GDate *date, GTime time_); G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_ALL void g_date_set_month (GDate *date, GDateMonth month); GLIB_AVAILABLE_IN_ALL void g_date_set_day (GDate *date, GDateDay day); GLIB_AVAILABLE_IN_ALL void g_date_set_year (GDate *date, GDateYear year); GLIB_AVAILABLE_IN_ALL void g_date_set_dmy (GDate *date, GDateDay day, GDateMonth month, GDateYear y); GLIB_AVAILABLE_IN_ALL void g_date_set_julian (GDate *date, guint32 julian_date); GLIB_AVAILABLE_IN_ALL gboolean g_date_is_first_of_month (const GDate *date); GLIB_AVAILABLE_IN_ALL gboolean g_date_is_last_of_month (const GDate *date); /* To go forward by some number of weeks just go forward weeks*7 days */ GLIB_AVAILABLE_IN_ALL void g_date_add_days (GDate *date, guint n_days); GLIB_AVAILABLE_IN_ALL void g_date_subtract_days (GDate *date, guint n_days); /* If you add/sub months while day > 28, the day might change */ GLIB_AVAILABLE_IN_ALL void g_date_add_months (GDate *date, guint n_months); GLIB_AVAILABLE_IN_ALL void g_date_subtract_months (GDate *date, guint n_months); /* If it's feb 29, changing years can move you to the 28th */ GLIB_AVAILABLE_IN_ALL void g_date_add_years (GDate *date, guint n_years); GLIB_AVAILABLE_IN_ALL void g_date_subtract_years (GDate *date, guint n_years); GLIB_AVAILABLE_IN_ALL gboolean g_date_is_leap_year (GDateYear year) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL guint8 g_date_get_days_in_month (GDateMonth month, GDateYear year) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL guint8 g_date_get_monday_weeks_in_year (GDateYear year) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL guint8 g_date_get_sunday_weeks_in_year (GDateYear year) G_GNUC_CONST; /* Returns the number of days between the two dates. If date2 comes before date1, a negative value is return. */ GLIB_AVAILABLE_IN_ALL gint g_date_days_between (const GDate *date1, const GDate *date2); /* qsort-friendly (with a cast...) */ GLIB_AVAILABLE_IN_ALL gint g_date_compare (const GDate *lhs, const GDate *rhs); GLIB_AVAILABLE_IN_ALL void g_date_to_struct_tm (const GDate *date, struct tm *tm); GLIB_AVAILABLE_IN_ALL void g_date_clamp (GDate *date, const GDate *min_date, const GDate *max_date); /* Swap date1 and date2's values if date1 > date2. */ GLIB_AVAILABLE_IN_ALL void g_date_order (GDate *date1, GDate *date2); /* Just like strftime() except you can only use date-related formats. * Using a time format is undefined. */ GLIB_AVAILABLE_IN_ALL gsize g_date_strftime (gchar *s, gsize slen, const gchar *format, const GDate *date); #define g_date_weekday g_date_get_weekday GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_weekday) #define g_date_month g_date_get_month GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_month) #define g_date_year g_date_get_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_year) #define g_date_day g_date_get_day GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_day) #define g_date_julian g_date_get_julian GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_julian) #define g_date_day_of_year g_date_get_day_of_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_day_of_year) #define g_date_monday_week_of_year g_date_get_monday_week_of_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_monday_week_of_year) #define g_date_sunday_week_of_year g_date_get_sunday_week_of_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_sunday_week_of_year) #define g_date_days_in_month g_date_get_days_in_month GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_days_in_month) #define g_date_monday_weeks_in_year g_date_get_monday_weeks_in_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_monday_weeks_in_year) #define g_date_sunday_weeks_in_year g_date_get_sunday_weeks_in_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_sunday_weeks_in_year) G_END_DECLS #endif /* __G_DATE_H__ */ PK �w[�ܸW�1 �1 gdatetime.hnu �[��� /* * Copyright (C) 2009-2010 Christian Hergert <chris@dronelabs.com> * Copyright © 2010 Codethink Limited * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of the * licence, or (at your option) any later version. * * This is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, see <http://www.gnu.org/licenses/>. * * Authors: Christian Hergert <chris@dronelabs.com> * Thiago Santos <thiago.sousa.santos@collabora.co.uk> * Emmanuele Bassi <ebassi@linux.intel.com> * Ryan Lortie <desrt@desrt.ca> */ #ifndef __G_DATE_TIME_H__ #define __G_DATE_TIME_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gtimezone.h> G_BEGIN_DECLS /** * G_TIME_SPAN_DAY: * * Evaluates to a time span of one day. * * Since: 2.26 */ #define G_TIME_SPAN_DAY (G_GINT64_CONSTANT (86400000000)) /** * G_TIME_SPAN_HOUR: * * Evaluates to a time span of one hour. * * Since: 2.26 */ #define G_TIME_SPAN_HOUR (G_GINT64_CONSTANT (3600000000)) /** * G_TIME_SPAN_MINUTE: * * Evaluates to a time span of one minute. * * Since: 2.26 */ #define G_TIME_SPAN_MINUTE (G_GINT64_CONSTANT (60000000)) /** * G_TIME_SPAN_SECOND: * * Evaluates to a time span of one second. * * Since: 2.26 */ #define G_TIME_SPAN_SECOND (G_GINT64_CONSTANT (1000000)) /** * G_TIME_SPAN_MILLISECOND: * * Evaluates to a time span of one millisecond. * * Since: 2.26 */ #define G_TIME_SPAN_MILLISECOND (G_GINT64_CONSTANT (1000)) /** * GTimeSpan: * * A value representing an interval of time, in microseconds. * * Since: 2.26 */ typedef gint64 GTimeSpan; /** * GDateTime: * * `GDateTime` is an opaque structure whose members * cannot be accessed directly. * * Since: 2.26 */ typedef struct _GDateTime GDateTime; GLIB_AVAILABLE_IN_ALL void g_date_time_unref (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_ref (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_new_now (GTimeZone *tz); GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_new_now_local (void); GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_new_now_utc (void); GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_new_from_unix_local (gint64 t); GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_new_from_unix_utc (gint64 t); G_GNUC_BEGIN_IGNORE_DEPRECATIONS GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_new_from_unix_local) GDateTime * g_date_time_new_from_timeval_local (const GTimeVal *tv); GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_new_from_unix_utc) GDateTime * g_date_time_new_from_timeval_utc (const GTimeVal *tv); G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_2_56 GDateTime * g_date_time_new_from_iso8601 (const gchar *text, GTimeZone *default_tz); GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_new (GTimeZone *tz, gint year, gint month, gint day, gint hour, gint minute, gdouble seconds); GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_new_local (gint year, gint month, gint day, gint hour, gint minute, gdouble seconds); GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_new_utc (gint year, gint month, gint day, gint hour, gint minute, gdouble seconds); GLIB_AVAILABLE_IN_ALL G_GNUC_WARN_UNUSED_RESULT GDateTime * g_date_time_add (GDateTime *datetime, GTimeSpan timespan); GLIB_AVAILABLE_IN_ALL G_GNUC_WARN_UNUSED_RESULT GDateTime * g_date_time_add_years (GDateTime *datetime, gint years); GLIB_AVAILABLE_IN_ALL G_GNUC_WARN_UNUSED_RESULT GDateTime * g_date_time_add_months (GDateTime *datetime, gint months); GLIB_AVAILABLE_IN_ALL G_GNUC_WARN_UNUSED_RESULT GDateTime * g_date_time_add_weeks (GDateTime *datetime, gint weeks); GLIB_AVAILABLE_IN_ALL G_GNUC_WARN_UNUSED_RESULT GDateTime * g_date_time_add_days (GDateTime *datetime, gint days); GLIB_AVAILABLE_IN_ALL G_GNUC_WARN_UNUSED_RESULT GDateTime * g_date_time_add_hours (GDateTime *datetime, gint hours); GLIB_AVAILABLE_IN_ALL G_GNUC_WARN_UNUSED_RESULT GDateTime * g_date_time_add_minutes (GDateTime *datetime, gint minutes); GLIB_AVAILABLE_IN_ALL G_GNUC_WARN_UNUSED_RESULT GDateTime * g_date_time_add_seconds (GDateTime *datetime, gdouble seconds); GLIB_AVAILABLE_IN_ALL G_GNUC_WARN_UNUSED_RESULT GDateTime * g_date_time_add_full (GDateTime *datetime, gint years, gint months, gint days, gint hours, gint minutes, gdouble seconds); GLIB_AVAILABLE_IN_ALL gint g_date_time_compare (gconstpointer dt1, gconstpointer dt2); GLIB_AVAILABLE_IN_ALL GTimeSpan g_date_time_difference (GDateTime *end, GDateTime *begin); GLIB_AVAILABLE_IN_ALL guint g_date_time_hash (gconstpointer datetime); GLIB_AVAILABLE_IN_ALL gboolean g_date_time_equal (gconstpointer dt1, gconstpointer dt2); GLIB_AVAILABLE_IN_ALL void g_date_time_get_ymd (GDateTime *datetime, gint *year, gint *month, gint *day); GLIB_AVAILABLE_IN_ALL gint g_date_time_get_year (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL gint g_date_time_get_month (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL gint g_date_time_get_day_of_month (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL gint g_date_time_get_week_numbering_year (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL gint g_date_time_get_week_of_year (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL gint g_date_time_get_day_of_week (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL gint g_date_time_get_day_of_year (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL gint g_date_time_get_hour (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL gint g_date_time_get_minute (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL gint g_date_time_get_second (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL gint g_date_time_get_microsecond (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL gdouble g_date_time_get_seconds (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL gint64 g_date_time_to_unix (GDateTime *datetime); G_GNUC_BEGIN_IGNORE_DEPRECATIONS GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_to_unix) gboolean g_date_time_to_timeval (GDateTime *datetime, GTimeVal *tv); G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_ALL GTimeSpan g_date_time_get_utc_offset (GDateTime *datetime); GLIB_AVAILABLE_IN_2_58 GTimeZone * g_date_time_get_timezone (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL const gchar * g_date_time_get_timezone_abbreviation (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL gboolean g_date_time_is_daylight_savings (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_to_timezone (GDateTime *datetime, GTimeZone *tz); GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_to_local (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_to_utc (GDateTime *datetime); GLIB_AVAILABLE_IN_ALL gchar * g_date_time_format (GDateTime *datetime, const gchar *format) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_2_62 gchar * g_date_time_format_iso8601 (GDateTime *datetime) G_GNUC_MALLOC; G_END_DECLS #endif /* __G_DATE_TIME_H__ */ PK �w[^�!�i i gdir.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * gdir.c: Simplified wrapper around the DIRENT functions. * * Copyright 2001 Hans Breuer * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __G_DIR_H__ #define __G_DIR_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gerror.h> #ifdef G_OS_UNIX #include <dirent.h> #endif G_BEGIN_DECLS typedef struct _GDir GDir; GLIB_AVAILABLE_IN_ALL GDir * g_dir_open (const gchar *path, guint flags, GError **error); GLIB_AVAILABLE_IN_ALL const gchar * g_dir_read_name (GDir *dir); GLIB_AVAILABLE_IN_ALL void g_dir_rewind (GDir *dir); GLIB_AVAILABLE_IN_ALL void g_dir_close (GDir *dir); G_END_DECLS #endif /* __G_DIR_H__ */ PK �w[�X��< < genviron.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_ENVIRON_H__ #define __G_ENVIRON_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gtypes.h> G_BEGIN_DECLS GLIB_AVAILABLE_IN_ALL const gchar * g_getenv (const gchar *variable); GLIB_AVAILABLE_IN_ALL gboolean g_setenv (const gchar *variable, const gchar *value, gboolean overwrite); GLIB_AVAILABLE_IN_ALL void g_unsetenv (const gchar *variable); GLIB_AVAILABLE_IN_ALL gchar ** g_listenv (void); GLIB_AVAILABLE_IN_ALL gchar ** g_get_environ (void); GLIB_AVAILABLE_IN_ALL const gchar * g_environ_getenv (gchar **envp, const gchar *variable); GLIB_AVAILABLE_IN_ALL gchar ** g_environ_setenv (gchar **envp, const gchar *variable, const gchar *value, gboolean overwrite) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL gchar ** g_environ_unsetenv (gchar **envp, const gchar *variable) G_GNUC_WARN_UNUSED_RESULT; G_END_DECLS #endif /* __G_ENVIRON_H__ */ PK �w[;M��+ �+ gerror.hnu �[��� /* gerror.h - Error reporting system * * Copyright 2000 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __G_ERROR_H__ #define __G_ERROR_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <stdarg.h> #include <glib/gquark.h> G_BEGIN_DECLS /** * GError: * @domain: error domain, e.g. #G_FILE_ERROR * @code: error code, e.g. %G_FILE_ERROR_NOENT * @message: human-readable informative error message * * The `GError` structure contains information about * an error that has occurred. */ typedef struct _GError GError; struct _GError { GQuark domain; gint code; gchar *message; }; /** * G_DEFINE_EXTENDED_ERROR: * @ErrorType: name to return a #GQuark for * @error_type: prefix for the function name * * A convenience macro which defines two functions. First, returning * the #GQuark for the extended error type @ErrorType; it is called * `error_type_quark()`. Second, returning the private data from a * passed #GError; it is called `error_type_get_private()`. * * For this macro to work, a type named `ErrorTypePrivate` should be * defined, `error_type_private_init()`, `error_type_private_copy()` * and `error_type_private_clear()` functions need to be either * declared or defined. The functions should be similar to * #GErrorInitFunc, #GErrorCopyFunc and #GErrorClearFunc, * respectively, but they should receive the private data type instead * of #GError. * * See [Extended #GError Domains][gerror-extended-domains] for an example. * * Since: 2.68 */ #define G_DEFINE_EXTENDED_ERROR(ErrorType, error_type) \ static inline ErrorType ## Private * \ error_type ## _get_private (const GError *error) \ { \ /* Copied from gtype.c (STRUCT_ALIGNMENT and ALIGN_STRUCT macros). */ \ const gsize sa = 2 * sizeof (gsize); \ const gsize as = (sizeof (ErrorType ## Private) + (sa - 1)) & -sa; \ g_return_val_if_fail (error != NULL, NULL); \ g_return_val_if_fail (error->domain == error_type ## _quark (), NULL); \ return (ErrorType ## Private *) (((guint8 *)error) - as); \ } \ \ static void \ g_error_with_ ## error_type ## _private_init (GError *error) \ { \ ErrorType ## Private *priv = error_type ## _get_private (error); \ error_type ## _private_init (priv); \ } \ \ static void \ g_error_with_ ## error_type ## _private_copy (const GError *src_error, \ GError *dest_error) \ { \ const ErrorType ## Private *src_priv = error_type ## _get_private (src_error); \ ErrorType ## Private *dest_priv = error_type ## _get_private (dest_error); \ error_type ## _private_copy (src_priv, dest_priv); \ } \ \ static void \ g_error_with_ ## error_type ## _private_clear (GError *error) \ { \ ErrorType ## Private *priv = error_type ## _get_private (error); \ error_type ## _private_clear (priv); \ } \ \ GQuark \ error_type ## _quark (void) \ { \ static GQuark q; \ static gsize initialized = 0; \ \ if (g_once_init_enter (&initialized)) \ { \ q = g_error_domain_register_static (#ErrorType, \ sizeof (ErrorType ## Private), \ g_error_with_ ## error_type ## _private_init, \ g_error_with_ ## error_type ## _private_copy, \ g_error_with_ ## error_type ## _private_clear); \ g_once_init_leave (&initialized, 1); \ } \ \ return q; \ } /** * GErrorInitFunc: * @error: extended error * * Specifies the type of function which is called just after an * extended error instance is created and its fields filled. It should * only initialize the fields in the private data, which can be * received with the generated `*_get_private()` function. * * Normally, it is better to use G_DEFINE_EXTENDED_ERROR(), as it * already takes care of getting the private data from @error. * * Since: 2.68 */ typedef void (*GErrorInitFunc) (GError *error); /** * GErrorCopyFunc: * @src_error: source extended error * @dest_error: destination extended error * * Specifies the type of function which is called when an extended * error instance is copied. It is passed the pointer to the * destination error and source error, and should copy only the fields * of the private data from @src_error to @dest_error. * * Normally, it is better to use G_DEFINE_EXTENDED_ERROR(), as it * already takes care of getting the private data from @src_error and * @dest_error. * * Since: 2.68 */ typedef void (*GErrorCopyFunc) (const GError *src_error, GError *dest_error); /** * GErrorClearFunc: * @error: extended error to clear * * Specifies the type of function which is called when an extended * error instance is freed. It is passed the error pointer about to be * freed, and should free the error's private data fields. * * Normally, it is better to use G_DEFINE_EXTENDED_ERROR(), as it * already takes care of getting the private data from @error. * * Since: 2.68 */ typedef void (*GErrorClearFunc) (GError *error); GLIB_AVAILABLE_IN_2_68 GQuark g_error_domain_register_static (const char *error_type_name, gsize error_type_private_size, GErrorInitFunc error_type_init, GErrorCopyFunc error_type_copy, GErrorClearFunc error_type_clear); GLIB_AVAILABLE_IN_2_68 GQuark g_error_domain_register (const char *error_type_name, gsize error_type_private_size, GErrorInitFunc error_type_init, GErrorCopyFunc error_type_copy, GErrorClearFunc error_type_clear); GLIB_AVAILABLE_IN_ALL GError* g_error_new (GQuark domain, gint code, const gchar *format, ...) G_GNUC_PRINTF (3, 4); GLIB_AVAILABLE_IN_ALL GError* g_error_new_literal (GQuark domain, gint code, const gchar *message); GLIB_AVAILABLE_IN_ALL GError* g_error_new_valist (GQuark domain, gint code, const gchar *format, va_list args) G_GNUC_PRINTF(3, 0); GLIB_AVAILABLE_IN_ALL void g_error_free (GError *error); GLIB_AVAILABLE_IN_ALL GError* g_error_copy (const GError *error); GLIB_AVAILABLE_IN_ALL gboolean g_error_matches (const GError *error, GQuark domain, gint code); /* if (err) *err = g_error_new(domain, code, format, ...), also has * some sanity checks. */ GLIB_AVAILABLE_IN_ALL void g_set_error (GError **err, GQuark domain, gint code, const gchar *format, ...) G_GNUC_PRINTF (4, 5); GLIB_AVAILABLE_IN_ALL void g_set_error_literal (GError **err, GQuark domain, gint code, const gchar *message); /* if (dest) *dest = src; also has some sanity checks. */ GLIB_AVAILABLE_IN_ALL void g_propagate_error (GError **dest, GError *src); /* if (err && *err) { g_error_free(*err); *err = NULL; } */ GLIB_AVAILABLE_IN_ALL void g_clear_error (GError **err); /* if (err) prefix the formatted string to the ->message */ GLIB_AVAILABLE_IN_ALL void g_prefix_error (GError **err, const gchar *format, ...) G_GNUC_PRINTF (2, 3); /* g_propagate_error then g_error_prefix on dest */ GLIB_AVAILABLE_IN_ALL void g_propagate_prefixed_error (GError **dest, GError *src, const gchar *format, ...) G_GNUC_PRINTF (3, 4); G_END_DECLS #endif /* __G_ERROR_H__ */ PK �w[�1� � gfileutils.hnu �[��� /* gfileutils.h - File utility functions * * Copyright 2000 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __G_FILEUTILS_H__ #define __G_FILEUTILS_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glibconfig.h> #include <glib/gerror.h> G_BEGIN_DECLS #define G_FILE_ERROR g_file_error_quark () typedef enum { G_FILE_ERROR_EXIST, G_FILE_ERROR_ISDIR, G_FILE_ERROR_ACCES, G_FILE_ERROR_NAMETOOLONG, G_FILE_ERROR_NOENT, G_FILE_ERROR_NOTDIR, G_FILE_ERROR_NXIO, G_FILE_ERROR_NODEV, G_FILE_ERROR_ROFS, G_FILE_ERROR_TXTBSY, G_FILE_ERROR_FAULT, G_FILE_ERROR_LOOP, G_FILE_ERROR_NOSPC, G_FILE_ERROR_NOMEM, G_FILE_ERROR_MFILE, G_FILE_ERROR_NFILE, G_FILE_ERROR_BADF, G_FILE_ERROR_INVAL, G_FILE_ERROR_PIPE, G_FILE_ERROR_AGAIN, G_FILE_ERROR_INTR, G_FILE_ERROR_IO, G_FILE_ERROR_PERM, G_FILE_ERROR_NOSYS, G_FILE_ERROR_FAILED } GFileError; /* For backward-compat reasons, these are synced to an old * anonymous enum in libgnome. But don't use that enum * in new code. */ typedef enum { G_FILE_TEST_IS_REGULAR = 1 << 0, G_FILE_TEST_IS_SYMLINK = 1 << 1, G_FILE_TEST_IS_DIR = 1 << 2, G_FILE_TEST_IS_EXECUTABLE = 1 << 3, G_FILE_TEST_EXISTS = 1 << 4 } GFileTest; /** * GFileSetContentsFlags: * @G_FILE_SET_CONTENTS_NONE: No guarantees about file consistency or durability. * The most dangerous setting, which is slightly faster than other settings. * @G_FILE_SET_CONTENTS_CONSISTENT: Guarantee file consistency: after a crash, * either the old version of the file or the new version of the file will be * available, but not a mixture. On Unix systems this equates to an `fsync()` * on the file and use of an atomic `rename()` of the new version of the file * over the old. * @G_FILE_SET_CONTENTS_DURABLE: Guarantee file durability: after a crash, the * new version of the file will be available. On Unix systems this equates to * an `fsync()` on the file (if %G_FILE_SET_CONTENTS_CONSISTENT is unset), or * the effects of %G_FILE_SET_CONTENTS_CONSISTENT plus an `fsync()` on the * directory containing the file after calling `rename()`. * @G_FILE_SET_CONTENTS_ONLY_EXISTING: Only apply consistency and durability * guarantees if the file already exists. This may speed up file operations * if the file doesn’t currently exist, but may result in a corrupted version * of the new file if the system crashes while writing it. * * Flags to pass to g_file_set_contents_full() to affect its safety and * performance. * * Since: 2.66 */ typedef enum { G_FILE_SET_CONTENTS_NONE = 0, G_FILE_SET_CONTENTS_CONSISTENT = 1 << 0, G_FILE_SET_CONTENTS_DURABLE = 1 << 1, G_FILE_SET_CONTENTS_ONLY_EXISTING = 1 << 2 } GFileSetContentsFlags GLIB_AVAILABLE_ENUMERATOR_IN_2_66; GLIB_AVAILABLE_IN_ALL GQuark g_file_error_quark (void); /* So other code can generate a GFileError */ GLIB_AVAILABLE_IN_ALL GFileError g_file_error_from_errno (gint err_no); GLIB_AVAILABLE_IN_ALL gboolean g_file_test (const gchar *filename, GFileTest test); GLIB_AVAILABLE_IN_ALL gboolean g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GError **error); GLIB_AVAILABLE_IN_ALL gboolean g_file_set_contents (const gchar *filename, const gchar *contents, gssize length, GError **error); G_GNUC_BEGIN_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_2_66 gboolean g_file_set_contents_full (const gchar *filename, const gchar *contents, gssize length, GFileSetContentsFlags flags, int mode, GError **error); G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_ALL gchar *g_file_read_link (const gchar *filename, GError **error); /* Wrapper / workalike for mkdtemp() */ GLIB_AVAILABLE_IN_2_30 gchar *g_mkdtemp (gchar *tmpl); GLIB_AVAILABLE_IN_2_30 gchar *g_mkdtemp_full (gchar *tmpl, gint mode); /* Wrapper / workalike for mkstemp() */ GLIB_AVAILABLE_IN_ALL gint g_mkstemp (gchar *tmpl); GLIB_AVAILABLE_IN_ALL gint g_mkstemp_full (gchar *tmpl, gint flags, gint mode); /* Wrappers for g_mkstemp and g_mkdtemp() */ GLIB_AVAILABLE_IN_ALL gint g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **error); GLIB_AVAILABLE_IN_2_30 gchar *g_dir_make_tmp (const gchar *tmpl, GError **error); GLIB_AVAILABLE_IN_ALL gchar *g_build_path (const gchar *separator, const gchar *first_element, ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED; GLIB_AVAILABLE_IN_ALL gchar *g_build_pathv (const gchar *separator, gchar **args) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_ALL gchar *g_build_filename (const gchar *first_element, ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED; GLIB_AVAILABLE_IN_ALL gchar *g_build_filenamev (gchar **args) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_2_56 gchar *g_build_filename_valist (const gchar *first_element, va_list *args) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_ALL gint g_mkdir_with_parents (const gchar *pathname, gint mode); #ifdef G_OS_WIN32 /* On Win32, the canonical directory separator is the backslash, and * the search path separator is the semicolon. Note that also the * (forward) slash works as directory separator. */ #define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR || (c) == '/') #else /* !G_OS_WIN32 */ #define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR) #endif /* !G_OS_WIN32 */ GLIB_AVAILABLE_IN_ALL gboolean g_path_is_absolute (const gchar *file_name); GLIB_AVAILABLE_IN_ALL const gchar *g_path_skip_root (const gchar *file_name); GLIB_DEPRECATED_FOR(g_path_get_basename) const gchar *g_basename (const gchar *file_name); #define g_dirname g_path_get_dirname GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_path_get_dirname) GLIB_AVAILABLE_IN_ALL gchar *g_get_current_dir (void); GLIB_AVAILABLE_IN_ALL gchar *g_path_get_basename (const gchar *file_name) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_ALL gchar *g_path_get_dirname (const gchar *file_name) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_2_58 gchar *g_canonicalize_filename (const gchar *filename, const gchar *relative_to) G_GNUC_MALLOC; G_END_DECLS #endif /* __G_FILEUTILS_H__ */ PK �w[�D*x x ggettext.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_GETTEXT_H__ #define __G_GETTEXT_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gtypes.h> G_BEGIN_DECLS GLIB_AVAILABLE_IN_ALL const gchar *g_strip_context (const gchar *msgid, const gchar *msgval) G_GNUC_FORMAT(1); GLIB_AVAILABLE_IN_ALL const gchar *g_dgettext (const gchar *domain, const gchar *msgid) G_GNUC_FORMAT(2); GLIB_AVAILABLE_IN_ALL const gchar *g_dcgettext (const gchar *domain, const gchar *msgid, gint category) G_GNUC_FORMAT(2); GLIB_AVAILABLE_IN_ALL const gchar *g_dngettext (const gchar *domain, const gchar *msgid, const gchar *msgid_plural, gulong n) G_GNUC_FORMAT(3); GLIB_AVAILABLE_IN_ALL const gchar *g_dpgettext (const gchar *domain, const gchar *msgctxtid, gsize msgidoffset) G_GNUC_FORMAT(2); GLIB_AVAILABLE_IN_ALL const gchar *g_dpgettext2 (const gchar *domain, const gchar *context, const gchar *msgid) G_GNUC_FORMAT(3); G_END_DECLS #endif /* __G_GETTEXT_H__ */ PK �w[H6��� � ghash.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_HASH_H__ #define __G_HASH_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gtypes.h> #include <glib/glist.h> G_BEGIN_DECLS typedef struct _GHashTable GHashTable; typedef gboolean (*GHRFunc) (gpointer key, gpointer value, gpointer user_data); typedef struct _GHashTableIter GHashTableIter; struct _GHashTableIter { /*< private >*/ gpointer dummy1; gpointer dummy2; gpointer dummy3; int dummy4; gboolean dummy5; gpointer dummy6; }; GLIB_AVAILABLE_IN_ALL GHashTable* g_hash_table_new (GHashFunc hash_func, GEqualFunc key_equal_func); GLIB_AVAILABLE_IN_ALL GHashTable* g_hash_table_new_full (GHashFunc hash_func, GEqualFunc key_equal_func, GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func); GLIB_AVAILABLE_IN_ALL void g_hash_table_destroy (GHashTable *hash_table); GLIB_AVAILABLE_IN_ALL gboolean g_hash_table_insert (GHashTable *hash_table, gpointer key, gpointer value); GLIB_AVAILABLE_IN_ALL gboolean g_hash_table_replace (GHashTable *hash_table, gpointer key, gpointer value); GLIB_AVAILABLE_IN_ALL gboolean g_hash_table_add (GHashTable *hash_table, gpointer key); GLIB_AVAILABLE_IN_ALL gboolean g_hash_table_remove (GHashTable *hash_table, gconstpointer key); GLIB_AVAILABLE_IN_ALL void g_hash_table_remove_all (GHashTable *hash_table); GLIB_AVAILABLE_IN_ALL gboolean g_hash_table_steal (GHashTable *hash_table, gconstpointer key); GLIB_AVAILABLE_IN_2_58 gboolean g_hash_table_steal_extended (GHashTable *hash_table, gconstpointer lookup_key, gpointer *stolen_key, gpointer *stolen_value); GLIB_AVAILABLE_IN_ALL void g_hash_table_steal_all (GHashTable *hash_table); GLIB_AVAILABLE_IN_ALL gpointer g_hash_table_lookup (GHashTable *hash_table, gconstpointer key); GLIB_AVAILABLE_IN_ALL gboolean g_hash_table_contains (GHashTable *hash_table, gconstpointer key); GLIB_AVAILABLE_IN_ALL gboolean g_hash_table_lookup_extended (GHashTable *hash_table, gconstpointer lookup_key, gpointer *orig_key, gpointer *value); GLIB_AVAILABLE_IN_ALL void g_hash_table_foreach (GHashTable *hash_table, GHFunc func, gpointer user_data); GLIB_AVAILABLE_IN_ALL gpointer g_hash_table_find (GHashTable *hash_table, GHRFunc predicate, gpointer user_data); GLIB_AVAILABLE_IN_ALL guint g_hash_table_foreach_remove (GHashTable *hash_table, GHRFunc func, gpointer user_data); GLIB_AVAILABLE_IN_ALL guint g_hash_table_foreach_steal (GHashTable *hash_table, GHRFunc func, gpointer user_data); GLIB_AVAILABLE_IN_ALL guint g_hash_table_size (GHashTable *hash_table); GLIB_AVAILABLE_IN_ALL GList * g_hash_table_get_keys (GHashTable *hash_table); GLIB_AVAILABLE_IN_ALL GList * g_hash_table_get_values (GHashTable *hash_table); GLIB_AVAILABLE_IN_2_40 gpointer * g_hash_table_get_keys_as_array (GHashTable *hash_table, guint *length); GLIB_AVAILABLE_IN_ALL void g_hash_table_iter_init (GHashTableIter *iter, GHashTable *hash_table); GLIB_AVAILABLE_IN_ALL gboolean g_hash_table_iter_next (GHashTableIter *iter, gpointer *key, gpointer *value); GLIB_AVAILABLE_IN_ALL GHashTable* g_hash_table_iter_get_hash_table (GHashTableIter *iter); GLIB_AVAILABLE_IN_ALL void g_hash_table_iter_remove (GHashTableIter *iter); GLIB_AVAILABLE_IN_2_30 void g_hash_table_iter_replace (GHashTableIter *iter, gpointer value); GLIB_AVAILABLE_IN_ALL void g_hash_table_iter_steal (GHashTableIter *iter); GLIB_AVAILABLE_IN_ALL GHashTable* g_hash_table_ref (GHashTable *hash_table); GLIB_AVAILABLE_IN_ALL void g_hash_table_unref (GHashTable *hash_table); #define g_hash_table_freeze(hash_table) ((void)0) GLIB_DEPRECATED_MACRO_IN_2_26 #define g_hash_table_thaw(hash_table) ((void)0) GLIB_DEPRECATED_MACRO_IN_2_26 /* Hash Functions */ GLIB_AVAILABLE_IN_ALL gboolean g_str_equal (gconstpointer v1, gconstpointer v2); GLIB_AVAILABLE_IN_ALL guint g_str_hash (gconstpointer v); GLIB_AVAILABLE_IN_ALL gboolean g_int_equal (gconstpointer v1, gconstpointer v2); GLIB_AVAILABLE_IN_ALL guint g_int_hash (gconstpointer v); GLIB_AVAILABLE_IN_ALL gboolean g_int64_equal (gconstpointer v1, gconstpointer v2); GLIB_AVAILABLE_IN_ALL guint g_int64_hash (gconstpointer v); GLIB_AVAILABLE_IN_ALL gboolean g_double_equal (gconstpointer v1, gconstpointer v2); GLIB_AVAILABLE_IN_ALL guint g_double_hash (gconstpointer v); GLIB_AVAILABLE_IN_ALL guint g_direct_hash (gconstpointer v) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL gboolean g_direct_equal (gconstpointer v1, gconstpointer v2) G_GNUC_CONST; G_END_DECLS #endif /* __G_HASH_H__ */ PK �w[j^��� � ghmac.hnu �[��� /* ghmac.h - secure data hashing * * Copyright (C) 2011 Stef Walter <stefw@collabora.co.uk> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __G_HMAC_H__ #define __G_HMAC_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gtypes.h> #include "gchecksum.h" G_BEGIN_DECLS /** * GHmac: * * An opaque structure representing a HMAC operation. * To create a new GHmac, use g_hmac_new(). To free * a GHmac, use g_hmac_unref(). * * Since: 2.30 */ typedef struct _GHmac GHmac; GLIB_AVAILABLE_IN_2_30 GHmac * g_hmac_new (GChecksumType digest_type, const guchar *key, gsize key_len); GLIB_AVAILABLE_IN_2_30 GHmac * g_hmac_copy (const GHmac *hmac); GLIB_AVAILABLE_IN_2_30 GHmac * g_hmac_ref (GHmac *hmac); GLIB_AVAILABLE_IN_2_30 void g_hmac_unref (GHmac *hmac); GLIB_AVAILABLE_IN_2_30 void g_hmac_update (GHmac *hmac, const guchar *data, gssize length); GLIB_AVAILABLE_IN_2_30 const gchar * g_hmac_get_string (GHmac *hmac); GLIB_AVAILABLE_IN_2_30 void g_hmac_get_digest (GHmac *hmac, guint8 *buffer, gsize *digest_len); GLIB_AVAILABLE_IN_2_30 gchar *g_compute_hmac_for_data (GChecksumType digest_type, const guchar *key, gsize key_len, const guchar *data, gsize length); GLIB_AVAILABLE_IN_2_30 gchar *g_compute_hmac_for_string (GChecksumType digest_type, const guchar *key, gsize key_len, const gchar *str, gssize length); GLIB_AVAILABLE_IN_2_50 gchar *g_compute_hmac_for_bytes (GChecksumType digest_type, GBytes *key, GBytes *data); G_END_DECLS #endif /* __G_CHECKSUM_H__ */ PK �w[���@� � ghook.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_HOOK_H__ #define __G_HOOK_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gmem.h> G_BEGIN_DECLS /* --- typedefs --- */ typedef struct _GHook GHook; typedef struct _GHookList GHookList; typedef gint (*GHookCompareFunc) (GHook *new_hook, GHook *sibling); typedef gboolean (*GHookFindFunc) (GHook *hook, gpointer data); typedef void (*GHookMarshaller) (GHook *hook, gpointer marshal_data); typedef gboolean (*GHookCheckMarshaller) (GHook *hook, gpointer marshal_data); typedef void (*GHookFunc) (gpointer data); typedef gboolean (*GHookCheckFunc) (gpointer data); typedef void (*GHookFinalizeFunc) (GHookList *hook_list, GHook *hook); typedef enum { G_HOOK_FLAG_ACTIVE = 1 << 0, G_HOOK_FLAG_IN_CALL = 1 << 1, G_HOOK_FLAG_MASK = 0x0f } GHookFlagMask; #define G_HOOK_FLAG_USER_SHIFT (4) /* --- structures --- */ struct _GHookList { gulong seq_id; guint hook_size : 16; guint is_setup : 1; GHook *hooks; gpointer dummy3; GHookFinalizeFunc finalize_hook; gpointer dummy[2]; }; struct _GHook { gpointer data; GHook *next; GHook *prev; guint ref_count; gulong hook_id; guint flags; gpointer func; GDestroyNotify destroy; }; /* --- macros --- */ #define G_HOOK(hook) ((GHook*) (hook)) #define G_HOOK_FLAGS(hook) (G_HOOK (hook)->flags) #define G_HOOK_ACTIVE(hook) ((G_HOOK_FLAGS (hook) & \ G_HOOK_FLAG_ACTIVE) != 0) #define G_HOOK_IN_CALL(hook) ((G_HOOK_FLAGS (hook) & \ G_HOOK_FLAG_IN_CALL) != 0) #define G_HOOK_IS_VALID(hook) (G_HOOK (hook)->hook_id != 0 && \ (G_HOOK_FLAGS (hook) & \ G_HOOK_FLAG_ACTIVE)) #define G_HOOK_IS_UNLINKED(hook) (G_HOOK (hook)->next == NULL && \ G_HOOK (hook)->prev == NULL && \ G_HOOK (hook)->hook_id == 0 && \ G_HOOK (hook)->ref_count == 0) /* --- prototypes --- */ /* callback maintenance functions */ GLIB_AVAILABLE_IN_ALL void g_hook_list_init (GHookList *hook_list, guint hook_size); GLIB_AVAILABLE_IN_ALL void g_hook_list_clear (GHookList *hook_list); GLIB_AVAILABLE_IN_ALL GHook* g_hook_alloc (GHookList *hook_list); GLIB_AVAILABLE_IN_ALL void g_hook_free (GHookList *hook_list, GHook *hook); GLIB_AVAILABLE_IN_ALL GHook * g_hook_ref (GHookList *hook_list, GHook *hook); GLIB_AVAILABLE_IN_ALL void g_hook_unref (GHookList *hook_list, GHook *hook); GLIB_AVAILABLE_IN_ALL gboolean g_hook_destroy (GHookList *hook_list, gulong hook_id); GLIB_AVAILABLE_IN_ALL void g_hook_destroy_link (GHookList *hook_list, GHook *hook); GLIB_AVAILABLE_IN_ALL void g_hook_prepend (GHookList *hook_list, GHook *hook); GLIB_AVAILABLE_IN_ALL void g_hook_insert_before (GHookList *hook_list, GHook *sibling, GHook *hook); GLIB_AVAILABLE_IN_ALL void g_hook_insert_sorted (GHookList *hook_list, GHook *hook, GHookCompareFunc func); GLIB_AVAILABLE_IN_ALL GHook* g_hook_get (GHookList *hook_list, gulong hook_id); GLIB_AVAILABLE_IN_ALL GHook* g_hook_find (GHookList *hook_list, gboolean need_valids, GHookFindFunc func, gpointer data); GLIB_AVAILABLE_IN_ALL GHook* g_hook_find_data (GHookList *hook_list, gboolean need_valids, gpointer data); GLIB_AVAILABLE_IN_ALL GHook* g_hook_find_func (GHookList *hook_list, gboolean need_valids, gpointer func); GLIB_AVAILABLE_IN_ALL 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 */ GLIB_AVAILABLE_IN_ALL 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 */ GLIB_AVAILABLE_IN_ALL GHook* g_hook_next_valid (GHookList *hook_list, GHook *hook, gboolean may_be_in_call); /* GHookCompareFunc implementation to insert hooks sorted by their id */ GLIB_AVAILABLE_IN_ALL 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. */ GLIB_AVAILABLE_IN_ALL 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. */ GLIB_AVAILABLE_IN_ALL void g_hook_list_invoke_check (GHookList *hook_list, gboolean may_recurse); /* invoke a marshaller on all valid hooks. */ GLIB_AVAILABLE_IN_ALL void g_hook_list_marshal (GHookList *hook_list, gboolean may_recurse, GHookMarshaller marshaller, gpointer marshal_data); GLIB_AVAILABLE_IN_ALL void g_hook_list_marshal_check (GHookList *hook_list, gboolean may_recurse, GHookCheckMarshaller marshaller, gpointer marshal_data); G_END_DECLS #endif /* __G_HOOK_H__ */ PK �w[�l`� � ghostutils.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 2008 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __G_HOST_UTILS_H__ #define __G_HOST_UTILS_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gtypes.h> G_BEGIN_DECLS GLIB_AVAILABLE_IN_ALL gboolean g_hostname_is_non_ascii (const gchar *hostname); GLIB_AVAILABLE_IN_ALL gboolean g_hostname_is_ascii_encoded (const gchar *hostname); GLIB_AVAILABLE_IN_ALL gboolean g_hostname_is_ip_address (const gchar *hostname); GLIB_AVAILABLE_IN_ALL gchar *g_hostname_to_ascii (const gchar *hostname); GLIB_AVAILABLE_IN_ALL gchar *g_hostname_to_unicode (const gchar *hostname); G_END_DECLS #endif /* __G_HOST_UTILS_H__ */ PK �w[�Ub�Z Z gi18n-lib.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997, 2002 Peter Mattis, Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __G_I18N_LIB_H__ #define __G_I18N_LIB_H__ #include <glib.h> #include <libintl.h> #include <string.h> #ifndef GETTEXT_PACKAGE #error You must define GETTEXT_PACKAGE before including gi18n-lib.h. Did you forget to include config.h? #endif #define _(String) ((char *) g_dgettext (GETTEXT_PACKAGE, String)) #define Q_(String) g_dpgettext (GETTEXT_PACKAGE, String, 0) #define N_(String) (String) #define C_(Context,String) g_dpgettext (GETTEXT_PACKAGE, Context "\004" String, strlen (Context) + 1) #define NC_(Context, String) (String) #endif /* __G_I18N_LIB_H__ */ PK �w[��ŏ � gi18n.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997, 2002 Peter Mattis, Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __G_I18N_H__ #define __G_I18N_H__ #include <glib.h> #include <libintl.h> #include <string.h> #define _(String) gettext (String) #define Q_(String) g_dpgettext (NULL, String, 0) #define N_(String) (String) #define C_(Context,String) g_dpgettext (NULL, Context "\004" String, strlen (Context) + 1) #define NC_(Context, String) (String) #endif /* __G_I18N_H__ */ PK �w[��^��6 �6 giochannel.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_IOCHANNEL_H__ #define __G_IOCHANNEL_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gconvert.h> #include <glib/gmain.h> #include <glib/gstring.h> G_BEGIN_DECLS /* GIOChannel */ typedef struct _GIOChannel GIOChannel; typedef struct _GIOFuncs GIOFuncs; typedef enum { G_IO_ERROR_NONE, G_IO_ERROR_AGAIN, G_IO_ERROR_INVAL, G_IO_ERROR_UNKNOWN } GIOError; #define G_IO_CHANNEL_ERROR g_io_channel_error_quark() typedef enum { /* Derived from errno */ G_IO_CHANNEL_ERROR_FBIG, G_IO_CHANNEL_ERROR_INVAL, G_IO_CHANNEL_ERROR_IO, G_IO_CHANNEL_ERROR_ISDIR, G_IO_CHANNEL_ERROR_NOSPC, G_IO_CHANNEL_ERROR_NXIO, G_IO_CHANNEL_ERROR_OVERFLOW, G_IO_CHANNEL_ERROR_PIPE, /* Other */ G_IO_CHANNEL_ERROR_FAILED } GIOChannelError; typedef enum { G_IO_STATUS_ERROR, G_IO_STATUS_NORMAL, G_IO_STATUS_EOF, G_IO_STATUS_AGAIN } GIOStatus; typedef enum { G_SEEK_CUR, G_SEEK_SET, G_SEEK_END } GSeekType; typedef enum { G_IO_FLAG_APPEND = 1 << 0, G_IO_FLAG_NONBLOCK = 1 << 1, G_IO_FLAG_IS_READABLE = 1 << 2, /* Read only flag */ G_IO_FLAG_IS_WRITABLE = 1 << 3, /* Read only flag */ G_IO_FLAG_IS_WRITEABLE = 1 << 3, /* Misspelling in 2.29.10 and earlier */ G_IO_FLAG_IS_SEEKABLE = 1 << 4, /* Read only flag */ G_IO_FLAG_MASK = (1 << 5) - 1, G_IO_FLAG_GET_MASK = G_IO_FLAG_MASK, G_IO_FLAG_SET_MASK = G_IO_FLAG_APPEND | G_IO_FLAG_NONBLOCK } GIOFlags; struct _GIOChannel { /*< private >*/ gint ref_count; GIOFuncs *funcs; gchar *encoding; GIConv read_cd; GIConv write_cd; gchar *line_term; /* String which indicates the end of a line of text */ guint line_term_len; /* So we can have null in the line term */ gsize buf_size; GString *read_buf; /* Raw data from the channel */ GString *encoded_read_buf; /* Channel data converted to UTF-8 */ GString *write_buf; /* Data ready to be written to the file */ gchar partial_write_buf[6]; /* UTF-8 partial characters, null terminated */ /* Group the flags together, immediately after partial_write_buf, to save memory */ guint use_buffer : 1; /* The encoding uses the buffers */ guint do_encode : 1; /* The encoding uses the GIConv coverters */ guint close_on_unref : 1; /* Close the channel on final unref */ guint is_readable : 1; /* Cached GIOFlag */ guint is_writeable : 1; /* ditto */ guint is_seekable : 1; /* ditto */ gpointer reserved1; gpointer reserved2; }; typedef gboolean (*GIOFunc) (GIOChannel *source, GIOCondition condition, gpointer data); struct _GIOFuncs { GIOStatus (*io_read) (GIOChannel *channel, gchar *buf, gsize count, gsize *bytes_read, GError **err); GIOStatus (*io_write) (GIOChannel *channel, const gchar *buf, gsize count, gsize *bytes_written, GError **err); GIOStatus (*io_seek) (GIOChannel *channel, gint64 offset, GSeekType type, GError **err); GIOStatus (*io_close) (GIOChannel *channel, GError **err); GSource* (*io_create_watch) (GIOChannel *channel, GIOCondition condition); void (*io_free) (GIOChannel *channel); GIOStatus (*io_set_flags) (GIOChannel *channel, GIOFlags flags, GError **err); GIOFlags (*io_get_flags) (GIOChannel *channel); }; GLIB_AVAILABLE_IN_ALL void g_io_channel_init (GIOChannel *channel); GLIB_AVAILABLE_IN_ALL GIOChannel *g_io_channel_ref (GIOChannel *channel); GLIB_AVAILABLE_IN_ALL void g_io_channel_unref (GIOChannel *channel); GLIB_DEPRECATED_FOR(g_io_channel_read_chars) GIOError g_io_channel_read (GIOChannel *channel, gchar *buf, gsize count, gsize *bytes_read); GLIB_DEPRECATED_FOR(g_io_channel_write_chars) GIOError g_io_channel_write (GIOChannel *channel, const gchar *buf, gsize count, gsize *bytes_written); GLIB_DEPRECATED_FOR(g_io_channel_seek_position) GIOError g_io_channel_seek (GIOChannel *channel, gint64 offset, GSeekType type); GLIB_DEPRECATED_FOR(g_io_channel_shutdown) void g_io_channel_close (GIOChannel *channel); GLIB_AVAILABLE_IN_ALL GIOStatus g_io_channel_shutdown (GIOChannel *channel, gboolean flush, GError **err); GLIB_AVAILABLE_IN_ALL guint g_io_add_watch_full (GIOChannel *channel, gint priority, GIOCondition condition, GIOFunc func, gpointer user_data, GDestroyNotify notify); GLIB_AVAILABLE_IN_ALL GSource * g_io_create_watch (GIOChannel *channel, GIOCondition condition); GLIB_AVAILABLE_IN_ALL guint g_io_add_watch (GIOChannel *channel, GIOCondition condition, GIOFunc func, gpointer user_data); /* character encoding conversion involved functions. */ GLIB_AVAILABLE_IN_ALL void g_io_channel_set_buffer_size (GIOChannel *channel, gsize size); GLIB_AVAILABLE_IN_ALL gsize g_io_channel_get_buffer_size (GIOChannel *channel); GLIB_AVAILABLE_IN_ALL GIOCondition g_io_channel_get_buffer_condition (GIOChannel *channel); GLIB_AVAILABLE_IN_ALL GIOStatus g_io_channel_set_flags (GIOChannel *channel, GIOFlags flags, GError **error); GLIB_AVAILABLE_IN_ALL GIOFlags g_io_channel_get_flags (GIOChannel *channel); GLIB_AVAILABLE_IN_ALL void g_io_channel_set_line_term (GIOChannel *channel, const gchar *line_term, gint length); GLIB_AVAILABLE_IN_ALL const gchar * g_io_channel_get_line_term (GIOChannel *channel, gint *length); GLIB_AVAILABLE_IN_ALL void g_io_channel_set_buffered (GIOChannel *channel, gboolean buffered); GLIB_AVAILABLE_IN_ALL gboolean g_io_channel_get_buffered (GIOChannel *channel); GLIB_AVAILABLE_IN_ALL GIOStatus g_io_channel_set_encoding (GIOChannel *channel, const gchar *encoding, GError **error); GLIB_AVAILABLE_IN_ALL const gchar * g_io_channel_get_encoding (GIOChannel *channel); GLIB_AVAILABLE_IN_ALL void g_io_channel_set_close_on_unref (GIOChannel *channel, gboolean do_close); GLIB_AVAILABLE_IN_ALL gboolean g_io_channel_get_close_on_unref (GIOChannel *channel); GLIB_AVAILABLE_IN_ALL GIOStatus g_io_channel_flush (GIOChannel *channel, GError **error); GLIB_AVAILABLE_IN_ALL GIOStatus g_io_channel_read_line (GIOChannel *channel, gchar **str_return, gsize *length, gsize *terminator_pos, GError **error); GLIB_AVAILABLE_IN_ALL GIOStatus g_io_channel_read_line_string (GIOChannel *channel, GString *buffer, gsize *terminator_pos, GError **error); GLIB_AVAILABLE_IN_ALL GIOStatus g_io_channel_read_to_end (GIOChannel *channel, gchar **str_return, gsize *length, GError **error); GLIB_AVAILABLE_IN_ALL GIOStatus g_io_channel_read_chars (GIOChannel *channel, gchar *buf, gsize count, gsize *bytes_read, GError **error); GLIB_AVAILABLE_IN_ALL GIOStatus g_io_channel_read_unichar (GIOChannel *channel, gunichar *thechar, GError **error); GLIB_AVAILABLE_IN_ALL GIOStatus g_io_channel_write_chars (GIOChannel *channel, const gchar *buf, gssize count, gsize *bytes_written, GError **error); GLIB_AVAILABLE_IN_ALL GIOStatus g_io_channel_write_unichar (GIOChannel *channel, gunichar thechar, GError **error); GLIB_AVAILABLE_IN_ALL GIOStatus g_io_channel_seek_position (GIOChannel *channel, gint64 offset, GSeekType type, GError **error); GLIB_AVAILABLE_IN_ALL GIOChannel* g_io_channel_new_file (const gchar *filename, const gchar *mode, GError **error); /* Error handling */ GLIB_AVAILABLE_IN_ALL GQuark g_io_channel_error_quark (void); GLIB_AVAILABLE_IN_ALL GIOChannelError g_io_channel_error_from_errno (gint en); /* On Unix, IO channels created with this function for any file * descriptor or socket. * * On Win32, this can be used either for files opened with the MSVCRT * (the Microsoft run-time C library) _open() or _pipe, including file * descriptors 0, 1 and 2 (corresponding to stdin, stdout and stderr), * or for Winsock SOCKETs. If the parameter is a legal file * descriptor, it is assumed to be such, otherwise it should be a * SOCKET. This relies on SOCKETs and file descriptors not * overlapping. If you want to be certain, call either * g_io_channel_win32_new_fd() or g_io_channel_win32_new_socket() * instead as appropriate. * * The term file descriptor as used in the context of Win32 refers to * the emulated Unix-like file descriptors MSVCRT provides. The native * corresponding concept is file HANDLE. There isn't as of yet a way to * get GIOChannels for Win32 file HANDLEs. */ GLIB_AVAILABLE_IN_ALL GIOChannel* g_io_channel_unix_new (int fd); GLIB_AVAILABLE_IN_ALL gint g_io_channel_unix_get_fd (GIOChannel *channel); /* Hook for GClosure / GSource integration. Don't touch */ GLIB_VAR GSourceFuncs g_io_watch_funcs; #ifdef G_OS_WIN32 /* You can use this "pseudo file descriptor" in a GPollFD to add * polling for Windows messages. GTK applications should not do that. */ #define G_WIN32_MSG_HANDLE 19981206 /* Use this to get a GPollFD from a GIOChannel, so that you can call * g_io_channel_win32_poll(). After calling this you should only use * g_io_channel_read() to read from the GIOChannel, i.e. never read() * from the underlying file descriptor. For SOCKETs, it is possible to call * recv(). */ GLIB_AVAILABLE_IN_ALL void g_io_channel_win32_make_pollfd (GIOChannel *channel, GIOCondition condition, GPollFD *fd); /* This can be used to wait until at least one of the channels is readable. * On Unix you would do a select() on the file descriptors of the channels. */ GLIB_AVAILABLE_IN_ALL gint g_io_channel_win32_poll (GPollFD *fds, gint n_fds, gint timeout_); /* Create an IO channel for Windows messages for window handle hwnd. */ #if GLIB_SIZEOF_VOID_P == 8 /* We use gsize here so that it is still an integer type and not a * pointer, like the guint in the traditional prototype. We can't use * intptr_t as that is not portable enough. */ GLIB_AVAILABLE_IN_ALL GIOChannel *g_io_channel_win32_new_messages (gsize hwnd); #else GLIB_AVAILABLE_IN_ALL GIOChannel *g_io_channel_win32_new_messages (guint hwnd); #endif /* Create an IO channel for C runtime (emulated Unix-like) file * descriptors. After calling g_io_add_watch() on a IO channel * returned by this function, you shouldn't call read() on the file * descriptor. This is because adding polling for a file descriptor is * implemented on Win32 by starting a thread that sits blocked in a * read() from the file descriptor most of the time. All reads from * the file descriptor should be done by this internal GLib * thread. Your code should call only g_io_channel_read_chars(). */ GLIB_AVAILABLE_IN_ALL GIOChannel* g_io_channel_win32_new_fd (gint fd); /* Get the C runtime file descriptor of a channel. */ GLIB_AVAILABLE_IN_ALL gint g_io_channel_win32_get_fd (GIOChannel *channel); /* Create an IO channel for a winsock socket. The parameter should be * a SOCKET. Contrary to IO channels for file descriptors (on *Win32), * you can use normal recv() or recvfrom() on sockets even if GLib * is polling them. */ GLIB_AVAILABLE_IN_ALL GIOChannel *g_io_channel_win32_new_socket (gint socket); GLIB_DEPRECATED_FOR(g_io_channel_win32_new_socket) GIOChannel *g_io_channel_win32_new_stream_socket (gint socket); GLIB_AVAILABLE_IN_ALL void g_io_channel_win32_set_debug (GIOChannel *channel, gboolean flag); #endif G_END_DECLS #endif /* __G_IOCHANNEL_H__ */ PK �w[��E�A: A: gkeyfile.hnu �[��� /* gkeyfile.h - desktop entry file parser * * Copyright 2004 Red Hat, Inc. * * Ray Strode <halfline@hawaii.rr.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __G_KEY_FILE_H__ #define __G_KEY_FILE_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gbytes.h> #include <glib/gerror.h> G_BEGIN_DECLS typedef enum { G_KEY_FILE_ERROR_UNKNOWN_ENCODING, G_KEY_FILE_ERROR_PARSE, G_KEY_FILE_ERROR_NOT_FOUND, G_KEY_FILE_ERROR_KEY_NOT_FOUND, G_KEY_FILE_ERROR_GROUP_NOT_FOUND, G_KEY_FILE_ERROR_INVALID_VALUE } GKeyFileError; #define G_KEY_FILE_ERROR g_key_file_error_quark() GLIB_AVAILABLE_IN_ALL GQuark g_key_file_error_quark (void); typedef struct _GKeyFile GKeyFile; typedef enum { G_KEY_FILE_NONE = 0, G_KEY_FILE_KEEP_COMMENTS = 1 << 0, G_KEY_FILE_KEEP_TRANSLATIONS = 1 << 1 } GKeyFileFlags; GLIB_AVAILABLE_IN_ALL GKeyFile *g_key_file_new (void); GLIB_AVAILABLE_IN_ALL GKeyFile *g_key_file_ref (GKeyFile *key_file); GLIB_AVAILABLE_IN_ALL void g_key_file_unref (GKeyFile *key_file); GLIB_AVAILABLE_IN_ALL void g_key_file_free (GKeyFile *key_file); GLIB_AVAILABLE_IN_ALL void g_key_file_set_list_separator (GKeyFile *key_file, gchar separator); GLIB_AVAILABLE_IN_ALL gboolean g_key_file_load_from_file (GKeyFile *key_file, const gchar *file, GKeyFileFlags flags, GError **error); GLIB_AVAILABLE_IN_ALL gboolean g_key_file_load_from_data (GKeyFile *key_file, const gchar *data, gsize length, GKeyFileFlags flags, GError **error); GLIB_AVAILABLE_IN_2_50 gboolean g_key_file_load_from_bytes (GKeyFile *key_file, GBytes *bytes, GKeyFileFlags flags, GError **error); GLIB_AVAILABLE_IN_ALL gboolean g_key_file_load_from_dirs (GKeyFile *key_file, const gchar *file, const gchar **search_dirs, gchar **full_path, GKeyFileFlags flags, GError **error); GLIB_AVAILABLE_IN_ALL gboolean g_key_file_load_from_data_dirs (GKeyFile *key_file, const gchar *file, gchar **full_path, GKeyFileFlags flags, GError **error); GLIB_AVAILABLE_IN_ALL gchar *g_key_file_to_data (GKeyFile *key_file, gsize *length, GError **error) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_2_40 gboolean g_key_file_save_to_file (GKeyFile *key_file, const gchar *filename, GError **error); GLIB_AVAILABLE_IN_ALL gchar *g_key_file_get_start_group (GKeyFile *key_file) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_ALL gchar **g_key_file_get_groups (GKeyFile *key_file, gsize *length); GLIB_AVAILABLE_IN_ALL gchar **g_key_file_get_keys (GKeyFile *key_file, const gchar *group_name, gsize *length, GError **error); GLIB_AVAILABLE_IN_ALL gboolean g_key_file_has_group (GKeyFile *key_file, const gchar *group_name); GLIB_AVAILABLE_IN_ALL gboolean g_key_file_has_key (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); GLIB_AVAILABLE_IN_ALL gchar *g_key_file_get_value (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_ALL void g_key_file_set_value (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *value); GLIB_AVAILABLE_IN_ALL gchar *g_key_file_get_string (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_ALL void g_key_file_set_string (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *string); GLIB_AVAILABLE_IN_ALL gchar *g_key_file_get_locale_string (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *locale, GError **error) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_2_56 gchar *g_key_file_get_locale_for_key (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *locale) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_ALL void g_key_file_set_locale_string (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *locale, const gchar *string); GLIB_AVAILABLE_IN_ALL gboolean g_key_file_get_boolean (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); GLIB_AVAILABLE_IN_ALL void g_key_file_set_boolean (GKeyFile *key_file, const gchar *group_name, const gchar *key, gboolean value); GLIB_AVAILABLE_IN_ALL gint g_key_file_get_integer (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); GLIB_AVAILABLE_IN_ALL void g_key_file_set_integer (GKeyFile *key_file, const gchar *group_name, const gchar *key, gint value); GLIB_AVAILABLE_IN_ALL gint64 g_key_file_get_int64 (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); GLIB_AVAILABLE_IN_ALL void g_key_file_set_int64 (GKeyFile *key_file, const gchar *group_name, const gchar *key, gint64 value); GLIB_AVAILABLE_IN_ALL guint64 g_key_file_get_uint64 (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); GLIB_AVAILABLE_IN_ALL void g_key_file_set_uint64 (GKeyFile *key_file, const gchar *group_name, const gchar *key, guint64 value); GLIB_AVAILABLE_IN_ALL gdouble g_key_file_get_double (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); GLIB_AVAILABLE_IN_ALL void g_key_file_set_double (GKeyFile *key_file, const gchar *group_name, const gchar *key, gdouble value); GLIB_AVAILABLE_IN_ALL gchar **g_key_file_get_string_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gsize *length, GError **error); GLIB_AVAILABLE_IN_ALL void g_key_file_set_string_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar * const list[], gsize length); GLIB_AVAILABLE_IN_ALL gchar **g_key_file_get_locale_string_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *locale, gsize *length, GError **error); GLIB_AVAILABLE_IN_ALL void g_key_file_set_locale_string_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *locale, const gchar * const list[], gsize length); GLIB_AVAILABLE_IN_ALL gboolean *g_key_file_get_boolean_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gsize *length, GError **error) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_ALL void g_key_file_set_boolean_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gboolean list[], gsize length); GLIB_AVAILABLE_IN_ALL gint *g_key_file_get_integer_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gsize *length, GError **error) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_ALL void g_key_file_set_double_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gdouble list[], gsize length); GLIB_AVAILABLE_IN_ALL gdouble *g_key_file_get_double_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gsize *length, GError **error) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_ALL void g_key_file_set_integer_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gint list[], gsize length); GLIB_AVAILABLE_IN_ALL gboolean g_key_file_set_comment (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *comment, GError **error); GLIB_AVAILABLE_IN_ALL gchar *g_key_file_get_comment (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_ALL gboolean g_key_file_remove_comment (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); GLIB_AVAILABLE_IN_ALL gboolean g_key_file_remove_key (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); GLIB_AVAILABLE_IN_ALL gboolean g_key_file_remove_group (GKeyFile *key_file, const gchar *group_name, GError **error); /* Defines for handling freedesktop.org Desktop files */ #define G_KEY_FILE_DESKTOP_GROUP "Desktop Entry" #define G_KEY_FILE_DESKTOP_KEY_TYPE "Type" #define G_KEY_FILE_DESKTOP_KEY_VERSION "Version" #define G_KEY_FILE_DESKTOP_KEY_NAME "Name" #define G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME "GenericName" #define G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY "NoDisplay" #define G_KEY_FILE_DESKTOP_KEY_COMMENT "Comment" #define G_KEY_FILE_DESKTOP_KEY_ICON "Icon" #define G_KEY_FILE_DESKTOP_KEY_HIDDEN "Hidden" #define G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN "OnlyShowIn" #define G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN "NotShowIn" #define G_KEY_FILE_DESKTOP_KEY_TRY_EXEC "TryExec" #define G_KEY_FILE_DESKTOP_KEY_EXEC "Exec" #define G_KEY_FILE_DESKTOP_KEY_PATH "Path" #define G_KEY_FILE_DESKTOP_KEY_TERMINAL "Terminal" #define G_KEY_FILE_DESKTOP_KEY_MIME_TYPE "MimeType" #define G_KEY_FILE_DESKTOP_KEY_CATEGORIES "Categories" #define G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY "StartupNotify" #define G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS "StartupWMClass" #define G_KEY_FILE_DESKTOP_KEY_URL "URL" #define G_KEY_FILE_DESKTOP_KEY_DBUS_ACTIVATABLE "DBusActivatable" #define G_KEY_FILE_DESKTOP_KEY_ACTIONS "Actions" #define G_KEY_FILE_DESKTOP_TYPE_APPLICATION "Application" #define G_KEY_FILE_DESKTOP_TYPE_LINK "Link" #define G_KEY_FILE_DESKTOP_TYPE_DIRECTORY "Directory" G_END_DECLS #endif /* __G_KEY_FILE_H__ */ PK �w[u?�' ' glib-autocleanups.hnu �[��� /* * Copyright © 2015 Canonical Limited * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. * * Author: Ryan Lortie <desrt@desrt.ca> */ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif static inline void g_autoptr_cleanup_generic_gfree (void *p) { void **pp = (void**)p; g_free (*pp); } static inline void g_autoptr_cleanup_gstring_free (GString *string) { if (string) g_string_free (string, TRUE); } /* Ignore deprecations in case we refer to a type which was added in a more * recent GLib version than the user’s #GLIB_VERSION_MAX_ALLOWED definition. */ G_GNUC_BEGIN_IGNORE_DEPRECATIONS /* If adding a cleanup here, please also add a test case to * glib/tests/autoptr.c */ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncQueue, g_async_queue_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBookmarkFile, g_bookmark_file_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBytes, g_bytes_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GChecksum, g_checksum_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDateTime, g_date_time_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDate, g_date_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDir, g_dir_close) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GError, g_error_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHashTable, g_hash_table_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHmac, g_hmac_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GIOChannel, g_io_channel_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GKeyFile, g_key_file_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GList, g_list_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GArray, g_array_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPtrArray, g_ptr_array_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GByteArray, g_byte_array_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContext, g_main_context_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContextPusher, g_main_context_pusher_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainLoop, g_main_loop_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSource, g_source_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMappedFile, g_mapped_file_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMarkupParseContext, g_markup_parse_context_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNode, g_node_destroy) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionContext, g_option_context_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionGroup, g_option_group_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPatternSpec, g_pattern_spec_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GQueue, g_queue_free) G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GQueue, g_queue_clear) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRand, g_rand_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRegex, g_regex_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMatchInfo, g_match_info_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GScanner, g_scanner_destroy) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSequence, g_sequence_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSList, g_slist_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GString, g_autoptr_cleanup_gstring_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GStringChunk, g_string_chunk_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GStrvBuilder, g_strv_builder_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GThread, g_thread_unref) G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GMutex, g_mutex_clear) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMutexLocker, g_mutex_locker_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRecMutexLocker, g_rec_mutex_locker_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRWLockWriterLocker, g_rw_lock_writer_locker_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRWLockReaderLocker, g_rw_lock_reader_locker_free) G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GCond, g_cond_clear) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimer, g_timer_destroy) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimeZone, g_time_zone_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTree, g_tree_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariant, g_variant_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantBuilder, g_variant_builder_unref) G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantBuilder, g_variant_builder_clear) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantIter, g_variant_iter_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantDict, g_variant_dict_unref) G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantDict, g_variant_dict_clear) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantType, g_variant_type_free) G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GStrv, g_strfreev, NULL) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRefString, g_ref_string_release) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUri, g_uri_unref) G_GNUC_END_IGNORE_DEPRECATIONS PK �w[��=o glist.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_LIST_H__ #define __G_LIST_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gmem.h> #include <glib/gnode.h> G_BEGIN_DECLS typedef struct _GList GList; struct _GList { gpointer data; GList *next; GList *prev; }; /* Doubly linked lists */ GLIB_AVAILABLE_IN_ALL GList* g_list_alloc (void) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL void g_list_free (GList *list); GLIB_AVAILABLE_IN_ALL void g_list_free_1 (GList *list); #define g_list_free1 g_list_free_1 GLIB_AVAILABLE_IN_ALL void g_list_free_full (GList *list, GDestroyNotify free_func); GLIB_AVAILABLE_IN_ALL GList* g_list_append (GList *list, gpointer data) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL GList* g_list_prepend (GList *list, gpointer data) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL GList* g_list_insert (GList *list, gpointer data, gint position) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL GList* g_list_insert_sorted (GList *list, gpointer data, GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL GList* g_list_insert_sorted_with_data (GList *list, gpointer data, GCompareDataFunc func, gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL GList* g_list_insert_before (GList *list, GList *sibling, gpointer data) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_2_62 GList* g_list_insert_before_link (GList *list, GList *sibling, GList *link_) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL GList* g_list_concat (GList *list1, GList *list2) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL GList* g_list_remove (GList *list, gconstpointer data) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL GList* g_list_remove_all (GList *list, gconstpointer data) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL GList* g_list_remove_link (GList *list, GList *llink) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL GList* g_list_delete_link (GList *list, GList *link_) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL GList* g_list_reverse (GList *list) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL GList* g_list_copy (GList *list) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_2_34 GList* g_list_copy_deep (GList *list, GCopyFunc func, gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL GList* g_list_nth (GList *list, guint n); GLIB_AVAILABLE_IN_ALL GList* g_list_nth_prev (GList *list, guint n); GLIB_AVAILABLE_IN_ALL GList* g_list_find (GList *list, gconstpointer data); GLIB_AVAILABLE_IN_ALL GList* g_list_find_custom (GList *list, gconstpointer data, GCompareFunc func); GLIB_AVAILABLE_IN_ALL gint g_list_position (GList *list, GList *llink); GLIB_AVAILABLE_IN_ALL gint g_list_index (GList *list, gconstpointer data); GLIB_AVAILABLE_IN_ALL GList* g_list_last (GList *list); GLIB_AVAILABLE_IN_ALL GList* g_list_first (GList *list); GLIB_AVAILABLE_IN_ALL guint g_list_length (GList *list); GLIB_AVAILABLE_IN_ALL void g_list_foreach (GList *list, GFunc func, gpointer user_data); GLIB_AVAILABLE_IN_ALL GList* g_list_sort (GList *list, GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL GList* g_list_sort_with_data (GList *list, GCompareDataFunc compare_func, gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL gpointer g_list_nth_data (GList *list, guint n); GLIB_AVAILABLE_IN_2_64 void g_clear_list (GList **list_ptr, GDestroyNotify destroy); #define g_clear_list(list_ptr, destroy) \ G_STMT_START { \ GList *_list; \ \ _list = *(list_ptr); \ if (_list) \ { \ *list_ptr = NULL; \ \ if ((destroy) != NULL) \ g_list_free_full (_list, (destroy)); \ else \ g_list_free (_list); \ } \ } G_STMT_END \ GLIB_AVAILABLE_MACRO_IN_2_64 #define g_list_previous(list) ((list) ? (((GList *)(list))->prev) : NULL) #define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL) G_END_DECLS #endif /* __G_LIST_H__ */ PK �w[B�"y� y� gmacros.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ /* This file must not include any other glib header file and must thus * not refer to variables from glibconfig.h */ #ifndef __G_MACROS_H__ #define __G_MACROS_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif /* We include stddef.h to get the system's definition of NULL */ #include <stddef.h> #ifdef __GNUC__ #define G_GNUC_CHECK_VERSION(major, minor) \ ((__GNUC__ > (major)) || \ ((__GNUC__ == (major)) && \ (__GNUC_MINOR__ >= (minor)))) #else #define G_GNUC_CHECK_VERSION(major, minor) 0 #endif /* Here we provide G_GNUC_EXTENSION as an alias for __extension__, * where this is valid. This allows for warningless compilation of * "long long" types even in the presence of '-ansi -pedantic'. */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) #define G_GNUC_EXTENSION __extension__ #else #define G_GNUC_EXTENSION #endif /* Every compiler that we target supports inlining, but some of them may * complain about it if we don't say "__inline". If we have C99, or if * we are using C++, then we can use "inline" directly. Unfortunately * Visual Studio does not support __STDC_VERSION__, so we need to check * whether we are on Visual Studio 2013 or earlier to see that we need to * say "__inline" in C mode. * Otherwise, we say "__inline" to avoid the warning. */ #define G_CAN_INLINE #ifndef __cplusplus # ifdef _MSC_VER # if (_MSC_VER < 1900) # define G_INLINE_DEFINE_NEEDED # endif # elif !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199900) # define G_INLINE_DEFINE_NEEDED # endif #endif #ifdef G_INLINE_DEFINE_NEEDED # undef inline # define inline __inline #endif #undef G_INLINE_DEFINE_NEEDED /** * G_INLINE_FUNC: * * This macro used to be used to conditionally define inline functions * in a compatible way before this feature was supported in all * compilers. These days, GLib requires inlining support from the * compiler, so your GLib-using programs can safely assume that the * "inline" keyword works properly. * * Never use this macro anymore. Just say "static inline". * * Deprecated: 2.48: Use "static inline" instead */ /* For historical reasons we need to continue to support those who * define G_IMPLEMENT_INLINES to mean "don't implement this here". */ #ifdef G_IMPLEMENT_INLINES # define G_INLINE_FUNC extern GLIB_DEPRECATED_MACRO_IN_2_48_FOR(static inline) # undef G_CAN_INLINE #else # define G_INLINE_FUNC static inline GLIB_DEPRECATED_MACRO_IN_2_48_FOR(static inline) #endif /* G_IMPLEMENT_INLINES */ /* Provide macros to feature the GCC function attribute. */ /** * G_GNUC_PURE: * * Expands to the GNU C `pure` function attribute if the compiler is gcc. * Declaring a function as `pure` enables better optimization of calls to * the function. A `pure` function has no effects except its return value * and the return value depends only on the parameters and/or global * variables. * * Place the attribute after the declaration, just before the semicolon. * * |[<!-- language="C" --> * gboolean g_type_check_value (const GValue *value) G_GNUC_PURE; * ]| * * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-pure-function-attribute) for more details. */ /** * G_GNUC_MALLOC: * * Expands to the * [GNU C `malloc` function attribute](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-functions-that-behave-like-malloc) * if the compiler is gcc. * Declaring a function as `malloc` enables better optimization of the function, * but must only be done if the allocation behaviour of the function is fully * understood, otherwise miscompilation can result. * * A function can have the `malloc` attribute if it returns a pointer which is * guaranteed to not alias with any other pointer valid when the function * returns, and moreover no pointers to valid objects occur in any storage * addressed by the returned pointer. * * In practice, this means that `G_GNUC_MALLOC` can be used with any function * which returns unallocated or zeroed-out memory, but not with functions which * return initialised structures containing other pointers, or with functions * that reallocate memory. This definition changed in GLib 2.58 to match the * stricter definition introduced around GCC 5. * * Place the attribute after the declaration, just before the semicolon. * * |[<!-- language="C" --> * gpointer g_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); * ]| * * See the * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-functions-that-behave-like-malloc) * for more details. * * Since: 2.6 */ /** * G_GNUC_NO_INLINE: * * Expands to the GNU C `noinline` function attribute if the compiler is gcc. * If the compiler is not gcc, this macro expands to nothing. * * Declaring a function as `noinline` prevents the function from being * considered for inlining. * * The attribute may be placed before the declaration or definition, * right before the `static` keyword. * * |[<!-- language="C" --> * G_GNUC_NO_INLINE * static int * do_not_inline_this (void) * { * ... * } * ]| * * See the * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noinline-function-attribute) * for more details. * * Since: 2.58 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) #define G_GNUC_PURE __attribute__((__pure__)) #define G_GNUC_MALLOC __attribute__((__malloc__)) #define G_GNUC_NO_INLINE __attribute__((noinline)) #else #define G_GNUC_PURE #define G_GNUC_MALLOC #define G_GNUC_NO_INLINE #endif /** * G_GNUC_NULL_TERMINATED: * * Expands to the GNU C `sentinel` function attribute if the compiler is gcc. * This function attribute only applies to variadic functions and instructs * the compiler to check that the argument list is terminated with an * explicit %NULL. * * Place the attribute after the declaration, just before the semicolon. * * |[<!-- language="C" --> * gchar *g_strconcat (const gchar *string1, * ...) G_GNUC_NULL_TERMINATED; * ]| * * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-sentinel-function-attribute) for more details. * * Since: 2.8 */ #if __GNUC__ >= 4 #define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) #else #define G_GNUC_NULL_TERMINATED #endif /* * We can only use __typeof__ on GCC >= 4.8, and not when compiling C++. Since * __typeof__ is used in a few places in GLib, provide a pre-processor symbol * to factor the check out from callers. * * This symbol is private. */ #undef glib_typeof #if !defined(__cplusplus) && \ ((defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) || \ defined(__clang__)) #define glib_typeof(t) __typeof__ (t) #elif defined(__cplusplus) && __cplusplus >= 201103L /* C++11 decltype() is close enough for our usage */ /* This needs `#include <type_traits>`, but we have guarded this feature with a * `GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68` check, and such a check * cannot be enforced in this header due to include ordering requirements. * Within GLib itself, which use `glib_typeof` need to add the include * themselves. See other examples in GLib for how to do this. */ #define glib_typeof(t) typename std::remove_reference<decltype (t)>::type #define glib_typeof_2_68 #endif /* * Clang feature detection: http://clang.llvm.org/docs/LanguageExtensions.html * These are not available on GCC, but since the pre-processor doesn't do * operator short-circuiting, we can't use it in a statement or we'll get: * * error: missing binary operator before token "(" * * So we define it to 0 to satisfy the pre-processor. */ #ifdef __has_attribute #define g_macro__has_attribute __has_attribute #else #define g_macro__has_attribute(x) 0 #endif #ifdef __has_feature #define g_macro__has_feature __has_feature #else #define g_macro__has_feature(x) 0 #endif #ifdef __has_builtin #define g_macro__has_builtin __has_builtin #else #define g_macro__has_builtin(x) 0 #endif /** * G_GNUC_ALLOC_SIZE: * @x: the index of the argument specifying the allocation size * * Expands to the GNU C `alloc_size` function attribute if the compiler * is a new enough gcc. This attribute tells the compiler that the * function returns a pointer to memory of a size that is specified * by the @xth function parameter. * * Place the attribute after the function declaration, just before the * semicolon. * * |[<!-- language="C" --> * gpointer g_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); * ]| * * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-alloc_005fsize-function-attribute) for more details. * * Since: 2.18 */ /** * G_GNUC_ALLOC_SIZE2: * @x: the index of the argument specifying one factor of the allocation size * @y: the index of the argument specifying the second factor of the allocation size * * Expands to the GNU C `alloc_size` function attribute if the compiler is a * new enough gcc. This attribute tells the compiler that the function returns * a pointer to memory of a size that is specified by the product of two * function parameters. * * Place the attribute after the function declaration, just before the * semicolon. * * |[<!-- language="C" --> * gpointer g_malloc_n (gsize n_blocks, * gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1, 2); * ]| * * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-alloc_005fsize-function-attribute) for more details. * * Since: 2.18 */ #if (!defined(__clang__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || \ (defined(__clang__) && g_macro__has_attribute(__alloc_size__)) #define G_GNUC_ALLOC_SIZE(x) __attribute__((__alloc_size__(x))) #define G_GNUC_ALLOC_SIZE2(x,y) __attribute__((__alloc_size__(x,y))) #else #define G_GNUC_ALLOC_SIZE(x) #define G_GNUC_ALLOC_SIZE2(x,y) #endif /** * G_GNUC_PRINTF: * @format_idx: the index of the argument corresponding to the * format string (the arguments are numbered from 1) * @arg_idx: the index of the first of the format arguments, or 0 if * there are no format arguments * * Expands to the GNU C `format` function attribute if the compiler is gcc. * This is used for declaring functions which take a variable number of * arguments, with the same syntax as `printf()`. It allows the compiler * to type-check the arguments passed to the function. * * Place the attribute after the function declaration, just before the * semicolon. * * See the * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-3288) * for more details. * * |[<!-- language="C" --> * gint g_snprintf (gchar *string, * gulong n, * gchar const *format, * ...) G_GNUC_PRINTF (3, 4); * ]| */ /** * G_GNUC_SCANF: * @format_idx: the index of the argument corresponding to * the format string (the arguments are numbered from 1) * @arg_idx: the index of the first of the format arguments, or 0 if * there are no format arguments * * Expands to the GNU C `format` function attribute if the compiler is gcc. * This is used for declaring functions which take a variable number of * arguments, with the same syntax as `scanf()`. It allows the compiler * to type-check the arguments passed to the function. * * |[<!-- language="C" --> * int my_scanf (MyStream *stream, * const char *format, * ...) G_GNUC_SCANF (2, 3); * int my_vscanf (MyStream *stream, * const char *format, * va_list ap) G_GNUC_SCANF (2, 0); * ]| * * See the * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-3288) * for details. */ /** * G_GNUC_STRFTIME: * @format_idx: the index of the argument corresponding to * the format string (the arguments are numbered from 1) * * Expands to the GNU C `strftime` format function attribute if the compiler * is gcc. This is used for declaring functions which take a format argument * which is passed to `strftime()` or an API implementing its formats. It allows * the compiler check the format passed to the function. * * |[<!-- language="C" --> * gsize my_strftime (MyBuffer *buffer, * const char *format, * const struct tm *tm) G_GNUC_STRFTIME (2); * ]| * * See the * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-3288) * for details. * * Since: 2.60 */ /** * G_GNUC_FORMAT: * @arg_idx: the index of the argument * * Expands to the GNU C `format_arg` function attribute if the compiler * is gcc. This function attribute specifies that a function takes a * format string for a `printf()`, `scanf()`, `strftime()` or `strfmon()` style * function and modifies it, so that the result can be passed to a `printf()`, * `scanf()`, `strftime()` or `strfmon()` style function (with the remaining * arguments to the format function the same as they would have been * for the unmodified string). * * Place the attribute after the function declaration, just before the * semicolon. * * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-nonliteral-1) for more details. * * |[<!-- language="C" --> * gchar *g_dgettext (gchar *domain_name, gchar *msgid) G_GNUC_FORMAT (2); * ]| */ /** * G_GNUC_NORETURN: * * Expands to the GNU C `noreturn` function attribute if the compiler is gcc. * It is used for declaring functions which never return. It enables * optimization of the function, and avoids possible compiler warnings. * * Since 2.68, it is recommended that code uses %G_NORETURN instead of * %G_GNUC_NORETURN, as that works on more platforms and compilers (in * particular, MSVC and C++11) than %G_GNUC_NORETURN, which works with GCC and * Clang only. %G_GNUC_NORETURN continues to work, so has not been deprecated * yet. * * Place the attribute after the declaration, just before the semicolon. * * |[<!-- language="C" --> * void g_abort (void) G_GNUC_NORETURN; * ]| * * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noreturn-function-attribute) for more details. */ /** * G_GNUC_CONST: * * Expands to the GNU C `const` function attribute if the compiler is gcc. * Declaring a function as `const` enables better optimization of calls to * the function. A `const` function doesn't examine any values except its * parameters, and has no effects except its return value. * * Place the attribute after the declaration, just before the semicolon. * * |[<!-- language="C" --> * gchar g_ascii_tolower (gchar c) G_GNUC_CONST; * ]| * * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-const-function-attribute) for more details. * * A function that has pointer arguments and examines the data pointed to * must not be declared `const`. Likewise, a function that calls a non-`const` * function usually must not be `const`. It doesn't make sense for a `const` * function to return `void`. */ /** * G_GNUC_UNUSED: * * Expands to the GNU C `unused` function attribute if the compiler is gcc. * It is used for declaring functions and arguments which may never be used. * It avoids possible compiler warnings. * * For functions, place the attribute after the declaration, just before the * semicolon. For arguments, place the attribute at the beginning of the * argument declaration. * * |[<!-- language="C" --> * void my_unused_function (G_GNUC_UNUSED gint unused_argument, * gint other_argument) G_GNUC_UNUSED; * ]| * * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-unused-function-attribute) for more details. */ /** * G_GNUC_NO_INSTRUMENT: * * Expands to the GNU C `no_instrument_function` function attribute if the * compiler is gcc. Functions with this attribute will not be instrumented * for profiling, when the compiler is called with the * `-finstrument-functions` option. * * Place the attribute after the declaration, just before the semicolon. * * |[<!-- language="C" --> * int do_uninteresting_things (void) G_GNUC_NO_INSTRUMENT; * ]| * * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-no_005finstrument_005ffunction-function-attribute) for more details. */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) #if !defined (__clang__) && G_GNUC_CHECK_VERSION (4, 4) #define G_GNUC_PRINTF( format_idx, arg_idx ) \ __attribute__((__format__ (gnu_printf, format_idx, arg_idx))) #define G_GNUC_SCANF( format_idx, arg_idx ) \ __attribute__((__format__ (gnu_scanf, format_idx, arg_idx))) #define G_GNUC_STRFTIME( format_idx ) \ __attribute__((__format__ (gnu_strftime, format_idx, 0))) #else #define G_GNUC_PRINTF( format_idx, arg_idx ) \ __attribute__((__format__ (__printf__, format_idx, arg_idx))) #define G_GNUC_SCANF( format_idx, arg_idx ) \ __attribute__((__format__ (__scanf__, format_idx, arg_idx))) #define G_GNUC_STRFTIME( format_idx ) \ __attribute__((__format__ (__strftime__, format_idx, 0))) #endif #define G_GNUC_FORMAT( arg_idx ) \ __attribute__((__format_arg__ (arg_idx))) #define G_GNUC_NORETURN \ __attribute__((__noreturn__)) #define G_GNUC_CONST \ __attribute__((__const__)) #define G_GNUC_UNUSED \ __attribute__((__unused__)) #define G_GNUC_NO_INSTRUMENT \ __attribute__((__no_instrument_function__)) #else /* !__GNUC__ */ #define G_GNUC_PRINTF( format_idx, arg_idx ) #define G_GNUC_SCANF( format_idx, arg_idx ) #define G_GNUC_STRFTIME( format_idx ) #define G_GNUC_FORMAT( arg_idx ) /* NOTE: MSVC has __declspec(noreturn) but unlike GCC __attribute__, * __declspec can only be placed at the start of the function prototype * and not at the end, so we can't use it without breaking API. */ #define G_GNUC_NORETURN #define G_GNUC_CONST #define G_GNUC_UNUSED #define G_GNUC_NO_INSTRUMENT #endif /* !__GNUC__ */ /** * G_GNUC_FALLTHROUGH: * * Expands to the GNU C `fallthrough` statement attribute if the compiler supports it. * This allows declaring case statement to explicitly fall through in switch * statements. To enable this feature, use `-Wimplicit-fallthrough` during * compilation. * * Put the attribute right before the case statement you want to fall through * to. * * |[<!-- language="C" --> * switch (foo) * { * case 1: * g_message ("it's 1"); * G_GNUC_FALLTHROUGH; * case 2: * g_message ("it's either 1 or 2"); * break; * } * ]| * * * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#index-fallthrough-statement-attribute) for more details. * * Since: 2.60 */ #if __GNUC__ > 6 #define G_GNUC_FALLTHROUGH __attribute__((fallthrough)) #elif g_macro__has_attribute (fallthrough) #define G_GNUC_FALLTHROUGH __attribute__((fallthrough)) #else #define G_GNUC_FALLTHROUGH #endif /* __GNUC__ */ /** * G_GNUC_DEPRECATED: * * Expands to the GNU C `deprecated` attribute if the compiler is gcc. * It can be used to mark `typedef`s, variables and functions as deprecated. * When called with the `-Wdeprecated-declarations` option, * gcc will generate warnings when deprecated interfaces are used. * * Place the attribute after the declaration, just before the semicolon. * * |[<!-- language="C" --> * int my_mistake (void) G_GNUC_DEPRECATED; * ]| * * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-deprecated-function-attribute) for more details. * * Since: 2.2 */ #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || defined (__clang__) #define G_GNUC_DEPRECATED __attribute__((__deprecated__)) #else #define G_GNUC_DEPRECATED #endif /* __GNUC__ */ /** * G_GNUC_DEPRECATED_FOR: * @f: the intended replacement for the deprecated symbol, * such as the name of a function * * Like %G_GNUC_DEPRECATED, but names the intended replacement for the * deprecated symbol if the version of gcc in use is new enough to support * custom deprecation messages. * * Place the attribute after the declaration, just before the semicolon. * * |[<!-- language="C" --> * int my_mistake (void) G_GNUC_DEPRECATED_FOR(my_replacement); * ]| * * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-deprecated-function-attribute) for more details. * * Note that if @f is a macro, it will be expanded in the warning message. * You can enclose it in quotes to prevent this. (The quotes will show up * in the warning, but it's better than showing the macro expansion.) * * Since: 2.26 */ #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || defined (__clang__) #define G_GNUC_DEPRECATED_FOR(f) \ __attribute__((deprecated("Use " #f " instead"))) #else #define G_GNUC_DEPRECATED_FOR(f) G_GNUC_DEPRECATED #endif /* __GNUC__ */ #ifdef __ICC #define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ _Pragma ("warning (push)") \ _Pragma ("warning (disable:1478)") #define G_GNUC_END_IGNORE_DEPRECATIONS \ _Pragma ("warning (pop)") #elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) #define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wdeprecated-declarations\"") #define G_GNUC_END_IGNORE_DEPRECATIONS \ _Pragma ("GCC diagnostic pop") #elif defined (_MSC_VER) && (_MSC_VER >= 1500) && !defined (__clang__) #define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ __pragma (warning (push)) \ __pragma (warning (disable : 4996)) #define G_GNUC_END_IGNORE_DEPRECATIONS \ __pragma (warning (pop)) #elif defined (__clang__) #define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") #define G_GNUC_END_IGNORE_DEPRECATIONS \ _Pragma("clang diagnostic pop") #else #define G_GNUC_BEGIN_IGNORE_DEPRECATIONS #define G_GNUC_END_IGNORE_DEPRECATIONS #endif /** * G_GNUC_MAY_ALIAS: * * Expands to the GNU C `may_alias` type attribute if the compiler is gcc. * Types with this attribute will not be subjected to type-based alias * analysis, but are assumed to alias with any other type, just like `char`. * * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-may_005falias-type-attribute) for details. * * Since: 2.14 */ #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) #define G_GNUC_MAY_ALIAS __attribute__((may_alias)) #else #define G_GNUC_MAY_ALIAS #endif /** * G_GNUC_WARN_UNUSED_RESULT: * * Expands to the GNU C `warn_unused_result` function attribute if the compiler * is gcc. This function attribute makes the compiler emit a warning if the * result of a function call is ignored. * * Place the attribute after the declaration, just before the semicolon. * * |[<!-- language="C" --> * GList *g_list_append (GList *list, * gpointer data) G_GNUC_WARN_UNUSED_RESULT; * ]| * * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-warn_005funused_005fresult-function-attribute) for more details. * * Since: 2.10 */ #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) #define G_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) #else #define G_GNUC_WARN_UNUSED_RESULT #endif /* __GNUC__ */ /** * G_GNUC_FUNCTION: * * Expands to "" on all modern compilers, and to __FUNCTION__ on gcc * version 2.x. Don't use it. * * Deprecated: 2.16: Use G_STRFUNC() instead */ /** * G_GNUC_PRETTY_FUNCTION: * * Expands to "" on all modern compilers, and to __PRETTY_FUNCTION__ * on gcc version 2.x. Don't use it. * * Deprecated: 2.16: Use G_STRFUNC() instead */ /* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with * macros, so we can refer to them as strings unconditionally. * usage not-recommended since gcc-3.0 * * Mark them as deprecated since 2.26, since that’s when version macros were * introduced. */ #if defined (__GNUC__) && (__GNUC__ < 3) #define G_GNUC_FUNCTION __FUNCTION__ GLIB_DEPRECATED_MACRO_IN_2_26_FOR(G_STRFUNC) #define G_GNUC_PRETTY_FUNCTION __PRETTY_FUNCTION__ GLIB_DEPRECATED_MACRO_IN_2_26_FOR(G_STRFUNC) #else /* !__GNUC__ */ #define G_GNUC_FUNCTION "" GLIB_DEPRECATED_MACRO_IN_2_26_FOR(G_STRFUNC) #define G_GNUC_PRETTY_FUNCTION "" GLIB_DEPRECATED_MACRO_IN_2_26_FOR(G_STRFUNC) #endif /* !__GNUC__ */ #if g_macro__has_feature(attribute_analyzer_noreturn) && defined(__clang_analyzer__) #define G_ANALYZER_ANALYZING 1 #define G_ANALYZER_NORETURN __attribute__((analyzer_noreturn)) #else #define G_ANALYZER_ANALYZING 0 #define G_ANALYZER_NORETURN #endif #define G_STRINGIFY(macro_or_string) G_STRINGIFY_ARG (macro_or_string) #define G_STRINGIFY_ARG(contents) #contents #ifndef __GI_SCANNER__ /* The static assert macro really confuses the introspection parser */ #define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2 #define G_PASTE(identifier1,identifier2) G_PASTE_ARGS (identifier1, identifier2) #if !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false") #elif (defined(__cplusplus) && __cplusplus >= 201103L) || \ (defined(__cplusplus) && defined (_MSC_VER) && (_MSC_VER >= 1600)) || \ (defined (_MSC_VER) && (_MSC_VER >= 1800)) #define G_STATIC_ASSERT(expr) static_assert (expr, "Expression evaluates to false") #else #ifdef __COUNTER__ #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED #else #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __LINE__)[(expr) ? 1 : -1] G_GNUC_UNUSED #endif #endif /* __STDC_VERSION__ */ #define G_STATIC_ASSERT_EXPR(expr) ((void) sizeof (char[(expr) ? 1 : -1])) #endif /* !__GI_SCANNER__ */ /* Provide a string identifying the current code position */ #if defined(__GNUC__) && (__GNUC__ < 3) && !defined(__cplusplus) #define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) ":" __PRETTY_FUNCTION__ "()" #else #define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) #endif /* Provide a string identifying the current function, non-concatenatable */ #if defined (__GNUC__) && defined (__cplusplus) #define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__)) #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define G_STRFUNC ((const char*) (__func__)) #elif defined (__GNUC__) || (defined(_MSC_VER) && (_MSC_VER > 1300)) #define G_STRFUNC ((const char*) (__FUNCTION__)) #else #define G_STRFUNC ((const char*) ("???")) #endif /* Guard C code in headers, while including them from C++ */ #ifdef __cplusplus #define G_BEGIN_DECLS extern "C" { #define G_END_DECLS } #else #define G_BEGIN_DECLS #define G_END_DECLS #endif /* Provide definitions for some commonly used macros. * Some of them are only provided if they haven't already * been defined. It is assumed that if they are already * defined then the current definition is correct. */ #ifndef NULL # ifdef __cplusplus # define NULL (0L) # else /* !__cplusplus */ # define NULL ((void*) 0) # endif /* !__cplusplus */ #endif #ifndef FALSE #define FALSE (0) #endif #ifndef TRUE #define TRUE (!FALSE) #endif #undef MAX #define MAX(a, b) (((a) > (b)) ? (a) : (b)) #undef MIN #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #undef ABS #define ABS(a) (((a) < 0) ? -(a) : (a)) #undef CLAMP #define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) #define G_APPROX_VALUE(a, b, epsilon) \ (((a) > (b) ? (a) - (b) : (b) - (a)) < (epsilon)) /* Count the number of elements in an array. The array must be defined * as such; using this with a dynamically allocated array will give * incorrect results. */ #define G_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0])) /* Macros by analogy to GINT_TO_POINTER, GPOINTER_TO_INT */ #define GPOINTER_TO_SIZE(p) ((gsize) (p)) #define GSIZE_TO_POINTER(s) ((gpointer) (gsize) (s)) /* Provide convenience macros for handling structure * fields through their offsets. */ #if (defined(__GNUC__) && __GNUC__ >= 4) || defined (_MSC_VER) #define G_STRUCT_OFFSET(struct_type, member) \ ((glong) offsetof (struct_type, member)) #else #define G_STRUCT_OFFSET(struct_type, member) \ ((glong) ((guint8*) &((struct_type*) 0)->member)) #endif #define G_STRUCT_MEMBER_P(struct_p, struct_offset) \ ((gpointer) ((guint8*) (struct_p) + (glong) (struct_offset))) #define G_STRUCT_MEMBER(member_type, struct_p, struct_offset) \ (*(member_type*) G_STRUCT_MEMBER_P ((struct_p), (struct_offset))) /* Provide simple macro statement wrappers: * G_STMT_START { statements; } G_STMT_END; * This can be used as a single statement, like: * if (x) G_STMT_START { ... } G_STMT_END; else ... * This intentionally does not use compiler extensions like GCC's '({...})' to * avoid portability issue or side effects when compiled with different compilers. * MSVC complains about "while(0)": C4127: "Conditional expression is constant", * so we use __pragma to avoid the warning since the use here is intentional. */ #if !(defined (G_STMT_START) && defined (G_STMT_END)) #define G_STMT_START do #if defined (_MSC_VER) && (_MSC_VER >= 1500) #define G_STMT_END \ __pragma(warning(push)) \ __pragma(warning(disable:4127)) \ while(0) \ __pragma(warning(pop)) #else #define G_STMT_END while (0) #endif #endif /* Provide G_ALIGNOF alignment macro. * * Note we cannot use the gcc __alignof__ operator here, as that returns the * preferred alignment rather than the minimal alignment. See * https://gitlab.gnome.org/GNOME/glib/merge_requests/538/diffs#note_390790. */ /** * G_ALIGNOF * @type: a type-name * * Return the minimal alignment required by the platform ABI for values of the given * type. The address of a variable or struct member of the given type must always be * a multiple of this alignment. For example, most platforms require int variables * to be aligned at a 4-byte boundary, so `G_ALIGNOF (int)` is 4 on most platforms. * * Note this is not necessarily the same as the value returned by GCC’s * `__alignof__` operator, which returns the preferred alignment for a type. * The preferred alignment may be a stricter alignment than the minimal * alignment. * * Since: 2.60 */ #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__cplusplus) #define G_ALIGNOF(type) _Alignof (type) #else #define G_ALIGNOF(type) (G_STRUCT_OFFSET (struct { char a; type b; }, b)) #endif /** * G_CONST_RETURN: * * If %G_DISABLE_CONST_RETURNS is defined, this macro expands * to nothing. By default, the macro expands to const. The macro * can be used in place of const for functions that return a value * that should not be modified. The purpose of this macro is to allow * us to turn on const for returned constant strings by default, while * allowing programmers who find that annoying to turn it off. This macro * should only be used for return values and for "out" parameters, it * doesn't make sense for "in" parameters. * * Deprecated: 2.30: API providers should replace all existing uses with * const and API consumers should adjust their code accordingly */ #ifdef G_DISABLE_CONST_RETURNS #define G_CONST_RETURN GLIB_DEPRECATED_MACRO_IN_2_30_FOR(const) #else #define G_CONST_RETURN const GLIB_DEPRECATED_MACRO_IN_2_30_FOR(const) #endif /** * G_NORETURN: * * Expands to the GNU C or MSVC `noreturn` function attribute depending on * the compiler. It is used for declaring functions which never return. * Enables optimization of the function, and avoids possible compiler warnings. * * Note that %G_NORETURN supersedes the previous %G_GNUC_NORETURN macro, which * will eventually be deprecated. %G_NORETURN supports more platforms. * * Place the attribute before the function declaration as follows: * * |[<!-- language="C" --> * G_NORETURN void g_abort (void); * ]| * * Since: 2.68 */ /* Note: We can’t annotate this with GLIB_AVAILABLE_MACRO_IN_2_68 because it’s * used within the GLib headers in function declarations which are always * evaluated when a header is included. This results in warnings in third party * code which includes glib.h, even if the third party code doesn’t use the new * macro itself. */ #if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__)) || (0x5110 <= __SUNPRO_C) /* For compatibility with G_NORETURN_FUNCPTR on clang, use __attribute__((__noreturn__)), not _Noreturn. */ # define G_NORETURN __attribute__ ((__noreturn__)) #elif defined (_MSC_VER) && (1200 <= _MSC_VER) /* Use MSVC specific syntax. */ # define G_NORETURN __declspec (noreturn) /* Use ISO C++11 syntax when the compiler supports it. */ #elif (defined (__cplusplus) && __cplusplus >= 201103 && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) || defined (_MSC_VER) && (_MSC_VER >= 1900) # define G_NORETURN [[noreturn]] /* Use ISO C11 syntax when the compiler supports it. */ #elif (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) # define G_NORETURN _Noreturn #else # define G_NORETURN /* empty */ #endif /** * G_NORETURN_FUNCPTR: * * Expands to the GNU C or MSVC `noreturn` function attribute depending on * the compiler. It is used for declaring function pointers which never return. * Enables optimization of the function, and avoids possible compiler warnings. * * Place the attribute before the function declaration as follows: * * |[<!-- language="C" --> * G_NORETURN_FUNCPTR void (*funcptr) (void); * ]| * * Note that if the function is not a function pointer, you can simply use * the %G_NORETURN macro as follows: * * |[<!-- language="C" --> * G_NORETURN void g_abort (void); * ]| * * Since: 2.68 */ #if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__)) || (0x5110 <= __SUNPRO_C) # define G_NORETURN_FUNCPTR __attribute__ ((__noreturn__)) \ GLIB_AVAILABLE_MACRO_IN_2_68 #else # define G_NORETURN_FUNCPTR /* empty */ \ GLIB_AVAILABLE_MACRO_IN_2_68 #endif /* * The G_LIKELY and G_UNLIKELY macros let the programmer give hints to * the compiler about the expected result of an expression. Some compilers * can use this information for optimizations. * * The _G_BOOLEAN_EXPR macro is intended to trigger a gcc warning when * putting assignments in g_return_if_fail (). */ #if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) #define _G_BOOLEAN_EXPR(expr) \ G_GNUC_EXTENSION ({ \ int _g_boolean_var_; \ if (expr) \ _g_boolean_var_ = 1; \ else \ _g_boolean_var_ = 0; \ _g_boolean_var_; \ }) #define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1)) #define G_UNLIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 0)) #else #define G_LIKELY(expr) (expr) #define G_UNLIKELY(expr) (expr) #endif #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || defined (__clang__) #define G_DEPRECATED __attribute__((__deprecated__)) #elif defined(_MSC_VER) && (_MSC_VER >= 1300) #define G_DEPRECATED __declspec(deprecated) #else #define G_DEPRECATED #endif #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || defined (__clang__) #define G_DEPRECATED_FOR(f) __attribute__((__deprecated__("Use '" #f "' instead"))) #elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320) #define G_DEPRECATED_FOR(f) __declspec(deprecated("is deprecated. Use '" #f "' instead")) #else #define G_DEPRECATED_FOR(f) G_DEPRECATED #endif #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || defined (__clang__) #define G_UNAVAILABLE(maj,min) __attribute__((deprecated("Not available before " #maj "." #min))) #elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320) #define G_UNAVAILABLE(maj,min) __declspec(deprecated("is not available before " #maj "." #min)) #else #define G_UNAVAILABLE(maj,min) G_DEPRECATED #endif #ifndef _GLIB_EXTERN #define _GLIB_EXTERN extern #endif /* These macros are used to mark deprecated symbols in GLib headers, * and thus have to be exposed in installed headers. But please * do *not* use them in other projects. Instead, use G_DEPRECATED * or define your own wrappers around it. */ #ifdef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DEPRECATED _GLIB_EXTERN #define GLIB_DEPRECATED_FOR(f) _GLIB_EXTERN #define GLIB_UNAVAILABLE(maj,min) _GLIB_EXTERN #define GLIB_UNAVAILABLE_STATIC_INLINE(maj,min) #else #define GLIB_DEPRECATED G_DEPRECATED _GLIB_EXTERN #define GLIB_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _GLIB_EXTERN #define GLIB_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _GLIB_EXTERN #define GLIB_UNAVAILABLE_STATIC_INLINE(maj,min) G_UNAVAILABLE(maj,min) #endif #if !defined(GLIB_DISABLE_DEPRECATION_WARNINGS) && \ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || \ __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4)) #define _GLIB_GNUC_DO_PRAGMA(x) _Pragma(G_STRINGIFY (x)) #define GLIB_DEPRECATED_MACRO _GLIB_GNUC_DO_PRAGMA(GCC warning "Deprecated pre-processor symbol") #define GLIB_DEPRECATED_MACRO_FOR(f) _GLIB_GNUC_DO_PRAGMA(GCC warning "Deprecated pre-processor symbol, replace with " #f) #define GLIB_UNAVAILABLE_MACRO(maj,min) _GLIB_GNUC_DO_PRAGMA(GCC warning "Not available before " #maj "." #min) #else #define GLIB_DEPRECATED_MACRO #define GLIB_DEPRECATED_MACRO_FOR(f) #define GLIB_UNAVAILABLE_MACRO(maj,min) #endif #if !defined(GLIB_DISABLE_DEPRECATION_WARNINGS) && \ ((defined (__GNUC__) && (__GNUC__ > 6 || (__GNUC__ == 6 && __GNUC_MINOR__ >= 1))) || \ (defined (__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0)))) #define GLIB_DEPRECATED_ENUMERATOR G_DEPRECATED #define GLIB_DEPRECATED_ENUMERATOR_FOR(f) G_DEPRECATED_FOR(f) #define GLIB_UNAVAILABLE_ENUMERATOR(maj,min) G_UNAVAILABLE(maj,min) #else #define GLIB_DEPRECATED_ENUMERATOR #define GLIB_DEPRECATED_ENUMERATOR_FOR(f) #define GLIB_UNAVAILABLE_ENUMERATOR(maj,min) #endif #if !defined(GLIB_DISABLE_DEPRECATION_WARNINGS) && \ ((defined (__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))) || \ (defined (__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0)))) #define GLIB_DEPRECATED_TYPE G_DEPRECATED #define GLIB_DEPRECATED_TYPE_FOR(f) G_DEPRECATED_FOR(f) #define GLIB_UNAVAILABLE_TYPE(maj,min) G_UNAVAILABLE(maj,min) #else #define GLIB_DEPRECATED_TYPE #define GLIB_DEPRECATED_TYPE_FOR(f) #define GLIB_UNAVAILABLE_TYPE(maj,min) #endif #ifndef __GI_SCANNER__ #if defined (__GNUC__) || defined (__clang__) /* these macros are private */ #define _GLIB_AUTOPTR_FUNC_NAME(TypeName) glib_autoptr_cleanup_##TypeName #define _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) glib_autoptr_clear_##TypeName #define _GLIB_AUTOPTR_TYPENAME(TypeName) TypeName##_autoptr #define _GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName) glib_listautoptr_cleanup_##TypeName #define _GLIB_AUTOPTR_LIST_TYPENAME(TypeName) TypeName##_listautoptr #define _GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName) glib_slistautoptr_cleanup_##TypeName #define _GLIB_AUTOPTR_SLIST_TYPENAME(TypeName) TypeName##_slistautoptr #define _GLIB_AUTOPTR_QUEUE_FUNC_NAME(TypeName) glib_queueautoptr_cleanup_##TypeName #define _GLIB_AUTOPTR_QUEUE_TYPENAME(TypeName) TypeName##_queueautoptr #define _GLIB_AUTO_FUNC_NAME(TypeName) glib_auto_cleanup_##TypeName #define _GLIB_CLEANUP(func) __attribute__((cleanup(func))) #define _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(TypeName, ParentName, cleanup) \ typedef TypeName *_GLIB_AUTOPTR_TYPENAME(TypeName); \ typedef GList *_GLIB_AUTOPTR_LIST_TYPENAME(TypeName); \ typedef GSList *_GLIB_AUTOPTR_SLIST_TYPENAME(TypeName); \ typedef GQueue *_GLIB_AUTOPTR_QUEUE_TYPENAME(TypeName); \ G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) (TypeName *_ptr) \ { if (_ptr) (cleanup) ((ParentName *) _ptr); } \ static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_FUNC_NAME(TypeName) (TypeName **_ptr) \ { _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) (*_ptr); } \ static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName) (GList **_l) \ { g_list_free_full (*_l, (GDestroyNotify) (void(*)(void)) cleanup); } \ static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName) (GSList **_l) \ { g_slist_free_full (*_l, (GDestroyNotify) (void(*)(void)) cleanup); } \ static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_QUEUE_FUNC_NAME(TypeName) (GQueue **_q) \ { if (*_q) g_queue_free_full (*_q, (GDestroyNotify) (void(*)(void)) cleanup); } \ G_GNUC_END_IGNORE_DEPRECATIONS #define _GLIB_DEFINE_AUTOPTR_CHAINUP(ModuleObjName, ParentName) \ _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(ModuleObjName, ParentName, _GLIB_AUTOPTR_CLEAR_FUNC_NAME(ParentName)) /* these macros are API */ #define G_DEFINE_AUTOPTR_CLEANUP_FUNC(TypeName, func) \ _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(TypeName, TypeName, func) #define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func) \ G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ static G_GNUC_UNUSED inline void _GLIB_AUTO_FUNC_NAME(TypeName) (TypeName *_ptr) { (func) (_ptr); } \ G_GNUC_END_IGNORE_DEPRECATIONS #define G_DEFINE_AUTO_CLEANUP_FREE_FUNC(TypeName, func, none) \ G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ static G_GNUC_UNUSED inline void _GLIB_AUTO_FUNC_NAME(TypeName) (TypeName *_ptr) { if (*_ptr != none) (func) (*_ptr); } \ G_GNUC_END_IGNORE_DEPRECATIONS #define g_autoptr(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_TYPENAME(TypeName) #define g_autolist(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_LIST_TYPENAME(TypeName) #define g_autoslist(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_SLIST_TYPENAME(TypeName) #define g_autoqueue(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_QUEUE_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_QUEUE_TYPENAME(TypeName) #define g_auto(TypeName) _GLIB_CLEANUP(_GLIB_AUTO_FUNC_NAME(TypeName)) TypeName #define g_autofree _GLIB_CLEANUP(g_autoptr_cleanup_generic_gfree) #else /* not GNU C */ /* this (dummy) macro is private */ #define _GLIB_DEFINE_AUTOPTR_CHAINUP(ModuleObjName, ParentName) /* these (dummy) macros are API */ #define G_DEFINE_AUTOPTR_CLEANUP_FUNC(TypeName, func) #define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func) #define G_DEFINE_AUTO_CLEANUP_FREE_FUNC(TypeName, func, none) /* no declaration of g_auto() or g_autoptr() here */ #endif /* __GNUC__ */ #else #define _GLIB_DEFINE_AUTOPTR_CHAINUP(ModuleObjName, ParentName) #define G_DEFINE_AUTOPTR_CLEANUP_FUNC(TypeName, func) #define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func) #define G_DEFINE_AUTO_CLEANUP_FREE_FUNC(TypeName, func, none) #endif /* __GI_SCANNER__ */ /** * G_SIZEOF_MEMBER: * @struct_type: a structure type, e.g. #GOutputVector * @member: a field in the structure, e.g. `size` * * Returns the size of @member in the struct definition without having a * declared instance of @struct_type. * * Returns: the size of @member in bytes. * * Since: 2.64 */ #define G_SIZEOF_MEMBER(struct_type, member) \ GLIB_AVAILABLE_MACRO_IN_2_64 \ sizeof (((struct_type *) 0)->member) #endif /* __G_MACROS_H__ */ PK �w[]̷/4n 4n gmain.hnu �[��� /* gmain.h - the GLib Main loop * Copyright (C) 1998-2000 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __G_MAIN_H__ #define __G_MAIN_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gpoll.h> #include <glib/gslist.h> #include <glib/gthread.h> G_BEGIN_DECLS typedef enum /*< flags >*/ { G_IO_IN GLIB_SYSDEF_POLLIN, G_IO_OUT GLIB_SYSDEF_POLLOUT, G_IO_PRI GLIB_SYSDEF_POLLPRI, G_IO_ERR GLIB_SYSDEF_POLLERR, G_IO_HUP GLIB_SYSDEF_POLLHUP, G_IO_NVAL GLIB_SYSDEF_POLLNVAL } GIOCondition; /** * GMainContext: * * The `GMainContext` struct is an opaque data * type representing a set of sources to be handled in a main loop. */ typedef struct _GMainContext GMainContext; /** * GMainLoop: * * The `GMainLoop` struct is an opaque data type * representing the main event loop of a GLib or GTK+ application. */ typedef struct _GMainLoop GMainLoop; /** * GSource: * * The `GSource` struct is an opaque data type * representing an event source. */ typedef struct _GSource GSource; typedef struct _GSourcePrivate GSourcePrivate; /** * GSourceCallbackFuncs: * @ref: Called when a reference is added to the callback object * @unref: Called when a reference to the callback object is dropped * @get: Called to extract the callback function and data from the * callback object. * * The `GSourceCallbackFuncs` struct contains * functions for managing callback objects. */ typedef struct _GSourceCallbackFuncs GSourceCallbackFuncs; /** * GSourceFuncs: * @prepare: Called before all the file descriptors are polled. If the * source can determine that it is ready here (without waiting for the * results of the poll() call) it should return %TRUE. It can also return * a @timeout_ value which should be the maximum timeout (in milliseconds) * which should be passed to the poll() call. The actual timeout used will * be -1 if all sources returned -1, or it will be the minimum of all * the @timeout_ values returned which were >= 0. Since 2.36 this may * be %NULL, in which case the effect is as if the function always returns * %FALSE with a timeout of -1. If @prepare returns a * timeout and the source also has a ready time set, then the * lower of the two will be used. * @check: Called after all the file descriptors are polled. The source * should return %TRUE if it is ready to be dispatched. Note that some * time may have passed since the previous prepare function was called, * so the source should be checked again here. Since 2.36 this may * be %NULL, in which case the effect is as if the function always returns * %FALSE. * @dispatch: Called to dispatch the event source, after it has returned * %TRUE in either its @prepare or its @check function, or if a ready time * has been reached. The @dispatch function receives a callback function and * user data. The callback function may be %NULL if the source was never * connected to a callback using g_source_set_callback(). The @dispatch * function should call the callback function with @user_data and whatever * additional parameters are needed for this type of event source. The * return value of the @dispatch function should be #G_SOURCE_REMOVE if the * source should be removed or #G_SOURCE_CONTINUE to keep it. * @finalize: Called when the source is finalized. At this point, the source * will have been destroyed, had its callback cleared, and have been removed * from its #GMainContext, but it will still have its final reference count, * so methods can be called on it from within this function. * * The `GSourceFuncs` struct contains a table of * functions used to handle event sources in a generic manner. * * For idle sources, the prepare and check functions always return %TRUE * to indicate that the source is always ready to be processed. The prepare * function also returns a timeout value of 0 to ensure that the poll() call * doesn't block (since that would be time wasted which could have been spent * running the idle function). * * For timeout sources, the prepare and check functions both return %TRUE * if the timeout interval has expired. The prepare function also returns * a timeout value to ensure that the poll() call doesn't block too long * and miss the next timeout. * * For file descriptor sources, the prepare function typically returns %FALSE, * since it must wait until poll() has been called before it knows whether * any events need to be processed. It sets the returned timeout to -1 to * indicate that it doesn't mind how long the poll() call blocks. In the * check function, it tests the results of the poll() call to see if the * required condition has been met, and returns %TRUE if so. */ typedef struct _GSourceFuncs GSourceFuncs; /** * GPid: * * A type which is used to hold a process identification. * * On UNIX, processes are identified by a process id (an integer), * while Windows uses process handles (which are pointers). * * GPid is used in GLib only for descendant processes spawned with * the g_spawn functions. */ /* defined in glibconfig.h */ /** * G_PID_FORMAT: * * A format specifier that can be used in printf()-style format strings * when printing a #GPid. * * Since: 2.50 */ /* defined in glibconfig.h */ /** * GSourceFunc: * @user_data: data passed to the function, set when the source was * created with one of the above functions * * Specifies the type of function passed to g_timeout_add(), * g_timeout_add_full(), g_idle_add(), and g_idle_add_full(). * * When calling g_source_set_callback(), you may need to cast a function of a * different type to this type. Use G_SOURCE_FUNC() to avoid warnings about * incompatible function types. * * Returns: %FALSE if the source should be removed. #G_SOURCE_CONTINUE and * #G_SOURCE_REMOVE are more memorable names for the return value. */ typedef gboolean (*GSourceFunc) (gpointer user_data); /** * G_SOURCE_FUNC: * @f: a function pointer. * * Cast a function pointer to a #GSourceFunc, suppressing warnings from GCC 8 * onwards with `-Wextra` or `-Wcast-function-type` enabled about the function * types being incompatible. * * For example, the correct type of callback for a source created by * g_child_watch_source_new() is #GChildWatchFunc, which accepts more arguments * than #GSourceFunc. Casting the function with `(GSourceFunc)` to call * g_source_set_callback() will trigger a warning, even though it will be cast * back to the correct type before it is called by the source. * * Since: 2.58 */ #define G_SOURCE_FUNC(f) ((GSourceFunc) (void (*)(void)) (f)) GLIB_AVAILABLE_MACRO_IN_2_58 /** * GChildWatchFunc: * @pid: the process id of the child process * @status: Status information about the child process, encoded * in a platform-specific manner * @user_data: user data passed to g_child_watch_add() * * Prototype of a #GChildWatchSource callback, called when a child * process has exited. To interpret @status, see the documentation * for g_spawn_check_exit_status(). */ typedef void (*GChildWatchFunc) (GPid pid, gint status, gpointer user_data); /** * GSourceDisposeFunc: * @source: #GSource that is currently being disposed * * Dispose function for @source. See g_source_set_dispose_function() for * details. * * Since: 2.64 */ GLIB_AVAILABLE_TYPE_IN_2_64 typedef void (*GSourceDisposeFunc) (GSource *source); struct _GSource { /*< private >*/ gpointer callback_data; GSourceCallbackFuncs *callback_funcs; const GSourceFuncs *source_funcs; guint ref_count; GMainContext *context; gint priority; guint flags; guint source_id; GSList *poll_fds; GSource *prev; GSource *next; char *name; GSourcePrivate *priv; }; struct _GSourceCallbackFuncs { void (*ref) (gpointer cb_data); void (*unref) (gpointer cb_data); void (*get) (gpointer cb_data, GSource *source, GSourceFunc *func, gpointer *data); }; /** * GSourceDummyMarshal: * * This is just a placeholder for #GClosureMarshal, * which cannot be used here for dependency reasons. */ typedef void (*GSourceDummyMarshal) (void); struct _GSourceFuncs { gboolean (*prepare) (GSource *source, gint *timeout_); gboolean (*check) (GSource *source); gboolean (*dispatch) (GSource *source, GSourceFunc callback, gpointer user_data); void (*finalize) (GSource *source); /* Can be NULL */ /*< private >*/ /* For use by g_source_set_closure */ GSourceFunc closure_callback; GSourceDummyMarshal closure_marshal; /* Really is of type GClosureMarshal */ }; /* Standard priorities */ /** * G_PRIORITY_HIGH: * * Use this for high priority event sources. * * It is not used within GLib or GTK+. */ #define G_PRIORITY_HIGH -100 /** * G_PRIORITY_DEFAULT: * * Use this for default priority event sources. * * In GLib this priority is used when adding timeout functions * with g_timeout_add(). In GDK this priority is used for events * from the X server. */ #define G_PRIORITY_DEFAULT 0 /** * G_PRIORITY_HIGH_IDLE: * * Use this for high priority idle functions. * * GTK+ uses #G_PRIORITY_HIGH_IDLE + 10 for resizing operations, * and #G_PRIORITY_HIGH_IDLE + 20 for redrawing operations. (This is * done to ensure that any pending resizes are processed before any * pending redraws, so that widgets are not redrawn twice unnecessarily.) */ #define G_PRIORITY_HIGH_IDLE 100 /** * G_PRIORITY_DEFAULT_IDLE: * * Use this for default priority idle functions. * * In GLib this priority is used when adding idle functions with * g_idle_add(). */ #define G_PRIORITY_DEFAULT_IDLE 200 /** * G_PRIORITY_LOW: * * Use this for very low priority background tasks. * * It is not used within GLib or GTK+. */ #define G_PRIORITY_LOW 300 /** * G_SOURCE_REMOVE: * * Use this macro as the return value of a #GSourceFunc to remove * the #GSource from the main loop. * * Since: 2.32 */ #define G_SOURCE_REMOVE FALSE /** * G_SOURCE_CONTINUE: * * Use this macro as the return value of a #GSourceFunc to leave * the #GSource in the main loop. * * Since: 2.32 */ #define G_SOURCE_CONTINUE TRUE /* GMainContext: */ GLIB_AVAILABLE_IN_ALL GMainContext *g_main_context_new (void); GLIB_AVAILABLE_IN_ALL GMainContext *g_main_context_ref (GMainContext *context); GLIB_AVAILABLE_IN_ALL void g_main_context_unref (GMainContext *context); GLIB_AVAILABLE_IN_ALL GMainContext *g_main_context_default (void); GLIB_AVAILABLE_IN_ALL gboolean g_main_context_iteration (GMainContext *context, gboolean may_block); GLIB_AVAILABLE_IN_ALL gboolean g_main_context_pending (GMainContext *context); /* For implementation of legacy interfaces */ GLIB_AVAILABLE_IN_ALL GSource *g_main_context_find_source_by_id (GMainContext *context, guint source_id); GLIB_AVAILABLE_IN_ALL GSource *g_main_context_find_source_by_user_data (GMainContext *context, gpointer user_data); GLIB_AVAILABLE_IN_ALL GSource *g_main_context_find_source_by_funcs_user_data (GMainContext *context, GSourceFuncs *funcs, gpointer user_data); /* Low level functions for implementing custom main loops. */ GLIB_AVAILABLE_IN_ALL void g_main_context_wakeup (GMainContext *context); GLIB_AVAILABLE_IN_ALL gboolean g_main_context_acquire (GMainContext *context); GLIB_AVAILABLE_IN_ALL void g_main_context_release (GMainContext *context); GLIB_AVAILABLE_IN_ALL gboolean g_main_context_is_owner (GMainContext *context); GLIB_DEPRECATED_IN_2_58_FOR(g_main_context_is_owner) gboolean g_main_context_wait (GMainContext *context, GCond *cond, GMutex *mutex); GLIB_AVAILABLE_IN_ALL gboolean g_main_context_prepare (GMainContext *context, gint *priority); GLIB_AVAILABLE_IN_ALL gint g_main_context_query (GMainContext *context, gint max_priority, gint *timeout_, GPollFD *fds, gint n_fds); GLIB_AVAILABLE_IN_ALL gboolean g_main_context_check (GMainContext *context, gint max_priority, GPollFD *fds, gint n_fds); GLIB_AVAILABLE_IN_ALL void g_main_context_dispatch (GMainContext *context); GLIB_AVAILABLE_IN_ALL void g_main_context_set_poll_func (GMainContext *context, GPollFunc func); GLIB_AVAILABLE_IN_ALL GPollFunc g_main_context_get_poll_func (GMainContext *context); /* Low level functions for use by source implementations */ GLIB_AVAILABLE_IN_ALL void g_main_context_add_poll (GMainContext *context, GPollFD *fd, gint priority); GLIB_AVAILABLE_IN_ALL void g_main_context_remove_poll (GMainContext *context, GPollFD *fd); GLIB_AVAILABLE_IN_ALL gint g_main_depth (void); GLIB_AVAILABLE_IN_ALL GSource *g_main_current_source (void); /* GMainContexts for other threads */ GLIB_AVAILABLE_IN_ALL void g_main_context_push_thread_default (GMainContext *context); GLIB_AVAILABLE_IN_ALL void g_main_context_pop_thread_default (GMainContext *context); GLIB_AVAILABLE_IN_ALL GMainContext *g_main_context_get_thread_default (void); GLIB_AVAILABLE_IN_ALL GMainContext *g_main_context_ref_thread_default (void); /** * GMainContextPusher: * * Opaque type. See g_main_context_pusher_new() for details. * * Since: 2.64 */ typedef void GMainContextPusher GLIB_AVAILABLE_TYPE_IN_2_64; /** * g_main_context_pusher_new: * @main_context: (transfer none): a main context to push * * Push @main_context as the new thread-default main context for the current * thread, using g_main_context_push_thread_default(), and return a new * #GMainContextPusher. Pop with g_main_context_pusher_free(). Using * g_main_context_pop_thread_default() on @main_context while a * #GMainContextPusher exists for it can lead to undefined behaviour. * * Using two #GMainContextPushers in the same scope is not allowed, as it leads * to an undefined pop order. * * This is intended to be used with g_autoptr(). Note that g_autoptr() * is only available when using GCC or clang, so the following example * will only work with those compilers: * |[ * typedef struct * { * ... * GMainContext *context; * ... * } MyObject; * * static void * my_object_do_stuff (MyObject *self) * { * g_autoptr(GMainContextPusher) pusher = g_main_context_pusher_new (self->context); * * // Code with main context as the thread default here * * if (cond) * // No need to pop * return; * * // Optionally early pop * g_clear_pointer (&pusher, g_main_context_pusher_free); * * // Code with main context no longer the thread default here * } * ]| * * Returns: (transfer full): a #GMainContextPusher * Since: 2.64 */ G_GNUC_BEGIN_IGNORE_DEPRECATIONS GLIB_AVAILABLE_STATIC_INLINE_IN_2_64 static inline GMainContextPusher * g_main_context_pusher_new (GMainContext *main_context) { g_main_context_push_thread_default (main_context); return (GMainContextPusher *) main_context; } G_GNUC_END_IGNORE_DEPRECATIONS /** * g_main_context_pusher_free: * @pusher: (transfer full): a #GMainContextPusher * * Pop @pusher’s main context as the thread default main context. * See g_main_context_pusher_new() for details. * * This will pop the #GMainContext as the current thread-default main context, * but will not call g_main_context_unref() on it. * * Since: 2.64 */ G_GNUC_BEGIN_IGNORE_DEPRECATIONS GLIB_AVAILABLE_STATIC_INLINE_IN_2_64 static inline void g_main_context_pusher_free (GMainContextPusher *pusher) { g_main_context_pop_thread_default ((GMainContext *) pusher); } G_GNUC_END_IGNORE_DEPRECATIONS /* GMainLoop: */ GLIB_AVAILABLE_IN_ALL GMainLoop *g_main_loop_new (GMainContext *context, gboolean is_running); GLIB_AVAILABLE_IN_ALL void g_main_loop_run (GMainLoop *loop); GLIB_AVAILABLE_IN_ALL void g_main_loop_quit (GMainLoop *loop); GLIB_AVAILABLE_IN_ALL GMainLoop *g_main_loop_ref (GMainLoop *loop); GLIB_AVAILABLE_IN_ALL void g_main_loop_unref (GMainLoop *loop); GLIB_AVAILABLE_IN_ALL gboolean g_main_loop_is_running (GMainLoop *loop); GLIB_AVAILABLE_IN_ALL GMainContext *g_main_loop_get_context (GMainLoop *loop); /* GSource: */ GLIB_AVAILABLE_IN_ALL GSource *g_source_new (GSourceFuncs *source_funcs, guint struct_size); G_GNUC_BEGIN_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_2_64 void g_source_set_dispose_function (GSource *source, GSourceDisposeFunc dispose); G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_ALL GSource *g_source_ref (GSource *source); GLIB_AVAILABLE_IN_ALL void g_source_unref (GSource *source); GLIB_AVAILABLE_IN_ALL guint g_source_attach (GSource *source, GMainContext *context); GLIB_AVAILABLE_IN_ALL void g_source_destroy (GSource *source); GLIB_AVAILABLE_IN_ALL void g_source_set_priority (GSource *source, gint priority); GLIB_AVAILABLE_IN_ALL gint g_source_get_priority (GSource *source); GLIB_AVAILABLE_IN_ALL void g_source_set_can_recurse (GSource *source, gboolean can_recurse); GLIB_AVAILABLE_IN_ALL gboolean g_source_get_can_recurse (GSource *source); GLIB_AVAILABLE_IN_ALL guint g_source_get_id (GSource *source); GLIB_AVAILABLE_IN_ALL GMainContext *g_source_get_context (GSource *source); GLIB_AVAILABLE_IN_ALL void g_source_set_callback (GSource *source, GSourceFunc func, gpointer data, GDestroyNotify notify); GLIB_AVAILABLE_IN_ALL void g_source_set_funcs (GSource *source, GSourceFuncs *funcs); GLIB_AVAILABLE_IN_ALL gboolean g_source_is_destroyed (GSource *source); GLIB_AVAILABLE_IN_ALL void g_source_set_name (GSource *source, const char *name); GLIB_AVAILABLE_IN_ALL const char * g_source_get_name (GSource *source); GLIB_AVAILABLE_IN_ALL void g_source_set_name_by_id (guint tag, const char *name); GLIB_AVAILABLE_IN_2_36 void g_source_set_ready_time (GSource *source, gint64 ready_time); GLIB_AVAILABLE_IN_2_36 gint64 g_source_get_ready_time (GSource *source); #ifdef G_OS_UNIX GLIB_AVAILABLE_IN_2_36 gpointer g_source_add_unix_fd (GSource *source, gint fd, GIOCondition events); GLIB_AVAILABLE_IN_2_36 void g_source_modify_unix_fd (GSource *source, gpointer tag, GIOCondition new_events); GLIB_AVAILABLE_IN_2_36 void g_source_remove_unix_fd (GSource *source, gpointer tag); GLIB_AVAILABLE_IN_2_36 GIOCondition g_source_query_unix_fd (GSource *source, gpointer tag); #endif /* Used to implement g_source_connect_closure and internally*/ GLIB_AVAILABLE_IN_ALL void g_source_set_callback_indirect (GSource *source, gpointer callback_data, GSourceCallbackFuncs *callback_funcs); GLIB_AVAILABLE_IN_ALL void g_source_add_poll (GSource *source, GPollFD *fd); GLIB_AVAILABLE_IN_ALL void g_source_remove_poll (GSource *source, GPollFD *fd); GLIB_AVAILABLE_IN_ALL void g_source_add_child_source (GSource *source, GSource *child_source); GLIB_AVAILABLE_IN_ALL void g_source_remove_child_source (GSource *source, GSource *child_source); G_GNUC_BEGIN_IGNORE_DEPRECATIONS GLIB_DEPRECATED_IN_2_28_FOR(g_source_get_time) void g_source_get_current_time (GSource *source, GTimeVal *timeval); G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_ALL gint64 g_source_get_time (GSource *source); /* void g_source_connect_closure (GSource *source, GClosure *closure); */ /* Specific source types */ GLIB_AVAILABLE_IN_ALL GSource *g_idle_source_new (void); GLIB_AVAILABLE_IN_ALL GSource *g_child_watch_source_new (GPid pid); GLIB_AVAILABLE_IN_ALL GSource *g_timeout_source_new (guint interval); GLIB_AVAILABLE_IN_ALL GSource *g_timeout_source_new_seconds (guint interval); /* Miscellaneous functions */ G_GNUC_BEGIN_IGNORE_DEPRECATIONS GLIB_DEPRECATED_IN_2_62_FOR(g_get_real_time) void g_get_current_time (GTimeVal *result); G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_ALL gint64 g_get_monotonic_time (void); GLIB_AVAILABLE_IN_ALL gint64 g_get_real_time (void); /* Source manipulation by ID */ GLIB_AVAILABLE_IN_ALL gboolean g_source_remove (guint tag); GLIB_AVAILABLE_IN_ALL gboolean g_source_remove_by_user_data (gpointer user_data); GLIB_AVAILABLE_IN_ALL gboolean g_source_remove_by_funcs_user_data (GSourceFuncs *funcs, gpointer user_data); /** * GClearHandleFunc: * @handle_id: the handle ID to clear * * Specifies the type of function passed to g_clear_handle_id(). * The implementation is expected to free the resource identified * by @handle_id; for instance, if @handle_id is a #GSource ID, * g_source_remove() can be used. * * Since: 2.56 */ typedef void (* GClearHandleFunc) (guint handle_id); GLIB_AVAILABLE_IN_2_56 void g_clear_handle_id (guint *tag_ptr, GClearHandleFunc clear_func); #define g_clear_handle_id(tag_ptr, clear_func) \ G_STMT_START { \ G_STATIC_ASSERT (sizeof *(tag_ptr) == sizeof (guint)); \ guint *_tag_ptr = (guint *) (tag_ptr); \ guint _handle_id; \ \ _handle_id = *_tag_ptr; \ if (_handle_id > 0) \ { \ *_tag_ptr = 0; \ clear_func (_handle_id); \ } \ } G_STMT_END \ GLIB_AVAILABLE_MACRO_IN_2_56 /* Idles, child watchers and timeouts */ GLIB_AVAILABLE_IN_ALL guint g_timeout_add_full (gint priority, guint interval, GSourceFunc function, gpointer data, GDestroyNotify notify); GLIB_AVAILABLE_IN_ALL guint g_timeout_add (guint interval, GSourceFunc function, gpointer data); GLIB_AVAILABLE_IN_ALL guint g_timeout_add_seconds_full (gint priority, guint interval, GSourceFunc function, gpointer data, GDestroyNotify notify); GLIB_AVAILABLE_IN_ALL guint g_timeout_add_seconds (guint interval, GSourceFunc function, gpointer data); GLIB_AVAILABLE_IN_ALL guint g_child_watch_add_full (gint priority, GPid pid, GChildWatchFunc function, gpointer data, GDestroyNotify notify); GLIB_AVAILABLE_IN_ALL guint g_child_watch_add (GPid pid, GChildWatchFunc function, gpointer data); GLIB_AVAILABLE_IN_ALL guint g_idle_add (GSourceFunc function, gpointer data); GLIB_AVAILABLE_IN_ALL guint g_idle_add_full (gint priority, GSourceFunc function, gpointer data, GDestroyNotify notify); GLIB_AVAILABLE_IN_ALL gboolean g_idle_remove_by_data (gpointer data); GLIB_AVAILABLE_IN_ALL void g_main_context_invoke_full (GMainContext *context, gint priority, GSourceFunc function, gpointer data, GDestroyNotify notify); GLIB_AVAILABLE_IN_ALL void g_main_context_invoke (GMainContext *context, GSourceFunc function, gpointer data); /* Hook for GClosure / GSource integration. Don't touch */ GLIB_VAR GSourceFuncs g_timeout_funcs; GLIB_VAR GSourceFuncs g_child_watch_funcs; GLIB_VAR GSourceFuncs g_idle_funcs; #ifdef G_OS_UNIX GLIB_VAR GSourceFuncs g_unix_signal_funcs; GLIB_VAR GSourceFuncs g_unix_fd_source_funcs; #endif G_END_DECLS #endif /* __G_MAIN_H__ */ PK �w[O�0 � � gmappedfile.hnu �[��� /* GLIB - Library of useful routines for C programming * gmappedfile.h: Simplified wrapper around the mmap function * * Copyright 2005 Matthias Clasen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __G_MAPPED_FILE_H__ #define __G_MAPPED_FILE_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gbytes.h> #include <glib/gerror.h> G_BEGIN_DECLS typedef struct _GMappedFile GMappedFile; GLIB_AVAILABLE_IN_ALL GMappedFile *g_mapped_file_new (const gchar *filename, gboolean writable, GError **error); GLIB_AVAILABLE_IN_ALL GMappedFile *g_mapped_file_new_from_fd (gint fd, gboolean writable, GError **error); GLIB_AVAILABLE_IN_ALL gsize g_mapped_file_get_length (GMappedFile *file); GLIB_AVAILABLE_IN_ALL gchar *g_mapped_file_get_contents (GMappedFile *file); GLIB_AVAILABLE_IN_2_34 GBytes * g_mapped_file_get_bytes (GMappedFile *file); GLIB_AVAILABLE_IN_ALL GMappedFile *g_mapped_file_ref (GMappedFile *file); GLIB_AVAILABLE_IN_ALL void g_mapped_file_unref (GMappedFile *file); GLIB_DEPRECATED_FOR(g_mapped_file_unref) void g_mapped_file_free (GMappedFile *file); G_END_DECLS #endif /* __G_MAPPED_FILE_H__ */ PK �w[:�N|* |* gmarkup.hnu �[��� /* gmarkup.h - Simple XML-like string parser/writer * * Copyright 2000 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __G_MARKUP_H__ #define __G_MARKUP_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <stdarg.h> #include <glib/gerror.h> #include <glib/gslist.h> G_BEGIN_DECLS /** * GMarkupError: * @G_MARKUP_ERROR_BAD_UTF8: text being parsed was not valid UTF-8 * @G_MARKUP_ERROR_EMPTY: document contained nothing, or only whitespace * @G_MARKUP_ERROR_PARSE: document was ill-formed * @G_MARKUP_ERROR_UNKNOWN_ELEMENT: error should be set by #GMarkupParser * functions; element wasn't known * @G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE: error should be set by #GMarkupParser * functions; attribute wasn't known * @G_MARKUP_ERROR_INVALID_CONTENT: error should be set by #GMarkupParser * functions; content was invalid * @G_MARKUP_ERROR_MISSING_ATTRIBUTE: error should be set by #GMarkupParser * functions; a required attribute was missing * * Error codes returned by markup parsing. */ typedef enum { G_MARKUP_ERROR_BAD_UTF8, G_MARKUP_ERROR_EMPTY, G_MARKUP_ERROR_PARSE, /* The following are primarily intended for specific GMarkupParser * implementations to set. */ G_MARKUP_ERROR_UNKNOWN_ELEMENT, G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, G_MARKUP_ERROR_INVALID_CONTENT, G_MARKUP_ERROR_MISSING_ATTRIBUTE } GMarkupError; /** * G_MARKUP_ERROR: * * Error domain for markup parsing. * Errors in this domain will be from the #GMarkupError enumeration. * See #GError for information on error domains. */ #define G_MARKUP_ERROR g_markup_error_quark () GLIB_AVAILABLE_IN_ALL GQuark g_markup_error_quark (void); /** * GMarkupParseFlags: * @G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG: flag you should not use * @G_MARKUP_TREAT_CDATA_AS_TEXT: When this flag is set, CDATA marked * sections are not passed literally to the @passthrough function of * the parser. Instead, the content of the section (without the * `<![CDATA[` and `]]>`) is * passed to the @text function. This flag was added in GLib 2.12 * @G_MARKUP_PREFIX_ERROR_POSITION: Normally errors caught by GMarkup * itself have line/column information prefixed to them to let the * caller know the location of the error. When this flag is set the * location information is also prefixed to errors generated by the * #GMarkupParser implementation functions * @G_MARKUP_IGNORE_QUALIFIED: Ignore (don't report) qualified * attributes and tags, along with their contents. A qualified * attribute or tag is one that contains ':' in its name (ie: is in * another namespace). Since: 2.40. * * Flags that affect the behaviour of the parser. */ typedef enum { G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1 << 0, G_MARKUP_TREAT_CDATA_AS_TEXT = 1 << 1, G_MARKUP_PREFIX_ERROR_POSITION = 1 << 2, G_MARKUP_IGNORE_QUALIFIED = 1 << 3 } GMarkupParseFlags; /** * GMarkupParseContext: * * A parse context is used to parse a stream of bytes that * you expect to contain marked-up text. * * See g_markup_parse_context_new(), #GMarkupParser, and so * on for more details. */ typedef struct _GMarkupParseContext GMarkupParseContext; typedef struct _GMarkupParser GMarkupParser; /** * GMarkupParser: * @start_element: Callback to invoke when the opening tag of an element * is seen. The callback's @attribute_names and @attribute_values parameters * are %NULL-terminated. * @end_element: Callback to invoke when the closing tag of an element * is seen. Note that this is also called for empty tags like * `<empty/>`. * @text: Callback to invoke when some text is seen (text is always * inside an element). Note that the text of an element may be spread * over multiple calls of this function. If the * %G_MARKUP_TREAT_CDATA_AS_TEXT flag is set, this function is also * called for the content of CDATA marked sections. * @passthrough: Callback to invoke for comments, processing instructions * and doctype declarations; if you're re-writing the parsed document, * write the passthrough text back out in the same position. If the * %G_MARKUP_TREAT_CDATA_AS_TEXT flag is not set, this function is also * called for CDATA marked sections. * @error: Callback to invoke when an error occurs. * * Any of the fields in #GMarkupParser can be %NULL, in which case they * will be ignored. Except for the @error function, any of these callbacks * can set an error; in particular the %G_MARKUP_ERROR_UNKNOWN_ELEMENT, * %G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, and %G_MARKUP_ERROR_INVALID_CONTENT * errors are intended to be set from these callbacks. If you set an error * from a callback, g_markup_parse_context_parse() will report that error * back to its caller. */ struct _GMarkupParser { /* Called for open tags <foo bar="baz"> */ void (*start_element) (GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer user_data, GError **error); /* Called for close tags </foo> */ void (*end_element) (GMarkupParseContext *context, const gchar *element_name, gpointer user_data, GError **error); /* Called for character data */ /* text is not nul-terminated */ void (*text) (GMarkupParseContext *context, const gchar *text, gsize text_len, gpointer user_data, GError **error); /* Called for strings that should be re-saved verbatim in this same * position, but are not otherwise interpretable. At the moment * this includes comments and processing instructions. */ /* text is not nul-terminated. */ void (*passthrough) (GMarkupParseContext *context, const gchar *passthrough_text, gsize text_len, gpointer user_data, GError **error); /* Called on error, including one set by other * methods in the vtable. The GError should not be freed. */ void (*error) (GMarkupParseContext *context, GError *error, gpointer user_data); }; GLIB_AVAILABLE_IN_ALL GMarkupParseContext *g_markup_parse_context_new (const GMarkupParser *parser, GMarkupParseFlags flags, gpointer user_data, GDestroyNotify user_data_dnotify); GLIB_AVAILABLE_IN_2_36 GMarkupParseContext *g_markup_parse_context_ref (GMarkupParseContext *context); GLIB_AVAILABLE_IN_2_36 void g_markup_parse_context_unref (GMarkupParseContext *context); GLIB_AVAILABLE_IN_ALL void g_markup_parse_context_free (GMarkupParseContext *context); GLIB_AVAILABLE_IN_ALL gboolean g_markup_parse_context_parse (GMarkupParseContext *context, const gchar *text, gssize text_len, GError **error); GLIB_AVAILABLE_IN_ALL void g_markup_parse_context_push (GMarkupParseContext *context, const GMarkupParser *parser, gpointer user_data); GLIB_AVAILABLE_IN_ALL gpointer g_markup_parse_context_pop (GMarkupParseContext *context); GLIB_AVAILABLE_IN_ALL gboolean g_markup_parse_context_end_parse (GMarkupParseContext *context, GError **error); GLIB_AVAILABLE_IN_ALL const gchar * g_markup_parse_context_get_element (GMarkupParseContext *context); GLIB_AVAILABLE_IN_ALL const GSList * g_markup_parse_context_get_element_stack (GMarkupParseContext *context); /* For user-constructed error messages, has no precise semantics */ GLIB_AVAILABLE_IN_ALL void g_markup_parse_context_get_position (GMarkupParseContext *context, gint *line_number, gint *char_number); GLIB_AVAILABLE_IN_ALL gpointer g_markup_parse_context_get_user_data (GMarkupParseContext *context); /* useful when saving */ GLIB_AVAILABLE_IN_ALL gchar* g_markup_escape_text (const gchar *text, gssize length); GLIB_AVAILABLE_IN_ALL gchar *g_markup_printf_escaped (const char *format, ...) G_GNUC_PRINTF (1, 2); GLIB_AVAILABLE_IN_ALL gchar *g_markup_vprintf_escaped (const char *format, va_list args) G_GNUC_PRINTF(1, 0); typedef enum { G_MARKUP_COLLECT_INVALID, G_MARKUP_COLLECT_STRING, G_MARKUP_COLLECT_STRDUP, G_MARKUP_COLLECT_BOOLEAN, G_MARKUP_COLLECT_TRISTATE, G_MARKUP_COLLECT_OPTIONAL = (1 << 16) } GMarkupCollectType; /* useful from start_element */ GLIB_AVAILABLE_IN_ALL gboolean g_markup_collect_attributes (const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, GError **error, GMarkupCollectType first_type, const gchar *first_attr, ...); G_END_DECLS #endif /* __G_MARKUP_H__ */ PK �w[�ԓ* : : gmem.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_MEM_H__ #define __G_MEM_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gutils.h> #if defined(glib_typeof_2_68) && GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68 /* for glib_typeof */ #include <type_traits> #endif G_BEGIN_DECLS /** * GMemVTable: * @malloc: function to use for allocating memory. * @realloc: function to use for reallocating memory. * @free: function to use to free memory. * @calloc: function to use for allocating zero-filled memory. * @try_malloc: function to use for allocating memory without a default error handler. * @try_realloc: function to use for reallocating memory without a default error handler. * * A set of functions used to perform memory allocation. The same #GMemVTable must * be used for all allocations in the same program; a call to g_mem_set_vtable(), * if it exists, should be prior to any use of GLib. * * This functions related to this has been deprecated in 2.46, and no longer work. */ typedef struct _GMemVTable GMemVTable; #if GLIB_SIZEOF_VOID_P > GLIB_SIZEOF_LONG /** * G_MEM_ALIGN: * * Indicates the number of bytes to which memory will be aligned on the * current platform. */ # define G_MEM_ALIGN GLIB_SIZEOF_VOID_P #else /* GLIB_SIZEOF_VOID_P <= GLIB_SIZEOF_LONG */ # define G_MEM_ALIGN GLIB_SIZEOF_LONG #endif /* GLIB_SIZEOF_VOID_P <= GLIB_SIZEOF_LONG */ /* Memory allocation functions */ GLIB_AVAILABLE_IN_ALL void g_free (gpointer mem); GLIB_AVAILABLE_IN_2_34 void g_clear_pointer (gpointer *pp, GDestroyNotify destroy); GLIB_AVAILABLE_IN_ALL gpointer g_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); GLIB_AVAILABLE_IN_ALL gpointer g_malloc0 (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); GLIB_AVAILABLE_IN_ALL gpointer g_realloc (gpointer mem, gsize n_bytes) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL gpointer g_try_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); GLIB_AVAILABLE_IN_ALL gpointer g_try_malloc0 (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); GLIB_AVAILABLE_IN_ALL gpointer g_try_realloc (gpointer mem, gsize n_bytes) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL gpointer g_malloc_n (gsize n_blocks, gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2); GLIB_AVAILABLE_IN_ALL gpointer g_malloc0_n (gsize n_blocks, gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2); GLIB_AVAILABLE_IN_ALL gpointer g_realloc_n (gpointer mem, gsize n_blocks, gsize n_block_bytes) G_GNUC_WARN_UNUSED_RESULT; GLIB_AVAILABLE_IN_ALL gpointer g_try_malloc_n (gsize n_blocks, gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2); GLIB_AVAILABLE_IN_ALL gpointer g_try_malloc0_n (gsize n_blocks, gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2); GLIB_AVAILABLE_IN_ALL gpointer g_try_realloc_n (gpointer mem, gsize n_blocks, gsize n_block_bytes) G_GNUC_WARN_UNUSED_RESULT; #if defined(glib_typeof) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_58 && (!defined(glib_typeof_2_68) || GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68) #define g_clear_pointer(pp, destroy) \ G_STMT_START \ { \ G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer)); \ glib_typeof ((pp)) _pp = (pp); \ glib_typeof (*(pp)) _ptr = *_pp; \ *_pp = NULL; \ if (_ptr) \ (destroy) (_ptr); \ } \ G_STMT_END \ GLIB_AVAILABLE_MACRO_IN_2_34 #else /* __GNUC__ */ #define g_clear_pointer(pp, destroy) \ G_STMT_START { \ G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer)); \ /* Only one access, please; work around type aliasing */ \ union { char *in; gpointer *out; } _pp; \ gpointer _p; \ /* This assignment is needed to avoid a gcc warning */ \ GDestroyNotify _destroy = (GDestroyNotify) (destroy); \ \ _pp.in = (char *) (pp); \ _p = *_pp.out; \ if (_p) \ { \ *_pp.out = NULL; \ _destroy (_p); \ } \ } G_STMT_END \ GLIB_AVAILABLE_MACRO_IN_2_34 #endif /* __GNUC__ */ /** * g_steal_pointer: * @pp: (not nullable): a pointer to a pointer * * Sets @pp to %NULL, returning the value that was there before. * * Conceptually, this transfers the ownership of the pointer from the * referenced variable to the "caller" of the macro (ie: "steals" the * reference). * * The return value will be properly typed, according to the type of * @pp. * * This can be very useful when combined with g_autoptr() to prevent the * return value of a function from being automatically freed. Consider * the following example (which only works on GCC and clang): * * |[ * GObject * * create_object (void) * { * g_autoptr(GObject) obj = g_object_new (G_TYPE_OBJECT, NULL); * * if (early_error_case) * return NULL; * * return g_steal_pointer (&obj); * } * ]| * * It can also be used in similar ways for 'out' parameters and is * particularly useful for dealing with optional out parameters: * * |[ * gboolean * get_object (GObject **obj_out) * { * g_autoptr(GObject) obj = g_object_new (G_TYPE_OBJECT, NULL); * * if (early_error_case) * return FALSE; * * if (obj_out) * *obj_out = g_steal_pointer (&obj); * * return TRUE; * } * ]| * * In the above example, the object will be automatically freed in the * early error case and also in the case that %NULL was given for * @obj_out. * * Since: 2.44 */ GLIB_AVAILABLE_STATIC_INLINE_IN_2_44 static inline gpointer g_steal_pointer (gpointer pp) { gpointer *ptr = (gpointer *) pp; gpointer ref; ref = *ptr; *ptr = NULL; return ref; } /* type safety */ #if defined(glib_typeof) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_58 && (!defined(glib_typeof_2_68) || GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68) #define g_steal_pointer(pp) ((glib_typeof (*pp)) (g_steal_pointer) (pp)) #else /* __GNUC__ */ /* This version does not depend on gcc extensions, but gcc does not warn * about incompatible-pointer-types: */ #define g_steal_pointer(pp) \ (0 ? (*(pp)) : (g_steal_pointer) (pp)) #endif /* __GNUC__ */ /* Optimise: avoid the call to the (slower) _n function if we can * determine at compile-time that no overflow happens. */ #if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__) # define _G_NEW(struct_type, n_structs, func) \ (struct_type *) (G_GNUC_EXTENSION ({ \ gsize __n = (gsize) (n_structs); \ gsize __s = sizeof (struct_type); \ gpointer __p; \ if (__s == 1) \ __p = g_##func (__n); \ else if (__builtin_constant_p (__n) && \ (__s == 0 || __n <= G_MAXSIZE / __s)) \ __p = g_##func (__n * __s); \ else \ __p = g_##func##_n (__n, __s); \ __p; \ })) # define _G_RENEW(struct_type, mem, n_structs, func) \ (struct_type *) (G_GNUC_EXTENSION ({ \ gsize __n = (gsize) (n_structs); \ gsize __s = sizeof (struct_type); \ gpointer __p = (gpointer) (mem); \ if (__s == 1) \ __p = g_##func (__p, __n); \ else if (__builtin_constant_p (__n) && \ (__s == 0 || __n <= G_MAXSIZE / __s)) \ __p = g_##func (__p, __n * __s); \ else \ __p = g_##func##_n (__p, __n, __s); \ __p; \ })) #else /* Unoptimised version: always call the _n() function. */ #define _G_NEW(struct_type, n_structs, func) \ ((struct_type *) g_##func##_n ((n_structs), sizeof (struct_type))) #define _G_RENEW(struct_type, mem, n_structs, func) \ ((struct_type *) g_##func##_n (mem, (n_structs), sizeof (struct_type))) #endif /** * g_new: * @struct_type: the type of the elements to allocate * @n_structs: the number of elements to allocate * * Allocates @n_structs elements of type @struct_type. * The returned pointer is cast to a pointer to the given type. * If @n_structs is 0 it returns %NULL. * Care is taken to avoid overflow when calculating the size of the allocated block. * * Since the returned pointer is already casted to the right type, * it is normally unnecessary to cast it explicitly, and doing * so might hide memory allocation errors. * * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type */ #define g_new(struct_type, n_structs) _G_NEW (struct_type, n_structs, malloc) /** * g_new0: * @struct_type: the type of the elements to allocate. * @n_structs: the number of elements to allocate. * * Allocates @n_structs elements of type @struct_type, initialized to 0's. * The returned pointer is cast to a pointer to the given type. * If @n_structs is 0 it returns %NULL. * Care is taken to avoid overflow when calculating the size of the allocated block. * * Since the returned pointer is already casted to the right type, * it is normally unnecessary to cast it explicitly, and doing * so might hide memory allocation errors. * * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type. */ #define g_new0(struct_type, n_structs) _G_NEW (struct_type, n_structs, malloc0) /** * g_renew: * @struct_type: the type of the elements to allocate * @mem: the currently allocated memory * @n_structs: the number of elements to allocate * * Reallocates the memory pointed to by @mem, so that it now has space for * @n_structs elements of type @struct_type. It returns the new address of * the memory, which may have been moved. * Care is taken to avoid overflow when calculating the size of the allocated block. * * Returns: a pointer to the new allocated memory, cast to a pointer to @struct_type */ #define g_renew(struct_type, mem, n_structs) _G_RENEW (struct_type, mem, n_structs, realloc) /** * g_try_new: * @struct_type: the type of the elements to allocate * @n_structs: the number of elements to allocate * * Attempts to allocate @n_structs elements of type @struct_type, and returns * %NULL on failure. Contrast with g_new(), which aborts the program on failure. * The returned pointer is cast to a pointer to the given type. * The function returns %NULL when @n_structs is 0 of if an overflow occurs. * * Since: 2.8 * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type */ #define g_try_new(struct_type, n_structs) _G_NEW (struct_type, n_structs, try_malloc) /** * g_try_new0: * @struct_type: the type of the elements to allocate * @n_structs: the number of elements to allocate * * Attempts to allocate @n_structs elements of type @struct_type, initialized * to 0's, and returns %NULL on failure. Contrast with g_new0(), which aborts * the program on failure. * The returned pointer is cast to a pointer to the given type. * The function returns %NULL when @n_structs is 0 or if an overflow occurs. * * Since: 2.8 * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type */ #define g_try_new0(struct_type, n_structs) _G_NEW (struct_type, n_structs, try_malloc0) /** * g_try_renew: * @struct_type: the type of the elements to allocate * @mem: the currently allocated memory * @n_structs: the number of elements to allocate * * Attempts to reallocate the memory pointed to by @mem, so that it now has * space for @n_structs elements of type @struct_type, and returns %NULL on * failure. Contrast with g_renew(), which aborts the program on failure. * It returns the new address of the memory, which may have been moved. * The function returns %NULL if an overflow occurs. * * Since: 2.8 * Returns: a pointer to the new allocated memory, cast to a pointer to @struct_type */ #define g_try_renew(struct_type, mem, n_structs) _G_RENEW (struct_type, mem, n_structs, try_realloc) /* Memory allocation virtualization for debugging purposes * g_mem_set_vtable() has to be the very first GLib function called * if being used */ struct _GMemVTable { gpointer (*malloc) (gsize n_bytes); gpointer (*realloc) (gpointer mem, gsize n_bytes); void (*free) (gpointer mem); /* optional; set to NULL if not used ! */ gpointer (*calloc) (gsize n_blocks, gsize n_block_bytes); gpointer (*try_malloc) (gsize n_bytes); gpointer (*try_realloc) (gpointer mem, gsize n_bytes); }; GLIB_DEPRECATED_IN_2_46 void g_mem_set_vtable (GMemVTable *vtable); GLIB_DEPRECATED_IN_2_46 gboolean g_mem_is_system_malloc (void); GLIB_VAR gboolean g_mem_gc_friendly; /* Memory profiler and checker, has to be enabled via g_mem_set_vtable() */ GLIB_VAR GMemVTable *glib_mem_profiler_table; GLIB_DEPRECATED_IN_2_46 void g_mem_profile (void); G_END_DECLS #endif /* __G_MEM_H__ */ PK �w[u��M9j 9j gmessages.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_MESSAGES_H__ #define __G_MESSAGES_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <stdarg.h> #include <glib/gatomic.h> #include <glib/gtypes.h> #include <glib/gmacros.h> #include <glib/gvariant.h> G_BEGIN_DECLS /* calculate a string size, guaranteed to fit format + args. */ GLIB_AVAILABLE_IN_ALL gsize g_printf_string_upper_bound (const gchar* format, va_list args) G_GNUC_PRINTF(1, 0); /* Log level shift offset for user defined * log levels (0-7 are used by GLib). */ #define G_LOG_LEVEL_USER_SHIFT (8) /* Glib log levels and flags. */ typedef enum { /* log flags */ G_LOG_FLAG_RECURSION = 1 << 0, G_LOG_FLAG_FATAL = 1 << 1, /* GLib log levels */ G_LOG_LEVEL_ERROR = 1 << 2, /* always fatal */ G_LOG_LEVEL_CRITICAL = 1 << 3, G_LOG_LEVEL_WARNING = 1 << 4, G_LOG_LEVEL_MESSAGE = 1 << 5, G_LOG_LEVEL_INFO = 1 << 6, G_LOG_LEVEL_DEBUG = 1 << 7, G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL) } GLogLevelFlags; /* GLib log levels that are considered fatal by default */ #define G_LOG_FATAL_MASK (G_LOG_FLAG_RECURSION | G_LOG_LEVEL_ERROR) typedef void (*GLogFunc) (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data); /* Logging mechanism */ GLIB_AVAILABLE_IN_ALL guint g_log_set_handler (const gchar *log_domain, GLogLevelFlags log_levels, GLogFunc log_func, gpointer user_data); GLIB_AVAILABLE_IN_2_46 guint g_log_set_handler_full (const gchar *log_domain, GLogLevelFlags log_levels, GLogFunc log_func, gpointer user_data, GDestroyNotify destroy); GLIB_AVAILABLE_IN_ALL void g_log_remove_handler (const gchar *log_domain, guint handler_id); GLIB_AVAILABLE_IN_ALL void g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data); GLIB_AVAILABLE_IN_ALL GLogFunc g_log_set_default_handler (GLogFunc log_func, gpointer user_data); GLIB_AVAILABLE_IN_ALL void g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, ...) G_GNUC_PRINTF (3, 4); GLIB_AVAILABLE_IN_ALL void g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args) G_GNUC_PRINTF(3, 0); GLIB_AVAILABLE_IN_ALL GLogLevelFlags g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask); GLIB_AVAILABLE_IN_ALL GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask); /* Structured logging mechanism. */ /** * GLogWriterOutput: * @G_LOG_WRITER_HANDLED: Log writer has handled the log entry. * @G_LOG_WRITER_UNHANDLED: Log writer could not handle the log entry. * * Return values from #GLogWriterFuncs to indicate whether the given log entry * was successfully handled by the writer, or whether there was an error in * handling it (and hence a fallback writer should be used). * * If a #GLogWriterFunc ignores a log entry, it should return * %G_LOG_WRITER_HANDLED. * * Since: 2.50 */ typedef enum { G_LOG_WRITER_HANDLED = 1, G_LOG_WRITER_UNHANDLED = 0, } GLogWriterOutput; /** * GLogField: * @key: field name (UTF-8 string) * @value: field value (arbitrary bytes) * @length: length of @value, in bytes, or -1 if it is nul-terminated * * Structure representing a single field in a structured log entry. See * g_log_structured() for details. * * Log fields may contain arbitrary values, including binary with embedded nul * bytes. If the field contains a string, the string must be UTF-8 encoded and * have a trailing nul byte. Otherwise, @length must be set to a non-negative * value. * * Since: 2.50 */ typedef struct _GLogField GLogField; struct _GLogField { const gchar *key; gconstpointer value; gssize length; }; /** * GLogWriterFunc: * @log_level: log level of the message * @fields: (array length=n_fields): fields forming the message * @n_fields: number of @fields * @user_data: user data passed to g_log_set_writer_func() * * Writer function for log entries. A log entry is a collection of one or more * #GLogFields, using the standard [field names from journal * specification](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html). * See g_log_structured() for more information. * * Writer functions must ignore fields which they do not recognise, unless they * can write arbitrary binary output, as field values may be arbitrary binary. * * @log_level is guaranteed to be included in @fields as the `PRIORITY` field, * but is provided separately for convenience of deciding whether or where to * output the log entry. * * Writer functions should return %G_LOG_WRITER_HANDLED if they handled the log * message successfully or if they deliberately ignored it. If there was an * error handling the message (for example, if the writer function is meant to * send messages to a remote logging server and there is a network error), it * should return %G_LOG_WRITER_UNHANDLED. This allows writer functions to be * chained and fall back to simpler handlers in case of failure. * * Returns: %G_LOG_WRITER_HANDLED if the log entry was handled successfully; * %G_LOG_WRITER_UNHANDLED otherwise * Since: 2.50 */ typedef GLogWriterOutput (*GLogWriterFunc) (GLogLevelFlags log_level, const GLogField *fields, gsize n_fields, gpointer user_data); GLIB_AVAILABLE_IN_2_50 void g_log_structured (const gchar *log_domain, GLogLevelFlags log_level, ...); GLIB_AVAILABLE_IN_2_50 void g_log_structured_array (GLogLevelFlags log_level, const GLogField *fields, gsize n_fields); GLIB_AVAILABLE_IN_2_50 void g_log_variant (const gchar *log_domain, GLogLevelFlags log_level, GVariant *fields); GLIB_AVAILABLE_IN_2_50 void g_log_set_writer_func (GLogWriterFunc func, gpointer user_data, GDestroyNotify user_data_free); GLIB_AVAILABLE_IN_2_50 gboolean g_log_writer_supports_color (gint output_fd); GLIB_AVAILABLE_IN_2_50 gboolean g_log_writer_is_journald (gint output_fd); GLIB_AVAILABLE_IN_2_50 gchar *g_log_writer_format_fields (GLogLevelFlags log_level, const GLogField *fields, gsize n_fields, gboolean use_color); GLIB_AVAILABLE_IN_2_50 GLogWriterOutput g_log_writer_journald (GLogLevelFlags log_level, const GLogField *fields, gsize n_fields, gpointer user_data); GLIB_AVAILABLE_IN_2_50 GLogWriterOutput g_log_writer_standard_streams (GLogLevelFlags log_level, const GLogField *fields, gsize n_fields, gpointer user_data); GLIB_AVAILABLE_IN_2_50 GLogWriterOutput g_log_writer_default (GLogLevelFlags log_level, const GLogField *fields, gsize n_fields, gpointer user_data); GLIB_AVAILABLE_IN_2_68 void g_log_writer_default_set_use_stderr (gboolean use_stderr); GLIB_AVAILABLE_IN_2_68 gboolean g_log_writer_default_would_drop (GLogLevelFlags log_level, const char *log_domain); /** * G_DEBUG_HERE: * * A convenience form of g_log_structured(), recommended to be added to * functions when debugging. It prints the current monotonic time and the code * location using %G_STRLOC. * * Since: 2.50 */ #define G_DEBUG_HERE() \ g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ "CODE_FILE", __FILE__, \ "CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_FUNC", G_STRFUNC, \ "MESSAGE", "%" G_GINT64_FORMAT ": %s", \ g_get_monotonic_time (), G_STRLOC) /* internal */ void _g_log_fallback_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data); /* Internal functions, used to implement the following macros */ GLIB_AVAILABLE_IN_ALL void g_return_if_fail_warning (const char *log_domain, const char *pretty_function, const char *expression) G_ANALYZER_NORETURN; GLIB_AVAILABLE_IN_ALL void g_warn_message (const char *domain, const char *file, int line, const char *func, const char *warnexpr) G_ANALYZER_NORETURN; GLIB_DEPRECATED G_NORETURN void g_assert_warning (const char *log_domain, const char *file, const int line, const char *pretty_function, const char *expression); GLIB_AVAILABLE_IN_2_56 void g_log_structured_standard (const gchar *log_domain, GLogLevelFlags log_level, const gchar *file, const gchar *line, const gchar *func, const gchar *message_format, ...) G_GNUC_PRINTF (6, 7); #ifndef G_LOG_DOMAIN #define G_LOG_DOMAIN ((gchar*) 0) #endif /* G_LOG_DOMAIN */ #if defined(G_HAVE_ISO_VARARGS) && !G_ANALYZER_ANALYZING #if defined(G_LOG_USE_STRUCTURED) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56 #define g_error(...) G_STMT_START { \ g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \ __FILE__, G_STRINGIFY (__LINE__), \ G_STRFUNC, __VA_ARGS__); \ for (;;) ; \ } G_STMT_END #define g_message(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, \ __FILE__, G_STRINGIFY (__LINE__), \ G_STRFUNC, __VA_ARGS__) #define g_critical(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \ __FILE__, G_STRINGIFY (__LINE__), \ G_STRFUNC, __VA_ARGS__) #define g_warning(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, \ __FILE__, G_STRINGIFY (__LINE__), \ G_STRFUNC, __VA_ARGS__) #define g_info(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \ __FILE__, G_STRINGIFY (__LINE__), \ G_STRFUNC, __VA_ARGS__) #define g_debug(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ __FILE__, G_STRINGIFY (__LINE__), \ G_STRFUNC, __VA_ARGS__) #else /* for(;;) ; so that GCC knows that control doesn't go past g_error(). * Put space before ending semicolon to avoid C++ build warnings. */ #define g_error(...) G_STMT_START { \ g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_ERROR, \ __VA_ARGS__); \ for (;;) ; \ } G_STMT_END #define g_message(...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_MESSAGE, \ __VA_ARGS__) #define g_critical(...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_CRITICAL, \ __VA_ARGS__) #define g_warning(...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_WARNING, \ __VA_ARGS__) #define g_info(...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_INFO, \ __VA_ARGS__) #define g_debug(...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_DEBUG, \ __VA_ARGS__) #endif #elif defined(G_HAVE_GNUC_VARARGS) && !G_ANALYZER_ANALYZING #if defined(G_LOG_USE_STRUCTURED) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56 #define g_error(format...) G_STMT_START { \ g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \ __FILE__, G_STRINGIFY (__LINE__), \ G_STRFUNC, format); \ for (;;) ; \ } G_STMT_END #define g_message(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, \ __FILE__, G_STRINGIFY (__LINE__), \ G_STRFUNC, format) #define g_critical(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \ __FILE__, G_STRINGIFY (__LINE__), \ G_STRFUNC, format) #define g_warning(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, \ __FILE__, G_STRINGIFY (__LINE__), \ G_STRFUNC, format) #define g_info(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \ __FILE__, G_STRINGIFY (__LINE__), \ G_STRFUNC, format) #define g_debug(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ __FILE__, G_STRINGIFY (__LINE__), \ G_STRFUNC, format) #else #define g_error(format...) G_STMT_START { \ g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_ERROR, \ format); \ for (;;) ; \ } G_STMT_END #define g_message(format...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_MESSAGE, \ format) #define g_critical(format...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_CRITICAL, \ format) #define g_warning(format...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_WARNING, \ format) #define g_info(format...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_INFO, \ format) #define g_debug(format...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_DEBUG, \ format) #endif #else /* no varargs macros */ static G_NORETURN void g_error (const gchar *format, ...) G_ANALYZER_NORETURN; static void g_critical (const gchar *format, ...) G_ANALYZER_NORETURN; static inline 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); for(;;) ; } static inline 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 inline void g_critical (const gchar *format, ...) { va_list args; va_start (args, format); g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, format, args); va_end (args); } static inline 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); } static inline void g_info (const gchar *format, ...) { va_list args; va_start (args, format); g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format, args); va_end (args); } static inline void g_debug (const gchar *format, ...) { va_list args; va_start (args, format); g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format, args); va_end (args); } #endif /* !__GNUC__ */ /** * g_warning_once: * @...: format string, followed by parameters to insert * into the format string (as with printf()) * * Logs a warning only once. * * g_warning_once() calls g_warning() with the passed message the first time * the statement is executed; subsequent times it is a no-op. * * Note! On platforms where the compiler doesn't support variadic macros, the * warning is printed each time instead of only once. * * Since: 2.64 */ #if defined(G_HAVE_ISO_VARARGS) && !G_ANALYZER_ANALYZING #define g_warning_once(...) \ G_STMT_START { \ static int G_PASTE (_GWarningOnceBoolean, __LINE__) = 0; /* (atomic) */ \ if (g_atomic_int_compare_and_exchange (&G_PASTE (_GWarningOnceBoolean, __LINE__), \ 0, 1)) \ g_warning (__VA_ARGS__); \ } G_STMT_END \ GLIB_AVAILABLE_MACRO_IN_2_64 #elif defined(G_HAVE_GNUC_VARARGS) && !G_ANALYZER_ANALYZING #define g_warning_once(format...) \ G_STMT_START { \ static int G_PASTE (_GWarningOnceBoolean, __LINE__) = 0; /* (atomic) */ \ if (g_atomic_int_compare_and_exchange (&G_PASTE (_GWarningOnceBoolean, __LINE__), \ 0, 1)) \ g_warning (format); \ } G_STMT_END \ GLIB_AVAILABLE_MACRO_IN_2_64 #else #define g_warning_once g_warning #endif /** * GPrintFunc: * @string: the message to output * * Specifies the type of the print handler functions. * These are called with the complete formatted string to output. */ typedef void (*GPrintFunc) (const gchar *string); GLIB_AVAILABLE_IN_ALL void g_print (const gchar *format, ...) G_GNUC_PRINTF (1, 2); GLIB_AVAILABLE_IN_ALL GPrintFunc g_set_print_handler (GPrintFunc func); GLIB_AVAILABLE_IN_ALL void g_printerr (const gchar *format, ...) G_GNUC_PRINTF (1, 2); GLIB_AVAILABLE_IN_ALL GPrintFunc g_set_printerr_handler (GPrintFunc func); /** * g_warn_if_reached: * * Logs a warning. * * Since: 2.16 */ #define g_warn_if_reached() \ do { \ g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); \ } while (0) /** * g_warn_if_fail: * @expr: the expression to check * * Logs a warning if the expression is not true. * * Since: 2.16 */ #define g_warn_if_fail(expr) \ do { \ if G_LIKELY (expr) ; \ else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, #expr); \ } while (0) #ifdef G_DISABLE_CHECKS /** * g_return_if_fail: * @expr: the expression to check * * Verifies that the expression @expr, usually representing a precondition, * evaluates to %TRUE. If the function returns a value, use * g_return_val_if_fail() instead. * * If @expr evaluates to %FALSE, the current function should be considered to * have undefined behaviour (a programmer error). The only correct solution * to such an error is to change the module that is calling the current * function, so that it avoids this incorrect call. * * To make this undefined behaviour visible, if @expr evaluates to %FALSE, * the result is usually that a critical message is logged and the current * function returns. * * If `G_DISABLE_CHECKS` is defined then the check is not performed. You * should therefore not depend on any side effects of @expr. * * To debug failure of a g_return_if_fail() check, run the code under a debugger * with `G_DEBUG=fatal-criticals` or `G_DEBUG=fatal-warnings` defined in the * environment (see [Running GLib Applications](glib-running.html)): * * |[ * G_DEBUG=fatal-warnings gdb ./my-program * ]| * * Any unrelated failures can be skipped over in * [gdb](https://www.gnu.org/software/gdb/) using the `continue` command. */ #define g_return_if_fail(expr) G_STMT_START{ (void)0; }G_STMT_END /** * g_return_val_if_fail: * @expr: the expression to check * @val: the value to return from the current function * if the expression is not true * * Verifies that the expression @expr, usually representing a precondition, * evaluates to %TRUE. If the function does not return a value, use * g_return_if_fail() instead. * * If @expr evaluates to %FALSE, the current function should be considered to * have undefined behaviour (a programmer error). The only correct solution * to such an error is to change the module that is calling the current * function, so that it avoids this incorrect call. * * To make this undefined behaviour visible, if @expr evaluates to %FALSE, * the result is usually that a critical message is logged and @val is * returned from the current function. * * If `G_DISABLE_CHECKS` is defined then the check is not performed. You * should therefore not depend on any side effects of @expr. * * See g_return_if_fail() for guidance on how to debug failure of this check. */ #define g_return_val_if_fail(expr,val) G_STMT_START{ (void)0; }G_STMT_END /** * g_return_if_reached: * * Logs a critical message and returns from the current function. * This can only be used in functions which do not return a value. * * See g_return_if_fail() for guidance on how to debug failure of this check. */ #define g_return_if_reached() G_STMT_START{ return; }G_STMT_END /** * g_return_val_if_reached: * @val: the value to return from the current function * * Logs a critical message and returns @val. * * See g_return_if_fail() for guidance on how to debug failure of this check. */ #define g_return_val_if_reached(val) G_STMT_START{ return (val); }G_STMT_END #else /* !G_DISABLE_CHECKS */ #define g_return_if_fail(expr) \ G_STMT_START { \ if (G_LIKELY (expr)) \ { } \ else \ { \ g_return_if_fail_warning (G_LOG_DOMAIN, \ G_STRFUNC, \ #expr); \ return; \ } \ } G_STMT_END #define g_return_val_if_fail(expr, val) \ G_STMT_START { \ if (G_LIKELY (expr)) \ { } \ else \ { \ g_return_if_fail_warning (G_LOG_DOMAIN, \ G_STRFUNC, \ #expr); \ return (val); \ } \ } G_STMT_END #define g_return_if_reached() \ G_STMT_START { \ g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_CRITICAL, \ "file %s: line %d (%s): should not be reached", \ __FILE__, \ __LINE__, \ G_STRFUNC); \ return; \ } G_STMT_END #define g_return_val_if_reached(val) \ G_STMT_START { \ g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_CRITICAL, \ "file %s: line %d (%s): should not be reached", \ __FILE__, \ __LINE__, \ G_STRFUNC); \ return (val); \ } G_STMT_END #endif /* !G_DISABLE_CHECKS */ G_END_DECLS #endif /* __G_MESSAGES_H__ */ PK �w[�m�A�! �! gnode.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_NODE_H__ #define __G_NODE_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gmem.h> G_BEGIN_DECLS typedef struct _GNode GNode; /* Tree traverse flags */ typedef enum { G_TRAVERSE_LEAVES = 1 << 0, G_TRAVERSE_NON_LEAVES = 1 << 1, G_TRAVERSE_ALL = G_TRAVERSE_LEAVES | G_TRAVERSE_NON_LEAVES, G_TRAVERSE_MASK = 0x03, G_TRAVERSE_LEAFS = G_TRAVERSE_LEAVES, G_TRAVERSE_NON_LEAFS = G_TRAVERSE_NON_LEAVES } GTraverseFlags; /* Tree traverse orders */ typedef enum { G_IN_ORDER, G_PRE_ORDER, G_POST_ORDER, G_LEVEL_ORDER } GTraverseType; typedef gboolean (*GNodeTraverseFunc) (GNode *node, gpointer data); typedef void (*GNodeForeachFunc) (GNode *node, gpointer data); /* N-way tree implementation */ struct _GNode { gpointer data; GNode *next; GNode *prev; GNode *parent; GNode *children; }; /** * G_NODE_IS_ROOT: * @node: a #GNode * * Returns %TRUE if a #GNode is the root of a tree. * * Returns: %TRUE if the #GNode is the root of a tree * (i.e. it has no parent or siblings) */ #define G_NODE_IS_ROOT(node) (((GNode*) (node))->parent == NULL && \ ((GNode*) (node))->prev == NULL && \ ((GNode*) (node))->next == NULL) /** * G_NODE_IS_LEAF: * @node: a #GNode * * Returns %TRUE if a #GNode is a leaf node. * * Returns: %TRUE if the #GNode is a leaf node * (i.e. it has no children) */ #define G_NODE_IS_LEAF(node) (((GNode*) (node))->children == NULL) GLIB_AVAILABLE_IN_ALL GNode* g_node_new (gpointer data); GLIB_AVAILABLE_IN_ALL void g_node_destroy (GNode *root); GLIB_AVAILABLE_IN_ALL void g_node_unlink (GNode *node); GLIB_AVAILABLE_IN_ALL GNode* g_node_copy_deep (GNode *node, GCopyFunc copy_func, gpointer data); GLIB_AVAILABLE_IN_ALL GNode* g_node_copy (GNode *node); GLIB_AVAILABLE_IN_ALL GNode* g_node_insert (GNode *parent, gint position, GNode *node); GLIB_AVAILABLE_IN_ALL GNode* g_node_insert_before (GNode *parent, GNode *sibling, GNode *node); GLIB_AVAILABLE_IN_ALL GNode* g_node_insert_after (GNode *parent, GNode *sibling, GNode *node); GLIB_AVAILABLE_IN_ALL GNode* g_node_prepend (GNode *parent, GNode *node); GLIB_AVAILABLE_IN_ALL guint g_node_n_nodes (GNode *root, GTraverseFlags flags); GLIB_AVAILABLE_IN_ALL GNode* g_node_get_root (GNode *node); GLIB_AVAILABLE_IN_ALL gboolean g_node_is_ancestor (GNode *node, GNode *descendant); GLIB_AVAILABLE_IN_ALL guint g_node_depth (GNode *node); GLIB_AVAILABLE_IN_ALL GNode* g_node_find (GNode *root, GTraverseType order, GTraverseFlags flags, gpointer data); /* convenience macros */ /** * g_node_append: * @parent: the #GNode to place the new #GNode under * @node: the #GNode to insert * * Inserts a #GNode as the last child of the given parent. * * Returns: the inserted #GNode */ #define g_node_append(parent, node) \ g_node_insert_before ((parent), NULL, (node)) /** * g_node_insert_data: * @parent: the #GNode to place the new #GNode under * @position: the position to place the new #GNode at. If position is -1, * the new #GNode is inserted as the last child of @parent * @data: the data for the new #GNode * * Inserts a new #GNode at the given position. * * Returns: the new #GNode */ #define g_node_insert_data(parent, position, data) \ g_node_insert ((parent), (position), g_node_new (data)) /** * g_node_insert_data_after: * @parent: the #GNode to place the new #GNode under * @sibling: the sibling #GNode to place the new #GNode after * @data: the data for the new #GNode * * Inserts a new #GNode after the given sibling. * * Returns: the new #GNode */ #define g_node_insert_data_after(parent, sibling, data) \ g_node_insert_after ((parent), (sibling), g_node_new (data)) /** * g_node_insert_data_before: * @parent: the #GNode to place the new #GNode under * @sibling: the sibling #GNode to place the new #GNode before * @data: the data for the new #GNode * * Inserts a new #GNode before the given sibling. * * Returns: the new #GNode */ #define g_node_insert_data_before(parent, sibling, data) \ g_node_insert_before ((parent), (sibling), g_node_new (data)) /** * g_node_prepend_data: * @parent: the #GNode to place the new #GNode under * @data: the data for the new #GNode * * Inserts a new #GNode as the first child of the given parent. * * Returns: the new #GNode */ #define g_node_prepend_data(parent, data) \ g_node_prepend ((parent), g_node_new (data)) /** * g_node_append_data: * @parent: the #GNode to place the new #GNode under * @data: the data for the new #GNode * * Inserts a new #GNode as the last child of the given parent. * * Returns: the new #GNode */ #define g_node_append_data(parent, data) \ g_node_insert_before ((parent), NULL, g_node_new (data)) /* traversal function, assumes that 'node' is root * (only traverses 'node' and its subtree). * this function is just a high level interface to * low level traversal functions, optimized for speed. */ GLIB_AVAILABLE_IN_ALL void g_node_traverse (GNode *root, GTraverseType order, GTraverseFlags flags, gint max_depth, GNodeTraverseFunc func, gpointer data); /* return the maximum tree height starting with 'node', this is an expensive * operation, since we need to visit all nodes. this could be shortened by * adding 'guint height' to struct _GNode, but then again, this is not very * often needed, and would make g_node_insert() more time consuming. */ GLIB_AVAILABLE_IN_ALL guint g_node_max_height (GNode *root); GLIB_AVAILABLE_IN_ALL void g_node_children_foreach (GNode *node, GTraverseFlags flags, GNodeForeachFunc func, gpointer data); GLIB_AVAILABLE_IN_ALL void g_node_reverse_children (GNode *node); GLIB_AVAILABLE_IN_ALL guint g_node_n_children (GNode *node); GLIB_AVAILABLE_IN_ALL GNode* g_node_nth_child (GNode *node, guint n); GLIB_AVAILABLE_IN_ALL GNode* g_node_last_child (GNode *node); GLIB_AVAILABLE_IN_ALL GNode* g_node_find_child (GNode *node, GTraverseFlags flags, gpointer data); GLIB_AVAILABLE_IN_ALL gint g_node_child_position (GNode *node, GNode *child); GLIB_AVAILABLE_IN_ALL gint g_node_child_index (GNode *node, gpointer data); GLIB_AVAILABLE_IN_ALL GNode* g_node_first_sibling (GNode *node); GLIB_AVAILABLE_IN_ALL GNode* g_node_last_sibling (GNode *node); /** * g_node_prev_sibling: * @node: a #GNode * * Gets the previous sibling of a #GNode. * * Returns: the previous sibling of @node, or %NULL if @node is the first * node or %NULL */ #define g_node_prev_sibling(node) ((node) ? \ ((GNode*) (node))->prev : NULL) /** * g_node_next_sibling: * @node: a #GNode * * Gets the next sibling of a #GNode. * * Returns: the next sibling of @node, or %NULL if @node is the last node * or %NULL */ #define g_node_next_sibling(node) ((node) ? \ ((GNode*) (node))->next : NULL) /** * g_node_first_child: * @node: a #GNode * * Gets the first child of a #GNode. * * Returns: the first child of @node, or %NULL if @node is %NULL * or has no children */ #define g_node_first_child(node) ((node) ? \ ((GNode*) (node))->children : NULL) G_END_DECLS #endif /* __G_NODE_H__ */ PK �w[�>1�>