summaryrefslogtreecommitdiff
path: root/docs/glib.texi
blob: 1bf23e191b5fe51789bc4db9fcfbebd8d2e6fdc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
\input texinfo @c -*-texinfo-*-
@c %**start of header
@setfilename glib.info
@settitle GLIB
@setchapternewpage odd

@set edition 1.0
@set update-date 3 Feburary 1998
@set update-month Feburary 1998
@c %**end of header

@ifinfo
This file documents GLIB, A library of useful routines for C programming

Copyright (C) 1998 Gregory A McLean

Permission is granted to make and distributed verbatim copies of this
manual, provided the copyright notice and this permission notice are
preserved on all copies. 

@ignore
Permission is granted to process this file throught TeX and print the 
results, provided the printed document carries copying permission notice 
identical to this one except for the removal of this paragraph (this 
paragraph not being relevant to the printed manual).

@end ignore
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation
approved by Gregory McLean.
@end ifinfo

@titlepage
@title GLIB, Useful routines for C programming 
@subtitle Version 1.0
@subtitle @value{update-month}
@author by Gregory McLean

@page
@vskip 0pt plus 1filll
Copyright @copyright{} 1998 Gregory McLean

Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.

Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation
approved by Gregory McLean.
@end titlepage

@dircategory Library of useful routines for 'C' programing
@direntry
* GLIB: (glib).        useful routines for 'C' programming
@end direntry

@node Top, Copying, (dir), (dir)
@top useful routines for 'C' programming
@ifinfo
This is edition @value{edition} of the GLIB documentation,
@w{@value{update-date}}.
@end ifinfo

@menu
* Copying::                     Your rights.
* Overview::                    What is GLIB?
* Doubly linked lists::         Doubly linked lists
* Signly linked lists::         Singly linked lists
* List allocators::             List Allocators
* Hash tables::                 Hash tables
* Caches::                      Cache handling
* Trees::                       Tree handling
* Memory::                      Memory handling
* Timers::                      Timer functions
* Output::                      Output handling
* Utilities::                   Utilitiy functions
* Errors::                      Error handling
* String Chunks::               String Chunks
* Strings::                     String handling
* Resizable arrays::            Resizeable arrays
* GScanner::                    Flexible lexical scanner
* Miscellany::                  Other stuff
* Function Index::              Index of functions
* Concept Index::               Index of concepts
@end menu

@node Copying, Overview, Top, Top
@comment node-name, next, previous, up
@chapter Copying

@node Overview, Doubly linked lists, Copying, Top
@comment node-name, next, previous, up
@chapter What is GLIB

@node Doubly linked lists, Signly linked lists, Overview, Top
@comment node-name, next, previous, up
@chapter Doubly linked lists

@subsection Functions

@deftypefun GList* g_list_alloc (void)
@end deftypefun

@deftypefun void g_list_free (GList *@var{list})
@end deftypefun

@deftypefun void g_list_free_1 (GList *@var{list})
@end deftypefun

@deftypefun GList* g_list_append (GList *@var{list}, gpointer @var{data})
@end deftypefun

@deftypefun GList* g_list_prepend (GList *@var{list}, gpointer @var{data})
@end deftypefun

@deftypefun GList* g_list_insert (GList *@var{list}, gpointer @var{data}, gint @var{position})
@end deftypefun

@deftypefun GList* g_list_insert_sorted (GList *@var{list}, gpointer @var{data}, GCompareFunc @var{func})
@end deftypefun

@deftypefun GList* g_list_concat (GList *@var{list1}, GList *@var{list2})
@end deftypefun

@deftypefun GList* g_list_remove (GList *@var{list}, gpointer @var{data})
@end deftypefun

@deftypefun GList* g_list_remove_link (GList *@var{list}, GList *@var{link})
@end deftypefun

@deftypefun GList* g_list_reverse (GList *@var{list})
@end deftypefun

@deftypefun GList* g_list_nth (GList *@var{list}, gint @var{n})
@end deftypefun

@deftypefun GList* g_list_find (GList *@var{list}, gpointer @var{data})
@end deftypefun

@deftypefun GList* g_list_last (GList *@var{list})
@end deftypefun

@deftypefun GList* g_list_first (GList *@var{list})
@end deftypefun

@deftypefun gint g_list_length (GList *@var{list})
@end deftypefun

@deftypefun void g_list_foreach (GList *@var{list}, GFunc @var{func}, gpointer @var{user_data})
@end deftypefun

@node Signly linked lists, List allocators, Doubly linked lists, Top
@comment node-name, next, previous, up
@chapter Signly linked lists

@subsection Functions
@deftypefun GSList* g_slist_alloc (void)
@end deftypefun

