Canorus  0.0
glib.h
Go to the documentation of this file.
1 /* GLIB - Library of useful routines for C programming
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU Library General Public
14  * License along with this library; if not, write to the
15  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16  * Boston, MA 02111-1307, USA.
17  */
18 
19 /*
20  * Modified by the GLib Team and others 1997-1999. See the AUTHORS
21  * file for a list of people on the GLib Team. See the ChangeLog
22  * files for a list of changes. These files are distributed with
23  * GLib at ftp://ftp.gtk.org/pub/gtk/.
24  * Modified: Steve Ratcliffe May 1999. File exists so that pmidi
25  * is not dependant on glib.
26  */
27 
28 #ifndef __G_LIB_H__
29 #define __G_LIB_H__
30 
31 #include <stdlib.h>
32 #include <string.h>
33 
34 /* system specific config file glibconfig.h provides definitions for
35  * the extrema of many of the standard types. These are:
36  *
37  * G_MINSHORT, G_MAXSHORT
38  * G_MININT, G_MAXINT
39  * G_MINLONG, G_MAXLONG
40  * G_MINFLOAT, G_MAXFLOAT
41  * G_MINDOUBLE, G_MAXDOUBLE
42  *
43  * It also provides the following typedefs:
44  *
45  * gint8, guint8
46  * gint16, guint16
47  * gint32, guint32
48  * gint64, guint64
49  *
50  * It defines the G_BYTE_ORDER symbol to one of G_*_ENDIAN (see later in
51  * this file).
52  *
53  * And it provides a way to store and retrieve a `gint' in/from a `gpointer'.
54  * This is useful to pass an integer instead of a pointer to a callback.
55  *
56  * GINT_TO_POINTER(i), GUINT_TO_POINTER(i)
57  * GPOINTER_TO_INT(p), GPOINTER_TO_UINT(p)
58  *
59  * Finally, it provide the following wrappers to STDC functions:
60  *
61  * g_ATEXIT
62  * To register hooks which are executed on exit().
63  * Usually a wrapper for STDC atexit.
64  *
65  * void *g_memmove(void *dest, const void *src, guint count);
66  * A wrapper for STDC memmove, or an implementation, if memmove doesn't
67  * exist. The prototype looks like the above, give or take a const,
68  * or size_t.
69  */
70 
71 typedef signed char gint8;
72 typedef unsigned char guint8;
73 typedef signed short gint16;
74 typedef unsigned short guint16;
75 typedef signed int gint32;
76 typedef unsigned int guint32;
77 
78 /* include varargs functions for assertment macros
79  */
80 #include <stdarg.h>
81 
82 /* optionally feature DMALLOC memory allocation debugger
83  */
84 #ifdef USE_DMALLOC
85 #include "dmalloc.h"
86 #endif
87 
88 
89 #ifdef NATIVE_WIN32
90 
91 /* On native Win32, directory separator is the backslash, and search path
92  * separator is the semicolon.
93  */
94 #define G_DIR_SEPARATOR '\\'
95 #define G_DIR_SEPARATOR_S "\\"
96 #define G_SEARCHPATH_SEPARATOR ';'
97 #define G_SEARCHPATH_SEPARATOR_S ";"
98 
99 #else /* !NATIVE_WIN32 */
100 
101 /* Unix */
102 
103 #define G_DIR_SEPARATOR '/'
104 #define G_DIR_SEPARATOR_S "/"
105 #define G_SEARCHPATH_SEPARATOR ':'
106 #define G_SEARCHPATH_SEPARATOR_S ":"
107 
108 #endif /* !NATIVE_WIN32 */
109 
110 #ifdef __cplusplus
111 extern "C" {
112 #endif /* __cplusplus */
113 
114 
115 /* Provide definitions for some commonly used macros.
116  * Some of them are only provided if they haven't already
117  * been defined. It is assumed that if they are already
118  * defined then the current definition is correct.
119  */
120 #ifndef NULL
121 #define NULL ((void*) 0)
122 #endif
123 
124 #ifndef FALSE
125 #define FALSE (0)
126 #endif
127 
128 #ifndef TRUE
129 #define TRUE (!FALSE)
130 #endif
131 
132 #undef MAX
133 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
134 
135 #undef MIN
136 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
137 
138 #undef ABS
139 #define ABS(a) (((a) < 0) ? -(a) : (a))
140 
141 #undef CLAMP
142 #define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
143 
144 
145 /* Define G_VA_COPY() to do the right thing for copying va_list variables.
146  * glibconfig.h may have already defined G_VA_COPY as va_copy or __va_copy.
147  */
148 #if !defined (G_VA_COPY)
149 # if defined (__GNUC__) && defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
150 # define G_VA_COPY(ap1, ap2) (*(ap1) = *(ap2))
151 # elif defined (G_VA_COPY_AS_ARRAY)
152 # define G_VA_COPY(ap1, ap2) g_memmove ((ap1), (ap2), sizeof (va_list))
153 # else /* va_list is a pointer */
154 # define G_VA_COPY(ap1, ap2) ((ap1) = (ap2))
155 # endif /* va_list is a pointer */
156 #endif /* !G_VA_COPY */
157 
158 
159 /* Provide convenience macros for handling structure
160  * fields through their offsets.
161  */
162 #define G_STRUCT_OFFSET(struct_type, member) \
163  ((gulong) ((gchar*) &((struct_type*) 0)->member))
164 #define G_STRUCT_MEMBER_P(struct_p, struct_offset) \
165  ((gpointer) ((gchar*) (struct_p) + (gulong) (struct_offset)))
166 #define G_STRUCT_MEMBER(member_type, struct_p, struct_offset) \
167  (*(member_type*) G_STRUCT_MEMBER_P ((struct_p), (struct_offset)))
168 
169 
170 /* inlining hassle. for compilers that don't allow the `inline' keyword,
171  * mostly because of strict ANSI C compliance or dumbness, we try to fall
172  * back to either `__inline__' or `__inline'.
173  * we define G_CAN_INLINE, if the compiler seems to be actually
174  * *capable* to do function inlining, in which case inline function bodys
175  * do make sense. we also define G_INLINE_FUNC to properly export the
176  * function prototypes if no inlining can be performed.
177  * we special case most of the stuff, so inline functions can have a normal
178  * implementation by defining G_INLINE_FUNC to extern and G_CAN_INLINE to 1.
179  */
180 #ifndef G_INLINE_FUNC
181 # define G_CAN_INLINE 1
182 #endif
183 #ifdef G_HAVE_INLINE
184 # if defined (__GNUC__) && defined (__STRICT_ANSI__)
185 # undef inline
186 # define inline __inline__
187 # endif
188 #else /* !G_HAVE_INLINE */
189 # undef inline
190 # if defined (G_HAVE___INLINE__)
191 # define inline __inline__
192 # else /* !inline && !__inline__ */
193 # if defined (G_HAVE___INLINE)
194 # define inline __inline
195 # else /* !inline && !__inline__ && !__inline */
196 # define inline /* don't inline, then */
197 # ifndef G_INLINE_FUNC
198 # undef G_CAN_INLINE
199 # endif
200 # endif
201 # endif
202 #endif
203 #ifndef G_INLINE_FUNC
204 # ifdef __GNUC__
205 # ifdef __OPTIMIZE__
206 # define G_INLINE_FUNC extern inline
207 # else
208 # undef G_CAN_INLINE
209 # define G_INLINE_FUNC extern
210 # endif
211 # else /* !__GNUC__ */
212 # ifdef G_CAN_INLINE
213 # define G_INLINE_FUNC static inline
214 # else
215 # define G_INLINE_FUNC extern
216 # endif
217 # endif /* !__GNUC__ */
218 #endif /* !G_INLINE_FUNC */
219 
220 
221 /* Provide simple macro statement wrappers (adapted from Perl):
222  * G_STMT_START { statements; } G_STMT_END;
223  * can be used as a single statement, as in
224  * if (x) G_STMT_START { ... } G_STMT_END; else ...
225  *
226  * For gcc we will wrap the statements within `({' and `})' braces.
227  * For SunOS they will be wrapped within `if (1)' and `else (void) 0',
228  * and otherwise within `do' and `while (0)'.
229  */
230 #if !(defined (G_STMT_START) && defined (G_STMT_END))
231 # if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus)
232 # define G_STMT_START (void)(
233 # define G_STMT_END )
234 # else
235 # if (defined (sun) || defined (__sun__))
236 # define G_STMT_START if (1)
237 # define G_STMT_END else (void)0
238 # else
239 # define G_STMT_START do
240 # define G_STMT_END while (0)
241 # endif
242 # endif
243 #endif
244 
245 
246 /* Provide macros to feature the GCC function attribute.
247  */
248 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
249 #define G_GNUC_PRINTF( format_idx, arg_idx ) \
250  __attribute__((format (printf, format_idx, arg_idx)))
251 #define G_GNUC_SCANF( format_idx, arg_idx ) \
252  __attribute__((format (scanf, format_idx, arg_idx)))
253 #define G_GNUC_FORMAT( arg_idx ) \
254  __attribute__((format_arg (arg_idx)))
255 #define G_GNUC_NORETURN \
256  __attribute__((noreturn))
257 #define G_GNUC_CONST \
258  __attribute__((const))
259 #define G_GNUC_UNUSED \
260  __attribute__((unused))
261 #else /* !__GNUC__ */
262 #define G_GNUC_PRINTF( format_idx, arg_idx )
263 #define G_GNUC_SCANF( format_idx, arg_idx )
264 #define G_GNUC_FORMAT( arg_idx )
265 #define G_GNUC_NORETURN
266 #define G_GNUC_CONST
267 #define G_GNUC_UNUSED
268 #endif /* !__GNUC__ */
269 
270 
271 /* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with
272  * macros, so we can refer to them as strings unconditionally.
273  */
274 #ifdef __GNUC__
275 #define G_GNUC_FUNCTION __FUNCTION__
276 #define G_GNUC_PRETTY_FUNCTION __PRETTY_FUNCTION__
277 #else /* !__GNUC__ */
278 #define G_GNUC_FUNCTION ""
279 #define G_GNUC_PRETTY_FUNCTION ""
280 #endif /* !__GNUC__ */
281 
282 /* we try to provide a usefull equivalent for ATEXIT if it is
283  * not defined, but use is actually abandoned. people should
284  * use g_atexit() instead.
285  */
286 #ifndef ATEXIT
287 # define ATEXIT(proc) g_ATEXIT(proc)
288 #else
289 # define G_NATIVE_ATEXIT
290 #endif /* ATEXIT */
291 
292 /* Hacker macro to place breakpoints for elected machines.
293  * Actual use is strongly deprecated of course ;)
294  */
295 #if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2
296 #define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("int $03"); }G_STMT_END
297 #elif defined (__alpha__) && defined (__GNUC__) && __GNUC__ >= 2
298 #define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("bpt"); }G_STMT_END
299 #else /* !__i386__ && !__alpha__ */
300 #define G_BREAKPOINT()
301 #endif /* __i386__ */
302 
303 
304 /* Provide macros for easily allocating memory. The macros
305  * will cast the allocated memory to the specified type
306  * in order to avoid compiler warnings. (Makes the code neater).
307  */
308 
309 # define g_new(type, count) \
310  ((type *) malloc ((unsigned) sizeof (type) * (count)))
311 # define g_new0(type, count) \
312  ((type *) calloc ((unsigned) sizeof (type) * (count), 1))
313 # define g_renew(type, mem, count) \
314  ((type *) realloc (mem, (unsigned) sizeof (type) * (count)))
315 
316 #define g_mem_chunk_create(type, pre_alloc, alloc_type) ( \
317  g_mem_chunk_new (#type " mem chunks (" #pre_alloc ")", \
318  sizeof (type), \
319  sizeof (type) * (pre_alloc), \
320  (alloc_type)) \
321 )
322 #define g_chunk_new(type, chunk) ( \
323  (type *) g_mem_chunk_alloc (chunk) \
324 )
325 #define g_chunk_new0(type, chunk) ( \
326  (type *) g_mem_chunk_alloc0 (chunk) \
327 )
328 #define g_chunk_free(mem, mem_chunk) G_STMT_START { \
329  g_mem_chunk_free ((mem_chunk), (mem)); \
330 } G_STMT_END
331 
332 
333 #define g_string(x) #x
334 
335 
336 /* Provide macros for error handling. The "assert" macros will
337  * exit on failure. The "return" macros will exit the current
338  * function. Two different definitions are given for the macros
339  * if G_DISABLE_ASSERT is not defined, in order to support gcc's
340  * __PRETTY_FUNCTION__ capability.
341  */
342 
343 #ifdef G_DISABLE_ASSERT
344 
345 #define g_assert(expr)
346 #define g_assert_not_reached()
347 
348 #else /* !G_DISABLE_ASSERT */
349 
350 #ifdef __GNUC__
351 
352 #define g_assert(expr) G_STMT_START{ \
353  if (!(expr)) \
354  g_log (G_LOG_DOMAIN, \
355  G_LOG_LEVEL_ERROR, \
356  "file %s: line %d (%s): assertion failed: (%s)", \
357  __FILE__, \
358  __LINE__, \
359  __PRETTY_FUNCTION__, \
360  #expr); }G_STMT_END
361 
362 #define g_assert_not_reached() G_STMT_START{ \
363  g_log (G_LOG_DOMAIN, \
364  G_LOG_LEVEL_ERROR, \
365  "file %s: line %d (%s): should not be reached", \
366  __FILE__, \
367  __LINE__, \
368  __PRETTY_FUNCTION__); }G_STMT_END
369 
370 #else /* !__GNUC__ */
371 
372 #define g_assert(expr) G_STMT_START{ \
373  if (!(expr)) \
374  g_log (G_LOG_DOMAIN, \
375  G_LOG_LEVEL_ERROR, \
376  "file %s: line %d: assertion failed: (%s)", \
377  __FILE__, \
378  __LINE__, \
379  #expr); }G_STMT_END
380 
381 #define g_assert_not_reached() G_STMT_START{ \
382  g_log (G_LOG_DOMAIN, \
383  G_LOG_LEVEL_ERROR, \
384  "file %s: line %d: should not be reached", \
385  __FILE__, \
386  __LINE__); }G_STMT_END
387 
388 #endif /* __GNUC__ */
389 
390 #endif /* !G_DISABLE_ASSERT */
391 
392 
393 #ifdef G_DISABLE_CHECKS
394 
395 #define g_return_if_fail(expr)
396 #define g_return_val_if_fail(expr,val)
397 
398 #else /* !G_DISABLE_CHECKS */
399 
400 #ifdef __GNUC__
401 
402 #define g_return_if_fail(expr) G_STMT_START{ \
403  if (!(expr)) \
404  { \
405  g_log (G_LOG_DOMAIN, \
406  G_LOG_LEVEL_CRITICAL, \
407  "file %s: line %d (%s): assertion `%s' failed.", \
408  __FILE__, \
409  __LINE__, \
410  __PRETTY_FUNCTION__, \
411  #expr); \
412  return; \
413  }; }G_STMT_END
414 
415 #define g_return_val_if_fail(expr,val) G_STMT_START{ \
416  if (!(expr)) \
417  { \
418  g_log (G_LOG_DOMAIN, \
419  G_LOG_LEVEL_CRITICAL, \
420  "file %s: line %d (%s): assertion `%s' failed.", \
421  __FILE__, \
422  __LINE__, \
423  __PRETTY_FUNCTION__, \
424  #expr); \
425  return val; \
426  }; }G_STMT_END
427 
428 #else /* !__GNUC__ */
429 
430 #define g_return_if_fail(expr) G_STMT_START{ \
431  if (!(expr)) \
432  { \
433  g_log (G_LOG_DOMAIN, \
434  G_LOG_LEVEL_CRITICAL, \
435  "file %s: line %d: assertion `%s' failed.", \
436  __FILE__, \
437  __LINE__, \
438  #expr); \
439  return; \
440  }; }G_STMT_END
441 
442 #define g_return_val_if_fail(expr, val) G_STMT_START{ \
443  if (!(expr)) \
444  { \
445  g_log (G_LOG_DOMAIN, \
446  G_LOG_LEVEL_CRITICAL, \
447  "file %s: line %d: assertion `%s' failed.", \
448  __FILE__, \
449  __LINE__, \
450  #expr); \
451  return val; \
452  }; }G_STMT_END
453 
454 #endif /* !__GNUC__ */
455 
456 #endif /* !G_DISABLE_CHECKS */
457 
458 
459 /* Provide type definitions for commonly used types.
460  * These are useful because a "gint8" can be adjusted
461  * to be 1 byte (8 bits) on all platforms. Similarly and
462  * more importantly, "gint32" can be adjusted to be
463  * 4 bytes (32 bits) on all platforms.
464  */
465 
466 typedef char gchar;
467 typedef short gshort;
468 typedef long glong;
469 typedef int gint;
470 typedef gint gboolean;
471 
472 typedef unsigned char guchar;
473 typedef unsigned short gushort;
474 typedef unsigned long gulong;
475 typedef unsigned int guint;
476 
477 typedef float gfloat;
478 typedef double gdouble;
479 
480 /* HAVE_LONG_DOUBLE doesn't work correctly on all platforms.
481  * Since gldouble isn't used anywhere, just disable it for now */
482 
483 #if 0
484 #ifdef HAVE_LONG_DOUBLE
485 typedef long double gldouble;
486 #else /* HAVE_LONG_DOUBLE */
487 typedef double gldouble;
488 #endif /* HAVE_LONG_DOUBLE */
489 #endif /* 0 */
490 
491 typedef void* gpointer;
492 typedef const void *gconstpointer;
493 
494 
495 typedef gint32 gssize;
496 typedef guint32 gsize;
497 typedef guint32 GQuark;
498 typedef gint32 GTime;
499 
500 
501 /* Portable endian checks and conversions
502  *
503  * glibconfig.h defines G_BYTE_ORDER which expands to one of
504  * the below macros.
505  */
506 #define G_LITTLE_ENDIAN 1234
507 #define G_BIG_ENDIAN 4321
508 #define G_PDP_ENDIAN 3412 /* unused, need specific PDP check */
509 
510 
511 /* Basic bit swapping functions
512  */
513 #define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \
514  (((guint16) (val) & (guint16) 0x00ffU) << 8) | \
515  (((guint16) (val) & (guint16) 0xff00U) >> 8)))
516 #define GUINT32_SWAP_LE_BE_CONSTANT(val) ((guint32) ( \
517  (((guint32) (val) & (guint32) 0x000000ffU) << 24) | \
518  (((guint32) (val) & (guint32) 0x0000ff00U) << 8) | \
519  (((guint32) (val) & (guint32) 0x00ff0000U) >> 8) | \
520  (((guint32) (val) & (guint32) 0xff000000U) >> 24)))
521 
522 /* Intel specific stuff for speed
523  */
524 #if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2
525 # define GUINT16_SWAP_LE_BE_X86(val) \
526  (__extension__ \
527  ({ register guint16 __v; \
528  if (__builtin_constant_p (val)) \
529  __v = GUINT16_SWAP_LE_BE_CONSTANT (val); \
530  else \
531  __asm__ __const__ ("rorw $8, %w0" \
532  : "=r" (__v) \
533  : "0" ((guint16) (val))); \
534  __v; }))
535 # define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_X86 (val))
536 # if !defined(__i486__) && !defined(__i586__) \
537  && !defined(__pentium__) && !defined(__i686__) && !defined(__pentiumpro__)
538 # define GUINT32_SWAP_LE_BE_X86(val) \
539  (__extension__ \
540  ({ register guint32 __v; \
541  if (__builtin_constant_p (val)) \
542  __v = GUINT32_SWAP_LE_BE_CONSTANT (val); \
543  else \
544  __asm__ __const__ ("rorw $8, %w0\n\t" \
545  "rorl $16, %0\n\t" \
546  "rorw $8, %w0" \
547  : "=r" (__v) \
548  : "0" ((guint32) (val))); \
549  __v; }))
550 # else /* 486 and higher has bswap */
551 # define GUINT32_SWAP_LE_BE_X86(val) \
552  (__extension__ \
553  ({ register guint32 __v; \
554  if (__builtin_constant_p (val)) \
555  __v = GUINT32_SWAP_LE_BE_CONSTANT (val); \
556  else \
557  __asm__ __const__ ("bswap %0" \
558  : "=r" (__v) \
559  : "0" ((guint32) (val))); \
560  __v; }))
561 # endif /* processor specific 32-bit stuff */
562 # define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86 (val))
563 #else /* !__i386__ */
564 # define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
565 # define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val))
566 #endif /* __i386__ */
567 
568 #ifdef G_HAVE_GINT64
569 # define GUINT64_SWAP_LE_BE_CONSTANT(val) ((guint64) ( \
570  (((guint64) (val) & \
571  (guint64) G_GINT64_CONSTANT(0x00000000000000ffU)) << 56) | \
572  (((guint64) (val) & \
573  (guint64) G_GINT64_CONSTANT(0x000000000000ff00U)) << 40) | \
574  (((guint64) (val) & \
575  (guint64) G_GINT64_CONSTANT(0x0000000000ff0000U)) << 24) | \
576  (((guint64) (val) & \
577  (guint64) G_GINT64_CONSTANT(0x00000000ff000000U)) << 8) | \
578  (((guint64) (val) & \
579  (guint64) G_GINT64_CONSTANT(0x000000ff00000000U)) >> 8) | \
580  (((guint64) (val) & \
581  (guint64) G_GINT64_CONSTANT(0x0000ff0000000000U)) >> 24) | \
582  (((guint64) (val) & \
583  (guint64) G_GINT64_CONSTANT(0x00ff000000000000U)) >> 40) | \
584  (((guint64) (val) & \
585  (guint64) G_GINT64_CONSTANT(0xff00000000000000U)) >> 56)))
586 # if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2
587 # define GUINT64_SWAP_LE_BE_X86(val) \
588  (__extension__ \
589  ({ union { guint64 __ll; \
590  guint32 __l[2]; } __r; \
591  if (__builtin_constant_p (val)) \
592  __r.__ll = GUINT64_SWAP_LE_BE_CONSTANT (val); \
593  else \
594  { \
595  union { guint64 __ll; \
596  guint32 __l[2]; } __w; \
597  __w.__ll = ((guint64) val); \
598  __r.__l[0] = GUINT32_SWAP_LE_BE (__w.__l[1]); \
599  __r.__l[1] = GUINT32_SWAP_LE_BE (__w.__l[0]); \
600  } \
601  __r.__ll; }))
602 # define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_X86 (val))
603 # else /* !__i386__ */
604 # define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT(val))
605 # endif
606 #endif
607 
608 #define GUINT16_SWAP_LE_PDP(val) ((guint16) (val))
609 #define GUINT16_SWAP_BE_PDP(val) (GUINT16_SWAP_LE_BE (val))
610 #define GUINT32_SWAP_LE_PDP(val) ((guint32) ( \
611  (((guint32) (val) & (guint32) 0x0000ffffU) << 16) | \
612  (((guint32) (val) & (guint32) 0xffff0000U) >> 16)))
613 #define GUINT32_SWAP_BE_PDP(val) ((guint32) ( \
614  (((guint32) (val) & (guint32) 0x00ff00ffU) << 8) | \
615  (((guint32) (val) & (guint32) 0xff00ff00U) >> 8)))
616 
617 /* The G*_TO_?E() macros are defined in glibconfig.h.
618  * The transformation is symmetric, so the FROM just maps to the TO.
619  */
620 #define GINT16_FROM_LE(val) (GINT16_TO_LE (val))
621 #define GUINT16_FROM_LE(val) (GUINT16_TO_LE (val))
622 #define GINT16_FROM_BE(val) (GINT16_TO_BE (val))
623 #define GUINT16_FROM_BE(val) (GUINT16_TO_BE (val))
624 #define GINT32_FROM_LE(val) (GINT32_TO_LE (val))
625 #define GUINT32_FROM_LE(val) (GUINT32_TO_LE (val))
626 #define GINT32_FROM_BE(val) (GINT32_TO_BE (val))
627 #define GUINT32_FROM_BE(val) (GUINT32_TO_BE (val))
628 
629 #ifdef G_HAVE_GINT64
630 #define GINT64_FROM_LE(val) (GINT64_TO_LE (val))
631 #define GUINT64_FROM_LE(val) (GUINT64_TO_LE (val))
632 #define GINT64_FROM_BE(val) (GINT64_TO_BE (val))
633 #define GUINT64_FROM_BE(val) (GUINT64_TO_BE (val))
634 #endif
635 
636 #define GLONG_FROM_LE(val) (GLONG_TO_LE (val))
637 #define GULONG_FROM_LE(val) (GULONG_TO_LE (val))
638 #define GLONG_FROM_BE(val) (GLONG_TO_BE (val))
639 #define GULONG_FROM_BE(val) (GULONG_TO_BE (val))
640 
641 #define GINT_FROM_LE(val) (GINT_TO_LE (val))
642 #define GUINT_FROM_LE(val) (GUINT_TO_LE (val))
643 #define GINT_FROM_BE(val) (GINT_TO_BE (val))
644 #define GUINT_FROM_BE(val) (GUINT_TO_BE (val))
645 
646 
647 /* Portable versions of host-network order stuff
648  */
649 #define g_ntohl(val) (GUINT32_FROM_BE (val))
650 #define g_ntohs(val) (GUINT16_FROM_BE (val))
651 #define g_htonl(val) (GUINT32_TO_BE (val))
652 #define g_htons(val) (GUINT16_TO_BE (val))
653 
654 
655 /* Glib version.
656  * we prefix variable declarations so they can
657  * properly get exported in windows dlls.
658  */
659 #ifdef NATIVE_WIN32
660 # ifdef GLIB_COMPILATION
661 # define GUTILS_C_VAR __declspec(dllexport)
662 # else /* !GLIB_COMPILATION */
663 # define GUTILS_C_VAR extern __declspec(dllimport)
664 # endif /* !GLIB_COMPILATION */
665 #else /* !NATIVE_WIN32 */
666 # define GUTILS_C_VAR extern
667 #endif /* !NATIVE_WIN32 */
668 
674 
675 #define GLIB_CHECK_VERSION(major,minor,micro) \
676  (GLIB_MAJOR_VERSION > (major) || \
677  (GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION > (minor)) || \
678  (GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION == (minor) && \
679  GLIB_MICRO_VERSION >= (micro)))
680 
681 /* Forward declarations of glib types.
682  */
683 typedef struct _GAllocator GAllocator;
684 typedef struct _GArray GArray;
685 typedef struct _GByteArray GByteArray;
686 typedef struct _GCache GCache;
687 typedef struct _GCompletion GCompletion;
688 typedef struct _GData GData;
689 typedef struct _GDebugKey GDebugKey;
690 typedef struct _GHashTable GHashTable;
691 typedef struct _GHook GHook;
692 typedef struct _GHookList GHookList;
693 typedef struct _GList GList;
694 typedef struct _GMemChunk GMemChunk;
695 typedef struct _GNode GNode;
696 typedef struct _GPtrArray GPtrArray;
697 typedef struct _GRelation GRelation;
698 typedef struct _GScanner GScanner;
699 typedef struct _GScannerConfig GScannerConfig;
700 typedef struct _GSList GSList;
701 typedef struct _GString GString;
702 typedef struct _GStringChunk GStringChunk;
703 typedef struct _GTimer GTimer;
704 typedef struct _GTree GTree;
705 typedef struct _GTuples GTuples;
706 typedef union _GTokenValue GTokenValue;
707 typedef struct _GIOChannel GIOChannel;
708 
709 typedef enum
710 {
714  G_TRAVERSE_MASK = 0x03
716 
717 typedef enum
718 {
724 
725 /* Log level shift offset for user defined
726  * log levels (0-7 are used by GLib).
727  */
728 #define G_LOG_LEVEL_USER_SHIFT (8)
729 
730 /* Glib log levels and flags.
731  */
732 typedef enum
733 {
734  /* log flags */
737 
738  /* GLib log levels */
739  G_LOG_LEVEL_ERROR = 1 << 2, /* always fatal */
745 
748 
749 /* GLib log levels that are considered fatal by default */
750 #define G_LOG_FATAL_MASK (G_LOG_FLAG_RECURSION | G_LOG_LEVEL_ERROR)
751 
752 
753 typedef gpointer (*GCacheNewFunc) (gpointer key);
754 typedef gpointer (*GCacheDupFunc) (gpointer value);
755 typedef void (*GCacheDestroyFunc) (gpointer value);
757  gconstpointer b);
758 typedef gchar* (*GCompletionFunc) (gpointer);
759 typedef void (*GDestroyNotify) (gpointer data);
760 typedef void (*GDataForeachFunc) (GQuark key_id,
761  gpointer data,
762  gpointer user_data);
763 typedef void (*GFunc) (gpointer data,
764  gpointer user_data);
765 typedef guint (*GHashFunc) (gconstpointer key);
766 typedef void (*GFreeFunc) (gpointer data);
767 typedef void (*GHFunc) (gpointer key,
768  gpointer value,
769  gpointer user_data);
770 typedef gboolean (*GHRFunc) (gpointer key,
771  gpointer value,
772  gpointer user_data);
773 typedef gint (*GHookCompareFunc) (GHook *new_hook,
774  GHook *sibling);
775 typedef gboolean (*GHookFindFunc) (GHook *hook,
776  gpointer data);
777 typedef void (*GHookMarshaller) (GHook *hook,
778  gpointer data);
780  gpointer data);
781 typedef void (*GHookFunc) (gpointer data);
782 typedef gboolean (*GHookCheckFunc) (gpointer data);
783 typedef void (*GHookFreeFunc) (GHookList *hook_list,
784  GHook *hook);
785 typedef void (*GLogFunc) (const gchar *log_domain,
786  GLogLevelFlags log_level,
787  const gchar *message,
788  gpointer user_data);
789 typedef gboolean (*GNodeTraverseFunc) (GNode *node,
790  gpointer data);
791 typedef void (*GNodeForeachFunc) (GNode *node,
792  gpointer data);
793 typedef gint (*GSearchFunc) (gpointer key,
794  gpointer data);
795 typedef void (*GScannerMsgFunc) (GScanner *scanner,
796  gchar *message,
797  gint error);
798 typedef gint (*GTraverseFunc) (gpointer key,
799  gpointer value,
800  gpointer data);
801 typedef void (*GVoidFunc) (void);
802 
803 
804 struct _GList
805 {
809 };
810 
811 struct _GSList
812 {
815 };
816 
817 struct _GString
818 {
821 };
822 
823 struct _GArray
824 {
827 };
828 
830 {
833 };
834 
836 {
839 };
840 
841 struct _GTuples
842 {
844 };
845 
847 {
850 };
851 
852 
853 /* Doubly linked lists
854  */
858 void g_list_free (GList *list);
859 void g_list_free_1 (GList *list);
861  gpointer data);
863  gpointer data);
865  gpointer data,
866  gint position);
868  gpointer data,
869  GCompareFunc func);
871  GList *list2);
873  gpointer data);
875  GList *llink);
879  guint n);
881  gpointer data);
883  gpointer data,
884  GCompareFunc func);
886  GList *llink);
888  gpointer data);
892 void g_list_foreach (GList *list,
893  GFunc func,
894  gpointer user_data);
896  GCompareFunc compare_func);
898  guint n);
899 #define g_list_previous(list) ((list) ? (((GList *)(list))->prev) : NULL)
900 #define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL)
901 
902 
903 /* Singly linked lists
904  */
908 void g_slist_free (GSList *list);
909 void g_slist_free_1 (GSList *list);
911  gpointer data);
913  gpointer data);
915  gpointer data,
916  gint position);
918  gpointer data,
919  GCompareFunc func);
921  GSList *list2);
923  gpointer data);
925  GSList *llink);
929  guint n);
931  gpointer data);
933  gpointer data,
934  GCompareFunc func);
936  GSList *llink);
938  gpointer data);
942  GFunc func,
943  gpointer user_data);
945  GCompareFunc compare_func);
947  guint n);
948 #define g_slist_next(slist) ((slist) ? (((GSList *)(slist))->next) : NULL)
949 
950 
951 /* Hash tables
952  */
954  GCompareFunc key_compare_func);
955 void g_hash_table_destroy (GHashTable *hash_table);
956 void g_hash_table_insert (GHashTable *hash_table,
957  gpointer key,
958  gpointer value);
959 void g_hash_table_remove (GHashTable *hash_table,
960  gconstpointer key);
962  gconstpointer key);
964  gconstpointer lookup_key,
965  gpointer *orig_key,
966  gpointer *value);
967 void g_hash_table_freeze (GHashTable *hash_table);
968 void g_hash_table_thaw (GHashTable *hash_table);
970  GHFunc func,
971  gpointer user_data);
973  GHRFunc func,
974  gpointer user_data);
976 
977 
978 /* Caches
979  */
981  GCacheDestroyFunc value_destroy_func,
982  GCacheDupFunc key_dup_func,
983  GCacheDestroyFunc key_destroy_func,
984  GHashFunc hash_key_func,
985  GHashFunc hash_value_func,
986  GCompareFunc key_compare_func);
987 void g_cache_destroy (GCache *cache);
989  gpointer key);
990 void g_cache_remove (GCache *cache,
991  gpointer value);
993  GHFunc func,
994  gpointer user_data);
996  GHFunc func,
997  gpointer user_data);
998 
999 
1000 /* Balanced binary trees
1001  */
1002 GTree* g_tree_new (GCompareFunc key_compare_func);
1003 void g_tree_destroy (GTree *tree);
1004 void g_tree_insert (GTree *tree,
1005  gpointer key,
1006  gpointer value);
1007 void g_tree_remove (GTree *tree,
1008  gpointer key);
1010  gpointer key);
1012  GTraverseFunc traverse_func,
1013  GTraverseType traverse_type,
1014  gpointer data);
1016  GSearchFunc search_func,
1017  gpointer data);
1020 
1021 
1022 
1023 /* N-way tree implementation
1024  */
1025 struct _GNode
1026 {
1032 };
1033 
1034 #define G_NODE_IS_ROOT(node) (((GNode*) (node))->parent == NULL && \
1035  ((GNode*) (node))->prev == NULL && \
1036  ((GNode*) (node))->next == NULL)
1037 #define G_NODE_IS_LEAF(node) (((GNode*) (node))->children == NULL)
1038 
1042 void g_node_destroy (GNode *root);
1043 void g_node_unlink (GNode *node);
1045  gint position,
1046  GNode *node);
1048  GNode *sibling,
1049  GNode *node);
1051  GNode *node);
1053  GTraverseFlags flags);
1056  GNode *descendant);
1059  GTraverseType order,
1060  GTraverseFlags flags,
1061  gpointer data);
1062 
1063 /* convenience macros */
1064 #define g_node_append(parent, node) \
1065  g_node_insert_before ((parent), NULL, (node))
1066 #define g_node_insert_data(parent, position, data) \
1067  g_node_insert ((parent), (position), g_node_new (data))
1068 #define g_node_insert_data_before(parent, sibling, data) \
1069  g_node_insert_before ((parent), (sibling), g_node_new (data))
1070 #define g_node_prepend_data(parent, data) \
1071  g_node_prepend ((parent), g_node_new (data))
1072 #define g_node_append_data(parent, data) \
1073  g_node_insert_before ((parent), NULL, g_node_new (data))
1074 
1075 /* traversal function, assumes that `node' is root
1076  * (only traverses `node' and its subtree).
1077  * this function is just a high level interface to
1078  * low level traversal functions, optimized for speed.
1079  */
1081  GTraverseType order,
1082  GTraverseFlags flags,
1083  gint max_depth,
1084  GNodeTraverseFunc func,
1085  gpointer data);
1086 
1087 /* return the maximum tree height starting with `node', this is an expensive
1088  * operation, since we need to visit all nodes. this could be shortened by
1089  * adding `guint height' to struct _GNode, but then again, this is not very
1090  * often needed, and would make g_node_insert() more time consuming.
1091  */
1093 
1095  GTraverseFlags flags,
1096  GNodeForeachFunc func,
1097  gpointer data);
1101  guint n);
1104  GTraverseFlags flags,
1105  gpointer data);
1107  GNode *child);
1109  gpointer data);
1110 
1113 
1114 #define g_node_prev_sibling(node) ((node) ? \
1115  ((GNode*) (node))->prev : NULL)
1116 #define g_node_next_sibling(node) ((node) ? \
1117  ((GNode*) (node))->next : NULL)
1118 #define g_node_first_child(node) ((node) ? \
1119  ((GNode*) (node))->children : NULL)
1120 
1121 
1122 /* Callback maintenance functions
1123  */
1124 #define G_HOOK_FLAG_USER_SHIFT (4)
1125 typedef enum
1126 {
1129  G_HOOK_FLAG_MASK = 0x0f
1131 
1132 #define G_HOOK_DEFERRED_DESTROY ((GHookFreeFunc) 0x01)
1133 
1135 {
1141  GHookFreeFunc hook_free; /* virtual function */
1142  GHookFreeFunc hook_destroy; /* virtual function */
1143 };
1144 
1145 struct _GHook
1146 {
1155 };
1156 
1157 #define G_HOOK_ACTIVE(hook) ((((GHook*) hook)->flags & \
1158  G_HOOK_FLAG_ACTIVE) != 0)
1159 #define G_HOOK_IN_CALL(hook) ((((GHook*) hook)->flags & \
1160  G_HOOK_FLAG_IN_CALL) != 0)
1161 #define G_HOOK_IS_VALID(hook) (((GHook*) hook)->hook_id != 0 && \
1162  G_HOOK_ACTIVE (hook))
1163 #define G_HOOK_IS_UNLINKED(hook) (((GHook*) hook)->next == NULL && \
1164  ((GHook*) hook)->prev == NULL && \
1165  ((GHook*) hook)->hook_id == 0 && \
1166  ((GHook*) hook)->ref_count == 0)
1167 
1168 void g_hook_list_init (GHookList *hook_list,
1169  guint hook_size);
1170 void g_hook_list_clear (GHookList *hook_list);
1172 void g_hook_free (GHookList *hook_list,
1173  GHook *hook);
1174 void g_hook_ref (GHookList *hook_list,
1175  GHook *hook);
1176 void g_hook_unref (GHookList *hook_list,
1177  GHook *hook);
1179  guint hook_id);
1181  GHook *hook);
1182 void g_hook_prepend (GHookList *hook_list,
1183  GHook *hook);
1185  GHook *sibling,
1186  GHook *hook);
1188  GHook *hook,
1189  GHookCompareFunc func);
1191  guint hook_id);
1193  gboolean need_valids,
1194  GHookFindFunc func,
1195  gpointer data);
1197  gboolean need_valids,
1198  gpointer data);
1200  gboolean need_valids,
1201  gpointer func);
1203  gboolean need_valids,
1204  gpointer func,
1205  gpointer data);
1206 /* return the first valid hook, and increment its reference count */
1208  gboolean may_be_in_call);
1209 /* return the next valid hook with incremented reference count, and
1210  * decrement the reference count of the original hook
1211  */
1213  GHook *hook,
1214  gboolean may_be_in_call);
1215 
1216 /* GHookCompareFunc implementation to insert hooks sorted by their id */
1218  GHook *sibling);
1219 
1220 /* convenience macros */
1221 #define g_hook_append( hook_list, hook ) \
1222  g_hook_insert_before ((hook_list), NULL, (hook))
1223 
1224 /* invoke all valid hooks with the (*GHookFunc) signature.
1225  */
1227  gboolean may_recurse);
1228 /* invoke all valid hooks with the (*GHookCheckFunc) signature,
1229  * and destroy the hook if FALSE is returned.
1230  */
1232  gboolean may_recurse);
1233 /* invoke a marshaller on all valid hooks.
1234  */
1236  gboolean may_recurse,
1237  GHookMarshaller marshaller,
1238  gpointer data);
1240  gboolean may_recurse,
1241  GHookCheckMarshaller marshaller,
1242  gpointer data);
1243 
1244 
1245 /* Fatal error handlers.
1246  * g_on_error_query() will prompt the user to either
1247  * [E]xit, [H]alt, [P]roceed or show [S]tack trace.
1248  * g_on_error_stack_trace() invokes gdb, which attaches to the current
1249  * process and shows a stack trace.
1250  * These function may cause different actions on non-unix platforms.
1251  * The prg_name arg is required by gdb to find the executable, if it is
1252  * passed as NULL, g_on_error_query() will try g_get_prgname().
1253  */
1254 void g_on_error_query (const gchar *prg_name);
1255 void g_on_error_stack_trace (const gchar *prg_name);
1256 
1257 
1258 /* Logging mechanism
1259  */
1260 extern const gchar *g_log_domain_glib;
1261 guint g_log_set_handler (const gchar *log_domain,
1262  GLogLevelFlags log_levels,
1263  GLogFunc log_func,
1264  gpointer user_data);
1265 void g_log_remove_handler (const gchar *log_domain,
1266  guint handler_id);
1267 void g_log_default_handler (const gchar *log_domain,
1268  GLogLevelFlags log_level,
1269  const gchar *message,
1270  gpointer unused_data);
1271 void g_log (const gchar *log_domain,
1272  GLogLevelFlags log_level,
1273  const gchar *format,
1274  ...) G_GNUC_PRINTF (3, 4);
1275 void g_logv (const gchar *log_domain,
1276  GLogLevelFlags log_level,
1277  const gchar *format,
1278  va_list args);
1280  GLogLevelFlags fatal_mask);
1282 #ifndef G_LOG_DOMAIN
1283 #define G_LOG_DOMAIN ((gchar*) 0)
1284 #endif /* G_LOG_DOMAIN */
1285 
1286 #define g_error(format, args...) g_log (G_LOG_DOMAIN, \
1287  G_LOG_LEVEL_ERROR, \
1288  format, ##args)
1289 #define g_message(format, args...) g_log (G_LOG_DOMAIN, \
1290  G_LOG_LEVEL_MESSAGE, \
1291  format, ##args)
1292 #define g_warning printf
1293 
1294 
1295 
1296 /* Memory allocation and debugging
1297  */
1298 #define g_malloc(size) ((gpointer)malloc(size))
1299 #define g_malloc0(size) ((gpointer)calloc(size, 1))
1300 #define g_realloc(mem,size) ((gpointer)realloc(mem, size))
1301 #define g_free(mem) free(mem)
1302 
1303 
1304 void g_mem_profile (void);
1306 
1307 
1308 /* String utility functions that modify a string argument or
1309  * return a constant string that must not be freed.
1310  */
1311 #define G_STR_DELIMITERS "_-|> <."
1313  const gchar *delimiters,
1314  gchar new_delimiter);
1315 gdouble g_strtod (const gchar *nptr,
1316  gchar **endptr);
1320  const gchar *s2);
1322  const gchar *s2,
1323  guint n);
1324 void g_strdown (gchar *string);
1325 void g_strup (gchar *string);
1326 void g_strreverse (gchar *string);
1327 /* removes leading spaces */
1328 gchar* g_strchug (gchar *string);
1329 /* removes trailing spaces */
1331 /* removes leading & trailing spaces */
1332 #define g_strstrip( string ) g_strchomp (g_strchug (string))
1333 
1334 /* String utility functions that return a newly allocated string which
1335  * ought to be freed from the caller at some point.
1336  */
1337 gchar* g_strdup (const gchar *str);
1338 gchar* g_strdup_printf (const gchar *format,
1339  ...) G_GNUC_PRINTF (1, 2);
1341  va_list args);
1343  guint n);
1345  gchar fill_char);
1347  ...); /* NULL terminated */
1349  ...); /* NULL terminated */
1352  guint byte_size);
1353 
1354 /* NULL terminated string arrays.
1355  * g_strsplit() splits up string into max_tokens tokens at delim and
1356  * returns a newly allocated string array.
1357  * g_strjoinv() concatenates all of str_array's strings, sliding in an
1358  * optional separator, the returned string is newly allocated.
1359  * g_strfreev() frees the array itself and all of its strings.
1360  */
1362  const gchar *delimiter,
1363  gint max_tokens);
1365  gchar **str_array);
1366 void g_strfreev (gchar **str_array);
1367 
1368 
1369 
1370 /* calculate a string size, guarranteed to fit format + args.
1371  */
1373  va_list args);
1374 
1375 
1376 /* Retrive static string info
1377  */
1383 void g_set_prgname (const gchar *prgname);
1384 
1385 
1386 /* Miscellaneous utility functions
1387  */
1389  GDebugKey *keys,
1390  guint nkeys);
1392  gulong n,
1393  gchar const *format,
1394  ...) G_GNUC_PRINTF (3, 4);
1396  gulong n,
1397  gchar const *format,
1398  va_list args);
1399 gchar* g_basename (const gchar *file_name);
1400 /* Check if a file name is an absolute path */
1402 /* In case of absolute paths, skip the root part */
1404 
1405 /* strings are newly allocated with g_malloc() */
1406 gchar* g_dirname (const gchar *file_name);
1408 gchar* g_getenv (const gchar *variable);
1409 
1410 
1411 /* we use a GLib function as a replacement for ATEXIT, so
1412  * the programmer is not required to check the return value
1413  * (if there is any in the implementation) and doesn't encounter
1414  * missing include files.
1415  */
1416 void g_atexit (GVoidFunc func);
1417 
1418 
1419 /* Bit tests
1420  */
1422  gint nth_bit);
1423 #ifdef G_CAN_INLINE
1425 g_bit_nth_lsf (guint32 mask,
1426  gint nth_bit)
1427 {
1428  do
1429  {
1430  nth_bit++;
1431  if (mask & (1 << (guint) nth_bit))
1432  return nth_bit;
1433  }
1434  while (nth_bit < 32);
1435  return -1;
1436 }
1437 #endif /* G_CAN_INLINE */
1438 
1440  gint nth_bit);
1441 #ifdef G_CAN_INLINE
1443 g_bit_nth_msf (guint32 mask,
1444  gint nth_bit)
1445 {
1446  if (nth_bit < 0)
1447  nth_bit = 32;
1448  do
1449  {
1450  nth_bit--;
1451  if (mask & (1 << (guint) nth_bit))
1452  return nth_bit;
1453  }
1454  while (nth_bit > 0);
1455  return -1;
1456 }
1457 #endif /* G_CAN_INLINE */
1458 
1460 #ifdef G_CAN_INLINE
1462 g_bit_storage (guint number)
1463 {
1464  register guint n_bits = 0;
1465 
1466  do
1467  {
1468  n_bits++;
1469  number >>= 1;
1470  }
1471  while (number);
1472  return n_bits;
1473 }
1474 #endif /* G_CAN_INLINE */
1475 
1476 /* String Chunks
1477  */
1481  const gchar *string);
1483  const gchar *string);
1484 
1485 
1486 /* Strings
1487  */
1488 GString* g_string_new (const gchar *init);
1490 void g_string_free (GString *string,
1491  gint free_segment);
1493  const gchar *rval);
1495  gint len);
1497  const gchar *val);
1499  gchar c);
1501  const gchar *val);
1503  gchar c);
1505  gint pos,
1506  const gchar *val);
1508  gint pos,
1509  gchar c);
1511  gint pos,
1512  gint len);
1516  const gchar *format,
1517  ...) G_GNUC_PRINTF (2, 3);
1519  const gchar *format,
1520  ...) G_GNUC_PRINTF (2, 3);
1521 
1522 
1523 /* Resizable arrays, remove fills any cleared spot and shortens the
1524  * array, while preserving the order. remove_fast will distort the
1525  * order by moving the last element to the position of the removed
1526  */
1527 
1528 #define g_array_append_val(a,v) pmidi_array_append_vals (a, &v, 1)
1529 #define g_array_prepend_val(a,v) g_array_prepend_vals (a, &v, 1)
1530 #define g_array_insert_val(a,i,v) g_array_insert_vals (a, i, &v, 1)
1531 #define g_array_index(a,t,i) (((t*) (a)->data) [(i)])
1532 
1533 GArray* pmidi_array_new (gboolean zero_terminated,
1534  gboolean clear,
1535  guint element_size);
1537  gboolean free_segment);
1539  gconstpointer data,
1540  guint len);
1542  gconstpointer data,
1543  guint len);
1545  guint index,
1546  gconstpointer data,
1547  guint len);
1549  guint length);
1551  guint index);
1553  guint index);
1554 
1555 /* Resizable pointer array. This interface is much less complicated
1556  * than the above. Add appends appends a pointer. Remove fills any
1557  * cleared spot and shortens the array. remove_fast will again distort
1558  * order.
1559  */
1560 #define g_ptr_array_index(array,index) (array->pdata)[index]
1563  gboolean free_seg);
1565  gint length);
1567  guint index);
1569  guint index);
1571  gpointer data);
1573  gpointer data);
1575  gpointer data);
1576 
1577 /* Byte arrays, an array of guint8. Implemented as a GArray,
1578  * but type-safe.
1579  */
1580 
1583  gboolean free_segment);
1585  const guint8 *data,
1586  guint len);
1588  const guint8 *data,
1589  guint len);
1591  guint length);
1593  guint index);
1595  guint index);
1596 
1597 #ifdef __cplusplus
1598 }
1599 #endif /* __cplusplus */
1600 
1601 #endif /* __G_LIB_H__ */
GHFunc
void(* GHFunc)(gpointer key, gpointer value, gpointer user_data)
Definition: glib.h:767
g_hook_destroy_link
void g_hook_destroy_link(GHookList *hook_list, GHook *hook)
g_string_assign
GString * g_string_assign(GString *lval, const gchar *rval)
g_cache_key_foreach
void g_cache_key_foreach(GCache *cache, GHFunc func, gpointer user_data)
g_ptr_array_set_size
void g_ptr_array_set_size(GPtrArray *array, gint length)
g_hash_table_destroy
void g_hash_table_destroy(GHashTable *hash_table)
GHookMarshaller
void(* GHookMarshaller)(GHook *hook, gpointer data)
Definition: glib.h:777
glib_binary_age
GUTILS_C_VAR const guint glib_binary_age
Definition: glib.h:673
g_hook_list_init
void g_hook_list_init(GHookList *hook_list, guint hook_size)
_GNode::children
GNode * children
Definition: glib.h:1031
g_array_set_size
GArray * g_array_set_size(GArray *array, guint length)
_GNode
Definition: glib.h:1026
g_node_find_child
GNode * g_node_find_child(GNode *node, GTraverseFlags flags, gpointer data)
g_strconcat
gchar * g_strconcat(const gchar *string1,...)
pmidi_ptr_array_remove_index_fast
gpointer pmidi_ptr_array_remove_index_fast(GPtrArray *array, guint index)
g_slist_remove
GSList * g_slist_remove(GSList *list, gpointer data)
g_strjoinv
gchar * g_strjoinv(const gchar *separator, gchar **str_array)
GSearchFunc
gint(* GSearchFunc)(gpointer key, gpointer data)
Definition: glib.h:793
g_cache_new
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, GCompareFunc key_compare_func)
g_strcasecmp
gint g_strcasecmp(const gchar *s1, const gchar *s2)
g_byte_array_append
GByteArray * g_byte_array_append(GByteArray *array, const guint8 *data, guint len)
g_hash_table_lookup
gpointer g_hash_table_lookup(GHashTable *hash_table, gconstpointer key)
gconstpointer
const void * gconstpointer
Definition: glib.h:492
GHookCheckMarshaller
gboolean(* GHookCheckMarshaller)(GHook *hook, gpointer data)
Definition: glib.h:779
_GByteArray::data
guint8 * data
Definition: glib.h:831
_GList::next
GList * next
Definition: glib.h:807
GHookCheckFunc
gboolean(* GHookCheckFunc)(gpointer data)
Definition: glib.h:782
g_strerror
gchar * g_strerror(gint errnum)
g_get_prgname
gchar * g_get_prgname(void)
G_HOOK_FLAG_ACTIVE
@ G_HOOK_FLAG_ACTIVE
Definition: glib.h:1127
g_list_alloc
GList * g_list_alloc(void)
GIOChannel
struct _GIOChannel GIOChannel
Definition: glib.h:707
G_HOOK_FLAG_IN_CALL
@ G_HOOK_FLAG_IN_CALL
Definition: glib.h:1128
GLogFunc
void(* GLogFunc)(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
Definition: glib.h:785
g_strdown
void g_strdown(gchar *string)
guint16
unsigned short guint16
Definition: glib.h:74
G_HOOK_FLAG_MASK
@ G_HOOK_FLAG_MASK
Definition: glib.h:1129
g_array_insert_vals
GArray * g_array_insert_vals(GArray *array, guint index, gconstpointer data, guint len)
g_list_insert
GList * g_list_insert(GList *list, gpointer data, gint position)
g_string_new
GString * g_string_new(const gchar *init)
g_snprintf
gint g_snprintf(gchar *string, gulong n, gchar const *format,...) G_GNUC_PRINTF(3
g_string_sprintfa
void void g_string_sprintfa(GString *string, const gchar *format,...) G_GNUC_PRINTF(2
g_cache_destroy
void g_cache_destroy(GCache *cache)
g_strncasecmp
gint g_strncasecmp(const gchar *s1, const gchar *s2, guint n)
_GString::len
gint len
Definition: glib.h:820
GHookFindFunc
gboolean(* GHookFindFunc)(GHook *hook, gpointer data)
Definition: glib.h:775
GHashFunc
guint(* GHashFunc)(gconstpointer key)
Definition: glib.h:765
g_list_append
GList * g_list_append(GList *list, gpointer data)
_GTuples::len
guint len
Definition: glib.h:843
g_strreverse
void g_strreverse(gchar *string)
g_list_last
GList * g_list_last(GList *list)
g_byte_array_new
GByteArray * g_byte_array_new(void)
GTraverseType
GTraverseType
Definition: glib.h:718
_GPtrArray::pdata
gpointer * pdata
Definition: glib.h:837
g_list_index
gint g_list_index(GList *list, gpointer data)
G_TRAVERSE_LEAFS
@ G_TRAVERSE_LEAFS
Definition: glib.h:711
g_slist_position
gint g_slist_position(GSList *list, GSList *llink)
g_list_nth
GList * g_list_nth(GList *list, guint n)
G_IN_ORDER
@ G_IN_ORDER
Definition: glib.h:719
_GHook::func
gpointer func
Definition: glib.h:1153
g_tree_destroy
void g_tree_destroy(GTree *tree)
guint8
unsigned char guint8
Definition: glib.h:72
g_strtod
gdouble g_strtod(const gchar *nptr, gchar **endptr)
g_node_is_ancestor
gboolean g_node_is_ancestor(GNode *node, GNode *descendant)
g_get_home_dir
gchar * g_get_home_dir(void)
g_byte_array_remove_index_fast
GByteArray * g_byte_array_remove_index_fast(GByteArray *array, guint index)
_GHook::prev
GHook * prev
Definition: glib.h:1149
_GHook::ref_count
guint ref_count
Definition: glib.h:1150
gint
int gint
Definition: glib.h:469
_GPtrArray
Definition: glib.h:836
g_list_push_allocator
void g_list_push_allocator(GAllocator *allocator)
g_slist_reverse
GSList * g_slist_reverse(GSList *list)
g_log_remove_handler
void g_log_remove_handler(const gchar *log_domain, guint handler_id)
g_strdup_printf
gchar * g_strdup_printf(const gchar *format,...) G_GNUC_PRINTF(1
g_list_concat
GList * g_list_concat(GList *list1, GList *list2)
g_hook_find_func_data
GHook * g_hook_find_func_data(GHookList *hook_list, gboolean need_valids, gpointer func, gpointer data)
guint32
unsigned int guint32
Definition: glib.h:76
g_tree_insert
void g_tree_insert(GTree *tree, gpointer key, gpointer value)
g_hook_list_invoke
void g_hook_list_invoke(GHookList *hook_list, gboolean may_recurse)
g_node_first_sibling
GNode * g_node_first_sibling(GNode *node)
g_byte_array_prepend
GByteArray * g_byte_array_prepend(GByteArray *array, const guint8 *data, guint len)
g_path_skip_root
gchar * g_path_skip_root(gchar *file_name)
g_list_prepend
GList * g_list_prepend(GList *list, gpointer data)
g_log_set_fatal_mask
GLogLevelFlags g_log_set_fatal_mask(const gchar *log_domain, GLogLevelFlags fatal_mask)
g_list_pop_allocator
void g_list_pop_allocator(void)
_GNode::prev
GNode * prev
Definition: glib.h:1029
g_memdup
gpointer g_memdup(gconstpointer mem, guint byte_size)
g_list_sort
GList * g_list_sort(GList *list, GCompareFunc compare_func)
g_byte_array_free
void g_byte_array_free(GByteArray *array, gboolean free_segment)
g_list_find_custom
GList * g_list_find_custom(GList *list, gpointer data, GCompareFunc func)
g_strndup
gchar * g_strndup(const gchar *str, guint n)
GStringChunk
struct _GStringChunk GStringChunk
Definition: glib.h:702
g_node_nth_child
GNode * g_node_nth_child(GNode *node, guint n)
g_slist_length
guint g_slist_length(GSList *list)
g_hash_table_size
guint g_hash_table_size(GHashTable *hash_table)
g_slist_index
gint g_slist_index(GSList *list, gpointer data)
g_get_real_name
gchar * g_get_real_name(void)
g_string_chunk_free
void g_string_chunk_free(GStringChunk *chunk)
G_GNUC_PRINTF
#define G_GNUC_PRINTF(format_idx, arg_idx)
Definition: glib.h:262
g_strdup
gchar * g_strdup(const gchar *str)
g_hook_get
GHook * g_hook_get(GHookList *hook_list, guint hook_id)
g_hook_compare_ids
gint g_hook_compare_ids(GHook *new_hook, GHook *sibling)
_GSList
Definition: glib.h:812
g_strdelimit
gchar * g_strdelimit(gchar *string, const gchar *delimiters, gchar new_delimiter)
g_string_sized_new
GString * g_string_sized_new(guint dfl_size)
g_mem_profile
void g_mem_profile(void)
g_parse_debug_string
guint g_parse_debug_string(const gchar *string, GDebugKey *keys, guint nkeys)
g_array_remove_index_fast
GArray * g_array_remove_index_fast(GArray *array, guint index)
g_slist_insert_sorted
GSList * g_slist_insert_sorted(GSList *list, gpointer data, GCompareFunc func)
G_LOG_FLAG_RECURSION
@ G_LOG_FLAG_RECURSION
Definition: glib.h:735
g_get_tmp_dir
gchar * g_get_tmp_dir(void)
GHRFunc
gboolean(* GHRFunc)(gpointer key, gpointer value, gpointer user_data)
Definition: glib.h:770
g_log_domain_glib
const gchar * g_log_domain_glib
g_slist_find_custom
GSList * g_slist_find_custom(GSList *list, gpointer data, GCompareFunc func)
GCacheDestroyFunc
void(* GCacheDestroyFunc)(gpointer value)
Definition: glib.h:755
_GString::str
gchar * str
Definition: glib.h:819
g_strchomp
gchar * g_strchomp(gchar *string)
GTraverseFlags
GTraverseFlags
Definition: glib.h:710
gboolean
gint gboolean
Definition: glib.h:470
g_hook_list_invoke_check
void g_hook_list_invoke_check(GHookList *hook_list, gboolean may_recurse)
glib_interface_age
GUTILS_C_VAR const guint glib_interface_age
Definition: glib.h:672
_GSList::next
GSList * next
Definition: glib.h:814
_GNode::parent
GNode * parent
Definition: glib.h:1030
GFunc
void(* GFunc)(gpointer data, gpointer user_data)
Definition: glib.h:763
g_string_truncate
GString * g_string_truncate(GString *string, gint len)
GNodeForeachFunc
void(* GNodeForeachFunc)(GNode *node, gpointer data)
Definition: glib.h:791
g_hash_table_remove
void g_hash_table_remove(GHashTable *hash_table, gconstpointer key)
g_node_child_position
gint g_node_child_position(GNode *node, GNode *child)
g_cache_remove
void g_cache_remove(GCache *cache, gpointer value)
g_hash_table_thaw
void g_hash_table_thaw(GHashTable *hash_table)
g_tree_search
gpointer g_tree_search(GTree *tree, GSearchFunc search_func, gpointer data)
g_hook_ref
void g_hook_ref(GHookList *hook_list, GHook *hook)
g_node_find
GNode * g_node_find(GNode *root, GTraverseType order, GTraverseFlags flags, gpointer data)
g_slist_last
GSList * g_slist_last(GSList *list)
g_strnfill
gchar * g_strnfill(guint length, gchar fill_char)
gpointer
void * gpointer
Definition: glib.h:491
pmidi_ptr_array_free
void pmidi_ptr_array_free(GPtrArray *array, gboolean free_seg)
GTokenValue
union _GTokenValue GTokenValue
Definition: glib.h:706
g_list_insert_sorted
GList * g_list_insert_sorted(GList *list, gpointer data, GCompareFunc func)
g_cache_insert
gpointer g_cache_insert(GCache *cache, gpointer key)
g_tree_height
gint g_tree_height(GTree *tree)
_GHookList::is_setup
guint is_setup
Definition: glib.h:1138
guchar
unsigned char guchar
Definition: glib.h:472
glib_major_version
GUTILS_C_VAR const guint glib_major_version
Definition: glib.h:669
_GHook::destroy
GDestroyNotify destroy
Definition: glib.h:1154
_GByteArray::len
guint len
Definition: glib.h:832
g_node_unlink
void g_node_unlink(GNode *node)
_GHook::next
GHook * next
Definition: glib.h:1148
GHookFunc
void(* GHookFunc)(gpointer data)
Definition: glib.h:781
g_log_default_handler
void g_log_default_handler(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data)
gint8
signed char gint8
Definition: glib.h:71
g_hook_unref
void g_hook_unref(GHookList *hook_list, GHook *hook)
g_node_max_height
guint g_node_max_height(GNode *root)
g_get_user_name
gchar * g_get_user_name(void)
g_node_last_child
GNode * g_node_last_child(GNode *node)
g_hash_table_new
GHashTable * g_hash_table_new(GHashFunc hash_func, GCompareFunc key_compare_func)
GDataForeachFunc
void(* GDataForeachFunc)(GQuark key_id, gpointer data, gpointer user_data)
Definition: glib.h:760
GMemChunk
struct _GMemChunk GMemChunk
Definition: glib.h:694
g_string_up
GString * g_string_up(GString *string)
pmidi_ptr_array_add
void pmidi_ptr_array_add(GPtrArray *array, gpointer data)
_GNode::data
gpointer data
Definition: glib.h:1027
GRelation
struct _GRelation GRelation
Definition: glib.h:697
g_tree_nnodes
gint g_tree_nnodes(GTree *tree)
g_node_depth
guint g_node_depth(GNode *node)
g_slist_foreach
void g_slist_foreach(GSList *list, GFunc func, gpointer user_data)
_GHook::hook_id
guint hook_id
Definition: glib.h:1151
_GTuples
Definition: glib.h:842
GAllocator
struct _GAllocator GAllocator
Definition: glib.h:683
g_string_prepend
GString * g_string_prepend(GString *string, const gchar *val)
g_hook_free
void g_hook_free(GHookList *hook_list, GHook *hook)
_GNode::next
GNode * next
Definition: glib.h:1028
g_basename
gchar * g_basename(const gchar *file_name)
gushort
unsigned short gushort
Definition: glib.h:473
g_list_nth_data
gpointer g_list_nth_data(GList *list, guint n)
_GArray
Definition: glib.h:824
glib_micro_version
GUTILS_C_VAR const guint glib_micro_version
Definition: glib.h:671
g_list_remove_link
GList * g_list_remove_link(GList *list, GList *llink)
_GHookList::hooks
GHook * hooks
Definition: glib.h:1139
GHookFreeFunc
void(* GHookFreeFunc)(GHookList *hook_list, GHook *hook)
Definition: glib.h:783
g_hash_table_foreach
void g_hash_table_foreach(GHashTable *hash_table, GHFunc func, gpointer user_data)
g_logv
void void g_logv(const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args)
_GByteArray
Definition: glib.h:830
GCacheDupFunc
gpointer(* GCacheDupFunc)(gpointer value)
Definition: glib.h:754
g_hash_table_lookup_extended
gboolean g_hash_table_lookup_extended(GHashTable *hash_table, gconstpointer lookup_key, gpointer *orig_key, gpointer *value)
_GDebugKey
Definition: glib.h:847
g_node_reverse_children
void g_node_reverse_children(GNode *node)
g_hook_find
GHook * g_hook_find(GHookList *hook_list, gboolean need_valids, GHookFindFunc func, gpointer data)
g_tree_remove
void g_tree_remove(GTree *tree, gpointer key)
g_string_chunk_insert_const
gchar * g_string_chunk_insert_const(GStringChunk *chunk, const gchar *string)
g_hook_destroy
gboolean g_hook_destroy(GHookList *hook_list, guint hook_id)
g_strdup_vprintf
gchar gchar * g_strdup_vprintf(const gchar *format, va_list args)
g_list_remove
GList * g_list_remove(GList *list, gpointer data)
g_array_prepend_vals
GArray * g_array_prepend_vals(GArray *array, gconstpointer data, guint len)
gulong
unsigned long gulong
Definition: glib.h:474
g_string_chunk_insert
gchar * g_string_chunk_insert(GStringChunk *chunk, const gchar *string)
g_strfreev
void g_strfreev(gchar **str_array)
g_list_length
guint g_list_length(GList *list)
g_tree_new
GTree * g_tree_new(GCompareFunc key_compare_func)
GCompareFunc
gint(* GCompareFunc)(gconstpointer a, gconstpointer b)
Definition: glib.h:756
g_hook_prepend
void g_hook_prepend(GHookList *hook_list, GHook *hook)
_GHook::data
gpointer data
Definition: glib.h:1147
gdouble
double gdouble
Definition: glib.h:478
_GList::data
gpointer data
Definition: glib.h:806
g_list_foreach
void g_list_foreach(GList *list, GFunc func, gpointer user_data)
g_node_push_allocator
void g_node_push_allocator(GAllocator *allocator)
_GHookList
Definition: glib.h:1135
GCompletion
struct _GCompletion GCompletion
Definition: glib.h:687
g_list_first
GList * g_list_first(GList *list)
GTime
gint32 GTime
Definition: glib.h:498
g_strsignal
gchar * g_strsignal(gint signum)
GHookFlagMask
GHookFlagMask
Definition: glib.h:1126
G_LOG_LEVEL_CRITICAL
@ G_LOG_LEVEL_CRITICAL
Definition: glib.h:740
g_string_chunk_new
GStringChunk * g_string_chunk_new(gint size)
GScannerMsgFunc
void(* GScannerMsgFunc)(GScanner *scanner, gchar *message, gint error)
Definition: glib.h:795
g_slist_copy
GSList * g_slist_copy(GSList *list)
G_PRE_ORDER
@ G_PRE_ORDER
Definition: glib.h:720
g_hook_list_marshal
void g_hook_list_marshal(GHookList *hook_list, gboolean may_recurse, GHookMarshaller marshaller, gpointer data)
g_slist_nth
GSList * g_slist_nth(GSList *list, guint n)
g_log_set_handler
guint g_log_set_handler(const gchar *log_domain, GLogLevelFlags log_levels, GLogFunc log_func, gpointer user_data)
g_array_remove_index
GArray * g_array_remove_index(GArray *array, guint index)
GLogLevelFlags
GLogLevelFlags
Definition: glib.h:733
g_hook_list_marshal_check
void g_hook_list_marshal_check(GHookList *hook_list, gboolean may_recurse, GHookCheckMarshaller marshaller, gpointer data)
g_strjoin
gchar * g_strjoin(const gchar *separator,...)
g_slist_concat
GSList * g_slist_concat(GSList *list1, GSList *list2)
g_hash_table_freeze
void g_hash_table_freeze(GHashTable *hash_table)
_GHookList::hook_memchunk
GMemChunk * hook_memchunk
Definition: glib.h:1140
g_strsplit
gchar ** g_strsplit(const gchar *string, const gchar *delimiter, gint max_tokens)
G_LOG_LEVEL_DEBUG
@ G_LOG_LEVEL_DEBUG
Definition: glib.h:744
g_slist_remove_link
GSList * g_slist_remove_link(GSList *list, GSList *llink)
g_slist_free
void g_slist_free(GSList *list)
pmidi_ptr_array_new
GPtrArray * pmidi_ptr_array_new(void)
g_slist_sort
GSList * g_slist_sort(GSList *list, GCompareFunc compare_func)
g_dirname
gchar * g_dirname(const gchar *file_name)
g_node_insert_before
GNode * g_node_insert_before(GNode *parent, GNode *sibling, GNode *node)
_GArray::len
guint len
Definition: glib.h:826
g_log_set_always_fatal
GLogLevelFlags g_log_set_always_fatal(GLogLevelFlags fatal_mask)
G_INLINE_FUNC
#define G_INLINE_FUNC
Definition: glib.h:215
g_strescape
gchar * g_strescape(gchar *string)
G_TRAVERSE_ALL
@ G_TRAVERSE_ALL
Definition: glib.h:713
pmidi_array_free
void pmidi_array_free(GArray *array, gboolean free_segment)
g_string_erase
GString * g_string_erase(GString *string, gint pos, gint len)
_GDebugKey::key
gchar * key
Definition: glib.h:848
GQuark
guint32 GQuark
Definition: glib.h:497
g_string_down
GString * g_string_down(GString *string)
g_slist_prepend
GSList * g_slist_prepend(GSList *list, gpointer data)
GData
struct _GData GData
Definition: glib.h:688
_GHook::flags
guint flags
Definition: glib.h:1152
gsize
guint32 gsize
Definition: glib.h:496
g_node_pop_allocator
void g_node_pop_allocator(void)
g_hash_table_insert
void g_hash_table_insert(GHashTable *hash_table, gpointer key, gpointer value)
g_mem_check
void g_mem_check(gpointer mem)
g_node_insert
GNode * g_node_insert(GNode *parent, gint position, GNode *node)
G_LOG_LEVEL_MASK
@ G_LOG_LEVEL_MASK
Definition: glib.h:746
GNodeTraverseFunc
gboolean(* GNodeTraverseFunc)(GNode *node, gpointer data)
Definition: glib.h:789
g_hook_find_func
GHook * g_hook_find_func(GHookList *hook_list, gboolean need_valids, gpointer func)
GTraverseFunc
gint(* GTraverseFunc)(gpointer key, gpointer value, gpointer data)
Definition: glib.h:798
g_hook_alloc
GHook * g_hook_alloc(GHookList *hook_list)
_GHook
Definition: glib.h:1146
g_cache_value_foreach
void g_cache_value_foreach(GCache *cache, GHFunc func, gpointer user_data)
g_ptr_array_remove
gboolean g_ptr_array_remove(GPtrArray *array, gpointer data)
_GPtrArray::len
guint len
Definition: glib.h:838
g_list_free_1
void g_list_free_1(GList *list)
g_hook_insert_before
void g_hook_insert_before(GHookList *hook_list, GHook *sibling, GHook *hook)
g_string_insert
GString * g_string_insert(GString *string, gint pos, const gchar *val)
g_slist_find
GSList * g_slist_find(GSList *list, gpointer data)
GTimer
struct _GTimer GTimer
Definition: glib.h:703
g_hook_insert_sorted
void g_hook_insert_sorted(GHookList *hook_list, GHook *hook, GHookCompareFunc func)
GVoidFunc
void(* GVoidFunc)(void)
Definition: glib.h:801
g_ptr_array_remove_index
gpointer g_ptr_array_remove_index(GPtrArray *array, guint index)
guint
unsigned int guint
Definition: glib.h:475
g_node_new
GNode * g_node_new(gpointer data)
g_get_current_dir
gchar * g_get_current_dir(void)
g_node_child_index
gint g_node_child_index(GNode *node, gpointer data)
g_node_destroy
void g_node_destroy(GNode *root)
GCache
struct _GCache GCache
Definition: glib.h:686
G_LEVEL_ORDER
@ G_LEVEL_ORDER
Definition: glib.h:722
g_list_copy
GList * g_list_copy(GList *list)
GScannerConfig
struct _GScannerConfig GScannerConfig
Definition: glib.h:699
g_string_prepend_c
GString * g_string_prepend_c(GString *string, gchar c)
g_list_free
void g_list_free(GList *list)
g_node_last_sibling
GNode * g_node_last_sibling(GNode *node)
g_slist_pop_allocator
void g_slist_pop_allocator(void)
g_string_sprintf
void g_string_sprintf(GString *string, const gchar *format,...) G_GNUC_PRINTF(2
gshort
short gshort
Definition: glib.h:467
g_ptr_array_remove_fast
gboolean g_ptr_array_remove_fast(GPtrArray *array, gpointer data)
g_node_n_nodes
guint g_node_n_nodes(GNode *root, GTraverseFlags flags)
g_list_position
gint g_list_position(GList *list, GList *llink)
G_TRAVERSE_MASK
@ G_TRAVERSE_MASK
Definition: glib.h:714
G_LOG_FLAG_FATAL
@ G_LOG_FLAG_FATAL
Definition: glib.h:736
GHookCompareFunc
gint(* GHookCompareFunc)(GHook *new_hook, GHook *sibling)
Definition: glib.h:773
_GDebugKey::value
guint value
Definition: glib.h:849
G_TRAVERSE_NON_LEAFS
@ G_TRAVERSE_NON_LEAFS
Definition: glib.h:712
g_node_prepend
GNode * g_node_prepend(GNode *parent, GNode *node)
g_byte_array_set_size
GByteArray * g_byte_array_set_size(GByteArray *array, guint length)
g_list_reverse
GList * g_list_reverse(GList *list)
g_atexit
void g_atexit(GVoidFunc func)
g_bit_nth_lsf
G_INLINE_FUNC gint g_bit_nth_lsf(guint32 mask, gint nth_bit)
g_vsnprintf
gint gint g_vsnprintf(gchar *string, gulong n, gchar const *format, va_list args)
g_hook_find_data
GHook * g_hook_find_data(GHookList *hook_list, gboolean need_valids, gpointer data)
g_on_error_query
void g_on_error_query(const gchar *prg_name)
gchar
char gchar
Definition: glib.h:466
g_strchug
gchar * g_strchug(gchar *string)
gint32
signed int gint32
Definition: glib.h:75
g_hook_list_clear
void g_hook_list_clear(GHookList *hook_list)
g_hash_table_foreach_remove
guint g_hash_table_foreach_remove(GHashTable *hash_table, GHRFunc func, gpointer user_data)
g_string_free
void g_string_free(GString *string, gint free_segment)
g_byte_array_remove_index
GByteArray * g_byte_array_remove_index(GByteArray *array, guint index)
g_node_traverse
void g_node_traverse(GNode *root, GTraverseType order, GTraverseFlags flags, gint max_depth, GNodeTraverseFunc func, gpointer data)
g_node_children_foreach
void g_node_children_foreach(GNode *node, GTraverseFlags flags, GNodeForeachFunc func, gpointer data)
g_bit_nth_msf
G_INLINE_FUNC gint g_bit_nth_msf(guint32 mask, gint nth_bit)
G_LOG_LEVEL_MESSAGE
@ G_LOG_LEVEL_MESSAGE
Definition: glib.h:742
g_bit_storage
G_INLINE_FUNC guint g_bit_storage(guint number)
g_slist_nth_data
gpointer g_slist_nth_data(GSList *list, guint n)
GUTILS_C_VAR
#define GUTILS_C_VAR
Definition: glib.h:666
glib_minor_version
GUTILS_C_VAR const guint glib_minor_version
Definition: glib.h:670
glong
long glong
Definition: glib.h:468
g_hook_first_valid
GHook * g_hook_first_valid(GHookList *hook_list, gboolean may_be_in_call)
gint16
signed short gint16
Definition: glib.h:73
g_set_prgname
void g_set_prgname(const gchar *prgname)
_GHookList::hook_destroy
GHookFreeFunc hook_destroy
Definition: glib.h:1142
g_string_append_c
GString * g_string_append_c(GString *string, gchar c)
_GArray::data
gchar * data
Definition: glib.h:825
g_path_is_absolute
gboolean g_path_is_absolute(const gchar *file_name)
g_slist_free_1
void g_slist_free_1(GSList *list)
G_LOG_LEVEL_WARNING
@ G_LOG_LEVEL_WARNING
Definition: glib.h:741
g_string_append
GString * g_string_append(GString *string, const gchar *val)
g_slist_insert
GSList * g_slist_insert(GSList *list, gpointer data, gint position)
g_slist_append
GSList * g_slist_append(GSList *list, gpointer data)
g_slist_alloc
GSList * g_slist_alloc(void)
G_POST_ORDER
@ G_POST_ORDER
Definition: glib.h:721
g_hook_next_valid
GHook * g_hook_next_valid(GHookList *hook_list, GHook *hook, gboolean may_be_in_call)
g_tree_lookup
gpointer g_tree_lookup(GTree *tree, gpointer key)
_GString
Definition: glib.h:818
GDestroyNotify
void(* GDestroyNotify)(gpointer data)
Definition: glib.h:759
GFreeFunc
void(* GFreeFunc)(gpointer data)
Definition: glib.h:766
pmidi_array_new
GArray * pmidi_array_new(gboolean zero_terminated, gboolean clear, guint element_size)
g_printf_string_upper_bound
guint g_printf_string_upper_bound(const gchar *format, va_list args)
g_slist_push_allocator
void g_slist_push_allocator(GAllocator *allocator)
gssize
gint32 gssize
Definition: glib.h:495
G_LOG_LEVEL_INFO
@ G_LOG_LEVEL_INFO
Definition: glib.h:743
pmidi_array_append_vals
GArray * pmidi_array_append_vals(GArray *array, gconstpointer data, guint len)
g_strup
void g_strup(gchar *string)
g_tree_traverse
void g_tree_traverse(GTree *tree, GTraverseFunc traverse_func, GTraverseType traverse_type, gpointer data)
g_list_find
GList * g_list_find(GList *list, gpointer data)
g_node_n_children
guint g_node_n_children(GNode *node)
gfloat
float gfloat
Definition: glib.h:477
g_on_error_stack_trace
void g_on_error_stack_trace(const gchar *prg_name)
g_node_get_root
GNode * g_node_get_root(GNode *node)
GHashTable
struct _GHashTable GHashTable
Definition: glib.h:690
_GList::prev
GList * prev
Definition: glib.h:808
_GSList::data
gpointer data
Definition: glib.h:813
g_string_insert_c
GString * g_string_insert_c(GString *string, gint pos, gchar c)
_GList
Definition: glib.h:805
GScanner
struct _GScanner GScanner
Definition: glib.h:698
GCacheNewFunc
gpointer(* GCacheNewFunc)(gpointer key)
Definition: glib.h:753
g_log
void g_log(const gchar *log_domain, GLogLevelFlags log_level, const gchar *format,...) G_GNUC_PRINTF(3
_GHookList::seq_id
guint seq_id
Definition: glib.h:1136
_GHookList::hook_free
GHookFreeFunc hook_free
Definition: glib.h:1141
_GHookList::hook_size
guint hook_size
Definition: glib.h:1137
G_LOG_LEVEL_ERROR
@ G_LOG_LEVEL_ERROR
Definition: glib.h:739
const
#define const
Definition: zconf.h:124
g_getenv
gchar * g_getenv(const gchar *variable)
GTree
struct _GTree GTree
Definition: glib.h:704