1 \input texinfo @c -*-texinfo-*-
8 @set update-date 3 Feburary 1998
9 @set update-month Feburary 1998
13 This file documents GLIB, A library of useful routines for C programming
15 Copyright (C) 1998 Gregory A McLean
17 Permission is granted to make and distributed verbatim copies of this
18 manual, provided the copyright notice and this permission notice are
19 preserved on all copies.
22 Permission is granted to process this file throught TeX and print the
23 results, provided the printed document carries copying permission notice
24 identical to this one except for the removal of this paragraph (this
25 paragraph not being relevant to the printed manual).
28 Permission is granted to copy and distribute modified versions of this
29 manual under the conditions for verbatim copying, provided that the
30 entire resulting derived work is distributed under the terms of a
31 permission notice identical to this one.
33 Permission is granted to copy and distribute translations of this manual
34 into another language, under the above conditions for modified versions,
35 except that this permission notice may be stated in a translation
36 approved by Gregory McLean.
40 @title GLIB, Useful routines for C programming
42 @subtitle @value{update-month}
43 @author by Gregory McLean
46 @vskip 0pt plus 1filll
47 Copyright @copyright{} 1998 Gregory McLean
49 Permission is granted to make and distribute verbatim copies of this
50 manual provided the copyright notice and this permission notice are
51 preserved on all copies.
53 Permission is granted to copy and distribute modified versions of this
54 manual under the conditions for verbatim copying, provided that the
55 entire resulting derived work is distributed under the terms of a
56 permission notice identical to this one.
58 Permission is granted to copy and distribute translations of this manual
59 into another language, under the above conditions for modified versions,
60 except that this permission notice may be stated in a translation
61 approved by Gregory McLean.
64 @dircategory Library of useful routines for 'C' programing
66 * GLIB: (glib). useful routines for 'C' programming
69 @node Top, Copying, (dir), (dir)
70 @top useful routines for 'C' programming
72 This is edition @value{edition} of the GLIB documentation,
73 @w{@value{update-date}}.
77 * Copying:: Your rights.
78 * Overview:: What is GLIB?
79 * Doubly linked lists:: Doubly linked lists
80 * Signly linked lists:: Singly linked lists
81 * List allocators:: List Allocators
82 * Hash tables:: Hash tables
83 * Caches:: Cache handling
84 * Trees:: Tree handling
85 * Memory:: Memory handling
86 * Timers:: Timer functions
87 * Output:: Output handling
88 * Utilities:: Utilitiy functions
89 * Errors:: Error handling
90 * String Chunks:: String Chunks
91 * Strings:: String handling
92 * Resizable arrays:: Resizeable arrays
93 * GScanner:: Flexible lexical scanner
94 * Miscellany:: Other stuff
95 * Function Index:: Index of functions
96 * Concept Index:: Index of concepts
99 @node Copying, Overview, Top, Top
100 @comment node-name, next, previous, up
103 @node Overview, Doubly linked lists, Copying, Top
104 @comment node-name, next, previous, up
105 @chapter What is GLIB
107 @node Doubly linked lists, Signly linked lists, Overview, Top
108 @comment node-name, next, previous, up
109 @chapter Doubly linked lists
111 @subsection Functions
113 @deftypefun GList* g_list_alloc (void)
116 @deftypefun void g_list_free (GList *@var{list})
119 @deftypefun void g_list_free_1 (GList *@var{list})
122 @deftypefun GList* g_list_append (GList *@var{list}, gpointer @var{data})
125 @deftypefun GList* g_list_prepend (GList *@var{list}, gpointer @var{data})
128 @deftypefun GList* g_list_insert (GList *@var{list}, gpointer @var{data}, gint @var{position})
131 @deftypefun GList* g_list_insert_sorted (GList *@var{list}, gpointer @var{data}, GCompareFunc @var{func})
134 @deftypefun GList* g_list_concat (GList *@var{list1}, GList *@var{list2})
137 @deftypefun GList* g_list_remove (GList *@var{list}, gpointer @var{data})
140 @deftypefun GList* g_list_remove_link (GList *@var{list}, GList *@var{link})
143 @deftypefun GList* g_list_reverse (GList *@var{list})
146 @deftypefun GList* g_list_nth (GList *@var{list}, gint @var{n})
149 @deftypefun GList* g_list_find (GList *@var{list}, gpointer @var{data})
152 @deftypefun GList* g_list_last (GList *@var{list})
155 @deftypefun GList* g_list_first (GList *@var{list})
158 @deftypefun gint g_list_length (GList *@var{list})
161 @deftypefun void g_list_foreach (GList *@var{list}, GFunc @var{func}, gpointer @var{user_data})
164 @node Signly linked lists, List allocators, Doubly linked lists, Top
165 @comment node-name, next, previous, up
166 @chapter Signly linked lists
168 @subsection Functions
169 @deftypefun GSList* g_slist_alloc (void)
172 @deftypefun void g_slist_free (GSList *@var{list})
175 @deftypefun void g_slist_free_1 (GSList *@var{list})
178 @deftypefun GSList* g_slist_append (GSList *@var{list}, gpointer @var{data})
181 @deftypefun GSList* g_slist_prepend (GSList *@var{list}, gpointer @var{data})
184 @deftypefun GSList* g_slist_insert (GSList *@var{list}, gpointer @var{data}, gint @var{position})
187 @deftypefun GSList* g_slist_insert_sorted (GSList *@var{list}, gpointer @var{data}, GCompareFunc @var{func})
190 @deftypefun GSList* g_slist_concat (GSList *@var{list1}, GSList *@var{list2})
193 @deftypefun GSList* g_slist_remove (GSList *@var{list}, gpointer @var{data})
196 @deftypefun GSList* g_slist_remove_link (GSList *@var{list}, GSList *@var{link})
199 @deftypefun GSList* g_slist_reverse (GSList *@var{list})
202 @deftypefun GSList* g_slist_nth (GSList *@var{list}, gint @var{n})
205 @deftypefun GSList* g_slist_find (GSList *@var{list}, gpointer @var{data})
208 @deftypefun GSList* g_slist_last (GSList *@var{list})
211 @deftypefun gint g_slist_length (GSList *@var{list})
214 @deftypefun void g_slist_foreach (GSList *@var{list}, GFunc @var{func}, gpointer @var{user_data})
217 @node List allocators, Hash tables, Signly linked lists, Top
218 @comment node-name, next, previous, up
219 @chapter List allocators
221 @subsection Functions
223 @deftypefun GListAllocator* g_list_allocator_new (void)
226 @deftypefun void g_list_allocator_free (GListAllocator *@var{allocator})
229 @deftypefun GListAllocator* g_slist_set_allocator (GListAllocator *@var{allocator})
232 @deftypefun GListAllocator* g_list_set_allocator (GListAllocator *@var{allocator})
235 @node Hash tables, Caches, List allocators, Top
236 @comment node-name, next, previous, up
239 @subsection Functions
241 @deftypefun GHashTable* g_hash_table_new (GHashFunc @var{hash_func}, GCompareFunc @var{key_compare_func})
244 @deftypefun void g_hash_table_destroy (GHashTable *@var{hash_table})
247 @deftypefun void g_hash_table_insert (GHashTable *@var{hash_table}, gpointer @var{key}, gpointer @var{value})
250 @deftypefun void g_hash_table_remove (GHashTable *@var{hash_table}, gpointer @var{key})
253 @deftypefun gpointer g_hash_table_lookup (GHashTable *@var{hash_table}, gpointer @var{key})
256 @deftypefun void g_hash_table_freeze (GHashTable *@var{hash_table})
259 @deftypefun void g_hash_table_thaw (GHashTable *@var{hash_table})
262 @deftypefun void g_hash_table_foreach (GHashTable *@var{hash_table}, GHFunc @var{func}, gpointer @var{user_data})
265 @node Caches, Trees, Hash tables, Top
266 @comment node-name, next, previous, up
267 @chapter Cache handling
269 @subsection Functions
271 @deftypefun GCache* g_cache_new (GCacheNewFunc @var{value_new_func}, GCacheDestroyFunc @var{value_destroy_func}, GCacheDupFunc @var{key_dup_func}, GCacheDestroyFunc @var{key_destroy_func}, GHashFunc @var{hash_key_func}, GHashFunc @var{hash_value_func}, GCompareFunc @var{key_compare_func})
274 @deftypefun void g_cache_destroy (GCache *@var{cache})
277 @deftypefun gpointer g_cache_insert (GCache *@var{cache}, gpointer @var{key})
280 @deftypefun void g_cache_remove (GCache *@var{cache}, gpointer @var{key})
283 @deftypefun void g_cache_key_foreach (GCache *@var{cache}, GHFunc @var{func}, gpointer @var{user_data})
286 @deftypefun void g_cache_value_foreach (GCache *@var{cache}, GHFunc @var{func}, gpointer @var{user_data})
289 @node Trees, Memory, Caches, Top
290 @comment node-name, next, previous, up
291 @chapter Tree handling
293 @subsection Functions
295 @deftypefun GTree* g_tree_new (GCompareFunc @var{key_compare_func})
298 @deftypefun void g_tree_destroy (GTree *@var{tree})
301 @deftypefun void g_tree_remove (GTree *@var{tree}, gpointer @var{key}, gpointer @var{value})
304 @deftypefun gpointer g_tree_lookup (GTree *@var{tree}, gpointer @var{key})
307 @deftypefun void g_tree_traverse (GTree *@var{tree}, GTraverseFunc @var{traverse_func}, GTraverseType @var{traverse_type}, gpointer @var{data}
310 @deftypefun gpointer g_tree_search (GTree *@var{tree}, GSearchFunc @var{search_func}, gpointer @var{data})
313 @deftypefun gint g_tree_height (GTree *@var{tree})
316 @deftypefun gint g_tree_nnodes (GTree *@var{tree})
319 @node Memory, Timers, Trees, Top
320 @comment node-name, next, previous, up
321 @chapter Memory handling
323 @subsection Functions
325 @deftypefun gpointer g_malloc (gulong @var{size})
328 @deftypefun gpointer g_malloc0 (gulong @var{size})
331 @deftypefun gpointer g_realloc (gpointer @var{mem}, gulong @var{size})
334 @deftypefun void g_mem_profile (void)
337 @deftypefun void g_mem_check (gpointer @var{mem})
340 @deftypefun GMemChunk* g_mem_chunk_new (gchar *@var{name}, gint @var{atom_size}, gulong @var{area_size}, gint @var{type})
343 @deftypefun void g_mem_chunk_destroy (GMemChunk *@var{mem_chunk})
346 @deftypefun gpointer g_mem_chunk_alloc (GMemChunk *@var{mem_chunk})
349 @deftypefun void g_mem_chunk_free (GMemChunk *@var{mem_chunk}, gpointer @var{mem})
352 @deftypefun void g_mem_chunk_clean (GMemChunk *@var{mem_chunk})
355 @deftypefun void g_mem_chunk_reset (GMemChunk *@var{mem_chunk})
358 @deftypefun void g_mem_chunk_print (GMemChunk *@var{mem_chunk})
361 @deftypefun void g_mem_chunk_info (void)
364 @deftypefun void g_blow_chunks (void)
365 Not what you might be thinking, @code{g_blow_chunks()} simply compresses all
366 the chunks. This operation consists of freeing every memory area that should
367 be freed (but which we haven't gotten around to doing yet).
370 @node Timers, Output, Memory, Top
371 @comment node-name, next, previous, up
372 @chapter Timer functions
374 @subsection Functions
376 @deftypefun GTimer* g_timer_new (void)
379 @deftypefun void g_timer_destroy (GTimer *@var{timer})
382 @deftypefun void g_timer_start (GTimer *@var{timer})
385 @deftypefun void g_timer_stop (GTimer *@var{timer})
388 @deftypefun void g_timer_reset (GTimer *@var{timer})
391 @deftypefun gdouble g_timer_elapsed (GTimer *@var{timer}, gulong *@var{microseconds})
394 @node Output, Utilities, Timers, Top
395 @comment node-name, next, previous, up
396 @chapter Output functions
398 @subsection Functions
400 @deftypefun void g_error (gchar *@var{format}, @dots{})
403 @deftypefun void g_warning (gchar *@var{format}, @dots{})
406 @deftypefun void g_message (gchar *@var{format}, @dots{})
409 @deftypefun void g_print (gchar *@var{format}, @dots{})
412 @node Utilities, Errors, Output, Top
413 @comment node-name, next, previous, up
414 @chapter Utility functions
416 @node Errors, String Chunks, Utilities, Top
417 @comment node-name, next, previous, up
418 @chapter Error handling
420 @node String Chunks, Strings, Errors, Top
421 @comment node-name, next, previous, up
422 @chapter String chunks
424 @node Strings, Resizable arrays, String Chunks, Top
425 @comment node-name, next, previous, up
426 @chapter String handling
428 @node Resizable arrays, GScanner, Strings, Top
429 @comment node-name, next, previous, up
430 @chapter Resizable arrays
432 @node GScanner, Miscellany, Resizable arrays, Top
433 @comment node-name, next, previous, up
434 @chapter Flexible lexical scanner
436 @node Miscellany, Function Index, GScanner, Top
437 @comment node-name, next, previous, up
440 @node Function Index, Concept Index, Miscellany, Top
441 @comment node-name, next, previous, up
442 @unnumbered Function Index
446 @node Concept Index, , Function Index, Top
447 @comment node-name, next, previous, up
448 @unnumbered Concept Index