@deftypefun void g_slist_free (GSList *@var{list})
@end deftypefun

@deftypefun void g_slist_free_1 (GSList *@var{list})
@end deftypefun

@deftypefun GSList* g_slist_append (GSList *@var{list}, gpointer @var{data})
@end deftypefun

@deftypefun GSList* g_slist_prepend (GSList *@var{list}, gpointer @var{data})
@end deftypefun

@deftypefun GSList* g_slist_insert (GSList *@var{list}, gpointer @var{data}, gint @var{position})
@end deftypefun

@deftypefun GSList* g_slist_insert_sorted (GSList *@var{list}, gpointer @var{data}, GCompareFunc @var{func})
@end deftypefun

@deftypefun GSList* g_slist_concat (GSList *@var{list1}, GSList *@var{list2})
@end deftypefun

@deftypefun GSList* g_slist_remove (GSList *@var{list}, gpointer @var{data})
@end deftypefun

@deftypefun GSList* g_slist_remove_link (GSList *@var{list}, GSList *@var{link})
@end deftypefun

@deftypefun GSList* g_slist_reverse (GSList *@var{list})
@end deftypefun

@deftypefun GSList* g_slist_nth (GSList *@var{list}, gint @var{n})
@end deftypefun

@deftypefun GSList* g_slist_find (GSList *@var{list}, gpointer @var{data})
@end deftypefun

@deftypefun GSList* g_slist_last (GSList *@var{list})
@end deftypefun

@deftypefun gint g_slist_length (GSList *@var{list})
@end deftypefun

@deftypefun void g_slist_foreach (GSList *@var{list}, GFunc @var{func}, gpointer @var{user_data})
@end deftypefun

@node List allocators, Hash tables, Signly linked lists, Top
@comment node-name, next, previous, up
@chapter List allocators

@subsection Functions

@deftypefun GListAllocator* g_list_allocator_new (void)
@end deftypefun

@deftypefun void g_list_allocator_free (GListAllocator *@var{allocator})
@end deftypefun

@deftypefun GListAllocator* g_slist_set_allocator (GListAllocator *@var{allocator})
@end deftypefun

@deftypefun GListAllocator* g_list_set_allocator (GListAllocator *@var{allocator})
@end deftypefun

@node Hash tables, Caches, List allocators, Top
@comment node-name, next, previous, up
@chapter Hash tables

@subsection Functions

@deftypefun GHashTable* g_hash_table_new (GHashFunc @var{hash_func}, GCompareFunc @var{key_compare_func})
@end deftypefun

@deftypefun void g_hash_table_destroy (GHashTable *@var{hash_table})
@end deftypefun

@deftypefun void g_hash_table_insert (GHashTable *@var{hash_table}, gpointer @var{key}, gpointer @var{value})
@end deftypefun

@deftypefun void g_hash_table_remove (GHashTable *@var{hash_table}, gpointer @var{key})
@end deftypefun

@deftypefun gpointer g_hash_table_lookup (GHashTable *@var{hash_table}, gpointer @var{key})
@end deftypefun

@deftypefun void g_hash_table_freeze (GHashTable *@var{hash_table})
@end deftypefun

@deftypefun void g_hash_table_thaw (GHashTable *@var{hash_table})
@end deftypefun

@deftypefun void g_hash_table_foreach (GHashTable *@var{hash_table}, GHFunc @var{func}, gpointer @var{user_data})
@end deftypefun

@node Caches, Trees, Hash tables, Top
@comment node-name, next, previous, up
@chapter Cache handling

@subsection Functions

@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})
@end deftypefun

@deftypefun void g_cache_destroy (GCache *@var{cache})
@end deftypefun

@deftypefun gpointer g_cache_insert (GCache *@var{cache}, gpointer @var{key})
@end deftypefun

@deftypefun void g_cache_remove (GCache *@var{cache}, gpointer @var{key})
@end deftypefun

@deftypefun void g_cache_key_foreach (GCache *@var{cache}, GHFunc @var{func}, gpointer @var{user_data})
@end deftypefun

@deftypefun void g_cache_value_foreach (GCache *@var{cache}, GHFunc @var{func}, gpointer @var{user_data})
@end deftypefun

@node Trees, Memory, Caches, Top
@comment node-name, next, previous, up
@chapter Tree handling

@subsection Functions

@deftypefun GTree* g_tree_new (GCompareFunc @var{key_compare_func})
@end deftypefun

@deftypefun void g_tree_destroy (GTree *@var{tree})
@end deftypefun

@deftypefun void g_tree_remove (GTree *@var{tree}, gpointer @var{key}, gpointer @var{value})
@end deftypefun

@deftypefun gpointer g_tree_lookup (GTree *@var{tree}, gpointer @var{key})
@end deftypefun

@deftypefun void g_tree_traverse (GTree *@var{tree}, GTraverseFunc @var{traverse_func}, GTraverseType @var{traverse_type}, gpointer @var{data}
@end deftypefun

@deftypefun gpointer g_tree_search (GTree *@var{tree}, GSearchFunc @var{search_func}, gpointer @var{data})
@end deftypefun

@deftypefun gint g_tree_height (GTree *@var{tree})
@end deftypefun

@deftypefun gint g_tree_nnodes (GTree *@var{tree})
@end deftypefun

@node Memory, Timers, Trees, Top
@comment node-name, next, previous, up
@chapter Memory handling

@subsection Functions

@deftypefun gpointer g_malloc (gulong @var{size})
@end deftypefun

@deftypefun gpointer g_malloc0 (gulong @var{size})
@end deftypefun

@deftypefun gpointer g_realloc (gpointer @var{mem}, gulong @var{size})
@end deftypefun

@deftypefun void g_mem_profile (void)
@end deftypefun

@deftypefun void g_mem_check (gpointer @var{mem})
@end deftypefun

@deftypefun GMemChunk* g_mem_chunk_new (gchar *@var{name}, gint @var{atom_size}, gulong @var{area_size}, gint @var{type})
@end deftypefun

@deftypefun void g_mem_chunk_destroy (GMemChunk *@var{mem_chunk})
@end deftypefun

@deftypefun gpointer g_mem_chunk_alloc (GMemChunk *@var{mem_chunk})
@end deftypefun

@deftypefun void g_mem_chunk_free (GMemChunk *@var{mem_chunk}, gpointer @var{mem})
@end deftypefun

@deftypefun void g_mem_chunk_clean (GMemChunk *@var{mem_chunk})
@end deftypefun

@deftypefun void g_mem_chunk_reset (GMemChunk *@var{mem_chunk})
@end deftypefun

@deftypefun void g_mem_chunk_print (GMemChunk *@var{mem_chunk})
@end deftypefun

@deftypefun void g_mem_chunk_info (void)
@end deftypefun

@deftypefun void g_blow_chunks (void)
Not what you might be thinking, @code{g_blow_chunks()} simply compresses all 
the chunks. This operation consists of freeing every memory area that should
be freed (but which we haven't gotten around to doing yet).
@end deftypefun

@node Timers, Output, Memory, Top
@comment node-name, next, previous, up
@chapter Timer functions

@subsection Functions

@deftypefun GTimer* g_timer_new (void)
@end deftypefun

@deftypefun void g_timer_destroy (GTimer *@var{timer})
@end deftypefun

@deftypefun void g_timer_start (GTimer *@var{timer})
@end deftypefun

@deftypefun void g_timer_stop (GTimer *@var{timer})
@end deftypefun

@deftypefun void g_timer_reset (GTimer *@var{timer})
@end deftypefun

@deftypefun gdouble g_timer_elapsed (GTimer *@var{timer}, gulong *@var{microseconds})
@end deftypefun

@node Output, Utilities, Timers, Top
@comment node-name, next, previous, up
@chapter Output functions

@subsection Functions

@deftypefun void g_error (gchar *@var{format}, @dots{})
@end deftypefun

@deftypefun void g_warning (gchar *@var{format}, @dots{})
@end deftypefun

@deftypefun void g_message (gchar *@var{format}, @dots{})
@end deftypefun

@deftypefun void g_print (gchar *@var{format}, @dots{})
@end deftypefun

@node Utilities, Errors, Output, Top
@comment node-name, next, previous, up
@chapter Utility functions

@node Errors, String Chunks, Utilities, Top
@comment node-name, next, previous, up
@chapter Error handling

@node String Chunks, Strings, Errors, Top
@comment node-name, next, previous, up
@chapter String chunks

@node Strings, Resizable arrays, String Chunks, Top
@comment node-name, next, previous, up
@chapter String handling

@node Resizable arrays, GScanner, Strings, Top
@comment node-name, next, previous, up
@chapter Resizable arrays

@node GScanner, Miscellany, Resizable arrays, Top
@comment node-name, next, previous, up
@chapter Flexible lexical scanner

@node Miscellany, Function Index, GScanner, Top
@comment node-name, next, previous, up
@chapter Other stuff

@node Function Index, Concept Index, Miscellany, Top
@comment node-name, next, previous, up
@unnumbered Function Index

@printindex fn

@node Concept Index, , Function Index, Top
@comment node-name, next, previous, up
@unnumbered Concept Index

@printindex cp

@summarycontents
@contents 
@bye