giscanner: fix DocBlock().comment
[platform/upstream/gobject-introspection.git] / gir / glib-2.0.c
1 /************************************************************/
2 /* THIS FILE IS GENERATED DO NOT EDIT */
3 /************************************************************/
4
5 /**
6  * ABS:
7  * @a: a numeric value
8  *
9  * Calculates the absolute value of @a.
10  * The absolute value is simply the number with any negative sign taken away.
11  *
12  * For example,
13  * - ABS(-10) is 10.
14  * - ABS(10) is also 10.
15  *
16  * Returns: the absolute value of @a.
17  */
18
19
20 /**
21  * CLAMP:
22  * @x: the value to clamp
23  * @low: the minimum value allowed
24  * @high: the maximum value allowed
25  *
26  * Ensures that @x is between the limits set by @low and @high. If @low is
27  * greater than @high the result is undefined.
28  *
29  * For example,
30  * - CLAMP(5, 10, 15) is 10.
31  * - CLAMP(15, 5, 10) is 10.
32  * - CLAMP(20, 15, 25) is 20.
33  *
34  * Returns: the value of @x clamped to the range between @low and @high
35  */
36
37
38 /**
39  * C_:
40  * @Context: a message context, must be a string literal
41  * @String: a message id, must be a string literal
42  *
43  * Uses gettext to get the translation for @String. @Context is
44  * used as a context. This is mainly useful for short strings which
45  * may need different translations, depending on the context in which
46  * they are used.
47  * |[
48  * label1 = C_("Navigation", "Back");
49  * label2 = C_("Body part", "Back");
50  * ]|
51  *
52  * <note><para>If you are using the C_() macro, you need to make sure
53  * that you pass <option>--keyword=C_:1c,2</option> to xgettext when
54  * extracting messages. Note that this only works with GNU
55  * gettext >= 0.15.</para></note>
56  *
57  * Returns: the translated message
58  * Since: 2.16
59  */
60
61
62 /**
63  * FALSE:
64  *
65  * Defines the %FALSE value for the #gboolean type.
66  */
67
68
69 /**
70  * GArray:
71  * @data: a pointer to the element data. The data may be moved as elements are added to the #GArray.
72  * @len: the number of elements in the #GArray not including the possible terminating zero element.
73  *
74  * Contains the public fields of an <link linkend="glib-Arrays">Array</link>.
75  */
76
77
78 /**
79  * GAsyncQueue:
80  *
81  * The GAsyncQueue struct is an opaque data structure which represents
82  * an asynchronous queue. It should only be accessed through the
83  * <function>g_async_queue_*</function> functions.
84  */
85
86
87 /**
88  * GByteArray:
89  * @data: a pointer to the element data. The data may be moved as elements are added to the #GByteArray.
90  * @len: the number of elements in the #GByteArray.
91  *
92  * The <structname>GByteArray</structname> struct allows access to the
93  * public fields of a <structname>GByteArray</structname>.
94  */
95
96
97 /**
98  * GBytes:
99  *
100  * A simple refcounted data type representing an immutable byte sequence
101  * from an unspecified origin.
102  *
103  * The purpose of a #GBytes is to keep the memory region that it holds
104  * alive for as long as anyone holds a reference to the bytes.  When
105  * the last reference count is dropped, the memory is released. Multiple
106  * unrelated callers can use byte data in the #GBytes without coordinating
107  * their activities, resting assured that the byte data will not change or
108  * move while they hold a reference.
109  *
110  * A #GBytes can come from many different origins that may have
111  * different procedures for freeing the memory region.  Examples are
112  * memory from g_malloc(), from memory slices, from a #GMappedFile or
113  * memory from other allocators.
114  *
115  * #GBytes work well as keys in #GHashTable. Use g_bytes_equal() and
116  * g_bytes_hash() as parameters to g_hash_table_new() or g_hash_table_new_full().
117  * #GBytes can also be used as keys in a #GTree by passing the g_bytes_compare()
118  * function to g_tree_new().
119  *
120  * The data pointed to by this bytes must not be modified. For a mutable
121  * array of bytes see #GByteArray. Use g_bytes_unref_to_array() to create a
122  * mutable array for a #GBytes sequence. To create an immutable #GBytes from
123  * a mutable #GByteArray, use the g_byte_array_free_to_bytes() function.
124  *
125  * Since: 2.32
126  */
127
128
129 /**
130  * GCompareDataFunc:
131  * @a: a value.
132  * @b: a value to compare with.
133  * @user_data: user data to pass to comparison function.
134  *
135  * Specifies the type of a comparison function used to compare two
136  * values.  The function should return a negative integer if the first
137  * value comes before the second, 0 if they are equal, or a positive
138  * integer if the first value comes after the second.
139  *
140  * Returns: negative value if @a &lt; @b; zero if @a = @b; positive value if @a > @b.
141  */
142
143
144 /**
145  * GCompareFunc:
146  * @a: a value.
147  * @b: a value to compare with.
148  *
149  * Specifies the type of a comparison function used to compare two
150  * values.  The function should return a negative integer if the first
151  * value comes before the second, 0 if they are equal, or a positive
152  * integer if the first value comes after the second.
153  *
154  * Returns: negative value if @a &lt; @b; zero if @a = @b; positive value if @a > @b.
155  */
156
157
158 /**
159  * GCond:
160  *
161  * The #GCond struct is an opaque data structure that represents a
162  * condition. Threads can block on a #GCond if they find a certain
163  * condition to be false. If other threads change the state of this
164  * condition they signal the #GCond, and that causes the waiting
165  * threads to be woken up.
166  *
167  * Consider the following example of a shared variable.  One or more
168  * threads can wait for data to be published to the variable and when
169  * another thread publishes the data, it can signal one of the waiting
170  * threads to wake up to collect the data.
171  *
172  * <example>
173  *  <title>
174  *   Using GCond to block a thread until a condition is satisfied
175  *  </title>
176  *  <programlisting>
177  *   gpointer current_data = NULL;
178  *   GMutex data_mutex;
179  *   GCond data_cond;
180  *
181  *   void
182  *   push_data (gpointer data)
183  *   {
184  *     g_mutex_lock (&data_mutex);
185  *     current_data = data;
186  *     g_cond_signal (&data_cond);
187  *     g_mutex_unlock (&data_mutex);
188  *   }
189  *
190  *   gpointer
191  *   pop_data (void)
192  *   {
193  *     gpointer data;
194  *
195  *     g_mutex_lock (&data_mutex);
196  *     while (!current_data)
197  *       g_cond_wait (&data_cond, &data_mutex);
198  *     data = current_data;
199  *     current_data = NULL;
200  *     g_mutex_unlock (&data_mutex);
201  *
202  *     return data;
203  *   }
204  *  </programlisting>
205  * </example>
206  *
207  * Whenever a thread calls pop_data() now, it will wait until
208  * current_data is non-%NULL, i.e. until some other thread
209  * has called push_data().
210  *
211  * The example shows that use of a condition variable must always be
212  * paired with a mutex.  Without the use of a mutex, there would be a
213  * race between the check of <varname>current_data</varname> by the
214  * while loop in <function>pop_data</function> and waiting.
215  * Specifically, another thread could set <varname>pop_data</varname>
216  * after the check, and signal the cond (with nobody waiting on it)
217  * before the first thread goes to sleep.  #GCond is specifically useful
218  * for its ability to release the mutex and go to sleep atomically.
219  *
220  * It is also important to use the g_cond_wait() and g_cond_wait_until()
221  * functions only inside a loop which checks for the condition to be
222  * true.  See g_cond_wait() for an explanation of why the condition may
223  * not be true even after it returns.
224  *
225  * If a #GCond is allocated in static storage then it can be used
226  * without initialisation.  Otherwise, you should call g_cond_init() on
227  * it and g_cond_clear() when done.
228  *
229  * A #GCond should only be accessed via the <function>g_cond_</function>
230  * functions.
231  */
232
233
234 /**
235  * GData:
236  *
237  * The #GData struct is an opaque data structure to represent a <link
238  * linkend="glib-Keyed-Data-Lists">Keyed Data List</link>. It should
239  * only be accessed via the following functions.
240  */
241
242
243 /**
244  * GDataForeachFunc:
245  * @key_id: the #GQuark id to identifying the data element.
246  * @data: the data element.
247  * @user_data: user data passed to g_dataset_foreach().
248  *
249  * Specifies the type of function passed to g_dataset_foreach(). It is
250  * called with each #GQuark id and associated data element, together
251  * with the @user_data parameter supplied to g_dataset_foreach().
252  */
253
254
255 /**
256  * GDate:
257  * @julian_days: the Julian representation of the date
258  * @julian: this bit is set if @julian_days is valid
259  * @dmy: this is set if @day, @month and @year are valid
260  * @day: the day of the day-month-year representation of the date, as a number between 1 and 31
261  * @month: the day of the day-month-year representation of the date, as a number between 1 and 12
262  * @year: the day of the day-month-year representation of the date
263  *
264  * Represents a day between January 1, Year 1 and a few thousand years in
265  * the future. None of its members should be accessed directly. If the
266  * <structname>GDate</structname> is obtained from g_date_new(), it will
267  * be safe to mutate but invalid and thus not safe for calendrical
268  * computations. If it's declared on the stack, it will contain garbage
269  * so must be initialized with g_date_clear(). g_date_clear() makes the
270  * date invalid but sane. An invalid date doesn't represent a day, it's
271  * "empty." A date becomes valid after you set it to a Julian day or you
272  * set a day, month, and year.
273  */
274
275
276 /**
277  * GDateDMY:
278  * @G_DATE_DAY: a day
279  * @G_DATE_MONTH: a month
280  * @G_DATE_YEAR: a year
281  *
282  * This enumeration isn't used in the API, but may be useful if you need
283  * to mark a number as a day, month, or year.
284  */
285
286
287 /**
288  * GDateDay:
289  *
290  * Integer representing a day of the month; between 1 and
291  * 31. #G_DATE_BAD_DAY represents an invalid day of the month.
292  */
293
294
295 /**
296  * GDateMonth:
297  * @G_DATE_BAD_MONTH: invalid value
298  * @G_DATE_JANUARY: January
299  * @G_DATE_FEBRUARY: February
300  * @G_DATE_MARCH: March
301  * @G_DATE_APRIL: April
302  * @G_DATE_MAY: May
303  * @G_DATE_JUNE: June
304  * @G_DATE_JULY: July
305  * @G_DATE_AUGUST: August
306  * @G_DATE_SEPTEMBER: September
307  * @G_DATE_OCTOBER: October
308  * @G_DATE_NOVEMBER: November
309  * @G_DATE_DECEMBER: December
310  *
311  * Enumeration representing a month; values are #G_DATE_JANUARY,
312  * #G_DATE_FEBRUARY, etc. #G_DATE_BAD_MONTH is the invalid value.
313  */
314
315
316 /**
317  * GDateWeekday:
318  * @G_DATE_BAD_WEEKDAY: invalid value
319  * @G_DATE_MONDAY: Monday
320  * @G_DATE_TUESDAY: Tuesday
321  * @G_DATE_WEDNESDAY: Wednesday
322  * @G_DATE_THURSDAY: Thursday
323  * @G_DATE_FRIDAY: Friday
324  * @G_DATE_SATURDAY: Saturday
325  * @G_DATE_SUNDAY: Sunday
326  *
327  * Enumeration representing a day of the week; #G_DATE_MONDAY,
328  * #G_DATE_TUESDAY, etc. #G_DATE_BAD_WEEKDAY is an invalid weekday.
329  */
330
331
332 /**
333  * GDateYear:
334  *
335  * Integer representing a year; #G_DATE_BAD_YEAR is the invalid
336  * value. The year must be 1 or higher; negative (BC) years are not
337  * allowed. The year is represented with four digits.
338  */
339
340
341 /**
342  * GDestroyNotify:
343  * @data: the data element.
344  *
345  * Specifies the type of function which is called when a data element
346  * is destroyed. It is passed the pointer to the data element and
347  * should free any memory and resources allocated for it.
348  */
349
350
351 /**
352  * GDir:
353  *
354  * An opaque structure representing an opened directory.
355  */
356
357
358 /**
359  * GDoubleIEEE754:
360  * @v_double: the double value
361  *
362  * The #GFloatIEEE754 and #GDoubleIEEE754 unions are used to access the sign,
363  * mantissa and exponent of IEEE floats and doubles. These unions are defined
364  * as appropriate for a given platform. IEEE floats and doubles are supported
365  * (used for storage) by at least Intel, PPC and Sparc.
366  */
367
368
369 /**
370  * GDuplicateFunc:
371  * @data: the data to duplicate
372  * @user_data: user data that was specified in g_datalist_id_dup_data()
373  *
374  * The type of functions that are used to 'duplicate' an object.
375  * What this means depends on the context, it could just be
376  * incrementing the reference count, if @data is a ref-counted
377  * object.
378  *
379  * Returns: a duplicate of data
380  */
381
382
383 /**
384  * GEqualFunc:
385  * @a: a value
386  * @b: a value to compare with
387  *
388  * Specifies the type of a function used to test two values for
389  * equality. The function should return %TRUE if both values are equal
390  * and %FALSE otherwise.
391  *
392  * Returns: %TRUE if @a = @b; %FALSE otherwise
393  */
394
395
396 /**
397  * GErrorType:
398  * @G_ERR_UNKNOWN: unknown error
399  * @G_ERR_UNEXP_EOF: unexpected end of file
400  * @G_ERR_UNEXP_EOF_IN_STRING: unterminated string constant
401  * @G_ERR_UNEXP_EOF_IN_COMMENT: unterminated comment
402  * @G_ERR_NON_DIGIT_IN_CONST: non-digit character in a number
403  * @G_ERR_DIGIT_RADIX: digit beyond radix in a number
404  * @G_ERR_FLOAT_RADIX: non-decimal floating point number
405  * @G_ERR_FLOAT_MALFORMED: malformed floating point number
406  *
407  * The possible errors, used in the @v_error field
408  * of #GTokenValue, when the token is a %G_TOKEN_ERROR.
409  */
410
411
412 /**
413  * GFileError:
414  * @G_FILE_ERROR_EXIST: Operation not permitted; only the owner of the file (or other resource) or processes with special privileges can perform the operation.
415  * @G_FILE_ERROR_ISDIR: File is a directory; you cannot open a directory for writing, or create or remove hard links to it.
416  * @G_FILE_ERROR_ACCES: Permission denied; the file permissions do not allow the attempted operation.
417  * @G_FILE_ERROR_NAMETOOLONG: Filename too long.
418  * @G_FILE_ERROR_NOENT: No such file or directory. This is a "file doesn't exist" error for ordinary files that are referenced in contexts where they are expected to already exist.
419  * @G_FILE_ERROR_NOTDIR: A file that isn't a directory was specified when a directory is required.
420  * @G_FILE_ERROR_NXIO: No such device or address. The system tried to use the device represented by a file you specified, and it couldn't find the device. This can mean that the device file was installed incorrectly, or that the physical device is missing or not correctly attached to the computer.
421  * @G_FILE_ERROR_NODEV: The underlying file system of the specified file does not support memory mapping.
422  * @G_FILE_ERROR_ROFS: The directory containing the new link can't be modified because it's on a read-only file system.
423  * @G_FILE_ERROR_TXTBSY: Text file busy.
424  * @G_FILE_ERROR_FAULT: You passed in a pointer to bad memory. (GLib won't reliably return this, don't pass in pointers to bad memory.)
425  * @G_FILE_ERROR_LOOP: Too many levels of symbolic links were encountered in looking up a file name. This often indicates a cycle of symbolic links.
426  * @G_FILE_ERROR_NOSPC: No space left on device; write operation on a file failed because the disk is full.
427  * @G_FILE_ERROR_NOMEM: No memory available. The system cannot allocate more virtual memory because its capacity is full.
428  * @G_FILE_ERROR_MFILE: The current process has too many files open and can't open any more. Duplicate descriptors do count toward this limit.
429  * @G_FILE_ERROR_NFILE: There are too many distinct file openings in the entire system.
430  * @G_FILE_ERROR_BADF: Bad file descriptor; for example, I/O on a descriptor that has been closed or reading from a descriptor open only for writing (or vice versa).
431  * @G_FILE_ERROR_INVAL: Invalid argument. This is used to indicate various kinds of problems with passing the wrong argument to a library function.
432  * @G_FILE_ERROR_PIPE: Broken pipe; there is no process reading from the other end of a pipe. Every library function that returns this error code also generates a `SIGPIPE' signal; this signal terminates the program if not handled or blocked. Thus, your program will never actually see this code unless it has handled or blocked `SIGPIPE'.
433  * @G_FILE_ERROR_AGAIN: Resource temporarily unavailable; the call might work if you try again later.
434  * @G_FILE_ERROR_INTR: Interrupted function call; an asynchronous signal occurred and prevented completion of the call. When this happens, you should try the call again.
435  * @G_FILE_ERROR_IO: Input/output error; usually used for physical read or write errors. i.e. the disk or other physical device hardware is returning errors.
436  * @G_FILE_ERROR_PERM: Operation not permitted; only the owner of the file (or other resource) or processes with special privileges can perform the operation.
437  * @G_FILE_ERROR_NOSYS: Function not implemented; this indicates that the system is missing some functionality.
438  * @G_FILE_ERROR_FAILED: Does not correspond to a UNIX error code; this is the standard "failed for unspecified reason" error code present in all #GError error code enumerations. Returned if no specific code applies.
439  *
440  * Values corresponding to @errno codes returned from file operations
441  * on UNIX. Unlike @errno codes, GFileError values are available on
442  * all systems, even Windows. The exact meaning of each code depends
443  * on what sort of file operation you were performing; the UNIX
444  * documentation gives more details. The following error code descriptions
445  * come from the GNU C Library manual, and are under the copyright
446  * of that manual.
447  *
448  * It's not very portable to make detailed assumptions about exactly
449  * which errors will be returned from a given operation. Some errors
450  * don't occur on some systems, etc., sometimes there are subtle
451  * differences in when a system will report a given error, etc.
452  */
453
454
455 /**
456  * GFileTest:
457  * @G_FILE_TEST_IS_REGULAR: %TRUE if the file is a regular file (not a directory). Note that this test will also return %TRUE if the tested file is a symlink to a regular file.
458  * @G_FILE_TEST_IS_SYMLINK: %TRUE if the file is a symlink.
459  * @G_FILE_TEST_IS_DIR: %TRUE if the file is a directory.
460  * @G_FILE_TEST_IS_EXECUTABLE: %TRUE if the file is executable.
461  * @G_FILE_TEST_EXISTS: %TRUE if the file exists. It may or may not be a regular file.
462  *
463  * A test to perform on a file using g_file_test().
464  */
465
466
467 /**
468  * GFloatIEEE754:
469  * @v_float: the double value
470  *
471  * The #GFloatIEEE754 and #GDoubleIEEE754 unions are used to access the sign,
472  * mantissa and exponent of IEEE floats and doubles. These unions are defined
473  * as appropriate for a given platform. IEEE floats and doubles are supported
474  * (used for storage) by at least Intel, PPC and Sparc.
475  */
476
477
478 /**
479  * GFormatSizeFlags:
480  * @G_FORMAT_SIZE_DEFAULT: behave the same as g_format_size()
481  * @G_FORMAT_SIZE_LONG_FORMAT: include the exact number of bytes as part of the returned string.  For example, "45.6 kB (45,612 bytes)".
482  * @G_FORMAT_SIZE_IEC_UNITS: use IEC (base 1024) units with "KiB"-style suffixes. IEC units should only be used for reporting things with a strong "power of 2" basis, like RAM sizes or RAID stripe sizes. Network and storage sizes should be reported in the normal SI units.
483  *
484  * Flags to modify the format of the string returned by g_format_size_full().
485  */
486
487
488 /**
489  * GFunc:
490  * @data: the element's data.
491  * @user_data: user data passed to g_list_foreach() or g_slist_foreach().
492  *
493  * Specifies the type of functions passed to g_list_foreach() and
494  * g_slist_foreach().
495  */
496
497
498 /**
499  * GHFunc:
500  * @key: a key
501  * @value: the value corresponding to the key
502  * @user_data: user data passed to g_hash_table_foreach()
503  *
504  * Specifies the type of the function passed to g_hash_table_foreach().
505  * It is called with each key/value pair, together with the @user_data
506  * parameter which is passed to g_hash_table_foreach().
507  */
508
509
510 /**
511  * GHRFunc:
512  * @key: a key
513  * @value: the value associated with the key
514  * @user_data: user data passed to g_hash_table_remove()
515  *
516  * Specifies the type of the function passed to
517  * g_hash_table_foreach_remove(). It is called with each key/value
518  * pair, together with the @user_data parameter passed to
519  * g_hash_table_foreach_remove(). It should return %TRUE if the
520  * key/value pair should be removed from the #GHashTable.
521  *
522  * Returns: %TRUE if the key/value pair should be removed from the #GHashTable
523  */
524
525
526 /**
527  * GHashFunc:
528  * @key: a key
529  *
530  * Specifies the type of the hash function which is passed to
531  * g_hash_table_new() when a #GHashTable is created.
532  *
533  * The function is passed a key and should return a #guint hash value.
534  * The functions g_direct_hash(), g_int_hash() and g_str_hash() provide
535  * hash functions which can be used when the key is a #gpointer, #gint*,
536  * and #gchar* respectively.
537  *
538  * g_direct_hash() is also the appropriate hash function for keys
539  * of the form <literal>GINT_TO_POINTER (n)</literal> (or similar macros).
540  *
541  * <!-- FIXME: Need more here. --> A good hash functions should produce
542  * hash values that are evenly distributed over a fairly large range.
543  * The modulus is taken with the hash table size (a prime number) to
544  * find the 'bucket' to place each key into. The function should also
545  * be very fast, since it is called for each key lookup.
546  *
547  * Note that the hash functions provided by GLib have these qualities,
548  * but are not particularly robust against manufactured keys that
549  * cause hash collisions. Therefore, you should consider choosing
550  * a more secure hash function when using a GHashTable with keys
551  * that originate in untrusted data (such as HTTP requests).
552  * Using g_str_hash() in that situation might make your application
553  * vulerable to <ulink url="https://lwn.net/Articles/474912/">Algorithmic Complexity Attacks</ulink>.
554  *
555  * The key to choosing a good hash is unpredictability.  Even
556  * cryptographic hashes are very easy to find collisions for when the
557  * remainder is taken modulo a somewhat predictable prime number.  There
558  * must be an element of randomness that an attacker is unable to guess.
559  *
560  * Returns: the hash value corresponding to the key
561  */
562
563
564 /**
565  * GHashTable:
566  *
567  * The #GHashTable struct is an opaque data structure to represent a
568  * <link linkend="glib-Hash-Tables">Hash Table</link>. It should only be
569  * accessed via the following functions.
570  */
571
572
573 /**
574  * GHashTableIter:
575  *
576  * A GHashTableIter structure represents an iterator that can be used
577  * to iterate over the elements of a #GHashTable. GHashTableIter
578  * structures are typically allocated on the stack and then initialized
579  * with g_hash_table_iter_init().
580  */
581
582
583 /**
584  * GHook:
585  * @data: data which is passed to func when this hook is invoked
586  * @next: pointer to the next hook in the list
587  * @prev: pointer to the previous hook in the list
588  * @ref_count: the reference count of this hook
589  * @hook_id: the id of this hook, which is unique within its list
590  * @flags: flags which are set for this hook. See #GHookFlagMask for predefined flags
591  * @func: the function to call when this hook is invoked. The possible signatures for this function are #GHookFunc and #GHookCheckFunc
592  * @destroy: the default @finalize_hook function of a #GHookList calls this member of the hook that is being finalized
593  *
594  * The <structname>GHook</structname> struct represents a single hook
595  * function in a #GHookList.
596  */
597
598
599 /**
600  * GHookCheckFunc:
601  * @data: the data field of the #GHook is passed to the hook function here
602  *
603  * Defines the type of a hook function that can be invoked
604  * by g_hook_list_invoke_check().
605  *
606  * Returns: %FALSE if the #GHook should be destroyed
607  */
608
609
610 /**
611  * GHookCheckMarshaller:
612  * @hook: a #GHook
613  * @marshal_data: user data
614  *
615  * Defines the type of function used by g_hook_list_marshal_check().
616  *
617  * Returns: %FALSE if @hook should be destroyed
618  */
619
620
621 /**
622  * GHookCompareFunc:
623  * @new_hook: the #GHook being inserted
624  * @sibling: the #GHook to compare with @new_hook
625  *
626  * Defines the type of function used to compare #GHook elements in
627  * g_hook_insert_sorted().
628  *
629  * Returns: a value &lt;= 0 if @new_hook should be before @sibling
630  */
631
632
633 /**
634  * GHookFinalizeFunc:
635  * @hook_list: a #GHookList
636  * @hook: the hook in @hook_list that gets finalized
637  *
638  * Defines the type of function to be called when a hook in a
639  * list of hooks gets finalized.
640  */
641
642
643 /**
644  * GHookFindFunc:
645  * @hook: a #GHook
646  * @data: user data passed to g_hook_find_func()
647  *
648  * Defines the type of the function passed to g_hook_find().
649  *
650  * Returns: %TRUE if the required #GHook has been found
651  */
652
653
654 /**
655  * GHookFlagMask:
656  * @G_HOOK_FLAG_ACTIVE: set if the hook has not been destroyed
657  * @G_HOOK_FLAG_IN_CALL: set if the hook is currently being run
658  * @G_HOOK_FLAG_MASK: A mask covering all bits reserved for hook flags; see %G_HOOK_FLAG_USER_SHIFT
659  *
660  * Flags used internally in the #GHook implementation.
661  */
662
663
664 /**
665  * GHookFunc:
666  * @data: the data field of the #GHook is passed to the hook function here
667  *
668  * Defines the type of a hook function that can be invoked
669  * by g_hook_list_invoke().
670  */
671
672
673 /**
674  * GHookList:
675  * @seq_id: the next free #GHook id
676  * @hook_size: the size of the #GHookList elements, in bytes
677  * @is_setup: 1 if the #GHookList has been initialized
678  * @hooks: the first #GHook element in the list
679  * @dummy3: unused
680  * @finalize_hook: the function to call to finalize a #GHook element. The default behaviour is to call the hooks @destroy function
681  * @dummy: unused
682  *
683  * The <structname>GHookList</structname> struct represents a
684  * list of hook functions.
685  */
686
687
688 /**
689  * GHookMarshaller:
690  * @hook: a #GHook
691  * @marshal_data: user data
692  *
693  * Defines the type of function used by g_hook_list_marshal().
694  */
695
696
697 /**
698  * GINT16_FROM_BE:
699  * @val: a #gint16 value in big-endian byte order
700  *
701  * Converts a #gint16 value from big-endian to host byte order.
702  *
703  * Returns: @val converted to host byte order
704  */
705
706
707 /**
708  * GINT16_FROM_LE:
709  * @val: a #gint16 value in little-endian byte order
710  *
711  * Converts a #gint16 value from little-endian to host byte order.
712  *
713  * Returns: @val converted to host byte order
714  */
715
716
717 /**
718  * GINT16_TO_BE:
719  * @val: a #gint16 value in host byte order
720  *
721  * Converts a #gint16 value from host byte order to big-endian.
722  *
723  * Returns: @val converted to big-endian
724  */
725
726
727 /**
728  * GINT16_TO_LE:
729  * @val: a #gint16 value in host byte order
730  *
731  * Converts a #gint16 value from host byte order to little-endian.
732  *
733  * Returns: @val converted to little-endian
734  */
735
736
737 /**
738  * GINT32_FROM_BE:
739  * @val: a #gint32 value in big-endian byte order
740  *
741  * Converts a #gint32 value from big-endian to host byte order.
742  *
743  * Returns: @val converted to host byte order
744  */
745
746
747 /**
748  * GINT32_FROM_LE:
749  * @val: a #gint32 value in little-endian byte order
750  *
751  * Converts a #gint32 value from little-endian to host byte order.
752  *
753  * Returns: @val converted to host byte order
754  */
755
756
757 /**
758  * GINT32_TO_BE:
759  * @val: a #gint32 value in host byte order
760  *
761  * Converts a #gint32 value from host byte order to big-endian.
762  *
763  * Returns: @val converted to big-endian
764  */
765
766
767 /**
768  * GINT32_TO_LE:
769  * @val: a #gint32 value in host byte order
770  *
771  * Converts a #gint32 value from host byte order to little-endian.
772  *
773  * Returns: @val converted to little-endian
774  */
775
776
777 /**
778  * GINT64_FROM_BE:
779  * @val: a #gint64 value in big-endian byte order
780  *
781  * Converts a #gint64 value from big-endian to host byte order.
782  *
783  * Returns: @val converted to host byte order
784  */
785
786
787 /**
788  * GINT64_FROM_LE:
789  * @val: a #gint64 value in little-endian byte order
790  *
791  * Converts a #gint64 value from little-endian to host byte order.
792  *
793  * Returns: @val converted to host byte order
794  */
795
796
797 /**
798  * GINT64_TO_BE:
799  * @val: a #gint64 value in host byte order
800  *
801  * Converts a #gint64 value from host byte order to big-endian.
802  *
803  * Returns: @val converted to big-endian
804  */
805
806
807 /**
808  * GINT64_TO_LE:
809  * @val: a #gint64 value in host byte order
810  *
811  * Converts a #gint64 value from host byte order to little-endian.
812  *
813  * Returns: @val converted to little-endian
814  */
815
816
817 /**
818  * GINT_FROM_BE:
819  * @val: a #gint value in big-endian byte order
820  *
821  * Converts a #gint value from big-endian to host byte order.
822  *
823  * Returns: @val converted to host byte order
824  */
825
826
827 /**
828  * GINT_FROM_LE:
829  * @val: a #gint value in little-endian byte order
830  *
831  * Converts a #gint value from little-endian to host byte order.
832  *
833  * Returns: @val converted to host byte order
834  */
835
836
837 /**
838  * GINT_TO_BE:
839  * @val: a #gint value in host byte order
840  *
841  * Converts a #gint value from host byte order to big-endian.
842  *
843  * Returns: @val converted to big-endian byte order
844  */
845
846
847 /**
848  * GINT_TO_LE:
849  * @val: a #gint value in host byte order
850  *
851  * Converts a #gint value from host byte order to little-endian.
852  *
853  * Returns: @val converted to little-endian byte order
854  */
855
856
857 /**
858  * GINT_TO_POINTER:
859  * @i: integer to stuff into a pointer
860  *
861  * Stuffs an integer into a pointer type.
862  *
863  * Remember, you may not store pointers in integers. This is not portable
864  * in any way, shape or form. These macros <emphasis>only</emphasis> allow
865  * storing integers in pointers, and only preserve 32 bits of the
866  * integer; values outside the range of a 32-bit integer will be mangled.
867  */
868
869
870 /**
871  * GIOChannel:
872  *
873  * A data structure representing an IO Channel. The fields should be
874  * considered private and should only be accessed with the following
875  * functions.
876  */
877
878
879 /**
880  * GIOChannelError:
881  * @G_IO_CHANNEL_ERROR_FBIG: File too large.
882  * @G_IO_CHANNEL_ERROR_INVAL: Invalid argument.
883  * @G_IO_CHANNEL_ERROR_IO: IO error.
884  * @G_IO_CHANNEL_ERROR_ISDIR: File is a directory.
885  * @G_IO_CHANNEL_ERROR_NOSPC: No space left on device.
886  * @G_IO_CHANNEL_ERROR_NXIO: No such device or address.
887  * @G_IO_CHANNEL_ERROR_OVERFLOW: Value too large for defined datatype.
888  * @G_IO_CHANNEL_ERROR_PIPE: Broken pipe.
889  * @G_IO_CHANNEL_ERROR_FAILED: Some other error.
890  *
891  * Error codes returned by #GIOChannel operations.
892  */
893
894
895 /**
896  * GIOCondition:
897  * @G_IO_IN: There is data to read.
898  * @G_IO_OUT: Data can be written (without blocking).
899  * @G_IO_PRI: There is urgent data to read.
900  * @G_IO_ERR: Error condition.
901  * @G_IO_HUP: Hung up (the connection has been broken, usually for pipes and sockets).
902  * @G_IO_NVAL: Invalid request. The file descriptor is not open.
903  *
904  * A bitwise combination representing a condition to watch for on an
905  * event source.
906  */
907
908
909 /**
910  * GIOError:
911  * @G_IO_ERROR_NONE: no error
912  * @G_IO_ERROR_AGAIN: an EAGAIN error occurred
913  * @G_IO_ERROR_INVAL: an EINVAL error occurred
914  * @G_IO_ERROR_UNKNOWN: another error occurred
915  *
916  * #GIOError is only used by the deprecated functions
917  * g_io_channel_read(), g_io_channel_write(), and g_io_channel_seek().
918  */
919
920
921 /**
922  * GIOFlags:
923  * @G_IO_FLAG_APPEND: turns on append mode, corresponds to <literal>O_APPEND</literal> (see the documentation of the UNIX open() syscall).
924  * @G_IO_FLAG_NONBLOCK: turns on nonblocking mode, corresponds to <literal>O_NONBLOCK</literal>/<literal>O_NDELAY</literal> (see the documentation of the UNIX open() syscall).
925  * @G_IO_FLAG_IS_READABLE: indicates that the io channel is readable. This flag cannot be changed.
926  * @G_IO_FLAG_IS_WRITABLE: indicates that the io channel is writable. This flag cannot be changed.
927  * @G_IO_FLAG_IS_SEEKABLE: indicates that the io channel is seekable, i.e. that g_io_channel_seek_position() can be used on it.  This flag cannot be changed.
928  * @G_IO_FLAG_MASK: the mask that specifies all the valid flags.
929  * @G_IO_FLAG_GET_MASK: the mask of the flags that are returned from g_io_channel_get_flags().
930  * @G_IO_FLAG_SET_MASK: the mask of the flags that the user can modify with g_io_channel_set_flags().
931  *
932  * Specifies properties of a #GIOChannel. Some of the flags can only be
933  * read with g_io_channel_get_flags(), but not changed with
934  * g_io_channel_set_flags().
935  */
936
937
938 /**
939  * GIOFunc:
940  * @source: the #GIOChannel event source
941  * @condition: the condition which has been satisfied
942  * @data: user data set in g_io_add_watch() or g_io_add_watch_full()
943  *
944  * Specifies the type of function passed to g_io_add_watch() or
945  * g_io_add_watch_full(), which is called when the requested condition
946  * on a #GIOChannel is satisfied.
947  *
948  * Returns: the function should return %FALSE if the event source should be removed
949  */
950
951
952 /**
953  * GIOFuncs:
954  * @io_read: reads raw bytes from the channel.  This is called from various functions such as g_io_channel_read_chars() to read raw bytes from the channel.  Encoding and buffering issues are dealt with at a higher level.
955  * @io_write: writes raw bytes to the channel.  This is called from various functions such as g_io_channel_write_chars() to write raw bytes to the channel.  Encoding and buffering issues are dealt with at a higher level.
956  * @io_seek: &lpar;optional&rpar; seeks the channel.  This is called from g_io_channel_seek() on channels that support it.
957  * @io_close: closes the channel.  This is called from g_io_channel_close() after flushing the buffers.
958  * @io_create_watch: creates a watch on the channel.  This call corresponds directly to g_io_create_watch().
959  * @io_free: called from g_io_channel_unref() when the channel needs to be freed.  This function must free the memory associated with the channel, including freeing the #GIOChannel structure itself.  The channel buffers have been flushed and possibly @io_close has been called by the time this function is called.
960  * @io_set_flags: sets the #GIOFlags on the channel.  This is called from g_io_channel_set_flags() with all flags except for %G_IO_FLAG_APPEND and %G_IO_FLAG_NONBLOCK masked out.
961  * @io_get_flags: gets the #GIOFlags for the channel.  This function need only return the %G_IO_FLAG_APPEND and %G_IO_FLAG_NONBLOCK flags; g_io_channel_get_flags() automatically adds the others as appropriate.
962  *
963  * A table of functions used to handle different types of #GIOChannel
964  * in a generic way.
965  */
966
967
968 /**
969  * GIOStatus:
970  * @G_IO_STATUS_ERROR: An error occurred.
971  * @G_IO_STATUS_NORMAL: Success.
972  * @G_IO_STATUS_EOF: End of file.
973  * @G_IO_STATUS_AGAIN: Resource temporarily unavailable.
974  *
975  * Stati returned by most of the #GIOFuncs functions.
976  */
977
978
979 /**
980  * GKeyFile:
981  *
982  * The GKeyFile struct contains only private data
983  * and should not be accessed directly.
984  */
985
986
987 /**
988  * GKeyFileError:
989  * @G_KEY_FILE_ERROR_UNKNOWN_ENCODING: the text being parsed was in an unknown encoding
990  * @G_KEY_FILE_ERROR_PARSE: document was ill-formed
991  * @G_KEY_FILE_ERROR_NOT_FOUND: the file was not found
992  * @G_KEY_FILE_ERROR_KEY_NOT_FOUND: a requested key was not found
993  * @G_KEY_FILE_ERROR_GROUP_NOT_FOUND: a requested group was not found
994  * @G_KEY_FILE_ERROR_INVALID_VALUE: a value could not be parsed
995  *
996  * Error codes returned by key file parsing.
997  */
998
999
1000 /**
1001  * GKeyFileFlags:
1002  * @G_KEY_FILE_NONE: No flags, default behaviour
1003  * @G_KEY_FILE_KEEP_COMMENTS: Use this flag if you plan to write the (possibly modified) contents of the key file back to a file; otherwise all comments will be lost when the key file is written back.
1004  * @G_KEY_FILE_KEEP_TRANSLATIONS: Use this flag if you plan to write the (possibly modified) contents of the key file back to a file; otherwise only the translations for the current language will be written back.
1005  *
1006  * Flags which influence the parsing.
1007  */
1008
1009
1010 /**
1011  * GLIB_CHECK_VERSION:
1012  * @major: the major version to check for
1013  * @minor: the minor version to check for
1014  * @micro: the micro version to check for
1015  *
1016  * Checks the version of the GLib library that is being compiled
1017  * against.
1018  *
1019  * <example>
1020  * <title>Checking the version of the GLib library</title>
1021  * <programlisting>
1022  *   if (!GLIB_CHECK_VERSION (1, 2, 0))
1023  *     g_error ("GLib version 1.2.0 or above is needed");
1024  * </programlisting>
1025  * </example>
1026  *
1027  * See glib_check_version() for a runtime check.
1028  *
1029  * Returns: %TRUE if the version of the GLib header files is the same as or newer than the passed-in version.
1030  */
1031
1032
1033 /**
1034  * GLIB_DISABLE_DEPRECATION_WARNINGS:
1035  *
1036  * A macro that should be defined before including the glib.h header.
1037  * If it is defined, no compiler warnings will be produced for uses
1038  * of deprecated GLib APIs.
1039  */
1040
1041
1042 /**
1043  * GLIB_MAJOR_VERSION:
1044  *
1045  * The major version number of the GLib library.
1046  *
1047  * Like #glib_major_version, but from the headers used at
1048  * application compile time, rather than from the library
1049  * linked against at application run time.
1050  */
1051
1052
1053 /**
1054  * GLIB_MICRO_VERSION:
1055  *
1056  * The micro version number of the GLib library.
1057  *
1058  * Like #gtk_micro_version, but from the headers used at
1059  * application compile time, rather than from the library
1060  * linked against at application run time.
1061  */
1062
1063
1064 /**
1065  * GLIB_MINOR_VERSION:
1066  *
1067  * The minor version number of the GLib library.
1068  *
1069  * Like #gtk_minor_version, but from the headers used at
1070  * application compile time, rather than from the library
1071  * linked against at application run time.
1072  */
1073
1074
1075 /**
1076  * GLONG_FROM_BE:
1077  * @val: a #glong value in big-endian byte order
1078  *
1079  * Converts a #glong value from big-endian to the host byte order.
1080  *
1081  * Returns: @val converted to host byte order
1082  */
1083
1084
1085 /**
1086  * GLONG_FROM_LE:
1087  * @val: a #glong value in little-endian byte order
1088  *
1089  * Converts a #glong value from little-endian to host byte order.
1090  *
1091  * Returns: @val converted to host byte order
1092  */
1093
1094
1095 /**
1096  * GLONG_TO_BE:
1097  * @val: a #glong value in host byte order
1098  *
1099  * Converts a #glong value from host byte order to big-endian.
1100  *
1101  * Returns: @val converted to big-endian byte order
1102  */
1103
1104
1105 /**
1106  * GLONG_TO_LE:
1107  * @val: a #glong value in host byte order
1108  *
1109  * Converts a #glong value from host byte order to little-endian.
1110  *
1111  * Returns: @val converted to little-endian
1112  */
1113
1114
1115 /**
1116  * GList:
1117  * @data: holds the element's data, which can be a pointer to any kind of data, or any integer value using the <link linkend="glib-Type-Conversion-Macros">Type Conversion Macros</link>.
1118  * @next: contains the link to the next element in the list.
1119  * @prev: contains the link to the previous element in the list.
1120  *
1121  * The #GList struct is used for each element in a doubly-linked list.
1122  */
1123
1124
1125 /**
1126  * GLogFunc:
1127  * @log_domain: the log domain of the message
1128  * @log_level: the log level of the message (including the fatal and recursion flags)
1129  * @message: the message to process
1130  * @user_data: user data, set in g_log_set_handler()
1131  *
1132  * Specifies the prototype of log handler functions.
1133  */
1134
1135
1136 /**
1137  * GLogLevelFlags:
1138  * @G_LOG_FLAG_RECURSION: internal flag
1139  * @G_LOG_FLAG_FATAL: internal flag
1140  * @G_LOG_LEVEL_ERROR: log level for errors, see g_error(). This level is also used for messages produced by g_assert().
1141  * @G_LOG_LEVEL_CRITICAL: log level for critical messages, see g_critical(). This level is also used for messages produced by g_return_if_fail() and g_return_val_if_fail().
1142  * @G_LOG_LEVEL_WARNING: log level for warnings, see g_warning()
1143  * @G_LOG_LEVEL_MESSAGE: log level for messages, see g_message()
1144  * @G_LOG_LEVEL_INFO: log level for informational messages
1145  * @G_LOG_LEVEL_DEBUG: log level for debug messages, see g_debug()
1146  * @G_LOG_LEVEL_MASK: a mask including all log levels
1147  *
1148  * Flags specifying the level of log messages.
1149  *
1150  * It is possible to change how GLib treats messages of the various
1151  * levels using g_log_set_handler() and g_log_set_fatal_mask().
1152  */
1153
1154
1155 /**
1156  * GMappedFile:
1157  *
1158  * The #GMappedFile represents a file mapping created with
1159  * g_mapped_file_new(). It has only private members and should
1160  * not be accessed directly.
1161  */
1162
1163
1164 /**
1165  * GMarkupCollectType:
1166  * @G_MARKUP_COLLECT_INVALID: used to terminate the list of attributes to collect
1167  * @G_MARKUP_COLLECT_STRING: collect the string pointer directly from the attribute_values[] array. Expects a parameter of type (const char **). If %G_MARKUP_COLLECT_OPTIONAL is specified and the attribute isn't present then the pointer will be set to %NULL
1168  * @G_MARKUP_COLLECT_STRDUP: as with %G_MARKUP_COLLECT_STRING, but expects a parameter of type (char **) and g_strdup()s the returned pointer. The pointer must be freed with g_free()
1169  * @G_MARKUP_COLLECT_BOOLEAN: expects a parameter of type (gboolean *) and parses the attribute value as a boolean. Sets %FALSE if the attribute isn't present. Valid boolean values consist of (case-insensitive) "false", "f", "no", "n", "0" and "true", "t", "yes", "y", "1"
1170  * @G_MARKUP_COLLECT_TRISTATE: as with %G_MARKUP_COLLECT_BOOLEAN, but in the case of a missing attribute a value is set that compares equal to neither %FALSE nor %TRUE G_MARKUP_COLLECT_OPTIONAL is implied
1171  * @G_MARKUP_COLLECT_OPTIONAL: can be bitwise ORed with the other fields. If present, allows the attribute not to appear. A default value is set depending on what value type is used
1172  *
1173  * A mixed enumerated type and flags field. You must specify one type
1174  * (string, strdup, boolean, tristate).  Additionally, you may  optionally
1175  * bitwise OR the type with the flag %G_MARKUP_COLLECT_OPTIONAL.
1176  *
1177  * It is likely that this enum will be extended in the future to
1178  * support other types.
1179  */
1180
1181
1182 /**
1183  * GMutex:
1184  *
1185  * The #GMutex struct is an opaque data structure to represent a mutex
1186  * (mutual exclusion). It can be used to protect data against shared
1187  * access. Take for example the following function:
1188  *
1189  * <example>
1190  *  <title>A function which will not work in a threaded environment</title>
1191  *  <programlisting>
1192  *   int
1193  *   give_me_next_number (void)
1194  *   {
1195  *     static int current_number = 0;
1196  *
1197  *     /<!-- -->* now do a very complicated calculation to calculate the new
1198  *      * number, this might for example be a random number generator
1199  *      *<!-- -->/
1200  *     current_number = calc_next_number (current_number);
1201  *
1202  *     return current_number;
1203  *   }
1204  *  </programlisting>
1205  * </example>
1206  *
1207  * It is easy to see that this won't work in a multi-threaded
1208  * application. There current_number must be protected against shared
1209  * access. A #GMutex can be used as a solution to this problem:
1210  *
1211  * <example>
1212  *  <title>Using GMutex to protected a shared variable</title>
1213  *  <programlisting>
1214  *   int
1215  *   give_me_next_number (void)
1216  *   {
1217  *     static GMutex mutex;
1218  *     static int current_number = 0;
1219  *     int ret_val;
1220  *
1221  *     g_mutex_lock (&amp;mutex);
1222  *     ret_val = current_number = calc_next_number (current_number);
1223  *     g_mutex_unlock (&amp;mutex);
1224  *
1225  *     return ret_val;
1226  *   }
1227  *  </programlisting>
1228  * </example>
1229  *
1230  * Notice that the #GMutex is not initialised to any particular value.
1231  * Its placement in static storage ensures that it will be initialised
1232  * to all-zeros, which is appropriate.
1233  *
1234  * If a #GMutex is placed in other contexts (eg: embedded in a struct)
1235  * then it must be explicitly initialised using g_mutex_init().
1236  *
1237  * A #GMutex should only be accessed via <function>g_mutex_</function>
1238  * functions.
1239  */
1240
1241
1242 /**
1243  * GNode:
1244  * @data: contains the actual data of the node.
1245  * @next: points to the node's next sibling (a sibling is another #GNode with the same parent).
1246  * @prev: points to the node's previous sibling.
1247  * @parent: points to the parent of the #GNode, or is %NULL if the #GNode is the root of the tree.
1248  * @children: points to the first child of the #GNode.  The other children are accessed by using the @next pointer of each child.
1249  *
1250  * The #GNode struct represents one node in a
1251  * <link linkend="glib-N-ary-Trees">N-ary Tree</link>. fields
1252  */
1253
1254
1255 /**
1256  * GNodeForeachFunc:
1257  * @node: a #GNode.
1258  * @data: user data passed to g_node_children_foreach().
1259  *
1260  * Specifies the type of function passed to g_node_children_foreach().
1261  * The function is called with each child node, together with the user
1262  * data passed to g_node_children_foreach().
1263  */
1264
1265
1266 /**
1267  * GNodeTraverseFunc:
1268  * @node: a #GNode.
1269  * @data: user data passed to g_node_traverse().
1270  *
1271  * Specifies the type of function passed to g_node_traverse(). The
1272  * function is called with each of the nodes visited, together with the
1273  * user data passed to g_node_traverse(). If the function returns
1274  * %TRUE, then the traversal is stopped.
1275  *
1276  * Returns: %TRUE to stop the traversal.
1277  */
1278
1279
1280 /**
1281  * GOnce:
1282  * @status: the status of the #GOnce
1283  * @retval: the value returned by the call to the function, if @status is %G_ONCE_STATUS_READY
1284  *
1285  * A #GOnce struct controls a one-time initialization function. Any
1286  * one-time initialization function must have its own unique #GOnce
1287  * struct.
1288  *
1289  * Since: 2.4
1290  */
1291
1292
1293 /**
1294  * GOnceStatus:
1295  * @G_ONCE_STATUS_NOTCALLED: the function has not been called yet.
1296  * @G_ONCE_STATUS_PROGRESS: the function call is currently in progress.
1297  * @G_ONCE_STATUS_READY: the function has been called.
1298  *
1299  * The possible statuses of a one-time initialization function
1300  * controlled by a #GOnce struct.
1301  *
1302  * Since: 2.4
1303  */
1304
1305
1306 /**
1307  * GPOINTER_TO_INT:
1308  * @p: pointer containing an integer
1309  *
1310  * Extracts an integer from a pointer. The integer must have
1311  * been stored in the pointer with GINT_TO_POINTER().
1312  *
1313  * Remember, you may not store pointers in integers. This is not portable
1314  * in any way, shape or form. These macros <emphasis>only</emphasis> allow
1315  * storing integers in pointers, and only preserve 32 bits of the
1316  * integer; values outside the range of a 32-bit integer will be mangled.
1317  */
1318
1319
1320 /**
1321  * GPOINTER_TO_SIZE:
1322  * @p: pointer to extract a #gsize from
1323  *
1324  * Extracts a #gsize from a pointer. The #gsize must have
1325  * been stored in the pointer with GSIZE_TO_POINTER().
1326  */
1327
1328
1329 /**
1330  * GPOINTER_TO_UINT:
1331  * @p: pointer to extract an unsigned integer from
1332  *
1333  * Extracts an unsigned integer from a pointer. The integer must have
1334  * been stored in the pointer with GUINT_TO_POINTER().
1335  */
1336
1337
1338 /**
1339  * GPatternSpec:
1340  *
1341  * A <structname>GPatternSpec</structname> is the 'compiled' form of a
1342  * pattern. This structure is opaque and its fields cannot be accessed
1343  * directly.
1344  */
1345
1346
1347 /**
1348  * GPrivate:
1349  *
1350  * The #GPrivate struct is an opaque data structure to represent a
1351  * thread-local data key. It is approximately equivalent to the
1352  * pthread_setspecific()/pthread_getspecific() APIs on POSIX and to
1353  * TlsSetValue()/TlsGetValue() on Windows.
1354  *
1355  * If you don't already know why you might want this functionality,
1356  * then you probably don't need it.
1357  *
1358  * #GPrivate is a very limited resource (as far as 128 per program,
1359  * shared between all libraries). It is also not possible to destroy a
1360  * #GPrivate after it has been used. As such, it is only ever acceptable
1361  * to use #GPrivate in static scope, and even then sparingly so.
1362  *
1363  * See G_PRIVATE_INIT() for a couple of examples.
1364  *
1365  * The #GPrivate structure should be considered opaque.  It should only
1366  * be accessed via the <function>g_private_</function> functions.
1367  */
1368
1369
1370 /**
1371  * GPtrArray:
1372  * @pdata: points to the array of pointers, which may be moved when the array grows.
1373  * @len: number of pointers in the array.
1374  *
1375  * Contains the public fields of a pointer array.
1376  */
1377
1378
1379 /**
1380  * GQuark:
1381  *
1382  * A GQuark is a non-zero integer which uniquely identifies a
1383  * particular string. A GQuark value of zero is associated to %NULL.
1384  */
1385
1386
1387 /**
1388  * GRWLock:
1389  *
1390  * The GRWLock struct is an opaque data structure to represent a
1391  * reader-writer lock. It is similar to a #GMutex in that it allows
1392  * multiple threads to coordinate access to a shared resource.
1393  *
1394  * The difference to a mutex is that a reader-writer lock discriminates
1395  * between read-only ('reader') and full ('writer') access. While only
1396  * one thread at a time is allowed write access (by holding the 'writer'
1397  * lock via g_rw_lock_writer_lock()), multiple threads can gain
1398  * simultaneous read-only access (by holding the 'reader' lock via
1399  * g_rw_lock_reader_lock()).
1400  *
1401  * <example>
1402  *  <title>An array with access functions</title>
1403  *  <programlisting>
1404  *   GRWLock lock;
1405  *   GPtrArray *array;
1406  *
1407  *   gpointer
1408  *   my_array_get (guint index)
1409  *   {
1410  *     gpointer retval = NULL;
1411  *
1412  *     if (!array)
1413  *       return NULL;
1414  *
1415  *     g_rw_lock_reader_lock (&amp;lock);
1416  *     if (index &lt; array->len)
1417  *       retval = g_ptr_array_index (array, index);
1418  *     g_rw_lock_reader_unlock (&amp;lock);
1419  *
1420  *     return retval;
1421  *   }
1422  *
1423  *   void
1424  *   my_array_set (guint index, gpointer data)
1425  *   {
1426  *     g_rw_lock_writer_lock (&amp;lock);
1427  *
1428  *     if (!array)
1429  *       array = g_ptr_array_new (<!-- -->);
1430  *
1431  *     if (index >= array->len)
1432  *       g_ptr_array_set_size (array, index+1);
1433  *     g_ptr_array_index (array, index) = data;
1434  *
1435  *     g_rw_lock_writer_unlock (&amp;lock);
1436  *   }
1437  *  </programlisting>
1438  *  <para>
1439  *    This example shows an array which can be accessed by many readers
1440  *    (the <function>my_array_get()</function> function) simultaneously,
1441  *    whereas the writers (the <function>my_array_set()</function>
1442  *    function) will only be allowed once at a time and only if no readers
1443  *    currently access the array. This is because of the potentially
1444  *    dangerous resizing of the array. Using these functions is fully
1445  *    multi-thread safe now.
1446  *  </para>
1447  * </example>
1448  *
1449  * If a #GRWLock is allocated in static storage then it can be used
1450  * without initialisation.  Otherwise, you should call
1451  * g_rw_lock_init() on it and g_rw_lock_clear() when done.
1452  *
1453  * A GRWLock should only be accessed with the
1454  * <function>g_rw_lock_</function> functions.
1455  *
1456  * Since: 2.32
1457  */
1458
1459
1460 /**
1461  * GRand:
1462  *
1463  * The #GRand struct is an opaque data structure. It should only be
1464  * accessed through the <function>g_rand_*</function> functions.
1465  */
1466
1467
1468 /**
1469  * GRecMutex:
1470  *
1471  * The GRecMutex struct is an opaque data structure to represent a
1472  * recursive mutex. It is similar to a #GMutex with the difference
1473  * that it is possible to lock a GRecMutex multiple times in the same
1474  * thread without deadlock. When doing so, care has to be taken to
1475  * unlock the recursive mutex as often as it has been locked.
1476  *
1477  * If a #GRecMutex is allocated in static storage then it can be used
1478  * without initialisation.  Otherwise, you should call
1479  * g_rec_mutex_init() on it and g_rec_mutex_clear() when done.
1480  *
1481  * A GRecMutex should only be accessed with the
1482  * <function>g_rec_mutex_</function> functions.
1483  *
1484  * Since: 2.32
1485  */
1486
1487
1488 /**
1489  * GSIZE_FROM_BE:
1490  * @val: a #gsize value in big-endian byte order
1491  *
1492  * Converts a #gsize value from big-endian to the host byte order.
1493  *
1494  * Returns: @val converted to host byte order
1495  */
1496
1497
1498 /**
1499  * GSIZE_FROM_LE:
1500  * @val: a #gsize value in little-endian byte order
1501  *
1502  * Converts a #gsize value from little-endian to host byte order.
1503  *
1504  * Returns: @val converted to host byte order
1505  */
1506
1507
1508 /**
1509  * GSIZE_TO_BE:
1510  * @val: a #gsize value in host byte order
1511  *
1512  * Converts a #gsize value from host byte order to big-endian.
1513  *
1514  * Returns: @val converted to big-endian byte order
1515  */
1516
1517
1518 /**
1519  * GSIZE_TO_LE:
1520  * @val: a #gsize value in host byte order
1521  *
1522  * Converts a #gsize value from host byte order to little-endian.
1523  *
1524  * Returns: @val converted to little-endian
1525  */
1526
1527
1528 /**
1529  * GSIZE_TO_POINTER:
1530  * @s: #gsize to stuff into the pointer
1531  *
1532  * Stuffs a #gsize into a pointer type.
1533  */
1534
1535
1536 /**
1537  * GSList:
1538  * @data: holds the element's data, which can be a pointer to any kind of data, or any integer value using the <link linkend="glib-Type-Conversion-Macros">Type Conversion Macros</link>.
1539  * @next: contains the link to the next element in the list.
1540  *
1541  * The #GSList struct is used for each element in the singly-linked
1542  * list.
1543  */
1544
1545
1546 /**
1547  * GSSIZE_FROM_BE:
1548  * @val: a #gssize value in big-endian byte order
1549  *
1550  * Converts a #gssize value from big-endian to host byte order.
1551  *
1552  * Returns: @val converted to host byte order
1553  */
1554
1555
1556 /**
1557  * GSSIZE_FROM_LE:
1558  * @val: a #gssize value in little-endian byte order
1559  *
1560  * Converts a #gssize value from little-endian to host byte order.
1561  *
1562  * Returns: @val converted to host byte order
1563  */
1564
1565
1566 /**
1567  * GSSIZE_TO_BE:
1568  * @val: a #gssize value in host byte order
1569  *
1570  * Converts a #gssize value from host byte order to big-endian.
1571  *
1572  * Returns: @val converted to big-endian
1573  */
1574
1575
1576 /**
1577  * GSSIZE_TO_LE:
1578  * @val: a #gssize value in host byte order
1579  *
1580  * Converts a #gssize value from host byte order to little-endian.
1581  *
1582  * Returns: @val converted to little-endian
1583  */
1584
1585
1586 /**
1587  * GScanner:
1588  * @user_data: unused
1589  * @max_parse_errors: unused
1590  * @parse_errors: g_scanner_error() increments this field
1591  * @input_name: name of input stream, featured by the default message handler
1592  * @qdata: quarked data
1593  * @config: link into the scanner configuration
1594  * @token: token parsed by the last g_scanner_get_next_token()
1595  * @value: value of the last token from g_scanner_get_next_token()
1596  * @line: line number of the last token from g_scanner_get_next_token()
1597  * @position: char number of the last token from g_scanner_get_next_token()
1598  * @next_token: token parsed by the last g_scanner_peek_next_token()
1599  * @next_value: value of the last token from g_scanner_peek_next_token()
1600  * @next_line: line number of the last token from g_scanner_peek_next_token()
1601  * @next_position: char number of the last token from g_scanner_peek_next_token()
1602  * @msg_handler: handler function for _warn and _error
1603  *
1604  * The data structure representing a lexical scanner.
1605  *
1606  * You should set @input_name after creating the scanner, since
1607  * it is used by the default message handler when displaying
1608  * warnings and errors. If you are scanning a file, the filename
1609  * would be a good choice.
1610  *
1611  * The @user_data and @max_parse_errors fields are not used.
1612  * If you need to associate extra data with the scanner you
1613  * can place them here.
1614  *
1615  * If you want to use your own message handler you can set the
1616  * @msg_handler field. The type of the message handler function
1617  * is declared by #GScannerMsgFunc.
1618  */
1619
1620
1621 /**
1622  * GScannerConfig:
1623  * @cset_skip_characters: specifies which characters should be skipped by the scanner (the default is the whitespace characters: space, tab, carriage-return and line-feed).
1624  * @cset_identifier_first: specifies the characters which can start identifiers (the default is #G_CSET_a_2_z, "_", and #G_CSET_A_2_Z).
1625  * @cset_identifier_nth: specifies the characters which can be used in identifiers, after the first character (the default is #G_CSET_a_2_z, "_0123456789", #G_CSET_A_2_Z, #G_CSET_LATINS, #G_CSET_LATINC).
1626  * @cpair_comment_single: specifies the characters at the start and end of single-line comments. The default is "#\n" which means that single-line comments start with a '#' and continue until a '\n' (end of line).
1627  * @case_sensitive: specifies if symbols are case sensitive (the default is %FALSE).
1628  * @skip_comment_multi: specifies if multi-line comments are skipped and not returned as tokens (the default is %TRUE).
1629  * @skip_comment_single: specifies if single-line comments are skipped and not returned as tokens (the default is %TRUE).
1630  * @scan_comment_multi: specifies if multi-line comments are recognized (the default is %TRUE).
1631  * @scan_identifier: specifies if identifiers are recognized (the default is %TRUE).
1632  * @scan_identifier_1char: specifies if single-character identifiers are recognized (the default is %FALSE).
1633  * @scan_identifier_NULL: specifies if %NULL is reported as %G_TOKEN_IDENTIFIER_NULL (the default is %FALSE).
1634  * @scan_symbols: specifies if symbols are recognized (the default is %TRUE).
1635  * @scan_binary: specifies if binary numbers are recognized (the default is %FALSE).
1636  * @scan_octal: specifies if octal numbers are recognized (the default is %TRUE).
1637  * @scan_float: specifies if floating point numbers are recognized (the default is %TRUE).
1638  * @scan_hex: specifies if hexadecimal numbers are recognized (the default is %TRUE).
1639  * @scan_hex_dollar: specifies if '$' is recognized as a prefix for hexadecimal numbers (the default is %FALSE).
1640  * @scan_string_sq: specifies if strings can be enclosed in single quotes (the default is %TRUE).
1641  * @scan_string_dq: specifies if strings can be enclosed in double quotes (the default is %TRUE).
1642  * @numbers_2_int: specifies if binary, octal and hexadecimal numbers are reported as #G_TOKEN_INT (the default is %TRUE).
1643  * @int_2_float: specifies if all numbers are reported as %G_TOKEN_FLOAT (the default is %FALSE).
1644  * @identifier_2_string: specifies if identifiers are reported as strings (the default is %FALSE).
1645  * @char_2_token: specifies if characters are reported by setting <literal>token = ch</literal> or as %G_TOKEN_CHAR (the default is %TRUE).
1646  * @symbol_2_token: specifies if symbols are reported by setting <literal>token = v_symbol</literal> or as %G_TOKEN_SYMBOL (the default is %FALSE).
1647  * @scope_0_fallback: specifies if a symbol is searched for in the default scope in addition to the current scope (the default is %FALSE).
1648  * @store_int64: use value.v_int64 rather than v_int
1649  *
1650  * Specifies the #GScanner parser configuration. Most settings can
1651  * be changed during the parsing phase and will affect the lexical
1652  * parsing of the next unpeeked token.
1653  */
1654
1655
1656 /**
1657  * GScannerMsgFunc:
1658  * @scanner: a #GScanner
1659  * @message: the message
1660  * @error: %TRUE if the message signals an error, %FALSE if it signals a warning.
1661  *
1662  * Specifies the type of the message handler function.
1663  */
1664
1665
1666 /**
1667  * GSeekType:
1668  * @G_SEEK_CUR: the current position in the file.
1669  * @G_SEEK_SET: the start of the file.
1670  * @G_SEEK_END: the end of the file.
1671  *
1672  * An enumeration specifying the base position for a
1673  * g_io_channel_seek_position() operation.
1674  */
1675
1676
1677 /**
1678  * GSequence:
1679  *
1680  * The #GSequence struct is an opaque data type representing a
1681  * <link linkend="glib-Sequences">Sequence</link> data type.
1682  */
1683
1684
1685 /**
1686  * GSequenceIter:
1687  *
1688  * The #GSequenceIter struct is an opaque data type representing an
1689  * iterator pointing into a #GSequence.
1690  */
1691
1692
1693 /**
1694  * GSequenceIterCompareFunc:
1695  * @a: a #GSequenceIter
1696  * @b: a #GSequenceIter
1697  * @data: user data
1698  *
1699  * A #GSequenceIterCompareFunc is a function used to compare iterators.
1700  * It must return zero if the iterators compare equal, a negative value
1701  * if @a comes before @b, and a positive value if @b comes before @a.
1702  *
1703  * Returns: zero if the iterators are equal, a negative value if @a comes before @b, and a positive value if @b comes before @a.
1704  */
1705
1706
1707 /**
1708  * GShellError:
1709  * @G_SHELL_ERROR_BAD_QUOTING: Mismatched or otherwise mangled quoting.
1710  * @G_SHELL_ERROR_EMPTY_STRING: String to be parsed was empty.
1711  * @G_SHELL_ERROR_FAILED: Some other error.
1712  *
1713  * Error codes returned by shell functions.
1714  */
1715
1716
1717 /**
1718  * GStatBuf:
1719  *
1720  * A type corresponding to the appropriate struct type for the stat
1721  * system call, depending on the platform and/or compiler being used.
1722  *
1723  * See g_stat() for more information.
1724  */
1725
1726
1727 /**
1728  * GString:
1729  * @str: points to the character data. It may move as text is added. The @str field is null-terminated and so can be used as an ordinary C string.
1730  * @len: contains the length of the string, not including the terminating nul byte.
1731  * @allocated_len: the number of bytes that can be stored in the string before it needs to be reallocated. May be larger than @len.
1732  *
1733  * The GString struct contains the public fields of a GString.
1734  */
1735
1736
1737 /**
1738  * GStringChunk:
1739  *
1740  * An opaque data structure representing String Chunks.
1741  * It should only be accessed by using the following functions.
1742  */
1743
1744
1745 /**
1746  * GTestCase:
1747  *
1748  * An opaque structure representing a test case.
1749  */
1750
1751
1752 /**
1753  * GTestDataFunc:
1754  * @user_data: the data provided when registering the test
1755  *
1756  * The type used for test case functions that take an extra pointer
1757  * argument.
1758  *
1759  * Since: 2.28
1760  */
1761
1762
1763 /**
1764  * GTestFixtureFunc:
1765  * @fixture: the test fixture
1766  * @user_data: the data provided when registering the test
1767  *
1768  * The type used for functions that operate on test fixtures.  This is
1769  * used for the fixture setup and teardown functions as well as for the
1770  * testcases themselves.
1771  *
1772  * @user_data is a pointer to the data that was given when registering
1773  * the test case.
1774  *
1775  * @fixture will be a pointer to the area of memory allocated by the
1776  * test framework, of the size requested.  If the requested size was
1777  * zero then @fixture will be equal to @user_data.
1778  *
1779  * Since: 2.28
1780  */
1781
1782
1783 /**
1784  * GTestFunc:
1785  *
1786  * The type used for test case functions.
1787  *
1788  * Since: 2.28
1789  */
1790
1791
1792 /**
1793  * GTestSuite:
1794  *
1795  * An opaque structure representing a test suite.
1796  */
1797
1798
1799 /**
1800  * GTestTrapFlags:
1801  * @G_TEST_TRAP_SILENCE_STDOUT: Redirect stdout of the test child to <filename>/dev/null</filename> so it cannot be observed on the console during test runs. The actual output is still captured though to allow later tests with g_test_trap_assert_stdout().
1802  * @G_TEST_TRAP_SILENCE_STDERR: Redirect stderr of the test child to <filename>/dev/null</filename> so it cannot be observed on the console during test runs. The actual output is still captured though to allow later tests with g_test_trap_assert_stderr().
1803  * @G_TEST_TRAP_INHERIT_STDIN: If this flag is given, stdin of the forked child process is shared with stdin of its parent process. It is redirected to <filename>/dev/null</filename> otherwise.
1804  *
1805  * Test traps are guards around forked tests.
1806  * These flags determine what traps to set.
1807  */
1808
1809
1810 /**
1811  * GThread:
1812  *
1813  * The #GThread struct represents a running thread. This struct
1814  * is returned by g_thread_new() or g_thread_try_new(). You can
1815  * obtain the #GThread struct representing the current thead by
1816  * calling g_thread_self().
1817  *
1818  * GThread is refcounted, see g_thread_ref() and g_thread_unref().
1819  * The thread represented by it holds a reference while it is running,
1820  * and g_thread_join() consumes the reference that it is given, so
1821  * it is normally not necessary to manage GThread references
1822  * explicitly.
1823  *
1824  * The structure is opaque -- none of its fields may be directly
1825  * accessed.
1826  */
1827
1828
1829 /**
1830  * GThreadError:
1831  * @G_THREAD_ERROR_AGAIN: a thread couldn't be created due to resource shortage. Try again later.
1832  *
1833  * Possible errors of thread related functions.
1834  */
1835
1836
1837 /**
1838  * GThreadFunc:
1839  * @data: data passed to the thread
1840  *
1841  * Specifies the type of the @func functions passed to g_thread_new()
1842  * or g_thread_try_new().
1843  *
1844  * Returns: the return value of the thread
1845  */
1846
1847
1848 /**
1849  * GThreadPool:
1850  * @func: the function to execute in the threads of this pool
1851  * @user_data: the user data for the threads of this pool
1852  * @exclusive: are all threads exclusive to this pool
1853  *
1854  * The #GThreadPool struct represents a thread pool. It has three
1855  * public read-only members, but the underlying struct is bigger,
1856  * so you must not copy this struct.
1857  */
1858
1859
1860 /**
1861  * GTime:
1862  *
1863  * Simply a replacement for <type>time_t</type>. It has been deprecated
1864  * since it is <emphasis>not</emphasis> equivalent to <type>time_t</type>
1865  * on 64-bit platforms with a 64-bit <type>time_t</type>.
1866  * Unrelated to #GTimer.
1867  *
1868  * Note that <type>GTime</type> is defined to always be a 32bit integer,
1869  * unlike <type>time_t</type> which may be 64bit on some systems.
1870  * Therefore, <type>GTime</type> will overflow in the year 2038, and
1871  * you cannot use the address of a <type>GTime</type> variable as argument
1872  * to the UNIX time() function. Instead, do the following:
1873  * |[
1874  * time_t ttime;
1875  * GTime gtime;
1876  *
1877  * time (&amp;ttime);
1878  * gtime = (GTime)ttime;
1879  * ]|
1880  */
1881
1882
1883 /**
1884  * GTimeVal:
1885  * @tv_sec: seconds
1886  * @tv_usec: microseconds
1887  *
1888  * Represents a precise time, with seconds and microseconds.
1889  * Similar to the <structname>struct timeval</structname> returned by
1890  * the gettimeofday() UNIX system call.
1891  *
1892  * GLib is attempting to unify around the use of 64bit integers to
1893  * represent microsecond-precision time. As such, this type will be
1894  * removed from a future version of GLib.
1895  */
1896
1897
1898 /**
1899  * GTimeZone:
1900  *
1901  * #GDateTime is an opaque structure whose members cannot be accessed
1902  * directly.
1903  *
1904  * Since: 2.26
1905  */
1906
1907
1908 /**
1909  * GTimer:
1910  *
1911  * Opaque datatype that records a start time.
1912  */
1913
1914
1915 /**
1916  * GTokenType:
1917  * @G_TOKEN_EOF: the end of the file
1918  * @G_TOKEN_LEFT_PAREN: a '(' character
1919  * @G_TOKEN_LEFT_CURLY: a '{' character
1920  * @G_TOKEN_LEFT_BRACE: a '[' character
1921  * @G_TOKEN_RIGHT_CURLY: a '}' character
1922  * @G_TOKEN_RIGHT_PAREN: a ')' character
1923  * @G_TOKEN_RIGHT_BRACE: a ']' character
1924  * @G_TOKEN_EQUAL_SIGN: a '=' character
1925  * @G_TOKEN_COMMA: a ',' character
1926  * @G_TOKEN_NONE: not a token
1927  * @G_TOKEN_ERROR: an error occurred
1928  * @G_TOKEN_CHAR: a character
1929  * @G_TOKEN_BINARY: a binary integer
1930  * @G_TOKEN_OCTAL: an octal integer
1931  * @G_TOKEN_INT: an integer
1932  * @G_TOKEN_HEX: a hex integer
1933  * @G_TOKEN_FLOAT: a floating point number
1934  * @G_TOKEN_STRING: a string
1935  * @G_TOKEN_SYMBOL: a symbol
1936  * @G_TOKEN_IDENTIFIER: an identifier
1937  * @G_TOKEN_IDENTIFIER_NULL: a null identifier
1938  * @G_TOKEN_COMMENT_SINGLE: one line comment
1939  * @G_TOKEN_COMMENT_MULTI: multi line comment
1940  *
1941  * The possible types of token returned from each
1942  * g_scanner_get_next_token() call.
1943  */
1944
1945
1946 /**
1947  * GTokenValue:
1948  * @v_symbol: token symbol value
1949  * @v_identifier: token identifier value
1950  * @v_binary: token binary integer value
1951  * @v_octal: octal integer value
1952  * @v_int: integer value
1953  * @v_int64: 64-bit integer value
1954  * @v_float: floating point value
1955  * @v_hex: hex integer value
1956  * @v_string: string value
1957  * @v_comment: comment value
1958  * @v_char: character value
1959  * @v_error: error value
1960  *
1961  * A union holding the value of the token.
1962  */
1963
1964
1965 /**
1966  * GTrashStack:
1967  * @next: pointer to the previous element of the stack, gets stored in the first <literal>sizeof (gpointer)</literal> bytes of the element
1968  *
1969  * Each piece of memory that is pushed onto the stack
1970  * is cast to a <structname>GTrashStack*</structname>.
1971  */
1972
1973
1974 /**
1975  * GTraverseFlags:
1976  * @G_TRAVERSE_LEAVES: only leaf nodes should be visited. This name has been introduced in 2.6, for older version use %G_TRAVERSE_LEAFS.
1977  * @G_TRAVERSE_NON_LEAVES: only non-leaf nodes should be visited. This name has been introduced in 2.6, for older version use %G_TRAVERSE_NON_LEAFS.
1978  * @G_TRAVERSE_ALL: all nodes should be visited.
1979  * @G_TRAVERSE_MASK: a mask of all traverse flags.
1980  * @G_TRAVERSE_LEAFS: identical to %G_TRAVERSE_LEAVES.
1981  * @G_TRAVERSE_NON_LEAFS: identical to %G_TRAVERSE_NON_LEAVES.
1982  *
1983  * Specifies which nodes are visited during several of the tree
1984  * functions, including g_node_traverse() and g_node_find().
1985  */
1986
1987
1988 /**
1989  * GTraverseFunc:
1990  * @key: a key of a #GTree node.
1991  * @value: the value corresponding to the key.
1992  * @data: user data passed to g_tree_traverse().
1993  *
1994  * Specifies the type of function passed to g_tree_traverse(). It is
1995  * passed the key and value of each node, together with the @user_data
1996  * parameter passed to g_tree_traverse(). If the function returns
1997  * %TRUE, the traversal is stopped.
1998  *
1999  * Returns: %TRUE to stop the traversal.
2000  */
2001
2002
2003 /**
2004  * GTraverseType:
2005  * @G_IN_ORDER: vists a node's left child first, then the node itself, then its right child. This is the one to use if you want the output sorted according to the compare function.
2006  * @G_PRE_ORDER: visits a node, then its children.
2007  * @G_POST_ORDER: visits the node's children, then the node itself.
2008  * @G_LEVEL_ORDER: is not implemented for <link linkend="glib-Balanced-Binary-Trees">Balanced Binary Trees</link>.  For <link linkend="glib-N-ary-Trees">N-ary Trees</link>, it vists the root node first, then its children, then its grandchildren, and so on. Note that this is less efficient than the other orders.
2009  *
2010  * Specifies the type of traveral performed by g_tree_traverse(),
2011  * g_node_traverse() and g_node_find().
2012  */
2013
2014
2015 /**
2016  * GTree:
2017  *
2018  * The <structname>GTree</structname> struct is an opaque data
2019  * structure representing a <link
2020  * linkend="glib-Balanced-Binary-Trees">Balanced Binary Tree</link>. It
2021  * should be accessed only by using the following functions.
2022  */
2023
2024
2025 /**
2026  * GUINT16_FROM_BE:
2027  * @val: a #guint16 value in big-endian byte order
2028  *
2029  * Converts a #guint16 value from big-endian to host byte order.
2030  *
2031  * Returns: @val converted to host byte order
2032  */
2033
2034
2035 /**
2036  * GUINT16_FROM_LE:
2037  * @val: a #guint16 value in little-endian byte order
2038  *
2039  * Converts a #guint16 value from little-endian to host byte order.
2040  *
2041  * Returns: @val converted to host byte order
2042  */
2043
2044
2045 /**
2046  * GUINT16_SWAP_BE_PDP:
2047  * @val: a #guint16 value in big-endian or pdp-endian byte order
2048  *
2049  * Converts a #guint16 value between big-endian and pdp-endian byte order.
2050  * The conversion is symmetric so it can be used both ways.
2051  *
2052  * Returns: @val converted to the opposite byte order
2053  */
2054
2055
2056 /**
2057  * GUINT16_SWAP_LE_BE:
2058  * @val: a #guint16 value in little-endian or big-endian byte order
2059  *
2060  * Converts a #guint16 value between little-endian and big-endian byte order.
2061  * The conversion is symmetric so it can be used both ways.
2062  *
2063  * Returns: @val converted to the opposite byte order
2064  */
2065
2066
2067 /**
2068  * GUINT16_SWAP_LE_PDP:
2069  * @val: a #guint16 value in little-endian or pdp-endian byte order
2070  *
2071  * Converts a #guint16 value between little-endian and pdp-endian byte order.
2072  * The conversion is symmetric so it can be used both ways.
2073  *
2074  * Returns: @val converted to the opposite byte order
2075  */
2076
2077
2078 /**
2079  * GUINT16_TO_BE:
2080  * @val: a #guint16 value in host byte order
2081  *
2082  * Converts a #guint16 value from host byte order to big-endian.
2083  *
2084  * Returns: @val converted to big-endian
2085  */
2086
2087
2088 /**
2089  * GUINT16_TO_LE:
2090  * @val: a #guint16 value in host byte order
2091  *
2092  * Converts a #guint16 value from host byte order to little-endian.
2093  *
2094  * Returns: @val converted to little-endian
2095  */
2096
2097
2098 /**
2099  * GUINT32_FROM_BE:
2100  * @val: a #guint32 value in big-endian byte order
2101  *
2102  * Converts a #guint32 value from big-endian to host byte order.
2103  *
2104  * Returns: @val converted to host byte order
2105  */
2106
2107
2108 /**
2109  * GUINT32_FROM_LE:
2110  * @val: a #guint32 value in little-endian byte order
2111  *
2112  * Converts a #guint32 value from little-endian to host byte order.
2113  *
2114  * Returns: @val converted to host byte order
2115  */
2116
2117
2118 /**
2119  * GUINT32_SWAP_BE_PDP:
2120  * @val: a #guint32 value in big-endian or pdp-endian byte order
2121  *
2122  * Converts a #guint32 value between big-endian and pdp-endian byte order.
2123  * The conversion is symmetric so it can be used both ways.
2124  *
2125  * Returns: @val converted to the opposite byte order
2126  */
2127
2128
2129 /**
2130  * GUINT32_SWAP_LE_BE:
2131  * @val: a #guint32 value in little-endian or big-endian byte order
2132  *
2133  * Converts a #guint32 value between little-endian and big-endian byte order.
2134  * The conversion is symmetric so it can be used both ways.
2135  *
2136  * Returns: @val converted to the opposite byte order
2137  */
2138
2139
2140 /**
2141  * GUINT32_SWAP_LE_PDP:
2142  * @val: a #guint32 value in little-endian or pdp-endian byte order
2143  *
2144  * Converts a #guint32 value between little-endian and pdp-endian byte order.
2145  * The conversion is symmetric so it can be used both ways.
2146  *
2147  * Returns: @val converted to the opposite byte order
2148  */
2149
2150
2151 /**
2152  * GUINT32_TO_BE:
2153  * @val: a #guint32 value in host byte order
2154  *
2155  * Converts a #guint32 value from host byte order to big-endian.
2156  *
2157  * Returns: @val converted to big-endian
2158  */
2159
2160
2161 /**
2162  * GUINT32_TO_LE:
2163  * @val: a #guint32 value in host byte order
2164  *
2165  * Converts a #guint32 value from host byte order to little-endian.
2166  *
2167  * Returns: @val converted to little-endian
2168  */
2169
2170
2171 /**
2172  * GUINT64_FROM_BE:
2173  * @val: a #guint64 value in big-endian byte order
2174  *
2175  * Converts a #guint64 value from big-endian to host byte order.
2176  *
2177  * Returns: @val converted to host byte order
2178  */
2179
2180
2181 /**
2182  * GUINT64_FROM_LE:
2183  * @val: a #guint64 value in little-endian byte order
2184  *
2185  * Converts a #guint64 value from little-endian to host byte order.
2186  *
2187  * Returns: @val converted to host byte order
2188  */
2189
2190
2191 /**
2192  * GUINT64_SWAP_LE_BE:
2193  * @val: a #guint64 value in little-endian or big-endian byte order
2194  *
2195  * Converts a #guint64 value between little-endian and big-endian byte order.
2196  * The conversion is symmetric so it can be used both ways.
2197  *
2198  * Returns: @val converted to the opposite byte order
2199  */
2200
2201
2202 /**
2203  * GUINT64_TO_BE:
2204  * @val: a #guint64 value in host byte order
2205  *
2206  * Converts a #guint64 value from host byte order to big-endian.
2207  *
2208  * Returns: @val converted to big-endian
2209  */
2210
2211
2212 /**
2213  * GUINT64_TO_LE:
2214  * @val: a #guint64 value in host byte order
2215  *
2216  * Converts a #guint64 value from host byte order to little-endian.
2217  *
2218  * Returns: @val converted to little-endian
2219  */
2220
2221
2222 /**
2223  * GUINT_FROM_BE:
2224  * @val: a #guint value in big-endian byte order
2225  *
2226  * Converts a #guint value from big-endian to host byte order.
2227  *
2228  * Returns: @val converted to host byte order
2229  */
2230
2231
2232 /**
2233  * GUINT_FROM_LE:
2234  * @val: a #guint value in little-endian byte order
2235  *
2236  * Converts a #guint value from little-endian to host byte order.
2237  *
2238  * Returns: @val converted to host byte order
2239  */
2240
2241
2242 /**
2243  * GUINT_TO_BE:
2244  * @val: a #guint value in host byte order
2245  *
2246  * Converts a #guint value from host byte order to big-endian.
2247  *
2248  * Returns: @val converted to big-endian byte order
2249  */
2250
2251
2252 /**
2253  * GUINT_TO_LE:
2254  * @val: a #guint value in host byte order
2255  *
2256  * Converts a #guint value from host byte order to little-endian.
2257  *
2258  * Returns: @val converted to little-endian byte order.
2259  */
2260
2261
2262 /**
2263  * GUINT_TO_POINTER:
2264  * @u: unsigned integer to stuff into the pointer
2265  *
2266  * Stuffs an unsigned integer into a pointer type.
2267  */
2268
2269
2270 /**
2271  * GULONG_FROM_BE:
2272  * @val: a #gulong value in big-endian byte order
2273  *
2274  * Converts a #gulong value from big-endian to host byte order.
2275  *
2276  * Returns: @val converted to host byte order
2277  */
2278
2279
2280 /**
2281  * GULONG_FROM_LE:
2282  * @val: a #gulong value in little-endian byte order
2283  *
2284  * Converts a #gulong value from little-endian to host byte order.
2285  *
2286  * Returns: @val converted to host byte order
2287  */
2288
2289
2290 /**
2291  * GULONG_TO_BE:
2292  * @val: a #gulong value in host byte order
2293  *
2294  * Converts a #gulong value from host byte order to big-endian.
2295  *
2296  * Returns: @val converted to big-endian
2297  */
2298
2299
2300 /**
2301  * GULONG_TO_LE:
2302  * @val: a #gulong value in host byte order
2303  *
2304  * Converts a #gulong value from host byte order to little-endian.
2305  *
2306  * Returns: @val converted to little-endian
2307  */
2308
2309
2310 /**
2311  * GVariant:
2312  *
2313  * #GVariant is an opaque data structure and can only be accessed
2314  * using the following functions.
2315  *
2316  * Since: 2.24
2317  */
2318
2319
2320 /**
2321  * GVariantBuilder:
2322  *
2323  * A utility type for constructing container-type #GVariant instances.
2324  *
2325  * This is an opaque structure and may only be accessed using the
2326  * following functions.
2327  *
2328  * #GVariantBuilder is not threadsafe in any way.  Do not attempt to
2329  * access it from more than one thread.
2330  */
2331
2332
2333 /**
2334  * GVariantClass:
2335  * @G_VARIANT_CLASS_BOOLEAN: The #GVariant is a boolean.
2336  * @G_VARIANT_CLASS_BYTE: The #GVariant is a byte.
2337  * @G_VARIANT_CLASS_INT16: The #GVariant is a signed 16 bit integer.
2338  * @G_VARIANT_CLASS_UINT16: The #GVariant is an unsigned 16 bit integer.
2339  * @G_VARIANT_CLASS_INT32: The #GVariant is a signed 32 bit integer.
2340  * @G_VARIANT_CLASS_UINT32: The #GVariant is an unsigned 32 bit integer.
2341  * @G_VARIANT_CLASS_INT64: The #GVariant is a signed 64 bit integer.
2342  * @G_VARIANT_CLASS_UINT64: The #GVariant is an unsigned 64 bit integer.
2343  * @G_VARIANT_CLASS_HANDLE: The #GVariant is a file handle index.
2344  * @G_VARIANT_CLASS_DOUBLE: The #GVariant is a double precision floating point value.
2345  * @G_VARIANT_CLASS_STRING: The #GVariant is a normal string.
2346  * @G_VARIANT_CLASS_OBJECT_PATH: The #GVariant is a D-Bus object path string.
2347  * @G_VARIANT_CLASS_SIGNATURE: The #GVariant is a D-Bus signature string.
2348  * @G_VARIANT_CLASS_VARIANT: The #GVariant is a variant.
2349  * @G_VARIANT_CLASS_MAYBE: The #GVariant is a maybe-typed value.
2350  * @G_VARIANT_CLASS_ARRAY: The #GVariant is an array.
2351  * @G_VARIANT_CLASS_TUPLE: The #GVariant is a tuple.
2352  * @G_VARIANT_CLASS_DICT_ENTRY: The #GVariant is a dictionary entry.
2353  *
2354  * The range of possible top-level types of #GVariant instances.
2355  *
2356  * Since: 2.24
2357  */
2358
2359
2360 /**
2361  * GVariantIter: (skip)
2362  *
2363  * #GVariantIter is an opaque data structure and can only be accessed
2364  * using the following functions.
2365  */
2366
2367
2368 /**
2369  * GVariantParseError:
2370  * @G_VARIANT_PARSE_ERROR_FAILED: generic error (unused)
2371  * @G_VARIANT_PARSE_ERROR_BASIC_TYPE_EXPECTED: a non-basic #GVariantType was given where a basic type was expected
2372  * @G_VARIANT_PARSE_ERROR_CANNOT_INFER_TYPE: cannot infer the #GVariantType
2373  * @G_VARIANT_PARSE_ERROR_DEFINITE_TYPE_EXPECTED: an indefinite #GVariantType was given where a definite type was expected
2374  * @G_VARIANT_PARSE_ERROR_INPUT_NOT_AT_END: extra data after parsing finished
2375  * @G_VARIANT_PARSE_ERROR_INVALID_CHARACTER: invalid character in number or unicode escape
2376  * @G_VARIANT_PARSE_ERROR_INVALID_FORMAT_STRING: not a valid #GVariant format string
2377  * @G_VARIANT_PARSE_ERROR_INVALID_OBJECT_PATH: not a valid object path
2378  * @G_VARIANT_PARSE_ERROR_INVALID_SIGNATURE: not a valid type signature
2379  * @G_VARIANT_PARSE_ERROR_INVALID_TYPE_STRING: not a valid #GVariant type string
2380  * @G_VARIANT_PARSE_ERROR_NO_COMMON_TYPE: could not find a common type for array entries
2381  * @G_VARIANT_PARSE_ERROR_NUMBER_OUT_OF_RANGE: the numerical value is out of range of the given type
2382  * @G_VARIANT_PARSE_ERROR_NUMBER_TOO_BIG: the numerical value is out of range for any type
2383  * @G_VARIANT_PARSE_ERROR_TYPE_ERROR: cannot parse as variant of the specified type
2384  * @G_VARIANT_PARSE_ERROR_UNEXPECTED_TOKEN: an unexpected token was encountered
2385  * @G_VARIANT_PARSE_ERROR_UNKNOWN_KEYWORD: an unknown keyword was encountered
2386  * @G_VARIANT_PARSE_ERROR_UNTERMINATED_STRING_CONSTANT: unterminated string constant
2387  * @G_VARIANT_PARSE_ERROR_VALUE_EXPECTED: no value given
2388  *
2389  * Error codes returned by parsing text-format GVariants.
2390  */
2391
2392
2393 /**
2394  * G_ASCII_DTOSTR_BUF_SIZE:
2395  *
2396  * A good size for a buffer to be passed into g_ascii_dtostr().
2397  * It is guaranteed to be enough for all output of that function
2398  * on systems with 64bit IEEE-compatible doubles.
2399  *
2400  * The typical usage would be something like:
2401  * |[
2402  *   char buf[G_ASCII_DTOSTR_BUF_SIZE];
2403  *
2404  *   fprintf (out, "value=&percnt;s\n", g_ascii_dtostr (buf, sizeof (buf), value));
2405  * ]|
2406  */
2407
2408
2409 /**
2410  * G_ATOMIC_LOCK_FREE:
2411  *
2412  * This macro is defined if the atomic operations of GLib are
2413  * implemented using real hardware atomic operations.  This means that
2414  * the GLib atomic API can be used between processes and safely mixed
2415  * with other (hardware) atomic APIs.
2416  *
2417  * If this macro is not defined, the atomic operations may be
2418  * emulated using a mutex.  In that case, the GLib atomic operations are
2419  * only atomic relative to themselves and within a single process.
2420  */
2421
2422
2423 /**
2424  * G_BEGIN_DECLS:
2425  *
2426  * Used (along with #G_END_DECLS) to bracket header files. If the
2427  * compiler in use is a C++ compiler, adds <literal>extern "C"</literal>
2428  * around the header.
2429  */
2430
2431
2432 /**
2433  * G_BIG_ENDIAN:
2434  *
2435  * Specifies one of the possible types of byte order.
2436  * See #G_BYTE_ORDER.
2437  */
2438
2439
2440 /**
2441  * G_BYTE_ORDER:
2442  *
2443  * The host byte order.
2444  * This can be either #G_LITTLE_ENDIAN or #G_BIG_ENDIAN (support for
2445  * #G_PDP_ENDIAN may be added in future.)
2446  */
2447
2448
2449 /**
2450  * G_CONST_RETURN:
2451  *
2452  * If <literal>G_DISABLE_CONST_RETURNS</literal> is defined, this macro expands
2453  * to nothing. By default, the macro expands to <literal>const</literal>.
2454  * The macro should be used in place of <literal>const</literal> for
2455  * functions that return a value that should not be modified. The
2456  * purpose of this macro is to allow us to turn on <literal>const</literal>
2457  * for returned constant strings by default, while allowing programmers
2458  * who find that annoying to turn it off. This macro should only be used
2459  * for return values and for <emphasis>out</emphasis> parameters, it doesn't
2460  * make sense for <emphasis>in</emphasis> parameters.
2461  *
2462  * Deprecated: 2.30: API providers should replace all existing uses with <literal>const</literal> and API consumers should adjust their code accordingly
2463  */
2464
2465
2466 /**
2467  * G_CSET_A_2_Z:
2468  *
2469  * The set of uppercase ASCII alphabet characters.
2470  * Used for specifying valid identifier characters
2471  * in #GScannerConfig.
2472  */
2473
2474
2475 /**
2476  * G_CSET_LATINC:
2477  *
2478  * The set of uppercase ISO 8859-1 alphabet characters
2479  * which are not ASCII characters.
2480  * Used for specifying valid identifier characters
2481  * in #GScannerConfig.
2482  */
2483
2484
2485 /**
2486  * G_CSET_LATINS:
2487  *
2488  * The set of lowercase ISO 8859-1 alphabet characters
2489  * which are not ASCII characters.
2490  * Used for specifying valid identifier characters
2491  * in #GScannerConfig.
2492  */
2493
2494
2495 /**
2496  * G_CSET_a_2_z:
2497  *
2498  * The set of lowercase ASCII alphabet characters.
2499  * Used for specifying valid identifier characters
2500  * in #GScannerConfig.
2501  */
2502
2503
2504 /**
2505  * G_DATE_BAD_DAY:
2506  *
2507  * Represents an invalid #GDateDay.
2508  */
2509
2510
2511 /**
2512  * G_DATE_BAD_JULIAN:
2513  *
2514  * Represents an invalid Julian day number.
2515  */
2516
2517
2518 /**
2519  * G_DATE_BAD_YEAR:
2520  *
2521  * Represents an invalid year.
2522  */
2523
2524
2525 /**
2526  * G_DEFINE_QUARK:
2527  * @QN: the name to return a #GQuark for
2528  * @q_n: prefix for the function name
2529  *
2530  * A convenience macro which defines a function returning the
2531  * #GQuark for the name @QN. The function will be named
2532  * @q_n<!-- -->_quark().
2533  * Note that the quark name will be stringified automatically in the
2534  * macro, so you shouldn't use double quotes.
2535  *
2536  * Since: 2.34
2537  */
2538
2539
2540 /**
2541  * G_DEPRECATED:
2542  *
2543  * This macro is similar to %G_GNUC_DEPRECATED, and can be used to mark
2544  * functions declarations as deprecated. Unlike %G_GNUC_DEPRECATED, it is
2545  * meant to be portable across different compilers and must be placed
2546  * before the function declaration.
2547  *
2548  * Since: 2.32
2549  */
2550
2551
2552 /**
2553  * G_DEPRECATED_FOR:
2554  * @f: the name of the function that this function was deprecated for
2555  *
2556  * This macro is similar to %G_GNUC_DEPRECATED_FOR, and can be used to mark
2557  * functions declarations as deprecated. Unlike %G_GNUC_DEPRECATED_FOR, it is
2558  * meant to be portable across different compilers and must be placed
2559  * before the function declaration.
2560  *
2561  * Since: 2.32
2562  */
2563
2564
2565 /**
2566  * G_DIR_SEPARATOR:
2567  *
2568  * The directory separator character.
2569  * This is '/' on UNIX machines and '\' under Windows.
2570  */
2571
2572
2573 /**
2574  * G_DIR_SEPARATOR_S:
2575  *
2576  * The directory separator as a string.
2577  * This is "/" on UNIX machines and "\" under Windows.
2578  */
2579
2580
2581 /**
2582  * G_E:
2583  *
2584  * The base of natural logarithms.
2585  */
2586
2587
2588 /**
2589  * G_END_DECLS:
2590  *
2591  * Used (along with #G_BEGIN_DECLS) to bracket header files. If the
2592  * compiler in use is a C++ compiler, adds <literal>extern "C"</literal>
2593  * around the header.
2594  */
2595
2596
2597 /**
2598  * G_FILE_ERROR:
2599  *
2600  * Error domain for file operations. Errors in this domain will
2601  * be from the #GFileError enumeration. See #GError for information
2602  * on error domains.
2603  */
2604
2605
2606 /**
2607  * G_GINT16_FORMAT:
2608  *
2609  * This is the platform dependent conversion specifier for scanning and
2610  * printing values of type #gint16. It is a string literal, but doesn't
2611  * include the percent-sign, such that you can add precision and length
2612  * modifiers between percent-sign and conversion specifier.
2613  *
2614  * |[
2615  * gint16 in;
2616  * gint32 out;
2617  * sscanf ("42", "%" G_GINT16_FORMAT, &amp;in)
2618  * out = in * 1000;
2619  * g_print ("%" G_GINT32_FORMAT, out);
2620  * ]|
2621  */
2622
2623
2624 /**
2625  * G_GINT16_MODIFIER:
2626  *
2627  * The platform dependent length modifier for conversion specifiers
2628  * for scanning and printing values of type #gint16 or #guint16. It
2629  * is a string literal, but doesn't include the percent-sign, such
2630  * that you can add precision and length modifiers between percent-sign
2631  * and conversion specifier and append a conversion specifier.
2632  *
2633  * The following example prints "0x7b";
2634  * |[
2635  * gint16 value = 123;
2636  * g_print ("%#" G_GINT16_MODIFIER "x", value);
2637  * ]|
2638  *
2639  * Since: 2.4
2640  */
2641
2642
2643 /**
2644  * G_GINT32_FORMAT:
2645  *
2646  * This is the platform dependent conversion specifier for scanning
2647  * and printing values of type #gint32. See also #G_GINT16_FORMAT.
2648  */
2649
2650
2651 /**
2652  * G_GINT32_MODIFIER:
2653  *
2654  * The platform dependent length modifier for conversion specifiers
2655  * for scanning and printing values of type #gint32 or #guint32. It
2656  * is a string literal. See also #G_GINT16_MODIFIER.
2657  *
2658  * Since: 2.4
2659  */
2660
2661
2662 /**
2663  * G_GINT64_CONSTANT:
2664  * @val: a literal integer value, e.g. 0x1d636b02300a7aa7
2665  *
2666  * This macro is used to insert 64-bit integer literals
2667  * into the source code.
2668  */
2669
2670
2671 /**
2672  * G_GINT64_FORMAT:
2673  *
2674  * This is the platform dependent conversion specifier for scanning
2675  * and printing values of type #gint64. See also #G_GINT16_FORMAT.
2676  *
2677  * <note><para>
2678  * Some platforms do not support scanning and printing 64 bit integers,
2679  * even though the types are supported. On such platforms #G_GINT64_FORMAT
2680  * is not defined. Note that scanf() may not support 64 bit integers, even
2681  * if #G_GINT64_FORMAT is defined. Due to its weak error handling, scanf()
2682  * is not recommended for parsing anyway; consider using g_ascii_strtoull()
2683  * instead.
2684  * </para></note>
2685  */
2686
2687
2688 /**
2689  * G_GINT64_MODIFIER:
2690  *
2691  * The platform dependent length modifier for conversion specifiers
2692  * for scanning and printing values of type #gint64 or #guint64.
2693  * It is a string literal.
2694  *
2695  * <note><para>
2696  * Some platforms do not support printing 64 bit integers, even
2697  * though the types are supported. On such platforms #G_GINT64_MODIFIER
2698  * is not defined.
2699  * </para></note>
2700  *
2701  * Since: 2.4
2702  */
2703
2704
2705 /**
2706  * G_GINTPTR_FORMAT:
2707  *
2708  * This is the platform dependent conversion specifier for scanning
2709  * and printing values of type #gintptr.
2710  *
2711  * Since: 2.22
2712  */
2713
2714
2715 /**
2716  * G_GINTPTR_MODIFIER:
2717  *
2718  * The platform dependent length modifier for conversion specifiers
2719  * for scanning and printing values of type #gintptr or #guintptr.
2720  * It is a string literal.
2721  *
2722  * Since: 2.22
2723  */
2724
2725
2726 /**
2727  * G_GNUC_ALLOC_SIZE:
2728  * @x: the index of the argument specifying the allocation size
2729  *
2730  * Expands to the GNU C <literal>alloc_size</literal> function attribute
2731  * if the compiler is a new enough <command>gcc</command>. This attribute
2732  * tells the compiler that the function returns a pointer to memory of a
2733  * size that is specified by the @x<!-- -->th function parameter.
2734  *
2735  * Place the attribute after the function declaration, just before the
2736  * semicolon.
2737  *
2738  * See the GNU C documentation for more details.
2739  *
2740  * Since: 2.18
2741  */
2742
2743
2744 /**
2745  * G_GNUC_ALLOC_SIZE2:
2746  * @x: the index of the argument specifying one factor of the allocation size
2747  * @y: the index of the argument specifying the second factor of the allocation size
2748  *
2749  * Expands to the GNU C <literal>alloc_size</literal> function attribute
2750  * if the compiler is a new enough <command>gcc</command>. This attribute
2751  * tells the compiler that the function returns a pointer to memory of a
2752  * size that is specified by the product of two function parameters.
2753  *
2754  * Place the attribute after the function declaration, just before the
2755  * semicolon.
2756  *
2757  * See the GNU C documentation for more details.
2758  *
2759  * Since: 2.18
2760  */
2761
2762
2763 /**
2764  * G_GNUC_BEGIN_IGNORE_DEPRECATIONS:
2765  *
2766  * Tells <command>gcc</command> (if it is a new enough version) to
2767  * temporarily stop emitting warnings when functions marked with
2768  * %G_GNUC_DEPRECATED or %G_GNUC_DEPRECATED_FOR are called. This is
2769  * useful for when you have one deprecated function calling another
2770  * one, or when you still have regression tests for deprecated
2771  * functions.
2772  *
2773  * Use %G_GNUC_END_IGNORE_DEPRECATIONS to begin warning again. (If you
2774  * are not compiling with <literal>-Wdeprecated-declarations</literal>
2775  * then neither macro has any effect.)
2776  *
2777  * This macro can be used either inside or outside of a function body,
2778  * but must appear on a line by itself.
2779  *
2780  * Since: 2.32
2781  */
2782
2783
2784 /**
2785  * G_GNUC_CONST:
2786  *
2787  * Expands to the GNU C <literal>const</literal> function attribute if
2788  * the compiler is <command>gcc</command>. Declaring a function as const
2789  * enables better optimization of calls to the function. A const function
2790  * doesn't examine any values except its parameters, and has no effects
2791  * except its return value.
2792  *
2793  * Place the attribute after the declaration, just before the semicolon.
2794  *
2795  * See the GNU C documentation for more details.
2796  *
2797  * <note><para>
2798  * A function that has pointer arguments and examines the data pointed to
2799  * must <emphasis>not</emphasis> be declared const. Likewise, a function
2800  * that calls a non-const function usually must not be const. It doesn't
2801  * make sense for a const function to return void.
2802  * </para></note>
2803  */
2804
2805
2806 /**
2807  * G_GNUC_DEPRECATED:
2808  *
2809  * Expands to the GNU C <literal>deprecated</literal> attribute if the
2810  * compiler is <command>gcc</command>. It can be used to mark typedefs,
2811  * variables and functions as deprecated. When called with the
2812  * <option>-Wdeprecated-declarations</option> option, the compiler will
2813  * generate warnings when deprecated interfaces are used.
2814  *
2815  * Place the attribute after the declaration, just before the semicolon.
2816  *
2817  * See the GNU C documentation for more details.
2818  *
2819  * Since: 2.2
2820  */
2821
2822
2823 /**
2824  * G_GNUC_DEPRECATED_FOR:
2825  * @f: the intended replacement for the deprecated symbol, such as the name of a function
2826  *
2827  * Like %G_GNUC_DEPRECATED, but names the intended replacement for the
2828  * deprecated symbol if the version of <command>gcc</command> in use is
2829  * new enough to support custom deprecation messages.
2830  *
2831  * Place the attribute after the declaration, just before the semicolon.
2832  *
2833  * See the GNU C documentation for more details.
2834  *
2835  * Note that if @f is a macro, it will be expanded in the warning message.
2836  * You can enclose it in quotes to prevent this. (The quotes will show up
2837  * in the warning, but it's better than showing the macro expansion.)
2838  *
2839  * Since: 2.26
2840  */
2841
2842
2843 /**
2844  * G_GNUC_END_IGNORE_DEPRECATIONS:
2845  *
2846  * Undoes the effect of %G_GNUC_BEGIN_IGNORE_DEPRECATIONS, telling
2847  * <command>gcc</command> to begin outputting warnings again
2848  * (assuming those warnings had been enabled to begin with).
2849  *
2850  * This macro can be used either inside or outside of a function body,
2851  * but must appear on a line by itself.
2852  *
2853  * Since: 2.32
2854  */
2855
2856
2857 /**
2858  * G_GNUC_EXTENSION:
2859  *
2860  * Expands to <literal>__extension__</literal> when <command>gcc</command>
2861  * is used as the compiler. This simply tells <command>gcc</command> not
2862  * to warn about the following non-standard code when compiling with the
2863  * <option>-pedantic</option> option.
2864  */
2865
2866
2867 /**
2868  * G_GNUC_FORMAT:
2869  * @arg_idx: the index of the argument
2870  *
2871  * Expands to the GNU C <literal>format_arg</literal> function attribute
2872  * if the compiler is <command>gcc</command>. This function attribute
2873  * specifies that a function takes a format string for a printf(),
2874  * scanf(), strftime() or strfmon() style function and modifies it,
2875  * so that the result can be passed to a printf(), scanf(), strftime()
2876  * or strfmon() style function (with the remaining arguments to the
2877  * format function the same as they would have been for the unmodified
2878  * string).
2879  *
2880  * Place the attribute after the function declaration, just after the
2881  * semicolon.
2882  *
2883  * See the GNU C documentation for more details.
2884  *
2885  * |[
2886  * gchar *g_dgettext (gchar *domain_name, gchar *msgid) G_GNUC_FORMAT (2);
2887  * ]|
2888  */
2889
2890
2891 /**
2892  * G_GNUC_FUNCTION:
2893  *
2894  * Expands to "" on all modern compilers, and to
2895  * <literal>__FUNCTION__</literal> on <command>gcc</command> version 2.x.
2896  * Don't use it.
2897  *
2898  * Deprecated: 2.16: Use #G_STRFUNC instead
2899  */
2900
2901
2902 /**
2903  * G_GNUC_INTERNAL:
2904  *
2905  * This attribute can be used for marking library functions as being used
2906  * internally to the library only, which may allow the compiler to handle
2907  * function calls more efficiently. Note that static functions do not need
2908  * to be marked as internal in this way. See the GNU C documentation for
2909  * details.
2910  *
2911  * When using a compiler that supports the GNU C hidden visibility attribute,
2912  * this macro expands to <literal>__attribute__((visibility("hidden")))</literal>.
2913  * When using the Sun Studio compiler, it expands to <literal>__hidden</literal>.
2914  *
2915  * Note that for portability, the attribute should be placed before the
2916  * function declaration. While GCC allows the macro after the declaration,
2917  * Sun Studio does not.
2918  *
2919  * |[
2920  * G_GNUC_INTERNAL
2921  * void _g_log_fallback_handler (const gchar    *log_domain,
2922  *                               GLogLevelFlags  log_level,
2923  *                               const gchar    *message,
2924  *                               gpointer        unused_data);
2925  * ]|
2926  *
2927  * Since: 2.6
2928  */
2929
2930
2931 /**
2932  * G_GNUC_MALLOC:
2933  *
2934  * Expands to the GNU C <literal>malloc</literal> function attribute if the
2935  * compiler is <command>gcc</command>. Declaring a function as malloc enables
2936  * better optimization of the function. A function can have the malloc
2937  * attribute if it returns a pointer which is guaranteed to not alias with
2938  * any other pointer when the function returns (in practice, this means newly
2939  * allocated memory).
2940  *
2941  * Place the attribute after the declaration, just before the semicolon.
2942  *
2943  * See the GNU C documentation for more details.
2944  *
2945  * Since: 2.6
2946  */
2947
2948
2949 /**
2950  * G_GNUC_MAY_ALIAS:
2951  *
2952  * Expands to the GNU C <literal>may_alias</literal> type attribute
2953  * if the compiler is <command>gcc</command>. Types with this attribute
2954  * will not be subjected to type-based alias analysis, but are assumed
2955  * to alias with any other type, just like char.
2956  * See the GNU C documentation for details.
2957  *
2958  * Since: 2.14
2959  */
2960
2961
2962 /**
2963  * G_GNUC_NORETURN:
2964  *
2965  * Expands to the GNU C <literal>noreturn</literal> function attribute
2966  * if the compiler is <command>gcc</command>. It is used for declaring
2967  * functions which never return. It enables optimization of the function,
2968  * and avoids possible compiler warnings.
2969  *
2970  * Place the attribute after the declaration, just before the semicolon.
2971  *
2972  * See the GNU C documentation for more details.
2973  */
2974
2975
2976 /**
2977  * G_GNUC_NO_INSTRUMENT:
2978  *
2979  * Expands to the GNU C <literal>no_instrument_function</literal> function
2980  * attribute if the compiler is <command>gcc</command>. Functions with this
2981  * attribute will not be instrumented for profiling, when the compiler is
2982  * called with the <option>-finstrument-functions</option> option.
2983  *
2984  * Place the attribute after the declaration, just before the semicolon.
2985  *
2986  * See the GNU C documentation for more details.
2987  */
2988
2989
2990 /**
2991  * G_GNUC_NULL_TERMINATED:
2992  *
2993  * Expands to the GNU C <literal>sentinel</literal> function attribute
2994  * if the compiler is <command>gcc</command>, or "" if it isn't. This
2995  * function attribute only applies to variadic functions and instructs
2996  * the compiler to check that the argument list is terminated with an
2997  * explicit %NULL.
2998  *
2999  * Place the attribute after the declaration, just before the semicolon.
3000  *
3001  * See the GNU C documentation for more details.
3002  *
3003  * Since: 2.8
3004  */
3005
3006
3007 /**
3008  * G_GNUC_PRETTY_FUNCTION:
3009  *
3010  * Expands to "" on all modern compilers, and to
3011  * <literal>__PRETTY_FUNCTION__</literal> on <command>gcc</command>
3012  * version 2.x. Don't use it.
3013  *
3014  * Deprecated: 2.16: Use #G_STRFUNC instead
3015  */
3016
3017
3018 /**
3019  * G_GNUC_PRINTF:
3020  * @format_idx: the index of the argument corresponding to the format string (The arguments are numbered from 1)
3021  * @arg_idx: the index of the first of the format arguments
3022  *
3023  * Expands to the GNU C <literal>format</literal> function attribute
3024  * if the compiler is <command>gcc</command>. This is used for declaring
3025  * functions which take a variable number of arguments, with the same
3026  * syntax as printf(). It allows the compiler to type-check the arguments
3027  * passed to the function.
3028  *
3029  * Place the attribute after the function declaration, just before the
3030  * semicolon.
3031  *
3032  * See the GNU C documentation for more details.
3033  *
3034  * |[
3035  * gint g_snprintf (gchar  *string,
3036  *                  gulong       n,
3037  *                  gchar const *format,
3038  *                  ...) G_GNUC_PRINTF (3, 4);
3039  * ]|
3040  */
3041
3042
3043 /**
3044  * G_GNUC_PURE:
3045  *
3046  * Expands to the GNU C <literal>pure</literal> function attribute if the
3047  * compiler is <command>gcc</command>. Declaring a function as pure enables
3048  * better optimization of calls to the function. A pure function has no
3049  * effects except its return value and the return value depends only on
3050  * the parameters and/or global variables.
3051  *
3052  * Place the attribute after the declaration, just before the semicolon.
3053  *
3054  * See the GNU C documentation for more details.
3055  */
3056
3057
3058 /**
3059  * G_GNUC_SCANF:
3060  * @format_idx: the index of the argument corresponding to the format string (The arguments are numbered from 1)
3061  * @arg_idx: the index of the first of the format arguments
3062  *
3063  * Expands to the GNU C <literal>format</literal> function attribute
3064  * if the compiler is <command>gcc</command>. This is used for declaring
3065  * functions which take a variable number of arguments, with the same
3066  * syntax as scanf(). It allows the compiler to type-check the arguments
3067  * passed to the function. See the GNU C documentation for details.
3068  */
3069
3070
3071 /**
3072  * G_GNUC_UNUSED:
3073  *
3074  * Expands to the GNU C <literal>unused</literal> function attribute if
3075  * the compiler is <command>gcc</command>. It is used for declaring
3076  * functions and arguments which may never be used. It avoids possible compiler
3077  * warnings.
3078  *
3079  * For functions, place the attribute after the declaration, just before the
3080  * semicolon. For arguments, place the attribute at the beginning of the
3081  * argument declaration.
3082  *
3083  * |[
3084  * void my_unused_function (G_GNUC_UNUSED gint unused_argument,
3085  *                          gint other_argument) G_GNUC_UNUSED;
3086  * ]|
3087  *
3088  * See the GNU C documentation for more details.
3089  */
3090
3091
3092 /**
3093  * G_GNUC_WARN_UNUSED_RESULT:
3094  *
3095  * Expands to the GNU C <literal>warn_unused_result</literal> function
3096  * attribute if the compiler is <command>gcc</command>, or "" if it isn't.
3097  * This function attribute makes the compiler emit a warning if the result
3098  * of a function call is ignored.
3099  *
3100  * Place the attribute after the declaration, just before the semicolon.
3101  *
3102  * See the GNU C documentation for more details.
3103  *
3104  * Since: 2.10
3105  */
3106
3107
3108 /**
3109  * G_GOFFSET_CONSTANT:
3110  * @val: a literal integer value, e.g. 0x1d636b02300a7aa7
3111  *
3112  * This macro is used to insert #goffset 64-bit integer literals
3113  * into the source code.
3114  *
3115  * See also #G_GINT64_CONSTANT.
3116  *
3117  * Since: 2.20
3118  */
3119
3120
3121 /**
3122  * G_GOFFSET_FORMAT:
3123  *
3124  * This is the platform dependent conversion specifier for scanning
3125  * and printing values of type #goffset. See also #G_GINT64_FORMAT.
3126  *
3127  * Since: 2.20
3128  */
3129
3130
3131 /**
3132  * G_GOFFSET_MODIFIER:
3133  *
3134  * The platform dependent length modifier for conversion specifiers
3135  * for scanning and printing values of type #goffset. It is a string
3136  * literal. See also #G_GINT64_MODIFIER.
3137  *
3138  * Since: 2.20
3139  */
3140
3141
3142 /**
3143  * G_GSIZE_FORMAT:
3144  *
3145  * This is the platform dependent conversion specifier for scanning
3146  * and printing values of type #gsize. See also #G_GINT16_FORMAT.
3147  *
3148  * Since: 2.6
3149  */
3150
3151
3152 /**
3153  * G_GSIZE_MODIFIER:
3154  *
3155  * The platform dependent length modifier for conversion specifiers
3156  * for scanning and printing values of type #gsize or #gssize. It
3157  * is a string literal.
3158  *
3159  * Since: 2.6
3160  */
3161
3162
3163 /**
3164  * G_GSSIZE_FORMAT:
3165  *
3166  * This is the platform dependent conversion specifier for scanning
3167  * and printing values of type #gssize. See also #G_GINT16_FORMAT.
3168  *
3169  * Since: 2.6
3170  */
3171
3172
3173 /**
3174  * G_GUINT16_FORMAT:
3175  *
3176  * This is the platform dependent conversion specifier for scanning
3177  * and printing values of type #guint16. See also #G_GINT16_FORMAT
3178  */
3179
3180
3181 /**
3182  * G_GUINT32_FORMAT:
3183  *
3184  * This is the platform dependent conversion specifier for scanning
3185  * and printing values of type #guint32. See also #G_GINT16_FORMAT.
3186  */
3187
3188
3189 /**
3190  * G_GUINT64_CONSTANT:
3191  * @val: a literal integer value, e.g. 0x1d636b02300a7aa7U
3192  *
3193  * This macro is used to insert 64-bit unsigned integer
3194  * literals into the source code.
3195  *
3196  * Since: 2.10
3197  */
3198
3199
3200 /**
3201  * G_GUINT64_FORMAT:
3202  *
3203  * This is the platform dependent conversion specifier for scanning
3204  * and printing values of type #guint64. See also #G_GINT16_FORMAT.
3205  *
3206  * <note><para>
3207  * Some platforms do not support scanning and printing 64 bit integers,
3208  * even though the types are supported. On such platforms #G_GUINT64_FORMAT
3209  * is not defined.  Note that scanf() may not support 64 bit integers, even
3210  * if #G_GINT64_FORMAT is defined. Due to its weak error handling, scanf()
3211  * is not recommended for parsing anyway; consider using g_ascii_strtoull()
3212  * instead.
3213  * </para></note>
3214  */
3215
3216
3217 /**
3218  * G_GUINTPTR_FORMAT:
3219  *
3220  * This is the platform dependent conversion specifier
3221  * for scanning and printing values of type #guintptr.
3222  *
3223  * Since: 2.22
3224  */
3225
3226
3227 /**
3228  * G_HOOK:
3229  * @hook: a pointer
3230  *
3231  * Casts a pointer to a <literal>GHook*</literal>.
3232  */
3233
3234
3235 /**
3236  * G_HOOK_ACTIVE:
3237  * @hook: a #GHook
3238  *
3239  * Returns %TRUE if the #GHook is active, which is normally the case
3240  * until the #GHook is destroyed.
3241  *
3242  * Returns: %TRUE if the #GHook is active
3243  */
3244
3245
3246 /**
3247  * G_HOOK_FLAGS:
3248  * @hook: a #GHook
3249  *
3250  * Gets the flags of a hook.
3251  */
3252
3253
3254 /**
3255  * G_HOOK_FLAG_USER_SHIFT:
3256  *
3257  * The position of the first bit which is not reserved for internal
3258  * use be the #GHook implementation, i.e.
3259  * <literal>1 &lt;&lt; G_HOOK_FLAG_USER_SHIFT</literal> is the first
3260  * bit which can be used for application-defined flags.
3261  */
3262
3263
3264 /**
3265  * G_HOOK_IN_CALL:
3266  * @hook: a #GHook
3267  *
3268  * Returns %TRUE if the #GHook function is currently executing.
3269  *
3270  * Returns: %TRUE if the #GHook function is currently executing
3271  */
3272
3273
3274 /**
3275  * G_HOOK_IS_UNLINKED:
3276  * @hook: a #GHook
3277  *
3278  * Returns %TRUE if the #GHook is not in a #GHookList.
3279  *
3280  * Returns: %TRUE if the #GHook is not in a #GHookList
3281  */
3282
3283
3284 /**
3285  * G_HOOK_IS_VALID:
3286  * @hook: a #GHook
3287  *
3288  * Returns %TRUE if the #GHook is valid, i.e. it is in a #GHookList,
3289  * it is active and it has not been destroyed.
3290  *
3291  * Returns: %TRUE if the #GHook is valid
3292  */
3293
3294
3295 /**
3296  * G_IEEE754_DOUBLE_BIAS:
3297  *
3298  * The bias by which exponents in double-precision floats are offset.
3299  */
3300
3301
3302 /**
3303  * G_IEEE754_FLOAT_BIAS:
3304  *
3305  * The bias by which exponents in single-precision floats are offset.
3306  */
3307
3308
3309 /**
3310  * G_INLINE_FUNC:
3311  *
3312  * This macro is used to export function prototypes so they can be linked
3313  * with an external version when no inlining is performed. The file which
3314  * implements the functions should define <literal>G_IMPLEMENTS_INLINES</literal>
3315  * before including the headers which contain %G_INLINE_FUNC declarations.
3316  * Since inlining is very compiler-dependent using these macros correctly
3317  * is very difficult. Their use is strongly discouraged.
3318  *
3319  * This macro is often mistaken for a replacement for the inline keyword;
3320  * inline is already declared in a portable manner in the GLib headers
3321  * and can be used normally.
3322  */
3323
3324
3325 /**
3326  * G_IO_CHANNEL_ERROR:
3327  *
3328  * Error domain for #GIOChannel operations. Errors in this domain will
3329  * be from the #GIOChannelError enumeration. See #GError for
3330  * information on error domains.
3331  */
3332
3333
3334 /**
3335  * G_IO_FLAG_IS_WRITEABLE:
3336  *
3337  * This is a misspelled version of G_IO_FLAG_IS_WRITABLE that existed
3338  * before the spelling was fixed in GLib 2.30.  It is kept here for
3339  * compatibility reasons.
3340  *
3341  * Deprecated: 2.30:Use G_IO_FLAG_IS_WRITABLE instead.
3342  */
3343
3344
3345 /**
3346  * G_IS_DIR_SEPARATOR:
3347  * @c: a character
3348  *
3349  * Checks whether a character is a directory
3350  * separator. It returns %TRUE for '/' on UNIX
3351  * machines and for '\' or '/' under Windows.
3352  *
3353  * Since: 2.6
3354  */
3355
3356
3357 /**
3358  * G_KEY_FILE_DESKTOP_GROUP:
3359  *
3360  * The name of the main group of a desktop entry file, as defined in the
3361  * <ulink url="http://freedesktop.org/Standards/desktop-entry-spec">Desktop
3362  * Entry Specification</ulink>. Consult the specification for more
3363  * details about the meanings of the keys below.
3364  *
3365  * Since: 2.14
3366  */
3367
3368
3369 /**
3370  * G_KEY_FILE_DESKTOP_KEY_CATEGORIES:
3371  *
3372  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a list
3373  * of strings giving the categories in which the desktop entry
3374  * should be shown in a menu.
3375  *
3376  * Since: 2.14
3377  */
3378
3379
3380 /**
3381  * G_KEY_FILE_DESKTOP_KEY_COMMENT:
3382  *
3383  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a localized
3384  * string giving the tooltip for the desktop entry.
3385  *
3386  * Since: 2.14
3387  */
3388
3389
3390 /**
3391  * G_KEY_FILE_DESKTOP_KEY_EXEC:
3392  *
3393  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a string
3394  * giving the command line to execute. It is only valid for desktop
3395  * entries with the <literal>Application</literal> type.
3396  *
3397  * Since: 2.14
3398  */
3399
3400
3401 /**
3402  * G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME:
3403  *
3404  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a localized
3405  * string giving the generic name of the desktop entry.
3406  *
3407  * Since: 2.14
3408  */
3409
3410
3411 /**
3412  * G_KEY_FILE_DESKTOP_KEY_HIDDEN:
3413  *
3414  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a boolean
3415  * stating whether the desktop entry has been deleted by the user.
3416  *
3417  * Since: 2.14
3418  */
3419
3420
3421 /**
3422  * G_KEY_FILE_DESKTOP_KEY_ICON:
3423  *
3424  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a localized
3425  * string giving the name of the icon to be displayed for the desktop
3426  * entry.
3427  *
3428  * Since: 2.14
3429  */
3430
3431
3432 /**
3433  * G_KEY_FILE_DESKTOP_KEY_MIME_TYPE:
3434  *
3435  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a list
3436  * of strings giving the MIME types supported by this desktop entry.
3437  *
3438  * Since: 2.14
3439  */
3440
3441
3442 /**
3443  * G_KEY_FILE_DESKTOP_KEY_NAME:
3444  *
3445  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a localized
3446  * string giving the specific name of the desktop entry.
3447  *
3448  * Since: 2.14
3449  */
3450
3451
3452 /**
3453  * G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN:
3454  *
3455  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a list of
3456  * strings identifying the environments that should not display the
3457  * desktop entry.
3458  *
3459  * Since: 2.14
3460  */
3461
3462
3463 /**
3464  * G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY:
3465  *
3466  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a boolean
3467  * stating whether the desktop entry should be shown in menus.
3468  *
3469  * Since: 2.14
3470  */
3471
3472
3473 /**
3474  * G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN:
3475  *
3476  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a list of
3477  * strings identifying the environments that should display the
3478  * desktop entry.
3479  *
3480  * Since: 2.14
3481  */
3482
3483
3484 /**
3485  * G_KEY_FILE_DESKTOP_KEY_PATH:
3486  *
3487  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a string
3488  * containing the working directory to run the program in. It is only
3489  * valid for desktop entries with the <literal>Application</literal> type.
3490  *
3491  * Since: 2.14
3492  */
3493
3494
3495 /**
3496  * G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY:
3497  *
3498  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a boolean
3499  * stating whether the application supports the <ulink
3500  * url="http://www.freedesktop.org/Standards/startup-notification-spec">Startup
3501  * Notification Protocol Specification</ulink>.
3502  *
3503  * Since: 2.14
3504  */
3505
3506
3507 /**
3508  * G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS:
3509  *
3510  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is string
3511  * identifying the WM class or name hint of a window that the application
3512  * will create, which can be used to emulate Startup Notification with
3513  * older applications.
3514  *
3515  * Since: 2.14
3516  */
3517
3518
3519 /**
3520  * G_KEY_FILE_DESKTOP_KEY_TERMINAL:
3521  *
3522  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a boolean
3523  * stating whether the program should be run in a terminal window.
3524  * It is only valid for desktop entries with the
3525  * <literal>Application</literal> type.
3526  *
3527  * Since: 2.14
3528  */
3529
3530
3531 /**
3532  * G_KEY_FILE_DESKTOP_KEY_TRY_EXEC:
3533  *
3534  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a string
3535  * giving the file name of a binary on disk used to determine if the
3536  * program is actually installed. It is only valid for desktop entries
3537  * with the <literal>Application</literal> type.
3538  *
3539  * Since: 2.14
3540  */
3541
3542
3543 /**
3544  * G_KEY_FILE_DESKTOP_KEY_TYPE:
3545  *
3546  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a string
3547  * giving the type of the desktop entry. Usually
3548  * #G_KEY_FILE_DESKTOP_TYPE_APPLICATION,
3549  * #G_KEY_FILE_DESKTOP_TYPE_LINK, or
3550  * #G_KEY_FILE_DESKTOP_TYPE_DIRECTORY.
3551  *
3552  * Since: 2.14
3553  */
3554
3555
3556 /**
3557  * G_KEY_FILE_DESKTOP_KEY_URL:
3558  *
3559  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a string
3560  * giving the URL to access. It is only valid for desktop entries
3561  * with the <literal>Link</literal> type.
3562  *
3563  * Since: 2.14
3564  */
3565
3566
3567 /**
3568  * G_KEY_FILE_DESKTOP_KEY_VERSION:
3569  *
3570  * A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a string
3571  * giving the version of the Desktop Entry Specification used for
3572  * the desktop entry file.
3573  *
3574  * Since: 2.14
3575  */
3576
3577
3578 /**
3579  * G_KEY_FILE_DESKTOP_TYPE_APPLICATION:
3580  *
3581  * The value of the #G_KEY_FILE_DESKTOP_KEY_TYPE, key for desktop
3582  * entries representing applications.
3583  *
3584  * Since: 2.14
3585  */
3586
3587
3588 /**
3589  * G_KEY_FILE_DESKTOP_TYPE_DIRECTORY:
3590  *
3591  * The value of the #G_KEY_FILE_DESKTOP_KEY_TYPE, key for desktop
3592  * entries representing directories.
3593  *
3594  * Since: 2.14
3595  */
3596
3597
3598 /**
3599  * G_KEY_FILE_DESKTOP_TYPE_LINK:
3600  *
3601  * The value of the #G_KEY_FILE_DESKTOP_KEY_TYPE, key for desktop
3602  * entries representing links to documents.
3603  *
3604  * Since: 2.14
3605  */
3606
3607
3608 /**
3609  * G_KEY_FILE_ERROR:
3610  *
3611  * Error domain for key file parsing. Errors in this domain will
3612  * be from the #GKeyFileError enumeration.
3613  *
3614  * See #GError for information on error domains.
3615  */
3616
3617
3618 /**
3619  * G_LIKELY:
3620  * @expr: the expression
3621  *
3622  * Hints the compiler that the expression is likely to evaluate to
3623  * a true value. The compiler may use this information for optimizations.
3624  *
3625  * |[
3626  * if (G_LIKELY (random () != 1))
3627  *   g_print ("not one");
3628  * ]|
3629  *
3630  * Returns: the value of @expr
3631  * Since: 2.2
3632  */
3633
3634
3635 /**
3636  * G_LITTLE_ENDIAN:
3637  *
3638  * Specifies one of the possible types of byte order.
3639  * See #G_BYTE_ORDER.
3640  */
3641
3642
3643 /**
3644  * G_LN10:
3645  *
3646  * The natural logarithm of 10.
3647  */
3648
3649
3650 /**
3651  * G_LN2:
3652  *
3653  * The natural logarithm of 2.
3654  */
3655
3656
3657 /**
3658  * G_LOCK:
3659  * @name: the name of the lock
3660  *
3661  * Works like g_mutex_lock(), but for a lock defined with
3662  * #G_LOCK_DEFINE.
3663  */
3664
3665
3666 /**
3667  * G_LOCK_DEFINE:
3668  * @name: the name of the lock
3669  *
3670  * The <literal>G_LOCK_*</literal> macros provide a convenient interface to #GMutex.
3671  * #G_LOCK_DEFINE defines a lock. It can appear in any place where
3672  * variable definitions may appear in programs, i.e. in the first block
3673  * of a function or outside of functions. The @name parameter will be
3674  * mangled to get the name of the #GMutex. This means that you
3675  * can use names of existing variables as the parameter - e.g. the name
3676  * of the variable you intend to protect with the lock. Look at our
3677  * <function>give_me_next_number()</function> example using the
3678  * <literal>G_LOCK_*</literal> macros:
3679  *
3680  * <example>
3681  *  <title>Using the <literal>G_LOCK_*</literal> convenience macros</title>
3682  *  <programlisting>
3683  *   G_LOCK_DEFINE (current_number);
3684  *
3685  *   int
3686  *   give_me_next_number (void)
3687  *   {
3688  *     static int current_number = 0;
3689  *     int ret_val;
3690  *
3691  *     G_LOCK (current_number);
3692  *     ret_val = current_number = calc_next_number (current_number);
3693  *     G_UNLOCK (current_number);
3694  *
3695  *     return ret_val;
3696  *   }
3697  *  </programlisting>
3698  * </example>
3699  */
3700
3701
3702 /**
3703  * G_LOCK_DEFINE_STATIC:
3704  * @name: the name of the lock
3705  *
3706  * This works like #G_LOCK_DEFINE, but it creates a static object.
3707  */
3708
3709
3710 /**
3711  * G_LOCK_EXTERN:
3712  * @name: the name of the lock
3713  *
3714  * This declares a lock, that is defined with #G_LOCK_DEFINE in another
3715  * module.
3716  */
3717
3718
3719 /**
3720  * G_LOG_2_BASE_10:
3721  *
3722  * Multiplying the base 2 exponent by this number yields the base 10 exponent.
3723  */
3724
3725
3726 /**
3727  * G_LOG_DOMAIN:
3728  *
3729  * Defines the log domain.
3730  *
3731  * For applications, this is typically left as the default %NULL
3732  * (or "") domain. Libraries should define this so that any messages
3733  * which they log can be differentiated from messages from other
3734  * libraries and application code. But be careful not to define
3735  * it in any public header files.
3736  *
3737  * For example, GTK+ uses this in its Makefile.am:
3738  * |[
3739  * INCLUDES = -DG_LOG_DOMAIN=\"Gtk\"
3740  * ]|
3741  */
3742
3743
3744 /**
3745  * G_LOG_FATAL_MASK:
3746  *
3747  * GLib log levels that are considered fatal by default.
3748  */
3749
3750
3751 /**
3752  * G_MAXDOUBLE:
3753  *
3754  * The maximum value which can be held in a #gdouble.
3755  */
3756
3757
3758 /**
3759  * G_MAXFLOAT:
3760  *
3761  * The maximum value which can be held in a #gfloat.
3762  */
3763
3764
3765 /**
3766  * G_MAXINT:
3767  *
3768  * The maximum value which can be held in a #gint.
3769  */
3770
3771
3772 /**
3773  * G_MAXINT16:
3774  *
3775  * The maximum value which can be held in a #gint16.
3776  *
3777  * Since: 2.4
3778  */
3779
3780
3781 /**
3782  * G_MAXINT32:
3783  *
3784  * The maximum value which can be held in a #gint32.
3785  *
3786  * Since: 2.4
3787  */
3788
3789
3790 /**
3791  * G_MAXINT64:
3792  *
3793  * The maximum value which can be held in a #gint64.
3794  */
3795
3796
3797 /**
3798  * G_MAXINT8:
3799  *
3800  * The maximum value which can be held in a #gint8.
3801  *
3802  * Since: 2.4
3803  */
3804
3805
3806 /**
3807  * G_MAXLONG:
3808  *
3809  * The maximum value which can be held in a #glong.
3810  */
3811
3812
3813 /**
3814  * G_MAXOFFSET:
3815  *
3816  * The maximum value which can be held in a #goffset.
3817  */
3818
3819
3820 /**
3821  * G_MAXSHORT:
3822  *
3823  * The maximum value which can be held in a #gshort.
3824  */
3825
3826
3827 /**
3828  * G_MAXSIZE:
3829  *
3830  * The maximum value which can be held in a #gsize.
3831  *
3832  * Since: 2.4
3833  */
3834
3835
3836 /**
3837  * G_MAXSSIZE:
3838  *
3839  * The maximum value which can be held in a #gssize.
3840  *
3841  * Since: 2.14
3842  */
3843
3844
3845 /**
3846  * G_MAXUINT:
3847  *
3848  * The maximum value which can be held in a #guint.
3849  */
3850
3851
3852 /**
3853  * G_MAXUINT16:
3854  *
3855  * The maximum value which can be held in a #guint16.
3856  *
3857  * Since: 2.4
3858  */
3859
3860
3861 /**
3862  * G_MAXUINT32:
3863  *
3864  * The maximum value which can be held in a #guint32.
3865  *
3866  * Since: 2.4
3867  */
3868
3869
3870 /**
3871  * G_MAXUINT64:
3872  *
3873  * The maximum value which can be held in a #guint64.
3874  */
3875
3876
3877 /**
3878  * G_MAXUINT8:
3879  *
3880  * The maximum value which can be held in a #guint8.
3881  *
3882  * Since: 2.4
3883  */
3884
3885
3886 /**
3887  * G_MAXULONG:
3888  *
3889  * The maximum value which can be held in a #gulong.
3890  */
3891
3892
3893 /**
3894  * G_MAXUSHORT:
3895  *
3896  * The maximum value which can be held in a #gushort.
3897  */
3898
3899
3900 /**
3901  * G_MINDOUBLE:
3902  *
3903  * The minimum positive value which can be held in a #gdouble.
3904  *
3905  * If you are interested in the smallest value which can be held
3906  * in a #gdouble, use -G_MAXDOUBLE.
3907  */
3908
3909
3910 /**
3911  * G_MINFLOAT:
3912  *
3913  * The minimum positive value which can be held in a #gfloat.
3914  *
3915  * If you are interested in the smallest value which can be held
3916  * in a #gfloat, use -G_MAXFLOAT.
3917  */
3918
3919
3920 /**
3921  * G_MININT:
3922  *
3923  * The minimum value which can be held in a #gint.
3924  */
3925
3926
3927 /**
3928  * G_MININT16:
3929  *
3930  * The minimum value which can be held in a #gint16.
3931  *
3932  * Since: 2.4
3933  */
3934
3935
3936 /**
3937  * G_MININT32:
3938  *
3939  * The minimum value which can be held in a #gint32.
3940  *
3941  * Since: 2.4
3942  */
3943
3944
3945 /**
3946  * G_MININT64:
3947  *
3948  * The minimum value which can be held in a #gint64.
3949  */
3950
3951
3952 /**
3953  * G_MININT8:
3954  *
3955  * The minimum value which can be held in a #gint8.
3956  *
3957  * Since: 2.4
3958  */
3959
3960
3961 /**
3962  * G_MINLONG:
3963  *
3964  * The minimum value which can be held in a #glong.
3965  */
3966
3967
3968 /**
3969  * G_MINOFFSET:
3970  *
3971  * The minimum value which can be held in a #goffset.
3972  */
3973
3974
3975 /**
3976  * G_MINSHORT:
3977  *
3978  * The minimum value which can be held in a #gshort.
3979  */
3980
3981
3982 /**
3983  * G_MINSSIZE:
3984  *
3985  * The minimum value which can be held in a #gssize.
3986  *
3987  * Since: 2.14
3988  */
3989
3990
3991 /**
3992  * G_N_ELEMENTS:
3993  * @arr: the array
3994  *
3995  * Determines the number of elements in an array. The array must be
3996  * declared so the compiler knows its size at compile-time; this
3997  * macro will not work on an array allocated on the heap, only static
3998  * arrays or arrays on the stack.
3999  */
4000
4001
4002 /**
4003  * G_ONCE_INIT:
4004  *
4005  * A #GOnce must be initialized with this macro before it can be used.
4006  *
4007  * |[
4008  *   GOnce my_once = G_ONCE_INIT;
4009  * ]|
4010  *
4011  * Since: 2.4
4012  */
4013
4014
4015 /**
4016  * G_OS_BEOS:
4017  *
4018  * This macro is defined only on BeOS. So you can bracket
4019  * BeOS-specific code in "&num;ifdef G_OS_BEOS".
4020  */
4021
4022
4023 /**
4024  * G_OS_UNIX:
4025  *
4026  * This macro is defined only on UNIX. So you can bracket
4027  * UNIX-specific code in "&num;ifdef G_OS_UNIX".
4028  */
4029
4030
4031 /**
4032  * G_OS_WIN32:
4033  *
4034  * This macro is defined only on Windows. So you can bracket
4035  * Windows-specific code in "&num;ifdef G_OS_WIN32".
4036  */
4037
4038
4039 /**
4040  * G_PASTE:
4041  * @identifier1: an identifier
4042  * @identifier2: an identifier
4043  *
4044  * Yields a new preprocessor pasted identifier
4045  * <code>identifier1identifier2</code> from its expanded
4046  * arguments @identifier1 and @identifier2. For example,
4047  * the following code:
4048  * |[
4049  * #define GET(traveller,method) G_PASTE(traveller_get_, method) (traveller)
4050  * const gchar *name = GET (traveller, name);
4051  * const gchar *quest = GET (traveller, quest);
4052  * GdkColor *favourite = GET (traveller, favourite_colour);
4053  * ]|
4054  *
4055  * is transformed by the preprocessor into:
4056  * |[
4057  * const gchar *name = traveller_get_name (traveller);
4058  * const gchar *quest = traveller_get_quest (traveller);
4059  * GdkColor *favourite = traveller_get_favourite_colour (traveller);
4060  * ]|
4061  *
4062  * Since: 2.20
4063  */
4064
4065
4066 /**
4067  * G_PDP_ENDIAN:
4068  *
4069  * Specifies one of the possible types of byte order
4070  * (currently unused). See #G_BYTE_ORDER.
4071  */
4072
4073
4074 /**
4075  * G_PI:
4076  *
4077  * The value of pi (ratio of circle's circumference to its diameter).
4078  */
4079
4080
4081 /**
4082  * G_PI_2:
4083  *
4084  * Pi divided by 2.
4085  */
4086
4087
4088 /**
4089  * G_PI_4:
4090  *
4091  * Pi divided by 4.
4092  */
4093
4094
4095 /**
4096  * G_PRIVATE_INIT:
4097  * @notify: a #GDestroyNotify
4098  *
4099  * A macro to assist with the static initialisation of a #GPrivate.
4100  *
4101  * This macro is useful for the case that a #GDestroyNotify function
4102  * should be associated the key.  This is needed when the key will be
4103  * used to point at memory that should be deallocated when the thread
4104  * exits.
4105  *
4106  * Additionally, the #GDestroyNotify will also be called on the previous
4107  * value stored in the key when g_private_replace() is used.
4108  *
4109  * If no #GDestroyNotify is needed, then use of this macro is not
4110  * required -- if the #GPrivate is declared in static scope then it will
4111  * be properly initialised by default (ie: to all zeros).  See the
4112  * examples below.
4113  *
4114  * |[
4115  * static GPrivate name_key = G_PRIVATE_INIT (g_free);
4116  *
4117  * // return value should not be freed
4118  * const gchar *
4119  * get_local_name (void)
4120  * {
4121  *   return g_private_get (&name_key);
4122  * }
4123  *
4124  * void
4125  * set_local_name (const gchar *name)
4126  * {
4127  *   g_private_replace (&name_key, g_strdup (name));
4128  * }
4129  *
4130  *
4131  * static GPrivate count_key;   // no free function
4132  *
4133  * gint
4134  * get_local_count (void)
4135  * {
4136  *   return GPOINTER_TO_INT (g_private_get (&count_key));
4137  * }
4138  *
4139  * void
4140  * set_local_count (gint count)
4141  * {
4142  *   g_private_set (&count_key, GINT_TO_POINTER (count));
4143  * }
4144  * ]|
4145  *
4146  * Since: 2.32
4147  */
4148
4149
4150 /**
4151  * G_SEARCHPATH_SEPARATOR:
4152  *
4153  * The search path separator character.
4154  * This is ':' on UNIX machines and ';' under Windows.
4155  */
4156
4157
4158 /**
4159  * G_SEARCHPATH_SEPARATOR_S:
4160  *
4161  * The search path separator as a string.
4162  * This is ":" on UNIX machines and ";" under Windows.
4163  */
4164
4165
4166 /**
4167  * G_SHELL_ERROR:
4168  *
4169  * Error domain for shell functions. Errors in this domain will be from
4170  * the #GShellError enumeration. See #GError for information on error
4171  * domains.
4172  */
4173
4174
4175 /**
4176  * G_SQRT2:
4177  *
4178  * The square root of two.
4179  */
4180
4181
4182 /**
4183  * G_STATIC_ASSERT:
4184  * @expr: a constant expression
4185  *
4186  * The G_STATIC_ASSERT macro lets the programmer check
4187  * a condition at compile time, the condition needs to
4188  * be compile time computable. The macro can be used in
4189  * any place where a <literal>typedef</literal> is valid.
4190  *
4191  * <note><para>
4192  * A <literal>typedef</literal> is generally allowed in
4193  * exactly the same places that a variable declaration is
4194  * allowed. For this reason, you should not use
4195  * <literal>G_STATIC_ASSERT</literal> in the middle of
4196  * blocks of code.
4197  * </para></note>
4198  *
4199  * The macro should only be used once per source code line.
4200  *
4201  * Since: 2.20
4202  */
4203
4204
4205 /**
4206  * G_STATIC_ASSERT_EXPR:
4207  * @expr: a constant expression
4208  *
4209  * The G_STATIC_ASSERT_EXPR macro lets the programmer check
4210  * a condition at compile time. The condition needs to be
4211  * compile time computable.
4212  *
4213  * Unlike <literal>G_STATIC_ASSERT</literal>, this macro
4214  * evaluates to an expression and, as such, can be used in
4215  * the middle of other expressions. Its value should be
4216  * ignored. This can be accomplished by placing it as
4217  * the first argument of a comma expression.
4218  *
4219  * |[
4220  * #define ADD_ONE_TO_INT(x) \
4221  *   (G_STATIC_ASSERT_EXPR(sizeof (x) == sizeof (int)), ((x) + 1))
4222  * ]|
4223  *
4224  * Since: 2.30
4225  */
4226
4227
4228 /**
4229  * G_STMT_END:
4230  *
4231  * Used within multi-statement macros so that they can be used in places
4232  * where only one statement is expected by the compiler.
4233  */
4234
4235
4236 /**
4237  * G_STMT_START:
4238  *
4239  * Used within multi-statement macros so that they can be used in places
4240  * where only one statement is expected by the compiler.
4241  */
4242
4243
4244 /**
4245  * G_STRFUNC:
4246  *
4247  * Expands to a string identifying the current function.
4248  *
4249  * Since: 2.4
4250  */
4251
4252
4253 /**
4254  * G_STRINGIFY:
4255  * @macro_or_string: a macro or a string
4256  *
4257  * Accepts a macro or a string and converts it into a string after
4258  * preprocessor argument expansion. For example, the following code:
4259  *
4260  * |[
4261  * #define AGE 27
4262  * const gchar *greeting = G_STRINGIFY (AGE) " today!";
4263  * ]|
4264  *
4265  * is transformed by the preprocessor into (code equivalent to):
4266  *
4267  * |[
4268  * const gchar *greeting = "27 today!";
4269  * ]|
4270  */
4271
4272
4273 /**
4274  * G_STRLOC:
4275  *
4276  * Expands to a string identifying the current code position.
4277  */
4278
4279
4280 /**
4281  * G_STRUCT_MEMBER:
4282  * @member_type: the type of the struct field
4283  * @struct_p: a pointer to a struct
4284  * @struct_offset: the offset of the field from the start of the struct, in bytes
4285  *
4286  * Returns a member of a structure at a given offset, using the given type.
4287  *
4288  * Returns: the struct member
4289  */
4290
4291
4292 /**
4293  * G_STRUCT_MEMBER_P:
4294  * @struct_p: a pointer to a struct
4295  * @struct_offset: the offset from the start of the struct, in bytes
4296  *
4297  * Returns an untyped pointer to a given offset of a struct.
4298  *
4299  * Returns: an untyped pointer to @struct_p plus @struct_offset bytes
4300  */
4301
4302
4303 /**
4304  * G_STRUCT_OFFSET:
4305  * @struct_type: a structure type, e.g. <structname>GtkWidget</structname>
4306  * @member: a field in the structure, e.g. <structfield>window</structfield>
4307  *
4308  * Returns the offset, in bytes, of a member of a struct.
4309  *
4310  * Returns: the offset of @member from the start of @struct_type
4311  */
4312
4313
4314 /**
4315  * G_STR_DELIMITERS:
4316  *
4317  * The standard delimiters, used in g_strdelimit().
4318  */
4319
4320
4321 /**
4322  * G_THREAD_ERROR:
4323  *
4324  * The error domain of the GLib thread subsystem.
4325  */
4326
4327
4328 /**
4329  * G_TRYLOCK:
4330  * @name: the name of the lock
4331  *
4332  * Works like g_mutex_trylock(), but for a lock defined with
4333  * #G_LOCK_DEFINE.
4334  *
4335  * Returns: %TRUE, if the lock could be locked.
4336  */
4337
4338
4339 /**
4340  * G_UNAVAILABLE:
4341  * @maj: the major version that introduced the symbol
4342  * @min: the minor version that introduced the symbol
4343  *
4344  * This macro can be used to mark a function declaration as unavailable.
4345  * It must be placed before the function declaration. Use of a function
4346  * that has been annotated with this macros will produce a compiler warning.
4347  *
4348  * Since: 2.32
4349  */
4350
4351
4352 /**
4353  * G_UNLIKELY:
4354  * @expr: the expression
4355  *
4356  * Hints the compiler that the expression is unlikely to evaluate to
4357  * a true value. The compiler may use this information for optimizations.
4358  *
4359  * |[
4360  * if (G_UNLIKELY (random () == 1))
4361  *   g_print ("a random one");
4362  * ]|
4363  *
4364  * Returns: the value of @expr
4365  * Since: 2.2
4366  */
4367
4368
4369 /**
4370  * G_UNLOCK:
4371  * @name: the name of the lock
4372  *
4373  * Works like g_mutex_unlock(), but for a lock defined with
4374  * #G_LOCK_DEFINE.
4375  */
4376
4377
4378 /**
4379  * G_USEC_PER_SEC:
4380  *
4381  * Number of microseconds in one second (1 million).
4382  * This macro is provided for code readability.
4383  */
4384
4385
4386 /**
4387  * G_VARIANT_PARSE_ERROR:
4388  *
4389  * Error domain for GVariant text format parsing.  Specific error codes
4390  * are not currently defined for this domain.  See #GError for
4391  * information on error domains.
4392  */
4393
4394
4395 /**
4396  * G_VA_COPY:
4397  * @ap1: the <type>va_list</type> variable to place a copy of @ap2 in
4398  * @ap2: a <type>va_list</type>
4399  *
4400  * Portable way to copy <type>va_list</type> variables.
4401  *
4402  * In order to use this function, you must include
4403  * <filename>string.h</filename> yourself, because this macro may
4404  * use memmove() and GLib does not include <filename>string.h</filename>
4405  * for you.
4406  */
4407
4408
4409 /**
4410  * G_WIN32_DLLMAIN_FOR_DLL_NAME:
4411  * @static: empty or "static"
4412  * @dll_name: the name of the (pointer to the) char array where the DLL name will be stored. If this is used, you must also include <filename>windows.h</filename>. If you need a more complex DLL entry point function, you cannot use this
4413  *
4414  * On Windows, this macro defines a DllMain() function that stores
4415  * the actual DLL name that the code being compiled will be included in.
4416  *
4417  * On non-Windows platforms, expands to nothing.
4418  */
4419
4420
4421 /**
4422  * G_WIN32_HAVE_WIDECHAR_API:
4423  *
4424  * On Windows, this macro defines an expression which evaluates to
4425  * %TRUE if the code is running on a version of Windows where the wide
4426  * character versions of the Win32 API functions, and the wide character
4427  * versions of the C library functions work. (They are always present in
4428  * the DLLs, but don't work on Windows 9x and Me.)
4429  *
4430  * On non-Windows platforms, it is not defined.
4431  *
4432  * Since: 2.6
4433  */
4434
4435
4436 /**
4437  * G_WIN32_IS_NT_BASED:
4438  *
4439  * On Windows, this macro defines an expression which evaluates to
4440  * %TRUE if the code is running on an NT-based Windows operating system.
4441  *
4442  * On non-Windows platforms, it is not defined.
4443  *
4444  * Since: 2.6
4445  */
4446
4447
4448 /**
4449  * MAX:
4450  * @a: a numeric value
4451  * @b: a numeric value
4452  *
4453  * Calculates the maximum of @a and @b.
4454  *
4455  * Returns: the maximum of @a and @b.
4456  */
4457
4458
4459 /**
4460  * MAXPATHLEN:
4461  *
4462  * Provided for UNIX emulation on Windows; equivalent to UNIX
4463  * macro %MAXPATHLEN, which is the maximum length of a filename
4464  * (including full path).
4465  */
4466
4467
4468 /**
4469  * MIN:
4470  * @a: a numeric value
4471  * @b: a numeric value
4472  *
4473  * Calculates the minimum of @a and @b.
4474  *
4475  * Returns: the minimum of @a and @b.
4476  */
4477
4478
4479 /**
4480  * NC_:
4481  * @Context: a message context, must be a string literal
4482  * @String: a message id, must be a string literal
4483  *
4484  * Only marks a string for translation, with context.
4485  * This is useful in situations where the translated strings can't
4486  * be directly used, e.g. in string array initializers. To get the
4487  * translated string, you should call g_dpgettext2() at runtime.
4488  *
4489  * |[
4490  * {
4491  *   static const char *messages[] = {
4492  *     NC_("some context", "some very meaningful message"),
4493  *     NC_("some context", "and another one")
4494  *   };
4495  *   const char *string;
4496  *   ...
4497  *   string
4498  *     = index &gt; 1 ? g_dpgettext2 (NULL, "some context", "a default message")
4499  *                    : g_dpgettext2 (NULL, "some context", messages[index]);
4500  *
4501  *   fputs (string);
4502  *   ...
4503  * }
4504  * ]|
4505  *
4506  * <note><para>If you are using the NC_() macro, you need to make sure
4507  * that you pass <option>--keyword=NC_:1c,2</option> to xgettext when
4508  * extracting messages. Note that this only works with GNU gettext >= 0.15.
4509  * Intltool has support for the NC_() macro since version 0.40.1.
4510  * </para></note>
4511  *
4512  * Since: 2.18
4513  */
4514
4515
4516 /**
4517  * NULL:
4518  *
4519  * Defines the standard %NULL pointer.
4520  */
4521
4522
4523 /**
4524  * N_:
4525  * @String: the string to be translated
4526  *
4527  * Only marks a string for translation. This is useful in situations
4528  * where the translated strings can't be directly used, e.g. in string
4529  * array initializers. To get the translated string, call gettext()
4530  * at runtime.
4531  * |[
4532  * {
4533  *   static const char *messages[] = {
4534  *     N_("some very meaningful message"),
4535  *     N_("and another one")
4536  *   };
4537  *   const char *string;
4538  *   ...
4539  *   string
4540  *     = index &gt; 1 ? _("a default message") : gettext (messages[index]);
4541  *
4542  *   fputs (string);
4543  *   ...
4544  * }
4545  * ]|
4546  *
4547  * Since: 2.4
4548  */
4549
4550
4551 /**
4552  * Q_:
4553  * @String: the string to be translated, with a '|'-separated prefix which must not be translated
4554  *
4555  * Like _(), but handles context in message ids. This has the advantage
4556  * that the string can be adorned with a prefix to guarantee uniqueness
4557  * and provide context to the translator.
4558  *
4559  * One use case given in the gettext manual is GUI translation, where one
4560  * could e.g. disambiguate two "Open" menu entries as "File|Open" and
4561  * "Printer|Open". Another use case is the string "Russian" which may
4562  * have to be translated differently depending on whether it's the name
4563  * of a character set or a language. This could be solved by using
4564  * "charset|Russian" and "language|Russian".
4565  *
4566  * See the C_() macro for a different way to mark up translatable strings
4567  * with context.
4568  *
4569  * <note><para>If you are using the Q_() macro, you need to make sure
4570  * that you pass <option>--keyword=Q_</option> to xgettext when extracting
4571  * messages. If you are using GNU gettext >= 0.15, you can also use
4572  * <option>--keyword=Q_:1g</option> to let xgettext split the context
4573  * string off into a msgctxt line in the po file.</para></note>
4574  *
4575  * Returns: the translated message
4576  * Since: 2.4
4577  */
4578
4579
4580 /**
4581  * SECTION:arrays
4582  * @title: Arrays
4583  * @short_description: arrays of arbitrary elements which grow automatically as elements are added
4584  *
4585  * Arrays are similar to standard C arrays, except that they grow
4586  * automatically as elements are added.
4587  *
4588  * Array elements can be of any size (though all elements of one array
4589  * are the same size), and the array can be automatically cleared to
4590  * '0's and zero-terminated.
4591  *
4592  * To create a new array use g_array_new().
4593  *
4594  * To add elements to an array, use g_array_append_val(),
4595  * g_array_append_vals(), g_array_prepend_val(), and
4596  * g_array_prepend_vals().
4597  *
4598  * To access an element of an array, use g_array_index().
4599  *
4600  * To set the size of an array, use g_array_set_size().
4601  *
4602  * To free an array, use g_array_free().
4603  *
4604  * <example>
4605  *  <title>Using a #GArray to store #gint values</title>
4606  *  <programlisting>
4607  *   GArray *garray;
4608  *   gint i;
4609  *   /<!-- -->* We create a new array to store gint values.
4610  *      We don't want it zero-terminated or cleared to 0's. *<!-- -->/
4611  *   garray = g_array_new (FALSE, FALSE, sizeof (gint));
4612  *   for (i = 0; i &lt; 10000; i++)
4613  *     g_array_append_val (garray, i);
4614  *   for (i = 0; i &lt; 10000; i++)
4615  *     if (g_array_index (garray, gint, i) != i)
4616  *       g_print ("ERROR: got &percnt;d instead of &percnt;d\n",
4617  *                g_array_index (garray, gint, i), i);
4618  *   g_array_free (garray, TRUE);
4619  *  </programlisting>
4620  * </example>
4621  */
4622
4623
4624 /**
4625  * SECTION:arrays_byte
4626  * @title: Byte Arrays
4627  * @short_description: arrays of bytes
4628  *
4629  * #GByteArray is a mutable array of bytes based on #GArray, to provide arrays
4630  * of bytes which grow automatically as elements are added.
4631  *
4632  * To create a new #GByteArray use g_byte_array_new(). To add elements to a
4633  * #GByteArray, use g_byte_array_append(), and g_byte_array_prepend().
4634  *
4635  * To set the size of a #GByteArray, use g_byte_array_set_size().
4636  *
4637  * To free a #GByteArray, use g_byte_array_free().
4638  *
4639  * <example>
4640  *  <title>Using a #GByteArray</title>
4641  *  <programlisting>
4642  *   GByteArray *gbarray;
4643  *   gint i;
4644  *
4645  *   gbarray = g_byte_array_new (<!-- -->);
4646  *   for (i = 0; i &lt; 10000; i++)
4647  *     g_byte_array_append (gbarray, (guint8*) "abcd", 4);
4648  *
4649  *   for (i = 0; i &lt; 10000; i++)
4650  *     {
4651  *       g_assert (gbarray->data[4*i] == 'a');
4652  *       g_assert (gbarray->data[4*i+1] == 'b');
4653  *       g_assert (gbarray->data[4*i+2] == 'c');
4654  *       g_assert (gbarray->data[4*i+3] == 'd');
4655  *     }
4656  *
4657  *   g_byte_array_free (gbarray, TRUE);
4658  *  </programlisting>
4659  * </example>
4660  *
4661  * See #GBytes if you are interested in an immutable object representing a
4662  * sequence of bytes.
4663  */
4664
4665
4666 /**
4667  * SECTION:arrays_pointer
4668  * @title: Pointer Arrays
4669  * @short_description: arrays of pointers to any type of data, which grow automatically as new elements are added
4670  *
4671  * Pointer Arrays are similar to Arrays but are used only for storing
4672  * pointers.
4673  *
4674  * <note><para>If you remove elements from the array, elements at the
4675  * end of the array are moved into the space previously occupied by the
4676  * removed element. This means that you should not rely on the index of
4677  * particular elements remaining the same. You should also be careful
4678  * when deleting elements while iterating over the array.</para></note>
4679  *
4680  * To create a pointer array, use g_ptr_array_new().
4681  *
4682  * To add elements to a pointer array, use g_ptr_array_add().
4683  *
4684  * To remove elements from a pointer array, use g_ptr_array_remove(),
4685  * g_ptr_array_remove_index() or g_ptr_array_remove_index_fast().
4686  *
4687  * To access an element of a pointer array, use g_ptr_array_index().
4688  *
4689  * To set the size of a pointer array, use g_ptr_array_set_size().
4690  *
4691  * To free a pointer array, use g_ptr_array_free().
4692  *
4693  * <example>
4694  *  <title>Using a #GPtrArray</title>
4695  *  <programlisting>
4696  *   GPtrArray *gparray;
4697  *   gchar *string1 = "one", *string2 = "two", *string3 = "three";
4698  *
4699  *   gparray = g_ptr_array_new (<!-- -->);
4700  *   g_ptr_array_add (gparray, (gpointer) string1);
4701  *   g_ptr_array_add (gparray, (gpointer) string2);
4702  *   g_ptr_array_add (gparray, (gpointer) string3);
4703  *
4704  *   if (g_ptr_array_index (gparray, 0) != (gpointer) string1)
4705  *     g_print ("ERROR: got &percnt;p instead of &percnt;p\n",
4706  *              g_ptr_array_index (gparray, 0), string1);
4707  *
4708  *   g_ptr_array_free (gparray, TRUE);
4709  *  </programlisting>
4710  * </example>
4711  */
4712
4713
4714 /**
4715  * SECTION:async_queues
4716  * @title: Asynchronous Queues
4717  * @short_description: asynchronous communication between threads
4718  * @see_also: #GThreadPool
4719  *
4720  * Often you need to communicate between different threads. In general
4721  * it's safer not to do this by shared memory, but by explicit message
4722  * passing. These messages only make sense asynchronously for
4723  * multi-threaded applications though, as a synchronous operation could
4724  * as well be done in the same thread.
4725  *
4726  * Asynchronous queues are an exception from most other GLib data
4727  * structures, as they can be used simultaneously from multiple threads
4728  * without explicit locking and they bring their own builtin reference
4729  * counting. This is because the nature of an asynchronous queue is that
4730  * it will always be used by at least 2 concurrent threads.
4731  *
4732  * For using an asynchronous queue you first have to create one with
4733  * g_async_queue_new(). #GAsyncQueue structs are reference counted,
4734  * use g_async_queue_ref() and g_async_queue_unref() to manage your
4735  * references.
4736  *
4737  * A thread which wants to send a message to that queue simply calls
4738  * g_async_queue_push() to push the message to the queue.
4739  *
4740  * A thread which is expecting messages from an asynchronous queue
4741  * simply calls g_async_queue_pop() for that queue. If no message is
4742  * available in the queue at that point, the thread is now put to sleep
4743  * until a message arrives. The message will be removed from the queue
4744  * and returned. The functions g_async_queue_try_pop() and
4745  * g_async_queue_timeout_pop() can be used to only check for the presence
4746  * of messages or to only wait a certain time for messages respectively.
4747  *
4748  * For almost every function there exist two variants, one that locks
4749  * the queue and one that doesn't. That way you can hold the queue lock
4750  * (acquire it with g_async_queue_lock() and release it with
4751  * g_async_queue_unlock()) over multiple queue accessing instructions.
4752  * This can be necessary to ensure the integrity of the queue, but should
4753  * only be used when really necessary, as it can make your life harder
4754  * if used unwisely. Normally you should only use the locking function
4755  * variants (those without the _unlocked suffix).
4756  *
4757  * In many cases, it may be more convenient to use #GThreadPool when
4758  * you need to distribute work to a set of worker threads instead of
4759  * using #GAsyncQueue manually. #GThreadPool uses a GAsyncQueue
4760  * internally.
4761  */
4762
4763
4764 /**
4765  * SECTION:atomic_operations
4766  * @title: Atomic Operations
4767  * @short_description: basic atomic integer and pointer operations
4768  * @see_also: #GMutex
4769  *
4770  * The following is a collection of compiler macros to provide atomic
4771  * access to integer and pointer-sized values.
4772  *
4773  * The macros that have 'int' in the name will operate on pointers to
4774  * #gint and #guint.  The macros with 'pointer' in the name will operate
4775  * on pointers to any pointer-sized value, including #gsize.  There is
4776  * no support for 64bit operations on platforms with 32bit pointers
4777  * because it is not generally possible to perform these operations
4778  * atomically.
4779  *
4780  * The get, set and exchange operations for integers and pointers
4781  * nominally operate on #gint and #gpointer, respectively.  Of the
4782  * arithmetic operations, the 'add' operation operates on (and returns)
4783  * signed integer values (#gint and #gssize) and the 'and', 'or', and
4784  * 'xor' operations operate on (and return) unsigned integer values
4785  * (#guint and #gsize).
4786  *
4787  * All of the operations act as a full compiler and (where appropriate)
4788  * hardware memory barrier.  Acquire and release or producer and
4789  * consumer barrier semantics are not available through this API.
4790  *
4791  * It is very important that all accesses to a particular integer or
4792  * pointer be performed using only this API and that different sizes of
4793  * operation are not mixed or used on overlapping memory regions.  Never
4794  * read or assign directly from or to a value -- always use this API.
4795  *
4796  * For simple reference counting purposes you should use
4797  * g_atomic_int_inc() and g_atomic_int_dec_and_test().  Other uses that
4798  * fall outside of simple reference counting patterns are prone to
4799  * subtle bugs and occasionally undefined behaviour.  It is also worth
4800  * noting that since all of these operations require global
4801  * synchronisation of the entire machine, they can be quite slow.  In
4802  * the case of performing multiple atomic operations it can often be
4803  * faster to simply acquire a mutex lock around the critical area,
4804  * perform the operations normally and then release the lock.
4805  */
4806
4807
4808 /**
4809  * SECTION:base64
4810  * @title: Base64 Encoding
4811  * @short_description: encodes and decodes data in Base64 format
4812  *
4813  * Base64 is an encoding that allows a sequence of arbitrary bytes to be
4814  * encoded as a sequence of printable ASCII characters. For the definition
4815  * of Base64, see <ulink url="http://www.ietf.org/rfc/rfc1421.txt">RFC
4816  * 1421</ulink> or <ulink url="http://www.ietf.org/rfc/rfc2045.txt">RFC
4817  * 2045</ulink>. Base64 is most commonly used as a MIME transfer encoding
4818  * for email.
4819  *
4820  * GLib supports incremental encoding using g_base64_encode_step() and
4821  * g_base64_encode_close(). Incremental decoding can be done with
4822  * g_base64_decode_step(). To encode or decode data in one go, use
4823  * g_base64_encode() or g_base64_decode(). To avoid memory allocation when
4824  * decoding, you can use g_base64_decode_inplace().
4825  *
4826  * Support for Base64 encoding has been added in GLib 2.12.
4827  */
4828
4829
4830 /**
4831  * SECTION:bookmarkfile
4832  * @title: Bookmark file parser
4833  * @short_description: parses files containing bookmarks
4834  *
4835  * GBookmarkFile lets you parse, edit or create files containing bookmarks
4836  * to URI, along with some meta-data about the resource pointed by the URI
4837  * like its MIME type, the application that is registering the bookmark and
4838  * the icon that should be used to represent the bookmark. The data is stored
4839  * using the
4840  * <ulink url="http://www.gnome.org/~ebassi/bookmark-spec">Desktop Bookmark
4841  * Specification</ulink>.
4842  *
4843  * The syntax of the bookmark files is described in detail inside the Desktop
4844  * Bookmark Specification, here is a quick summary: bookmark files use a
4845  * sub-class of the <ulink url="">XML Bookmark Exchange Language</ulink>
4846  * specification, consisting of valid UTF-8 encoded XML, under the
4847  * <literal>xbel</literal> root element; each bookmark is stored inside a
4848  * <literal>bookmark</literal> element, using its URI: no relative paths can
4849  * be used inside a bookmark file. The bookmark may have a user defined title
4850  * and description, to be used instead of the URI. Under the
4851  * <literal>metadata</literal> element, with its <literal>owner</literal>
4852  * attribute set to <literal>http://freedesktop.org</literal>, is stored the
4853  * meta-data about a resource pointed by its URI. The meta-data consists of
4854  * the resource's MIME type; the applications that have registered a bookmark;
4855  * the groups to which a bookmark belongs to; a visibility flag, used to set
4856  * the bookmark as "private" to the applications and groups that has it
4857  * registered; the URI and MIME type of an icon, to be used when displaying
4858  * the bookmark inside a GUI.
4859  * |[<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../glib/tests/bookmarks.xbel"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include>]|
4860  *
4861  * A bookmark file might contain more than one bookmark; each bookmark
4862  * is accessed through its URI.
4863  *
4864  * The important caveat of bookmark files is that when you add a new
4865  * bookmark you must also add the application that is registering it, using
4866  * g_bookmark_file_add_application() or g_bookmark_file_set_app_info().
4867  * If a bookmark has no applications then it won't be dumped when creating
4868  * the on disk representation, using g_bookmark_file_to_data() or
4869  * g_bookmark_file_to_file().
4870  *
4871  * The #GBookmarkFile parser was added in GLib 2.12.
4872  */
4873
4874
4875 /**
4876  * SECTION:byte_order
4877  * @title: Byte Order Macros
4878  * @short_description: a portable way to convert between different byte orders
4879  *
4880  * These macros provide a portable way to determine the host byte order
4881  * and to convert values between different byte orders.
4882  *
4883  * The byte order is the order in which bytes are stored to create larger
4884  * data types such as the #gint and #glong values.
4885  * The host byte order is the byte order used on the current machine.
4886  *
4887  * Some processors store the most significant bytes (i.e. the bytes that
4888  * hold the largest part of the value) first. These are known as big-endian
4889  * processors. Other processors (notably the x86 family) store the most
4890  * significant byte last. These are known as little-endian processors.
4891  *
4892  * Finally, to complicate matters, some other processors store the bytes in
4893  * a rather curious order known as PDP-endian. For a 4-byte word, the 3rd
4894  * most significant byte is stored first, then the 4th, then the 1st and
4895  * finally the 2nd.
4896  *
4897  * Obviously there is a problem when these different processors communicate
4898  * with each other, for example over networks or by using binary file formats.
4899  * This is where these macros come in. They are typically used to convert
4900  * values into a byte order which has been agreed on for use when
4901  * communicating between different processors. The Internet uses what is
4902  * known as 'network byte order' as the standard byte order (which is in
4903  * fact the big-endian byte order).
4904  *
4905  * Note that the byte order conversion macros may evaluate their arguments
4906  * multiple times, thus you should not use them with arguments which have
4907  * side-effects.
4908  */
4909
4910
4911 /**
4912  * SECTION:checksum
4913  * @title: Data Checksums
4914  * @short_description: computes the checksum for data
4915  *
4916  * GLib provides a generic API for computing checksums (or "digests")
4917  * for a sequence of arbitrary bytes, using various hashing algorithms
4918  * like MD5, SHA-1 and SHA-256. Checksums are commonly used in various
4919  * environments and specifications.
4920  *
4921  * GLib supports incremental checksums using the GChecksum data
4922  * structure, by calling g_checksum_update() as long as there's data
4923  * available and then using g_checksum_get_string() or
4924  * g_checksum_get_digest() to compute the checksum and return it either
4925  * as a string in hexadecimal form, or as a raw sequence of bytes. To
4926  * compute the checksum for binary blobs and NUL-terminated strings in
4927  * one go, use the convenience functions g_compute_checksum_for_data()
4928  * and g_compute_checksum_for_string(), respectively.
4929  *
4930  * Support for checksums has been added in GLib 2.16
4931  */
4932
4933
4934 /**
4935  * SECTION:conversions
4936  * @title: Character Set Conversion
4937  * @short_description: convert strings between different character sets
4938  *
4939  * The g_convert() family of function wraps the functionality of iconv(). In
4940  * addition to pure character set conversions, GLib has functions to deal
4941  * with the extra complications of encodings for file names.
4942  *
4943  * <refsect2 id="file-name-encodings">
4944  * <title>File Name Encodings</title>
4945  * <para>
4946  * Historically, Unix has not had a defined encoding for file
4947  * names:  a file name is valid as long as it does not have path
4948  * separators in it ("/").  However, displaying file names may
4949  * require conversion:  from the character set in which they were
4950  * created, to the character set in which the application
4951  * operates.  Consider the Spanish file name
4952  * "<filename>Presentaci&oacute;n.sxi</filename>".  If the
4953  * application which created it uses ISO-8859-1 for its encoding,
4954  * </para>
4955  * <programlisting id="filename-iso8859-1">
4956  * Character:  P  r  e  s  e  n  t  a  c  i  &oacute;  n  .  s  x  i
4957  * Hex code:   50 72 65 73 65 6e 74 61 63 69 f3 6e 2e 73 78 69
4958  * </programlisting>
4959  * <para>
4960  * However, if the application use UTF-8, the actual file name on
4961  * disk would look like this:
4962  * </para>
4963  * <programlisting id="filename-utf-8">
4964  * Character:  P  r  e  s  e  n  t  a  c  i  &oacute;     n  .  s  x  i
4965  * Hex code:   50 72 65 73 65 6e 74 61 63 69 c3 b3 6e 2e 73 78 69
4966  * </programlisting>
4967  * <para>
4968  * Glib uses UTF-8 for its strings, and GUI toolkits like GTK+
4969  * that use Glib do the same thing.  If you get a file name from
4970  * the file system, for example, from readdir(3) or from g_dir_read_name(),
4971  * and you wish to display the file name to the user, you
4972  * <emphasis>will</emphasis> need to convert it into UTF-8.  The
4973  * opposite case is when the user types the name of a file he
4974  * wishes to save:  the toolkit will give you that string in
4975  * UTF-8 encoding, and you will need to convert it to the
4976  * character set used for file names before you can create the
4977  * file with open(2) or fopen(3).
4978  * </para>
4979  * <para>
4980  * By default, Glib assumes that file names on disk are in UTF-8
4981  * encoding.  This is a valid assumption for file systems which
4982  * were created relatively recently:  most applications use UTF-8
4983  * encoding for their strings, and that is also what they use for
4984  * the file names they create.  However, older file systems may
4985  * still contain file names created in "older" encodings, such as
4986  * ISO-8859-1. In this case, for compatibility reasons, you may
4987  * want to instruct Glib to use that particular encoding for file
4988  * names rather than UTF-8.  You can do this by specifying the
4989  * encoding for file names in the <link
4990  * linkend="G_FILENAME_ENCODING"><envar>G_FILENAME_ENCODING</envar></link>
4991  * environment variable.  For example, if your installation uses
4992  * ISO-8859-1 for file names, you can put this in your
4993  * <filename>~/.profile</filename>:
4994  * </para>
4995  * <programlisting>
4996  * export G_FILENAME_ENCODING=ISO-8859-1
4997  * </programlisting>
4998  * <para>
4999  * Glib provides the functions g_filename_to_utf8() and
5000  * g_filename_from_utf8() to perform the necessary conversions. These
5001  * functions convert file names from the encoding specified in
5002  * <envar>G_FILENAME_ENCODING</envar> to UTF-8 and vice-versa.
5003  * <xref linkend="file-name-encodings-diagram"/> illustrates how
5004  * these functions are used to convert between UTF-8 and the
5005  * encoding for file names in the file system.
5006  * </para>
5007  * <figure id="file-name-encodings-diagram">
5008  * <title>Conversion between File Name Encodings</title>
5009  * <graphic fileref="file-name-encodings.png" format="PNG"/>
5010  * </figure>
5011  * <refsect3 id="file-name-encodings-checklist">
5012  * <title>Checklist for Application Writers</title>
5013  * <para>
5014  * This section is a practical summary of the detailed
5015  * description above.  You can use this as a checklist of
5016  * things to do to make sure your applications process file
5017  * name encodings correctly.
5018  * </para>
5019  * <orderedlist>
5020  * <listitem><para>
5021  * If you get a file name from the file system from a function
5022  * such as readdir(3) or gtk_file_chooser_get_filename(),
5023  * you do not need to do any conversion to pass that
5024  * file name to functions like open(2), rename(2), or
5025  * fopen(3) &mdash; those are "raw" file names which the file
5026  * system understands.
5027  * </para></listitem>
5028  * <listitem><para>
5029  * If you need to display a file name, convert it to UTF-8 first by
5030  * using g_filename_to_utf8(). If conversion fails, display a string like
5031  * "<literal>Unknown file name</literal>". <emphasis>Do not</emphasis>
5032  * convert this string back into the encoding used for file names if you
5033  * wish to pass it to the file system; use the original file name instead.
5034  * For example, the document window of a word processor could display
5035  * "Unknown file name" in its title bar but still let the user save the
5036  * file, as it would keep the raw file name internally. This can happen
5037  * if the user has not set the <envar>G_FILENAME_ENCODING</envar>
5038  * environment variable even though he has files whose names are not
5039  * encoded in UTF-8.
5040  * </para></listitem>
5041  * <listitem><para>
5042  * If your user interface lets the user type a file name for saving or
5043  * renaming, convert it to the encoding used for file names in the file
5044  * system by using g_filename_from_utf8(). Pass the converted file name
5045  * to functions like fopen(3). If conversion fails, ask the user to enter
5046  * a different file name. This can happen if the user types Japanese
5047  * characters when <envar>G_FILENAME_ENCODING</envar> is set to
5048  * <literal>ISO-8859-1</literal>, for example.
5049  * </para></listitem>
5050  * </orderedlist>
5051  * </refsect3>
5052  * </refsect2>
5053  */
5054
5055
5056 /**
5057  * SECTION:datalist
5058  * @title: Keyed Data Lists
5059  * @short_description: lists of data elements which are accessible by a string or GQuark identifier
5060  *
5061  * Keyed data lists provide lists of arbitrary data elements which can
5062  * be accessed either with a string or with a #GQuark corresponding to
5063  * the string.
5064  *
5065  * The #GQuark methods are quicker, since the strings have to be
5066  * converted to #GQuarks anyway.
5067  *
5068  * Data lists are used for associating arbitrary data with #GObjects,
5069  * using g_object_set_data() and related functions.
5070  *
5071  * To create a datalist, use g_datalist_init().
5072  *
5073  * To add data elements to a datalist use g_datalist_id_set_data(),
5074  * g_datalist_id_set_data_full(), g_datalist_set_data() and
5075  * g_datalist_set_data_full().
5076  *
5077  * To get data elements from a datalist use g_datalist_id_get_data()
5078  * and g_datalist_get_data().
5079  *
5080  * To iterate over all data elements in a datalist use
5081  * g_datalist_foreach() (not thread-safe).
5082  *
5083  * To remove data elements from a datalist use
5084  * g_datalist_id_remove_data() and g_datalist_remove_data().
5085  *
5086  * To remove all data elements from a datalist, use g_datalist_clear().
5087  */
5088
5089
5090 /**
5091  * SECTION:datasets
5092  * @title: Datasets
5093  * @short_description: associate groups of data elements with particular memory locations
5094  *
5095  * Datasets associate groups of data elements with particular memory
5096  * locations. These are useful if you need to associate data with a
5097  * structure returned from an external library. Since you cannot modify
5098  * the structure, you use its location in memory as the key into a
5099  * dataset, where you can associate any number of data elements with it.
5100  *
5101  * There are two forms of most of the dataset functions. The first form
5102  * uses strings to identify the data elements associated with a
5103  * location. The second form uses #GQuark identifiers, which are
5104  * created with a call to g_quark_from_string() or
5105  * g_quark_from_static_string(). The second form is quicker, since it
5106  * does not require looking up the string in the hash table of #GQuark
5107  * identifiers.
5108  *
5109  * There is no function to create a dataset. It is automatically
5110  * created as soon as you add elements to it.
5111  *
5112  * To add data elements to a dataset use g_dataset_id_set_data(),
5113  * g_dataset_id_set_data_full(), g_dataset_set_data() and
5114  * g_dataset_set_data_full().
5115  *
5116  * To get data elements from a dataset use g_dataset_id_get_data() and
5117  * g_dataset_get_data().
5118  *
5119  * To iterate over all data elements in a dataset use
5120  * g_dataset_foreach() (not thread-safe).
5121  *
5122  * To remove data elements from a dataset use
5123  * g_dataset_id_remove_data() and g_dataset_remove_data().
5124  *
5125  * To destroy a dataset, use g_dataset_destroy().
5126  */
5127
5128
5129 /**
5130  * SECTION:date
5131  * @title: Date and Time Functions
5132  * @short_description: calendrical calculations and miscellaneous time stuff
5133  *
5134  * The #GDate data structure represents a day between January 1, Year 1,
5135  * and sometime a few thousand years in the future (right now it will go
5136  * to the year 65535 or so, but g_date_set_parse() only parses up to the
5137  * year 8000 or so - just count on "a few thousand"). #GDate is meant to
5138  * represent everyday dates, not astronomical dates or historical dates
5139  * or ISO timestamps or the like. It extrapolates the current Gregorian
5140  * calendar forward and backward in time; there is no attempt to change
5141  * the calendar to match time periods or locations. #GDate does not store
5142  * time information; it represents a <emphasis>day</emphasis>.
5143  *
5144  * The #GDate implementation has several nice features; it is only a
5145  * 64-bit struct, so storing large numbers of dates is very efficient. It
5146  * can keep both a Julian and day-month-year representation of the date,
5147  * since some calculations are much easier with one representation or the
5148  * other. A Julian representation is simply a count of days since some
5149  * fixed day in the past; for #GDate the fixed day is January 1, 1 AD.
5150  * ("Julian" dates in the #GDate API aren't really Julian dates in the
5151  * technical sense; technically, Julian dates count from the start of the
5152  * Julian period, Jan 1, 4713 BC).
5153  *
5154  * #GDate is simple to use. First you need a "blank" date; you can get a
5155  * dynamically allocated date from g_date_new(), or you can declare an
5156  * automatic variable or array and initialize it to a sane state by
5157  * calling g_date_clear(). A cleared date is sane; it's safe to call
5158  * g_date_set_dmy() and the other mutator functions to initialize the
5159  * value of a cleared date. However, a cleared date is initially
5160  * <emphasis>invalid</emphasis>, meaning that it doesn't represent a day
5161  * that exists. It is undefined to call any of the date calculation
5162  * routines on an invalid date. If you obtain a date from a user or other
5163  * unpredictable source, you should check its validity with the
5164  * g_date_valid() predicate. g_date_valid() is also used to check for
5165  * errors with g_date_set_parse() and other functions that can
5166  * fail. Dates can be invalidated by calling g_date_clear() again.
5167  *
5168  * <emphasis>It is very important to use the API to access the #GDate
5169  * struct.</emphasis> Often only the day-month-year or only the Julian
5170  * representation is valid. Sometimes neither is valid. Use the API.
5171  *
5172  * GLib also features #GDateTime which represents a precise time.
5173  */
5174
5175
5176 /**
5177  * SECTION:date-time
5178  * @title: GDateTime
5179  * @short_description: a structure representing Date and Time
5180  * @see_also: #GTimeZone
5181  *
5182  * #GDateTime is a structure that combines a Gregorian date and time
5183  * into a single structure.  It provides many conversion and methods to
5184  * manipulate dates and times.  Time precision is provided down to
5185  * microseconds and the time can range (proleptically) from 0001-01-01
5186  * 00:00:00 to 9999-12-31 23:59:59.999999.  #GDateTime follows POSIX
5187  * time in the sense that it is oblivious to leap seconds.
5188  *
5189  * #GDateTime is an immutable object; once it has been created it cannot
5190  * be modified further.  All modifiers will create a new #GDateTime.
5191  * Nearly all such functions can fail due to the date or time going out
5192  * of range, in which case %NULL will be returned.
5193  *
5194  * #GDateTime is reference counted: the reference count is increased by calling
5195  * g_date_time_ref() and decreased by calling g_date_time_unref(). When the
5196  * reference count drops to 0, the resources allocated by the #GDateTime
5197  * structure are released.
5198  *
5199  * Many parts of the API may produce non-obvious results.  As an
5200  * example, adding two months to January 31st will yield March 31st
5201  * whereas adding one month and then one month again will yield either
5202  * March 28th or March 29th.  Also note that adding 24 hours is not
5203  * always the same as adding one day (since days containing daylight
5204  * savings time transitions are either 23 or 25 hours in length).
5205  *
5206  * #GDateTime is available since GLib 2.26.
5207  */
5208
5209
5210 /**
5211  * SECTION:error_reporting
5212  * @Title: Error Reporting
5213  * @Short_description: a system for reporting errors
5214  *
5215  * GLib provides a standard method of reporting errors from a called
5216  * function to the calling code. (This is the same problem solved by
5217  * exceptions in other languages.) It's important to understand that
5218  * this method is both a <emphasis>data type</emphasis> (the #GError
5219  * object) and a <emphasis>set of rules.</emphasis> If you use #GError
5220  * incorrectly, then your code will not properly interoperate with other
5221  * code that uses #GError, and users of your API will probably get confused.
5222  *
5223  * First and foremost: <emphasis>#GError should only be used to report
5224  * recoverable runtime errors, never to report programming
5225  * errors.</emphasis> If the programmer has screwed up, then you should
5226  * use g_warning(), g_return_if_fail(), g_assert(), g_error(), or some
5227  * similar facility. (Incidentally, remember that the g_error() function
5228  * should <emphasis>only</emphasis> be used for programming errors, it
5229  * should not be used to print any error reportable via #GError.)
5230  *
5231  * Examples of recoverable runtime errors are "file not found" or
5232  * "failed to parse input." Examples of programming errors are "NULL
5233  * passed to strcmp()" or "attempted to free the same pointer twice."
5234  * These two kinds of errors are fundamentally different: runtime errors
5235  * should be handled or reported to the user, programming errors should
5236  * be eliminated by fixing the bug in the program. This is why most
5237  * functions in GLib and GTK+ do not use the #GError facility.
5238  *
5239  * Functions that can fail take a return location for a #GError as their
5240  * last argument. For example:
5241  * |[
5242  * gboolean g_file_get_contents (const gchar  *filename,
5243  *                               gchar       **contents,
5244  *                               gsize        *length,
5245  *                               GError      **error);
5246  * ]|
5247  * If you pass a non-%NULL value for the <literal>error</literal>
5248  * argument, it should point to a location where an error can be placed.
5249  * For example:
5250  * |[
5251  * gchar *contents;
5252  * GError *err = NULL;
5253  * g_file_get_contents ("foo.txt", &amp;contents, NULL, &amp;err);
5254  * g_assert ((contents == NULL &amp;&amp; err != NULL) || (contents != NULL &amp;&amp; err == NULL));
5255  * if (err != NULL)
5256  *   {
5257  *     /&ast; Report error to user, and free error &ast;/
5258  *     g_assert (contents == NULL);
5259  *     fprintf (stderr, "Unable to read file: &percnt;s\n", err->message);
5260  *     g_error_free (err);
5261  *   }
5262  * else
5263  *   {
5264  *     /&ast; Use file contents &ast;/
5265  *     g_assert (contents != NULL);
5266  *   }
5267  * ]|
5268  * Note that <literal>err != NULL</literal> in this example is a
5269  * <emphasis>reliable</emphasis> indicator of whether
5270  * g_file_get_contents() failed. Additionally, g_file_get_contents()
5271  * returns a boolean which indicates whether it was successful.
5272  *
5273  * Because g_file_get_contents() returns %FALSE on failure, if you
5274  * are only interested in whether it failed and don't need to display
5275  * an error message, you can pass %NULL for the <literal>error</literal>
5276  * argument:
5277  * |[
5278  * if (g_file_get_contents ("foo.txt", &amp;contents, NULL, NULL)) /&ast; ignore errors &ast;/
5279  *   /&ast; no error occurred &ast;/ ;
5280  * else
5281  *   /&ast; error &ast;/ ;
5282  * ]|
5283  *
5284  * The #GError object contains three fields: <literal>domain</literal>
5285  * indicates the module the error-reporting function is located in,
5286  * <literal>code</literal> indicates the specific error that occurred,
5287  * and <literal>message</literal> is a user-readable error message with
5288  * as many details as possible. Several functions are provided to deal
5289  * with an error received from a called function: g_error_matches()
5290  * returns %TRUE if the error matches a given domain and code,
5291  * g_propagate_error() copies an error into an error location (so the
5292  * calling function will receive it), and g_clear_error() clears an
5293  * error location by freeing the error and resetting the location to
5294  * %NULL. To display an error to the user, simply display
5295  * <literal>error-&gt;message</literal>, perhaps along with additional
5296  * context known only to the calling function (the file being opened,
5297  * or whatever -- though in the g_file_get_contents() case,
5298  * <literal>error-&gt;message</literal> already contains a filename).
5299  *
5300  * When implementing a function that can report errors, the basic
5301  * tool is g_set_error(). Typically, if a fatal error occurs you
5302  * want to g_set_error(), then return immediately. g_set_error()
5303  * does nothing if the error location passed to it is %NULL.
5304  * Here's an example:
5305  * |[
5306  * gint
5307  * foo_open_file (GError **error)
5308  * {
5309  *   gint fd;
5310  *
5311  *   fd = open ("file.txt", O_RDONLY);
5312  *
5313  *   if (fd &lt; 0)
5314  *     {
5315  *       g_set_error (error,
5316  *                    FOO_ERROR,                 /&ast; error domain &ast;/
5317  *                    FOO_ERROR_BLAH,            /&ast; error code &ast;/
5318  *                    "Failed to open file: &percnt;s", /&ast; error message format string &ast;/
5319  *                    g_strerror (errno));
5320  *       return -1;
5321  *     }
5322  *   else
5323  *     return fd;
5324  * }
5325  * ]|
5326  *
5327  * Things are somewhat more complicated if you yourself call another
5328  * function that can report a #GError. If the sub-function indicates
5329  * fatal errors in some way other than reporting a #GError, such as
5330  * by returning %TRUE on success, you can simply do the following:
5331  * |[
5332  * gboolean
5333  * my_function_that_can_fail (GError **err)
5334  * {
5335  *   g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
5336  *
5337  *   if (!sub_function_that_can_fail (err))
5338  *     {
5339  *       /&ast; assert that error was set by the sub-function &ast;/
5340  *       g_assert (err == NULL || *err != NULL);
5341  *       return FALSE;
5342  *     }
5343  *
5344  *   /&ast; otherwise continue, no error occurred &ast;/
5345  *   g_assert (err == NULL || *err == NULL);
5346  * }
5347  * ]|
5348  *
5349  * If the sub-function does not indicate errors other than by
5350  * reporting a #GError, you need to create a temporary #GError
5351  * since the passed-in one may be %NULL. g_propagate_error() is
5352  * intended for use in this case.
5353  * |[
5354  * gboolean
5355  * my_function_that_can_fail (GError **err)
5356  * {
5357  *   GError *tmp_error;
5358  *
5359  *   g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
5360  *
5361  *   tmp_error = NULL;
5362  *   sub_function_that_can_fail (&amp;tmp_error);
5363  *
5364  *   if (tmp_error != NULL)
5365  *     {
5366  *       /&ast; store tmp_error in err, if err != NULL,
5367  *        &ast; otherwise call g_error_free() on tmp_error
5368  *        &ast;/
5369  *       g_propagate_error (err, tmp_error);
5370  *       return FALSE;
5371  *     }
5372  *
5373  *   /&ast; otherwise continue, no error occurred &ast;/
5374  * }
5375  * ]|
5376  *
5377  * Error pileups are always a bug. For example, this code is incorrect:
5378  * |[
5379  * gboolean
5380  * my_function_that_can_fail (GError **err)
5381  * {
5382  *   GError *tmp_error;
5383  *
5384  *   g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
5385  *
5386  *   tmp_error = NULL;
5387  *   sub_function_that_can_fail (&amp;tmp_error);
5388  *   other_function_that_can_fail (&amp;tmp_error);
5389  *
5390  *   if (tmp_error != NULL)
5391  *     {
5392  *       g_propagate_error (err, tmp_error);
5393  *       return FALSE;
5394  *     }
5395  * }
5396  * ]|
5397  * <literal>tmp_error</literal> should be checked immediately after
5398  * sub_function_that_can_fail(), and either cleared or propagated
5399  * upward. The rule is: <emphasis>after each error, you must either
5400  * handle the error, or return it to the calling function</emphasis>.
5401  * Note that passing %NULL for the error location is the equivalent
5402  * of handling an error by always doing nothing about it. So the
5403  * following code is fine, assuming errors in sub_function_that_can_fail()
5404  * are not fatal to my_function_that_can_fail():
5405  * |[
5406  * gboolean
5407  * my_function_that_can_fail (GError **err)
5408  * {
5409  *   GError *tmp_error;
5410  *
5411  *   g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
5412  *
5413  *   sub_function_that_can_fail (NULL); /&ast; ignore errors &ast;/
5414  *
5415  *   tmp_error = NULL;
5416  *   other_function_that_can_fail (&amp;tmp_error);
5417  *
5418  *   if (tmp_error != NULL)
5419  *     {
5420  *       g_propagate_error (err, tmp_error);
5421  *       return FALSE;
5422  *     }
5423  * }
5424  * ]|
5425  *
5426  * Note that passing %NULL for the error location
5427  * <emphasis>ignores</emphasis> errors; it's equivalent to
5428  * <literal>try { sub_function_that_can_fail (); } catch (...) {}</literal>
5429  * in C++. It does <emphasis>not</emphasis> mean to leave errors
5430  * unhandled; it means to handle them by doing nothing.
5431  *
5432  * Error domains and codes are conventionally named as follows:
5433  * <itemizedlist>
5434  * <listitem><para>
5435  *   The error domain is called
5436  *   <literal>&lt;NAMESPACE&gt;_&lt;MODULE&gt;_ERROR</literal>,
5437  *   for example %G_SPAWN_ERROR or %G_THREAD_ERROR:
5438  *   |[
5439  * #define G_SPAWN_ERROR g_spawn_error_quark ()
5440  *
5441  * GQuark
5442  * g_spawn_error_quark (void)
5443  * {
5444  *   return g_quark_from_static_string ("g-spawn-error-quark");
5445  * }
5446  *   ]|
5447  * </para></listitem>
5448  * <listitem><para>
5449  *   The quark function for the error domain is called
5450  *   <literal>&lt;namespace&gt;_&lt;module&gt;_error_quark</literal>,
5451  *   for example g_spawn_error_quark() or g_thread_error_quark().
5452  * </para></listitem>
5453  * <listitem><para>
5454  *   The error codes are in an enumeration called
5455  *   <literal>&lt;Namespace&gt;&lt;Module&gt;Error</literal>;
5456  *   for example,#GThreadError or #GSpawnError.
5457  * </para></listitem>
5458  * <listitem><para>
5459  *   Members of the error code enumeration are called
5460  *   <literal>&lt;NAMESPACE&gt;_&lt;MODULE&gt;_ERROR_&lt;CODE&gt;</literal>,
5461  *   for example %G_SPAWN_ERROR_FORK or %G_THREAD_ERROR_AGAIN.
5462  * </para></listitem>
5463  * <listitem><para>
5464  *   If there's a "generic" or "unknown" error code for unrecoverable
5465  *   errors it doesn't make sense to distinguish with specific codes,
5466  *   it should be called <literal>&lt;NAMESPACE&gt;_&lt;MODULE&gt;_ERROR_FAILED</literal>,
5467  *   for example %G_SPAWN_ERROR_FAILED.
5468  * </para></listitem>
5469  * </itemizedlist>
5470  *
5471  * Summary of rules for use of #GError:
5472  * <itemizedlist>
5473  * <listitem><para>
5474  *   Do not report programming errors via #GError.
5475  * </para></listitem>
5476  * <listitem><para>
5477  *   The last argument of a function that returns an error should
5478  *   be a location where a #GError can be placed (i.e. "#GError** error").
5479  *   If #GError is used with varargs, the #GError** should be the last
5480  *   argument before the "...".
5481  * </para></listitem>
5482  * <listitem><para>
5483  *   The caller may pass %NULL for the #GError** if they are not interested
5484  *   in details of the exact error that occurred.
5485  * </para></listitem>
5486  * <listitem><para>
5487  *   If %NULL is passed for the #GError** argument, then errors should
5488  *   not be returned to the caller, but your function should still
5489  *   abort and return if an error occurs. That is, control flow should
5490  *   not be affected by whether the caller wants to get a #GError.
5491  * </para></listitem>
5492  * <listitem><para>
5493  *   If a #GError is reported, then your function by definition
5494  *   <emphasis>had a fatal failure and did not complete whatever
5495  *   it was supposed to do</emphasis>. If the failure was not fatal,
5496  *   then you handled it and you should not report it. If it was fatal,
5497  *   then you must report it and discontinue whatever you were doing
5498  *   immediately.
5499  * </para></listitem>
5500  * <listitem><para>
5501  *   If a #GError is reported, out parameters are not guaranteed to
5502  *   be set to any defined value.
5503  * </para></listitem>
5504  * <listitem><para>
5505  *   A #GError* must be initialized to %NULL before passing its address
5506  *   to a function that can report errors.
5507  * </para></listitem>
5508  * <listitem><para>
5509  *   "Piling up" errors is always a bug. That is, if you assign a
5510  *   new #GError to a #GError* that is non-%NULL, thus overwriting
5511  *   the previous error, it indicates that you should have aborted
5512  *   the operation instead of continuing. If you were able to continue,
5513  *   you should have cleared the previous error with g_clear_error().
5514  *   g_set_error() will complain if you pile up errors.
5515  * </para></listitem>
5516  * <listitem><para>
5517  *   By convention, if you return a boolean value indicating success
5518  *   then %TRUE means success and %FALSE means failure. If %FALSE is
5519  *   returned, the error <emphasis>must</emphasis> be set to a non-%NULL
5520  *   value.
5521  * </para></listitem>
5522  * <listitem><para>
5523  *   A %NULL return value is also frequently used to mean that an error
5524  *   occurred. You should make clear in your documentation whether %NULL
5525  *   is a valid return value in non-error cases; if %NULL is a valid value,
5526  *   then users must check whether an error was returned to see if the
5527  *   function succeeded.
5528  * </para></listitem>
5529  * <listitem><para>
5530  *   When implementing a function that can report errors, you may want
5531  *   to add a check at the top of your function that the error return
5532  *   location is either %NULL or contains a %NULL error (e.g.
5533  *   <literal>g_return_if_fail (error == NULL || *error == NULL);</literal>).
5534  * </para></listitem>
5535  * </itemizedlist>
5536  */
5537
5538
5539 /**
5540  * SECTION:fileutils
5541  * @title: File Utilities
5542  * @short_description: various file-related functions
5543  *
5544  * There is a group of functions which wrap the common POSIX functions
5545  * dealing with filenames (g_open(), g_rename(), g_mkdir(), g_stat(),
5546  * g_unlink(), g_remove(), g_fopen(), g_freopen()). The point of these
5547  * wrappers is to make it possible to handle file names with any Unicode
5548  * characters in them on Windows without having to use ifdefs and the
5549  * wide character API in the application code.
5550  *
5551  * The pathname argument should be in the GLib file name encoding.
5552  * On POSIX this is the actual on-disk encoding which might correspond
5553  * to the locale settings of the process (or the
5554  * <envar>G_FILENAME_ENCODING</envar> environment variable), or not.
5555  *
5556  * On Windows the GLib file name encoding is UTF-8. Note that the
5557  * Microsoft C library does not use UTF-8, but has separate APIs for
5558  * current system code page and wide characters (UTF-16). The GLib
5559  * wrappers call the wide character API if present (on modern Windows
5560  * systems), otherwise convert to/from the system code page.
5561  *
5562  * Another group of functions allows to open and read directories
5563  * in the GLib file name encoding. These are g_dir_open(),
5564  * g_dir_read_name(), g_dir_rewind(), g_dir_close().
5565  */
5566
5567
5568 /**
5569  * SECTION:ghostutils
5570  * @short_description: Internet hostname utilities
5571  *
5572  * Functions for manipulating internet hostnames; in particular, for
5573  * converting between Unicode and ASCII-encoded forms of
5574  * Internationalized Domain Names (IDNs).
5575  *
5576  * The <ulink
5577  * url="http://www.ietf.org/rfc/rfc3490.txt">Internationalized Domain
5578  * Names for Applications (IDNA)</ulink> standards allow for the use
5579  * of Unicode domain names in applications, while providing
5580  * backward-compatibility with the old ASCII-only DNS, by defining an
5581  * ASCII-Compatible Encoding of any given Unicode name, which can be
5582  * used with non-IDN-aware applications and protocols. (For example,
5583  * "Παν語.org" maps to "xn--4wa8awb4637h.org".)
5584  */
5585
5586
5587 /**
5588  * SECTION:gregex
5589  * @title: Perl-compatible regular expressions
5590  * @short_description: matches strings against regular expressions
5591  * @see_also: <xref linkend="glib-regex-syntax"/>
5592  *
5593  * The <function>g_regex_*()</function> functions implement regular
5594  * expression pattern matching using syntax and semantics similar to
5595  * Perl regular expression.
5596  *
5597  * Some functions accept a @start_position argument, setting it differs
5598  * from just passing over a shortened string and setting #G_REGEX_MATCH_NOTBOL
5599  * in the case of a pattern that begins with any kind of lookbehind assertion.
5600  * For example, consider the pattern "\Biss\B" which finds occurrences of "iss"
5601  * in the middle of words. ("\B" matches only if the current position in the
5602  * subject is not a word boundary.) When applied to the string "Mississipi"
5603  * from the fourth byte, namely "issipi", it does not match, because "\B" is
5604  * always false at the start of the subject, which is deemed to be a word
5605  * boundary. However, if the entire string is passed , but with
5606  * @start_position set to 4, it finds the second occurrence of "iss" because
5607  * it is able to look behind the starting point to discover that it is
5608  * preceded by a letter.
5609  *
5610  * Note that, unless you set the #G_REGEX_RAW flag, all the strings passed
5611  * to these functions must be encoded in UTF-8. The lengths and the positions
5612  * inside the strings are in bytes and not in characters, so, for instance,
5613  * "\xc3\xa0" (i.e. "&agrave;") is two bytes long but it is treated as a
5614  * single character. If you set #G_REGEX_RAW the strings can be non-valid
5615  * UTF-8 strings and a byte is treated as a character, so "\xc3\xa0" is two
5616  * bytes and two characters long.
5617  *
5618  * When matching a pattern, "\n" matches only against a "\n" character in
5619  * the string, and "\r" matches only a "\r" character. To match any newline
5620  * sequence use "\R". This particular group matches either the two-character
5621  * sequence CR + LF ("\r\n"), or one of the single characters LF (linefeed,
5622  * U+000A, "\n"), VT vertical tab, U+000B, "\v"), FF (formfeed, U+000C, "\f"),
5623  * CR (carriage return, U+000D, "\r"), NEL (next line, U+0085), LS (line
5624  * separator, U+2028), or PS (paragraph separator, U+2029).
5625  *
5626  * The behaviour of the dot, circumflex, and dollar metacharacters are
5627  * affected by newline characters, the default is to recognize any newline
5628  * character (the same characters recognized by "\R"). This can be changed
5629  * with #G_REGEX_NEWLINE_CR, #G_REGEX_NEWLINE_LF and #G_REGEX_NEWLINE_CRLF
5630  * compile options, and with #G_REGEX_MATCH_NEWLINE_ANY,
5631  * #G_REGEX_MATCH_NEWLINE_CR, #G_REGEX_MATCH_NEWLINE_LF and
5632  * #G_REGEX_MATCH_NEWLINE_CRLF match options. These settings are also
5633  * relevant when compiling a pattern if #G_REGEX_EXTENDED is set, and an
5634  * unescaped "#" outside a character class is encountered. This indicates
5635  * a comment that lasts until after the next newline.
5636  *
5637  * When setting the %G_REGEX_JAVASCRIPT_COMPAT flag, pattern syntax and pattern
5638  * matching is changed to be compatible with the way that regular expressions
5639  * work in JavaScript. More precisely, a lonely ']' character in the pattern
5640  * is a syntax error; the '\x' escape only allows 0 to 2 hexadecimal digits, and
5641  * you must use the '\u' escape sequence with 4 hex digits to specify a unicode
5642  * codepoint instead of '\x' or 'x{....}'. If '\x' or '\u' are not followed by
5643  * the specified number of hex digits, they match 'x' and 'u' literally; also
5644  * '\U' always matches 'U' instead of being an error in the pattern. Finally,
5645  * pattern matching is modified so that back references to an unset subpattern
5646  * group produces a match with the empty string instead of an error. See
5647  * <ulink>man:pcreapi(3)</ulink> for more information.
5648  *
5649  * Creating and manipulating the same #GRegex structure from different
5650  * threads is not a problem as #GRegex does not modify its internal
5651  * state between creation and destruction, on the other hand #GMatchInfo
5652  * is not threadsafe.
5653  *
5654  * The regular expressions low-level functionalities are obtained through
5655  * the excellent <ulink url="http://www.pcre.org/">PCRE</ulink> library
5656  * written by Philip Hazel.
5657  */
5658
5659
5660 /**
5661  * SECTION:gunix
5662  * @title: UNIX-specific utilities and integration
5663  * @short_description: pipes, signal handling
5664  * @include: glib-unix.h
5665  *
5666  * Most of GLib is intended to be portable; in contrast, this set of
5667  * functions is designed for programs which explicitly target UNIX,
5668  * or are using it to build higher level abstractions which would be
5669  * conditionally compiled if the platform matches G_OS_UNIX.
5670  *
5671  * To use these functions, you must explicitly include the
5672  * "glib-unix.h" header.
5673  */
5674
5675
5676 /**
5677  * SECTION:gurifuncs
5678  * @title: URI Functions
5679  * @short_description: manipulating URIs
5680  *
5681  * Functions for manipulating Universal Resource Identifiers (URIs) as
5682  * defined by <ulink url="http://www.ietf.org/rfc/rfc3986.txt">
5683  * RFC 3986</ulink>. It is highly recommended that you have read and
5684  * understand RFC 3986 for understanding this API.
5685  */
5686
5687
5688 /**
5689  * SECTION:gvariant
5690  * @title: GVariant
5691  * @short_description: strongly typed value datatype
5692  * @see_also: GVariantType
5693  *
5694  * #GVariant is a variant datatype; it stores a value along with
5695  * information about the type of that value.  The range of possible
5696  * values is determined by the type.  The type system used by #GVariant
5697  * is #GVariantType.
5698  *
5699  * #GVariant instances always have a type and a value (which are given
5700  * at construction time).  The type and value of a #GVariant instance
5701  * can never change other than by the #GVariant itself being
5702  * destroyed.  A #GVariant cannot contain a pointer.
5703  *
5704  * #GVariant is reference counted using g_variant_ref() and
5705  * g_variant_unref().  #GVariant also has floating reference counts --
5706  * see g_variant_ref_sink().
5707  *
5708  * #GVariant is completely threadsafe.  A #GVariant instance can be
5709  * concurrently accessed in any way from any number of threads without
5710  * problems.
5711  *
5712  * #GVariant is heavily optimised for dealing with data in serialised
5713  * form.  It works particularly well with data located in memory-mapped
5714  * files.  It can perform nearly all deserialisation operations in a
5715  * small constant time, usually touching only a single memory page.
5716  * Serialised #GVariant data can also be sent over the network.
5717  *
5718  * #GVariant is largely compatible with D-Bus.  Almost all types of
5719  * #GVariant instances can be sent over D-Bus.  See #GVariantType for
5720  * exceptions.  (However, #GVariant's serialisation format is not the same
5721  * as the serialisation format of a D-Bus message body: use #GDBusMessage,
5722  * in the gio library, for those.)
5723  *
5724  * For space-efficiency, the #GVariant serialisation format does not
5725  * automatically include the variant's type or endianness, which must
5726  * either be implied from context (such as knowledge that a particular
5727  * file format always contains a little-endian %G_VARIANT_TYPE_VARIANT)
5728  * or supplied out-of-band (for instance, a type and/or endianness
5729  * indicator could be placed at the beginning of a file, network message
5730  * or network stream).
5731  *
5732  * A #GVariant's size is limited mainly by any lower level operating
5733  * system constraints, such as the number of bits in #gsize.  For
5734  * example, it is reasonable to have a 2GB file mapped into memory
5735  * with #GMappedFile, and call g_variant_new_from_data() on it.
5736  *
5737  * For convenience to C programmers, #GVariant features powerful
5738  * varargs-based value construction and destruction.  This feature is
5739  * designed to be embedded in other libraries.
5740  *
5741  * There is a Python-inspired text language for describing #GVariant
5742  * values.  #GVariant includes a printer for this language and a parser
5743  * with type inferencing.
5744  *
5745  * <refsect2>
5746  *  <title>Memory Use</title>
5747  *  <para>
5748  *   #GVariant tries to be quite efficient with respect to memory use.
5749  *   This section gives a rough idea of how much memory is used by the
5750  *   current implementation.  The information here is subject to change
5751  *   in the future.
5752  *  </para>
5753  *  <para>
5754  *   The memory allocated by #GVariant can be grouped into 4 broad
5755  *   purposes: memory for serialised data, memory for the type
5756  *   information cache, buffer management memory and memory for the
5757  *   #GVariant structure itself.
5758  *  </para>
5759  *  <refsect3 id="gvariant-serialised-data-memory">
5760  *   <title>Serialised Data Memory</title>
5761  *   <para>
5762  *    This is the memory that is used for storing GVariant data in
5763  *    serialised form.  This is what would be sent over the network or
5764  *    what would end up on disk.
5765  *   </para>
5766  *   <para>
5767  *    The amount of memory required to store a boolean is 1 byte.  16,
5768  *    32 and 64 bit integers and double precision floating point numbers
5769  *    use their "natural" size.  Strings (including object path and
5770  *    signature strings) are stored with a nul terminator, and as such
5771  *    use the length of the string plus 1 byte.
5772  *   </para>
5773  *   <para>
5774  *    Maybe types use no space at all to represent the null value and
5775  *    use the same amount of space (sometimes plus one byte) as the
5776  *    equivalent non-maybe-typed value to represent the non-null case.
5777  *   </para>
5778  *   <para>
5779  *    Arrays use the amount of space required to store each of their
5780  *    members, concatenated.  Additionally, if the items stored in an
5781  *    array are not of a fixed-size (ie: strings, other arrays, etc)
5782  *    then an additional framing offset is stored for each item.  The
5783  *    size of this offset is either 1, 2 or 4 bytes depending on the
5784  *    overall size of the container.  Additionally, extra padding bytes
5785  *    are added as required for alignment of child values.
5786  *   </para>
5787  *   <para>
5788  *    Tuples (including dictionary entries) use the amount of space
5789  *    required to store each of their members, concatenated, plus one
5790  *    framing offset (as per arrays) for each non-fixed-sized item in
5791  *    the tuple, except for the last one.  Additionally, extra padding
5792  *    bytes are added as required for alignment of child values.
5793  *   </para>
5794  *   <para>
5795  *    Variants use the same amount of space as the item inside of the
5796  *    variant, plus 1 byte, plus the length of the type string for the
5797  *    item inside the variant.
5798  *   </para>
5799  *   <para>
5800  *    As an example, consider a dictionary mapping strings to variants.
5801  *    In the case that the dictionary is empty, 0 bytes are required for
5802  *    the serialisation.
5803  *   </para>
5804  *   <para>
5805  *    If we add an item "width" that maps to the int32 value of 500 then
5806  *    we will use 4 byte to store the int32 (so 6 for the variant
5807  *    containing it) and 6 bytes for the string.  The variant must be
5808  *    aligned to 8 after the 6 bytes of the string, so that's 2 extra
5809  *    bytes.  6 (string) + 2 (padding) + 6 (variant) is 14 bytes used
5810  *    for the dictionary entry.  An additional 1 byte is added to the
5811  *    array as a framing offset making a total of 15 bytes.
5812  *   </para>
5813  *   <para>
5814  *    If we add another entry, "title" that maps to a nullable string
5815  *    that happens to have a value of null, then we use 0 bytes for the
5816  *    null value (and 3 bytes for the variant to contain it along with
5817  *    its type string) plus 6 bytes for the string.  Again, we need 2
5818  *    padding bytes.  That makes a total of 6 + 2 + 3 = 11 bytes.
5819  *   </para>
5820  *   <para>
5821  *    We now require extra padding between the two items in the array.
5822  *    After the 14 bytes of the first item, that's 2 bytes required.  We
5823  *    now require 2 framing offsets for an extra two bytes.  14 + 2 + 11
5824  *    + 2 = 29 bytes to encode the entire two-item dictionary.
5825  *   </para>
5826  *  </refsect3>
5827  *  <refsect3>
5828  *   <title>Type Information Cache</title>
5829  *   <para>
5830  *    For each GVariant type that currently exists in the program a type
5831  *    information structure is kept in the type information cache.  The
5832  *    type information structure is required for rapid deserialisation.
5833  *   </para>
5834  *   <para>
5835  *    Continuing with the above example, if a #GVariant exists with the
5836  *    type "a{sv}" then a type information struct will exist for
5837  *    "a{sv}", "{sv}", "s", and "v".  Multiple uses of the same type
5838  *    will share the same type information.  Additionally, all
5839  *    single-digit types are stored in read-only static memory and do
5840  *    not contribute to the writable memory footprint of a program using
5841  *    #GVariant.
5842  *   </para>
5843  *   <para>
5844  *    Aside from the type information structures stored in read-only
5845  *    memory, there are two forms of type information.  One is used for
5846  *    container types where there is a single element type: arrays and
5847  *    maybe types.  The other is used for container types where there
5848  *    are multiple element types: tuples and dictionary entries.
5849  *   </para>
5850  *   <para>
5851  *    Array type info structures are 6 * sizeof (void *), plus the
5852  *    memory required to store the type string itself.  This means that
5853  *    on 32bit systems, the cache entry for "a{sv}" would require 30
5854  *    bytes of memory (plus malloc overhead).
5855  *   </para>
5856  *   <para>
5857  *    Tuple type info structures are 6 * sizeof (void *), plus 4 *
5858  *    sizeof (void *) for each item in the tuple, plus the memory
5859  *    required to store the type string itself.  A 2-item tuple, for
5860  *    example, would have a type information structure that consumed
5861  *    writable memory in the size of 14 * sizeof (void *) (plus type
5862  *    string)  This means that on 32bit systems, the cache entry for
5863  *    "{sv}" would require 61 bytes of memory (plus malloc overhead).
5864  *   </para>
5865  *   <para>
5866  *    This means that in total, for our "a{sv}" example, 91 bytes of
5867  *    type information would be allocated.
5868  *   </para>
5869  *   <para>
5870  *    The type information cache, additionally, uses a #GHashTable to
5871  *    store and lookup the cached items and stores a pointer to this
5872  *    hash table in static storage.  The hash table is freed when there
5873  *    are zero items in the type cache.
5874  *   </para>
5875  *   <para>
5876  *    Although these sizes may seem large it is important to remember
5877  *    that a program will probably only have a very small number of
5878  *    different types of values in it and that only one type information
5879  *    structure is required for many different values of the same type.
5880  *   </para>
5881  *  </refsect3>
5882  *  <refsect3>
5883  *   <title>Buffer Management Memory</title>
5884  *   <para>
5885  *    #GVariant uses an internal buffer management structure to deal
5886  *    with the various different possible sources of serialised data
5887  *    that it uses.  The buffer is responsible for ensuring that the
5888  *    correct call is made when the data is no longer in use by
5889  *    #GVariant.  This may involve a g_free() or a g_slice_free() or
5890  *    even g_mapped_file_unref().
5891  *   </para>
5892  *   <para>
5893  *    One buffer management structure is used for each chunk of
5894  *    serialised data.  The size of the buffer management structure is 4
5895  *    * (void *).  On 32bit systems, that's 16 bytes.
5896  *   </para>
5897  *  </refsect3>
5898  *  <refsect3>
5899  *   <title>GVariant structure</title>
5900  *   <para>
5901  *    The size of a #GVariant structure is 6 * (void *).  On 32 bit
5902  *    systems, that's 24 bytes.
5903  *   </para>
5904  *   <para>
5905  *    #GVariant structures only exist if they are explicitly created
5906  *    with API calls.  For example, if a #GVariant is constructed out of
5907  *    serialised data for the example given above (with the dictionary)
5908  *    then although there are 9 individual values that comprise the
5909  *    entire dictionary (two keys, two values, two variants containing
5910  *    the values, two dictionary entries, plus the dictionary itself),
5911  *    only 1 #GVariant instance exists -- the one referring to the
5912  *    dictionary.
5913  *   </para>
5914  *   <para>
5915  *    If calls are made to start accessing the other values then
5916  *    #GVariant instances will exist for those values only for as long
5917  *    as they are in use (ie: until you call g_variant_unref()).  The
5918  *    type information is shared.  The serialised data and the buffer
5919  *    management structure for that serialised data is shared by the
5920  *    child.
5921  *   </para>
5922  *  </refsect3>
5923  *  <refsect3>
5924  *   <title>Summary</title>
5925  *   <para>
5926  *    To put the entire example together, for our dictionary mapping
5927  *    strings to variants (with two entries, as given above), we are
5928  *    using 91 bytes of memory for type information, 29 byes of memory
5929  *    for the serialised data, 16 bytes for buffer management and 24
5930  *    bytes for the #GVariant instance, or a total of 160 bytes, plus
5931  *    malloc overhead.  If we were to use g_variant_get_child_value() to
5932  *    access the two dictionary entries, we would use an additional 48
5933  *    bytes.  If we were to have other dictionaries of the same type, we
5934  *    would use more memory for the serialised data and buffer
5935  *    management for those dictionaries, but the type information would
5936  *    be shared.
5937  *   </para>
5938  *  </refsect3>
5939  * </refsect2>
5940  */
5941
5942
5943 /**
5944  * SECTION:gvarianttype
5945  * @title: GVariantType
5946  * @short_description: introduction to the GVariant type system
5947  * @see_also: #GVariantType, #GVariant
5948  *
5949  * This section introduces the GVariant type system.  It is based, in
5950  * large part, on the D-Bus type system, with two major changes and some minor
5951  * lifting of restrictions.  The <ulink
5952  * url='http://dbus.freedesktop.org/doc/dbus-specification.html'>DBus
5953  * specification</ulink>, therefore, provides a significant amount of
5954  * information that is useful when working with GVariant.
5955  *
5956  * The first major change with respect to the D-Bus type system is the
5957  * introduction of maybe (or "nullable") types.  Any type in GVariant can be
5958  * converted to a maybe type, in which case, "nothing" (or "null") becomes a
5959  * valid value.  Maybe types have been added by introducing the
5960  * character "<literal>m</literal>" to type strings.
5961  *
5962  * The second major change is that the GVariant type system supports the
5963  * concept of "indefinite types" -- types that are less specific than
5964  * the normal types found in D-Bus.  For example, it is possible to speak
5965  * of "an array of any type" in GVariant, where the D-Bus type system
5966  * would require you to speak of "an array of integers" or "an array of
5967  * strings".  Indefinite types have been added by introducing the
5968  * characters "<literal>*</literal>", "<literal>?</literal>" and
5969  * "<literal>r</literal>" to type strings.
5970  *
5971  * Finally, all arbitrary restrictions relating to the complexity of
5972  * types are lifted along with the restriction that dictionary entries
5973  * may only appear nested inside of arrays.
5974  *
5975  * Just as in D-Bus, GVariant types are described with strings ("type
5976  * strings").  Subject to the differences mentioned above, these strings
5977  * are of the same form as those found in DBus.  Note, however: D-Bus
5978  * always works in terms of messages and therefore individual type
5979  * strings appear nowhere in its interface.  Instead, "signatures"
5980  * are a concatenation of the strings of the type of each argument in a
5981  * message.  GVariant deals with single values directly so GVariant type
5982  * strings always describe the type of exactly one value.  This means
5983  * that a D-Bus signature string is generally not a valid GVariant type
5984  * string -- except in the case that it is the signature of a message
5985  * containing exactly one argument.
5986  *
5987  * An indefinite type is similar in spirit to what may be called an
5988  * abstract type in other type systems.  No value can exist that has an
5989  * indefinite type as its type, but values can exist that have types
5990  * that are subtypes of indefinite types.  That is to say,
5991  * g_variant_get_type() will never return an indefinite type, but
5992  * calling g_variant_is_of_type() with an indefinite type may return
5993  * %TRUE.  For example, you cannot have a value that represents "an
5994  * array of no particular type", but you can have an "array of integers"
5995  * which certainly matches the type of "an array of no particular type",
5996  * since "array of integers" is a subtype of "array of no particular
5997  * type".
5998  *
5999  * This is similar to how instances of abstract classes may not
6000  * directly exist in other type systems, but instances of their
6001  * non-abstract subtypes may.  For example, in GTK, no object that has
6002  * the type of #GtkBin can exist (since #GtkBin is an abstract class),
6003  * but a #GtkWindow can certainly be instantiated, and you would say
6004  * that the #GtkWindow is a #GtkBin (since #GtkWindow is a subclass of
6005  * #GtkBin).
6006  *
6007  * A detailed description of GVariant type strings is given here:
6008  *
6009  * <refsect2 id='gvariant-typestrings'>
6010  *  <title>GVariant Type Strings</title>
6011  *  <para>
6012  *   A GVariant type string can be any of the following:
6013  *  </para>
6014  *  <itemizedlist>
6015  *   <listitem>
6016  *    <para>
6017  *     any basic type string (listed below)
6018  *    </para>
6019  *   </listitem>
6020  *   <listitem>
6021  *    <para>
6022  *     "<literal>v</literal>", "<literal>r</literal>" or
6023  *     "<literal>*</literal>"
6024  *    </para>
6025  *   </listitem>
6026  *   <listitem>
6027  *    <para>
6028  *     one of the characters '<literal>a</literal>' or
6029  *     '<literal>m</literal>', followed by another type string
6030  *    </para>
6031  *   </listitem>
6032  *   <listitem>
6033  *    <para>
6034  *     the character '<literal>(</literal>', followed by a concatenation
6035  *     of zero or more other type strings, followed by the character
6036  *     '<literal>)</literal>'
6037  *    </para>
6038  *   </listitem>
6039  *   <listitem>
6040  *    <para>
6041  *     the character '<literal>{</literal>', followed by a basic type
6042  *     string (see below), followed by another type string, followed by
6043  *     the character '<literal>}</literal>'
6044  *    </para>
6045  *   </listitem>
6046  *  </itemizedlist>
6047  *  <para>
6048  *   A basic type string describes a basic type (as per
6049  *   g_variant_type_is_basic()) and is always a single
6050  *   character in length.  The valid basic type strings are
6051  *   "<literal>b</literal>", "<literal>y</literal>",
6052  *   "<literal>n</literal>", "<literal>q</literal>",
6053  *   "<literal>i</literal>", "<literal>u</literal>",
6054  *   "<literal>x</literal>", "<literal>t</literal>",
6055  *   "<literal>h</literal>", "<literal>d</literal>",
6056  *   "<literal>s</literal>", "<literal>o</literal>",
6057  *   "<literal>g</literal>" and "<literal>?</literal>".
6058  *  </para>
6059  *  <para>
6060  *   The above definition is recursive to arbitrary depth.
6061  *   "<literal>aaaaai</literal>" and "<literal>(ui(nq((y)))s)</literal>"
6062  *   are both valid type strings, as is
6063  *   "<literal>a(aa(ui)(qna{ya(yd)}))</literal>".
6064  *  </para>
6065  *  <para>
6066  *   The meaning of each of the characters is as follows:
6067  *  </para>
6068  *  <informaltable>
6069  *   <tgroup cols='2'>
6070  *    <tbody>
6071  *     <row>
6072  *      <entry>
6073  *       <para>
6074  *        <emphasis role='strong'>Character</emphasis>
6075  *       </para>
6076  *      </entry>
6077  *      <entry>
6078  *       <para>
6079  *        <emphasis role='strong'>Meaning</emphasis>
6080  *       </para>
6081  *      </entry>
6082  *     </row>
6083  *     <row>
6084  *      <entry>
6085  *       <para>
6086  *        <literal>b</literal>
6087  *       </para>
6088  *      </entry>
6089  *      <entry>
6090  *       <para>
6091  *        the type string of %G_VARIANT_TYPE_BOOLEAN; a boolean value.
6092  *       </para>
6093  *      </entry>
6094  *     </row>
6095  *     <row>
6096  *      <entry>
6097  *       <para>
6098  *        <literal>y</literal>
6099  *       </para>
6100  *      </entry>
6101  *      <entry>
6102  *       <para>
6103  *        the type string of %G_VARIANT_TYPE_BYTE; a byte.
6104  *       </para>
6105  *      </entry>
6106  *     </row>
6107  *     <row>
6108  *      <entry>
6109  *       <para>
6110  *        <literal>n</literal>
6111  *       </para>
6112  *      </entry>
6113  *      <entry>
6114  *       <para>
6115  *        the type string of %G_VARIANT_TYPE_INT16; a signed 16 bit
6116  *        integer.
6117  *       </para>
6118  *      </entry>
6119  *     </row>
6120  *     <row>
6121  *      <entry>
6122  *       <para>
6123  *        <literal>q</literal>
6124  *       </para>
6125  *      </entry>
6126  *      <entry>
6127  *       <para>
6128  *        the type string of %G_VARIANT_TYPE_UINT16; an unsigned 16 bit
6129  *        integer.
6130  *       </para>
6131  *      </entry>
6132  *     </row>
6133  *     <row>
6134  *      <entry>
6135  *       <para>
6136  *        <literal>i</literal>
6137  *       </para>
6138  *      </entry>
6139  *      <entry>
6140  *       <para>
6141  *        the type string of %G_VARIANT_TYPE_INT32; a signed 32 bit
6142  *        integer.
6143  *       </para>
6144  *      </entry>
6145  *     </row>
6146  *     <row>
6147  *      <entry>
6148  *       <para>
6149  *        <literal>u</literal>
6150  *       </para>
6151  *      </entry>
6152  *      <entry>
6153  *       <para>
6154  *        the type string of %G_VARIANT_TYPE_UINT32; an unsigned 32 bit
6155  *        integer.
6156  *       </para>
6157  *      </entry>
6158  *     </row>
6159  *     <row>
6160  *      <entry>
6161  *       <para>
6162  *        <literal>x</literal>
6163  *       </para>
6164  *      </entry>
6165  *      <entry>
6166  *       <para>
6167  *        the type string of %G_VARIANT_TYPE_INT64; a signed 64 bit
6168  *        integer.
6169  *       </para>
6170  *      </entry>
6171  *     </row>
6172  *     <row>
6173  *      <entry>
6174  *       <para>
6175  *        <literal>t</literal>
6176  *       </para>
6177  *      </entry>
6178  *      <entry>
6179  *       <para>
6180  *        the type string of %G_VARIANT_TYPE_UINT64; an unsigned 64 bit
6181  *        integer.
6182  *       </para>
6183  *      </entry>
6184  *     </row>
6185  *     <row>
6186  *      <entry>
6187  *       <para>
6188  *        <literal>h</literal>
6189  *       </para>
6190  *      </entry>
6191  *      <entry>
6192  *       <para>
6193  *        the type string of %G_VARIANT_TYPE_HANDLE; a signed 32 bit
6194  *        value that, by convention, is used as an index into an array
6195  *        of file descriptors that are sent alongside a D-Bus message.
6196  *       </para>
6197  *      </entry>
6198  *     </row>
6199  *     <row>
6200  *      <entry>
6201  *       <para>
6202  *        <literal>d</literal>
6203  *       </para>
6204  *      </entry>
6205  *      <entry>
6206  *       <para>
6207  *        the type string of %G_VARIANT_TYPE_DOUBLE; a double precision
6208  *        floating point value.
6209  *       </para>
6210  *      </entry>
6211  *     </row>
6212  *     <row>
6213  *      <entry>
6214  *       <para>
6215  *        <literal>s</literal>
6216  *       </para>
6217  *      </entry>
6218  *      <entry>
6219  *       <para>
6220  *        the type string of %G_VARIANT_TYPE_STRING; a string.
6221  *       </para>
6222  *      </entry>
6223  *     </row>
6224  *     <row>
6225  *      <entry>
6226  *       <para>
6227  *        <literal>o</literal>
6228  *       </para>
6229  *      </entry>
6230  *      <entry>
6231  *       <para>
6232  *        the type string of %G_VARIANT_TYPE_OBJECT_PATH; a string in
6233  *        the form of a D-Bus object path.
6234  *       </para>
6235  *      </entry>
6236  *     </row>
6237  *     <row>
6238  *      <entry>
6239  *       <para>
6240  *        <literal>g</literal>
6241  *       </para>
6242  *      </entry>
6243  *      <entry>
6244  *       <para>
6245  *        the type string of %G_VARIANT_TYPE_STRING; a string in the
6246  *        form of a D-Bus type signature.
6247  *       </para>
6248  *      </entry>
6249  *     </row>
6250  *     <row>
6251  *      <entry>
6252  *       <para>
6253  *        <literal>?</literal>
6254  *       </para>
6255  *      </entry>
6256  *      <entry>
6257  *       <para>
6258  *        the type string of %G_VARIANT_TYPE_BASIC; an indefinite type
6259  *        that is a supertype of any of the basic types.
6260  *       </para>
6261  *      </entry>
6262  *     </row>
6263  *     <row>
6264  *      <entry>
6265  *       <para>
6266  *        <literal>v</literal>
6267  *       </para>
6268  *      </entry>
6269  *      <entry>
6270  *       <para>
6271  *        the type string of %G_VARIANT_TYPE_VARIANT; a container type
6272  *        that contain any other type of value.
6273  *       </para>
6274  *      </entry>
6275  *     </row>
6276  *     <row>
6277  *      <entry>
6278  *       <para>
6279  *        <literal>a</literal>
6280  *       </para>
6281  *      </entry>
6282  *      <entry>
6283  *       <para>
6284  *        used as a prefix on another type string to mean an array of
6285  *        that type; the type string "<literal>ai</literal>", for
6286  *        example, is the type of an array of 32 bit signed integers.
6287  *       </para>
6288  *      </entry>
6289  *     </row>
6290  *     <row>
6291  *      <entry>
6292  *       <para>
6293  *        <literal>m</literal>
6294  *       </para>
6295  *      </entry>
6296  *      <entry>
6297  *       <para>
6298  *        used as a prefix on another type string to mean a "maybe", or
6299  *        "nullable", version of that type; the type string
6300  *        "<literal>ms</literal>", for example, is the type of a value
6301  *        that maybe contains a string, or maybe contains nothing.
6302  *       </para>
6303  *      </entry>
6304  *     </row>
6305  *     <row>
6306  *      <entry>
6307  *       <para>
6308  *        <literal>()</literal>
6309  *       </para>
6310  *      </entry>
6311  *      <entry>
6312  *       <para>
6313  *        used to enclose zero or more other concatenated type strings
6314  *        to create a tuple type; the type string
6315  *        "<literal>(is)</literal>", for example, is the type of a pair
6316  *        of an integer and a string.
6317  *       </para>
6318  *      </entry>
6319  *     </row>
6320  *     <row>
6321  *      <entry>
6322  *       <para>
6323  *        <literal>r</literal>
6324  *       </para>
6325  *      </entry>
6326  *      <entry>
6327  *       <para>
6328  *        the type string of %G_VARIANT_TYPE_TUPLE; an indefinite type
6329  *        that is a supertype of any tuple type, regardless of the
6330  *        number of items.
6331  *       </para>
6332  *      </entry>
6333  *     </row>
6334  *     <row>
6335  *      <entry>
6336  *       <para>
6337  *        <literal>{}</literal>
6338  *       </para>
6339  *      </entry>
6340  *      <entry>
6341  *       <para>
6342  *        used to enclose a basic type string concatenated with another
6343  *        type string to create a dictionary entry type, which usually
6344  *        appears inside of an array to form a dictionary; the type
6345  *        string "<literal>a{sd}</literal>", for example, is the type of
6346  *        a dictionary that maps strings to double precision floating
6347  *        point values.
6348  *       </para>
6349  *       <para>
6350  *        The first type (the basic type) is the key type and the second
6351  *        type is the value type.  The reason that the first type is
6352  *        restricted to being a basic type is so that it can easily be
6353  *        hashed.
6354  *       </para>
6355  *      </entry>
6356  *     </row>
6357  *     <row>
6358  *      <entry>
6359  *       <para>
6360  *        <literal>*</literal>
6361  *       </para>
6362  *      </entry>
6363  *      <entry>
6364  *       <para>
6365  *        the type string of %G_VARIANT_TYPE_ANY; the indefinite type
6366  *        that is a supertype of all types.  Note that, as with all type
6367  *        strings, this character represents exactly one type.  It
6368  *        cannot be used inside of tuples to mean "any number of items".
6369  *       </para>
6370  *      </entry>
6371  *     </row>
6372  *    </tbody>
6373  *   </tgroup>
6374  *  </informaltable>
6375  *  <para>
6376  *   Any type string of a container that contains an indefinite type is,
6377  *   itself, an indefinite type.  For example, the type string
6378  *   "<literal>a*</literal>" (corresponding to %G_VARIANT_TYPE_ARRAY) is
6379  *   an indefinite type that is a supertype of every array type.
6380  *   "<literal>(*s)</literal>" is a supertype of all tuples that
6381  *   contain exactly two items where the second item is a string.
6382  *  </para>
6383  *  <para>
6384  *   "<literal>a{?*}</literal>" is an indefinite type that is a
6385  *   supertype of all arrays containing dictionary entries where the key
6386  *   is any basic type and the value is any type at all.  This is, by
6387  *   definition, a dictionary, so this type string corresponds to
6388  *   %G_VARIANT_TYPE_DICTIONARY.  Note that, due to the restriction that
6389  *   the key of a dictionary entry must be a basic type,
6390  *   "<literal>{**}</literal>" is not a valid type string.
6391  *  </para>
6392  * </refsect2>
6393  */
6394
6395
6396 /**
6397  * SECTION:hash_tables
6398  * @title: Hash Tables
6399  * @short_description: associations between keys and values so that given a key the value can be found quickly
6400  *
6401  * A #GHashTable provides associations between keys and values which is
6402  * optimized so that given a key, the associated value can be found
6403  * very quickly.
6404  *
6405  * Note that neither keys nor values are copied when inserted into the
6406  * #GHashTable, so they must exist for the lifetime of the #GHashTable.
6407  * This means that the use of static strings is OK, but temporary
6408  * strings (i.e. those created in buffers and those returned by GTK+
6409  * widgets) should be copied with g_strdup() before being inserted.
6410  *
6411  * If keys or values are dynamically allocated, you must be careful to
6412  * ensure that they are freed when they are removed from the
6413  * #GHashTable, and also when they are overwritten by new insertions
6414  * into the #GHashTable. It is also not advisable to mix static strings
6415  * and dynamically-allocated strings in a #GHashTable, because it then
6416  * becomes difficult to determine whether the string should be freed.
6417  *
6418  * To create a #GHashTable, use g_hash_table_new().
6419  *
6420  * To insert a key and value into a #GHashTable, use
6421  * g_hash_table_insert().
6422  *
6423  * To lookup a value corresponding to a given key, use
6424  * g_hash_table_lookup() and g_hash_table_lookup_extended().
6425  *
6426  * g_hash_table_lookup_extended() can also be used to simply
6427  * check if a key is present in the hash table.
6428  *
6429  * To remove a key and value, use g_hash_table_remove().
6430  *
6431  * To call a function for each key and value pair use
6432  * g_hash_table_foreach() or use a iterator to iterate over the
6433  * key/value pairs in the hash table, see #GHashTableIter.
6434  *
6435  * To destroy a #GHashTable use g_hash_table_destroy().
6436  *
6437  * A common use-case for hash tables is to store information about a
6438  * set of keys, without associating any particular value with each
6439  * key. GHashTable optimizes one way of doing so: If you store only
6440  * key-value pairs where key == value, then GHashTable does not
6441  * allocate memory to store the values, which can be a considerable
6442  * space saving, if your set is large. The functions
6443  * g_hash_table_add() and g_hash_table_contains() are designed to be
6444  * used when using #GHashTable this way.
6445  */
6446
6447
6448 /**
6449  * SECTION:hmac
6450  * @title: Secure HMAC Digests
6451  * @short_description: computes the HMAC for data
6452  *
6453  * HMACs should be used when producing a cookie or hash based on data
6454  * and a key. Simple mechanisms for using SHA1 and other algorithms to
6455  * digest a key and data together are vulnerable to various security
6456  * issues. <ulink url="http://en.wikipedia.org/wiki/HMAC">HMAC</ulink>
6457  * uses algorithms like SHA1 in a secure way to produce a digest of a
6458  * key and data.
6459  *
6460  * Both the key and data are arbitrary byte arrays of bytes or characters.
6461  *
6462  * Support for HMAC Digests has been added in GLib 2.30.
6463  */
6464
6465
6466 /**
6467  * SECTION:hooks
6468  * @title: Hook Functions
6469  * @short_description: support for manipulating lists of hook functions
6470  *
6471  * The #GHookList, #GHook and their related functions provide support for
6472  * lists of hook functions. Functions can be added and removed from the lists,
6473  * and the list of hook functions can be invoked.
6474  */
6475
6476
6477 /**
6478  * SECTION:i18n
6479  * @title: Internationalization
6480  * @short_description: gettext support macros
6481  * @see_also: the gettext manual
6482  *
6483  * GLib doesn't force any particular localization method upon its users.
6484  * But since GLib itself is localized using the gettext() mechanism, it seems
6485  * natural to offer the de-facto standard gettext() support macros in an
6486  * easy-to-use form.
6487  *
6488  * In order to use these macros in an application, you must include
6489  * <filename>glib/gi18n.h</filename>. For use in a library, must include
6490  * <filename>glib/gi18n-lib.h</filename> <emphasis>after</emphasis> defining
6491  * the GETTEXT_PACKAGE macro suitably for your library:
6492  * |[
6493  * &num;define GETTEXT_PACKAGE "gtk20"
6494  * &num;include &lt;glib/gi18n-lib.h&gt;
6495  * ]|
6496  * Note that you also have to call setlocale() and textdomain() (as well as
6497  * bindtextdomain() and bind_textdomain_codeset()) early on in your main()
6498  * to make gettext() work.
6499  *
6500  * The gettext manual covers details of how to set up message extraction
6501  * with xgettext.
6502  */
6503
6504
6505 /**
6506  * SECTION:iochannels
6507  * @title: IO Channels
6508  * @short_description: portable support for using files, pipes and sockets
6509  * @see_also: <para> <variablelist> <varlistentry> <term>g_io_add_watch(), g_io_add_watch_full(), g_source_remove()</term> <listitem><para> Convenience functions for creating #GIOChannel instances and adding them to the <link linkend="glib-The-Main-Event-Loop">main event loop</link>. </para></listitem> </varlistentry> </variablelist> </para>
6510  *
6511  * The #GIOChannel data type aims to provide a portable method for
6512  * using file descriptors, pipes, and sockets, and integrating them
6513  * into the <link linkend="glib-The-Main-Event-Loop">main event
6514  * loop</link>. Currently full support is available on UNIX platforms,
6515  * support for Windows is only partially complete.
6516  *
6517  * To create a new #GIOChannel on UNIX systems use
6518  * g_io_channel_unix_new(). This works for plain file descriptors,
6519  * pipes and sockets. Alternatively, a channel can be created for a
6520  * file in a system independent manner using g_io_channel_new_file().
6521  *
6522  * Once a #GIOChannel has been created, it can be used in a generic
6523  * manner with the functions g_io_channel_read_chars(),
6524  * g_io_channel_write_chars(), g_io_channel_seek_position(), and
6525  * g_io_channel_shutdown().
6526  *
6527  * To add a #GIOChannel to the <link
6528  * linkend="glib-The-Main-Event-Loop">main event loop</link> use
6529  * g_io_add_watch() or g_io_add_watch_full(). Here you specify which
6530  * events you are interested in on the #GIOChannel, and provide a
6531  * function to be called whenever these events occur.
6532  *
6533  * #GIOChannel instances are created with an initial reference count of
6534  * 1. g_io_channel_ref() and g_io_channel_unref() can be used to
6535  * increment or decrement the reference count respectively. When the
6536  * reference count falls to 0, the #GIOChannel is freed. (Though it
6537  * isn't closed automatically, unless it was created using
6538  * g_io_channel_new_file().) Using g_io_add_watch() or
6539  * g_io_add_watch_full() increments a channel's reference count.
6540  *
6541  * The new functions g_io_channel_read_chars(),
6542  * g_io_channel_read_line(), g_io_channel_read_line_string(),
6543  * g_io_channel_read_to_end(), g_io_channel_write_chars(),
6544  * g_io_channel_seek_position(), and g_io_channel_flush() should not be
6545  * mixed with the deprecated functions g_io_channel_read(),
6546  * g_io_channel_write(), and g_io_channel_seek() on the same channel.
6547  */
6548
6549
6550 /**
6551  * SECTION:keyfile
6552  * @title: Key-value file parser
6553  * @short_description: parses .ini-like config files
6554  *
6555  * #GKeyFile lets you parse, edit or create files containing groups of
6556  * key-value pairs, which we call <firstterm>key files</firstterm> for
6557  * lack of a better name. Several freedesktop.org specifications use
6558  * key files now, e.g the
6559  * <ulink url="http://freedesktop.org/Standards/desktop-entry-spec">Desktop
6560  * Entry Specification</ulink> and the
6561  * <ulink url="http://freedesktop.org/Standards/icon-theme-spec">Icon
6562  * Theme Specification</ulink>.
6563  *
6564  * The syntax of key files is described in detail in the
6565  * <ulink url="http://freedesktop.org/Standards/desktop-entry-spec">Desktop
6566  * Entry Specification</ulink>, here is a quick summary: Key files
6567  * consists of groups of key-value pairs, interspersed with comments.
6568  *
6569  * |[
6570  * # this is just an example
6571  * # there can be comments before the first group
6572  *
6573  * [First Group]
6574  *
6575  * Name=Key File Example\tthis value shows\nescaping
6576  *
6577  * # localized strings are stored in multiple key-value pairs
6578  * Welcome=Hello
6579  * Welcome[de]=Hallo
6580  * Welcome[fr_FR]=Bonjour
6581  * Welcome[it]=Ciao
6582  * Welcome[be@latin]=Hello
6583  *
6584  * [Another Group]
6585  *
6586  * Numbers=2;20;-200;0
6587  *
6588  * Booleans=true;false;true;true
6589  * ]|
6590  *
6591  * Lines beginning with a '#' and blank lines are considered comments.
6592  *
6593  * Groups are started by a header line containing the group name enclosed
6594  * in '[' and ']', and ended implicitly by the start of the next group or
6595  * the end of the file. Each key-value pair must be contained in a group.
6596  *
6597  * Key-value pairs generally have the form <literal>key=value</literal>,
6598  * with the exception of localized strings, which have the form
6599  * <literal>key[locale]=value</literal>, with a locale identifier of the
6600  * form <literal>lang_COUNTRY@MODIFIER</literal> where
6601  * <literal>COUNTRY</literal> and <literal>MODIFIER</literal> are optional.
6602  * Space before and after the '=' character are ignored. Newline, tab,
6603  * carriage return and backslash characters in value are escaped as \n,
6604  * \t, \r, and \\, respectively. To preserve leading spaces in values,
6605  * these can also be escaped as \s.
6606  *
6607  * Key files can store strings (possibly with localized variants), integers,
6608  * booleans and lists of these. Lists are separated by a separator character,
6609  * typically ';' or ','. To use the list separator character in a value in
6610  * a list, it has to be escaped by prefixing it with a backslash.
6611  *
6612  * This syntax is obviously inspired by the .ini files commonly met
6613  * on Windows, but there are some important differences:
6614  * <itemizedlist>
6615  *   <listitem>.ini files use the ';' character to begin comments,
6616  *     key files use the '#' character.</listitem>
6617  *   <listitem>Key files do not allow for ungrouped keys meaning only
6618  *     comments can precede the first group.</listitem>
6619  *   <listitem>Key files are always encoded in UTF-8.</listitem>
6620  *   <listitem>Key and Group names are case-sensitive. For example, a
6621  *     group called <literal>[GROUP]</literal> is a different from
6622  *     <literal>[group]</literal>.</listitem>
6623  *   <listitem>.ini files don't have a strongly typed boolean entry type,
6624  *     they only have GetProfileInt(). In key files, only
6625  *     <literal>true</literal> and <literal>false</literal> (in lower case)
6626  *     are allowed.</listitem>
6627  *  </itemizedlist>
6628  *
6629  * Note that in contrast to the
6630  * <ulink url="http://freedesktop.org/Standards/desktop-entry-spec">Desktop
6631  * Entry Specification</ulink>, groups in key files may contain the same
6632  * key multiple times; the last entry wins. Key files may also contain
6633  * multiple groups with the same name; they are merged together.
6634  * Another difference is that keys and group names in key files are not
6635  * restricted to ASCII characters.
6636  */
6637
6638
6639 /**
6640  * SECTION:linked_lists_double
6641  * @title: Doubly-Linked Lists
6642  * @short_description: linked lists that can be iterated over in both directions
6643  *
6644  * The #GList structure and its associated functions provide a standard
6645  * doubly-linked list data structure.
6646  *
6647  * Each element in the list contains a piece of data, together with
6648  * pointers which link to the previous and next elements in the list.
6649  * Using these pointers it is possible to move through the list in both
6650  * directions (unlike the <link
6651  * linkend="glib-Singly-Linked-Lists">Singly-Linked Lists</link> which
6652  * only allows movement through the list in the forward direction).
6653  *
6654  * The data contained in each element can be either integer values, by
6655  * using one of the <link linkend="glib-Type-Conversion-Macros">Type
6656  * Conversion Macros</link>, or simply pointers to any type of data.
6657  *
6658  * List elements are allocated from the <link
6659  * linkend="glib-Memory-Slices">slice allocator</link>, which is more
6660  * efficient than allocating elements individually.
6661  *
6662  * Note that most of the #GList functions expect to be passed a pointer
6663  * to the first element in the list. The functions which insert
6664  * elements return the new start of the list, which may have changed.
6665  *
6666  * There is no function to create a #GList. %NULL is considered to be
6667  * the empty list so you simply set a #GList* to %NULL.
6668  *
6669  * To add elements, use g_list_append(), g_list_prepend(),
6670  * g_list_insert() and g_list_insert_sorted().
6671  *
6672  * To remove elements, use g_list_remove().
6673  *
6674  * To find elements in the list use g_list_first(), g_list_last(),
6675  * g_list_next(), g_list_previous(), g_list_nth(), g_list_nth_data(),
6676  * g_list_find() and g_list_find_custom().
6677  *
6678  * To find the index of an element use g_list_position() and
6679  * g_list_index().
6680  *
6681  * To call a function for each element in the list use g_list_foreach().
6682  *
6683  * To free the entire list, use g_list_free().
6684  */
6685
6686
6687 /**
6688  * SECTION:linked_lists_single
6689  * @title: Singly-Linked Lists
6690  * @short_description: linked lists that can be iterated in one direction
6691  *
6692  * The #GSList structure and its associated functions provide a
6693  * standard singly-linked list data structure.
6694  *
6695  * Each element in the list contains a piece of data, together with a
6696  * pointer which links to the next element in the list. Using this
6697  * pointer it is possible to move through the list in one direction
6698  * only (unlike the <link
6699  * linkend="glib-Doubly-Linked-Lists">Doubly-Linked Lists</link> which
6700  * allow movement in both directions).
6701  *
6702  * The data contained in each element can be either integer values, by
6703  * using one of the <link linkend="glib-Type-Conversion-Macros">Type
6704  * Conversion Macros</link>, or simply pointers to any type of data.
6705  *
6706  * List elements are allocated from the <link
6707  * linkend="glib-Memory-Slices">slice allocator</link>, which is more
6708  * efficient than allocating elements individually.
6709  *
6710  * Note that most of the #GSList functions expect to be passed a
6711  * pointer to the first element in the list. The functions which insert
6712  * elements return the new start of the list, which may have changed.
6713  *
6714  * There is no function to create a #GSList. %NULL is considered to be
6715  * the empty list so you simply set a #GSList* to %NULL.
6716  *
6717  * To add elements, use g_slist_append(), g_slist_prepend(),
6718  * g_slist_insert() and g_slist_insert_sorted().
6719  *
6720  * To remove elements, use g_slist_remove().
6721  *
6722  * To find elements in the list use g_slist_last(), g_slist_next(),
6723  * g_slist_nth(), g_slist_nth_data(), g_slist_find() and
6724  * g_slist_find_custom().
6725  *
6726  * To find the index of an element use g_slist_position() and
6727  * g_slist_index().
6728  *
6729  * To call a function for each element in the list use
6730  * g_slist_foreach().
6731  *
6732  * To free the entire list, use g_slist_free().
6733  */
6734
6735
6736 /**
6737  * SECTION:macros
6738  * @title: Standard Macros
6739  * @short_description: commonly-used macros
6740  *
6741  * These macros provide a few commonly-used features.
6742  */
6743
6744
6745 /**
6746  * SECTION:macros_misc
6747  * @title: Miscellaneous Macros
6748  * @short_description: specialized macros which are not used often
6749  *
6750  * These macros provide more specialized features which are not
6751  * needed so often by application programmers.
6752  */
6753
6754
6755 /**
6756  * SECTION:main
6757  * @title: The Main Event Loop
6758  * @short_description: manages all available sources of events
6759  *
6760  * The main event loop manages all the available sources of events for
6761  * GLib and GTK+ applications. These events can come from any number of
6762  * different types of sources such as file descriptors (plain files,
6763  * pipes or sockets) and timeouts. New types of event sources can also
6764  * be added using g_source_attach().
6765  *
6766  * To allow multiple independent sets of sources to be handled in
6767  * different threads, each source is associated with a #GMainContext.
6768  * A GMainContext can only be running in a single thread, but
6769  * sources can be added to it and removed from it from other threads.
6770  *
6771  * Each event source is assigned a priority. The default priority,
6772  * #G_PRIORITY_DEFAULT, is 0. Values less than 0 denote higher priorities.
6773  * Values greater than 0 denote lower priorities. Events from high priority
6774  * sources are always processed before events from lower priority sources.
6775  *
6776  * Idle functions can also be added, and assigned a priority. These will
6777  * be run whenever no events with a higher priority are ready to be processed.
6778  *
6779  * The #GMainLoop data type represents a main event loop. A GMainLoop is
6780  * created with g_main_loop_new(). After adding the initial event sources,
6781  * g_main_loop_run() is called. This continuously checks for new events from
6782  * each of the event sources and dispatches them. Finally, the processing of
6783  * an event from one of the sources leads to a call to g_main_loop_quit() to
6784  * exit the main loop, and g_main_loop_run() returns.
6785  *
6786  * It is possible to create new instances of #GMainLoop recursively.
6787  * This is often used in GTK+ applications when showing modal dialog
6788  * boxes. Note that event sources are associated with a particular
6789  * #GMainContext, and will be checked and dispatched for all main
6790  * loops associated with that GMainContext.
6791  *
6792  * GTK+ contains wrappers of some of these functions, e.g. gtk_main(),
6793  * gtk_main_quit() and gtk_events_pending().
6794  *
6795  * <refsect2><title>Creating new source types</title>
6796  * <para>One of the unusual features of the #GMainLoop functionality
6797  * is that new types of event source can be created and used in
6798  * addition to the builtin type of event source. A new event source
6799  * type is used for handling GDK events. A new source type is created
6800  * by <firstterm>deriving</firstterm> from the #GSource structure.
6801  * The derived type of source is represented by a structure that has
6802  * the #GSource structure as a first element, and other elements specific
6803  * to the new source type. To create an instance of the new source type,
6804  * call g_source_new() passing in the size of the derived structure and
6805  * a table of functions. These #GSourceFuncs determine the behavior of
6806  * the new source type.</para>
6807  * <para>New source types basically interact with the main context
6808  * in two ways. Their prepare function in #GSourceFuncs can set a timeout
6809  * to determine the maximum amount of time that the main loop will sleep
6810  * before checking the source again. In addition, or as well, the source
6811  * can add file descriptors to the set that the main context checks using
6812  * g_source_add_poll().</para>
6813  * </refsect2>
6814  * <refsect2><title>Customizing the main loop iteration</title>
6815  * <para>Single iterations of a #GMainContext can be run with
6816  * g_main_context_iteration(). In some cases, more detailed control
6817  * of exactly how the details of the main loop work is desired, for
6818  * instance, when integrating the #GMainLoop with an external main loop.
6819  * In such cases, you can call the component functions of
6820  * g_main_context_iteration() directly. These functions are
6821  * g_main_context_prepare(), g_main_context_query(),
6822  * g_main_context_check() and g_main_context_dispatch().</para>
6823  * <para>The operation of these functions can best be seen in terms
6824  * of a state diagram, as shown in <xref linkend="mainloop-states"/>.</para>
6825  * <figure id="mainloop-states"><title>States of a Main Context</title>
6826  * <graphic fileref="mainloop-states.gif" format="GIF"></graphic>
6827  * </figure>
6828  * </refsect2>
6829  *
6830  * On Unix, the GLib mainloop is incompatible with fork().  Any program
6831  * using the mainloop must either exec() or exit() from the child
6832  * without returning to the mainloop.
6833  */
6834
6835
6836 /**
6837  * SECTION:markup
6838  * @Title: Simple XML Subset Parser
6839  * @Short_description: parses a subset of XML
6840  * @See_also: <ulink url="http://www.w3.org/TR/REC-xml/">XML Specification</ulink>
6841  *
6842  * The "GMarkup" parser is intended to parse a simple markup format
6843  * that's a subset of XML. This is a small, efficient, easy-to-use
6844  * parser. It should not be used if you expect to interoperate with
6845  * other applications generating full-scale XML. However, it's very
6846  * useful for application data files, config files, etc. where you
6847  * know your application will be the only one writing the file.
6848  * Full-scale XML parsers should be able to parse the subset used by
6849  * GMarkup, so you can easily migrate to full-scale XML at a later
6850  * time if the need arises.
6851  *
6852  * GMarkup is not guaranteed to signal an error on all invalid XML;
6853  * the parser may accept documents that an XML parser would not.
6854  * However, XML documents which are not well-formed<footnote
6855  * id="wellformed">Being wellformed is a weaker condition than being
6856  * valid. See the <ulink url="http://www.w3.org/TR/REC-xml/">XML
6857  * specification</ulink> for definitions of these terms.</footnote>
6858  * are not considered valid GMarkup documents.
6859  *
6860  * Simplifications to XML include:
6861  * <itemizedlist>
6862  * <listitem>Only UTF-8 encoding is allowed</listitem>
6863  * <listitem>No user-defined entities</listitem>
6864  * <listitem>Processing instructions, comments and the doctype declaration
6865  * are "passed through" but are not interpreted in any way</listitem>
6866  * <listitem>No DTD or validation.</listitem>
6867  * </itemizedlist>
6868  *
6869  * The markup format does support:
6870  * <itemizedlist>
6871  * <listitem>Elements</listitem>
6872  * <listitem>Attributes</listitem>
6873  * <listitem>5 standard entities:
6874  *   <literal>&amp;amp; &amp;lt; &amp;gt; &amp;quot; &amp;apos;</literal>
6875  * </listitem>
6876  * <listitem>Character references</listitem>
6877  * <listitem>Sections marked as CDATA</listitem>
6878  * </itemizedlist>
6879  */
6880
6881
6882 /**
6883  * SECTION:memory
6884  * @Short_Description: general memory-handling
6885  * @Title: Memory Allocation
6886  *
6887  * These functions provide support for allocating and freeing memory.
6888  *
6889  * <note>
6890  * If any call to allocate memory fails, the application is terminated.
6891  * This also means that there is no need to check if the call succeeded.
6892  * </note>
6893  *
6894  * <note>
6895  * It's important to match g_malloc() with g_free(), plain malloc() with free(),
6896  * and (if you're using C++) new with delete and new[] with delete[]. Otherwise
6897  * bad things can happen, since these allocators may use different memory
6898  * pools (and new/delete call constructors and destructors). See also
6899  * g_mem_set_vtable().
6900  * </note>
6901  */
6902
6903
6904 /**
6905  * SECTION:memory_slices
6906  * @title: Memory Slices
6907  * @short_description: efficient way to allocate groups of equal-sized chunks of memory
6908  *
6909  * Memory slices provide a space-efficient and multi-processing scalable
6910  * way to allocate equal-sized pieces of memory, just like the original
6911  * #GMemChunks (from GLib 2.8), while avoiding their excessive
6912  * memory-waste, scalability and performance problems.
6913  *
6914  * To achieve these goals, the slice allocator uses a sophisticated,
6915  * layered design that has been inspired by Bonwick's slab allocator
6916  * <footnote><para>
6917  * <ulink url="http://citeseer.ist.psu.edu/bonwick94slab.html">[Bonwick94]</ulink> Jeff Bonwick, The slab allocator: An object-caching kernel
6918  * memory allocator. USENIX 1994, and
6919  * <ulink url="http://citeseer.ist.psu.edu/bonwick01magazines.html">[Bonwick01]</ulink> Bonwick and Jonathan Adams, Magazines and vmem: Extending the
6920  * slab allocator to many cpu's and arbitrary resources. USENIX 2001
6921  * </para></footnote>.
6922  * It uses posix_memalign() to optimize allocations of many equally-sized
6923  * chunks, and has per-thread free lists (the so-called magazine layer)
6924  * to quickly satisfy allocation requests of already known structure sizes.
6925  * This is accompanied by extra caching logic to keep freed memory around
6926  * for some time before returning it to the system. Memory that is unused
6927  * due to alignment constraints is used for cache colorization (random
6928  * distribution of chunk addresses) to improve CPU cache utilization. The
6929  * caching layer of the slice allocator adapts itself to high lock contention
6930  * to improve scalability.
6931  *
6932  * The slice allocator can allocate blocks as small as two pointers, and
6933  * unlike malloc(), it does not reserve extra space per block. For large block
6934  * sizes, g_slice_new() and g_slice_alloc() will automatically delegate to the
6935  * system malloc() implementation. For newly written code it is recommended
6936  * to use the new <literal>g_slice</literal> API instead of g_malloc() and
6937  * friends, as long as objects are not resized during their lifetime and the
6938  * object size used at allocation time is still available when freeing.
6939  *
6940  * <example>
6941  * <title>Using the slice allocator</title>
6942  * <programlisting>
6943  * gchar *mem[10000];
6944  * gint i;
6945  *
6946  * /&ast; Allocate 10000 blocks. &ast;/
6947  * for (i = 0; i &lt; 10000; i++)
6948  *   {
6949  *     mem[i] = g_slice_alloc (50);
6950  *
6951  *     /&ast; Fill in the memory with some junk. &ast;/
6952  *     for (j = 0; j &lt; 50; j++)
6953  *       mem[i][j] = i * j;
6954  *   }
6955  *
6956  * /&ast; Now free all of the blocks. &ast;/
6957  * for (i = 0; i &lt; 10000; i++)
6958  *   {
6959  *     g_slice_free1 (50, mem[i]);
6960  *   }
6961  * </programlisting></example>
6962  *
6963  * <example>
6964  * <title>Using the slice allocator with data structures</title>
6965  * <programlisting>
6966  * GRealArray *array;
6967  *
6968  * /&ast; Allocate one block, using the g_slice_new() macro. &ast;/
6969  * array = g_slice_new (GRealArray);
6970  *
6971  * /&ast; We can now use array just like a normal pointer to a structure. &ast;/
6972  * array->data            = NULL;
6973  * array->len             = 0;
6974  * array->alloc           = 0;
6975  * array->zero_terminated = (zero_terminated ? 1 : 0);
6976  * array->clear           = (clear ? 1 : 0);
6977  * array->elt_size        = elt_size;
6978  *
6979  * /&ast; We can free the block, so it can be reused. &ast;/
6980  * g_slice_free (GRealArray, array);
6981  * </programlisting></example>
6982  */
6983
6984
6985 /**
6986  * SECTION:messages
6987  * @title: Message Logging
6988  * @short_description: versatile support for logging messages with different levels of importance
6989  *
6990  * These functions provide support for logging error messages
6991  * or messages used for debugging.
6992  *
6993  * There are several built-in levels of messages, defined in
6994  * #GLogLevelFlags. These can be extended with user-defined levels.
6995  */
6996
6997
6998 /**
6999  * SECTION:misc_utils
7000  * @title: Miscellaneous Utility Functions
7001  * @short_description: a selection of portable utility functions
7002  *
7003  * These are portable utility functions.
7004  */
7005
7006
7007 /**
7008  * SECTION:numerical
7009  * @title: Numerical Definitions
7010  * @short_description: mathematical constants, and floating point decomposition
7011  *
7012  * GLib offers mathematical constants such as #G_PI for the value of pi;
7013  * many platforms have these in the C library, but some don't, the GLib
7014  * versions always exist.
7015  *
7016  * The #GFloatIEEE754 and #GDoubleIEEE754 unions are used to access the
7017  * sign, mantissa and exponent of IEEE floats and doubles. These unions are
7018  * defined as appropriate for a given platform. IEEE floats and doubles are
7019  * supported (used for storage) by at least Intel, PPC and Sparc. See
7020  * <ulink url="http://en.wikipedia.org/wiki/IEEE_float">IEEE 754-2008</ulink>
7021  * for more information about IEEE number formats.
7022  */
7023
7024
7025 /**
7026  * SECTION:option
7027  * @Short_description: parses commandline options
7028  * @Title: Commandline option parser
7029  *
7030  * The GOption commandline parser is intended to be a simpler replacement
7031  * for the popt library. It supports short and long commandline options,
7032  * as shown in the following example:
7033  *
7034  * <literal>testtreemodel -r 1 --max-size 20 --rand --display=:1.0 -vb -- file1 file2</literal>
7035  *
7036  * The example demonstrates a number of features of the GOption
7037  * commandline parser
7038  * <itemizedlist><listitem><para>
7039  *   Options can be single letters, prefixed by a single dash. Multiple
7040  *   short options can be grouped behind a single dash.
7041  * </para></listitem><listitem><para>
7042  *   Long options are prefixed by two consecutive dashes.
7043  * </para></listitem><listitem><para>
7044  *   Options can have an extra argument, which can be a number, a string or
7045  *   a filename. For long options, the extra argument can be appended with
7046  *   an equals sign after the option name, which is useful if the extra
7047  *   argument starts with a dash, which would otherwise cause it to be
7048  *   interpreted as another option.
7049  * </para></listitem><listitem><para>
7050  *   Non-option arguments are returned to the application as rest arguments.
7051  * </para></listitem><listitem><para>
7052  *   An argument consisting solely of two dashes turns off further parsing,
7053  *   any remaining arguments (even those starting with a dash) are returned
7054  *   to the application as rest arguments.
7055  * </para></listitem></itemizedlist>
7056  *
7057  * Another important feature of GOption is that it can automatically
7058  * generate nicely formatted help output. Unless it is explicitly turned
7059  * off with g_option_context_set_help_enabled(), GOption will recognize
7060  * the <option>--help</option>, <option>-?</option>,
7061  * <option>--help-all</option> and
7062  * <option>--help-</option><replaceable>groupname</replaceable> options
7063  * (where <replaceable>groupname</replaceable> is the name of a
7064  * #GOptionGroup) and write a text similar to the one shown in the
7065  * following example to stdout.
7066  *
7067  * <informalexample><screen>
7068  * Usage:
7069  *   testtreemodel [OPTION...] - test tree model performance
7070  *
7071  * Help Options:
7072  *   -h, --help               Show help options
7073  *   --help-all               Show all help options
7074  *   --help-gtk               Show GTK+ Options
7075  *
7076  * Application Options:
7077  *   -r, --repeats=N          Average over N repetitions
7078  *   -m, --max-size=M         Test up to 2^M items
7079  *   --display=DISPLAY        X display to use
7080  *   -v, --verbose            Be verbose
7081  *   -b, --beep               Beep when done
7082  *   --rand                   Randomize the data
7083  * </screen></informalexample>
7084  *
7085  * GOption groups options in #GOptionGroup<!-- -->s, which makes it easy to
7086  * incorporate options from multiple sources. The intended use for this is
7087  * to let applications collect option groups from the libraries it uses,
7088  * add them to their #GOptionContext, and parse all options by a single call
7089  * to g_option_context_parse(). See gtk_get_option_group() for an example.
7090  *
7091  * If an option is declared to be of type string or filename, GOption takes
7092  * care of converting it to the right encoding; strings are returned in
7093  * UTF-8, filenames are returned in the GLib filename encoding. Note that
7094  * this only works if setlocale() has been called before
7095  * g_option_context_parse().
7096  *
7097  * Here is a complete example of setting up GOption to parse the example
7098  * commandline above and produce the example help output.
7099  *
7100  * <informalexample><programlisting>
7101  * static gint repeats = 2;
7102  * static gint max_size = 8;
7103  * static gboolean verbose = FALSE;
7104  * static gboolean beep = FALSE;
7105  * static gboolean rand = FALSE;
7106  *
7107  * static GOptionEntry entries[] =
7108  * {
7109  *   { "repeats", 'r', 0, G_OPTION_ARG_INT, &repeats, "Average over N repetitions", "N" },
7110  *   { "max-size", 'm', 0, G_OPTION_ARG_INT, &max_size, "Test up to 2^M items", "M" },
7111  *   { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL },
7112  *   { "beep", 'b', 0, G_OPTION_ARG_NONE, &beep, "Beep when done", NULL },
7113  *   { "rand", 0, 0, G_OPTION_ARG_NONE, &rand, "Randomize the data", NULL },
7114  *   { NULL }
7115  * };
7116  *
7117  * int
7118  * main (int argc, char *argv[])
7119  * {
7120  *   GError *error = NULL;
7121  *   GOptionContext *context;
7122  *
7123  *   context = g_option_context_new ("- test tree model performance");
7124  *   g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
7125  *   g_option_context_add_group (context, gtk_get_option_group (TRUE));
7126  *   if (!g_option_context_parse (context, &argc, &argv, &error))
7127  *     {
7128  *       g_print ("option parsing failed: %s\n", error->message);
7129  *       exit (1);
7130  *     }
7131  *
7132  *   /&ast; ... &ast;/
7133  *
7134  * }
7135  * </programlisting></informalexample>
7136  */
7137
7138
7139 /**
7140  * SECTION:patterns
7141  * @title: Glob-style pattern matching
7142  * @short_description: matches strings against patterns containing '*' (wildcard) and '?' (joker)
7143  *
7144  * The <function>g_pattern_match*</function> functions match a string
7145  * against a pattern containing '*' and '?' wildcards with similar
7146  * semantics as the standard glob() function: '*' matches an arbitrary,
7147  * possibly empty, string, '?' matches an arbitrary character.
7148  *
7149  * Note that in contrast to glob(), the '/' character
7150  * <emphasis>can</emphasis> be matched by the wildcards, there are no
7151  * '[...]' character ranges and '*' and '?' can
7152  * <emphasis>not</emphasis> be escaped to include them literally in a
7153  * pattern.
7154  *
7155  * When multiple strings must be matched against the same pattern, it
7156  * is better to compile the pattern to a #GPatternSpec using
7157  * g_pattern_spec_new() and use g_pattern_match_string() instead of
7158  * g_pattern_match_simple(). This avoids the overhead of repeated
7159  * pattern compilation.
7160  */
7161
7162
7163 /**
7164  * SECTION:quarks
7165  * @title: Quarks
7166  * @short_description: a 2-way association between a string and a unique integer identifier
7167  *
7168  * Quarks are associations between strings and integer identifiers.
7169  * Given either the string or the #GQuark identifier it is possible to
7170  * retrieve the other.
7171  *
7172  * Quarks are used for both <link
7173  * linkend="glib-Datasets">Datasets</link> and <link
7174  * linkend="glib-Keyed-Data-Lists">Keyed Data Lists</link>.
7175  *
7176  * To create a new quark from a string, use g_quark_from_string() or
7177  * g_quark_from_static_string().
7178  *
7179  * To find the string corresponding to a given #GQuark, use
7180  * g_quark_to_string().
7181  *
7182  * To find the #GQuark corresponding to a given string, use
7183  * g_quark_try_string().
7184  *
7185  * Another use for the string pool maintained for the quark functions
7186  * is string interning, using g_intern_string() or
7187  * g_intern_static_string(). An interned string is a canonical
7188  * representation for a string. One important advantage of interned
7189  * strings is that they can be compared for equality by a simple
7190  * pointer comparison, rather than using strcmp().
7191  */
7192
7193
7194 /**
7195  * SECTION:queue
7196  * @Title: Double-ended Queues
7197  * @Short_description: double-ended queue data structure
7198  *
7199  * The #GQueue structure and its associated functions provide a standard
7200  * queue data structure. Internally, GQueue uses the same data structure
7201  * as #GList to store elements.
7202  *
7203  * The data contained in each element can be either integer values, by
7204  * using one of the <link linkend="glib-Type-Conversion-Macros">Type
7205  * Conversion Macros</link>, or simply pointers to any type of data.
7206  *
7207  * To create a new GQueue, use g_queue_new().
7208  *
7209  * To initialize a statically-allocated GQueue, use #G_QUEUE_INIT or
7210  * g_queue_init().
7211  *
7212  * To add elements, use g_queue_push_head(), g_queue_push_head_link(),
7213  * g_queue_push_tail() and g_queue_push_tail_link().
7214  *
7215  * To remove elements, use g_queue_pop_head() and g_queue_pop_tail().
7216  *
7217  * To free the entire queue, use g_queue_free().
7218  */
7219
7220
7221 /**
7222  * SECTION:random_numbers
7223  * @title: Random Numbers
7224  * @short_description: pseudo-random number generator
7225  *
7226  * The following functions allow you to use a portable, fast and good
7227  * pseudo-random number generator (PRNG). It uses the Mersenne Twister
7228  * PRNG, which was originally developed by Makoto Matsumoto and Takuji
7229  * Nishimura. Further information can be found at
7230  * <ulink url="http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html">
7231  * http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html</ulink>.
7232  *
7233  * If you just need a random number, you simply call the
7234  * <function>g_random_*</function> functions, which will create a
7235  * globally used #GRand and use the according
7236  * <function>g_rand_*</function> functions internally. Whenever you
7237  * need a stream of reproducible random numbers, you better create a
7238  * #GRand yourself and use the <function>g_rand_*</function> functions
7239  * directly, which will also be slightly faster. Initializing a #GRand
7240  * with a certain seed will produce exactly the same series of random
7241  * numbers on all platforms. This can thus be used as a seed for e.g.
7242  * games.
7243  *
7244  * The <function>g_rand*_range</function> functions will return high
7245  * quality equally distributed random numbers, whereas for example the
7246  * <literal>(g_random_int()&percnt;max)</literal> approach often
7247  * doesn't yield equally distributed numbers.
7248  *
7249  * GLib changed the seeding algorithm for the pseudo-random number
7250  * generator Mersenne Twister, as used by
7251  * <structname>GRand</structname> and <structname>GRandom</structname>.
7252  * This was necessary, because some seeds would yield very bad
7253  * pseudo-random streams.  Also the pseudo-random integers generated by
7254  * <function>g_rand*_int_range()</function> will have a slightly better
7255  * equal distribution with the new version of GLib.
7256  *
7257  * The original seeding and generation algorithms, as found in GLib
7258  * 2.0.x, can be used instead of the new ones by setting the
7259  * environment variable <envar>G_RANDOM_VERSION</envar> to the value of
7260  * '2.0'. Use the GLib-2.0 algorithms only if you have sequences of
7261  * numbers generated with Glib-2.0 that you need to reproduce exactly.
7262  */
7263
7264
7265 /**
7266  * SECTION:scanner
7267  * @title: Lexical Scanner
7268  * @short_description: a general purpose lexical scanner
7269  *
7270  * The #GScanner and its associated functions provide a
7271  * general purpose lexical scanner.
7272  */
7273
7274
7275 /**
7276  * SECTION:sequence
7277  * @title: Sequences
7278  * @short_description: scalable lists
7279  *
7280  * The #GSequence data structure has the API of a list, but is
7281  * implemented internally with a balanced binary tree. This means that
7282  * it is possible to maintain a sorted list of n elements in time O(n
7283  * log n). The data contained in each element can be either integer
7284  * values, by using of the <link
7285  * linkend="glib-Type-Conversion-Macros">Type Conversion Macros</link>,
7286  * or simply pointers to any type of data.
7287  *
7288  * A #GSequence is accessed through <firstterm>iterators</firstterm>,
7289  * represented by a #GSequenceIter. An iterator represents a position
7290  * between two elements of the sequence. For example, the
7291  * <firstterm>begin</firstterm> iterator represents the gap immediately
7292  * before the first element of the sequence, and the
7293  * <firstterm>end</firstterm> iterator represents the gap immediately
7294  * after the last element. In an empty sequence, the begin and end
7295  * iterators are the same.
7296  *
7297  * Some methods on #GSequence operate on ranges of items. For example
7298  * g_sequence_foreach_range() will call a user-specified function on
7299  * each element with the given range. The range is delimited by the
7300  * gaps represented by the passed-in iterators, so if you pass in the
7301  * begin and end iterators, the range in question is the entire
7302  * sequence.
7303  *
7304  * The function g_sequence_get() is used with an iterator to access the
7305  * element immediately following the gap that the iterator represents.
7306  * The iterator is said to <firstterm>point</firstterm> to that element.
7307  *
7308  * Iterators are stable across most operations on a #GSequence. For
7309  * example an iterator pointing to some element of a sequence will
7310  * continue to point to that element even after the sequence is sorted.
7311  * Even moving an element to another sequence using for example
7312  * g_sequence_move_range() will not invalidate the iterators pointing
7313  * to it. The only operation that will invalidate an iterator is when
7314  * the element it points to is removed from any sequence.
7315  */
7316
7317
7318 /**
7319  * SECTION:shell
7320  * @title: Shell-related Utilities
7321  * @short_description: shell-like commandline handling
7322  */
7323
7324
7325 /**
7326  * SECTION:spawn
7327  * @Short_description: process launching
7328  * @Title: Spawning Processes
7329  */
7330
7331
7332 /**
7333  * SECTION:string_chunks
7334  * @title: String Chunks
7335  * @short_description: efficient storage of groups of strings
7336  *
7337  * String chunks are used to store groups of strings. Memory is
7338  * allocated in blocks, and as strings are added to the #GStringChunk
7339  * they are copied into the next free position in a block. When a block
7340  * is full a new block is allocated.
7341  *
7342  * When storing a large number of strings, string chunks are more
7343  * efficient than using g_strdup() since fewer calls to malloc() are
7344  * needed, and less memory is wasted in memory allocation overheads.
7345  *
7346  * By adding strings with g_string_chunk_insert_const() it is also
7347  * possible to remove duplicates.
7348  *
7349  * To create a new #GStringChunk use g_string_chunk_new().
7350  *
7351  * To add strings to a #GStringChunk use g_string_chunk_insert().
7352  *
7353  * To add strings to a #GStringChunk, but without duplicating strings
7354  * which are already in the #GStringChunk, use
7355  * g_string_chunk_insert_const().
7356  *
7357  * To free the entire #GStringChunk use g_string_chunk_free(). It is
7358  * not possible to free individual strings.
7359  */
7360
7361
7362 /**
7363  * SECTION:string_utils
7364  * @title: String Utility Functions
7365  * @short_description: various string-related functions
7366  *
7367  * This section describes a number of utility functions for creating,
7368  * duplicating, and manipulating strings.
7369  *
7370  * Note that the functions g_printf(), g_fprintf(), g_sprintf(),
7371  * g_snprintf(), g_vprintf(), g_vfprintf(), g_vsprintf() and g_vsnprintf()
7372  * are declared in the header <filename>gprintf.h</filename> which is
7373  * <emphasis>not</emphasis> included in <filename>glib.h</filename>
7374  * (otherwise using <filename>glib.h</filename> would drag in
7375  * <filename>stdio.h</filename>), so you'll have to explicitly include
7376  * <literal>&lt;glib/gprintf.h&gt;</literal> in order to use the GLib
7377  * printf() functions.
7378  *
7379  * <para id="string-precision">While you may use the printf() functions
7380  * to format UTF-8 strings, notice that the precision of a
7381  * <literal>&percnt;Ns</literal> parameter is interpreted as the
7382  * number of <emphasis>bytes</emphasis>, not <emphasis>characters</emphasis>
7383  * to print. On top of that, the GNU libc implementation of the printf()
7384  * functions has the "feature" that it checks that the string given for
7385  * the <literal>&percnt;Ns</literal> parameter consists of a whole number
7386  * of characters in the current encoding. So, unless you are sure you are
7387  * always going to be in an UTF-8 locale or your know your text is restricted
7388  * to ASCII, avoid using <literal>&percnt;Ns</literal>. If your intention is
7389  * to format strings for a certain number of columns, then
7390  * <literal>&percnt;Ns</literal> is not a correct solution anyway, since it
7391  * fails to take wide characters (see g_unichar_iswide()) into account.
7392  * </para>
7393  */
7394
7395
7396 /**
7397  * SECTION:strings
7398  * @title: Strings
7399  * @short_description: text buffers which grow automatically as text is added
7400  *
7401  * A #GString is an object that handles the memory management of a C
7402  * string for you.  The emphasis of #GString is on text, typically
7403  * UTF-8.  Crucially, the "str" member of a #GString is guaranteed to
7404  * have a trailing nul character, and it is therefore always safe to
7405  * call functions such as strchr() or g_strdup() on it.
7406  *
7407  * However, a #GString can also hold arbitrary binary data, because it
7408  * has a "len" member, which includes any possible embedded nul
7409  * characters in the data.  Conceptually then, #GString is like a
7410  * #GByteArray with the addition of many convenience methods for text,
7411  * and a guaranteed nul terminator.
7412  */
7413
7414
7415 /**
7416  * SECTION:testing
7417  * @title: Testing
7418  * @short_description: a test framework
7419  * @see_also: <link linkend="gtester">gtester</link>, <link linkend="gtester-report">gtester-report</link>
7420  *
7421  * GLib provides a framework for writing and maintaining unit tests
7422  * in parallel to the code they are testing. The API is designed according
7423  * to established concepts found in the other test frameworks (JUnit, NUnit,
7424  * RUnit), which in turn is based on smalltalk unit testing concepts.
7425  *
7426  * <variablelist>
7427  *   <varlistentry>
7428  *     <term>Test case</term>
7429  *     <listitem>Tests (test methods) are grouped together with their
7430  *       fixture into test cases.</listitem>
7431  *   </varlistentry>
7432  *   <varlistentry>
7433  *     <term>Fixture</term>
7434  *     <listitem>A test fixture consists of fixture data and setup and
7435  *       teardown methods to establish the environment for the test
7436  *       functions. We use fresh fixtures, i.e. fixtures are newly set
7437  *       up and torn down around each test invocation to avoid dependencies
7438  *       between tests.</listitem>
7439  *   </varlistentry>
7440  *   <varlistentry>
7441  *     <term>Test suite</term>
7442  *     <listitem>Test cases can be grouped into test suites, to allow
7443  *       subsets of the available tests to be run. Test suites can be
7444  *       grouped into other test suites as well.</listitem>
7445  *   </varlistentry>
7446  * </variablelist>
7447  * The API is designed to handle creation and registration of test suites
7448  * and test cases implicitly. A simple call like
7449  * |[
7450  *   g_test_add_func ("/misc/assertions", test_assertions);
7451  * ]|
7452  * creates a test suite called "misc" with a single test case named
7453  * "assertions", which consists of running the test_assertions function.
7454  *
7455  * In addition to the traditional g_assert(), the test framework provides
7456  * an extended set of assertions for string and numerical comparisons:
7457  * g_assert_cmpfloat(), g_assert_cmpint(), g_assert_cmpuint(),
7458  * g_assert_cmphex(), g_assert_cmpstr(). The advantage of these variants
7459  * over plain g_assert() is that the assertion messages can be more
7460  * elaborate, and include the values of the compared entities.
7461  *
7462  * GLib ships with two utilities called gtester and gtester-report to
7463  * facilitate running tests and producing nicely formatted test reports.
7464  */
7465
7466
7467 /**
7468  * SECTION:thread_pools
7469  * @title: Thread Pools
7470  * @short_description: pools of threads to execute work concurrently
7471  * @see_also: #GThread
7472  *
7473  * Sometimes you wish to asynchronously fork out the execution of work
7474  * and continue working in your own thread. If that will happen often,
7475  * the overhead of starting and destroying a thread each time might be
7476  * too high. In such cases reusing already started threads seems like a
7477  * good idea. And it indeed is, but implementing this can be tedious
7478  * and error-prone.
7479  *
7480  * Therefore GLib provides thread pools for your convenience. An added
7481  * advantage is, that the threads can be shared between the different
7482  * subsystems of your program, when they are using GLib.
7483  *
7484  * To create a new thread pool, you use g_thread_pool_new().
7485  * It is destroyed by g_thread_pool_free().
7486  *
7487  * If you want to execute a certain task within a thread pool,
7488  * you call g_thread_pool_push().
7489  *
7490  * To get the current number of running threads you call
7491  * g_thread_pool_get_num_threads(). To get the number of still
7492  * unprocessed tasks you call g_thread_pool_unprocessed(). To control
7493  * the maximal number of threads for a thread pool, you use
7494  * g_thread_pool_get_max_threads() and g_thread_pool_set_max_threads().
7495  *
7496  * Finally you can control the number of unused threads, that are kept
7497  * alive by GLib for future use. The current number can be fetched with
7498  * g_thread_pool_get_num_unused_threads(). The maximal number can be
7499  * controlled by g_thread_pool_get_max_unused_threads() and
7500  * g_thread_pool_set_max_unused_threads(). All currently unused threads
7501  * can be stopped by calling g_thread_pool_stop_unused_threads().
7502  */
7503
7504
7505 /**
7506  * SECTION:threads
7507  * @title: Threads
7508  * @short_description: portable support for threads, mutexes, locks, conditions and thread private data
7509  * @see_also: #GThreadPool, #GAsyncQueue
7510  *
7511  * Threads act almost like processes, but unlike processes all threads
7512  * of one process share the same memory. This is good, as it provides
7513  * easy communication between the involved threads via this shared
7514  * memory, and it is bad, because strange things (so called
7515  * "Heisenbugs") might happen if the program is not carefully designed.
7516  * In particular, due to the concurrent nature of threads, no
7517  * assumptions on the order of execution of code running in different
7518  * threads can be made, unless order is explicitly forced by the
7519  * programmer through synchronization primitives.
7520  *
7521  * The aim of the thread-related functions in GLib is to provide a
7522  * portable means for writing multi-threaded software. There are
7523  * primitives for mutexes to protect the access to portions of memory
7524  * (#GMutex, #GRecMutex and #GRWLock). There is a facility to use
7525  * individual bits for locks (g_bit_lock()). There are primitives
7526  * for condition variables to allow synchronization of threads (#GCond).
7527  * There are primitives for thread-private data - data that every
7528  * thread has a private instance of (#GPrivate). There are facilities
7529  * for one-time initialization (#GOnce, g_once_init_enter()). Finally,
7530  * there are primitives to create and manage threads (#GThread).
7531  *
7532  * The GLib threading system used to be initialized with g_thread_init().
7533  * This is no longer necessary. Since version 2.32, the GLib threading
7534  * system is automatically initialized at the start of your program,
7535  * and all thread-creation functions and synchronization primitives
7536  * are available right away.
7537  *
7538  * Note that it is not safe to assume that your program has no threads
7539  * even if you don't call g_thread_new() yourself. GLib and GIO can
7540  * and will create threads for their own purposes in some cases, such
7541  * as when using g_unix_signal_source_new() or when using GDBus.
7542  *
7543  * Originally, UNIX did not have threads, and therefore some traditional
7544  * UNIX APIs are problematic in threaded programs. Some notable examples
7545  * are
7546  * <itemizedlist>
7547  *   <listitem>
7548  *     C library functions that return data in statically allocated
7549  *     buffers, such as strtok() or strerror(). For many of these,
7550  *     there are thread-safe variants with a _r suffix, or you can
7551  *     look at corresponding GLib APIs (like g_strsplit() or g_strerror()).
7552  *   </listitem>
7553  *   <listitem>
7554  *     setenv() and unsetenv() manipulate the process environment in
7555  *     a not thread-safe way, and may interfere with getenv() calls
7556  *     in other threads. Note that getenv() calls may be
7557  *     <quote>hidden</quote> behind other APIs. For example, GNU gettext()
7558  *     calls getenv() under the covers. In general, it is best to treat
7559  *     the environment as readonly. If you absolutely have to modify the
7560  *     environment, do it early in main(), when no other threads are around yet.
7561  *   </listitem>
7562  *   <listitem>
7563  *     setlocale() changes the locale for the entire process, affecting
7564  *     all threads. Temporary changes to the locale are often made to
7565  *     change the behavior of string scanning or formatting functions
7566  *     like scanf() or printf(). GLib offers a number of string APIs
7567  *     (like g_ascii_formatd() or g_ascii_strtod()) that can often be
7568  *     used as an alternative. Or you can use the uselocale() function
7569  *     to change the locale only for the current thread.
7570  *   </listitem>
7571  *   <listitem>
7572  *     fork() only takes the calling thread into the child's copy of the
7573  *     process image.  If other threads were executing in critical
7574  *     sections they could have left mutexes locked which could easily
7575  *     cause deadlocks in the new child.  For this reason, you should
7576  *     call exit() or exec() as soon as possible in the child and only
7577  *     make signal-safe library calls before that.
7578  *   </listitem>
7579  *   <listitem>
7580  *     daemon() uses fork() in a way contrary to what is described
7581  *     above.  It should not be used with GLib programs.
7582  *   </listitem>
7583  * </itemizedlist>
7584  *
7585  * GLib itself is internally completely thread-safe (all global data is
7586  * automatically locked), but individual data structure instances are
7587  * not automatically locked for performance reasons. For example,
7588  * you must coordinate accesses to the same #GHashTable from multiple
7589  * threads. The two notable exceptions from this rule are #GMainLoop
7590  * and #GAsyncQueue, which <emphasis>are</emphasis> thread-safe and
7591  * need no further application-level locking to be accessed from
7592  * multiple threads. Most refcounting functions such as g_object_ref()
7593  * are also thread-safe.
7594  */
7595
7596
7597 /**
7598  * SECTION:timers
7599  * @title: Timers
7600  * @short_description: keep track of elapsed time
7601  *
7602  * #GTimer records a start time, and counts microseconds elapsed since
7603  * that time. This is done somewhat differently on different platforms,
7604  * and can be tricky to get exactly right, so #GTimer provides a
7605  * portable/convenient interface.
7606  */
7607
7608
7609 /**
7610  * SECTION:timezone
7611  * @title: GTimeZone
7612  * @short_description: a structure representing a time zone
7613  * @see_also: #GDateTime
7614  *
7615  * #GTimeZone is a structure that represents a time zone, at no
7616  * particular point in time.  It is refcounted and immutable.
7617  *
7618  * A time zone contains a number of intervals.  Each interval has
7619  * an abbreviation to describe it, an offet to UTC and a flag indicating
7620  * if the daylight savings time is in effect during that interval.  A
7621  * time zone always has at least one interval -- interval 0.
7622  *
7623  * Every UTC time is contained within exactly one interval, but a given
7624  * local time may be contained within zero, one or two intervals (due to
7625  * incontinuities associated with daylight savings time).
7626  *
7627  * An interval may refer to a specific period of time (eg: the duration
7628  * of daylight savings time during 2010) or it may refer to many periods
7629  * of time that share the same properties (eg: all periods of daylight
7630  * savings time).  It is also possible (usually for political reasons)
7631  * that some properties (like the abbreviation) change between intervals
7632  * without other properties changing.
7633  *
7634  * #GTimeZone is available since GLib 2.26.
7635  */
7636
7637
7638 /**
7639  * SECTION:trash_stack
7640  * @title: Trash Stacks
7641  * @short_description: maintain a stack of unused allocated memory chunks
7642  *
7643  * A #GTrashStack is an efficient way to keep a stack of unused allocated
7644  * memory chunks. Each memory chunk is required to be large enough to hold
7645  * a #gpointer. This allows the stack to be maintained without any space
7646  * overhead, since the stack pointers can be stored inside the memory chunks.
7647  *
7648  * There is no function to create a #GTrashStack. A %NULL #GTrashStack*
7649  * is a perfectly valid empty stack.
7650  */
7651
7652
7653 /**
7654  * SECTION:trees-binary
7655  * @title: Balanced Binary Trees
7656  * @short_description: a sorted collection of key/value pairs optimized for searching and traversing in order
7657  *
7658  * The #GTree structure and its associated functions provide a sorted
7659  * collection of key/value pairs optimized for searching and traversing
7660  * in order.
7661  *
7662  * To create a new #GTree use g_tree_new().
7663  *
7664  * To insert a key/value pair into a #GTree use g_tree_insert().
7665  *
7666  * To lookup the value corresponding to a given key, use
7667  * g_tree_lookup() and g_tree_lookup_extended().
7668  *
7669  * To find out the number of nodes in a #GTree, use g_tree_nnodes(). To
7670  * get the height of a #GTree, use g_tree_height().
7671  *
7672  * To traverse a #GTree, calling a function for each node visited in
7673  * the traversal, use g_tree_foreach().
7674  *
7675  * To remove a key/value pair use g_tree_remove().
7676  *
7677  * To destroy a #GTree, use g_tree_destroy().
7678  */
7679
7680
7681 /**
7682  * SECTION:trees-nary
7683  * @title: N-ary Trees
7684  * @short_description: trees of data with any number of branches
7685  *
7686  * The #GNode struct and its associated functions provide a N-ary tree
7687  * data structure, where nodes in the tree can contain arbitrary data.
7688  *
7689  * To create a new tree use g_node_new().
7690  *
7691  * To insert a node into a tree use g_node_insert(),
7692  * g_node_insert_before(), g_node_append() and g_node_prepend().
7693  *
7694  * To create a new node and insert it into a tree use
7695  * g_node_insert_data(), g_node_insert_data_after(),
7696  * g_node_insert_data_before(), g_node_append_data()
7697  * and g_node_prepend_data().
7698  *
7699  * To reverse the children of a node use g_node_reverse_children().
7700  *
7701  * To find a node use g_node_get_root(), g_node_find(),
7702  * g_node_find_child(), g_node_child_index(), g_node_child_position(),
7703  * g_node_first_child(), g_node_last_child(), g_node_nth_child(),
7704  * g_node_first_sibling(), g_node_prev_sibling(), g_node_next_sibling()
7705  * or g_node_last_sibling().
7706  *
7707  * To get information about a node or tree use G_NODE_IS_LEAF(),
7708  * G_NODE_IS_ROOT(), g_node_depth(), g_node_n_nodes(),
7709  * g_node_n_children(), g_node_is_ancestor() or g_node_max_height().
7710  *
7711  * To traverse a tree, calling a function for each node visited in the
7712  * traversal, use g_node_traverse() or g_node_children_foreach().
7713  *
7714  * To remove a node or subtree from a tree use g_node_unlink() or
7715  * g_node_destroy().
7716  */
7717
7718
7719 /**
7720  * SECTION:type_conversion
7721  * @title: Type Conversion Macros
7722  * @short_description: portably storing integers in pointer variables
7723  *
7724  * Many times GLib, GTK+, and other libraries allow you to pass "user
7725  * data" to a callback, in the form of a void pointer. From time to time
7726  * you want to pass an integer instead of a pointer. You could allocate
7727  * an integer, with something like:
7728  * |[
7729  *   int *ip = g_new (int, 1);
7730  *   *ip = 42;
7731  * ]|
7732  * But this is inconvenient, and it's annoying to have to free the
7733  * memory at some later time.
7734  *
7735  * Pointers are always at least 32 bits in size (on all platforms GLib
7736  * intends to support). Thus you can store at least 32-bit integer values
7737  * in a pointer value. Naively, you might try this, but it's incorrect:
7738  * |[
7739  *   gpointer p;
7740  *   int i;
7741  *   p = (void*) 42;
7742  *   i = (int) p;
7743  * ]|
7744  * Again, that example was <emphasis>not</emphasis> correct, don't copy it.
7745  * The problem is that on some systems you need to do this:
7746  * |[
7747  *   gpointer p;
7748  *   int i;
7749  *   p = (void*) (long) 42;
7750  *   i = (int) (long) p;
7751  * ]|
7752  * The GLib macros GPOINTER_TO_INT(), GINT_TO_POINTER(), etc. take care
7753  * to do the right thing on the every platform.
7754  *
7755  * <warning><para>You may not store pointers in integers. This is not
7756  * portable in any way, shape or form. These macros <emphasis>only</emphasis>
7757  * allow storing integers in pointers, and only preserve 32 bits of the
7758  * integer; values outside the range of a 32-bit integer will be mangled.
7759  * </para></warning>
7760  */
7761
7762
7763 /**
7764  * SECTION:types
7765  * @title: Basic Types
7766  * @short_description: standard GLib types, defined for ease-of-use and portability
7767  *
7768  * GLib defines a number of commonly used types, which can be divided
7769  * into 4 groups:
7770  * - New types which are not part of standard C (but are defined in
7771  *   various C standard library header files) - #gboolean, #gsize,
7772  *   #gssize, #goffset, #gintptr, #guintptr.
7773  * - Integer types which are guaranteed to be the same size across
7774  *   all platforms - #gint8, #guint8, #gint16, #guint16, #gint32,
7775  *   #guint32, #gint64, #guint64.
7776  * - Types which are easier to use than their standard C counterparts -
7777  *   #gpointer, #gconstpointer, #guchar, #guint, #gushort, #gulong.
7778  * - Types which correspond exactly to standard C types, but are
7779  *   included for completeness - #gchar, #gint, #gshort, #glong,
7780  *   #gfloat, #gdouble.
7781  *
7782  * GLib also defines macros for the limits of some of the standard
7783  * integer and floating point types, as well as macros for suitable
7784  * printf() formats for these types.
7785  */
7786
7787
7788 /**
7789  * SECTION:unicode
7790  * @Title: Unicode Manipulation
7791  * @Short_description: functions operating on Unicode characters and UTF-8 strings
7792  * @See_also: g_locale_to_utf8(), g_locale_from_utf8()
7793  *
7794  * This section describes a number of functions for dealing with
7795  * Unicode characters and strings.  There are analogues of the
7796  * traditional <filename>ctype.h</filename> character classification
7797  * and case conversion functions, UTF-8 analogues of some string utility
7798  * functions, functions to perform normalization, case conversion and
7799  * collation on UTF-8 strings and finally functions to convert between
7800  * the UTF-8, UTF-16 and UCS-4 encodings of Unicode.
7801  *
7802  * The implementations of the Unicode functions in GLib are based
7803  * on the Unicode Character Data tables, which are available from
7804  * <ulink url="http://www.unicode.org/">www.unicode.org</ulink>.
7805  * GLib 2.8 supports Unicode 4.0, GLib 2.10 supports Unicode 4.1,
7806  * GLib 2.12 supports Unicode 5.0, GLib 2.16.3 supports Unicode 5.1,
7807  * GLib 2.30 supports Unicode 6.0.
7808  */
7809
7810
7811 /**
7812  * SECTION:version
7813  * @Title: Version Information
7814  * @Short_description: variables and functions to check the GLib version
7815  *
7816  * GLib provides version information, primarily useful in configure
7817  * checks for builds that have a configure script. Applications will
7818  * not typically use the features described here.
7819  *
7820  * The GLib headers annotate deprecated APIs in a way that produces
7821  * compiler warnings if these deprecated APIs are used. The warnings
7822  * can be turned off by defining the macro %GLIB_DISABLE_DEPRECATION_WARNINGS
7823  * before including the glib.h header.
7824  *
7825  * GLib also provides support for building applications against
7826  * defined subsets of deprecated or new GLib APIs. Define the macro
7827  * %GLIB_VERSION_MIN_REQUIRED to specify up to what version of GLib
7828  * you want to receive warnings about deprecated APIs. Define the
7829  * macro %GLIB_VERSION_MAX_ALLOWED to specify the newest version of
7830  * GLib whose API you want to use.
7831  */
7832
7833
7834 /**
7835  * SECTION:warnings
7836  * @Title: Message Output and Debugging Functions
7837  * @Short_description: functions to output messages and help debug applications
7838  *
7839  * These functions provide support for outputting messages.
7840  *
7841  * The <function>g_return</function> family of macros (g_return_if_fail(),
7842  * g_return_val_if_fail(), g_return_if_reached(), g_return_val_if_reached())
7843  * should only be used for programming errors, a typical use case is
7844  * checking for invalid parameters at the beginning of a public function.
7845  * They should not be used if you just mean "if (error) return", they
7846  * should only be used if you mean "if (bug in program) return".
7847  * The program behavior is generally considered undefined after one
7848  * of these checks fails. They are not intended for normal control
7849  * flow, only to give a perhaps-helpful warning before giving up.
7850  */
7851
7852
7853 /**
7854  * SECTION:windows
7855  * @title: Windows Compatibility Functions
7856  * @short_description: UNIX emulation on Windows
7857  *
7858  * These functions provide some level of UNIX emulation on the
7859  * Windows platform. If your application really needs the POSIX
7860  * APIs, we suggest you try the Cygwin project.
7861  */
7862
7863
7864 /**
7865  * TRUE:
7866  *
7867  * Defines the %TRUE value for the #gboolean type.
7868  */
7869
7870
7871 /**
7872  * _:
7873  * @String: the string to be translated
7874  *
7875  * Marks a string for translation, gets replaced with the translated string
7876  * at runtime.
7877  *
7878  * Since: 2.4
7879  */
7880
7881
7882 /**
7883  * _glib_get_locale_dir:
7884  *
7885  * Return the path to the share\locale or lib\locale subfolder of the
7886  * GLib installation folder. The path is in the system codepage. We
7887  * have to use system codepage as bindtextdomain() doesn't have a
7888  * UTF-8 interface.
7889  */
7890
7891
7892 /**
7893  * g_access:
7894  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
7895  * @mode: as in access()
7896  *
7897  * A wrapper for the POSIX access() function. This function is used to
7898  * test a pathname for one or several of read, write or execute
7899  * permissions, or just existence.
7900  *
7901  * On Windows, the file protection mechanism is not at all POSIX-like,
7902  * and the underlying function in the C library only checks the
7903  * FAT-style READONLY attribute, and does not look at the ACL of a
7904  * file at all. This function is this in practise almost useless on
7905  * Windows. Software that needs to handle file permissions on Windows
7906  * more exactly should use the Win32 API.
7907  *
7908  * See your C library manual for more details about access().
7909  *
7910  * Returns: zero if the pathname refers to an existing file system object that has all the tested permissions, or -1 otherwise or on error.
7911  * Since: 2.8
7912  */
7913
7914
7915 /**
7916  * g_array_append_val:
7917  * @a: a #GArray.
7918  * @v: the value to append to the #GArray.
7919  *
7920  * Adds the value on to the end of the array. The array will grow in
7921  * size automatically if necessary.
7922  *
7923  * <note><para>g_array_append_val() is a macro which uses a reference
7924  * to the value parameter @v. This means that you cannot use it with
7925  * literal values such as "27". You must use variables.</para></note>
7926  *
7927  * Returns: the #GArray.
7928  */
7929
7930
7931 /**
7932  * g_array_append_vals:
7933  * @array: a #GArray.
7934  * @data: a pointer to the elements to append to the end of the array.
7935  * @len: the number of elements to append.
7936  *
7937  * Adds @len elements onto the end of the array.
7938  *
7939  * Returns: the #GArray.
7940  */
7941
7942
7943 /**
7944  * g_array_free:
7945  * @array: a #GArray.
7946  * @free_segment: if %TRUE the actual element data is freed as well.
7947  *
7948  * Frees the memory allocated for the #GArray. If @free_segment is
7949  * %TRUE it frees the memory block holding the elements as well and
7950  * also each element if @array has a @element_free_func set. Pass
7951  * %FALSE if you want to free the #GArray wrapper but preserve the
7952  * underlying array for use elsewhere. If the reference count of @array
7953  * is greater than one, the #GArray wrapper is preserved but the size
7954  * of @array will be set to zero.
7955  *
7956  * <note><para>If array elements contain dynamically-allocated memory,
7957  * they should be freed separately.</para></note>
7958  *
7959  * Returns: the element data if @free_segment is %FALSE, otherwise %NULL.  The element data should be freed using g_free().
7960  */
7961
7962
7963 /**
7964  * g_array_get_element_size:
7965  * @array: A #GArray.
7966  *
7967  * Gets the size of the elements in @array.
7968  *
7969  * Returns: Size of each element, in bytes.
7970  * Since: 2.22
7971  */
7972
7973
7974 /**
7975  * g_array_index:
7976  * @a: a #GArray.
7977  * @t: the type of the elements.
7978  * @i: the index of the element to return.
7979  *
7980  * Returns the element of a #GArray at the given index. The return
7981  * value is cast to the given type.
7982  *
7983  * <example>
7984  *  <title>Getting a pointer to an element in a #GArray</title>
7985  *  <programlisting>
7986  *   EDayViewEvent *event;
7987  *   /<!-- -->* This gets a pointer to the 4th element
7988  *      in the array of EDayViewEvent structs. *<!-- -->/
7989  *   event = &amp;g_array_index (events, EDayViewEvent, 3);
7990  *  </programlisting>
7991  * </example>
7992  *
7993  * Returns: the element of the #GArray at the index given by @i.
7994  */
7995
7996
7997 /**
7998  * g_array_insert_val:
7999  * @a: a #GArray.
8000  * @i: the index to place the element at.
8001  * @v: the value to insert into the array.
8002  *
8003  * Inserts an element into an array at the given index.
8004  *
8005  * <note><para>g_array_insert_val() is a macro which uses a reference
8006  * to the value parameter @v. This means that you cannot use it with
8007  * literal values such as "27". You must use variables.</para></note>
8008  *
8009  * Returns: the #GArray.
8010  */
8011
8012
8013 /**
8014  * g_array_insert_vals:
8015  * @array: a #GArray.
8016  * @index_: the index to place the elements at.
8017  * @data: a pointer to the elements to insert.
8018  * @len: the number of elements to insert.
8019  *
8020  * Inserts @len elements into a #GArray at the given index.
8021  *
8022  * Returns: the #GArray.
8023  */
8024
8025
8026 /**
8027  * g_array_new:
8028  * @zero_terminated: %TRUE if the array should have an extra element at the end which is set to 0.
8029  * @clear_: %TRUE if #GArray elements should be automatically cleared to 0 when they are allocated.
8030  * @element_size: the size of each element in bytes.
8031  *
8032  * Creates a new #GArray with a reference count of 1.
8033  *
8034  * Returns: the new #GArray.
8035  */
8036
8037
8038 /**
8039  * g_array_prepend_val:
8040  * @a: a #GArray.
8041  * @v: the value to prepend to the #GArray.
8042  *
8043  * Adds the value on to the start of the array. The array will grow in
8044  * size automatically if necessary.
8045  *
8046  * This operation is slower than g_array_append_val() since the
8047  * existing elements in the array have to be moved to make space for
8048  * the new element.
8049  *
8050  * <note><para>g_array_prepend_val() is a macro which uses a reference
8051  * to the value parameter @v. This means that you cannot use it with
8052  * literal values such as "27". You must use variables.</para></note>
8053  *
8054  * Returns: the #GArray.
8055  */
8056
8057
8058 /**
8059  * g_array_prepend_vals:
8060  * @array: a #GArray.
8061  * @data: a pointer to the elements to prepend to the start of the array.
8062  * @len: the number of elements to prepend.
8063  *
8064  * Adds @len elements onto the start of the array.
8065  *
8066  * This operation is slower than g_array_append_vals() since the
8067  * existing elements in the array have to be moved to make space for
8068  * the new elements.
8069  *
8070  * Returns: the #GArray.
8071  */
8072
8073
8074 /**
8075  * g_array_ref:
8076  * @array: A #GArray.
8077  *
8078  * Atomically increments the reference count of @array by one. This
8079  * function is MT-safe and may be called from any thread.
8080  *
8081  * Returns: The passed in #GArray.
8082  * Since: 2.22
8083  */
8084
8085
8086 /**
8087  * g_array_remove_index:
8088  * @array: a #GArray.
8089  * @index_: the index of the element to remove.
8090  *
8091  * Removes the element at the given index from a #GArray. The following
8092  * elements are moved down one place.
8093  *
8094  * Returns: the #GArray.
8095  */
8096
8097
8098 /**
8099  * g_array_remove_index_fast:
8100  * @array: a @GArray.
8101  * @index_: the index of the element to remove.
8102  *
8103  * Removes the element at the given index from a #GArray. The last
8104  * element in the array is used to fill in the space, so this function
8105  * does not preserve the order of the #GArray. But it is faster than
8106  * g_array_remove_index().
8107  *
8108  * Returns: the #GArray.
8109  */
8110
8111
8112 /**
8113  * g_array_remove_range:
8114  * @array: a @GArray.
8115  * @index_: the index of the first element to remove.
8116  * @length: the number of elements to remove.
8117  *
8118  * Removes the given number of elements starting at the given index
8119  * from a #GArray.  The following elements are moved to close the gap.
8120  *
8121  * Returns: the #GArray.
8122  * Since: 2.4
8123  */
8124
8125
8126 /**
8127  * g_array_set_clear_func:
8128  * @array: A #GArray
8129  * @clear_func: a function to clear an element of @array
8130  *
8131  * Sets a function to clear an element of @array.
8132  *
8133  * The @clear_func will be called when an element in the array
8134  * data segment is removed and when the array is freed and data
8135  * segment is deallocated as well.
8136  *
8137  * Note that in contrast with other uses of #GDestroyNotify
8138  * functions, @clear_func is expected to clear the contents of
8139  * the array element it is given, but not free the element itself.
8140  *
8141  * Since: 2.32
8142  */
8143
8144
8145 /**
8146  * g_array_set_size:
8147  * @array: a #GArray.
8148  * @length: the new size of the #GArray.
8149  *
8150  * Sets the size of the array, expanding it if necessary. If the array
8151  * was created with @clear_ set to %TRUE, the new elements are set to 0.
8152  *
8153  * Returns: the #GArray.
8154  */
8155
8156
8157 /**
8158  * g_array_sized_new:
8159  * @zero_terminated: %TRUE if the array should have an extra element at the end with all bits cleared.
8160  * @clear_: %TRUE if all bits in the array should be cleared to 0 on allocation.
8161  * @element_size: size of each element in the array.
8162  * @reserved_size: number of elements preallocated.
8163  *
8164  * Creates a new #GArray with @reserved_size elements preallocated and
8165  * a reference count of 1. This avoids frequent reallocation, if you
8166  * are going to add many elements to the array. Note however that the
8167  * size of the array is still 0.
8168  *
8169  * Returns: the new #GArray.
8170  */
8171
8172
8173 /**
8174  * g_array_sort:
8175  * @array: a #GArray.
8176  * @compare_func: comparison function.
8177  *
8178  * Sorts a #GArray using @compare_func which should be a qsort()-style
8179  * comparison function (returns less than zero for first arg is less
8180  * than second arg, zero for equal, greater zero if first arg is
8181  * greater than second arg).
8182  *
8183  * This is guaranteed to be a stable sort since version 2.32.
8184  */
8185
8186
8187 /**
8188  * g_array_sort_with_data:
8189  * @array: a #GArray.
8190  * @compare_func: comparison function.
8191  * @user_data: data to pass to @compare_func.
8192  *
8193  * Like g_array_sort(), but the comparison function receives an extra
8194  * user data argument.
8195  *
8196  * This is guaranteed to be a stable sort since version 2.32.
8197  *
8198  * There used to be a comment here about making the sort stable by
8199  * using the addresses of the elements in the comparison function.
8200  * This did not actually work, so any such code should be removed.
8201  */
8202
8203
8204 /**
8205  * g_array_unref:
8206  * @array: A #GArray.
8207  *
8208  * Atomically decrements the reference count of @array by one. If the
8209  * reference count drops to 0, all memory allocated by the array is
8210  * released. This function is MT-safe and may be called from any
8211  * thread.
8212  *
8213  * Since: 2.22
8214  */
8215
8216
8217 /**
8218  * g_ascii_digit_value:
8219  * @c: an ASCII character.
8220  *
8221  * Determines the numeric value of a character as a decimal
8222  * digit. Differs from g_unichar_digit_value() because it takes
8223  * a char, so there's no worry about sign extension if characters
8224  * are signed.
8225  *
8226  * Returns: If @c is a decimal digit (according to g_ascii_isdigit()), its numeric value. Otherwise, -1.
8227  */
8228
8229
8230 /**
8231  * g_ascii_dtostr:
8232  * @buffer: A buffer to place the resulting string in
8233  * @buf_len: The length of the buffer.
8234  * @d: The #gdouble to convert
8235  *
8236  * Converts a #gdouble to a string, using the '.' as
8237  * decimal point.
8238  *
8239  * This functions generates enough precision that converting
8240  * the string back using g_ascii_strtod() gives the same machine-number
8241  * (on machines with IEEE compatible 64bit doubles). It is
8242  * guaranteed that the size of the resulting string will never
8243  * be larger than @G_ASCII_DTOSTR_BUF_SIZE bytes.
8244  *
8245  * Returns: The pointer to the buffer with the converted string.
8246  */
8247
8248
8249 /**
8250  * g_ascii_formatd:
8251  * @buffer: A buffer to place the resulting string in
8252  * @buf_len: The length of the buffer.
8253  * @format: The printf()-style format to use for the code to use for converting.
8254  * @d: The #gdouble to convert
8255  *
8256  * Converts a #gdouble to a string, using the '.' as
8257  * decimal point. To format the number you pass in
8258  * a printf()-style format string. Allowed conversion
8259  * specifiers are 'e', 'E', 'f', 'F', 'g' and 'G'.
8260  *
8261  * If you just want to want to serialize the value into a
8262  * string, use g_ascii_dtostr().
8263  *
8264  * Returns: The pointer to the buffer with the converted string.
8265  */
8266
8267
8268 /**
8269  * g_ascii_isalnum:
8270  * @c: any character
8271  *
8272  * Determines whether a character is alphanumeric.
8273  *
8274  * Unlike the standard C library isalnum() function, this only
8275  * recognizes standard ASCII letters and ignores the locale,
8276  * returning %FALSE for all non-ASCII characters. Also, unlike
8277  * the standard library function, this takes a <type>char</type>,
8278  * not an <type>int</type>, so don't call it on <literal>EOF</literal>, but no need to
8279  * cast to #guchar before passing a possibly non-ASCII character in.
8280  *
8281  * Returns: %TRUE if @c is an ASCII alphanumeric character
8282  */
8283
8284
8285 /**
8286  * g_ascii_isalpha:
8287  * @c: any character
8288  *
8289  * Determines whether a character is alphabetic (i.e. a letter).
8290  *
8291  * Unlike the standard C library isalpha() function, this only
8292  * recognizes standard ASCII letters and ignores the locale,
8293  * returning %FALSE for all non-ASCII characters. Also, unlike
8294  * the standard library function, this takes a <type>char</type>,
8295  * not an <type>int</type>, so don't call it on <literal>EOF</literal>, but no need to
8296  * cast to #guchar before passing a possibly non-ASCII character in.
8297  *
8298  * Returns: %TRUE if @c is an ASCII alphabetic character
8299  */
8300
8301
8302 /**
8303  * g_ascii_iscntrl:
8304  * @c: any character
8305  *
8306  * Determines whether a character is a control character.
8307  *
8308  * Unlike the standard C library iscntrl() function, this only
8309  * recognizes standard ASCII control characters and ignores the
8310  * locale, returning %FALSE for all non-ASCII characters. Also,
8311  * unlike the standard library function, this takes a <type>char</type>,
8312  * not an <type>int</type>, so don't call it on <literal>EOF</literal>, but no need to
8313  * cast to #guchar before passing a possibly non-ASCII character in.
8314  *
8315  * Returns: %TRUE if @c is an ASCII control character.
8316  */
8317
8318
8319 /**
8320  * g_ascii_isdigit:
8321  * @c: any character
8322  *
8323  * Determines whether a character is digit (0-9).
8324  *
8325  * Unlike the standard C library isdigit() function, this takes
8326  * a <type>char</type>, not an <type>int</type>, so don't call it
8327  * on <literal>EOF</literal>, but no need to cast to #guchar before passing a possibly
8328  * non-ASCII character in.
8329  *
8330  * Returns: %TRUE if @c is an ASCII digit.
8331  */
8332
8333
8334 /**
8335  * g_ascii_isgraph:
8336  * @c: any character
8337  *
8338  * Determines whether a character is a printing character and not a space.
8339  *
8340  * Unlike the standard C library isgraph() function, this only
8341  * recognizes standard ASCII characters and ignores the locale,
8342  * returning %FALSE for all non-ASCII characters. Also, unlike
8343  * the standard library function, this takes a <type>char</type>,
8344  * not an <type>int</type>, so don't call it on <literal>EOF</literal>, but no need
8345  * to cast to #guchar before passing a possibly non-ASCII character in.
8346  *
8347  * Returns: %TRUE if @c is an ASCII printing character other than space.
8348  */
8349
8350
8351 /**
8352  * g_ascii_islower:
8353  * @c: any character
8354  *
8355  * Determines whether a character is an ASCII lower case letter.
8356  *
8357  * Unlike the standard C library islower() function, this only
8358  * recognizes standard ASCII letters and ignores the locale,
8359  * returning %FALSE for all non-ASCII characters. Also, unlike
8360  * the standard library function, this takes a <type>char</type>,
8361  * not an <type>int</type>, so don't call it on <literal>EOF</literal>, but no need
8362  * to worry about casting to #guchar before passing a possibly
8363  * non-ASCII character in.
8364  *
8365  * Returns: %TRUE if @c is an ASCII lower case letter
8366  */
8367
8368
8369 /**
8370  * g_ascii_isprint:
8371  * @c: any character
8372  *
8373  * Determines whether a character is a printing character.
8374  *
8375  * Unlike the standard C library isprint() function, this only
8376  * recognizes standard ASCII characters and ignores the locale,
8377  * returning %FALSE for all non-ASCII characters. Also, unlike
8378  * the standard library function, this takes a <type>char</type>,
8379  * not an <type>int</type>, so don't call it on <literal>EOF</literal>, but no need
8380  * to cast to #guchar before passing a possibly non-ASCII character in.
8381  *
8382  * Returns: %TRUE if @c is an ASCII printing character.
8383  */
8384
8385
8386 /**
8387  * g_ascii_ispunct:
8388  * @c: any character
8389  *
8390  * Determines whether a character is a punctuation character.
8391  *
8392  * Unlike the standard C library ispunct() function, this only
8393  * recognizes standard ASCII letters and ignores the locale,
8394  * returning %FALSE for all non-ASCII characters. Also, unlike
8395  * the standard library function, this takes a <type>char</type>,
8396  * not an <type>int</type>, so don't call it on <literal>EOF</literal>, but no need to
8397  * cast to #guchar before passing a possibly non-ASCII character in.
8398  *
8399  * Returns: %TRUE if @c is an ASCII punctuation character.
8400  */
8401
8402
8403 /**
8404  * g_ascii_isspace:
8405  * @c: any character
8406  *
8407  * Determines whether a character is a white-space character.
8408  *
8409  * Unlike the standard C library isspace() function, this only
8410  * recognizes standard ASCII white-space and ignores the locale,
8411  * returning %FALSE for all non-ASCII characters. Also, unlike
8412  * the standard library function, this takes a <type>char</type>,
8413  * not an <type>int</type>, so don't call it on <literal>EOF</literal>, but no need to
8414  * cast to #guchar before passing a possibly non-ASCII character in.
8415  *
8416  * Returns: %TRUE if @c is an ASCII white-space character
8417  */
8418
8419
8420 /**
8421  * g_ascii_isupper:
8422  * @c: any character
8423  *
8424  * Determines whether a character is an ASCII upper case letter.
8425  *
8426  * Unlike the standard C library isupper() function, this only
8427  * recognizes standard ASCII letters and ignores the locale,
8428  * returning %FALSE for all non-ASCII characters. Also, unlike
8429  * the standard library function, this takes a <type>char</type>,
8430  * not an <type>int</type>, so don't call it on <literal>EOF</literal>, but no need to
8431  * worry about casting to #guchar before passing a possibly non-ASCII
8432  * character in.
8433  *
8434  * Returns: %TRUE if @c is an ASCII upper case letter
8435  */
8436
8437
8438 /**
8439  * g_ascii_isxdigit:
8440  * @c: any character
8441  *
8442  * Determines whether a character is a hexadecimal-digit character.
8443  *
8444  * Unlike the standard C library isxdigit() function, this takes
8445  * a <type>char</type>, not an <type>int</type>, so don't call it
8446  * on <literal>EOF</literal>, but no need to cast to #guchar before passing a
8447  * possibly non-ASCII character in.
8448  *
8449  * Returns: %TRUE if @c is an ASCII hexadecimal-digit character.
8450  */
8451
8452
8453 /**
8454  * g_ascii_strcasecmp:
8455  * @s1: string to compare with @s2.
8456  * @s2: string to compare with @s1.
8457  *
8458  * Compare two strings, ignoring the case of ASCII characters.
8459  *
8460  * Unlike the BSD strcasecmp() function, this only recognizes standard
8461  * ASCII letters and ignores the locale, treating all non-ASCII
8462  * bytes as if they are not letters.
8463  *
8464  * This function should be used only on strings that are known to be
8465  * in encodings where the bytes corresponding to ASCII letters always
8466  * represent themselves. This includes UTF-8 and the ISO-8859-*
8467  * charsets, but not for instance double-byte encodings like the
8468  * Windows Codepage 932, where the trailing bytes of double-byte
8469  * characters include all ASCII letters. If you compare two CP932
8470  * strings using this function, you will get false matches.
8471  *
8472  * Returns: 0 if the strings match, a negative value if @s1 &lt; @s2, or a positive value if @s1 &gt; @s2.
8473  */
8474
8475
8476 /**
8477  * g_ascii_strdown:
8478  * @str: a string.
8479  * @len: length of @str in bytes, or -1 if @str is nul-terminated.
8480  *
8481  * Converts all upper case ASCII letters to lower case ASCII letters.
8482  *
8483  * Returns: a newly-allocated string, with all the upper case characters in @str converted to lower case, with semantics that exactly match g_ascii_tolower(). (Note that this is unlike the old g_strdown(), which modified the string in place.)
8484  */
8485
8486
8487 /**
8488  * g_ascii_strncasecmp:
8489  * @s1: string to compare with @s2.
8490  * @s2: string to compare with @s1.
8491  * @n: number of characters to compare.
8492  *
8493  * Compare @s1 and @s2, ignoring the case of ASCII characters and any
8494  * characters after the first @n in each string.
8495  *
8496  * Unlike the BSD strcasecmp() function, this only recognizes standard
8497  * ASCII letters and ignores the locale, treating all non-ASCII
8498  * characters as if they are not letters.
8499  *
8500  * The same warning as in g_ascii_strcasecmp() applies: Use this
8501  * function only on strings known to be in encodings where bytes
8502  * corresponding to ASCII letters always represent themselves.
8503  *
8504  * Returns: 0 if the strings match, a negative value if @s1 &lt; @s2, or a positive value if @s1 &gt; @s2.
8505  */
8506
8507
8508 /**
8509  * g_ascii_strtod:
8510  * @nptr: the string to convert to a numeric value.
8511  * @endptr: if non-%NULL, it returns the character after the last character used in the conversion.
8512  *
8513  * Converts a string to a #gdouble value.
8514  *
8515  * This function behaves like the standard strtod() function
8516  * does in the C locale. It does this without actually changing
8517  * the current locale, since that would not be thread-safe.
8518  * A limitation of the implementation is that this function
8519  * will still accept localized versions of infinities and NANs.
8520  *
8521  * This function is typically used when reading configuration
8522  * files or other non-user input that should be locale independent.
8523  * To handle input from the user you should normally use the
8524  * locale-sensitive system strtod() function.
8525  *
8526  * To convert from a #gdouble to a string in a locale-insensitive
8527  * way, use g_ascii_dtostr().
8528  *
8529  * If the correct value would cause overflow, plus or minus <literal>HUGE_VAL</literal>
8530  * is returned (according to the sign of the value), and <literal>ERANGE</literal> is
8531  * stored in <literal>errno</literal>. If the correct value would cause underflow,
8532  * zero is returned and <literal>ERANGE</literal> is stored in <literal>errno</literal>.
8533  *
8534  * This function resets <literal>errno</literal> before calling strtod() so that
8535  * you can reliably detect overflow and underflow.
8536  *
8537  * Returns: the #gdouble value.
8538  */
8539
8540
8541 /**
8542  * g_ascii_strtoll:
8543  * @nptr: the string to convert to a numeric value.
8544  * @endptr: if non-%NULL, it returns the character after the last character used in the conversion.
8545  * @base: to be used for the conversion, 2..36 or 0
8546  *
8547  * Converts a string to a #gint64 value.
8548  * This function behaves like the standard strtoll() function
8549  * does in the C locale. It does this without actually
8550  * changing the current locale, since that would not be
8551  * thread-safe.
8552  *
8553  * This function is typically used when reading configuration
8554  * files or other non-user input that should be locale independent.
8555  * To handle input from the user you should normally use the
8556  * locale-sensitive system strtoll() function.
8557  *
8558  * If the correct value would cause overflow, %G_MAXINT64 or %G_MININT64
8559  * is returned, and <literal>ERANGE</literal> is stored in <literal>errno</literal>.
8560  * If the base is outside the valid range, zero is returned, and
8561  * <literal>EINVAL</literal> is stored in <literal>errno</literal>. If the
8562  * string conversion fails, zero is returned, and @endptr returns @nptr
8563  * (if @endptr is non-%NULL).
8564  *
8565  * Returns: the #gint64 value or zero on error.
8566  * Since: 2.12
8567  */
8568
8569
8570 /**
8571  * g_ascii_strtoull:
8572  * @nptr: the string to convert to a numeric value.
8573  * @endptr: if non-%NULL, it returns the character after the last character used in the conversion.
8574  * @base: to be used for the conversion, 2..36 or 0
8575  *
8576  * Converts a string to a #guint64 value.
8577  * This function behaves like the standard strtoull() function
8578  * does in the C locale. It does this without actually
8579  * changing the current locale, since that would not be
8580  * thread-safe.
8581  *
8582  * This function is typically used when reading configuration
8583  * files or other non-user input that should be locale independent.
8584  * To handle input from the user you should normally use the
8585  * locale-sensitive system strtoull() function.
8586  *
8587  * If the correct value would cause overflow, %G_MAXUINT64
8588  * is returned, and <literal>ERANGE</literal> is stored in <literal>errno</literal>.
8589  * If the base is outside the valid range, zero is returned, and
8590  * <literal>EINVAL</literal> is stored in <literal>errno</literal>.
8591  * If the string conversion fails, zero is returned, and @endptr returns
8592  * @nptr (if @endptr is non-%NULL).
8593  *
8594  * Returns: the #guint64 value or zero on error.
8595  * Since: 2.2
8596  */
8597
8598
8599 /**
8600  * g_ascii_strup:
8601  * @str: a string.
8602  * @len: length of @str in bytes, or -1 if @str is nul-terminated.
8603  *
8604  * Converts all lower case ASCII letters to upper case ASCII letters.
8605  *
8606  * Returns: a newly allocated string, with all the lower case characters in @str converted to upper case, with semantics that exactly match g_ascii_toupper(). (Note that this is unlike the old g_strup(), which modified the string in place.)
8607  */
8608
8609
8610 /**
8611  * g_ascii_tolower:
8612  * @c: any character.
8613  *
8614  * Convert a character to ASCII lower case.
8615  *
8616  * Unlike the standard C library tolower() function, this only
8617  * recognizes standard ASCII letters and ignores the locale, returning
8618  * all non-ASCII characters unchanged, even if they are lower case
8619  * letters in a particular character set. Also unlike the standard
8620  * library function, this takes and returns a char, not an int, so
8621  * don't call it on <literal>EOF</literal> but no need to worry about casting to #guchar
8622  * before passing a possibly non-ASCII character in.
8623  *
8624  * Returns: the result of converting @c to lower case. If @c is not an ASCII upper case letter, @c is returned unchanged.
8625  */
8626
8627
8628 /**
8629  * g_ascii_toupper:
8630  * @c: any character.
8631  *
8632  * Convert a character to ASCII upper case.
8633  *
8634  * Unlike the standard C library toupper() function, this only
8635  * recognizes standard ASCII letters and ignores the locale, returning
8636  * all non-ASCII characters unchanged, even if they are upper case
8637  * letters in a particular character set. Also unlike the standard
8638  * library function, this takes and returns a char, not an int, so
8639  * don't call it on <literal>EOF</literal> but no need to worry about casting to #guchar
8640  * before passing a possibly non-ASCII character in.
8641  *
8642  * Returns: the result of converting @c to upper case. If @c is not an ASCII lower case letter, @c is returned unchanged.
8643  */
8644
8645
8646 /**
8647  * g_ascii_xdigit_value:
8648  * @c: an ASCII character.
8649  *
8650  * Determines the numeric value of a character as a hexidecimal
8651  * digit. Differs from g_unichar_xdigit_value() because it takes
8652  * a char, so there's no worry about sign extension if characters
8653  * are signed.
8654  *
8655  * Returns: If @c is a hex digit (according to g_ascii_isxdigit()), its numeric value. Otherwise, -1.
8656  */
8657
8658
8659 /**
8660  * g_assert:
8661  * @expr: the expression to check
8662  *
8663  * Debugging macro to terminate the application if the assertion
8664  * fails. If the assertion fails (i.e. the expression is not true),
8665  * an error message is logged and the application is terminated.
8666  *
8667  * The macro can be turned off in final releases of code by defining
8668  * <envar>G_DISABLE_ASSERT</envar> when compiling the application.
8669  */
8670
8671
8672 /**
8673  * g_assert_cmpfloat:
8674  * @n1: an floating point number
8675  * @cmp: The comparison operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
8676  * @n2: another floating point number
8677  *
8678  * Debugging macro to terminate the application with a warning
8679  * message if a floating point number comparison fails.
8680  *
8681  * The effect of <literal>g_assert_cmpfloat (n1, op, n2)</literal> is
8682  * the same as <literal>g_assert (n1 op n2)</literal>. The advantage
8683  * of this macro is that it can produce a message that includes the
8684  * actual values of @n1 and @n2.
8685  *
8686  * Since: 2.16
8687  */
8688
8689
8690 /**
8691  * g_assert_cmphex:
8692  * @n1: an unsigned integer
8693  * @cmp: The comparison operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
8694  * @n2: another unsigned integer
8695  *
8696  * Debugging macro to terminate the application with a warning
8697  * message if an unsigned integer comparison fails.
8698  *
8699  * This is a variant of g_assert_cmpuint() that displays the numbers
8700  * in hexadecimal notation in the message.
8701  *
8702  * Since: 2.16
8703  */
8704
8705
8706 /**
8707  * g_assert_cmpint:
8708  * @n1: an integer
8709  * @cmp: The comparison operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
8710  * @n2: another integer
8711  *
8712  * Debugging macro to terminate the application with a warning
8713  * message if an integer comparison fails.
8714  *
8715  * The effect of <literal>g_assert_cmpint (n1, op, n2)</literal> is
8716  * the same as <literal>g_assert (n1 op n2)</literal>. The advantage
8717  * of this macro is that it can produce a message that includes the
8718  * actual values of @n1 and @n2.
8719  *
8720  * Since: 2.16
8721  */
8722
8723
8724 /**
8725  * g_assert_cmpstr:
8726  * @s1: a string (may be %NULL)
8727  * @cmp: The comparison operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
8728  * @s2: another string (may be %NULL)
8729  *
8730  * Debugging macro to terminate the application with a warning
8731  * message if a string comparison fails. The strings are compared
8732  * using g_strcmp0().
8733  *
8734  * The effect of <literal>g_assert_cmpstr (s1, op, s2)</literal> is
8735  * the same as <literal>g_assert (g_strcmp0 (s1, s2) op 0)</literal>.
8736  * The advantage of this macro is that it can produce a message that
8737  * includes the actual values of @s1 and @s2.
8738  *
8739  * |[
8740  *   g_assert_cmpstr (mystring, ==, "fubar");
8741  * ]|
8742  *
8743  * Since: 2.16
8744  */
8745
8746
8747 /**
8748  * g_assert_cmpuint:
8749  * @n1: an unsigned integer
8750  * @cmp: The comparison operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
8751  * @n2: another unsigned integer
8752  *
8753  * Debugging macro to terminate the application with a warning
8754  * message if an unsigned integer comparison fails.
8755  *
8756  * The effect of <literal>g_assert_cmpuint (n1, op, n2)</literal> is
8757  * the same as <literal>g_assert (n1 op n2)</literal>. The advantage
8758  * of this macro is that it can produce a message that includes the
8759  * actual values of @n1 and @n2.
8760  *
8761  * Since: 2.16
8762  */
8763
8764
8765 /**
8766  * g_assert_error:
8767  * @err: a #GError, possibly %NULL
8768  * @dom: the expected error domain (a #GQuark)
8769  * @c: the expected error code
8770  *
8771  * Debugging macro to terminate the application with a warning
8772  * message if a method has not returned the correct #GError.
8773  *
8774  * The effect of <literal>g_assert_error (err, dom, c)</literal> is
8775  * the same as <literal>g_assert (err != NULL &amp;&amp; err->domain
8776  * == dom &amp;&amp; err->code == c)</literal>. The advantage of this
8777  * macro is that it can produce a message that includes the incorrect
8778  * error message and code.
8779  *
8780  * This can only be used to test for a specific error. If you want to
8781  * test that @err is set, but don't care what it's set to, just use
8782  * <literal>g_assert (err != NULL)</literal>
8783  *
8784  * Since: 2.20
8785  */
8786
8787
8788 /**
8789  * g_assert_no_error:
8790  * @err: a #GError, possibly %NULL
8791  *
8792  * Debugging macro to terminate the application with a warning
8793  * message if a method has returned a #GError.
8794  *
8795  * The effect of <literal>g_assert_no_error (err)</literal> is
8796  * the same as <literal>g_assert (err == NULL)</literal>. The advantage
8797  * of this macro is that it can produce a message that includes
8798  * the error message and code.
8799  *
8800  * Since: 2.20
8801  */
8802
8803
8804 /**
8805  * g_assert_not_reached:
8806  *
8807  * Debugging macro to terminate the application if it is ever
8808  * reached. If it is reached, an error message is logged and the
8809  * application is terminated.
8810  *
8811  * The macro can be turned off in final releases of code by defining
8812  * <envar>G_DISABLE_ASSERT</envar> when compiling the application.
8813  */
8814
8815
8816 /**
8817  * g_async_queue_length:
8818  * @queue: a #GAsyncQueue.
8819  *
8820  * Returns the length of the queue.
8821  *
8822  * Actually this function returns the number of data items in
8823  * the queue minus the number of waiting threads, so a negative
8824  * value means waiting threads, and a positive value means available
8825  * entries in the @queue. A return value of 0 could mean n entries
8826  * in the queue and n threads waiting. This can happen due to locking
8827  * of the queue or due to scheduling.
8828  *
8829  * Returns: the length of the @queue
8830  */
8831
8832
8833 /**
8834  * g_async_queue_length_unlocked:
8835  * @queue: a #GAsyncQueue
8836  *
8837  * Returns the length of the queue.
8838  *
8839  * Actually this function returns the number of data items in
8840  * the queue minus the number of waiting threads, so a negative
8841  * value means waiting threads, and a positive value means available
8842  * entries in the @queue. A return value of 0 could mean n entries
8843  * in the queue and n threads waiting. This can happen due to locking
8844  * of the queue or due to scheduling.
8845  *
8846  * This function must be called while holding the @queue's lock.
8847  *
8848  * Returns: the length of the @queue.
8849  */
8850
8851
8852 /**
8853  * g_async_queue_lock:
8854  * @queue: a #GAsyncQueue
8855  *
8856  * Acquires the @queue's lock. If another thread is already
8857  * holding the lock, this call will block until the lock
8858  * becomes available.
8859  *
8860  * Call g_async_queue_unlock() to drop the lock again.
8861  *
8862  * While holding the lock, you can only call the
8863  * <function>g_async_queue_*_unlocked()</function> functions
8864  * on @queue. Otherwise, deadlock may occur.
8865  */
8866
8867
8868 /**
8869  * g_async_queue_new:
8870  *
8871  * Creates a new asynchronous queue.
8872  *
8873  * Returns: a new #GAsyncQueue. Free with g_async_queue_unref()
8874  */
8875
8876
8877 /**
8878  * g_async_queue_new_full:
8879  * @item_free_func: function to free queue elements
8880  *
8881  * Creates a new asynchronous queue and sets up a destroy notify
8882  * function that is used to free any remaining queue items when
8883  * the queue is destroyed after the final unref.
8884  *
8885  * Returns: a new #GAsyncQueue. Free with g_async_queue_unref()
8886  * Since: 2.16
8887  */
8888
8889
8890 /**
8891  * g_async_queue_pop:
8892  * @queue: a #GAsyncQueue
8893  *
8894  * Pops data from the @queue. If @queue is empty, this function
8895  * blocks until data becomes available.
8896  *
8897  * Returns: data from the queue
8898  */
8899
8900
8901 /**
8902  * g_async_queue_pop_unlocked:
8903  * @queue: a #GAsyncQueue
8904  *
8905  * Pops data from the @queue. If @queue is empty, this function
8906  * blocks until data becomes available.
8907  *
8908  * This function must be called while holding the @queue's lock.
8909  *
8910  * Returns: data from the queue.
8911  */
8912
8913
8914 /**
8915  * g_async_queue_push:
8916  * @queue: a #GAsyncQueue
8917  * @data: @data to push into the @queue
8918  *
8919  * Pushes the @data into the @queue. @data must not be %NULL.
8920  */
8921
8922
8923 /**
8924  * g_async_queue_push_sorted:
8925  * @queue: a #GAsyncQueue
8926  * @data: the @data to push into the @queue
8927  * @func: the #GCompareDataFunc is used to sort @queue
8928  * @user_data: user data passed to @func.
8929  *
8930  * Inserts @data into @queue using @func to determine the new
8931  * position.
8932  *
8933  * This function requires that the @queue is sorted before pushing on
8934  * new elements, see g_async_queue_sort().
8935  *
8936  * This function will lock @queue before it sorts the queue and unlock
8937  * it when it is finished.
8938  *
8939  * For an example of @func see g_async_queue_sort().
8940  *
8941  * Since: 2.10
8942  */
8943
8944
8945 /**
8946  * g_async_queue_push_sorted_unlocked:
8947  * @queue: a #GAsyncQueue
8948  * @data: the @data to push into the @queue
8949  * @func: the #GCompareDataFunc is used to sort @queue
8950  * @user_data: user data passed to @func.
8951  *
8952  * Inserts @data into @queue using @func to determine the new
8953  * position.
8954  *
8955  * The sort function @func is passed two elements of the @queue.
8956  * It should return 0 if they are equal, a negative value if the
8957  * first element should be higher in the @queue or a positive value
8958  * if the first element should be lower in the @queue than the second
8959  * element.
8960  *
8961  * This function requires that the @queue is sorted before pushing on
8962  * new elements, see g_async_queue_sort().
8963  *
8964  * This function must be called while holding the @queue's lock.
8965  *
8966  * For an example of @func see g_async_queue_sort().
8967  *
8968  * Since: 2.10
8969  */
8970
8971
8972 /**
8973  * g_async_queue_push_unlocked:
8974  * @queue: a #GAsyncQueue
8975  * @data: @data to push into the @queue
8976  *
8977  * Pushes the @data into the @queue. @data must not be %NULL.
8978  *
8979  * This function must be called while holding the @queue's lock.
8980  */
8981
8982
8983 /**
8984  * g_async_queue_ref:
8985  * @queue: a #GAsyncQueue
8986  *
8987  * Increases the reference count of the asynchronous @queue by 1.
8988  * You do not need to hold the lock to call this function.
8989  *
8990  * Returns: the @queue that was passed in (since 2.6)
8991  */
8992
8993
8994 /**
8995  * g_async_queue_ref_unlocked:
8996  * @queue: a #GAsyncQueue
8997  *
8998  * Increases the reference count of the asynchronous @queue by 1.
8999  *
9000  * Deprecated: 2.8: Reference counting is done atomically. so g_async_queue_ref() can be used regardless of the @queue's lock.
9001  */
9002
9003
9004 /**
9005  * g_async_queue_sort:
9006  * @queue: a #GAsyncQueue
9007  * @func: the #GCompareDataFunc is used to sort @queue
9008  * @user_data: user data passed to @func
9009  *
9010  * Sorts @queue using @func.
9011  *
9012  * The sort function @func is passed two elements of the @queue.
9013  * It should return 0 if they are equal, a negative value if the
9014  * first element should be higher in the @queue or a positive value
9015  * if the first element should be lower in the @queue than the second
9016  * element.
9017  *
9018  * This function will lock @queue before it sorts the queue and unlock
9019  * it when it is finished.
9020  *
9021  * If you were sorting a list of priority numbers to make sure the
9022  * lowest priority would be at the top of the queue, you could use:
9023  * |[
9024  *  gint32 id1;
9025  *  gint32 id2;
9026  *
9027  *  id1 = GPOINTER_TO_INT (element1);
9028  *  id2 = GPOINTER_TO_INT (element2);
9029  *
9030  *  return (id1 > id2 ? +1 : id1 == id2 ? 0 : -1);
9031  * ]|
9032  *
9033  * Since: 2.10
9034  */
9035
9036
9037 /**
9038  * g_async_queue_sort_unlocked:
9039  * @queue: a #GAsyncQueue
9040  * @func: the #GCompareDataFunc is used to sort @queue
9041  * @user_data: user data passed to @func
9042  *
9043  * Sorts @queue using @func.
9044  *
9045  * The sort function @func is passed two elements of the @queue.
9046  * It should return 0 if they are equal, a negative value if the
9047  * first element should be higher in the @queue or a positive value
9048  * if the first element should be lower in the @queue than the second
9049  * element.
9050  *
9051  * This function must be called while holding the @queue's lock.
9052  *
9053  * Since: 2.10
9054  */
9055
9056
9057 /**
9058  * g_async_queue_timed_pop:
9059  * @queue: a #GAsyncQueue
9060  * @end_time: a #GTimeVal, determining the final time
9061  *
9062  * Pops data from the @queue. If the queue is empty, blocks until
9063  * @end_time or until data becomes available.
9064  *
9065  * If no data is received before @end_time, %NULL is returned.
9066  *
9067  * To easily calculate @end_time, a combination of g_get_current_time()
9068  * and g_time_val_add() can be used.
9069  *
9070  * Returns: data from the queue or %NULL, when no data is received before @end_time.
9071  * Deprecated: use g_async_queue_timeout_pop().
9072  */
9073
9074
9075 /**
9076  * g_async_queue_timed_pop_unlocked:
9077  * @queue: a #GAsyncQueue
9078  * @end_time: a #GTimeVal, determining the final time
9079  *
9080  * Pops data from the @queue. If the queue is empty, blocks until
9081  * @end_time or until data becomes available.
9082  *
9083  * If no data is received before @end_time, %NULL is returned.
9084  *
9085  * To easily calculate @end_time, a combination of g_get_current_time()
9086  * and g_time_val_add() can be used.
9087  *
9088  * This function must be called while holding the @queue's lock.
9089  *
9090  * Returns: data from the queue or %NULL, when no data is received before @end_time.
9091  * Deprecated: use g_async_queue_timeout_pop_unlocked().
9092  */
9093
9094
9095 /**
9096  * g_async_queue_timeout_pop:
9097  * @queue: a #GAsyncQueue
9098  * @timeout: the number of microseconds to wait
9099  *
9100  * Pops data from the @queue. If the queue is empty, blocks for
9101  * @timeout microseconds, or until data becomes available.
9102  *
9103  * If no data is received before the timeout, %NULL is returned.
9104  *
9105  * Returns: data from the queue or %NULL, when no data is received before the timeout.
9106  */
9107
9108
9109 /**
9110  * g_async_queue_timeout_pop_unlocked:
9111  * @queue: a #GAsyncQueue
9112  * @timeout: the number of microseconds to wait
9113  *
9114  * Pops data from the @queue. If the queue is empty, blocks for
9115  * @timeout microseconds, or until data becomes available.
9116  *
9117  * If no data is received before the timeout, %NULL is returned.
9118  *
9119  * This function must be called while holding the @queue's lock.
9120  *
9121  * Returns: data from the queue or %NULL, when no data is received before the timeout.
9122  */
9123
9124
9125 /**
9126  * g_async_queue_try_pop:
9127  * @queue: a #GAsyncQueue
9128  *
9129  * Tries to pop data from the @queue. If no data is available,
9130  * %NULL is returned.
9131  *
9132  * Returns: data from the queue or %NULL, when no data is available immediately.
9133  */
9134
9135
9136 /**
9137  * g_async_queue_try_pop_unlocked:
9138  * @queue: a #GAsyncQueue
9139  *
9140  * Tries to pop data from the @queue. If no data is available,
9141  * %NULL is returned.
9142  *
9143  * This function must be called while holding the @queue's lock.
9144  *
9145  * Returns: data from the queue or %NULL, when no data is available immediately.
9146  */
9147
9148
9149 /**
9150  * g_async_queue_unlock:
9151  * @queue: a #GAsyncQueue
9152  *
9153  * Releases the queue's lock.
9154  *
9155  * Calling this function when you have not acquired
9156  * the with g_async_queue_lock() leads to undefined
9157  * behaviour.
9158  */
9159
9160
9161 /**
9162  * g_async_queue_unref:
9163  * @queue: a #GAsyncQueue.
9164  *
9165  * Decreases the reference count of the asynchronous @queue by 1.
9166  *
9167  * If the reference count went to 0, the @queue will be destroyed
9168  * and the memory allocated will be freed. So you are not allowed
9169  * to use the @queue afterwards, as it might have disappeared.
9170  * You do not need to hold the lock to call this function.
9171  */
9172
9173
9174 /**
9175  * g_async_queue_unref_and_unlock:
9176  * @queue: a #GAsyncQueue
9177  *
9178  * Decreases the reference count of the asynchronous @queue by 1
9179  * and releases the lock. This function must be called while holding
9180  * the @queue's lock. If the reference count went to 0, the @queue
9181  * will be destroyed and the memory allocated will be freed.
9182  *
9183  * Deprecated: 2.8: Reference counting is done atomically. so g_async_queue_unref() can be used regardless of the @queue's lock.
9184  */
9185
9186
9187 /**
9188  * g_atexit:
9189  * @func: (scope async): the function to call on normal program termination.
9190  *
9191  * Specifies a function to be called at normal program termination.
9192  *
9193  * Since GLib 2.8.2, on Windows g_atexit() actually is a preprocessor
9194  * macro that maps to a call to the atexit() function in the C
9195  * library. This means that in case the code that calls g_atexit(),
9196  * i.e. atexit(), is in a DLL, the function will be called when the
9197  * DLL is detached from the program. This typically makes more sense
9198  * than that the function is called when the GLib DLL is detached,
9199  * which happened earlier when g_atexit() was a function in the GLib
9200  * DLL.
9201  *
9202  * The behaviour of atexit() in the context of dynamically loaded
9203  * modules is not formally specified and varies wildly.
9204  *
9205  * On POSIX systems, calling g_atexit() (or atexit()) in a dynamically
9206  * loaded module which is unloaded before the program terminates might
9207  * well cause a crash at program exit.
9208  *
9209  * Some POSIX systems implement atexit() like Windows, and have each
9210  * dynamically loaded module maintain an own atexit chain that is
9211  * called when the module is unloaded.
9212  *
9213  * On other POSIX systems, before a dynamically loaded module is
9214  * unloaded, the registered atexit functions (if any) residing in that
9215  * module are called, regardless where the code that registered them
9216  * resided. This is presumably the most robust approach.
9217  *
9218  * As can be seen from the above, for portability it's best to avoid
9219  * calling g_atexit() (or atexit()) except in the main executable of a
9220  * program.
9221  *
9222  * Deprecated: 2.32: It is best to avoid g_atexit().
9223  */
9224
9225
9226 /**
9227  * g_atomic_int_add:
9228  * @atomic: a pointer to a #gint or #guint
9229  * @val: the value to add
9230  *
9231  * Atomically adds @val to the value of @atomic.
9232  *
9233  * Think of this operation as an atomic version of
9234  * <literal>{ tmp = *atomic; *@atomic += @val; return tmp; }</literal>
9235  *
9236  * This call acts as a full compiler and hardware memory barrier.
9237  *
9238  * Before version 2.30, this function did not return a value
9239  * (but g_atomic_int_exchange_and_add() did, and had the same meaning).
9240  *
9241  * Returns: the value of @atomic before the add, signed
9242  * Since: 2.4
9243  */
9244
9245
9246 /**
9247  * g_atomic_int_and:
9248  * @atomic: a pointer to a #gint or #guint
9249  * @val: the value to 'and'
9250  *
9251  * Performs an atomic bitwise 'and' of the value of @atomic and @val,
9252  * storing the result back in @atomic.
9253  *
9254  * This call acts as a full compiler and hardware memory barrier.
9255  *
9256  * Think of this operation as an atomic version of
9257  * <literal>{ tmp = *atomic; *@atomic &= @val; return tmp; }</literal>
9258  *
9259  * Returns: the value of @atomic before the operation, unsigned
9260  * Since: 2.30
9261  */
9262
9263
9264 /**
9265  * g_atomic_int_compare_and_exchange:
9266  * @atomic: a pointer to a #gint or #guint
9267  * @oldval: the value to compare with
9268  * @newval: the value to conditionally replace with
9269  *
9270  * Compares @atomic to @oldval and, if equal, sets it to @newval.
9271  * If @atomic was not equal to @oldval then no change occurs.
9272  *
9273  * This compare and exchange is done atomically.
9274  *
9275  * Think of this operation as an atomic version of
9276  * <literal>{ if (*@atomic == @oldval) { *@atomic = @newval; return TRUE; } else return FALSE; }</literal>
9277  *
9278  * This call acts as a full compiler and hardware memory barrier.
9279  *
9280  * Returns: %TRUE if the exchange took place
9281  * Since: 2.4
9282  */
9283
9284
9285 /**
9286  * g_atomic_int_dec_and_test:
9287  * @atomic: a pointer to a #gint or #guint
9288  *
9289  * Decrements the value of @atomic by 1.
9290  *
9291  * Think of this operation as an atomic version of
9292  * <literal>{ *@atomic -= 1; return (*@atomic == 0); }</literal>
9293  *
9294  * This call acts as a full compiler and hardware memory barrier.
9295  *
9296  * Returns: %TRUE if the resultant value is zero
9297  * Since: 2.4
9298  */
9299
9300
9301 /**
9302  * g_atomic_int_exchange_and_add:
9303  * @atomic: a pointer to a #gint
9304  * @val: the value to add
9305  *
9306  * This function existed before g_atomic_int_add() returned the prior
9307  * value of the integer (which it now does).  It is retained only for
9308  * compatibility reasons.  Don't use this function in new code.
9309  *
9310  * Returns: the value of @atomic before the add, signed
9311  * Since: 2.4
9312  * Deprecated: 2.30: Use g_atomic_int_add() instead.
9313  */
9314
9315
9316 /**
9317  * g_atomic_int_get:
9318  * @atomic: a pointer to a #gint or #guint
9319  *
9320  * Gets the current value of @atomic.
9321  *
9322  * This call acts as a full compiler and hardware
9323  * memory barrier (before the get).
9324  *
9325  * Returns: the value of the integer
9326  * Since: 2.4
9327  */
9328
9329
9330 /**
9331  * g_atomic_int_inc:
9332  * @atomic: a pointer to a #gint or #guint
9333  *
9334  * Increments the value of @atomic by 1.
9335  *
9336  * Think of this operation as an atomic version of
9337  * <literal>{ *@atomic += 1; }</literal>
9338  *
9339  * This call acts as a full compiler and hardware memory barrier.
9340  *
9341  * Since: 2.4
9342  */
9343
9344
9345 /**
9346  * g_atomic_int_or:
9347  * @atomic: a pointer to a #gint or #guint
9348  * @val: the value to 'or'
9349  *
9350  * Performs an atomic bitwise 'or' of the value of @atomic and @val,
9351  * storing the result back in @atomic.
9352  *
9353  * Think of this operation as an atomic version of
9354  * <literal>{ tmp = *atomic; *@atomic |= @val; return tmp; }</literal>
9355  *
9356  * This call acts as a full compiler and hardware memory barrier.
9357  *
9358  * Returns: the value of @atomic before the operation, unsigned
9359  * Since: 2.30
9360  */
9361
9362
9363 /**
9364  * g_atomic_int_set:
9365  * @atomic: a pointer to a #gint or #guint
9366  * @newval: a new value to store
9367  *
9368  * Sets the value of @atomic to @newval.
9369  *
9370  * This call acts as a full compiler and hardware
9371  * memory barrier (after the set).
9372  *
9373  * Since: 2.4
9374  */
9375
9376
9377 /**
9378  * g_atomic_int_xor:
9379  * @atomic: a pointer to a #gint or #guint
9380  * @val: the value to 'xor'
9381  *
9382  * Performs an atomic bitwise 'xor' of the value of @atomic and @val,
9383  * storing the result back in @atomic.
9384  *
9385  * Think of this operation as an atomic version of
9386  * <literal>{ tmp = *atomic; *@atomic ^= @val; return tmp; }</literal>
9387  *
9388  * This call acts as a full compiler and hardware memory barrier.
9389  *
9390  * Returns: the value of @atomic before the operation, unsigned
9391  * Since: 2.30
9392  */
9393
9394
9395 /**
9396  * g_atomic_pointer_add:
9397  * @atomic: a pointer to a #gpointer-sized value
9398  * @val: the value to add
9399  *
9400  * Atomically adds @val to the value of @atomic.
9401  *
9402  * Think of this operation as an atomic version of
9403  * <literal>{ tmp = *atomic; *@atomic += @val; return tmp; }</literal>
9404  *
9405  * This call acts as a full compiler and hardware memory barrier.
9406  *
9407  * Returns: the value of @atomic before the add, signed
9408  * Since: 2.30
9409  */
9410
9411
9412 /**
9413  * g_atomic_pointer_and:
9414  * @atomic: a pointer to a #gpointer-sized value
9415  * @val: the value to 'and'
9416  *
9417  * Performs an atomic bitwise 'and' of the value of @atomic and @val,
9418  * storing the result back in @atomic.
9419  *
9420  * Think of this operation as an atomic version of
9421  * <literal>{ tmp = *atomic; *@atomic &= @val; return tmp; }</literal>
9422  *
9423  * This call acts as a full compiler and hardware memory barrier.
9424  *
9425  * Returns: the value of @atomic before the operation, unsigned
9426  * Since: 2.30
9427  */
9428
9429
9430 /**
9431  * g_atomic_pointer_compare_and_exchange:
9432  * @atomic: a pointer to a #gpointer-sized value
9433  * @oldval: the value to compare with
9434  * @newval: the value to conditionally replace with
9435  *
9436  * Compares @atomic to @oldval and, if equal, sets it to @newval.
9437  * If @atomic was not equal to @oldval then no change occurs.
9438  *
9439  * This compare and exchange is done atomically.
9440  *
9441  * Think of this operation as an atomic version of
9442  * <literal>{ if (*@atomic == @oldval) { *@atomic = @newval; return TRUE; } else return FALSE; }</literal>
9443  *
9444  * This call acts as a full compiler and hardware memory barrier.
9445  *
9446  * Returns: %TRUE if the exchange took place
9447  * Since: 2.4
9448  */
9449
9450
9451 /**
9452  * g_atomic_pointer_get:
9453  * @atomic: a pointer to a #gpointer-sized value
9454  *
9455  * Gets the current value of @atomic.
9456  *
9457  * This call acts as a full compiler and hardware
9458  * memory barrier (before the get).
9459  *
9460  * Returns: the value of the pointer
9461  * Since: 2.4
9462  */
9463
9464
9465 /**
9466  * g_atomic_pointer_or:
9467  * @atomic: a pointer to a #gpointer-sized value
9468  * @val: the value to 'or'
9469  *
9470  * Performs an atomic bitwise 'or' of the value of @atomic and @val,
9471  * storing the result back in @atomic.
9472  *
9473  * Think of this operation as an atomic version of
9474  * <literal>{ tmp = *atomic; *@atomic |= @val; return tmp; }</literal>
9475  *
9476  * This call acts as a full compiler and hardware memory barrier.
9477  *
9478  * Returns: the value of @atomic before the operation, unsigned
9479  * Since: 2.30
9480  */
9481
9482
9483 /**
9484  * g_atomic_pointer_set:
9485  * @atomic: a pointer to a #gpointer-sized value
9486  * @newval: a new value to store
9487  *
9488  * Sets the value of @atomic to @newval.
9489  *
9490  * This call acts as a full compiler and hardware
9491  * memory barrier (after the set).
9492  *
9493  * Since: 2.4
9494  */
9495
9496
9497 /**
9498  * g_atomic_pointer_xor:
9499  * @atomic: a pointer to a #gpointer-sized value
9500  * @val: the value to 'xor'
9501  *
9502  * Performs an atomic bitwise 'xor' of the value of @atomic and @val,
9503  * storing the result back in @atomic.
9504  *
9505  * Think of this operation as an atomic version of
9506  * <literal>{ tmp = *atomic; *@atomic ^= @val; return tmp; }</literal>
9507  *
9508  * This call acts as a full compiler and hardware memory barrier.
9509  *
9510  * Returns: the value of @atomic before the operation, unsigned
9511  * Since: 2.30
9512  */
9513
9514
9515 /**
9516  * g_base64_decode:
9517  * @text: zero-terminated string with base64 text to decode
9518  * @out_len: (out): The length of the decoded data is written here
9519  *
9520  * Decode a sequence of Base-64 encoded text into binary data
9521  *
9522  * Returns: (transfer full) (array length=out_len) (element-type guint8): newly allocated buffer containing the binary data that @text represents. The returned buffer must be freed with g_free().
9523  * Since: 2.12
9524  */
9525
9526
9527 /**
9528  * g_base64_decode_inplace:
9529  * @text: (inout) (array length=out_len) (element-type guint8): zero-terminated string with base64 text to decode
9530  * @out_len: (inout): The length of the decoded data is written here
9531  *
9532  * Decode a sequence of Base-64 encoded text into binary data
9533  * by overwriting the input data.
9534  *
9535  * Returns: (transfer none): The binary data that @text responds. This pointer is the same as the input @text.
9536  * Since: 2.20
9537  */
9538
9539
9540 /**
9541  * g_base64_decode_step:
9542  * @in: (array length=len) (element-type guint8): binary input data
9543  * @len: max length of @in data to decode
9544  * @out: (out) (array) (element-type guint8): output buffer
9545  * @state: (inout): Saved state between steps, initialize to 0
9546  * @save: (inout): Saved state between steps, initialize to 0
9547  *
9548  * Incrementally decode a sequence of binary data from its Base-64 stringified
9549  * representation. By calling this function multiple times you can convert
9550  * data in chunks to avoid having to have the full encoded data in memory.
9551  *
9552  * The output buffer must be large enough to fit all the data that will
9553  * be written to it. Since base64 encodes 3 bytes in 4 chars you need
9554  * at least: (@len / 4) * 3 + 3 bytes (+ 3 may be needed in case of non-zero
9555  * state).
9556  *
9557  * Returns: The number of bytes of output that was written
9558  * Since: 2.12
9559  */
9560
9561
9562 /**
9563  * g_base64_encode:
9564  * @data: (array length=len) (element-type guint8): the binary data to encode
9565  * @len: the length of @data
9566  *
9567  * Encode a sequence of binary data into its Base-64 stringified
9568  * representation.
9569  *
9570  * Returns: (transfer full): a newly allocated, zero-terminated Base-64 encoded string representing @data. The returned string must be freed with g_free().
9571  * Since: 2.12
9572  */
9573
9574
9575 /**
9576  * g_base64_encode_close:
9577  * @break_lines: whether to break long lines
9578  * @out: (out) (array) (element-type guint8): pointer to destination buffer
9579  * @state: (inout): Saved state from g_base64_encode_step()
9580  * @save: (inout): Saved state from g_base64_encode_step()
9581  *
9582  * Flush the status from a sequence of calls to g_base64_encode_step().
9583  *
9584  * The output buffer must be large enough to fit all the data that will
9585  * be written to it. It will need up to 4 bytes, or up to 5 bytes if
9586  * line-breaking is enabled.
9587  *
9588  * Returns: The number of bytes of output that was written
9589  * Since: 2.12
9590  */
9591
9592
9593 /**
9594  * g_base64_encode_step:
9595  * @in: (array length=len) (element-type guint8): the binary data to encode
9596  * @len: the length of @in
9597  * @break_lines: whether to break long lines
9598  * @out: (out) (array) (element-type guint8): pointer to destination buffer
9599  * @state: (inout): Saved state between steps, initialize to 0
9600  * @save: (inout): Saved state between steps, initialize to 0
9601  *
9602  * Incrementally encode a sequence of binary data into its Base-64 stringified
9603  * representation. By calling this function multiple times you can convert
9604  * data in chunks to avoid having to have the full encoded data in memory.
9605  *
9606  * When all of the data has been converted you must call
9607  * g_base64_encode_close() to flush the saved state.
9608  *
9609  * The output buffer must be large enough to fit all the data that will
9610  * be written to it. Due to the way base64 encodes you will need
9611  * at least: (@len / 3 + 1) * 4 + 4 bytes (+ 4 may be needed in case of
9612  * non-zero state). If you enable line-breaking you will need at least:
9613  * ((@len / 3 + 1) * 4 + 4) / 72 + 1 bytes of extra space.
9614  *
9615  * @break_lines is typically used when putting base64-encoded data in emails.
9616  * It breaks the lines at 72 columns instead of putting all of the text on
9617  * the same line. This avoids problems with long lines in the email system.
9618  * Note however that it breaks the lines with <literal>LF</literal>
9619  * characters, not <literal>CR LF</literal> sequences, so the result cannot
9620  * be passed directly to SMTP or certain other protocols.
9621  *
9622  * Returns: The number of bytes of output that was written
9623  * Since: 2.12
9624  */
9625
9626
9627 /**
9628  * g_basename:
9629  * @file_name: the name of the file
9630  *
9631  * Gets the name of the file without any leading directory
9632  * components. It returns a pointer into the given file name
9633  * string.
9634  *
9635  * Returns: the name of the file without any leading directory components
9636  * Deprecated: 2.2: Use g_path_get_basename() instead, but notice that g_path_get_basename() allocates new memory for the returned string, unlike this function which returns a pointer into the argument.
9637  */
9638
9639
9640 /**
9641  * g_bit_lock:
9642  * @address: a pointer to an integer
9643  * @lock_bit: a bit value between 0 and 31
9644  *
9645  * Sets the indicated @lock_bit in @address.  If the bit is already
9646  * set, this call will block until g_bit_unlock() unsets the
9647  * corresponding bit.
9648  *
9649  * Attempting to lock on two different bits within the same integer is
9650  * not supported and will very probably cause deadlocks.
9651  *
9652  * The value of the bit that is set is (1u << @bit).  If @bit is not
9653  * between 0 and 31 then the result is undefined.
9654  *
9655  * This function accesses @address atomically.  All other accesses to
9656  * @address must be atomic in order for this function to work
9657  * reliably.
9658  *
9659  * Since: 2.24
9660  */
9661
9662
9663 /**
9664  * g_bit_nth_lsf:
9665  * @mask: a #gulong containing flags
9666  * @nth_bit: the index of the bit to start the search from
9667  *
9668  * Find the position of the first bit set in @mask, searching
9669  * from (but not including) @nth_bit upwards. Bits are numbered
9670  * from 0 (least significant) to sizeof(#gulong) * 8 - 1 (31 or 63,
9671  * usually). To start searching from the 0th bit, set @nth_bit to -1.
9672  *
9673  * Returns: the index of the first bit set which is higher than @nth_bit
9674  */
9675
9676
9677 /**
9678  * g_bit_nth_msf:
9679  * @mask: a #gulong containing flags
9680  * @nth_bit: the index of the bit to start the search from
9681  *
9682  * Find the position of the first bit set in @mask, searching
9683  * from (but not including) @nth_bit downwards. Bits are numbered
9684  * from 0 (least significant) to sizeof(#gulong) * 8 - 1 (31 or 63,
9685  * usually). To start searching from the last bit, set @nth_bit to
9686  * -1 or GLIB_SIZEOF_LONG * 8.
9687  *
9688  * Returns: the index of the first bit set which is lower than @nth_bit
9689  */
9690
9691
9692 /**
9693  * g_bit_storage:
9694  * @number: a #guint
9695  *
9696  * Gets the number of bits used to hold @number,
9697  * e.g. if @number is 4, 3 bits are needed.
9698  *
9699  * Returns: the number of bits used to hold @number
9700  */
9701
9702
9703 /**
9704  * g_bit_trylock:
9705  * @address: a pointer to an integer
9706  * @lock_bit: a bit value between 0 and 31
9707  *
9708  * Sets the indicated @lock_bit in @address, returning %TRUE if
9709  * successful.  If the bit is already set, returns %FALSE immediately.
9710  *
9711  * Attempting to lock on two different bits within the same integer is
9712  * not supported.
9713  *
9714  * The value of the bit that is set is (1u << @bit).  If @bit is not
9715  * between 0 and 31 then the result is undefined.
9716  *
9717  * This function accesses @address atomically.  All other accesses to
9718  * @address must be atomic in order for this function to work
9719  * reliably.
9720  *
9721  * Returns: %TRUE if the lock was acquired
9722  * Since: 2.24
9723  */
9724
9725
9726 /**
9727  * g_bit_unlock:
9728  * @address: a pointer to an integer
9729  * @lock_bit: a bit value between 0 and 31
9730  *
9731  * Clears the indicated @lock_bit in @address.  If another thread is
9732  * currently blocked in g_bit_lock() on this same bit then it will be
9733  * woken up.
9734  *
9735  * This function accesses @address atomically.  All other accesses to
9736  * @address must be atomic in order for this function to work
9737  * reliably.
9738  *
9739  * Since: 2.24
9740  */
9741
9742
9743 /**
9744  * g_bookmark_file_add_application:
9745  * @bookmark: a #GBookmarkFile
9746  * @uri: a valid URI
9747  * @name: (allow-none): the name of the application registering the bookmark or %NULL
9748  * @exec: (allow-none): command line to be used to launch the bookmark or %NULL
9749  *
9750  * Adds the application with @name and @exec to the list of
9751  * applications that have registered a bookmark for @uri into
9752  * @bookmark.
9753  *
9754  * Every bookmark inside a #GBookmarkFile must have at least an
9755  * application registered.  Each application must provide a name, a
9756  * command line useful for launching the bookmark, the number of times
9757  * the bookmark has been registered by the application and the last
9758  * time the application registered this bookmark.
9759  *
9760  * If @name is %NULL, the name of the application will be the
9761  * same returned by g_get_application_name(); if @exec is %NULL, the
9762  * command line will be a composition of the program name as
9763  * returned by g_get_prgname() and the "\%u" modifier, which will be
9764  * expanded to the bookmark's URI.
9765  *
9766  * This function will automatically take care of updating the
9767  * registrations count and timestamping in case an application
9768  * with the same @name had already registered a bookmark for
9769  * @uri inside @bookmark.
9770  *
9771  * If no bookmark for @uri is found, one is created.
9772  *
9773  * Since: 2.12
9774  */
9775
9776
9777 /**
9778  * g_bookmark_file_add_group:
9779  * @bookmark: a #GBookmarkFile
9780  * @uri: a valid URI
9781  * @group: the group name to be added
9782  *
9783  * Adds @group to the list of groups to which the bookmark for @uri
9784  * belongs to.
9785  *
9786  * If no bookmark for @uri is found then it is created.
9787  *
9788  * Since: 2.12
9789  */
9790
9791
9792 /**
9793  * g_bookmark_file_free:
9794  * @bookmark: a #GBookmarkFile
9795  *
9796  * Frees a #GBookmarkFile.
9797  *
9798  * Since: 2.12
9799  */
9800
9801
9802 /**
9803  * g_bookmark_file_get_added:
9804  * @bookmark: a #GBookmarkFile
9805  * @uri: a valid URI
9806  * @error: return location for a #GError, or %NULL
9807  *
9808  * Gets the time the bookmark for @uri was added to @bookmark
9809  *
9810  * In the event the URI cannot be found, -1 is returned and
9811  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
9812  *
9813  * Returns: a timestamp
9814  * Since: 2.12
9815  */
9816
9817
9818 /**
9819  * g_bookmark_file_get_app_info:
9820  * @bookmark: a #GBookmarkFile
9821  * @uri: a valid URI
9822  * @name: an application's name
9823  * @exec: (allow-none): location for the command line of the application, or %NULL
9824  * @count: (allow-none): return location for the registration count, or %NULL
9825  * @stamp: (allow-none): return location for the last registration time, or %NULL
9826  * @error: return location for a #GError, or %NULL
9827  *
9828  * Gets the registration informations of @app_name for the bookmark for
9829  * @uri.  See g_bookmark_file_set_app_info() for more informations about
9830  * the returned data.
9831  *
9832  * The string returned in @app_exec must be freed.
9833  *
9834  * In the event the URI cannot be found, %FALSE is returned and
9835  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.  In the
9836  * event that no application with name @app_name has registered a bookmark
9837  * for @uri,  %FALSE is returned and error is set to
9838  * #G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. In the event that unquoting
9839  * the command line fails, an error of the #G_SHELL_ERROR domain is
9840  * set and %FALSE is returned.
9841  *
9842  * Returns: %TRUE on success.
9843  * Since: 2.12
9844  */
9845
9846
9847 /**
9848  * g_bookmark_file_get_applications:
9849  * @bookmark: a #GBookmarkFile
9850  * @uri: a valid URI
9851  * @length: (allow-none): return location of the length of the returned list, or %NULL
9852  * @error: return location for a #GError, or %NULL
9853  *
9854  * Retrieves the names of the applications that have registered the
9855  * bookmark for @uri.
9856  *
9857  * In the event the URI cannot be found, %NULL is returned and
9858  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
9859  *
9860  * Returns: a newly allocated %NULL-terminated array of strings. Use g_strfreev() to free it.
9861  * Since: 2.12
9862  */
9863
9864
9865 /**
9866  * g_bookmark_file_get_description:
9867  * @bookmark: a #GBookmarkFile
9868  * @uri: a valid URI
9869  * @error: return location for a #GError, or %NULL
9870  *
9871  * Retrieves the description of the bookmark for @uri.
9872  *
9873  * In the event the URI cannot be found, %NULL is returned and
9874  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
9875  *
9876  * Returns: a newly allocated string or %NULL if the specified URI cannot be found.
9877  * Since: 2.12
9878  */
9879
9880
9881 /**
9882  * g_bookmark_file_get_groups:
9883  * @bookmark: a #GBookmarkFile
9884  * @uri: a valid URI
9885  * @length: (allow-none): return location for the length of the returned string, or %NULL
9886  * @error: return location for a #GError, or %NULL
9887  *
9888  * Retrieves the list of group names of the bookmark for @uri.
9889  *
9890  * In the event the URI cannot be found, %NULL is returned and
9891  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
9892  *
9893  * The returned array is %NULL terminated, so @length may optionally
9894  * be %NULL.
9895  *
9896  * Returns: a newly allocated %NULL-terminated array of group names. Use g_strfreev() to free it.
9897  * Since: 2.12
9898  */
9899
9900
9901 /**
9902  * g_bookmark_file_get_icon:
9903  * @bookmark: a #GBookmarkFile
9904  * @uri: a valid URI
9905  * @href: (allow-none): return location for the icon's location or %NULL
9906  * @mime_type: (allow-none): return location for the icon's MIME type or %NULL
9907  * @error: return location for a #GError or %NULL
9908  *
9909  * Gets the icon of the bookmark for @uri.
9910  *
9911  * In the event the URI cannot be found, %FALSE is returned and
9912  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
9913  *
9914  * Returns: %TRUE if the icon for the bookmark for the URI was found. You should free the returned strings.
9915  * Since: 2.12
9916  */
9917
9918
9919 /**
9920  * g_bookmark_file_get_is_private:
9921  * @bookmark: a #GBookmarkFile
9922  * @uri: a valid URI
9923  * @error: return location for a #GError, or %NULL
9924  *
9925  * Gets whether the private flag of the bookmark for @uri is set.
9926  *
9927  * In the event the URI cannot be found, %FALSE is returned and
9928  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.  In the
9929  * event that the private flag cannot be found, %FALSE is returned and
9930  * @error is set to #G_BOOKMARK_FILE_ERROR_INVALID_VALUE.
9931  *
9932  * Returns: %TRUE if the private flag is set, %FALSE otherwise.
9933  * Since: 2.12
9934  */
9935
9936
9937 /**
9938  * g_bookmark_file_get_mime_type:
9939  * @bookmark: a #GBookmarkFile
9940  * @uri: a valid URI
9941  * @error: return location for a #GError, or %NULL
9942  *
9943  * Retrieves the MIME type of the resource pointed by @uri.
9944  *
9945  * In the event the URI cannot be found, %NULL is returned and
9946  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.  In the
9947  * event that the MIME type cannot be found, %NULL is returned and
9948  * @error is set to #G_BOOKMARK_FILE_ERROR_INVALID_VALUE.
9949  *
9950  * Returns: a newly allocated string or %NULL if the specified URI cannot be found.
9951  * Since: 2.12
9952  */
9953
9954
9955 /**
9956  * g_bookmark_file_get_modified:
9957  * @bookmark: a #GBookmarkFile
9958  * @uri: a valid URI
9959  * @error: return location for a #GError, or %NULL
9960  *
9961  * Gets the time when the bookmark for @uri was last modified.
9962  *
9963  * In the event the URI cannot be found, -1 is returned and
9964  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
9965  *
9966  * Returns: a timestamp
9967  * Since: 2.12
9968  */
9969
9970
9971 /**
9972  * g_bookmark_file_get_size:
9973  * @bookmark: a #GBookmarkFile
9974  *
9975  * Gets the number of bookmarks inside @bookmark.
9976  *
9977  * Returns: the number of bookmarks
9978  * Since: 2.12
9979  */
9980
9981
9982 /**
9983  * g_bookmark_file_get_title:
9984  * @bookmark: a #GBookmarkFile
9985  * @uri: (allow-none): a valid URI or %NULL
9986  * @error: return location for a #GError, or %NULL
9987  *
9988  * Returns the title of the bookmark for @uri.
9989  *
9990  * If @uri is %NULL, the title of @bookmark is returned.
9991  *
9992  * In the event the URI cannot be found, %NULL is returned and
9993  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
9994  *
9995  * Returns: a newly allocated string or %NULL if the specified URI cannot be found.
9996  * Since: 2.12
9997  */
9998
9999
10000 /**
10001  * g_bookmark_file_get_uris:
10002  * @bookmark: a #GBookmarkFile
10003  * @length: (allow-none): return location for the number of returned URIs, or %NULL
10004  *
10005  * Returns all URIs of the bookmarks in the bookmark file @bookmark.
10006  * The array of returned URIs will be %NULL-terminated, so @length may
10007  * optionally be %NULL.
10008  *
10009  * Returns: a newly allocated %NULL-terminated array of strings. Use g_strfreev() to free it.
10010  * Since: 2.12
10011  */
10012
10013
10014 /**
10015  * g_bookmark_file_get_visited:
10016  * @bookmark: a #GBookmarkFile
10017  * @uri: a valid URI
10018  * @error: return location for a #GError, or %NULL
10019  *
10020  * Gets the time the bookmark for @uri was last visited.
10021  *
10022  * In the event the URI cannot be found, -1 is returned and
10023  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
10024  *
10025  * Returns: a timestamp.
10026  * Since: 2.12
10027  */
10028
10029
10030 /**
10031  * g_bookmark_file_has_application:
10032  * @bookmark: a #GBookmarkFile
10033  * @uri: a valid URI
10034  * @name: the name of the application
10035  * @error: return location for a #GError or %NULL
10036  *
10037  * Checks whether the bookmark for @uri inside @bookmark has been
10038  * registered by application @name.
10039  *
10040  * In the event the URI cannot be found, %FALSE is returned and
10041  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
10042  *
10043  * Returns: %TRUE if the application @name was found
10044  * Since: 2.12
10045  */
10046
10047
10048 /**
10049  * g_bookmark_file_has_group:
10050  * @bookmark: a #GBookmarkFile
10051  * @uri: a valid URI
10052  * @group: the group name to be searched
10053  * @error: return location for a #GError, or %NULL
10054  *
10055  * Checks whether @group appears in the list of groups to which
10056  * the bookmark for @uri belongs to.
10057  *
10058  * In the event the URI cannot be found, %FALSE is returned and
10059  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
10060  *
10061  * Returns: %TRUE if @group was found.
10062  * Since: 2.12
10063  */
10064
10065
10066 /**
10067  * g_bookmark_file_has_item:
10068  * @bookmark: a #GBookmarkFile
10069  * @uri: a valid URI
10070  *
10071  * Looks whether the desktop bookmark has an item with its URI set to @uri.
10072  *
10073  * Returns: %TRUE if @uri is inside @bookmark, %FALSE otherwise
10074  * Since: 2.12
10075  */
10076
10077
10078 /**
10079  * g_bookmark_file_load_from_data:
10080  * @bookmark: an empty #GBookmarkFile struct
10081  * @data: desktop bookmarks loaded in memory
10082  * @length: the length of @data in bytes
10083  * @error: return location for a #GError, or %NULL
10084  *
10085  * Loads a bookmark file from memory into an empty #GBookmarkFile
10086  * structure.  If the object cannot be created then @error is set to a
10087  * #GBookmarkFileError.
10088  *
10089  * Returns: %TRUE if a desktop bookmark could be loaded.
10090  * Since: 2.12
10091  */
10092
10093
10094 /**
10095  * g_bookmark_file_load_from_data_dirs:
10096  * @bookmark: a #GBookmarkFile
10097  * @file: a relative path to a filename to open and parse
10098  * @full_path: (allow-none): return location for a string containing the full path of the file, or %NULL
10099  * @error: return location for a #GError, or %NULL
10100  *
10101  * This function looks for a desktop bookmark file named @file in the
10102  * paths returned from g_get_user_data_dir() and g_get_system_data_dirs(),
10103  * loads the file into @bookmark and returns the file's full path in
10104  * @full_path.  If the file could not be loaded then an %error is
10105  * set to either a #GFileError or #GBookmarkFileError.
10106  *
10107  * Returns: %TRUE if a key file could be loaded, %FALSE otherwise
10108  * Since: 2.12
10109  */
10110
10111
10112 /**
10113  * g_bookmark_file_load_from_file:
10114  * @bookmark: an empty #GBookmarkFile struct
10115  * @filename: the path of a filename to load, in the GLib file name encoding
10116  * @error: return location for a #GError, or %NULL
10117  *
10118  * Loads a desktop bookmark file into an empty #GBookmarkFile structure.
10119  * If the file could not be loaded then @error is set to either a #GFileError
10120  * or #GBookmarkFileError.
10121  *
10122  * Returns: %TRUE if a desktop bookmark file could be loaded
10123  * Since: 2.12
10124  */
10125
10126
10127 /**
10128  * g_bookmark_file_move_item:
10129  * @bookmark: a #GBookmarkFile
10130  * @old_uri: a valid URI
10131  * @new_uri: (allow-none): a valid URI, or %NULL
10132  * @error: return location for a #GError or %NULL
10133  *
10134  * Changes the URI of a bookmark item from @old_uri to @new_uri.  Any
10135  * existing bookmark for @new_uri will be overwritten.  If @new_uri is
10136  * %NULL, then the bookmark is removed.
10137  *
10138  * In the event the URI cannot be found, %FALSE is returned and
10139  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
10140  *
10141  * Returns: %TRUE if the URI was successfully changed
10142  * Since: 2.12
10143  */
10144
10145
10146 /**
10147  * g_bookmark_file_new:
10148  *
10149  * Creates a new empty #GBookmarkFile object.
10150  *
10151  * Use g_bookmark_file_load_from_file(), g_bookmark_file_load_from_data()
10152  * or g_bookmark_file_load_from_data_dirs() to read an existing bookmark
10153  * file.
10154  *
10155  * Returns: an empty #GBookmarkFile
10156  * Since: 2.12
10157  */
10158
10159
10160 /**
10161  * g_bookmark_file_remove_application:
10162  * @bookmark: a #GBookmarkFile
10163  * @uri: a valid URI
10164  * @name: the name of the application
10165  * @error: return location for a #GError or %NULL
10166  *
10167  * Removes application registered with @name from the list of applications
10168  * that have registered a bookmark for @uri inside @bookmark.
10169  *
10170  * In the event the URI cannot be found, %FALSE is returned and
10171  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
10172  * In the event that no application with name @app_name has registered
10173  * a bookmark for @uri,  %FALSE is returned and error is set to
10174  * #G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED.
10175  *
10176  * Returns: %TRUE if the application was successfully removed.
10177  * Since: 2.12
10178  */
10179
10180
10181 /**
10182  * g_bookmark_file_remove_group:
10183  * @bookmark: a #GBookmarkFile
10184  * @uri: a valid URI
10185  * @group: the group name to be removed
10186  * @error: return location for a #GError, or %NULL
10187  *
10188  * Removes @group from the list of groups to which the bookmark
10189  * for @uri belongs to.
10190  *
10191  * In the event the URI cannot be found, %FALSE is returned and
10192  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
10193  * In the event no group was defined, %FALSE is returned and
10194  * @error is set to #G_BOOKMARK_FILE_ERROR_INVALID_VALUE.
10195  *
10196  * Returns: %TRUE if @group was successfully removed.
10197  * Since: 2.12
10198  */
10199
10200
10201 /**
10202  * g_bookmark_file_remove_item:
10203  * @bookmark: a #GBookmarkFile
10204  * @uri: a valid URI
10205  * @error: return location for a #GError, or %NULL
10206  *
10207  * Removes the bookmark for @uri from the bookmark file @bookmark.
10208  *
10209  * Returns: %TRUE if the bookmark was removed successfully.
10210  * Since: 2.12
10211  */
10212
10213
10214 /**
10215  * g_bookmark_file_set_added:
10216  * @bookmark: a #GBookmarkFile
10217  * @uri: a valid URI
10218  * @added: a timestamp or -1 to use the current time
10219  *
10220  * Sets the time the bookmark for @uri was added into @bookmark.
10221  *
10222  * If no bookmark for @uri is found then it is created.
10223  *
10224  * Since: 2.12
10225  */
10226
10227
10228 /**
10229  * g_bookmark_file_set_app_info:
10230  * @bookmark: a #GBookmarkFile
10231  * @uri: a valid URI
10232  * @name: an application's name
10233  * @exec: an application's command line
10234  * @count: the number of registrations done for this application
10235  * @stamp: the time of the last registration for this application
10236  * @error: return location for a #GError or %NULL
10237  *
10238  * Sets the meta-data of application @name inside the list of
10239  * applications that have registered a bookmark for @uri inside
10240  * @bookmark.
10241  *
10242  * You should rarely use this function; use g_bookmark_file_add_application()
10243  * and g_bookmark_file_remove_application() instead.
10244  *
10245  * @name can be any UTF-8 encoded string used to identify an
10246  * application.
10247  * @exec can have one of these two modifiers: "\%f", which will
10248  * be expanded as the local file name retrieved from the bookmark's
10249  * URI; "\%u", which will be expanded as the bookmark's URI.
10250  * The expansion is done automatically when retrieving the stored
10251  * command line using the g_bookmark_file_get_app_info() function.
10252  * @count is the number of times the application has registered the
10253  * bookmark; if is < 0, the current registration count will be increased
10254  * by one, if is 0, the application with @name will be removed from
10255  * the list of registered applications.
10256  * @stamp is the Unix time of the last registration; if it is -1, the
10257  * current time will be used.
10258  *
10259  * If you try to remove an application by setting its registration count to
10260  * zero, and no bookmark for @uri is found, %FALSE is returned and
10261  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND; similarly,
10262  * in the event that no application @name has registered a bookmark
10263  * for @uri,  %FALSE is returned and error is set to
10264  * #G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED.  Otherwise, if no bookmark
10265  * for @uri is found, one is created.
10266  *
10267  * Returns: %TRUE if the application's meta-data was successfully changed.
10268  * Since: 2.12
10269  */
10270
10271
10272 /**
10273  * g_bookmark_file_set_description:
10274  * @bookmark: a #GBookmarkFile
10275  * @uri: (allow-none): a valid URI or %NULL
10276  * @description: a string
10277  *
10278  * Sets @description as the description of the bookmark for @uri.
10279  *
10280  * If @uri is %NULL, the description of @bookmark is set.
10281  *
10282  * If a bookmark for @uri cannot be found then it is created.
10283  *
10284  * Since: 2.12
10285  */
10286
10287
10288 /**
10289  * g_bookmark_file_set_groups:
10290  * @bookmark: a #GBookmarkFile
10291  * @uri: an item's URI
10292  * @groups: (allow-none): an array of group names, or %NULL to remove all groups
10293  * @length: number of group name values in @groups
10294  *
10295  * Sets a list of group names for the item with URI @uri.  Each previously
10296  * set group name list is removed.
10297  *
10298  * If @uri cannot be found then an item for it is created.
10299  *
10300  * Since: 2.12
10301  */
10302
10303
10304 /**
10305  * g_bookmark_file_set_icon:
10306  * @bookmark: a #GBookmarkFile
10307  * @uri: a valid URI
10308  * @href: (allow-none): the URI of the icon for the bookmark, or %NULL
10309  * @mime_type: the MIME type of the icon for the bookmark
10310  *
10311  * Sets the icon for the bookmark for @uri. If @href is %NULL, unsets
10312  * the currently set icon. @href can either be a full URL for the icon
10313  * file or the icon name following the Icon Naming specification.
10314  *
10315  * If no bookmark for @uri is found one is created.
10316  *
10317  * Since: 2.12
10318  */
10319
10320
10321 /**
10322  * g_bookmark_file_set_is_private:
10323  * @bookmark: a #GBookmarkFile
10324  * @uri: a valid URI
10325  * @is_private: %TRUE if the bookmark should be marked as private
10326  *
10327  * Sets the private flag of the bookmark for @uri.
10328  *
10329  * If a bookmark for @uri cannot be found then it is created.
10330  *
10331  * Since: 2.12
10332  */
10333
10334
10335 /**
10336  * g_bookmark_file_set_mime_type:
10337  * @bookmark: a #GBookmarkFile
10338  * @uri: a valid URI
10339  * @mime_type: a MIME type
10340  *
10341  * Sets @mime_type as the MIME type of the bookmark for @uri.
10342  *
10343  * If a bookmark for @uri cannot be found then it is created.
10344  *
10345  * Since: 2.12
10346  */
10347
10348
10349 /**
10350  * g_bookmark_file_set_modified:
10351  * @bookmark: a #GBookmarkFile
10352  * @uri: a valid URI
10353  * @modified: a timestamp or -1 to use the current time
10354  *
10355  * Sets the last time the bookmark for @uri was last modified.
10356  *
10357  * If no bookmark for @uri is found then it is created.
10358  *
10359  * The "modified" time should only be set when the bookmark's meta-data
10360  * was actually changed.  Every function of #GBookmarkFile that
10361  * modifies a bookmark also changes the modification time, except for
10362  * g_bookmark_file_set_visited().
10363  *
10364  * Since: 2.12
10365  */
10366
10367
10368 /**
10369  * g_bookmark_file_set_title:
10370  * @bookmark: a #GBookmarkFile
10371  * @uri: (allow-none): a valid URI or %NULL
10372  * @title: a UTF-8 encoded string
10373  *
10374  * Sets @title as the title of the bookmark for @uri inside the
10375  * bookmark file @bookmark.
10376  *
10377  * If @uri is %NULL, the title of @bookmark is set.
10378  *
10379  * If a bookmark for @uri cannot be found then it is created.
10380  *
10381  * Since: 2.12
10382  */
10383
10384
10385 /**
10386  * g_bookmark_file_set_visited:
10387  * @bookmark: a #GBookmarkFile
10388  * @uri: a valid URI
10389  * @visited: a timestamp or -1 to use the current time
10390  *
10391  * Sets the time the bookmark for @uri was last visited.
10392  *
10393  * If no bookmark for @uri is found then it is created.
10394  *
10395  * The "visited" time should only be set if the bookmark was launched,
10396  * either using the command line retrieved by g_bookmark_file_get_app_info()
10397  * or by the default application for the bookmark's MIME type, retrieved
10398  * using g_bookmark_file_get_mime_type().  Changing the "visited" time
10399  * does not affect the "modified" time.
10400  *
10401  * Since: 2.12
10402  */
10403
10404
10405 /**
10406  * g_bookmark_file_to_data:
10407  * @bookmark: a #GBookmarkFile
10408  * @length: (allow-none): return location for the length of the returned string, or %NULL
10409  * @error: return location for a #GError, or %NULL
10410  *
10411  * This function outputs @bookmark as a string.
10412  *
10413  * Returns: a newly allocated string holding the contents of the #GBookmarkFile
10414  * Since: 2.12
10415  */
10416
10417
10418 /**
10419  * g_bookmark_file_to_file:
10420  * @bookmark: a #GBookmarkFile
10421  * @filename: path of the output file
10422  * @error: return location for a #GError, or %NULL
10423  *
10424  * This function outputs @bookmark into a file.  The write process is
10425  * guaranteed to be atomic by using g_file_set_contents() internally.
10426  *
10427  * Returns: %TRUE if the file was successfully written.
10428  * Since: 2.12
10429  */
10430
10431
10432 /**
10433  * g_build_filename:
10434  * @first_element: the first element in the path
10435  * @...: remaining elements in path, terminated by %NULL
10436  *
10437  * Creates a filename from a series of elements using the correct
10438  * separator for filenames.
10439  *
10440  * On Unix, this function behaves identically to <literal>g_build_path
10441  * (G_DIR_SEPARATOR_S, first_element, ....)</literal>.
10442  *
10443  * On Windows, it takes into account that either the backslash
10444  * (<literal>\</literal> or slash (<literal>/</literal>) can be used
10445  * as separator in filenames, but otherwise behaves as on Unix. When
10446  * file pathname separators need to be inserted, the one that last
10447  * previously occurred in the parameters (reading from left to right)
10448  * is used.
10449  *
10450  * No attempt is made to force the resulting filename to be an absolute
10451  * path. If the first element is a relative path, the result will
10452  * be a relative path.
10453  *
10454  * Returns: a newly-allocated string that must be freed with g_free().
10455  */
10456
10457
10458 /**
10459  * g_build_filenamev:
10460  * @args: (array zero-terminated=1): %NULL-terminated array of strings containing the path elements.
10461  *
10462  * Behaves exactly like g_build_filename(), but takes the path elements
10463  * as a string array, instead of varargs. This function is mainly
10464  * meant for language bindings.
10465  *
10466  * Returns: a newly-allocated string that must be freed with g_free().
10467  * Since: 2.8
10468  */
10469
10470
10471 /**
10472  * g_build_path:
10473  * @separator: a string used to separator the elements of the path.
10474  * @first_element: the first element in the path
10475  * @...: remaining elements in path, terminated by %NULL
10476  *
10477  * Creates a path from a series of elements using @separator as the
10478  * separator between elements. At the boundary between two elements,
10479  * any trailing occurrences of separator in the first element, or
10480  * leading occurrences of separator in the second element are removed
10481  * and exactly one copy of the separator is inserted.
10482  *
10483  * Empty elements are ignored.
10484  *
10485  * The number of leading copies of the separator on the result is
10486  * the same as the number of leading copies of the separator on
10487  * the first non-empty element.
10488  *
10489  * The number of trailing copies of the separator on the result is
10490  * the same as the number of trailing copies of the separator on
10491  * the last non-empty element. (Determination of the number of
10492  * trailing copies is done without stripping leading copies, so
10493  * if the separator is <literal>ABA</literal>, <literal>ABABA</literal>
10494  * has 1 trailing copy.)
10495  *
10496  * However, if there is only a single non-empty element, and there
10497  * are no characters in that element not part of the leading or
10498  * trailing separators, then the result is exactly the original value
10499  * of that element.
10500  *
10501  * Other than for determination of the number of leading and trailing
10502  * copies of the separator, elements consisting only of copies
10503  * of the separator are ignored.
10504  *
10505  * Returns: a newly-allocated string that must be freed with g_free().
10506  */
10507
10508
10509 /**
10510  * g_build_pathv:
10511  * @separator: a string used to separator the elements of the path.
10512  * @args: (array zero-terminated=1): %NULL-terminated array of strings containing the path elements.
10513  *
10514  * Behaves exactly like g_build_path(), but takes the path elements
10515  * as a string array, instead of varargs. This function is mainly
10516  * meant for language bindings.
10517  *
10518  * Returns: a newly-allocated string that must be freed with g_free().
10519  * Since: 2.8
10520  */
10521
10522
10523 /**
10524  * g_byte_array_append:
10525  * @array: a #GByteArray.
10526  * @data: the byte data to be added.
10527  * @len: the number of bytes to add.
10528  *
10529  * Adds the given bytes to the end of the #GByteArray. The array will
10530  * grow in size automatically if necessary.
10531  *
10532  * Returns: the #GByteArray.
10533  */
10534
10535
10536 /**
10537  * g_byte_array_free:
10538  * @array: a #GByteArray.
10539  * @free_segment: if %TRUE the actual byte data is freed as well.
10540  *
10541  * Frees the memory allocated by the #GByteArray. If @free_segment is
10542  * %TRUE it frees the actual byte data. If the reference count of
10543  * @array is greater than one, the #GByteArray wrapper is preserved but
10544  * the size of @array will be set to zero.
10545  *
10546  * Returns: the element data if @free_segment is %FALSE, otherwise %NULL.  The element data should be freed using g_free().
10547  */
10548
10549
10550 /**
10551  * g_byte_array_free_to_bytes:
10552  * @array: (transfer full): a #GByteArray
10553  *
10554  * Transfers the data from the #GByteArray into a new immutable #GBytes.
10555  *
10556  * The #GByteArray is freed unless the reference count of @array is greater
10557  * than one, the #GByteArray wrapper is preserved but the size of @array
10558  * will be set to zero.
10559  *
10560  * This is identical to using g_bytes_new_take() and g_byte_array_free()
10561  * together.
10562  *
10563  * Since: 2.32
10564  * Returns: (transfer full): a new immutable #GBytes representing same byte data that was in the array
10565  */
10566
10567
10568 /**
10569  * g_byte_array_new:
10570  *
10571  * Creates a new #GByteArray with a reference count of 1.
10572  *
10573  * Returns: (transfer full): the new #GByteArray.
10574  */
10575
10576
10577 /**
10578  * g_byte_array_new_take:
10579  * @data: (transfer full) (array length=len): byte data for the array
10580  * @len: length of @data
10581  *
10582  * Create byte array containing the data. The data will be owned by the array
10583  * and will be freed with g_free(), i.e. it could be allocated using g_strdup().
10584  *
10585  * Since: 2.32
10586  * Returns: (transfer full): a new #GByteArray
10587  */
10588
10589
10590 /**
10591  * g_byte_array_prepend:
10592  * @array: a #GByteArray.
10593  * @data: the byte data to be added.
10594  * @len: the number of bytes to add.
10595  *
10596  * Adds the given data to the start of the #GByteArray. The array will
10597  * grow in size automatically if necessary.
10598  *
10599  * Returns: the #GByteArray.
10600  */
10601
10602
10603 /**
10604  * g_byte_array_ref:
10605  * @array: A #GByteArray.
10606  *
10607  * Atomically increments the reference count of @array by one. This
10608  * function is MT-safe and may be called from any thread.
10609  *
10610  * Returns: The passed in #GByteArray.
10611  * Since: 2.22
10612  */
10613
10614
10615 /**
10616  * g_byte_array_remove_index:
10617  * @array: a #GByteArray.
10618  * @index_: the index of the byte to remove.
10619  *
10620  * Removes the byte at the given index from a #GByteArray. The
10621  * following bytes are moved down one place.
10622  *
10623  * Returns: the #GByteArray.
10624  */
10625
10626
10627 /**
10628  * g_byte_array_remove_index_fast:
10629  * @array: a #GByteArray.
10630  * @index_: the index of the byte to remove.
10631  *
10632  * Removes the byte at the given index from a #GByteArray. The last
10633  * element in the array is used to fill in the space, so this function
10634  * does not preserve the order of the #GByteArray. But it is faster
10635  * than g_byte_array_remove_index().
10636  *
10637  * Returns: the #GByteArray.
10638  */
10639
10640
10641 /**
10642  * g_byte_array_remove_range:
10643  * @array: a @GByteArray.
10644  * @index_: the index of the first byte to remove.
10645  * @length: the number of bytes to remove.
10646  *
10647  * Removes the given number of bytes starting at the given index from a
10648  * #GByteArray.  The following elements are moved to close the gap.
10649  *
10650  * Returns: the #GByteArray.
10651  * Since: 2.4
10652  */
10653
10654
10655 /**
10656  * g_byte_array_set_size:
10657  * @array: a #GByteArray.
10658  * @length: the new size of the #GByteArray.
10659  *
10660  * Sets the size of the #GByteArray, expanding it if necessary.
10661  *
10662  * Returns: the #GByteArray.
10663  */
10664
10665
10666 /**
10667  * g_byte_array_sized_new:
10668  * @reserved_size: number of bytes preallocated.
10669  *
10670  * Creates a new #GByteArray with @reserved_size bytes preallocated.
10671  * This avoids frequent reallocation, if you are going to add many
10672  * bytes to the array. Note however that the size of the array is still
10673  * 0.
10674  *
10675  * Returns: the new #GByteArray.
10676  */
10677
10678
10679 /**
10680  * g_byte_array_sort:
10681  * @array: a #GByteArray.
10682  * @compare_func: comparison function.
10683  *
10684  * Sorts a byte array, using @compare_func which should be a
10685  * qsort()-style comparison function (returns less than zero for first
10686  * arg is less than second arg, zero for equal, greater than zero if
10687  * first arg is greater than second arg).
10688  *
10689  * If two array elements compare equal, their order in the sorted array
10690  * is undefined. If you want equal elements to keep their order (i.e.
10691  * you want a stable sort) you can write a comparison function that,
10692  * if two elements would otherwise compare equal, compares them by
10693  * their addresses.
10694  */
10695
10696
10697 /**
10698  * g_byte_array_sort_with_data:
10699  * @array: a #GByteArray.
10700  * @compare_func: comparison function.
10701  * @user_data: data to pass to @compare_func.
10702  *
10703  * Like g_byte_array_sort(), but the comparison function takes an extra
10704  * user data argument.
10705  */
10706
10707
10708 /**
10709  * g_byte_array_unref:
10710  * @array: A #GByteArray.
10711  *
10712  * Atomically decrements the reference count of @array by one. If the
10713  * reference count drops to 0, all memory allocated by the array is
10714  * released. This function is MT-safe and may be called from any
10715  * thread.
10716  *
10717  * Since: 2.22
10718  */
10719
10720
10721 /**
10722  * g_bytes_compare:
10723  * @bytes1: (type GLib.Bytes): a pointer to a #GBytes
10724  * @bytes2: (type GLib.Bytes): a pointer to a #GBytes to compare with @bytes1
10725  *
10726  * Compares the two #GBytes values.
10727  *
10728  * This function can be used to sort GBytes instances in lexographical order.
10729  *
10730  * Returns: a negative value if bytes2 is lesser, a positive value if bytes2 is greater, and zero if bytes2 is equal to bytes1
10731  * Since: 2.32
10732  */
10733
10734
10735 /**
10736  * g_bytes_equal:
10737  * @bytes1: (type GLib.Bytes): a pointer to a #GBytes
10738  * @bytes2: (type GLib.Bytes): a pointer to a #GBytes to compare with @bytes1
10739  *
10740  * Compares the two #GBytes values being pointed to and returns
10741  * %TRUE if they are equal.
10742  *
10743  * This function can be passed to g_hash_table_new() as the @key_equal_func
10744  * parameter, when using non-%NULL #GBytes pointers as keys in a #GHashTable.
10745  *
10746  * Returns: %TRUE if the two keys match.
10747  * Since: 2.32
10748  */
10749
10750
10751 /**
10752  * g_bytes_get_data:
10753  * @bytes: a #GBytes
10754  * @size: (out) (allow-none): location to return size of byte data
10755  *
10756  * Get the byte data in the #GBytes. This data should not be modified.
10757  *
10758  * This function will always return the same pointer for a given #GBytes.
10759  *
10760  * Returns: (transfer none) (array length=size) (type guint8): a pointer to the byte data
10761  * Since: 2.32
10762  */
10763
10764
10765 /**
10766  * g_bytes_get_size:
10767  * @bytes: a #GBytes
10768  *
10769  * Get the size of the byte data in the #GBytes.
10770  *
10771  * This function will always return the same value for a given #GBytes.
10772  *
10773  * Returns: the size
10774  * Since: 2.32
10775  */
10776
10777
10778 /**
10779  * g_bytes_hash:
10780  * @bytes: (type GLib.Bytes): a pointer to a #GBytes key
10781  *
10782  * Creates an integer hash code for the byte data in the #GBytes.
10783  *
10784  * This function can be passed to g_hash_table_new() as the @key_equal_func
10785  * parameter, when using non-%NULL #GBytes pointers as keys in a #GHashTable.
10786  *
10787  * Returns: a hash value corresponding to the key.
10788  * Since: 2.32
10789  */
10790
10791
10792 /**
10793  * g_bytes_new:
10794  * @data: (transfer none) (array length=size) (element-type guint8): the data to be used for the bytes
10795  * @size: the size of @data
10796  *
10797  * Creates a new #GBytes from @data.
10798  *
10799  * @data is copied.
10800  *
10801  * Returns: (transfer full): a new #GBytes
10802  * Since: 2.32
10803  */
10804
10805
10806 /**
10807  * g_bytes_new_from_bytes:
10808  * @bytes: a #GBytes
10809  * @offset: offset which subsection starts at
10810  * @length: length of subsection
10811  *
10812  * Creates a #GBytes which is a subsection of another #GBytes. The @offset +
10813  * @length may not be longer than the size of @bytes.
10814  *
10815  * A reference to @bytes will be held by the newly created #GBytes until
10816  * the byte data is no longer needed.
10817  *
10818  * Returns: (transfer full): a new #GBytes
10819  * Since: 2.32
10820  */
10821
10822
10823 /**
10824  * g_bytes_new_static: (skip)
10825  * @data: (transfer full) (array length=size) (element-type guint8): the data to be used for the bytes
10826  * @size: the size of @data
10827  *
10828  * Creates a new #GBytes from static data.
10829  *
10830  * @data must be static (ie: never modified or freed).
10831  *
10832  * Returns: (transfer full): a new #GBytes
10833  * Since: 2.32
10834  */
10835
10836
10837 /**
10838  * g_bytes_new_take:
10839  * @data: (transfer full) (array length=size) (element-type guint8): the data to be used for the bytes
10840  * @size: the size of @data
10841  *
10842  * Creates a new #GBytes from @data.
10843  *
10844  * After this call, @data belongs to the bytes and may no longer be
10845  * modified by the caller.  g_free() will be called on @data when the
10846  * bytes is no longer in use. Because of this @data must have been created by
10847  * a call to g_malloc(), g_malloc0() or g_realloc() or by one of the many
10848  * functions that wrap these calls (such as g_new(), g_strdup(), etc).
10849  *
10850  * For creating #GBytes with memory from other allocators, see
10851  * g_bytes_new_with_free_func().
10852  *
10853  * Returns: (transfer full): a new #GBytes
10854  * Since: 2.32
10855  */
10856
10857
10858 /**
10859  * g_bytes_new_with_free_func:
10860  * @data: (array length=size): the data to be used for the bytes
10861  * @size: the size of @data
10862  * @free_func: the function to call to release the data
10863  * @user_data: data to pass to @free_func
10864  *
10865  * Creates a #GBytes from @data.
10866  *
10867  * When the last reference is dropped, @free_func will be called with the
10868  * @user_data argument.
10869  *
10870  * @data must not be modified after this call is made until @free_func has
10871  * been called to indicate that the bytes is no longer in use.
10872  *
10873  * Returns: (transfer full): a new #GBytes
10874  * Since: 2.32
10875  */
10876
10877
10878 /**
10879  * g_bytes_ref:
10880  * @bytes: a #GBytes
10881  *
10882  * Increase the reference count on @bytes.
10883  *
10884  * Returns: the #GBytes
10885  * Since: 2.32
10886  */
10887
10888
10889 /**
10890  * g_bytes_unref:
10891  * @bytes: (allow-none): a #GBytes
10892  *
10893  * Releases a reference on @bytes.  This may result in the bytes being
10894  * freed.
10895  *
10896  * Since: 2.32
10897  */
10898
10899
10900 /**
10901  * g_bytes_unref_to_array:
10902  * @bytes: (transfer full): a #GBytes
10903  *
10904  * Unreferences the bytes, and returns a new mutable #GByteArray containing
10905  * the same byte data.
10906  *
10907  * As an optimization, the byte data is transferred to the array without copying
10908  * if this was the last reference to bytes and bytes was created with
10909  * g_bytes_new(), g_bytes_new_take() or g_byte_array_free_to_bytes(). In all
10910  * other cases the data is copied.
10911  *
10912  * Returns: (transfer full): a new mutable #GByteArray containing the same byte data
10913  * Since: 2.32
10914  */
10915
10916
10917 /**
10918  * g_bytes_unref_to_data:
10919  * @bytes: (transfer full): a #GBytes
10920  * @size: location to place the length of the returned data
10921  *
10922  * Unreferences the bytes, and returns a pointer the same byte data
10923  * contents.
10924  *
10925  * As an optimization, the byte data is returned without copying if this was
10926  * the last reference to bytes and bytes was created with g_bytes_new(),
10927  * g_bytes_new_take() or g_byte_array_free_to_bytes(). In all other cases the
10928  * data is copied.
10929  *
10930  * Returns: (transfer full): a pointer to the same byte data, which should be freed with g_free()
10931  * Since: 2.32
10932  */
10933
10934
10935 /**
10936  * g_chdir:
10937  * @path: a pathname in the GLib file name encoding (UTF-8 on Windows)
10938  *
10939  * A wrapper for the POSIX chdir() function. The function changes the
10940  * current directory of the process to @path.
10941  *
10942  * See your C library manual for more details about chdir().
10943  *
10944  * Returns: 0 on success, -1 if an error occurred.
10945  * Since: 2.8
10946  */
10947
10948
10949 /**
10950  * g_checksum_copy:
10951  * @checksum: the #GChecksum to copy
10952  *
10953  * Copies a #GChecksum. If @checksum has been closed, by calling
10954  * g_checksum_get_string() or g_checksum_get_digest(), the copied
10955  * checksum will be closed as well.
10956  *
10957  * Returns: the copy of the passed #GChecksum. Use g_checksum_free() when finished using it.
10958  * Since: 2.16
10959  */
10960
10961
10962 /**
10963  * g_checksum_free:
10964  * @checksum: a #GChecksum
10965  *
10966  * Frees the memory allocated for @checksum.
10967  *
10968  * Since: 2.16
10969  */
10970
10971
10972 /**
10973  * g_checksum_get_digest:
10974  * @checksum: a #GChecksum
10975  * @buffer: output buffer
10976  * @digest_len: an inout parameter. The caller initializes it to the size of @buffer. After the call it contains the length of the digest.
10977  *
10978  * Gets the digest from @checksum as a raw binary vector and places it
10979  * into @buffer. The size of the digest depends on the type of checksum.
10980  *
10981  * Once this function has been called, the #GChecksum is closed and can
10982  * no longer be updated with g_checksum_update().
10983  *
10984  * Since: 2.16
10985  */
10986
10987
10988 /**
10989  * g_checksum_get_string:
10990  * @checksum: a #GChecksum
10991  *
10992  * Gets the digest as an hexadecimal string.
10993  *
10994  * Once this function has been called the #GChecksum can no longer be
10995  * updated with g_checksum_update().
10996  *
10997  * The hexadecimal characters will be lower case.
10998  *
10999  * Returns: the hexadecimal representation of the checksum. The returned string is owned by the checksum and should not be modified or freed.
11000  * Since: 2.16
11001  */
11002
11003
11004 /**
11005  * g_checksum_new:
11006  * @checksum_type: the desired type of checksum
11007  *
11008  * Creates a new #GChecksum, using the checksum algorithm @checksum_type.
11009  * If the @checksum_type is not known, %NULL is returned.
11010  * A #GChecksum can be used to compute the checksum, or digest, of an
11011  * arbitrary binary blob, using different hashing algorithms.
11012  *
11013  * A #GChecksum works by feeding a binary blob through g_checksum_update()
11014  * until there is data to be checked; the digest can then be extracted
11015  * using g_checksum_get_string(), which will return the checksum as a
11016  * hexadecimal string; or g_checksum_get_digest(), which will return a
11017  * vector of raw bytes. Once either g_checksum_get_string() or
11018  * g_checksum_get_digest() have been called on a #GChecksum, the checksum
11019  * will be closed and it won't be possible to call g_checksum_update()
11020  * on it anymore.
11021  *
11022  * Returns: the newly created #GChecksum, or %NULL. Use g_checksum_free() to free the memory allocated by it.
11023  * Since: 2.16
11024  */
11025
11026
11027 /**
11028  * g_checksum_reset:
11029  * @checksum: the #GChecksum to reset
11030  *
11031  * Resets the state of the @checksum back to its initial state.
11032  *
11033  * Since: 2.18
11034  */
11035
11036
11037 /**
11038  * g_checksum_type_get_length:
11039  * @checksum_type: a #GChecksumType
11040  *
11041  * Gets the length in bytes of digests of type @checksum_type
11042  *
11043  * Returns: the checksum length, or -1 if @checksum_type is not supported.
11044  * Since: 2.16
11045  */
11046
11047
11048 /**
11049  * g_checksum_update:
11050  * @checksum: a #GChecksum
11051  * @data: buffer used to compute the checksum
11052  * @length: size of the buffer, or -1 if it is a null-terminated string.
11053  *
11054  * Feeds @data into an existing #GChecksum. The checksum must still be
11055  * open, that is g_checksum_get_string() or g_checksum_get_digest() must
11056  * not have been called on @checksum.
11057  *
11058  * Since: 2.16
11059  */
11060
11061
11062 /**
11063  * g_child_watch_add:
11064  * @pid: process id to watch. On POSIX the pid of a child process. On Windows a handle for a process (which doesn't have to be a child).
11065  * @function: function to call
11066  * @data: data to pass to @function
11067  *
11068  * Sets a function to be called when the child indicated by @pid
11069  * exits, at a default priority, #G_PRIORITY_DEFAULT.
11070  *
11071  * If you obtain @pid from g_spawn_async() or g_spawn_async_with_pipes()
11072  * you will need to pass #G_SPAWN_DO_NOT_REAP_CHILD as flag to
11073  * the spawn function for the child watching to work.
11074  *
11075  * Note that on platforms where #GPid must be explicitly closed
11076  * (see g_spawn_close_pid()) @pid must not be closed while the
11077  * source is still active. Typically, you will want to call
11078  * g_spawn_close_pid() in the callback function for the source.
11079  *
11080  * GLib supports only a single callback per process id.
11081  *
11082  * This internally creates a main loop source using
11083  * g_child_watch_source_new() and attaches it to the main loop context
11084  * using g_source_attach(). You can do these steps manually if you
11085  * need greater control.
11086  *
11087  * Returns: the ID (greater than 0) of the event source.
11088  * Since: 2.4
11089  */
11090
11091
11092 /**
11093  * g_child_watch_add_full:
11094  * @priority: the priority of the idle source. Typically this will be in the range between #G_PRIORITY_DEFAULT_IDLE and #G_PRIORITY_HIGH_IDLE.
11095  * @pid: process to watch. On POSIX the pid of a child process. On Windows a handle for a process (which doesn't have to be a child).
11096  * @function: function to call
11097  * @data: data to pass to @function
11098  * @notify: (allow-none): function to call when the idle is removed, or %NULL
11099  *
11100  * Sets a function to be called when the child indicated by @pid
11101  * exits, at the priority @priority.
11102  *
11103  * If you obtain @pid from g_spawn_async() or g_spawn_async_with_pipes()
11104  * you will need to pass #G_SPAWN_DO_NOT_REAP_CHILD as flag to
11105  * the spawn function for the child watching to work.
11106  *
11107  * In many programs, you will want to call g_spawn_check_exit_status()
11108  * in the callback to determine whether or not the child exited
11109  * successfully.
11110  *
11111  * Also, note that on platforms where #GPid must be explicitly closed
11112  * (see g_spawn_close_pid()) @pid must not be closed while the source
11113  * is still active.  Typically, you should invoke g_spawn_close_pid()
11114  * in the callback function for the source.
11115  *
11116  * GLib supports only a single callback per process id.
11117  *
11118  * This internally creates a main loop source using
11119  * g_child_watch_source_new() and attaches it to the main loop context
11120  * using g_source_attach(). You can do these steps manually if you
11121  * need greater control.
11122  *
11123  * Returns: the ID (greater than 0) of the event source.
11124  * Rename to: g_child_watch_add
11125  * Since: 2.4
11126  */
11127
11128
11129 /**
11130  * g_child_watch_source_new:
11131  * @pid: process to watch. On POSIX the pid of a child process. On Windows a handle for a process (which doesn't have to be a child).
11132  *
11133  * Creates a new child_watch source.
11134  *
11135  * The source will not initially be associated with any #GMainContext
11136  * and must be added to one with g_source_attach() before it will be
11137  * executed.
11138  *
11139  * Note that child watch sources can only be used in conjunction with
11140  * <literal>g_spawn...</literal> when the %G_SPAWN_DO_NOT_REAP_CHILD
11141  * flag is used.
11142  *
11143  * Note that on platforms where #GPid must be explicitly closed
11144  * (see g_spawn_close_pid()) @pid must not be closed while the
11145  * source is still active. Typically, you will want to call
11146  * g_spawn_close_pid() in the callback function for the source.
11147  *
11148  * Note further that using g_child_watch_source_new() is not
11149  * compatible with calling <literal>waitpid</literal> with a
11150  * nonpositive first argument in the application. Calling waitpid()
11151  * for individual pids will still work fine.
11152  *
11153  * Returns: the newly-created child watch source
11154  * Since: 2.4
11155  */
11156
11157
11158 /**
11159  * g_chmod:
11160  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
11161  * @mode: as in chmod()
11162  *
11163  * A wrapper for the POSIX chmod() function. The chmod() function is
11164  * used to set the permissions of a file system object.
11165  *
11166  * On Windows the file protection mechanism is not at all POSIX-like,
11167  * and the underlying chmod() function in the C library just sets or
11168  * clears the FAT-style READONLY attribute. It does not touch any
11169  * ACL. Software that needs to manage file permissions on Windows
11170  * exactly should use the Win32 API.
11171  *
11172  * See your C library manual for more details about chmod().
11173  *
11174  * Returns: zero if the operation succeeded, -1 on error.
11175  * Since: 2.8
11176  */
11177
11178
11179 /**
11180  * g_clear_error:
11181  * @err: a #GError return location
11182  *
11183  * If @err is %NULL, does nothing. If @err is non-%NULL,
11184  * calls g_error_free() on *@err and sets *@err to %NULL.
11185  */
11186
11187
11188 /**
11189  * g_clear_pointer: (skip)
11190  * @pp: a pointer to a variable, struct member etc. holding a pointer
11191  * @destroy: a function to which a gpointer can be passed, to destroy *@pp
11192  *
11193  * Clears a reference to a variable.
11194  *
11195  * @pp must not be %NULL.
11196  *
11197  * If the reference is %NULL then this function does nothing.
11198  * Otherwise, the variable is destroyed using @destroy and the
11199  * pointer is set to %NULL.
11200  *
11201  * This function is threadsafe and modifies the pointer atomically,
11202  * using memory barriers where needed.
11203  *
11204  * A macro is also included that allows this function to be used without
11205  * pointer casts.
11206  *
11207  * Since: 2.34
11208  */
11209
11210
11211 /**
11212  * g_compute_checksum_for_bytes:
11213  * @checksum_type: a #GChecksumType
11214  * @data: binary blob to compute the digest of
11215  *
11216  * Computes the checksum for a binary @data. This is a
11217  * convenience wrapper for g_checksum_new(), g_checksum_get_string()
11218  * and g_checksum_free().
11219  *
11220  * The hexadecimal string returned will be in lower case.
11221  *
11222  * Returns: the digest of the binary data as a string in hexadecimal. The returned string should be freed with g_free() when done using it.
11223  * Since: 2.34
11224  */
11225
11226
11227 /**
11228  * g_compute_checksum_for_data:
11229  * @checksum_type: a #GChecksumType
11230  * @data: binary blob to compute the digest of
11231  * @length: length of @data
11232  *
11233  * Computes the checksum for a binary @data of @length. This is a
11234  * convenience wrapper for g_checksum_new(), g_checksum_get_string()
11235  * and g_checksum_free().
11236  *
11237  * The hexadecimal string returned will be in lower case.
11238  *
11239  * Returns: the digest of the binary data as a string in hexadecimal. The returned string should be freed with g_free() when done using it.
11240  * Since: 2.16
11241  */
11242
11243
11244 /**
11245  * g_compute_checksum_for_string:
11246  * @checksum_type: a #GChecksumType
11247  * @str: the string to compute the checksum of
11248  * @length: the length of the string, or -1 if the string is null-terminated.
11249  *
11250  * Computes the checksum of a string.
11251  *
11252  * The hexadecimal string returned will be in lower case.
11253  *
11254  * Returns: the checksum as a hexadecimal string. The returned string should be freed with g_free() when done using it.
11255  * Since: 2.16
11256  */
11257
11258
11259 /**
11260  * g_compute_hmac_for_data:
11261  * @digest_type: a #GChecksumType to use for the HMAC
11262  * @key: (array length=key_len): the key to use in the HMAC
11263  * @key_len: the length of the key
11264  * @data: binary blob to compute the HMAC of
11265  * @length: length of @data
11266  *
11267  * Computes the HMAC for a binary @data of @length. This is a
11268  * convenience wrapper for g_hmac_new(), g_hmac_get_string()
11269  * and g_hmac_unref().
11270  *
11271  * The hexadecimal string returned will be in lower case.
11272  *
11273  * Returns: the HMAC of the binary data as a string in hexadecimal. The returned string should be freed with g_free() when done using it.
11274  * Since: 2.30
11275  */
11276
11277
11278 /**
11279  * g_compute_hmac_for_string:
11280  * @digest_type: a #GChecksumType to use for the HMAC
11281  * @key: (array length=key_len): the key to use in the HMAC
11282  * @key_len: the length of the key
11283  * @str: the string to compute the HMAC for
11284  * @length: the length of the string, or -1 if the string is nul-terminated
11285  *
11286  * Computes the HMAC for a string.
11287  *
11288  * The hexadecimal string returned will be in lower case.
11289  *
11290  * Returns: the HMAC as a hexadecimal string. The returned string should be freed with g_free() when done using it.
11291  * Since: 2.30
11292  */
11293
11294
11295 /**
11296  * g_cond_broadcast:
11297  * @cond: a #GCond
11298  *
11299  * If threads are waiting for @cond, all of them are unblocked.
11300  * If no threads are waiting for @cond, this function has no effect.
11301  * It is good practice to lock the same mutex as the waiting threads
11302  * while calling this function, though not required.
11303  */
11304
11305
11306 /**
11307  * g_cond_clear:
11308  * @cond: an initialised #GCond
11309  *
11310  * Frees the resources allocated to a #GCond with g_cond_init().
11311  *
11312  * This function should not be used with a #GCond that has been
11313  * statically allocated.
11314  *
11315  * Calling g_cond_clear() for a #GCond on which threads are
11316  * blocking leads to undefined behaviour.
11317  *
11318  * Since: 2.32
11319  */
11320
11321
11322 /**
11323  * g_cond_init:
11324  * @cond: an uninitialized #GCond
11325  *
11326  * Initialises a #GCond so that it can be used.
11327  *
11328  * This function is useful to initialise a #GCond that has been
11329  * allocated as part of a larger structure.  It is not necessary to
11330  * initialise a #GCond that has been statically allocated.
11331  *
11332  * To undo the effect of g_cond_init() when a #GCond is no longer
11333  * needed, use g_cond_clear().
11334  *
11335  * Calling g_cond_init() on an already-initialised #GCond leads
11336  * to undefined behaviour.
11337  *
11338  * Since: 2.32
11339  */
11340
11341
11342 /**
11343  * g_cond_signal:
11344  * @cond: a #GCond
11345  *
11346  * If threads are waiting for @cond, at least one of them is unblocked.
11347  * If no threads are waiting for @cond, this function has no effect.
11348  * It is good practice to hold the same lock as the waiting thread
11349  * while calling this function, though not required.
11350  */
11351
11352
11353 /**
11354  * g_cond_wait:
11355  * @cond: a #GCond
11356  * @mutex: a #GMutex that is currently locked
11357  *
11358  * Atomically releases @mutex and waits until @cond is signalled.
11359  *
11360  * When using condition variables, it is possible that a spurious wakeup
11361  * may occur (ie: g_cond_wait() returns even though g_cond_signal() was
11362  * not called).  It's also possible that a stolen wakeup may occur.
11363  * This is when g_cond_signal() is called, but another thread acquires
11364  * @mutex before this thread and modifies the state of the program in
11365  * such a way that when g_cond_wait() is able to return, the expected
11366  * condition is no longer met.
11367  *
11368  * For this reason, g_cond_wait() must always be used in a loop.  See
11369  * the documentation for #GCond for a complete example.
11370  */
11371
11372
11373 /**
11374  * g_cond_wait_until:
11375  * @cond: a #GCond
11376  * @mutex: a #GMutex that is currently locked
11377  * @end_time: the monotonic time to wait until
11378  *
11379  * Waits until either @cond is signalled or @end_time has passed.
11380  *
11381  * As with g_cond_wait() it is possible that a spurious or stolen wakeup
11382  * could occur.  For that reason, waiting on a condition variable should
11383  * always be in a loop, based on an explicitly-checked predicate.
11384  *
11385  * %TRUE is returned if the condition variable was signalled (or in the
11386  * case of a spurious wakeup).  %FALSE is returned if @end_time has
11387  * passed.
11388  *
11389  * The following code shows how to correctly perform a timed wait on a
11390  * condition variable (extended the example presented in the
11391  * documentation for #GCond):
11392  *
11393  * |[
11394  * gpointer
11395  * pop_data_timed (void)
11396  * {
11397  *   gint64 end_time;
11398  *   gpointer data;
11399  *
11400  *   g_mutex_lock (&data_mutex);
11401  *
11402  *   end_time = g_get_monotonic_time () + 5 * G_TIME_SPAN_SECOND;
11403  *   while (!current_data)
11404  *     if (!g_cond_wait_until (&data_cond, &data_mutex, end_time))
11405  *       {
11406  *         // timeout has passed.
11407  *         g_mutex_unlock (&data_mutex);
11408  *         return NULL;
11409  *       }
11410  *
11411  *   // there is data for us
11412  *   data = current_data;
11413  *   current_data = NULL;
11414  *
11415  *   g_mutex_unlock (&data_mutex);
11416  *
11417  *   return data;
11418  * }
11419  * ]|
11420  *
11421  * Notice that the end time is calculated once, before entering the
11422  * loop and reused.  This is the motivation behind the use of absolute
11423  * time on this API -- if a relative time of 5 seconds were passed
11424  * directly to the call and a spurious wakeup occurred, the program would
11425  * have to start over waiting again (which would lead to a total wait
11426  * time of more than 5 seconds).
11427  *
11428  * Returns: %TRUE on a signal, %FALSE on a timeout
11429  * Since: 2.32
11430  */
11431
11432
11433 /**
11434  * g_convert:
11435  * @str: the string to convert
11436  * @len: the length of the string, or -1 if the string is nul-terminated<footnote id="nul-unsafe"> <para> Note that some encodings may allow nul bytes to occur inside strings. In that case, using -1 for the @len parameter is unsafe. </para> </footnote>.
11437  * @to_codeset: name of character set into which to convert @str
11438  * @from_codeset: character set of @str.
11439  * @bytes_read: (out): location to store the number of bytes in the input string that were successfully converted, or %NULL. Even if the conversion was successful, this may be less than @len if there were partial characters at the end of the input. If the error #G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will the byte offset after the last valid input sequence.
11440  * @bytes_written: (out): the number of bytes stored in the output buffer (not including the terminating nul).
11441  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError may occur.
11442  *
11443  * Converts a string from one character set to another.
11444  *
11445  * Note that you should use g_iconv() for streaming
11446  * conversions<footnoteref linkend="streaming-state"/>.
11447  *
11448  * Returns: If the conversion was successful, a newly allocated nul-terminated string, which must be freed with g_free(). Otherwise %NULL and @error will be set.
11449  */
11450
11451
11452 /**
11453  * g_convert_with_fallback:
11454  * @str: the string to convert
11455  * @len: the length of the string, or -1 if the string is nul-terminated<footnoteref linkend="nul-unsafe"/>.
11456  * @to_codeset: name of character set into which to convert @str
11457  * @from_codeset: character set of @str.
11458  * @fallback: UTF-8 string to use in place of character not present in the target encoding. (The string must be representable in the target encoding). If %NULL, characters not in the target encoding will be represented as Unicode escapes \uxxxx or \Uxxxxyyyy.
11459  * @bytes_read: location to store the number of bytes in the input string that were successfully converted, or %NULL. Even if the conversion was successful, this may be less than @len if there were partial characters at the end of the input.
11460  * @bytes_written: the number of bytes stored in the output buffer (not including the terminating nul).
11461  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError may occur.
11462  *
11463  * Converts a string from one character set to another, possibly
11464  * including fallback sequences for characters not representable
11465  * in the output. Note that it is not guaranteed that the specification
11466  * for the fallback sequences in @fallback will be honored. Some
11467  * systems may do an approximate conversion from @from_codeset
11468  * to @to_codeset in their iconv() functions,
11469  * in which case GLib will simply return that approximate conversion.
11470  *
11471  * Note that you should use g_iconv() for streaming
11472  * conversions<footnoteref linkend="streaming-state"/>.
11473  *
11474  * Returns: If the conversion was successful, a newly allocated nul-terminated string, which must be freed with g_free(). Otherwise %NULL and @error will be set.
11475  */
11476
11477
11478 /**
11479  * g_convert_with_iconv:
11480  * @str: the string to convert
11481  * @len: the length of the string, or -1 if the string is nul-terminated<footnoteref linkend="nul-unsafe"/>.
11482  * @converter: conversion descriptor from g_iconv_open()
11483  * @bytes_read: location to store the number of bytes in the input string that were successfully converted, or %NULL. Even if the conversion was successful, this may be less than @len if there were partial characters at the end of the input. If the error #G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will the byte offset after the last valid input sequence.
11484  * @bytes_written: the number of bytes stored in the output buffer (not including the terminating nul).
11485  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError may occur.
11486  *
11487  * Converts a string from one character set to another.
11488  *
11489  * Note that you should use g_iconv() for streaming
11490  * conversions<footnote id="streaming-state">
11491  *  <para>
11492  * Despite the fact that @byes_read can return information about partial
11493  * characters, the <literal>g_convert_...</literal> functions
11494  * are not generally suitable for streaming. If the underlying converter
11495  * being used maintains internal state, then this won't be preserved
11496  * across successive calls to g_convert(), g_convert_with_iconv() or
11497  * g_convert_with_fallback(). (An example of this is the GNU C converter
11498  * for CP1255 which does not emit a base character until it knows that
11499  * the next character is not a mark that could combine with the base
11500  * character.)
11501  *  </para>
11502  * </footnote>.
11503  *
11504  * Returns: If the conversion was successful, a newly allocated nul-terminated string, which must be freed with g_free(). Otherwise %NULL and @error will be set.
11505  */
11506
11507
11508 /**
11509  * g_creat:
11510  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
11511  * @mode: as in creat()
11512  *
11513  * A wrapper for the POSIX creat() function. The creat() function is
11514  * used to convert a pathname into a file descriptor, creating a file
11515  * if necessary.
11516  *
11517  * On POSIX systems file descriptors are implemented by the operating
11518  * system. On Windows, it's the C library that implements creat() and
11519  * file descriptors. The actual Windows API for opening files is
11520  * different, see MSDN documentation for CreateFile(). The Win32 API
11521  * uses file handles, which are more randomish integers, not small
11522  * integers like file descriptors.
11523  *
11524  * Because file descriptors are specific to the C library on Windows,
11525  * the file descriptor returned by this function makes sense only to
11526  * functions in the same C library. Thus if the GLib-using code uses a
11527  * different C library than GLib does, the file descriptor returned by
11528  * this function cannot be passed to C library functions like write()
11529  * or read().
11530  *
11531  * See your C library manual for more details about creat().
11532  *
11533  * Returns: a new file descriptor, or -1 if an error occurred. The return value can be used exactly like the return value from creat().
11534  * Since: 2.8
11535  */
11536
11537
11538 /**
11539  * g_critical:
11540  * @...: format string, followed by parameters to insert into the format string (as with printf())
11541  *
11542  * Logs a "critical warning" (#G_LOG_LEVEL_CRITICAL).
11543  * It's more or less application-defined what constitutes
11544  * a critical vs. a regular warning. You could call
11545  * g_log_set_always_fatal() to make critical warnings exit
11546  * the program, then use g_critical() for fatal errors, for
11547  * example.
11548  *
11549  * You can also make critical warnings fatal at runtime by
11550  * setting the <envar>G_DEBUG</envar> environment variable (see
11551  * <ulink url="glib-running.html">Running GLib Applications</ulink>).
11552  */
11553
11554
11555 /**
11556  * g_datalist_clear:
11557  * @datalist: a datalist.
11558  *
11559  * Frees all the data elements of the datalist.
11560  * The data elements' destroy functions are called
11561  * if they have been set.
11562  */
11563
11564
11565 /**
11566  * g_datalist_foreach:
11567  * @datalist: a datalist.
11568  * @func: the function to call for each data element.
11569  * @user_data: user data to pass to the function.
11570  *
11571  * Calls the given function for each data element of the datalist. The
11572  * function is called with each data element's #GQuark id and data,
11573  * together with the given @user_data parameter. Note that this
11574  * function is NOT thread-safe. So unless @datalist can be protected
11575  * from any modifications during invocation of this function, it should
11576  * not be called.
11577  */
11578
11579
11580 /**
11581  * g_datalist_get_data:
11582  * @datalist: a datalist.
11583  * @key: the string identifying a data element.
11584  *
11585  * Gets a data element, using its string identifier. This is slower than
11586  * g_datalist_id_get_data() because it compares strings.
11587  *
11588  * Returns: the data element, or %NULL if it is not found.
11589  */
11590
11591
11592 /**
11593  * g_datalist_get_flags:
11594  * @datalist: pointer to the location that holds a list
11595  *
11596  * Gets flags values packed in together with the datalist.
11597  * See g_datalist_set_flags().
11598  *
11599  * Returns: the flags of the datalist
11600  * Since: 2.8
11601  */
11602
11603
11604 /**
11605  * g_datalist_id_dup_data:
11606  * @datalist: location of a datalist
11607  * @key_id: the #GQuark identifying a data element
11608  * @dup_func: (allow-none): function to duplicate the old value
11609  * @user_data: (allow-none): passed as user_data to @dup_func
11610  *
11611  * This is a variant of g_datalist_id_get_data() which
11612  * returns a 'duplicate' of the value. @dup_func defines the
11613  * meaning of 'duplicate' in this context, it could e.g.
11614  * take a reference on a ref-counted object.
11615  *
11616  * If the @key_id is not set in the datalist then @dup_func
11617  * will be called with a %NULL argument.
11618  *
11619  * Note that @dup_func is called while the datalist is locked, so it
11620  * is not allowed to read or modify the datalist.
11621  *
11622  * This function can be useful to avoid races when multiple
11623  * threads are using the same datalist and the same key.
11624  *
11625  * Returns: the result of calling @dup_func on the value associated with @key_id in @datalist, or %NULL if not set. If @dup_func is %NULL, the value is returned unmodified.
11626  * Since: 2.34
11627  */
11628
11629
11630 /**
11631  * g_datalist_id_get_data:
11632  * @datalist: a datalist.
11633  * @key_id: the #GQuark identifying a data element.
11634  *
11635  * Retrieves the data element corresponding to @key_id.
11636  *
11637  * Returns: the data element, or %NULL if it is not found.
11638  */
11639
11640
11641 /**
11642  * g_datalist_id_remove_data:
11643  * @dl: a datalist.
11644  * @q: the #GQuark identifying the data element.
11645  *
11646  * Removes an element, using its #GQuark identifier.
11647  */
11648
11649
11650 /**
11651  * g_datalist_id_remove_no_notify:
11652  * @datalist: a datalist.
11653  * @key_id: the #GQuark identifying a data element.
11654  *
11655  * Removes an element, without calling its destroy notification
11656  * function.
11657  *
11658  * Returns: the data previously stored at @key_id, or %NULL if none.
11659  */
11660
11661
11662 /**
11663  * g_datalist_id_replace_data:
11664  * @datalist: location of a datalist
11665  * @key_id: the #GQuark identifying a data element
11666  * @oldval: (allow-none): the old value to compare against
11667  * @newval: (allow-none): the new value to replace it with
11668  * @destroy: (allow-none): destroy notify for the new value
11669  * @old_destroy: (allow-none): destroy notify for the existing value
11670  *
11671  * Compares the member that is associated with @key_id in
11672  * @datalist to @oldval, and if they are the same, replace
11673  * @oldval with @newval.
11674  *
11675  * This is like a typical atomic compare-and-exchange
11676  * operation, for a member of @datalist.
11677  *
11678  * If the previous value was replaced then ownership of the
11679  * old value (@oldval) is passed to the caller, including
11680  * the registred destroy notify for it (passed out in @old_destroy).
11681  * Its up to the caller to free this as he wishes, which may
11682  * or may not include using @old_destroy as sometimes replacement
11683  * should not destroy the object in the normal way.
11684  *
11685  * Return: %TRUE if the existing value for @key_id was replaced
11686  *  by @newval, %FALSE otherwise.
11687  *
11688  * Since: 2.34
11689  */
11690
11691
11692 /**
11693  * g_datalist_id_set_data:
11694  * @dl: a datalist.
11695  * @q: the #GQuark to identify the data element.
11696  * @d: (allow-none): the data element, or %NULL to remove any previous element corresponding to @q.
11697  *
11698  * Sets the data corresponding to the given #GQuark id. Any previous
11699  * data with the same key is removed, and its destroy function is
11700  * called.
11701  */
11702
11703
11704 /**
11705  * g_datalist_id_set_data_full:
11706  * @datalist: a datalist.
11707  * @key_id: the #GQuark to identify the data element.
11708  * @data: (allow-none): the data element or %NULL to remove any previous element corresponding to @key_id.
11709  * @destroy_func: the function to call when the data element is removed. This function will be called with the data element and can be used to free any memory allocated for it. If @data is %NULL, then @destroy_func must also be %NULL.
11710  *
11711  * Sets the data corresponding to the given #GQuark id, and the
11712  * function to be called when the element is removed from the datalist.
11713  * Any previous data with the same key is removed, and its destroy
11714  * function is called.
11715  */
11716
11717
11718 /**
11719  * g_datalist_init:
11720  * @datalist: a pointer to a pointer to a datalist.
11721  *
11722  * Resets the datalist to %NULL. It does not free any memory or call
11723  * any destroy functions.
11724  */
11725
11726
11727 /**
11728  * g_datalist_remove_data:
11729  * @dl: a datalist.
11730  * @k: the string identifying the data element.
11731  *
11732  * Removes an element using its string identifier. The data element's
11733  * destroy function is called if it has been set.
11734  */
11735
11736
11737 /**
11738  * g_datalist_remove_no_notify:
11739  * @dl: a datalist.
11740  * @k: the string identifying the data element.
11741  *
11742  * Removes an element, without calling its destroy notifier.
11743  */
11744
11745
11746 /**
11747  * g_datalist_set_data:
11748  * @dl: a datalist.
11749  * @k: the string to identify the data element.
11750  * @d: (allow-none): the data element, or %NULL to remove any previous element corresponding to @k.
11751  *
11752  * Sets the data element corresponding to the given string identifier.
11753  */
11754
11755
11756 /**
11757  * g_datalist_set_data_full:
11758  * @dl: a datalist.
11759  * @k: the string to identify the data element.
11760  * @d: (allow-none): the data element, or %NULL to remove any previous element corresponding to @k.
11761  * @f: the function to call when the data element is removed. This function will be called with the data element and can be used to free any memory allocated for it. If @d is %NULL, then @f must also be %NULL.
11762  *
11763  * Sets the data element corresponding to the given string identifier,
11764  * and the function to be called when the data element is removed.
11765  */
11766
11767
11768 /**
11769  * g_datalist_set_flags:
11770  * @datalist: pointer to the location that holds a list
11771  * @flags: the flags to turn on. The values of the flags are restricted by %G_DATALIST_FLAGS_MASK (currently 3; giving two possible boolean flags). A value for @flags that doesn't fit within the mask is an error.
11772  *
11773  * Turns on flag values for a data list. This function is used
11774  * to keep a small number of boolean flags in an object with
11775  * a data list without using any additional space. It is
11776  * not generally useful except in circumstances where space
11777  * is very tight. (It is used in the base #GObject type, for
11778  * example.)
11779  *
11780  * Since: 2.8
11781  */
11782
11783
11784 /**
11785  * g_datalist_unset_flags:
11786  * @datalist: pointer to the location that holds a list
11787  * @flags: the flags to turn off. The values of the flags are restricted by %G_DATALIST_FLAGS_MASK (currently 3: giving two possible boolean flags). A value for @flags that doesn't fit within the mask is an error.
11788  *
11789  * Turns off flag values for a data list. See g_datalist_unset_flags()
11790  *
11791  * Since: 2.8
11792  */
11793
11794
11795 /**
11796  * g_dataset_destroy:
11797  * @dataset_location: the location identifying the dataset.
11798  *
11799  * Destroys the dataset, freeing all memory allocated, and calling any
11800  * destroy functions set for data elements.
11801  */
11802
11803
11804 /**
11805  * g_dataset_foreach:
11806  * @dataset_location: the location identifying the dataset.
11807  * @func: the function to call for each data element.
11808  * @user_data: user data to pass to the function.
11809  *
11810  * Calls the given function for each data element which is associated
11811  * with the given location. Note that this function is NOT thread-safe.
11812  * So unless @datalist can be protected from any modifications during
11813  * invocation of this function, it should not be called.
11814  */
11815
11816
11817 /**
11818  * g_dataset_get_data:
11819  * @l: the location identifying the dataset.
11820  * @k: the string identifying the data element.
11821  *
11822  * Gets the data element corresponding to a string.
11823  *
11824  * Returns: the data element corresponding to the string, or %NULL if it is not found.
11825  */
11826
11827
11828 /**
11829  * g_dataset_id_get_data:
11830  * @dataset_location: the location identifying the dataset.
11831  * @key_id: the #GQuark id to identify the data element.
11832  *
11833  * Gets the data element corresponding to a #GQuark.
11834  *
11835  * Returns: the data element corresponding to the #GQuark, or %NULL if it is not found.
11836  */
11837
11838
11839 /**
11840  * g_dataset_id_remove_data:
11841  * @l: the location identifying the dataset.
11842  * @k: the #GQuark id identifying the data element.
11843  *
11844  * Removes a data element from a dataset. The data element's destroy
11845  * function is called if it has been set.
11846  */
11847
11848
11849 /**
11850  * g_dataset_id_remove_no_notify:
11851  * @dataset_location: the location identifying the dataset.
11852  * @key_id: the #GQuark ID identifying the data element.
11853  *
11854  * Removes an element, without calling its destroy notification
11855  * function.
11856  *
11857  * Returns: the data previously stored at @key_id, or %NULL if none.
11858  */
11859
11860
11861 /**
11862  * g_dataset_id_set_data:
11863  * @l: the location identifying the dataset.
11864  * @k: the #GQuark id to identify the data element.
11865  * @d: the data element.
11866  *
11867  * Sets the data element associated with the given #GQuark id. Any
11868  * previous data with the same key is removed, and its destroy function
11869  * is called.
11870  */
11871
11872
11873 /**
11874  * g_dataset_id_set_data_full:
11875  * @dataset_location: the location identifying the dataset.
11876  * @key_id: the #GQuark id to identify the data element.
11877  * @data: the data element.
11878  * @destroy_func: the function to call when the data element is removed. This function will be called with the data element and can be used to free any memory allocated for it.
11879  *
11880  * Sets the data element associated with the given #GQuark id, and also
11881  * the function to call when the data element is destroyed. Any
11882  * previous data with the same key is removed, and its destroy function
11883  * is called.
11884  */
11885
11886
11887 /**
11888  * g_dataset_remove_data:
11889  * @l: the location identifying the dataset.
11890  * @k: the string identifying the data element.
11891  *
11892  * Removes a data element corresponding to a string. Its destroy
11893  * function is called if it has been set.
11894  */
11895
11896
11897 /**
11898  * g_dataset_remove_no_notify:
11899  * @l: the location identifying the dataset.
11900  * @k: the string identifying the data element.
11901  *
11902  * Removes an element, without calling its destroy notifier.
11903  */
11904
11905
11906 /**
11907  * g_dataset_set_data:
11908  * @l: the location identifying the dataset.
11909  * @k: the string to identify the data element.
11910  * @d: the data element.
11911  *
11912  * Sets the data corresponding to the given string identifier.
11913  */
11914
11915
11916 /**
11917  * g_dataset_set_data_full:
11918  * @l: the location identifying the dataset.
11919  * @k: the string to identify the data element.
11920  * @d: the data element.
11921  * @f: the function to call when the data element is removed. This function will be called with the data element and can be used to free any memory allocated for it.
11922  *
11923  * Sets the data corresponding to the given string identifier, and the
11924  * function to call when the data element is destroyed.
11925  */
11926
11927
11928 /**
11929  * g_date_add_days:
11930  * @date: a #GDate to increment
11931  * @n_days: number of days to move the date forward
11932  *
11933  * Increments a date some number of days.
11934  * To move forward by weeks, add weeks*7 days.
11935  * The date must be valid.
11936  */
11937
11938
11939 /**
11940  * g_date_add_months:
11941  * @date: a #GDate to increment
11942  * @n_months: number of months to move forward
11943  *
11944  * Increments a date by some number of months.
11945  * If the day of the month is greater than 28,
11946  * this routine may change the day of the month
11947  * (because the destination month may not have
11948  * the current day in it). The date must be valid.
11949  */
11950
11951
11952 /**
11953  * g_date_add_years:
11954  * @date: a #GDate to increment
11955  * @n_years: number of years to move forward
11956  *
11957  * Increments a date by some number of years.
11958  * If the date is February 29, and the destination
11959  * year is not a leap year, the date will be changed
11960  * to February 28. The date must be valid.
11961  */
11962
11963
11964 /**
11965  * g_date_clamp:
11966  * @date: a #GDate to clamp
11967  * @min_date: minimum accepted value for @date
11968  * @max_date: maximum accepted value for @date
11969  *
11970  * If @date is prior to @min_date, sets @date equal to @min_date.
11971  * If @date falls after @max_date, sets @date equal to @max_date.
11972  * Otherwise, @date is unchanged.
11973  * Either of @min_date and @max_date may be %NULL.
11974  * All non-%NULL dates must be valid.
11975  */
11976
11977
11978 /**
11979  * g_date_clear:
11980  * @date: pointer to one or more dates to clear
11981  * @n_dates: number of dates to clear
11982  *
11983  * Initializes one or more #GDate structs to a sane but invalid
11984  * state. The cleared dates will not represent an existing date, but will
11985  * not contain garbage. Useful to init a date declared on the stack.
11986  * Validity can be tested with g_date_valid().
11987  */
11988
11989
11990 /**
11991  * g_date_compare:
11992  * @lhs: first date to compare
11993  * @rhs: second date to compare
11994  *
11995  * qsort()-style comparison function for dates.
11996  * Both dates must be valid.
11997  *
11998  * Returns: 0 for equal, less than zero if @lhs is less than @rhs, greater than zero if @lhs is greater than @rhs
11999  */
12000
12001
12002 /**
12003  * g_date_days_between:
12004  * @date1: the first date
12005  * @date2: the second date
12006  *
12007  * Computes the number of days between two dates.
12008  * If @date2 is prior to @date1, the returned value is negative.
12009  * Both dates must be valid.
12010  *
12011  * Returns: the number of days between @date1 and @date2
12012  */
12013
12014
12015 /**
12016  * g_date_free:
12017  * @date: a #GDate to free
12018  *
12019  * Frees a #GDate returned from g_date_new().
12020  */
12021
12022
12023 /**
12024  * g_date_get_day:
12025  * @date: a #GDate to extract the day of the month from
12026  *
12027  * Returns the day of the month. The date must be valid.
12028  *
12029  * Returns: day of the month
12030  */
12031
12032
12033 /**
12034  * g_date_get_day_of_year:
12035  * @date: a #GDate to extract day of year from
12036  *
12037  * Returns the day of the year, where Jan 1 is the first day of the
12038  * year. The date must be valid.
12039  *
12040  * Returns: day of the year
12041  */
12042
12043
12044 /**
12045  * g_date_get_days_in_month:
12046  * @month: month
12047  * @year: year
12048  *
12049  * Returns the number of days in a month, taking leap
12050  * years into account.
12051  *
12052  * Returns: number of days in @month during the @year
12053  */
12054
12055
12056 /**
12057  * g_date_get_iso8601_week_of_year:
12058  * @date: a valid #GDate
12059  *
12060  * Returns the week of the year, where weeks are interpreted according
12061  * to ISO 8601.
12062  *
12063  * Returns: ISO 8601 week number of the year.
12064  * Since: 2.6
12065  */
12066
12067
12068 /**
12069  * g_date_get_julian:
12070  * @date: a #GDate to extract the Julian day from
12071  *
12072  * Returns the Julian day or "serial number" of the #GDate. The
12073  * Julian day is simply the number of days since January 1, Year 1; i.e.,
12074  * January 1, Year 1 is Julian day 1; January 2, Year 1 is Julian day 2,
12075  * etc. The date must be valid.
12076  *
12077  * Returns: Julian day
12078  */
12079
12080
12081 /**
12082  * g_date_get_monday_week_of_year:
12083  * @date: a #GDate
12084  *
12085  * Returns the week of the year, where weeks are understood to start on
12086  * Monday. If the date is before the first Monday of the year, return
12087  * 0. The date must be valid.
12088  *
12089  * Returns: week of the year
12090  */
12091
12092
12093 /**
12094  * g_date_get_monday_weeks_in_year:
12095  * @year: a year
12096  *
12097  * Returns the number of weeks in the year, where weeks
12098  * are taken to start on Monday. Will be 52 or 53. The
12099  * date must be valid. (Years always have 52 7-day periods,
12100  * plus 1 or 2 extra days depending on whether it's a leap
12101  * year. This function is basically telling you how many
12102  * Mondays are in the year, i.e. there are 53 Mondays if
12103  * one of the extra days happens to be a Monday.)
12104  *
12105  * Returns: number of Mondays in the year
12106  */
12107
12108
12109 /**
12110  * g_date_get_month:
12111  * @date: a #GDate to get the month from
12112  *
12113  * Returns the month of the year. The date must be valid.
12114  *
12115  * Returns: month of the year as a #GDateMonth
12116  */
12117
12118
12119 /**
12120  * g_date_get_sunday_week_of_year:
12121  * @date: a #GDate
12122  *
12123  * Returns the week of the year during which this date falls, if weeks
12124  * are understood to being on Sunday. The date must be valid. Can return
12125  * 0 if the day is before the first Sunday of the year.
12126  *
12127  * Returns: week number
12128  */
12129
12130
12131 /**
12132  * g_date_get_sunday_weeks_in_year:
12133  * @year: year to count weeks in
12134  *
12135  * Returns the number of weeks in the year, where weeks
12136  * are taken to start on Sunday. Will be 52 or 53. The
12137  * date must be valid. (Years always have 52 7-day periods,
12138  * plus 1 or 2 extra days depending on whether it's a leap
12139  * year. This function is basically telling you how many
12140  * Sundays are in the year, i.e. there are 53 Sundays if
12141  * one of the extra days happens to be a Sunday.)
12142  *
12143  * Returns: the number of weeks in @year
12144  */
12145
12146
12147 /**
12148  * g_date_get_weekday:
12149  * @date: a #GDate
12150  *
12151  * Returns the day of the week for a #GDate. The date must be valid.
12152  *
12153  * Returns: day of the week as a #GDateWeekday.
12154  */
12155
12156
12157 /**
12158  * g_date_get_year:
12159  * @date: a #GDate
12160  *
12161  * Returns the year of a #GDate. The date must be valid.
12162  *
12163  * Returns: year in which the date falls
12164  */
12165
12166
12167 /**
12168  * g_date_is_first_of_month:
12169  * @date: a #GDate to check
12170  *
12171  * Returns %TRUE if the date is on the first of a month.
12172  * The date must be valid.
12173  *
12174  * Returns: %TRUE if the date is the first of the month
12175  */
12176
12177
12178 /**
12179  * g_date_is_last_of_month:
12180  * @date: a #GDate to check
12181  *
12182  * Returns %TRUE if the date is the last day of the month.
12183  * The date must be valid.
12184  *
12185  * Returns: %TRUE if the date is the last day of the month
12186  */
12187
12188
12189 /**
12190  * g_date_is_leap_year:
12191  * @year: year to check
12192  *
12193  * Returns %TRUE if the year is a leap year.
12194  * <footnote><para>For the purposes of this function,
12195  * leap year is every year divisible by 4 unless that year
12196  * is divisible by 100. If it is divisible by 100 it would
12197  * be a leap year only if that year is also divisible
12198  * by 400.</para></footnote>
12199  *
12200  * Returns: %TRUE if the year is a leap year
12201  */
12202
12203
12204 /**
12205  * g_date_new:
12206  *
12207  * Allocates a #GDate and initializes
12208  * it to a sane state. The new date will
12209  * be cleared (as if you'd called g_date_clear()) but invalid (it won't
12210  * represent an existing day). Free the return value with g_date_free().
12211  *
12212  * Returns: a newly-allocated #GDate
12213  */
12214
12215
12216 /**
12217  * g_date_new_dmy:
12218  * @day: day of the month
12219  * @month: month of the year
12220  * @year: year
12221  *
12222  * Like g_date_new(), but also sets the value of the date. Assuming the
12223  * day-month-year triplet you pass in represents an existing day, the
12224  * returned date will be valid.
12225  *
12226  * Returns: a newly-allocated #GDate initialized with @day, @month, and @year
12227  */
12228
12229
12230 /**
12231  * g_date_new_julian:
12232  * @julian_day: days since January 1, Year 1
12233  *
12234  * Like g_date_new(), but also sets the value of the date. Assuming the
12235  * Julian day number you pass in is valid (greater than 0, less than an
12236  * unreasonably large number), the returned date will be valid.
12237  *
12238  * Returns: a newly-allocated #GDate initialized with @julian_day
12239  */
12240
12241
12242 /**
12243  * g_date_order:
12244  * @date1: the first date
12245  * @date2: the second date
12246  *
12247  * Checks if @date1 is less than or equal to @date2,
12248  * and swap the values if this is not the case.
12249  */
12250
12251
12252 /**
12253  * g_date_set_day:
12254  * @date: a #GDate
12255  * @day: day to set
12256  *
12257  * Sets the day of the month for a #GDate. If the resulting
12258  * day-month-year triplet is invalid, the date will be invalid.
12259  */
12260
12261
12262 /**
12263  * g_date_set_dmy:
12264  * @date: a #GDate
12265  * @day: day
12266  * @month: month
12267  * @y: year
12268  *
12269  * Sets the value of a #GDate from a day, month, and year.
12270  * The day-month-year triplet must be valid; if you aren't
12271  * sure it is, call g_date_valid_dmy() to check before you
12272  * set it.
12273  */
12274
12275
12276 /**
12277  * g_date_set_julian:
12278  * @date: a #GDate
12279  * @julian_date: Julian day number (days since January 1, Year 1)
12280  *
12281  * Sets the value of a #GDate from a Julian day number.
12282  */
12283
12284
12285 /**
12286  * g_date_set_month:
12287  * @date: a #GDate
12288  * @month: month to set
12289  *
12290  * Sets the month of the year for a #GDate.  If the resulting
12291  * day-month-year triplet is invalid, the date will be invalid.
12292  */
12293
12294
12295 /**
12296  * g_date_set_parse:
12297  * @date: a #GDate to fill in
12298  * @str: string to parse
12299  *
12300  * Parses a user-inputted string @str, and try to figure out what date it
12301  * represents, taking the <link linkend="setlocale">current locale</link>
12302  * into account. If the string is successfully parsed, the date will be
12303  * valid after the call. Otherwise, it will be invalid. You should check
12304  * using g_date_valid() to see whether the parsing succeeded.
12305  *
12306  * This function is not appropriate for file formats and the like; it
12307  * isn't very precise, and its exact behavior varies with the locale.
12308  * It's intended to be a heuristic routine that guesses what the user
12309  * means by a given string (and it does work pretty well in that
12310  * capacity).
12311  */
12312
12313
12314 /**
12315  * g_date_set_time:
12316  * @date: a #GDate.
12317  * @time_: #GTime value to set.
12318  *
12319  * Sets the value of a date from a #GTime value.
12320  * The time to date conversion is done using the user's current timezone.
12321  *
12322  * Deprecated: 2.10: Use g_date_set_time_t() instead.
12323  */
12324
12325
12326 /**
12327  * g_date_set_time_t:
12328  * @date: a #GDate
12329  * @timet: <type>time_t</type> value to set
12330  *
12331  * Sets the value of a date to the date corresponding to a time
12332  * specified as a time_t. The time to date conversion is done using
12333  * the user's current timezone.
12334  *
12335  * To set the value of a date to the current day, you could write:
12336  * |[
12337  *  g_date_set_time_t (date, time (NULL));
12338  * ]|
12339  *
12340  * Since: 2.10
12341  */
12342
12343
12344 /**
12345  * g_date_set_time_val:
12346  * @date: a #GDate
12347  * @timeval: #GTimeVal value to set
12348  *
12349  * Sets the value of a date from a #GTimeVal value.  Note that the
12350  * @tv_usec member is ignored, because #GDate can't make use of the
12351  * additional precision.
12352  *
12353  * The time to date conversion is done using the user's current timezone.
12354  *
12355  * Since: 2.10
12356  */
12357
12358
12359 /**
12360  * g_date_set_year:
12361  * @date: a #GDate
12362  * @year: year to set
12363  *
12364  * Sets the year for a #GDate. If the resulting day-month-year
12365  * triplet is invalid, the date will be invalid.
12366  */
12367
12368
12369 /**
12370  * g_date_strftime:
12371  * @s: destination buffer
12372  * @slen: buffer size
12373  * @format: format string
12374  * @date: valid #GDate
12375  *
12376  * Generates a printed representation of the date, in a
12377  * <link linkend="setlocale">locale</link>-specific way.
12378  * Works just like the platform's C library strftime() function,
12379  * but only accepts date-related formats; time-related formats
12380  * give undefined results. Date must be valid. Unlike strftime()
12381  * (which uses the locale encoding), works on a UTF-8 format
12382  * string and stores a UTF-8 result.
12383  *
12384  * This function does not provide any conversion specifiers in
12385  * addition to those implemented by the platform's C library.
12386  * For example, don't expect that using g_date_strftime() would
12387  * make the \%F provided by the C99 strftime() work on Windows
12388  * where the C library only complies to C89.
12389  *
12390  * Returns: number of characters written to the buffer, or 0 the buffer was too small
12391  */
12392
12393
12394 /**
12395  * g_date_subtract_days:
12396  * @date: a #GDate to decrement
12397  * @n_days: number of days to move
12398  *
12399  * Moves a date some number of days into the past.
12400  * To move by weeks, just move by weeks*7 days.
12401  * The date must be valid.
12402  */
12403
12404
12405 /**
12406  * g_date_subtract_months:
12407  * @date: a #GDate to decrement
12408  * @n_months: number of months to move
12409  *
12410  * Moves a date some number of months into the past.
12411  * If the current day of the month doesn't exist in
12412  * the destination month, the day of the month
12413  * may change. The date must be valid.
12414  */
12415
12416
12417 /**
12418  * g_date_subtract_years:
12419  * @date: a #GDate to decrement
12420  * @n_years: number of years to move
12421  *
12422  * Moves a date some number of years into the past.
12423  * If the current day doesn't exist in the destination
12424  * year (i.e. it's February 29 and you move to a non-leap-year)
12425  * then the day is changed to February 29. The date
12426  * must be valid.
12427  */
12428
12429
12430 /**
12431  * g_date_time_add:
12432  * @datetime: a #GDateTime
12433  * @timespan: a #GTimeSpan
12434  *
12435  * Creates a copy of @datetime and adds the specified timespan to the copy.
12436  *
12437  * Returns: the newly created #GDateTime which should be freed with g_date_time_unref().
12438  * Since: 2.26
12439  */
12440
12441
12442 /**
12443  * g_date_time_add_days:
12444  * @datetime: a #GDateTime
12445  * @days: the number of days
12446  *
12447  * Creates a copy of @datetime and adds the specified number of days to the
12448  * copy.
12449  *
12450  * Returns: the newly created #GDateTime which should be freed with g_date_time_unref().
12451  * Since: 2.26
12452  */
12453
12454
12455 /**
12456  * g_date_time_add_full:
12457  * @datetime: a #GDateTime
12458  * @years: the number of years to add
12459  * @months: the number of months to add
12460  * @days: the number of days to add
12461  * @hours: the number of hours to add
12462  * @minutes: the number of minutes to add
12463  * @seconds: the number of seconds to add
12464  *
12465  * Creates a new #GDateTime adding the specified values to the current date and
12466  * time in @datetime.
12467  *
12468  * Returns: the newly created #GDateTime that should be freed with g_date_time_unref().
12469  * Since: 2.26
12470  */
12471
12472
12473 /**
12474  * g_date_time_add_hours:
12475  * @datetime: a #GDateTime
12476  * @hours: the number of hours to add
12477  *
12478  * Creates a copy of @datetime and adds the specified number of hours
12479  *
12480  * Returns: the newly created #GDateTime which should be freed with g_date_time_unref().
12481  * Since: 2.26
12482  */
12483
12484
12485 /**
12486  * g_date_time_add_minutes:
12487  * @datetime: a #GDateTime
12488  * @minutes: the number of minutes to add
12489  *
12490  * Creates a copy of @datetime adding the specified number of minutes.
12491  *
12492  * Returns: the newly created #GDateTime which should be freed with g_date_time_unref().
12493  * Since: 2.26
12494  */
12495
12496
12497 /**
12498  * g_date_time_add_months:
12499  * @datetime: a #GDateTime
12500  * @months: the number of months
12501  *
12502  * Creates a copy of @datetime and adds the specified number of months to the
12503  * copy.
12504  *
12505  * Returns: the newly created #GDateTime which should be freed with g_date_time_unref().
12506  * Since: 2.26
12507  */
12508
12509
12510 /**
12511  * g_date_time_add_seconds:
12512  * @datetime: a #GDateTime
12513  * @seconds: the number of seconds to add
12514  *
12515  * Creates a copy of @datetime and adds the specified number of seconds.
12516  *
12517  * Returns: the newly created #GDateTime which should be freed with g_date_time_unref().
12518  * Since: 2.26
12519  */
12520
12521
12522 /**
12523  * g_date_time_add_weeks:
12524  * @datetime: a #GDateTime
12525  * @weeks: the number of weeks
12526  *
12527  * Creates a copy of @datetime and adds the specified number of weeks to the
12528  * copy.
12529  *
12530  * Returns: the newly created #GDateTime which should be freed with g_date_time_unref().
12531  * Since: 2.26
12532  */
12533
12534
12535 /**
12536  * g_date_time_add_years:
12537  * @datetime: a #GDateTime
12538  * @years: the number of years
12539  *
12540  * Creates a copy of @datetime and adds the specified number of years to the
12541  * copy.
12542  *
12543  * Returns: the newly created #GDateTime which should be freed with g_date_time_unref().
12544  * Since: 2.26
12545  */
12546
12547
12548 /**
12549  * g_date_time_compare:
12550  * @dt1: first #GDateTime to compare
12551  * @dt2: second #GDateTime to compare
12552  *
12553  * A comparison function for #GDateTimes that is suitable
12554  * as a #GCompareFunc. Both #GDateTimes must be non-%NULL.
12555  *
12556  * Returns: -1, 0 or 1 if @dt1 is less than, equal to or greater than @dt2.
12557  * Since: 2.26
12558  */
12559
12560
12561 /**
12562  * g_date_time_difference:
12563  * @end: a #GDateTime
12564  * @begin: a #GDateTime
12565  *
12566  * Calculates the difference in time between @end and @begin.  The
12567  * #GTimeSpan that is returned is effectively @end - @begin (ie:
12568  * positive if the first simparameter is larger).
12569  *
12570  * Returns: the difference between the two #GDateTime, as a time span expressed in microseconds.
12571  * Since: 2.26
12572  */
12573
12574
12575 /**
12576  * g_date_time_equal:
12577  * @dt1: a #GDateTime
12578  * @dt2: a #GDateTime
12579  *
12580  * Checks to see if @dt1 and @dt2 are equal.
12581  *
12582  * Equal here means that they represent the same moment after converting
12583  * them to the same time zone.
12584  *
12585  * Returns: %TRUE if @dt1 and @dt2 are equal
12586  * Since: 2.26
12587  */
12588
12589
12590 /**
12591  * g_date_time_format:
12592  * @datetime: A #GDateTime
12593  * @format: a valid UTF-8 string, containing the format for the #GDateTime
12594  *
12595  * Creates a newly allocated string representing the requested @format.
12596  *
12597  * The format strings understood by this function are a subset of the
12598  * strftime() format language as specified by C99.  The \%D, \%U and \%W
12599  * conversions are not supported, nor is the 'E' modifier.  The GNU
12600  * extensions \%k, \%l, \%s and \%P are supported, however, as are the
12601  * '0', '_' and '-' modifiers.
12602  *
12603  * In contrast to strftime(), this function always produces a UTF-8
12604  * string, regardless of the current locale.  Note that the rendering of
12605  * many formats is locale-dependent and may not match the strftime()
12606  * output exactly.
12607  *
12608  * The following format specifiers are supported:
12609  *
12610  * <variablelist>
12611  *  <varlistentry><term>
12612  *    <literal>\%a</literal>:
12613  *   </term><listitem><simpara>
12614  *    the abbreviated weekday name according to the current locale
12615  *  </simpara></listitem></varlistentry>
12616  *  <varlistentry><term>
12617  *    <literal>\%A</literal>:
12618  *   </term><listitem><simpara>
12619  *    the full weekday name according to the current locale
12620  *  </simpara></listitem></varlistentry>
12621  *  <varlistentry><term>
12622  *    <literal>\%b</literal>:
12623  *   </term><listitem><simpara>
12624  *    the abbreviated month name according to the current locale
12625  *  </simpara></listitem></varlistentry>
12626  *  <varlistentry><term>
12627  *    <literal>\%B</literal>:
12628  *   </term><listitem><simpara>
12629  *    the full month name according to the current locale
12630  *  </simpara></listitem></varlistentry>
12631  *  <varlistentry><term>
12632  *    <literal>\%c</literal>:
12633  *   </term><listitem><simpara>
12634  *    the  preferred  date  and  time  representation  for the current locale
12635  *  </simpara></listitem></varlistentry>
12636  *  <varlistentry><term>
12637  *    <literal>\%C</literal>:
12638  *   </term><listitem><simpara>
12639  *    The century number (year/100) as a 2-digit integer (00-99)
12640  *  </simpara></listitem></varlistentry>
12641  *  <varlistentry><term>
12642  *    <literal>\%d</literal>:
12643  *   </term><listitem><simpara>
12644  *    the day of the month as a decimal number (range 01 to 31)
12645  *  </simpara></listitem></varlistentry>
12646  *  <varlistentry><term>
12647  *    <literal>\%e</literal>:
12648  *   </term><listitem><simpara>
12649  *    the day of the month as a decimal number (range  1 to 31)
12650  *  </simpara></listitem></varlistentry>
12651  *  <varlistentry><term>
12652  *    <literal>\%F</literal>:
12653  *   </term><listitem><simpara>
12654  *    equivalent to <literal>\%Y-\%m-\%d</literal> (the ISO 8601 date
12655  *    format)
12656  *  </simpara></listitem></varlistentry>
12657  *  <varlistentry><term>
12658  *    <literal>\%g</literal>:
12659  *   </term><listitem><simpara>
12660  *    the last two digits of the ISO 8601 week-based year as a decimal
12661  *    number (00-99).  This works well with \%V and \%u.
12662  *  </simpara></listitem></varlistentry>
12663  *  <varlistentry><term>
12664  *    <literal>\%G</literal>:
12665  *   </term><listitem><simpara>
12666  *    the ISO 8601 week-based year as a decimal number.  This works well
12667  *    with \%V and \%u.
12668  *  </simpara></listitem></varlistentry>
12669  *  <varlistentry><term>
12670  *    <literal>\%h</literal>:
12671  *   </term><listitem><simpara>
12672  *    equivalent to <literal>\%b</literal>
12673  *  </simpara></listitem></varlistentry>
12674  *  <varlistentry><term>
12675  *    <literal>\%H</literal>:
12676  *   </term><listitem><simpara>
12677  *    the hour as a decimal number using a 24-hour clock (range 00 to
12678  *    23)
12679  *  </simpara></listitem></varlistentry>
12680  *  <varlistentry><term>
12681  *    <literal>\%I</literal>:
12682  *   </term><listitem><simpara>
12683  *    the hour as a decimal number using a 12-hour clock (range 01 to
12684  *    12)
12685  *  </simpara></listitem></varlistentry>
12686  *  <varlistentry><term>
12687  *    <literal>\%j</literal>:
12688  *   </term><listitem><simpara>
12689  *    the day of the year as a decimal number (range 001 to 366)
12690  *  </simpara></listitem></varlistentry>
12691  *  <varlistentry><term>
12692  *    <literal>\%k</literal>:
12693  *   </term><listitem><simpara>
12694  *    the hour (24-hour clock) as a decimal number (range 0 to 23);
12695  *    single digits are preceded by a blank
12696  *  </simpara></listitem></varlistentry>
12697  *  <varlistentry><term>
12698  *    <literal>\%l</literal>:
12699  *   </term><listitem><simpara>
12700  *    the hour (12-hour clock) as a decimal number (range 1 to 12);
12701  *    single digits are preceded by a blank
12702  *  </simpara></listitem></varlistentry>
12703  *  <varlistentry><term>
12704  *    <literal>\%m</literal>:
12705  *   </term><listitem><simpara>
12706  *    the month as a decimal number (range 01 to 12)
12707  *  </simpara></listitem></varlistentry>
12708  *  <varlistentry><term>
12709  *    <literal>\%M</literal>:
12710  *   </term><listitem><simpara>
12711  *    the minute as a decimal number (range 00 to 59)
12712  *  </simpara></listitem></varlistentry>
12713  *  <varlistentry><term>
12714  *    <literal>\%p</literal>:
12715  *   </term><listitem><simpara>
12716  *    either "AM" or "PM" according to the given time value, or the
12717  *    corresponding  strings for the current locale.  Noon is treated as
12718  *    "PM" and midnight as "AM".
12719  *  </simpara></listitem></varlistentry>
12720  *  <varlistentry><term>
12721  *    <literal>\%P</literal>:
12722  *   </term><listitem><simpara>
12723  *    like \%p but lowercase: "am" or "pm" or a corresponding string for
12724  *    the current locale
12725  *  </simpara></listitem></varlistentry>
12726  *  <varlistentry><term>
12727  *    <literal>\%r</literal>:
12728  *   </term><listitem><simpara>
12729  *    the time in a.m. or p.m. notation
12730  *  </simpara></listitem></varlistentry>
12731  *  <varlistentry><term>
12732  *    <literal>\%R</literal>:
12733  *   </term><listitem><simpara>
12734  *    the time in 24-hour notation (<literal>\%H:\%M</literal>)
12735  *  </simpara></listitem></varlistentry>
12736  *  <varlistentry><term>
12737  *    <literal>\%s</literal>:
12738  *   </term><listitem><simpara>
12739  *    the number of seconds since the Epoch, that is, since 1970-01-01
12740  *    00:00:00 UTC
12741  *  </simpara></listitem></varlistentry>
12742  *  <varlistentry><term>
12743  *    <literal>\%S</literal>:
12744  *   </term><listitem><simpara>
12745  *    the second as a decimal number (range 00 to 60)
12746  *  </simpara></listitem></varlistentry>
12747  *  <varlistentry><term>
12748  *    <literal>\%t</literal>:
12749  *   </term><listitem><simpara>
12750  *    a tab character
12751  *  </simpara></listitem></varlistentry>
12752  *  <varlistentry><term>
12753  *    <literal>\%T</literal>:
12754  *   </term><listitem><simpara>
12755  *    the time in 24-hour notation with seconds (<literal>\%H:\%M:\%S</literal>)
12756  *  </simpara></listitem></varlistentry>
12757  *  <varlistentry><term>
12758  *    <literal>\%u</literal>:
12759  *   </term><listitem><simpara>
12760  *    the ISO 8601 standard day of the week as a decimal, range 1 to 7,
12761  *    Monday being 1.  This works well with \%G and \%V.
12762  *  </simpara></listitem></varlistentry>
12763  *  <varlistentry><term>
12764  *    <literal>\%V</literal>:
12765  *   </term><listitem><simpara>
12766  *    the ISO 8601 standard week number of the current year as a decimal
12767  *    number, range 01 to 53, where week 1 is the first week that has at
12768  *    least 4 days in the new year. See g_date_time_get_week_of_year().
12769  *    This works well with \%G and \%u.
12770  *  </simpara></listitem></varlistentry>
12771  *  <varlistentry><term>
12772  *    <literal>\%w</literal>:
12773  *   </term><listitem><simpara>
12774  *    the day of the week as a decimal, range 0 to 6, Sunday being 0.
12775  *    This is not the ISO 8601 standard format -- use \%u instead.
12776  *  </simpara></listitem></varlistentry>
12777  *  <varlistentry><term>
12778  *    <literal>\%x</literal>:
12779  *   </term><listitem><simpara>
12780  *    the preferred date representation for the current locale without
12781  *    the time
12782  *  </simpara></listitem></varlistentry>
12783  *  <varlistentry><term>
12784  *    <literal>\%X</literal>:
12785  *   </term><listitem><simpara>
12786  *    the preferred time representation for the current locale without
12787  *    the date
12788  *  </simpara></listitem></varlistentry>
12789  *  <varlistentry><term>
12790  *    <literal>\%y</literal>:
12791  *   </term><listitem><simpara>
12792  *    the year as a decimal number without the century
12793  *  </simpara></listitem></varlistentry>
12794  *  <varlistentry><term>
12795  *    <literal>\%Y</literal>:
12796  *   </term><listitem><simpara>
12797  *    the year as a decimal number including the century
12798  *  </simpara></listitem></varlistentry>
12799  *  <varlistentry><term>
12800  *    <literal>\%z</literal>:
12801  *   </term><listitem><simpara>
12802  *    the time-zone as hour offset from UTC
12803  *  </simpara></listitem></varlistentry>
12804  *  <varlistentry><term>
12805  *    <literal>\%Z</literal>:
12806  *   </term><listitem><simpara>
12807  *    the time zone or name or abbreviation
12808  *  </simpara></listitem></varlistentry>
12809  *  <varlistentry><term>
12810  *    <literal>\%\%</literal>:
12811  *   </term><listitem><simpara>
12812  *    a literal <literal>\%</literal> character
12813  *  </simpara></listitem></varlistentry>
12814  * </variablelist>
12815  *
12816  * Some conversion specifications can be modified by preceding the
12817  * conversion specifier by one or more modifier characters. The
12818  * following modifiers are supported for many of the numeric
12819  * conversions:
12820  * <variablelist>
12821  *   <varlistentry>
12822  *     <term>O</term>
12823  *     <listitem>
12824  *       Use alternative numeric symbols, if the current locale
12825  *       supports those.
12826  *     </listitem>
12827  *   </varlistentry>
12828  *   <varlistentry>
12829  *     <term>_</term>
12830  *     <listitem>
12831  *       Pad a numeric result with spaces.
12832  *       This overrides the default padding for the specifier.
12833  *     </listitem>
12834  *   </varlistentry>
12835  *   <varlistentry>
12836  *     <term>-</term>
12837  *     <listitem>
12838  *       Do not pad a numeric result.
12839  *       This overrides the default padding for the specifier.
12840  *     </listitem>
12841  *   </varlistentry>
12842  *   <varlistentry>
12843  *     <term>0</term>
12844  *     <listitem>
12845  *       Pad a numeric result with zeros.
12846  *       This overrides the default padding for the specifier.
12847  *     </listitem>
12848  *   </varlistentry>
12849  * </variablelist>
12850  *
12851  * Returns: a newly allocated string formatted to the requested format or %NULL in the case that there was an error.  The string should be freed with g_free().
12852  * Since: 2.26
12853  */
12854
12855
12856 /**
12857  * g_date_time_get_day_of_month:
12858  * @datetime: a #GDateTime
12859  *
12860  * Retrieves the day of the month represented by @datetime in the gregorian
12861  * calendar.
12862  *
12863  * Returns: the day of the month
12864  * Since: 2.26
12865  */
12866
12867
12868 /**
12869  * g_date_time_get_day_of_week:
12870  * @datetime: a #GDateTime
12871  *
12872  * Retrieves the ISO 8601 day of the week on which @datetime falls (1 is
12873  * Monday, 2 is Tuesday... 7 is Sunday).
12874  *
12875  * Returns: the day of the week
12876  * Since: 2.26
12877  */
12878
12879
12880 /**
12881  * g_date_time_get_day_of_year:
12882  * @datetime: a #GDateTime
12883  *
12884  * Retrieves the day of the year represented by @datetime in the Gregorian
12885  * calendar.
12886  *
12887  * Returns: the day of the year
12888  * Since: 2.26
12889  */
12890
12891
12892 /**
12893  * g_date_time_get_hour:
12894  * @datetime: a #GDateTime
12895  *
12896  * Retrieves the hour of the day represented by @datetime
12897  *
12898  * Returns: the hour of the day
12899  * Since: 2.26
12900  */
12901
12902
12903 /**
12904  * g_date_time_get_microsecond:
12905  * @datetime: a #GDateTime
12906  *
12907  * Retrieves the microsecond of the date represented by @datetime
12908  *
12909  * Returns: the microsecond of the second
12910  * Since: 2.26
12911  */
12912
12913
12914 /**
12915  * g_date_time_get_minute:
12916  * @datetime: a #GDateTime
12917  *
12918  * Retrieves the minute of the hour represented by @datetime
12919  *
12920  * Returns: the minute of the hour
12921  * Since: 2.26
12922  */
12923
12924
12925 /**
12926  * g_date_time_get_month:
12927  * @datetime: a #GDateTime
12928  *
12929  * Retrieves the month of the year represented by @datetime in the Gregorian
12930  * calendar.
12931  *
12932  * Returns: the month represented by @datetime
12933  * Since: 2.26
12934  */
12935
12936
12937 /**
12938  * g_date_time_get_second:
12939  * @datetime: a #GDateTime
12940  *
12941  * Retrieves the second of the minute represented by @datetime
12942  *
12943  * Returns: the second represented by @datetime
12944  * Since: 2.26
12945  */
12946
12947
12948 /**
12949  * g_date_time_get_seconds:
12950  * @datetime: a #GDateTime
12951  *
12952  * Retrieves the number of seconds since the start of the last minute,
12953  * including the fractional part.
12954  *
12955  * Returns: the number of seconds
12956  * Since: 2.26
12957  */
12958
12959
12960 /**
12961  * g_date_time_get_timezone_abbreviation:
12962  * @datetime: a #GDateTime
12963  *
12964  * Determines the time zone abbreviation to be used at the time and in
12965  * the time zone of @datetime.
12966  *
12967  * For example, in Toronto this is currently "EST" during the winter
12968  * months and "EDT" during the summer months when daylight savings
12969  * time is in effect.
12970  *
12971  * Returns: (transfer none): the time zone abbreviation. The returned string is owned by the #GDateTime and it should not be modified or freed
12972  * Since: 2.26
12973  */
12974
12975
12976 /**
12977  * g_date_time_get_utc_offset:
12978  * @datetime: a #GDateTime
12979  *
12980  * Determines the offset to UTC in effect at the time and in the time
12981  * zone of @datetime.
12982  *
12983  * The offset is the number of microseconds that you add to UTC time to
12984  * arrive at local time for the time zone (ie: negative numbers for time
12985  * zones west of GMT, positive numbers for east).
12986  *
12987  * If @datetime represents UTC time, then the offset is always zero.
12988  *
12989  * Returns: the number of microseconds that should be added to UTC to get the local time
12990  * Since: 2.26
12991  */
12992
12993
12994 /**
12995  * g_date_time_get_week_numbering_year:
12996  * @datetime: a #GDateTime
12997  *
12998  * Returns the ISO 8601 week-numbering year in which the week containing
12999  * @datetime falls.
13000  *
13001  * This function, taken together with g_date_time_get_week_of_year() and
13002  * g_date_time_get_day_of_week() can be used to determine the full ISO
13003  * week date on which @datetime falls.
13004  *
13005  * This is usually equal to the normal Gregorian year (as returned by
13006  * g_date_time_get_year()), except as detailed below:
13007  *
13008  * For Thursday, the week-numbering year is always equal to the usual
13009  * calendar year.  For other days, the number is such that every day
13010  * within a complete week (Monday to Sunday) is contained within the
13011  * same week-numbering year.
13012  *
13013  * For Monday, Tuesday and Wednesday occurring near the end of the year,
13014  * this may mean that the week-numbering year is one greater than the
13015  * calendar year (so that these days have the same week-numbering year
13016  * as the Thursday occurring early in the next year).
13017  *
13018  * For Friday, Saturaday and Sunday occurring near the start of the year,
13019  * this may mean that the week-numbering year is one less than the
13020  * calendar year (so that these days have the same week-numbering year
13021  * as the Thursday occurring late in the previous year).
13022  *
13023  * An equivalent description is that the week-numbering year is equal to
13024  * the calendar year containing the majority of the days in the current
13025  * week (Monday to Sunday).
13026  *
13027  * Note that January 1 0001 in the proleptic Gregorian calendar is a
13028  * Monday, so this function never returns 0.
13029  *
13030  * Returns: the ISO 8601 week-numbering year for @datetime
13031  * Since: 2.26
13032  */
13033
13034
13035 /**
13036  * g_date_time_get_week_of_year:
13037  * @datetime: a #GDateTime
13038  *
13039  * Returns the ISO 8601 week number for the week containing @datetime.
13040  * The ISO 8601 week number is the same for every day of the week (from
13041  * Moday through Sunday).  That can produce some unusual results
13042  * (described below).
13043  *
13044  * The first week of the year is week 1.  This is the week that contains
13045  * the first Thursday of the year.  Equivalently, this is the first week
13046  * that has more than 4 of its days falling within the calendar year.
13047  *
13048  * The value 0 is never returned by this function.  Days contained
13049  * within a year but occurring before the first ISO 8601 week of that
13050  * year are considered as being contained in the last week of the
13051  * previous year.  Similarly, the final days of a calendar year may be
13052  * considered as being part of the first ISO 8601 week of the next year
13053  * if 4 or more days of that week are contained within the new year.
13054  *
13055  * Returns: the ISO 8601 week number for @datetime.
13056  * Since: 2.26
13057  */
13058
13059
13060 /**
13061  * g_date_time_get_year:
13062  * @datetime: A #GDateTime
13063  *
13064  * Retrieves the year represented by @datetime in the Gregorian calendar.
13065  *
13066  * Returns: the year represented by @datetime
13067  * Since: 2.26
13068  */
13069
13070
13071 /**
13072  * g_date_time_get_ymd:
13073  * @datetime: a #GDateTime.
13074  * @year: (out) (allow-none): the return location for the gregorian year, or %NULL.
13075  * @month: (out) (allow-none): the return location for the month of the year, or %NULL.
13076  * @day: (out) (allow-none): the return location for the day of the month, or %NULL.
13077  *
13078  * Retrieves the Gregorian day, month, and year of a given #GDateTime.
13079  *
13080  * Since: 2.26
13081  */
13082
13083
13084 /**
13085  * g_date_time_hash:
13086  * @datetime: a #GDateTime
13087  *
13088  * Hashes @datetime into a #guint, suitable for use within #GHashTable.
13089  *
13090  * Returns: a #guint containing the hash
13091  * Since: 2.26
13092  */
13093
13094
13095 /**
13096  * g_date_time_is_daylight_savings:
13097  * @datetime: a #GDateTime
13098  *
13099  * Determines if daylight savings time is in effect at the time and in
13100  * the time zone of @datetime.
13101  *
13102  * Returns: %TRUE if daylight savings time is in effect
13103  * Since: 2.26
13104  */
13105
13106
13107 /**
13108  * g_date_time_new:
13109  * @tz: a #GTimeZone
13110  * @year: the year component of the date
13111  * @month: the month component of the date
13112  * @day: the day component of the date
13113  * @hour: the hour component of the date
13114  * @minute: the minute component of the date
13115  * @seconds: the number of seconds past the minute
13116  *
13117  * Creates a new #GDateTime corresponding to the given date and time in
13118  * the time zone @tz.
13119  *
13120  * The @year must be between 1 and 9999, @month between 1 and 12 and @day
13121  * between 1 and 28, 29, 30 or 31 depending on the month and the year.
13122  *
13123  * @hour must be between 0 and 23 and @minute must be between 0 and 59.
13124  *
13125  * @seconds must be at least 0.0 and must be strictly less than 60.0.
13126  * It will be rounded down to the nearest microsecond.
13127  *
13128  * If the given time is not representable in the given time zone (for
13129  * example, 02:30 on March 14th 2010 in Toronto, due to daylight savings
13130  * time) then the time will be rounded up to the nearest existing time
13131  * (in this case, 03:00).  If this matters to you then you should verify
13132  * the return value for containing the same as the numbers you gave.
13133  *
13134  * In the case that the given time is ambiguous in the given time zone
13135  * (for example, 01:30 on November 7th 2010 in Toronto, due to daylight
13136  * savings time) then the time falling within standard (ie:
13137  * non-daylight) time is taken.
13138  *
13139  * It not considered a programmer error for the values to this function
13140  * to be out of range, but in the case that they are, the function will
13141  * return %NULL.
13142  *
13143  * You should release the return value by calling g_date_time_unref()
13144  * when you are done with it.
13145  *
13146  * Returns: a new #GDateTime, or %NULL
13147  * Since: 2.26
13148  */
13149
13150
13151 /**
13152  * g_date_time_new_from_timeval_local:
13153  * @tv: a #GTimeVal
13154  *
13155  * Creates a #GDateTime corresponding to the given #GTimeVal @tv in the
13156  * local time zone.
13157  *
13158  * The time contained in a #GTimeVal is always stored in the form of
13159  * seconds elapsed since 1970-01-01 00:00:00 UTC, regardless of the
13160  * local time offset.
13161  *
13162  * This call can fail (returning %NULL) if @tv represents a time outside
13163  * of the supported range of #GDateTime.
13164  *
13165  * You should release the return value by calling g_date_time_unref()
13166  * when you are done with it.
13167  *
13168  * Returns: a new #GDateTime, or %NULL
13169  * Since: 2.26
13170  */
13171
13172
13173 /**
13174  * g_date_time_new_from_timeval_utc:
13175  * @tv: a #GTimeVal
13176  *
13177  * Creates a #GDateTime corresponding to the given #GTimeVal @tv in UTC.
13178  *
13179  * The time contained in a #GTimeVal is always stored in the form of
13180  * seconds elapsed since 1970-01-01 00:00:00 UTC.
13181  *
13182  * This call can fail (returning %NULL) if @tv represents a time outside
13183  * of the supported range of #GDateTime.
13184  *
13185  * You should release the return value by calling g_date_time_unref()
13186  * when you are done with it.
13187  *
13188  * Returns: a new #GDateTime, or %NULL
13189  * Since: 2.26
13190  */
13191
13192
13193 /**
13194  * g_date_time_new_from_unix_local:
13195  * @t: the Unix time
13196  *
13197  * Creates a #GDateTime corresponding to the given Unix time @t in the
13198  * local time zone.
13199  *
13200  * Unix time is the number of seconds that have elapsed since 1970-01-01
13201  * 00:00:00 UTC, regardless of the local time offset.
13202  *
13203  * This call can fail (returning %NULL) if @t represents a time outside
13204  * of the supported range of #GDateTime.
13205  *
13206  * You should release the return value by calling g_date_time_unref()
13207  * when you are done with it.
13208  *
13209  * Returns: a new #GDateTime, or %NULL
13210  * Since: 2.26
13211  */
13212
13213
13214 /**
13215  * g_date_time_new_from_unix_utc:
13216  * @t: the Unix time
13217  *
13218  * Creates a #GDateTime corresponding to the given Unix time @t in UTC.
13219  *
13220  * Unix time is the number of seconds that have elapsed since 1970-01-01
13221  * 00:00:00 UTC.
13222  *
13223  * This call can fail (returning %NULL) if @t represents a time outside
13224  * of the supported range of #GDateTime.
13225  *
13226  * You should release the return value by calling g_date_time_unref()
13227  * when you are done with it.
13228  *
13229  * Returns: a new #GDateTime, or %NULL
13230  * Since: 2.26
13231  */
13232
13233
13234 /**
13235  * g_date_time_new_local:
13236  * @year: the year component of the date
13237  * @month: the month component of the date
13238  * @day: the day component of the date
13239  * @hour: the hour component of the date
13240  * @minute: the minute component of the date
13241  * @seconds: the number of seconds past the minute
13242  *
13243  * Creates a new #GDateTime corresponding to the given date and time in
13244  * the local time zone.
13245  *
13246  * This call is equivalent to calling g_date_time_new() with the time
13247  * zone returned by g_time_zone_new_local().
13248  *
13249  * Returns: a #GDateTime, or %NULL
13250  * Since: 2.26
13251  */
13252
13253
13254 /**
13255  * g_date_time_new_now:
13256  * @tz: a #GTimeZone
13257  *
13258  * Creates a #GDateTime corresponding to this exact instant in the given
13259  * time zone @tz.  The time is as accurate as the system allows, to a
13260  * maximum accuracy of 1 microsecond.
13261  *
13262  * This function will always succeed unless the system clock is set to
13263  * truly insane values (or unless GLib is still being used after the
13264  * year 9999).
13265  *
13266  * You should release the return value by calling g_date_time_unref()
13267  * when you are done with it.
13268  *
13269  * Returns: a new #GDateTime, or %NULL
13270  * Since: 2.26
13271  */
13272
13273
13274 /**
13275  * g_date_time_new_now_local:
13276  *
13277  * Creates a #GDateTime corresponding to this exact instant in the local
13278  * time zone.
13279  *
13280  * This is equivalent to calling g_date_time_new_now() with the time
13281  * zone returned by g_time_zone_new_local().
13282  *
13283  * Returns: a new #GDateTime, or %NULL
13284  * Since: 2.26
13285  */
13286
13287
13288 /**
13289  * g_date_time_new_now_utc:
13290  *
13291  * Creates a #GDateTime corresponding to this exact instant in UTC.
13292  *
13293  * This is equivalent to calling g_date_time_new_now() with the time
13294  * zone returned by g_time_zone_new_utc().
13295  *
13296  * Returns: a new #GDateTime, or %NULL
13297  * Since: 2.26
13298  */
13299
13300
13301 /**
13302  * g_date_time_new_utc:
13303  * @year: the year component of the date
13304  * @month: the month component of the date
13305  * @day: the day component of the date
13306  * @hour: the hour component of the date
13307  * @minute: the minute component of the date
13308  * @seconds: the number of seconds past the minute
13309  *
13310  * Creates a new #GDateTime corresponding to the given date and time in
13311  * UTC.
13312  *
13313  * This call is equivalent to calling g_date_time_new() with the time
13314  * zone returned by g_time_zone_new_utc().
13315  *
13316  * Returns: a #GDateTime, or %NULL
13317  * Since: 2.26
13318  */
13319
13320
13321 /**
13322  * g_date_time_ref:
13323  * @datetime: a #GDateTime
13324  *
13325  * Atomically increments the reference count of @datetime by one.
13326  *
13327  * Returns: the #GDateTime with the reference count increased
13328  * Since: 2.26
13329  */
13330
13331
13332 /**
13333  * g_date_time_to_local:
13334  * @datetime: a #GDateTime
13335  *
13336  * Creates a new #GDateTime corresponding to the same instant in time as
13337  * @datetime, but in the local time zone.
13338  *
13339  * This call is equivalent to calling g_date_time_to_timezone() with the
13340  * time zone returned by g_time_zone_new_local().
13341  *
13342  * Returns: the newly created #GDateTime
13343  * Since: 2.26
13344  */
13345
13346
13347 /**
13348  * g_date_time_to_timeval:
13349  * @datetime: a #GDateTime
13350  * @tv: a #GTimeVal to modify
13351  *
13352  * Stores the instant in time that @datetime represents into @tv.
13353  *
13354  * The time contained in a #GTimeVal is always stored in the form of
13355  * seconds elapsed since 1970-01-01 00:00:00 UTC, regardless of the time
13356  * zone associated with @datetime.
13357  *
13358  * On systems where 'long' is 32bit (ie: all 32bit systems and all
13359  * Windows systems), a #GTimeVal is incapable of storing the entire
13360  * range of values that #GDateTime is capable of expressing.  On those
13361  * systems, this function returns %FALSE to indicate that the time is
13362  * out of range.
13363  *
13364  * On systems where 'long' is 64bit, this function never fails.
13365  *
13366  * Returns: %TRUE if successful, else %FALSE
13367  * Since: 2.26
13368  */
13369
13370
13371 /**
13372  * g_date_time_to_timezone:
13373  * @datetime: a #GDateTime
13374  * @tz: the new #GTimeZone
13375  *
13376  * Create a new #GDateTime corresponding to the same instant in time as
13377  * @datetime, but in the time zone @tz.
13378  *
13379  * This call can fail in the case that the time goes out of bounds.  For
13380  * example, converting 0001-01-01 00:00:00 UTC to a time zone west of
13381  * Greenwich will fail (due to the year 0 being out of range).
13382  *
13383  * You should release the return value by calling g_date_time_unref()
13384  * when you are done with it.
13385  *
13386  * Returns: a new #GDateTime, or %NULL
13387  * Since: 2.26
13388  */
13389
13390
13391 /**
13392  * g_date_time_to_unix:
13393  * @datetime: a #GDateTime
13394  *
13395  * Gives the Unix time corresponding to @datetime, rounding down to the
13396  * nearest second.
13397  *
13398  * Unix time is the number of seconds that have elapsed since 1970-01-01
13399  * 00:00:00 UTC, regardless of the time zone associated with @datetime.
13400  *
13401  * Returns: the Unix time corresponding to @datetime
13402  * Since: 2.26
13403  */
13404
13405
13406 /**
13407  * g_date_time_to_utc:
13408  * @datetime: a #GDateTime
13409  *
13410  * Creates a new #GDateTime corresponding to the same instant in time as
13411  * @datetime, but in UTC.
13412  *
13413  * This call is equivalent to calling g_date_time_to_timezone() with the
13414  * time zone returned by g_time_zone_new_utc().
13415  *
13416  * Returns: the newly created #GDateTime
13417  * Since: 2.26
13418  */
13419
13420
13421 /**
13422  * g_date_time_unref:
13423  * @datetime: a #GDateTime
13424  *
13425  * Atomically decrements the reference count of @datetime by one.
13426  *
13427  * When the reference count reaches zero, the resources allocated by
13428  * @datetime are freed
13429  *
13430  * Since: 2.26
13431  */
13432
13433
13434 /**
13435  * g_date_to_struct_tm:
13436  * @date: a #GDate to set the <structname>struct tm</structname> from
13437  * @tm: <structname>struct tm</structname> to fill
13438  *
13439  * Fills in the date-related bits of a <structname>struct tm</structname>
13440  * using the @date value. Initializes the non-date parts with something
13441  * sane but meaningless.
13442  */
13443
13444
13445 /**
13446  * g_date_valid:
13447  * @date: a #GDate to check
13448  *
13449  * Returns %TRUE if the #GDate represents an existing day. The date must not
13450  * contain garbage; it should have been initialized with g_date_clear()
13451  * if it wasn't allocated by one of the g_date_new() variants.
13452  *
13453  * Returns: Whether the date is valid
13454  */
13455
13456
13457 /**
13458  * g_date_valid_day:
13459  * @day: day to check
13460  *
13461  * Returns %TRUE if the day of the month is valid (a day is valid if it's
13462  * between 1 and 31 inclusive).
13463  *
13464  * Returns: %TRUE if the day is valid
13465  */
13466
13467
13468 /**
13469  * g_date_valid_dmy:
13470  * @day: day
13471  * @month: month
13472  * @year: year
13473  *
13474  * Returns %TRUE if the day-month-year triplet forms a valid, existing day
13475  * in the range of days #GDate understands (Year 1 or later, no more than
13476  * a few thousand years in the future).
13477  *
13478  * Returns: %TRUE if the date is a valid one
13479  */
13480
13481
13482 /**
13483  * g_date_valid_julian:
13484  * @julian_date: Julian day to check
13485  *
13486  * Returns %TRUE if the Julian day is valid. Anything greater than zero
13487  * is basically a valid Julian, though there is a 32-bit limit.
13488  *
13489  * Returns: %TRUE if the Julian day is valid
13490  */
13491
13492
13493 /**
13494  * g_date_valid_month:
13495  * @month: month
13496  *
13497  * Returns %TRUE if the month value is valid. The 12 #GDateMonth
13498  * enumeration values are the only valid months.
13499  *
13500  * Returns: %TRUE if the month is valid
13501  */
13502
13503
13504 /**
13505  * g_date_valid_weekday:
13506  * @weekday: weekday
13507  *
13508  * Returns %TRUE if the weekday is valid. The seven #GDateWeekday enumeration
13509  * values are the only valid weekdays.
13510  *
13511  * Returns: %TRUE if the weekday is valid
13512  */
13513
13514
13515 /**
13516  * g_date_valid_year:
13517  * @year: year
13518  *
13519  * Returns %TRUE if the year is valid. Any year greater than 0 is valid,
13520  * though there is a 16-bit limit to what #GDate will understand.
13521  *
13522  * Returns: %TRUE if the year is valid
13523  */
13524
13525
13526 /**
13527  * g_dcgettext:
13528  * @domain: (allow-none): the translation domain to use, or %NULL to use the domain set with textdomain()
13529  * @msgid: message to translate
13530  * @category: a locale category
13531  *
13532  * This is a variant of g_dgettext() that allows specifying a locale
13533  * category instead of always using <envar>LC_MESSAGES</envar>. See g_dgettext() for
13534  * more information about how this functions differs from calling
13535  * dcgettext() directly.
13536  *
13537  * Returns: the translated string for the given locale category
13538  * Since: 2.26
13539  */
13540
13541
13542 /**
13543  * g_debug:
13544  * @...: format string, followed by parameters to insert into the format string (as with printf())
13545  *
13546  * A convenience function/macro to log a debug message.
13547  *
13548  * Since: 2.6
13549  */
13550
13551
13552 /**
13553  * g_dgettext:
13554  * @domain: (allow-none): the translation domain to use, or %NULL to use the domain set with textdomain()
13555  * @msgid: message to translate
13556  *
13557  * This function is a wrapper of dgettext() which does not translate
13558  * the message if the default domain as set with textdomain() has no
13559  * translations for the current locale.
13560  *
13561  * The advantage of using this function over dgettext() proper is that
13562  * libraries using this function (like GTK+) will not use translations
13563  * if the application using the library does not have translations for
13564  * the current locale.  This results in a consistent English-only
13565  * interface instead of one having partial translations.  For this
13566  * feature to work, the call to textdomain() and setlocale() should
13567  * precede any g_dgettext() invocations.  For GTK+, it means calling
13568  * textdomain() before gtk_init or its variants.
13569  *
13570  * This function disables translations if and only if upon its first
13571  * call all the following conditions hold:
13572  * <itemizedlist>
13573  * <listitem>@domain is not %NULL</listitem>
13574  * <listitem>textdomain() has been called to set a default text domain</listitem>
13575  * <listitem>there is no translations available for the default text domain
13576  *           and the current locale</listitem>
13577  * <listitem>current locale is not "C" or any English locales (those
13578  *           starting with "en_")</listitem>
13579  * </itemizedlist>
13580  *
13581  * Note that this behavior may not be desired for example if an application
13582  * has its untranslated messages in a language other than English.  In those
13583  * cases the application should call textdomain() after initializing GTK+.
13584  *
13585  * Applications should normally not use this function directly,
13586  * but use the _() macro for translations.
13587  *
13588  * Returns: The translated string
13589  * Since: 2.18
13590  */
13591
13592
13593 /**
13594  * g_dir_close:
13595  * @dir: a #GDir* created by g_dir_open()
13596  *
13597  * Closes the directory and deallocates all related resources.
13598  */
13599
13600
13601 /**
13602  * g_dir_make_tmp:
13603  * @tmpl: (type filename) (allow-none): Template for directory name, as in g_mkdtemp(), basename only, or %NULL for a default template
13604  * @error: return location for a #GError
13605  *
13606  * Creates a subdirectory in the preferred directory for temporary
13607  * files (as returned by g_get_tmp_dir()).
13608  *
13609  * @tmpl should be a string in the GLib file name encoding containing
13610  * a sequence of six 'X' characters, as the parameter to g_mkstemp().
13611  * However, unlike these functions, the template should only be a
13612  * basename, no directory components are allowed. If template is
13613  * %NULL, a default template is used.
13614  *
13615  * Note that in contrast to g_mkdtemp() (and mkdtemp()) @tmpl is not
13616  * modified, and might thus be a read-only literal string.
13617  *
13618  * Returns: (type filename): The actual name used. This string should be freed with g_free() when not needed any longer and is is in the GLib file name encoding. In case of errors, %NULL is returned and @error will be set.
13619  * Since: 2.30
13620  */
13621
13622
13623 /**
13624  * g_dir_open:
13625  * @path: the path to the directory you are interested in. On Unix in the on-disk encoding. On Windows in UTF-8
13626  * @flags: Currently must be set to 0. Reserved for future use.
13627  * @error: return location for a #GError, or %NULL. If non-%NULL, an error will be set if and only if g_dir_open() fails.
13628  *
13629  * Opens a directory for reading. The names of the files in the
13630  * directory can then be retrieved using g_dir_read_name().  Note
13631  * that the ordering is not defined.
13632  *
13633  * Returns: a newly allocated #GDir on success, %NULL on failure. If non-%NULL, you must free the result with g_dir_close() when you are finished with it.
13634  */
13635
13636
13637 /**
13638  * g_dir_read_name:
13639  * @dir: a #GDir* created by g_dir_open()
13640  *
13641  * Retrieves the name of another entry in the directory, or %NULL.
13642  * The order of entries returned from this function is not defined,
13643  * and may vary by file system or other operating-system dependent
13644  * factors.
13645  *
13646  * %NULL may also be returned in case of errors. On Unix, you can
13647  * check <literal>errno</literal> to find out if %NULL was returned
13648  * because of an error.
13649  *
13650  * On Unix, the '.' and '..' entries are omitted, and the returned
13651  * name is in the on-disk encoding.
13652  *
13653  * On Windows, as is true of all GLib functions which operate on
13654  * filenames, the returned name is in UTF-8.
13655  *
13656  * Returns: The entry's name or %NULL if there are no more entries. The return value is owned by GLib and must not be modified or freed.
13657  */
13658
13659
13660 /**
13661  * g_dir_rewind:
13662  * @dir: a #GDir* created by g_dir_open()
13663  *
13664  * Resets the given directory. The next call to g_dir_read_name()
13665  * will return the first entry again.
13666  */
13667
13668
13669 /**
13670  * g_direct_equal:
13671  * @v1: (allow-none): a key
13672  * @v2: (allow-none): a key to compare with @v1
13673  *
13674  * Compares two #gpointer arguments and returns %TRUE if they are equal.
13675  * It can be passed to g_hash_table_new() as the @key_equal_func
13676  * parameter, when using opaque pointers compared by pointer value as keys
13677  * in a #GHashTable.
13678  *
13679  * This equality function is also appropriate for keys that are integers stored
13680  * in pointers, such as <literal>GINT_TO_POINTER (n)</literal>.
13681  *
13682  * Returns: %TRUE if the two keys match.
13683  */
13684
13685
13686 /**
13687  * g_direct_hash:
13688  * @v: (allow-none): a #gpointer key
13689  *
13690  * Converts a gpointer to a hash value.
13691  * It can be passed to g_hash_table_new() as the @hash_func parameter,
13692  * when using opaque pointers compared by pointer value as keys in a
13693  * #GHashTable.
13694  *
13695  * This hash function is also appropriate for keys that are integers stored
13696  * in pointers, such as <literal>GINT_TO_POINTER (n)</literal>.
13697  *
13698  * Returns: a hash value corresponding to the key.
13699  */
13700
13701
13702 /**
13703  * g_dirname:
13704  * @file_name: the name of the file
13705  *
13706  * Gets the directory components of a file name.
13707  *
13708  * If the file name has no directory components "." is returned.
13709  * The returned string should be freed when no longer needed.
13710  *
13711  * Returns: the directory components of the file
13712  * Deprecated: use g_path_get_dirname() instead
13713  */
13714
13715
13716 /**
13717  * g_dngettext:
13718  * @domain: (allow-none): the translation domain to use, or %NULL to use the domain set with textdomain()
13719  * @msgid: message to translate
13720  * @msgid_plural: plural form of the message
13721  * @n: the quantity for which translation is needed
13722  *
13723  * This function is a wrapper of dngettext() which does not translate
13724  * the message if the default domain as set with textdomain() has no
13725  * translations for the current locale.
13726  *
13727  * See g_dgettext() for details of how this differs from dngettext()
13728  * proper.
13729  *
13730  * Returns: The translated string
13731  * Since: 2.18
13732  */
13733
13734
13735 /**
13736  * g_double_equal:
13737  * @v1: a pointer to a #gdouble key
13738  * @v2: a pointer to a #gdouble key to compare with @v1
13739  *
13740  * Compares the two #gdouble values being pointed to and returns
13741  * %TRUE if they are equal.
13742  * It can be passed to g_hash_table_new() as the @key_equal_func
13743  * parameter, when using non-%NULL pointers to doubles as keys in a
13744  * #GHashTable.
13745  *
13746  * Returns: %TRUE if the two keys match.
13747  * Since: 2.22
13748  */
13749
13750
13751 /**
13752  * g_double_hash:
13753  * @v: a pointer to a #gdouble key
13754  *
13755  * Converts a pointer to a #gdouble to a hash value.
13756  * It can be passed to g_hash_table_new() as the @hash_func parameter,
13757  * It can be passed to g_hash_table_new() as the @hash_func parameter,
13758  * when using non-%NULL pointers to doubles as keys in a #GHashTable.
13759  *
13760  * Returns: a hash value corresponding to the key.
13761  * Since: 2.22
13762  */
13763
13764
13765 /**
13766  * g_dpgettext:
13767  * @domain: (allow-none): the translation domain to use, or %NULL to use the domain set with textdomain()
13768  * @msgctxtid: a combined message context and message id, separated by a \004 character
13769  * @msgidoffset: the offset of the message id in @msgctxid
13770  *
13771  * This function is a variant of g_dgettext() which supports
13772  * a disambiguating message context. GNU gettext uses the
13773  * '\004' character to separate the message context and
13774  * message id in @msgctxtid.
13775  * If 0 is passed as @msgidoffset, this function will fall back to
13776  * trying to use the deprecated convention of using "|" as a separation
13777  * character.
13778  *
13779  * This uses g_dgettext() internally. See that functions for differences
13780  * with dgettext() proper.
13781  *
13782  * Applications should normally not use this function directly,
13783  * but use the C_() macro for translations with context.
13784  *
13785  * Returns: The translated string
13786  * Since: 2.16
13787  */
13788
13789
13790 /**
13791  * g_dpgettext2:
13792  * @domain: (allow-none): the translation domain to use, or %NULL to use the domain set with textdomain()
13793  * @context: the message context
13794  * @msgid: the message
13795  *
13796  * This function is a variant of g_dgettext() which supports
13797  * a disambiguating message context. GNU gettext uses the
13798  * '\004' character to separate the message context and
13799  * message id in @msgctxtid.
13800  *
13801  * This uses g_dgettext() internally. See that functions for differences
13802  * with dgettext() proper.
13803  *
13804  * This function differs from C_() in that it is not a macro and
13805  * thus you may use non-string-literals as context and msgid arguments.
13806  *
13807  * Returns: The translated string
13808  * Since: 2.18
13809  */
13810
13811
13812 /**
13813  * g_environ_getenv:
13814  * @envp: (allow-none) (array zero-terminated=1) (transfer none): an environment list (eg, as returned from g_get_environ()), or %NULL for an empty environment list
13815  * @variable: the environment variable to get, in the GLib file name encoding
13816  *
13817  * Returns the value of the environment variable @variable in the
13818  * provided list @envp.
13819  *
13820  * The name and value are in the GLib file name encoding.
13821  * On UNIX, this means the actual bytes which might or might not
13822  * be in some consistent character set and encoding. On Windows,
13823  * it is in UTF-8. On Windows, in case the environment variable's
13824  * value contains references to other environment variables, they
13825  * are expanded.
13826  *
13827  * Returns: the value of the environment variable, or %NULL if the environment variable is not set in @envp. The returned string is owned by @envp, and will be freed if @variable is set or unset again.
13828  * Since: 2.32
13829  */
13830
13831
13832 /**
13833  * g_environ_setenv:
13834  * @envp: (allow-none) (array zero-terminated=1) (transfer full): an environment list that can be freed using g_strfreev() (e.g., as returned from g_get_environ()), or %NULL for an empty environment list
13835  * @variable: the environment variable to set, must not contain '='
13836  * @value: the value for to set the variable to
13837  * @overwrite: whether to change the variable if it already exists
13838  *
13839  * Sets the environment variable @variable in the provided list
13840  * @envp to @value.
13841  *
13842  * Both the variable's name and value should be in the GLib
13843  * file name encoding. On UNIX, this means that they can be
13844  * arbitrary byte strings. On Windows, they should be in UTF-8.
13845  *
13846  * Returns: (array zero-terminated=1) (transfer full): the updated environment list. Free it using g_strfreev().
13847  * Since: 2.32
13848  */
13849
13850
13851 /**
13852  * g_environ_unsetenv:
13853  * @envp: (allow-none) (array zero-terminated=1) (transfer full): an environment list that can be freed using g_strfreev() (e.g., as returned from g_get_environ()), or %NULL for an empty environment list
13854  * @variable: the environment variable to remove, must not contain '='
13855  *
13856  * Removes the environment variable @variable from the provided
13857  * environment @envp.
13858  *
13859  * Returns: (array zero-terminated=1) (transfer full): the updated environment list. Free it using g_strfreev().
13860  * Since: 2.32
13861  */
13862
13863
13864 /**
13865  * g_error:
13866  * @...: format string, followed by parameters to insert into the format string (as with printf())
13867  *
13868  * A convenience function/macro to log an error message.
13869  *
13870  * Error messages are always fatal, resulting in a call to
13871  * abort() to terminate the application. This function will
13872  * result in a core dump; don't use it for errors you expect.
13873  * Using this function indicates a bug in your program, i.e.
13874  * an assertion failure.
13875  */
13876
13877
13878 /**
13879  * g_error_copy:
13880  * @error: a #GError
13881  *
13882  * Makes a copy of @error.
13883  *
13884  * Returns: a new #GError
13885  */
13886
13887
13888 /**
13889  * g_error_free:
13890  * @error: a #GError
13891  *
13892  * Frees a #GError and associated resources.
13893  */
13894
13895
13896 /**
13897  * g_error_matches:
13898  * @error: (allow-none): a #GError or %NULL
13899  * @domain: an error domain
13900  * @code: an error code
13901  *
13902  * Returns %TRUE if @error matches @domain and @code, %FALSE
13903  * otherwise. In particular, when @error is %NULL, %FALSE will
13904  * be returned.
13905  *
13906  * Returns: whether @error has @domain and @code
13907  */
13908
13909
13910 /**
13911  * g_error_new:
13912  * @domain: error domain
13913  * @code: error code
13914  * @format: printf()-style format for error message
13915  * @...: parameters for message format
13916  *
13917  * Creates a new #GError with the given @domain and @code,
13918  * and a message formatted with @format.
13919  *
13920  * Returns: a new #GError
13921  */
13922
13923
13924 /**
13925  * g_error_new_literal:
13926  * @domain: error domain
13927  * @code: error code
13928  * @message: error message
13929  *
13930  * Creates a new #GError; unlike g_error_new(), @message is
13931  * not a printf()-style format string. Use this function if
13932  * @message contains text you don't have control over,
13933  * that could include printf() escape sequences.
13934  *
13935  * Returns: a new #GError
13936  */
13937
13938
13939 /**
13940  * g_error_new_valist:
13941  * @domain: error domain
13942  * @code: error code
13943  * @format: printf()-style format for error message
13944  * @args: #va_list of parameters for the message format
13945  *
13946  * Creates a new #GError with the given @domain and @code,
13947  * and a message formatted with @format.
13948  *
13949  * Returns: a new #GError
13950  * Since: 2.22
13951  */
13952
13953
13954 /**
13955  * g_file_error_from_errno:
13956  * @err_no: an "errno" value
13957  *
13958  * Gets a #GFileError constant based on the passed-in @err_no.
13959  * For example, if you pass in <literal>EEXIST</literal> this function returns
13960  * #G_FILE_ERROR_EXIST. Unlike <literal>errno</literal> values, you can portably
13961  * assume that all #GFileError values will exist.
13962  *
13963  * Normally a #GFileError value goes into a #GError returned
13964  * from a function that manipulates files. So you would use
13965  * g_file_error_from_errno() when constructing a #GError.
13966  *
13967  * Returns: #GFileError corresponding to the given @errno
13968  */
13969
13970
13971 /**
13972  * g_file_get_contents:
13973  * @filename: (type filename): name of a file to read contents from, in the GLib file name encoding
13974  * @contents: (out) (array length=length) (element-type guint8): location to store an allocated string, use g_free() to free the returned string
13975  * @length: (allow-none): location to store length in bytes of the contents, or %NULL
13976  * @error: return location for a #GError, or %NULL
13977  *
13978  * Reads an entire file into allocated memory, with good error
13979  * checking.
13980  *
13981  * If the call was successful, it returns %TRUE and sets @contents to the file
13982  * contents and @length to the length of the file contents in bytes. The string
13983  * stored in @contents will be nul-terminated, so for text files you can pass
13984  * %NULL for the @length argument. If the call was not successful, it returns
13985  * %FALSE and sets @error. The error domain is #G_FILE_ERROR. Possible error
13986  * codes are those in the #GFileError enumeration. In the error case,
13987  * @contents is set to %NULL and @length is set to zero.
13988  *
13989  * Returns: %TRUE on success, %FALSE if an error occurred
13990  */
13991
13992
13993 /**
13994  * g_file_open_tmp:
13995  * @tmpl: (type filename) (allow-none): Template for file name, as in g_mkstemp(), basename only, or %NULL for a default template
13996  * @name_used: (out) (type filename): location to store actual name used, or %NULL
13997  * @error: return location for a #GError
13998  *
13999  * Opens a file for writing in the preferred directory for temporary
14000  * files (as returned by g_get_tmp_dir()).
14001  *
14002  * @tmpl should be a string in the GLib file name encoding containing
14003  * a sequence of six 'X' characters, as the parameter to g_mkstemp().
14004  * However, unlike these functions, the template should only be a
14005  * basename, no directory components are allowed. If template is
14006  * %NULL, a default template is used.
14007  *
14008  * Note that in contrast to g_mkstemp() (and mkstemp()) @tmpl is not
14009  * modified, and might thus be a read-only literal string.
14010  *
14011  * Upon success, and if @name_used is non-%NULL, the actual name used
14012  * is returned in @name_used. This string should be freed with g_free()
14013  * when not needed any longer. The returned name is in the GLib file
14014  * name encoding.
14015  *
14016  * Returns: A file handle (as from open()) to the file opened for reading and writing. The file is opened in binary mode on platforms where there is a difference. The file handle should be closed with close(). In case of errors, -1 is returned and @error will be set.
14017  */
14018
14019
14020 /**
14021  * g_file_read_link:
14022  * @filename: the symbolic link
14023  * @error: return location for a #GError
14024  *
14025  * Reads the contents of the symbolic link @filename like the POSIX
14026  * readlink() function.  The returned string is in the encoding used
14027  * for filenames. Use g_filename_to_utf8() to convert it to UTF-8.
14028  *
14029  * Returns: A newly-allocated string with the contents of the symbolic link, or %NULL if an error occurred.
14030  * Since: 2.4
14031  */
14032
14033
14034 /**
14035  * g_file_set_contents:
14036  * @filename: (type filename): name of a file to write @contents to, in the GLib file name encoding
14037  * @contents: (array length=length) (element-type guint8): string to write to the file
14038  * @length: length of @contents, or -1 if @contents is a nul-terminated string
14039  * @error: return location for a #GError, or %NULL
14040  *
14041  * Writes all of @contents to a file named @filename, with good error checking.
14042  * If a file called @filename already exists it will be overwritten.
14043  *
14044  * This write is atomic in the sense that it is first written to a temporary
14045  * file which is then renamed to the final name. Notes:
14046  * <itemizedlist>
14047  * <listitem>
14048  *    On Unix, if @filename already exists hard links to @filename will break.
14049  *    Also since the file is recreated, existing permissions, access control
14050  *    lists, metadata etc. may be lost. If @filename is a symbolic link,
14051  *    the link itself will be replaced, not the linked file.
14052  * </listitem>
14053  * <listitem>
14054  *   On Windows renaming a file will not remove an existing file with the
14055  *   new name, so on Windows there is a race condition between the existing
14056  *   file being removed and the temporary file being renamed.
14057  * </listitem>
14058  * <listitem>
14059  *   On Windows there is no way to remove a file that is open to some
14060  *   process, or mapped into memory. Thus, this function will fail if
14061  *   @filename already exists and is open.
14062  * </listitem>
14063  * </itemizedlist>
14064  *
14065  * If the call was successful, it returns %TRUE. If the call was not successful,
14066  * it returns %FALSE and sets @error. The error domain is #G_FILE_ERROR.
14067  * Possible error codes are those in the #GFileError enumeration.
14068  *
14069  * Note that the name for the temporary file is constructed by appending up
14070  * to 7 characters to @filename.
14071  *
14072  * Returns: %TRUE on success, %FALSE if an error occurred
14073  * Since: 2.8
14074  */
14075
14076
14077 /**
14078  * g_file_test:
14079  * @filename: a filename to test in the GLib file name encoding
14080  * @test: bitfield of #GFileTest flags
14081  *
14082  * Returns %TRUE if any of the tests in the bitfield @test are
14083  * %TRUE. For example, <literal>(G_FILE_TEST_EXISTS |
14084  * G_FILE_TEST_IS_DIR)</literal> will return %TRUE if the file exists;
14085  * the check whether it's a directory doesn't matter since the existence
14086  * test is %TRUE. With the current set of available tests, there's no point
14087  * passing in more than one test at a time.
14088  *
14089  * Apart from %G_FILE_TEST_IS_SYMLINK all tests follow symbolic links,
14090  * so for a symbolic link to a regular file g_file_test() will return
14091  * %TRUE for both %G_FILE_TEST_IS_SYMLINK and %G_FILE_TEST_IS_REGULAR.
14092  *
14093  * Note, that for a dangling symbolic link g_file_test() will return
14094  * %TRUE for %G_FILE_TEST_IS_SYMLINK and %FALSE for all other flags.
14095  *
14096  * You should never use g_file_test() to test whether it is safe
14097  * to perform an operation, because there is always the possibility
14098  * of the condition changing before you actually perform the operation.
14099  * For example, you might think you could use %G_FILE_TEST_IS_SYMLINK
14100  * to know whether it is safe to write to a file without being
14101  * tricked into writing into a different location. It doesn't work!
14102  * |[
14103  * /&ast; DON'T DO THIS &ast;/
14104  *  if (!g_file_test (filename, G_FILE_TEST_IS_SYMLINK))
14105  *    {
14106  *      fd = g_open (filename, O_WRONLY);
14107  *      /&ast; write to fd &ast;/
14108  *    }
14109  * ]|
14110  *
14111  * Another thing to note is that %G_FILE_TEST_EXISTS and
14112  * %G_FILE_TEST_IS_EXECUTABLE are implemented using the access()
14113  * system call. This usually doesn't matter, but if your program
14114  * is setuid or setgid it means that these tests will give you
14115  * the answer for the real user ID and group ID, rather than the
14116  * effective user ID and group ID.
14117  *
14118  * On Windows, there are no symlinks, so testing for
14119  * %G_FILE_TEST_IS_SYMLINK will always return %FALSE. Testing for
14120  * %G_FILE_TEST_IS_EXECUTABLE will just check that the file exists and
14121  * its name indicates that it is executable, checking for well-known
14122  * extensions and those listed in the <envar>PATHEXT</envar> environment variable.
14123  *
14124  * Returns: whether a test was %TRUE
14125  */
14126
14127
14128 /**
14129  * g_filename_display_basename:
14130  * @filename: an absolute pathname in the GLib file name encoding
14131  *
14132  * Returns the display basename for the particular filename, guaranteed
14133  * to be valid UTF-8. The display name might not be identical to the filename,
14134  * for instance there might be problems converting it to UTF-8, and some files
14135  * can be translated in the display.
14136  *
14137  * If GLib cannot make sense of the encoding of @filename, as a last resort it
14138  * replaces unknown characters with U+FFFD, the Unicode replacement character.
14139  * You can search the result for the UTF-8 encoding of this character (which is
14140  * "\357\277\275" in octal notation) to find out if @filename was in an invalid
14141  * encoding.
14142  *
14143  * You must pass the whole absolute pathname to this functions so that
14144  * translation of well known locations can be done.
14145  *
14146  * This function is preferred over g_filename_display_name() if you know the
14147  * whole path, as it allows translation.
14148  *
14149  * Returns: a newly allocated string containing a rendition of the basename of the filename in valid UTF-8
14150  * Since: 2.6
14151  */
14152
14153
14154 /**
14155  * g_filename_display_name:
14156  * @filename: a pathname hopefully in the GLib file name encoding
14157  *
14158  * Converts a filename into a valid UTF-8 string. The conversion is
14159  * not necessarily reversible, so you should keep the original around
14160  * and use the return value of this function only for display purposes.
14161  * Unlike g_filename_to_utf8(), the result is guaranteed to be non-%NULL
14162  * even if the filename actually isn't in the GLib file name encoding.
14163  *
14164  * If GLib cannot make sense of the encoding of @filename, as a last resort it
14165  * replaces unknown characters with U+FFFD, the Unicode replacement character.
14166  * You can search the result for the UTF-8 encoding of this character (which is
14167  * "\357\277\275" in octal notation) to find out if @filename was in an invalid
14168  * encoding.
14169  *
14170  * If you know the whole pathname of the file you should use
14171  * g_filename_display_basename(), since that allows location-based
14172  * translation of filenames.
14173  *
14174  * Returns: a newly allocated string containing a rendition of the filename in valid UTF-8
14175  * Since: 2.6
14176  */
14177
14178
14179 /**
14180  * g_filename_from_uri:
14181  * @uri: a uri describing a filename (escaped, encoded in ASCII).
14182  * @hostname: (out) (allow-none): Location to store hostname for the URI, or %NULL. If there is no hostname in the URI, %NULL will be stored in this location.
14183  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError may occur.
14184  *
14185  * Converts an escaped ASCII-encoded URI to a local filename in the
14186  * encoding used for filenames.
14187  *
14188  * Returns: (type filename): a newly-allocated string holding the resulting filename, or %NULL on an error.
14189  */
14190
14191
14192 /**
14193  * g_filename_from_utf8:
14194  * @utf8string: a UTF-8 encoded string.
14195  * @len: the length of the string, or -1 if the string is nul-terminated.
14196  * @bytes_read: (out) (allow-none): location to store the number of bytes in the input string that were successfully converted, or %NULL. Even if the conversion was successful, this may be less than @len if there were partial characters at the end of the input. If the error #G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will the byte offset after the last valid input sequence.
14197  * @bytes_written: (out): the number of bytes stored in the output buffer (not including the terminating nul).
14198  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError may occur.
14199  *
14200  * Converts a string from UTF-8 to the encoding GLib uses for
14201  * filenames. Note that on Windows GLib uses UTF-8 for filenames;
14202  * on other platforms, this function indirectly depends on the
14203  * <link linkend="setlocale">current locale</link>.
14204  *
14205  * Returns: (array length=bytes_written) (element-type guint8) (transfer full): The converted string, or %NULL on an error.
14206  */
14207
14208
14209 /**
14210  * g_filename_to_uri:
14211  * @filename: an absolute filename specified in the GLib file name encoding, which is the on-disk file name bytes on Unix, and UTF-8 on Windows
14212  * @hostname: (allow-none): A UTF-8 encoded hostname, or %NULL for none.
14213  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError may occur.
14214  *
14215  * Converts an absolute filename to an escaped ASCII-encoded URI, with the path
14216  * component following Section 3.3. of RFC 2396.
14217  *
14218  * Returns: a newly-allocated string holding the resulting URI, or %NULL on an error.
14219  */
14220
14221
14222 /**
14223  * g_filename_to_utf8:
14224  * @opsysstring: a string in the encoding for filenames
14225  * @len: the length of the string, or -1 if the string is nul-terminated<footnoteref linkend="nul-unsafe"/>.
14226  * @bytes_read: location to store the number of bytes in the input string that were successfully converted, or %NULL. Even if the conversion was successful, this may be less than @len if there were partial characters at the end of the input. If the error #G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will the byte offset after the last valid input sequence.
14227  * @bytes_written: the number of bytes stored in the output buffer (not including the terminating nul).
14228  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError may occur.
14229  *
14230  * Converts a string which is in the encoding used by GLib for
14231  * filenames into a UTF-8 string. Note that on Windows GLib uses UTF-8
14232  * for filenames; on other platforms, this function indirectly depends on
14233  * the <link linkend="setlocale">current locale</link>.
14234  *
14235  * Returns: The converted string, or %NULL on an error.
14236  */
14237
14238
14239 /**
14240  * g_find_program_in_path:
14241  * @program: a program name in the GLib file name encoding
14242  *
14243  * Locates the first executable named @program in the user's path, in the
14244  * same way that execvp() would locate it. Returns an allocated string
14245  * with the absolute path name, or %NULL if the program is not found in
14246  * the path. If @program is already an absolute path, returns a copy of
14247  * @program if @program exists and is executable, and %NULL otherwise.
14248  *
14249  * On Windows, if @program does not have a file type suffix, tries
14250  * with the suffixes .exe, .cmd, .bat and .com, and the suffixes in
14251  * the <envar>PATHEXT</envar> environment variable.
14252  *
14253  * On Windows, it looks for the file in the same way as CreateProcess()
14254  * would. This means first in the directory where the executing
14255  * program was loaded from, then in the current directory, then in the
14256  * Windows 32-bit system directory, then in the Windows directory, and
14257  * finally in the directories in the <envar>PATH</envar> environment
14258  * variable. If the program is found, the return value contains the
14259  * full name including the type suffix.
14260  *
14261  * Returns: a newly-allocated string with the absolute path, or %NULL
14262  */
14263
14264
14265 /**
14266  * g_fopen:
14267  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
14268  * @mode: a string describing the mode in which the file should be opened
14269  *
14270  * A wrapper for the stdio fopen() function. The fopen() function
14271  * opens a file and associates a new stream with it.
14272  *
14273  * Because file descriptors are specific to the C library on Windows,
14274  * and a file descriptor is partof the <type>FILE</type> struct, the
14275  * <type>FILE</type> pointer returned by this function makes sense
14276  * only to functions in the same C library. Thus if the GLib-using
14277  * code uses a different C library than GLib does, the
14278  * <type>FILE</type> pointer returned by this function cannot be
14279  * passed to C library functions like fprintf() or fread().
14280  *
14281  * See your C library manual for more details about fopen().
14282  *
14283  * Returns: A <type>FILE</type> pointer if the file was successfully opened, or %NULL if an error occurred
14284  * Since: 2.6
14285  */
14286
14287
14288 /**
14289  * g_format_size:
14290  * @size: a size in bytes
14291  *
14292  * Formats a size (for example the size of a file) into a human readable
14293  * string.  Sizes are rounded to the nearest size prefix (kB, MB, GB)
14294  * and are displayed rounded to the nearest tenth. E.g. the file size
14295  * 3292528 bytes will be converted into the string "3.2 MB".
14296  *
14297  * The prefix units base is 1000 (i.e. 1 kB is 1000 bytes).
14298  *
14299  * This string should be freed with g_free() when not needed any longer.
14300  *
14301  * See g_format_size_full() for more options about how the size might be
14302  * formatted.
14303  *
14304  * Returns: a newly-allocated formatted string containing a human readable file size
14305  * Since: 2.30
14306  */
14307
14308
14309 /**
14310  * g_format_size_for_display:
14311  * @size: a size in bytes
14312  *
14313  * Formats a size (for example the size of a file) into a human
14314  * readable string. Sizes are rounded to the nearest size prefix
14315  * (KB, MB, GB) and are displayed rounded to the nearest tenth.
14316  * E.g. the file size 3292528 bytes will be converted into the
14317  * string "3.1 MB".
14318  *
14319  * The prefix units base is 1024 (i.e. 1 KB is 1024 bytes).
14320  *
14321  * This string should be freed with g_free() when not needed any longer.
14322  *
14323  * Returns: a newly-allocated formatted string containing a human readable file size
14324  * Since: 2.16
14325  * Deprecated: 2.30: This function is broken due to its use of SI suffixes to denote IEC units. Use g_format_size() instead.
14326  */
14327
14328
14329 /**
14330  * g_format_size_full:
14331  * @size: a size in bytes
14332  * @flags: #GFormatSizeFlags to modify the output
14333  *
14334  * Formats a size.
14335  *
14336  * This function is similar to g_format_size() but allows for flags
14337  * that modify the output. See #GFormatSizeFlags.
14338  *
14339  * Returns: a newly-allocated formatted string containing a human readable file size
14340  * Since: 2.30
14341  */
14342
14343
14344 /**
14345  * g_fprintf:
14346  * @file: the stream to write to.
14347  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
14348  * @...: the arguments to insert in the output.
14349  *
14350  * An implementation of the standard fprintf() function which supports
14351  * positional parameters, as specified in the Single Unix Specification.
14352  *
14353  * Returns: the number of bytes printed.
14354  * Since: 2.2
14355  */
14356
14357
14358 /**
14359  * g_free:
14360  * @mem: the memory to free
14361  *
14362  * Frees the memory pointed to by @mem.
14363  * If @mem is %NULL it simply returns.
14364  */
14365
14366
14367 /**
14368  * g_freopen:
14369  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
14370  * @mode: a string describing the mode in which the file should be opened
14371  * @stream: (allow-none): an existing stream which will be reused, or %NULL
14372  *
14373  * A wrapper for the POSIX freopen() function. The freopen() function
14374  * opens a file and associates it with an existing stream.
14375  *
14376  * See your C library manual for more details about freopen().
14377  *
14378  * Returns: A <literal>FILE</literal> pointer if the file was successfully opened, or %NULL if an error occurred.
14379  * Since: 2.6
14380  */
14381
14382
14383 /**
14384  * g_get_application_name:
14385  *
14386  * Gets a human-readable name for the application, as set by
14387  * g_set_application_name(). This name should be localized if
14388  * possible, and is intended for display to the user.  Contrast with
14389  * g_get_prgname(), which gets a non-localized name. If
14390  * g_set_application_name() has not been called, returns the result of
14391  * g_get_prgname() (which may be %NULL if g_set_prgname() has also not
14392  * been called).
14393  *
14394  * Returns: human-readable application name. may return %NULL
14395  * Since: 2.2
14396  */
14397
14398
14399 /**
14400  * g_get_charset:
14401  * @charset: return location for character set name
14402  *
14403  * Obtains the character set for the <link linkend="setlocale">current
14404  * locale</link>; you might use this character set as an argument to
14405  * g_convert(), to convert from the current locale's encoding to some
14406  * other encoding. (Frequently g_locale_to_utf8() and g_locale_from_utf8()
14407  * are nice shortcuts, though.)
14408  *
14409  * On Windows the character set returned by this function is the
14410  * so-called system default ANSI code-page. That is the character set
14411  * used by the "narrow" versions of C library and Win32 functions that
14412  * handle file names. It might be different from the character set
14413  * used by the C library's current locale.
14414  *
14415  * The return value is %TRUE if the locale's encoding is UTF-8, in that
14416  * case you can perhaps avoid calling g_convert().
14417  *
14418  * The string returned in @charset is not allocated, and should not be
14419  * freed.
14420  *
14421  * Returns: %TRUE if the returned charset is UTF-8
14422  */
14423
14424
14425 /**
14426  * g_get_codeset:
14427  *
14428  * Gets the character set for the current locale.
14429  *
14430  * Returns: a newly allocated string containing the name of the character set. This string must be freed with g_free().
14431  */
14432
14433
14434 /**
14435  * g_get_current_dir:
14436  *
14437  * Gets the current directory.
14438  *
14439  * The returned string should be freed when no longer needed.
14440  * The encoding of the returned string is system defined.
14441  * On Windows, it is always UTF-8.
14442  *
14443  * Returns: the current directory
14444  */
14445
14446
14447 /**
14448  * g_get_current_time:
14449  * @result: #GTimeVal structure in which to store current time.
14450  *
14451  * Equivalent to the UNIX gettimeofday() function, but portable.
14452  *
14453  * You may find g_get_real_time() to be more convenient.
14454  */
14455
14456
14457 /**
14458  * g_get_environ:
14459  *
14460  * Gets the list of environment variables for the current process.
14461  *
14462  * The list is %NULL terminated and each item in the list is of the
14463  * form 'NAME=VALUE'.
14464  *
14465  * This is equivalent to direct access to the 'environ' global variable,
14466  * except portable.
14467  *
14468  * The return value is freshly allocated and it should be freed with
14469  * g_strfreev() when it is no longer needed.
14470  *
14471  * Returns: (array zero-terminated=1) (transfer full): the list of environment variables
14472  * Since: 2.28
14473  */
14474
14475
14476 /**
14477  * g_get_filename_charsets:
14478  * @charsets: return location for the %NULL-terminated list of encoding names
14479  *
14480  * Determines the preferred character sets used for filenames.
14481  * The first character set from the @charsets is the filename encoding, the
14482  * subsequent character sets are used when trying to generate a displayable
14483  * representation of a filename, see g_filename_display_name().
14484  *
14485  * On Unix, the character sets are determined by consulting the
14486  * environment variables <envar>G_FILENAME_ENCODING</envar> and
14487  * <envar>G_BROKEN_FILENAMES</envar>. On Windows, the character set
14488  * used in the GLib API is always UTF-8 and said environment variables
14489  * have no effect.
14490  *
14491  * <envar>G_FILENAME_ENCODING</envar> may be set to a comma-separated list
14492  * of character set names. The special token "&commat;locale" is taken to
14493  * mean the character set for the <link linkend="setlocale">current
14494  * locale</link>. If <envar>G_FILENAME_ENCODING</envar> is not set, but
14495  * <envar>G_BROKEN_FILENAMES</envar> is, the character set of the current
14496  * locale is taken as the filename encoding. If neither environment variable
14497  * is set, UTF-8 is taken as the filename encoding, but the character
14498  * set of the current locale is also put in the list of encodings.
14499  *
14500  * The returned @charsets belong to GLib and must not be freed.
14501  *
14502  * Note that on Unix, regardless of the locale character set or
14503  * <envar>G_FILENAME_ENCODING</envar> value, the actual file names present
14504  * on a system might be in any random encoding or just gibberish.
14505  *
14506  * Returns: %TRUE if the filename encoding is UTF-8.
14507  * Since: 2.6
14508  */
14509
14510
14511 /**
14512  * g_get_home_dir:
14513  *
14514  * Gets the current user's home directory as defined in the
14515  * password database.
14516  *
14517  * Note that in contrast to traditional UNIX tools, this function
14518  * prefers <filename>passwd</filename> entries over the <envar>HOME</envar>
14519  * environment variable.
14520  *
14521  * One of the reasons for this decision is that applications in many
14522  * cases need special handling to deal with the case where
14523  * <envar>HOME</envar> is
14524  * <simplelist>
14525  *   <member>Not owned by the user</member>
14526  *   <member>Not writeable</member>
14527  *   <member>Not even readable</member>
14528  * </simplelist>
14529  * Since applications are in general <emphasis>not</emphasis> written
14530  * to deal with these situations it was considered better to make
14531  * g_get_home_dir() not pay attention to <envar>HOME</envar> and to
14532  * return the real home directory for the user. If applications
14533  * want to pay attention to <envar>HOME</envar>, they can do:
14534  * |[
14535  *  const char *homedir = g_getenv ("HOME");
14536  *   if (!homedir)
14537  *      homedir = g_get_home_dir (<!-- -->);
14538  * ]|
14539  *
14540  * Returns: the current user's home directory
14541  */
14542
14543
14544 /**
14545  * g_get_host_name:
14546  *
14547  * Return a name for the machine.
14548  *
14549  * The returned name is not necessarily a fully-qualified domain name,
14550  * or even present in DNS or some other name service at all. It need
14551  * not even be unique on your local network or site, but usually it
14552  * is. Callers should not rely on the return value having any specific
14553  * properties like uniqueness for security purposes. Even if the name
14554  * of the machine is changed while an application is running, the
14555  * return value from this function does not change. The returned
14556  * string is owned by GLib and should not be modified or freed. If no
14557  * name can be determined, a default fixed string "localhost" is
14558  * returned.
14559  *
14560  * Returns: the host name of the machine.
14561  * Since: 2.8
14562  */
14563
14564
14565 /**
14566  * g_get_language_names:
14567  *
14568  * Computes a list of applicable locale names, which can be used to
14569  * e.g. construct locale-dependent filenames or search paths. The returned
14570  * list is sorted from most desirable to least desirable and always contains
14571  * the default locale "C".
14572  *
14573  * For example, if LANGUAGE=de:en_US, then the returned list is
14574  * "de", "en_US", "en", "C".
14575  *
14576  * This function consults the environment variables <envar>LANGUAGE</envar>,
14577  * <envar>LC_ALL</envar>, <envar>LC_MESSAGES</envar> and <envar>LANG</envar>
14578  * to find the list of locales specified by the user.
14579  *
14580  * Returns: (array zero-terminated=1) (transfer none): a %NULL-terminated array of strings owned by GLib that must not be modified or freed.
14581  * Since: 2.6
14582  */
14583
14584
14585 /**
14586  * g_get_locale_variants:
14587  * @locale: a locale identifier
14588  *
14589  * Returns a list of derived variants of @locale, which can be used to
14590  * e.g. construct locale-dependent filenames or search paths. The returned
14591  * list is sorted from most desirable to least desirable.
14592  * This function handles territory, charset and extra locale modifiers.
14593  *
14594  * For example, if @locale is "fr_BE", then the returned list
14595  * is "fr_BE", "fr".
14596  *
14597  * If you need the list of variants for the <emphasis>current locale</emphasis>,
14598  * use g_get_language_names().
14599  *
14600  * Returns: (transfer full) (array zero-terminated=1) (element-type utf8): a newly allocated array of newly allocated strings with the locale variants. Free with g_strfreev().
14601  * Since: 2.28
14602  */
14603
14604
14605 /**
14606  * g_get_monotonic_time:
14607  *
14608  * Queries the system monotonic time, if available.
14609  *
14610  * On POSIX systems with clock_gettime() and <literal>CLOCK_MONOTONIC</literal> this call
14611  * is a very shallow wrapper for that.  Otherwise, we make a best effort
14612  * that probably involves returning the wall clock time (with at least
14613  * microsecond accuracy, subject to the limitations of the OS kernel).
14614  *
14615  * It's important to note that POSIX <literal>CLOCK_MONOTONIC</literal> does
14616  * not count time spent while the machine is suspended.
14617  *
14618  * On Windows, "limitations of the OS kernel" is a rather substantial
14619  * statement.  Depending on the configuration of the system, the wall
14620  * clock time is updated as infrequently as 64 times a second (which
14621  * is approximately every 16ms). Also, on XP (but not on Vista or later)
14622  * the monotonic clock is locally monotonic, but may differ in exact
14623  * value between processes due to timer wrap handling.
14624  *
14625  * Returns: the monotonic time, in microseconds
14626  * Since: 2.28
14627  */
14628
14629
14630 /**
14631  * g_get_prgname:
14632  *
14633  * Gets the name of the program. This name should <emphasis>not</emphasis>
14634  * be localized, contrast with g_get_application_name().
14635  * (If you are using GDK or GTK+ the program name is set in gdk_init(),
14636  * which is called by gtk_init(). The program name is found by taking
14637  * the last component of <literal>argv[0]</literal>.)
14638  *
14639  * Returns: the name of the program. The returned string belongs to GLib and must not be modified or freed.
14640  */
14641
14642
14643 /**
14644  * g_get_real_name:
14645  *
14646  * Gets the real name of the user. This usually comes from the user's entry
14647  * in the <filename>passwd</filename> file. The encoding of the returned
14648  * string is system-defined. (On Windows, it is, however, always UTF-8.)
14649  * If the real user name cannot be determined, the string "Unknown" is
14650  * returned.
14651  *
14652  * Returns: the user's real name.
14653  */
14654
14655
14656 /**
14657  * g_get_real_time:
14658  *
14659  * Queries the system wall-clock time.
14660  *
14661  * This call is functionally equivalent to g_get_current_time() except
14662  * that the return value is often more convenient than dealing with a
14663  * #GTimeVal.
14664  *
14665  * You should only use this call if you are actually interested in the real
14666  * wall-clock time.  g_get_monotonic_time() is probably more useful for
14667  * measuring intervals.
14668  *
14669  * Returns: the number of microseconds since January 1, 1970 UTC.
14670  * Since: 2.28
14671  */
14672
14673
14674 /**
14675  * g_get_system_config_dirs:
14676  *
14677  * Returns an ordered list of base directories in which to access
14678  * system-wide configuration information.
14679  *
14680  * On UNIX platforms this is determined using the mechanisms described in
14681  * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
14682  * XDG Base Directory Specification</ulink>.
14683  * In this case the list of directories retrieved will be XDG_CONFIG_DIRS.
14684  *
14685  * On Windows is the directory that contains application data for all users.
14686  * A typical path is C:\Documents and Settings\All Users\Application Data.
14687  * This folder is used for application data that is not user specific.
14688  * For example, an application can store a spell-check dictionary, a database
14689  * of clip art, or a log file in the CSIDL_COMMON_APPDATA folder.
14690  * This information will not roam and is available to anyone using the computer.
14691  *
14692  * Returns: (array zero-terminated=1) (transfer none): a %NULL-terminated array of strings owned by GLib that must not be modified or freed.
14693  * Since: 2.6
14694  */
14695
14696
14697 /**
14698  * g_get_system_data_dirs:
14699  *
14700  * Returns an ordered list of base directories in which to access
14701  * system-wide application data.
14702  *
14703  * On UNIX platforms this is determined using the mechanisms described in
14704  * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
14705  * XDG Base Directory Specification</ulink>
14706  * In this case the list of directories retrieved will be XDG_DATA_DIRS.
14707  *
14708  * On Windows the first elements in the list are the Application Data
14709  * and Documents folders for All Users. (These can be determined only
14710  * on Windows 2000 or later and are not present in the list on other
14711  * Windows versions.) See documentation for CSIDL_COMMON_APPDATA and
14712  * CSIDL_COMMON_DOCUMENTS.
14713  *
14714  * Then follows the "share" subfolder in the installation folder for
14715  * the package containing the DLL that calls this function, if it can
14716  * be determined.
14717  *
14718  * Finally the list contains the "share" subfolder in the installation
14719  * folder for GLib, and in the installation folder for the package the
14720  * application's .exe file belongs to.
14721  *
14722  * The installation folders above are determined by looking up the
14723  * folder where the module (DLL or EXE) in question is located. If the
14724  * folder's name is "bin", its parent is used, otherwise the folder
14725  * itself.
14726  *
14727  * Note that on Windows the returned list can vary depending on where
14728  * this function is called.
14729  *
14730  * Returns: (array zero-terminated=1) (transfer none): a %NULL-terminated array of strings owned by GLib that must not be modified or freed.
14731  * Since: 2.6
14732  */
14733
14734
14735 /**
14736  * g_get_tmp_dir:
14737  *
14738  * Gets the directory to use for temporary files. This is found from
14739  * inspecting the environment variables <envar>TMPDIR</envar>,
14740  * <envar>TMP</envar>, and <envar>TEMP</envar> in that order. If none
14741  * of those are defined "/tmp" is returned on UNIX and "C:\" on Windows.
14742  * The encoding of the returned string is system-defined. On Windows,
14743  * it is always UTF-8. The return value is never %NULL or the empty string.
14744  *
14745  * Returns: the directory to use for temporary files.
14746  */
14747
14748
14749 /**
14750  * g_get_user_cache_dir:
14751  *
14752  * Returns a base directory in which to store non-essential, cached
14753  * data specific to particular user.
14754  *
14755  * On UNIX platforms this is determined using the mechanisms described in
14756  * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
14757  * XDG Base Directory Specification</ulink>.
14758  * In this case the directory retrieved will be XDG_CACHE_HOME.
14759  *
14760  * On Windows is the directory that serves as a common repository for
14761  * temporary Internet files. A typical path is
14762  * C:\Documents and Settings\username\Local Settings\Temporary Internet Files.
14763  * See documentation for CSIDL_INTERNET_CACHE.
14764  *
14765  * Returns: a string owned by GLib that must not be modified or freed.
14766  * Since: 2.6
14767  */
14768
14769
14770 /**
14771  * g_get_user_config_dir:
14772  *
14773  * Returns a base directory in which to store user-specific application
14774  * configuration information such as user preferences and settings.
14775  *
14776  * On UNIX platforms this is determined using the mechanisms described in
14777  * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
14778  * XDG Base Directory Specification</ulink>.
14779  * In this case the directory retrieved will be XDG_CONFIG_HOME.
14780  *
14781  * On Windows this is the folder to use for local (as opposed to
14782  * roaming) application data. See documentation for
14783  * CSIDL_LOCAL_APPDATA. Note that on Windows it thus is the same as
14784  * what g_get_user_data_dir() returns.
14785  *
14786  * Returns: a string owned by GLib that must not be modified or freed.
14787  * Since: 2.6
14788  */
14789
14790
14791 /**
14792  * g_get_user_data_dir:
14793  *
14794  * Returns a base directory in which to access application data such
14795  * as icons that is customized for a particular user.
14796  *
14797  * On UNIX platforms this is determined using the mechanisms described in
14798  * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
14799  * XDG Base Directory Specification</ulink>.
14800  * In this case the directory retrieved will be XDG_DATA_HOME.
14801  *
14802  * On Windows this is the folder to use for local (as opposed to
14803  * roaming) application data. See documentation for
14804  * CSIDL_LOCAL_APPDATA. Note that on Windows it thus is the same as
14805  * what g_get_user_config_dir() returns.
14806  *
14807  * Returns: a string owned by GLib that must not be modified or freed.
14808  * Since: 2.6
14809  */
14810
14811
14812 /**
14813  * g_get_user_name:
14814  *
14815  * Gets the user name of the current user. The encoding of the returned
14816  * string is system-defined. On UNIX, it might be the preferred file name
14817  * encoding, or something else, and there is no guarantee that it is even
14818  * consistent on a machine. On Windows, it is always UTF-8.
14819  *
14820  * Returns: the user name of the current user.
14821  */
14822
14823
14824 /**
14825  * g_get_user_runtime_dir:
14826  *
14827  * Returns a directory that is unique to the current user on the local
14828  * system.
14829  *
14830  * On UNIX platforms this is determined using the mechanisms described in
14831  * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
14832  * XDG Base Directory Specification</ulink>.  This is the directory
14833  * specified in the <envar>XDG_RUNTIME_DIR</envar> environment variable.
14834  * In the case that this variable is not set, GLib will issue a warning
14835  * message to stderr and return the value of g_get_user_cache_dir().
14836  *
14837  * On Windows this is the folder to use for local (as opposed to
14838  * roaming) application data. See documentation for
14839  * CSIDL_LOCAL_APPDATA.  Note that on Windows it thus is the same as
14840  * what g_get_user_config_dir() returns.
14841  *
14842  * Returns: a string owned by GLib that must not be modified or freed.
14843  * Since: 2.28
14844  */
14845
14846
14847 /**
14848  * g_get_user_special_dir:
14849  * @directory: the logical id of special directory
14850  *
14851  * Returns the full path of a special directory using its logical id.
14852  *
14853  * On Unix this is done using the XDG special user directories.
14854  * For compatibility with existing practise, %G_USER_DIRECTORY_DESKTOP
14855  * falls back to <filename>$HOME/Desktop</filename> when XDG special
14856  * user directories have not been set up.
14857  *
14858  * Depending on the platform, the user might be able to change the path
14859  * of the special directory without requiring the session to restart; GLib
14860  * will not reflect any change once the special directories are loaded.
14861  *
14862  * Returns: the path to the specified special directory, or %NULL if the logical id was not found. The returned string is owned by GLib and should not be modified or freed.
14863  * Since: 2.14
14864  */
14865
14866
14867 /**
14868  * g_getenv:
14869  * @variable: the environment variable to get, in the GLib file name encoding
14870  *
14871  * Returns the value of an environment variable.
14872  *
14873  * The name and value are in the GLib file name encoding. On UNIX,
14874  * this means the actual bytes which might or might not be in some
14875  * consistent character set and encoding. On Windows, it is in UTF-8.
14876  * On Windows, in case the environment variable's value contains
14877  * references to other environment variables, they are expanded.
14878  *
14879  * Returns: the value of the environment variable, or %NULL if the environment variable is not found. The returned string may be overwritten by the next call to g_getenv(), g_setenv() or g_unsetenv().
14880  */
14881
14882
14883 /**
14884  * g_hash_table_add:
14885  * @hash_table: a #GHashTable
14886  * @key: a key to insert
14887  *
14888  * This is a convenience function for using a #GHashTable as a set.  It
14889  * is equivalent to calling g_hash_table_replace() with @key as both the
14890  * key and the value.
14891  *
14892  * When a hash table only ever contains keys that have themselves as the
14893  * corresponding value it is able to be stored more efficiently.  See
14894  * the discussion in the section description.
14895  *
14896  * Since: 2.32
14897  */
14898
14899
14900 /**
14901  * g_hash_table_contains:
14902  * @hash_table: a #GHashTable
14903  * @key: a key to check
14904  *
14905  * Checks if @key is in @hash_table.
14906  *
14907  * Since: 2.32
14908  */
14909
14910
14911 /**
14912  * g_hash_table_destroy:
14913  * @hash_table: a #GHashTable
14914  *
14915  * Destroys all keys and values in the #GHashTable and decrements its
14916  * reference count by 1. If keys and/or values are dynamically allocated,
14917  * you should either free them first or create the #GHashTable with destroy
14918  * notifiers using g_hash_table_new_full(). In the latter case the destroy
14919  * functions you supplied will be called on all keys and values during the
14920  * destruction phase.
14921  */
14922
14923
14924 /**
14925  * g_hash_table_find:
14926  * @hash_table: a #GHashTable
14927  * @predicate: function to test the key/value pairs for a certain property
14928  * @user_data: user data to pass to the function
14929  *
14930  * Calls the given function for key/value pairs in the #GHashTable
14931  * until @predicate returns %TRUE. The function is passed the key
14932  * and value of each pair, and the given @user_data parameter. The
14933  * hash table may not be modified while iterating over it (you can't
14934  * add/remove items).
14935  *
14936  * Note, that hash tables are really only optimized for forward
14937  * lookups, i.e. g_hash_table_lookup(). So code that frequently issues
14938  * g_hash_table_find() or g_hash_table_foreach() (e.g. in the order of
14939  * once per every entry in a hash table) should probably be reworked
14940  * to use additional or different data structures for reverse lookups
14941  * (keep in mind that an O(n) find/foreach operation issued for all n
14942  * values in a hash table ends up needing O(n*n) operations).
14943  *
14944  * Returns: (allow-none): The value of the first key/value pair is returned, for which @predicate evaluates to %TRUE. If no pair with the requested property is found, %NULL is returned.
14945  * Since: 2.4
14946  */
14947
14948
14949 /**
14950  * g_hash_table_foreach:
14951  * @hash_table: a #GHashTable
14952  * @func: the function to call for each key/value pair
14953  * @user_data: user data to pass to the function
14954  *
14955  * Calls the given function for each of the key/value pairs in the
14956  * #GHashTable.  The function is passed the key and value of each
14957  * pair, and the given @user_data parameter.  The hash table may not
14958  * be modified while iterating over it (you can't add/remove
14959  * items). To remove all items matching a predicate, use
14960  * g_hash_table_foreach_remove().
14961  *
14962  * See g_hash_table_find() for performance caveats for linear
14963  * order searches in contrast to g_hash_table_lookup().
14964  */
14965
14966
14967 /**
14968  * g_hash_table_foreach_remove:
14969  * @hash_table: a #GHashTable
14970  * @func: the function to call for each key/value pair
14971  * @user_data: user data to pass to the function
14972  *
14973  * Calls the given function for each key/value pair in the
14974  * #GHashTable. If the function returns %TRUE, then the key/value
14975  * pair is removed from the #GHashTable. If you supplied key or
14976  * value destroy functions when creating the #GHashTable, they are
14977  * used to free the memory allocated for the removed keys and values.
14978  *
14979  * See #GHashTableIter for an alternative way to loop over the
14980  * key/value pairs in the hash table.
14981  *
14982  * Returns: the number of key/value pairs removed
14983  */
14984
14985
14986 /**
14987  * g_hash_table_foreach_steal:
14988  * @hash_table: a #GHashTable
14989  * @func: the function to call for each key/value pair
14990  * @user_data: user data to pass to the function
14991  *
14992  * Calls the given function for each key/value pair in the
14993  * #GHashTable. If the function returns %TRUE, then the key/value
14994  * pair is removed from the #GHashTable, but no key or value
14995  * destroy functions are called.
14996  *
14997  * See #GHashTableIter for an alternative way to loop over the
14998  * key/value pairs in the hash table.
14999  *
15000  * Returns: the number of key/value pairs removed.
15001  */
15002
15003
15004 /**
15005  * g_hash_table_freeze:
15006  * @hash_table: a #GHashTable
15007  *
15008  * This function is deprecated and will be removed in the next major
15009  * release of GLib. It does nothing.
15010  */
15011
15012
15013 /**
15014  * g_hash_table_get_keys:
15015  * @hash_table: a #GHashTable
15016  *
15017  * Retrieves every key inside @hash_table. The returned data
15018  * is valid until @hash_table is modified.
15019  *
15020  * Returns: a #GList containing all the keys inside the hash table. The content of the list is owned by the hash table and should not be modified or freed. Use g_list_free() when done using the list.
15021  * Since: 2.14
15022  */
15023
15024
15025 /**
15026  * g_hash_table_get_values:
15027  * @hash_table: a #GHashTable
15028  *
15029  * Retrieves every value inside @hash_table. The returned data
15030  * is valid until @hash_table is modified.
15031  *
15032  * Returns: a #GList containing all the values inside the hash table. The content of the list is owned by the hash table and should not be modified or freed. Use g_list_free() when done using the list.
15033  * Since: 2.14
15034  */
15035
15036
15037 /**
15038  * g_hash_table_insert:
15039  * @hash_table: a #GHashTable
15040  * @key: a key to insert
15041  * @value: the value to associate with the key
15042  *
15043  * Inserts a new key and value into a #GHashTable.
15044  *
15045  * If the key already exists in the #GHashTable its current
15046  * value is replaced with the new value. If you supplied a
15047  * @value_destroy_func when creating the #GHashTable, the old
15048  * value is freed using that function. If you supplied a
15049  * @key_destroy_func when creating the #GHashTable, the passed
15050  * key is freed using that function.
15051  */
15052
15053
15054 /**
15055  * g_hash_table_iter_get_hash_table:
15056  * @iter: an initialized #GHashTableIter
15057  *
15058  * Returns the #GHashTable associated with @iter.
15059  *
15060  * Returns: the #GHashTable associated with @iter.
15061  * Since: 2.16
15062  */
15063
15064
15065 /**
15066  * g_hash_table_iter_init:
15067  * @iter: an uninitialized #GHashTableIter
15068  * @hash_table: a #GHashTable
15069  *
15070  * Initializes a key/value pair iterator and associates it with
15071  * @hash_table. Modifying the hash table after calling this function
15072  * invalidates the returned iterator.
15073  * |[
15074  * GHashTableIter iter;
15075  * gpointer key, value;
15076  *
15077  * g_hash_table_iter_init (&iter, hash_table);
15078  * while (g_hash_table_iter_next (&iter, &key, &value))
15079  *   {
15080  *     /&ast; do something with key and value &ast;/
15081  *   }
15082  * ]|
15083  *
15084  * Since: 2.16
15085  */
15086
15087
15088 /**
15089  * g_hash_table_iter_next:
15090  * @iter: an initialized #GHashTableIter
15091  * @key: (allow-none): a location to store the key, or %NULL
15092  * @value: (allow-none): a location to store the value, or %NULL
15093  *
15094  * Advances @iter and retrieves the key and/or value that are now
15095  * pointed to as a result of this advancement. If %FALSE is returned,
15096  * @key and @value are not set, and the iterator becomes invalid.
15097  *
15098  * Returns: %FALSE if the end of the #GHashTable has been reached.
15099  * Since: 2.16
15100  */
15101
15102
15103 /**
15104  * g_hash_table_iter_remove:
15105  * @iter: an initialized #GHashTableIter
15106  *
15107  * Removes the key/value pair currently pointed to by the iterator
15108  * from its associated #GHashTable. Can only be called after
15109  * g_hash_table_iter_next() returned %TRUE, and cannot be called
15110  * more than once for the same key/value pair.
15111  *
15112  * If the #GHashTable was created using g_hash_table_new_full(),
15113  * the key and value are freed using the supplied destroy functions,
15114  * otherwise you have to make sure that any dynamically allocated
15115  * values are freed yourself.
15116  *
15117  * Since: 2.16
15118  */
15119
15120
15121 /**
15122  * g_hash_table_iter_replace:
15123  * @iter: an initialized #GHashTableIter
15124  * @value: the value to replace with
15125  *
15126  * Replaces the value currently pointed to by the iterator
15127  * from its associated #GHashTable. Can only be called after
15128  * g_hash_table_iter_next() returned %TRUE.
15129  *
15130  * If you supplied a @value_destroy_func when creating the
15131  * #GHashTable, the old value is freed using that function.
15132  *
15133  * Since: 2.30
15134  */
15135
15136
15137 /**
15138  * g_hash_table_iter_steal:
15139  * @iter: an initialized #GHashTableIter
15140  *
15141  * Removes the key/value pair currently pointed to by the
15142  * iterator from its associated #GHashTable, without calling
15143  * the key and value destroy functions. Can only be called
15144  * after g_hash_table_iter_next() returned %TRUE, and cannot
15145  * be called more than once for the same key/value pair.
15146  *
15147  * Since: 2.16
15148  */
15149
15150
15151 /**
15152  * g_hash_table_lookup:
15153  * @hash_table: a #GHashTable
15154  * @key: the key to look up
15155  *
15156  * Looks up a key in a #GHashTable. Note that this function cannot
15157  * distinguish between a key that is not present and one which is present
15158  * and has the value %NULL. If you need this distinction, use
15159  * g_hash_table_lookup_extended().
15160  *
15161  * Returns: (allow-none): the associated value, or %NULL if the key is not found
15162  */
15163
15164
15165 /**
15166  * g_hash_table_lookup_extended:
15167  * @hash_table: a #GHashTable
15168  * @lookup_key: the key to look up
15169  * @orig_key: (allow-none): return location for the original key, or %NULL
15170  * @value: (allow-none): return location for the value associated with the key, or %NULL
15171  *
15172  * Looks up a key in the #GHashTable, returning the original key and the
15173  * associated value and a #gboolean which is %TRUE if the key was found. This
15174  * is useful if you need to free the memory allocated for the original key,
15175  * for example before calling g_hash_table_remove().
15176  *
15177  * You can actually pass %NULL for @lookup_key to test
15178  * whether the %NULL key exists, provided the hash and equal functions
15179  * of @hash_table are %NULL-safe.
15180  *
15181  * Returns: %TRUE if the key was found in the #GHashTable
15182  */
15183
15184
15185 /**
15186  * g_hash_table_new:
15187  * @hash_func: a function to create a hash value from a key
15188  * @key_equal_func: a function to check two keys for equality
15189  *
15190  * Creates a new #GHashTable with a reference count of 1.
15191  *
15192  * Hash values returned by @hash_func are used to determine where keys
15193  * are stored within the #GHashTable data structure. The g_direct_hash(),
15194  * g_int_hash(), g_int64_hash(), g_double_hash() and g_str_hash()
15195  * functions are provided for some common types of keys.
15196  * If @hash_func is %NULL, g_direct_hash() is used.
15197  *
15198  * @key_equal_func is used when looking up keys in the #GHashTable.
15199  * The g_direct_equal(), g_int_equal(), g_int64_equal(), g_double_equal()
15200  * and g_str_equal() functions are provided for the most common types
15201  * of keys. If @key_equal_func is %NULL, keys are compared directly in
15202  * a similar fashion to g_direct_equal(), but without the overhead of
15203  * a function call.
15204  *
15205  * Returns: a new #GHashTable
15206  */
15207
15208
15209 /**
15210  * g_hash_table_new_full:
15211  * @hash_func: a function to create a hash value from a key
15212  * @key_equal_func: a function to check two keys for equality
15213  * @key_destroy_func: (allow-none): a function to free the memory allocated for the key used when removing the entry from the #GHashTable, or %NULL if you don't want to supply such a function.
15214  * @value_destroy_func: (allow-none): a function to free the memory allocated for the value used when removing the entry from the #GHashTable, or %NULL if you don't want to supply such a function.
15215  *
15216  * Creates a new #GHashTable like g_hash_table_new() with a reference
15217  * count of 1 and allows to specify functions to free the memory
15218  * allocated for the key and value that get called when removing the
15219  * entry from the #GHashTable.
15220  *
15221  * Returns: a new #GHashTable
15222  */
15223
15224
15225 /**
15226  * g_hash_table_ref:
15227  * @hash_table: a valid #GHashTable
15228  *
15229  * Atomically increments the reference count of @hash_table by one.
15230  * This function is MT-safe and may be called from any thread.
15231  *
15232  * Returns: the passed in #GHashTable
15233  * Since: 2.10
15234  */
15235
15236
15237 /**
15238  * g_hash_table_remove:
15239  * @hash_table: a #GHashTable
15240  * @key: the key to remove
15241  *
15242  * Removes a key and its associated value from a #GHashTable.
15243  *
15244  * If the #GHashTable was created using g_hash_table_new_full(), the
15245  * key and value are freed using the supplied destroy functions, otherwise
15246  * you have to make sure that any dynamically allocated values are freed
15247  * yourself.
15248  *
15249  * Returns: %TRUE if the key was found and removed from the #GHashTable
15250  */
15251
15252
15253 /**
15254  * g_hash_table_remove_all:
15255  * @hash_table: a #GHashTable
15256  *
15257  * Removes all keys and their associated values from a #GHashTable.
15258  *
15259  * If the #GHashTable was created using g_hash_table_new_full(),
15260  * the keys and values are freed using the supplied destroy functions,
15261  * otherwise you have to make sure that any dynamically allocated
15262  * values are freed yourself.
15263  *
15264  * Since: 2.12
15265  */
15266
15267
15268 /**
15269  * g_hash_table_replace:
15270  * @hash_table: a #GHashTable
15271  * @key: a key to insert
15272  * @value: the value to associate with the key
15273  *
15274  * Inserts a new key and value into a #GHashTable similar to
15275  * g_hash_table_insert(). The difference is that if the key
15276  * already exists in the #GHashTable, it gets replaced by the
15277  * new key. If you supplied a @value_destroy_func when creating
15278  * the #GHashTable, the old value is freed using that function.
15279  * If you supplied a @key_destroy_func when creating the
15280  * #GHashTable, the old key is freed using that function.
15281  */
15282
15283
15284 /**
15285  * g_hash_table_size:
15286  * @hash_table: a #GHashTable
15287  *
15288  * Returns the number of elements contained in the #GHashTable.
15289  *
15290  * Returns: the number of key/value pairs in the #GHashTable.
15291  */
15292
15293
15294 /**
15295  * g_hash_table_steal:
15296  * @hash_table: a #GHashTable
15297  * @key: the key to remove
15298  *
15299  * Removes a key and its associated value from a #GHashTable without
15300  * calling the key and value destroy functions.
15301  *
15302  * Returns: %TRUE if the key was found and removed from the #GHashTable
15303  */
15304
15305
15306 /**
15307  * g_hash_table_steal_all:
15308  * @hash_table: a #GHashTable
15309  *
15310  * Removes all keys and their associated values from a #GHashTable
15311  * without calling the key and value destroy functions.
15312  *
15313  * Since: 2.12
15314  */
15315
15316
15317 /**
15318  * g_hash_table_thaw:
15319  * @hash_table: a #GHashTable
15320  *
15321  * This function is deprecated and will be removed in the next major
15322  * release of GLib. It does nothing.
15323  */
15324
15325
15326 /**
15327  * g_hash_table_unref:
15328  * @hash_table: a valid #GHashTable
15329  *
15330  * Atomically decrements the reference count of @hash_table by one.
15331  * If the reference count drops to 0, all keys and values will be
15332  * destroyed, and all memory allocated by the hash table is released.
15333  * This function is MT-safe and may be called from any thread.
15334  *
15335  * Since: 2.10
15336  */
15337
15338
15339 /**
15340  * g_hmac_copy:
15341  * @hmac: the #GHmac to copy
15342  *
15343  * Copies a #GHmac. If @hmac has been closed, by calling
15344  * g_hmac_get_string() or g_hmac_get_digest(), the copied
15345  * HMAC will be closed as well.
15346  *
15347  * Returns: the copy of the passed #GHmac. Use g_hmac_unref() when finished using it.
15348  * Since: 2.30
15349  */
15350
15351
15352 /**
15353  * g_hmac_get_digest:
15354  * @hmac: a #GHmac
15355  * @buffer: output buffer
15356  * @digest_len: an inout parameter. The caller initializes it to the size of @buffer. After the call it contains the length of the digest
15357  *
15358  * Gets the digest from @checksum as a raw binary array and places it
15359  * into @buffer. The size of the digest depends on the type of checksum.
15360  *
15361  * Once this function has been called, the #GHmac is closed and can
15362  * no longer be updated with g_checksum_update().
15363  *
15364  * Since: 2.30
15365  */
15366
15367
15368 /**
15369  * g_hmac_get_string:
15370  * @hmac: a #GHmac
15371  *
15372  * Gets the HMAC as an hexadecimal string.
15373  *
15374  * Once this function has been called the #GHmac can no longer be
15375  * updated with g_hmac_update().
15376  *
15377  * The hexadecimal characters will be lower case.
15378  *
15379  * Returns: the hexadecimal representation of the HMAC. The returned string is owned by the HMAC and should not be modified or freed.
15380  * Since: 2.30
15381  */
15382
15383
15384 /**
15385  * g_hmac_new:
15386  * @digest_type: the desired type of digest
15387  * @key: (array length=key_len): the key for the HMAC
15388  * @key_len: the length of the keys
15389  *
15390  * Creates a new #GHmac, using the digest algorithm @digest_type.
15391  * If the @digest_type is not known, %NULL is returned.
15392  * A #GHmac can be used to compute the HMAC of a key and an
15393  * arbitrary binary blob, using different hashing algorithms.
15394  *
15395  * A #GHmac works by feeding a binary blob through g_hmac_update()
15396  * until the data is complete; the digest can then be extracted
15397  * using g_hmac_get_string(), which will return the checksum as a
15398  * hexadecimal string; or g_hmac_get_digest(), which will return a
15399  * array of raw bytes. Once either g_hmac_get_string() or
15400  * g_hmac_get_digest() have been called on a #GHmac, the HMAC
15401  * will be closed and it won't be possible to call g_hmac_update()
15402  * on it anymore.
15403  *
15404  * Returns: the newly created #GHmac, or %NULL. Use g_hmac_unref() to free the memory allocated by it.
15405  * Since: 2.30
15406  */
15407
15408
15409 /**
15410  * g_hmac_ref:
15411  * @hmac: a valid #GHmac
15412  *
15413  * Atomically increments the reference count of @hmac by one.
15414  *
15415  * This function is MT-safe and may be called from any thread.
15416  *
15417  * Returns: the passed in #GHmac.
15418  * Since: 2.30
15419  */
15420
15421
15422 /**
15423  * g_hmac_unref:
15424  * @hmac: a #GHmac
15425  *
15426  * Atomically decrements the reference count of @hmac by one.
15427  *
15428  * If the reference count drops to 0, all keys and values will be
15429  * destroyed, and all memory allocated by the hash table is released.
15430  * This function is MT-safe and may be called from any thread.
15431  * Frees the memory allocated for @hmac.
15432  *
15433  * Since: 2.30
15434  */
15435
15436
15437 /**
15438  * g_hmac_update:
15439  * @hmac: a #GHmac
15440  * @data: (array length=length): buffer used to compute the checksum
15441  * @length: size of the buffer, or -1 if it is a nul-terminated string
15442  *
15443  * Feeds @data into an existing #GHmac.
15444  *
15445  * The HMAC must still be open, that is g_hmac_get_string() or
15446  * g_hmac_get_digest() must not have been called on @hmac.
15447  *
15448  * Since: 2.30
15449  */
15450
15451
15452 /**
15453  * g_hook_alloc:
15454  * @hook_list: a #GHookList
15455  *
15456  * Allocates space for a #GHook and initializes it.
15457  *
15458  * Returns: a new #GHook
15459  */
15460
15461
15462 /**
15463  * g_hook_append:
15464  * @hook_list: a #GHookList
15465  * @hook: the #GHook to add to the end of @hook_list
15466  *
15467  * Appends a #GHook onto the end of a #GHookList.
15468  */
15469
15470
15471 /**
15472  * g_hook_compare_ids:
15473  * @new_hook: a #GHook
15474  * @sibling: a #GHook to compare with @new_hook
15475  *
15476  * Compares the ids of two #GHook elements, returning a negative value
15477  * if the second id is greater than the first.
15478  *
15479  * Returns: a value &lt;= 0 if the id of @sibling is >= the id of @new_hook
15480  */
15481
15482
15483 /**
15484  * g_hook_destroy:
15485  * @hook_list: a #GHookList
15486  * @hook_id: a hook ID
15487  *
15488  * Destroys a #GHook, given its ID.
15489  *
15490  * Returns: %TRUE if the #GHook was found in the #GHookList and destroyed
15491  */
15492
15493
15494 /**
15495  * g_hook_destroy_link:
15496  * @hook_list: a #GHookList
15497  * @hook: the #GHook to remove
15498  *
15499  * Removes one #GHook from a #GHookList, marking it
15500  * inactive and calling g_hook_unref() on it.
15501  */
15502
15503
15504 /**
15505  * g_hook_find:
15506  * @hook_list: a #GHookList
15507  * @need_valids: %TRUE if #GHook elements which have been destroyed should be skipped
15508  * @func: the function to call for each #GHook, which should return %TRUE when the #GHook has been found
15509  * @data: the data to pass to @func
15510  *
15511  * Finds a #GHook in a #GHookList using the given function to
15512  * test for a match.
15513  *
15514  * Returns: the found #GHook or %NULL if no matching #GHook is found
15515  */
15516
15517
15518 /**
15519  * g_hook_find_data:
15520  * @hook_list: a #GHookList
15521  * @need_valids: %TRUE if #GHook elements which have been destroyed should be skipped
15522  * @data: the data to find
15523  *
15524  * Finds a #GHook in a #GHookList with the given data.
15525  *
15526  * Returns: the #GHook with the given @data or %NULL if no matching #GHook is found
15527  */
15528
15529
15530 /**
15531  * g_hook_find_func:
15532  * @hook_list: a #GHookList
15533  * @need_valids: %TRUE if #GHook elements which have been destroyed should be skipped
15534  * @func: the function to find
15535  *
15536  * Finds a #GHook in a #GHookList with the given function.
15537  *
15538  * Returns: the #GHook with the given @func or %NULL if no matching #GHook is found
15539  */
15540
15541
15542 /**
15543  * g_hook_find_func_data:
15544  * @hook_list: a #GHookList
15545  * @need_valids: %TRUE if #GHook elements which have been destroyed should be skipped
15546  * @func: the function to find
15547  * @data: the data to find
15548  *
15549  * Finds a #GHook in a #GHookList with the given function and data.
15550  *
15551  * Returns: the #GHook with the given @func and @data or %NULL if no matching #GHook is found
15552  */
15553
15554
15555 /**
15556  * g_hook_first_valid:
15557  * @hook_list: a #GHookList
15558  * @may_be_in_call: %TRUE if hooks which are currently running (e.g. in another thread) are considered valid. If set to %FALSE, these are skipped
15559  *
15560  * Returns the first #GHook in a #GHookList which has not been destroyed.
15561  * The reference count for the #GHook is incremented, so you must call
15562  * g_hook_unref() to restore it when no longer needed. (Or call
15563  * g_hook_next_valid() if you are stepping through the #GHookList.)
15564  *
15565  * Returns: the first valid #GHook, or %NULL if none are valid
15566  */
15567
15568
15569 /**
15570  * g_hook_free:
15571  * @hook_list: a #GHookList
15572  * @hook: the #GHook to free
15573  *
15574  * Calls the #GHookList @finalize_hook function if it exists,
15575  * and frees the memory allocated for the #GHook.
15576  */
15577
15578
15579 /**
15580  * g_hook_get:
15581  * @hook_list: a #GHookList
15582  * @hook_id: a hook id
15583  *
15584  * Returns the #GHook with the given id, or %NULL if it is not found.
15585  *
15586  * Returns: the #GHook with the given id, or %NULL if it is not found
15587  */
15588
15589
15590 /**
15591  * g_hook_insert_before:
15592  * @hook_list: a #GHookList
15593  * @sibling: the #GHook to insert the new #GHook before
15594  * @hook: the #GHook to insert
15595  *
15596  * Inserts a #GHook into a #GHookList, before a given #GHook.
15597  */
15598
15599
15600 /**
15601  * g_hook_insert_sorted:
15602  * @hook_list: a #GHookList
15603  * @hook: the #GHook to insert
15604  * @func: the comparison function used to sort the #GHook elements
15605  *
15606  * Inserts a #GHook into a #GHookList, sorted by the given function.
15607  */
15608
15609
15610 /**
15611  * g_hook_list_clear:
15612  * @hook_list: a #GHookList
15613  *
15614  * Removes all the #GHook elements from a #GHookList.
15615  */
15616
15617
15618 /**
15619  * g_hook_list_init:
15620  * @hook_list: a #GHookList
15621  * @hook_size: the size of each element in the #GHookList, typically <literal>sizeof (GHook)</literal>
15622  *
15623  * Initializes a #GHookList.
15624  * This must be called before the #GHookList is used.
15625  */
15626
15627
15628 /**
15629  * g_hook_list_invoke:
15630  * @hook_list: a #GHookList
15631  * @may_recurse: %TRUE if functions which are already running (e.g. in another thread) can be called. If set to %FALSE, these are skipped
15632  *
15633  * Calls all of the #GHook functions in a #GHookList.
15634  */
15635
15636
15637 /**
15638  * g_hook_list_invoke_check:
15639  * @hook_list: a #GHookList
15640  * @may_recurse: %TRUE if functions which are already running (e.g. in another thread) can be called. If set to %FALSE, these are skipped
15641  *
15642  * Calls all of the #GHook functions in a #GHookList.
15643  * Any function which returns %FALSE is removed from the #GHookList.
15644  */
15645
15646
15647 /**
15648  * g_hook_list_marshal:
15649  * @hook_list: a #GHookList
15650  * @may_recurse: %TRUE if hooks which are currently running (e.g. in another thread) are considered valid. If set to %FALSE, these are skipped
15651  * @marshaller: the function to call for each #GHook
15652  * @marshal_data: data to pass to @marshaller
15653  *
15654  * Calls a function on each valid #GHook.
15655  */
15656
15657
15658 /**
15659  * g_hook_list_marshal_check:
15660  * @hook_list: a #GHookList
15661  * @may_recurse: %TRUE if hooks which are currently running (e.g. in another thread) are considered valid. If set to %FALSE, these are skipped
15662  * @marshaller: the function to call for each #GHook
15663  * @marshal_data: data to pass to @marshaller
15664  *
15665  * Calls a function on each valid #GHook and destroys it if the
15666  * function returns %FALSE.
15667  */
15668
15669
15670 /**
15671  * g_hook_next_valid:
15672  * @hook_list: a #GHookList
15673  * @hook: the current #GHook
15674  * @may_be_in_call: %TRUE if hooks which are currently running (e.g. in another thread) are considered valid. If set to %FALSE, these are skipped
15675  *
15676  * Returns the next #GHook in a #GHookList which has not been destroyed.
15677  * The reference count for the #GHook is incremented, so you must call
15678  * g_hook_unref() to restore it when no longer needed. (Or continue to call
15679  * g_hook_next_valid() until %NULL is returned.)
15680  *
15681  * Returns: the next valid #GHook, or %NULL if none are valid
15682  */
15683
15684
15685 /**
15686  * g_hook_prepend:
15687  * @hook_list: a #GHookList
15688  * @hook: the #GHook to add to the start of @hook_list
15689  *
15690  * Prepends a #GHook on the start of a #GHookList.
15691  */
15692
15693
15694 /**
15695  * g_hook_ref:
15696  * @hook_list: a #GHookList
15697  * @hook: the #GHook to increment the reference count of
15698  *
15699  * Increments the reference count for a #GHook.
15700  *
15701  * Returns: the @hook that was passed in (since 2.6)
15702  */
15703
15704
15705 /**
15706  * g_hook_unref:
15707  * @hook_list: a #GHookList
15708  * @hook: the #GHook to unref
15709  *
15710  * Decrements the reference count of a #GHook.
15711  * If the reference count falls to 0, the #GHook is removed
15712  * from the #GHookList and g_hook_free() is called to free it.
15713  */
15714
15715
15716 /**
15717  * g_hostname_is_ascii_encoded:
15718  * @hostname: a hostname
15719  *
15720  * Tests if @hostname contains segments with an ASCII-compatible
15721  * encoding of an Internationalized Domain Name. If this returns
15722  * %TRUE, you should decode the hostname with g_hostname_to_unicode()
15723  * before displaying it to the user.
15724  *
15725  * Note that a hostname might contain a mix of encoded and unencoded
15726  * segments, and so it is possible for g_hostname_is_non_ascii() and
15727  * g_hostname_is_ascii_encoded() to both return %TRUE for a name.
15728  *
15729  * Returns: %TRUE if @hostname contains any ASCII-encoded segments.
15730  * Since: 2.22
15731  */
15732
15733
15734 /**
15735  * g_hostname_is_ip_address:
15736  * @hostname: a hostname (or IP address in string form)
15737  *
15738  * Tests if @hostname is the string form of an IPv4 or IPv6 address.
15739  * (Eg, "192.168.0.1".)
15740  *
15741  * Returns: %TRUE if @hostname is an IP address
15742  * Since: 2.22
15743  */
15744
15745
15746 /**
15747  * g_hostname_is_non_ascii:
15748  * @hostname: a hostname
15749  *
15750  * Tests if @hostname contains Unicode characters. If this returns
15751  * %TRUE, you need to encode the hostname with g_hostname_to_ascii()
15752  * before using it in non-IDN-aware contexts.
15753  *
15754  * Note that a hostname might contain a mix of encoded and unencoded
15755  * segments, and so it is possible for g_hostname_is_non_ascii() and
15756  * g_hostname_is_ascii_encoded() to both return %TRUE for a name.
15757  *
15758  * Returns: %TRUE if @hostname contains any non-ASCII characters
15759  * Since: 2.22
15760  */
15761
15762
15763 /**
15764  * g_hostname_to_ascii:
15765  * @hostname: a valid UTF-8 or ASCII hostname
15766  *
15767  * Converts @hostname to its canonical ASCII form; an ASCII-only
15768  * string containing no uppercase letters and not ending with a
15769  * trailing dot.
15770  *
15771  * Returns: an ASCII hostname, which must be freed, or %NULL if @hostname is in some way invalid.
15772  * Since: 2.22
15773  */
15774
15775
15776 /**
15777  * g_hostname_to_unicode:
15778  * @hostname: a valid UTF-8 or ASCII hostname
15779  *
15780  * Converts @hostname to its canonical presentation form; a UTF-8
15781  * string in Unicode normalization form C, containing no uppercase
15782  * letters, no forbidden characters, and no ASCII-encoded segments,
15783  * and not ending with a trailing dot.
15784  *
15785  * Of course if @hostname is not an internationalized hostname, then
15786  * the canonical presentation form will be entirely ASCII.
15787  *
15788  * Returns: a UTF-8 hostname, which must be freed, or %NULL if @hostname is in some way invalid.
15789  * Since: 2.22
15790  */
15791
15792
15793 /**
15794  * g_htonl:
15795  * @val: a 32-bit integer value in host byte order
15796  *
15797  * Converts a 32-bit integer value from host to network byte order.
15798  *
15799  * Returns: @val converted to network byte order
15800  */
15801
15802
15803 /**
15804  * g_htons:
15805  * @val: a 16-bit integer value in host byte order
15806  *
15807  * Converts a 16-bit integer value from host to network byte order.
15808  *
15809  * Returns: @val converted to network byte order
15810  */
15811
15812
15813 /**
15814  * g_iconv:
15815  * @converter: conversion descriptor from g_iconv_open()
15816  * @inbuf: bytes to convert
15817  * @inbytes_left: inout parameter, bytes remaining to convert in @inbuf
15818  * @outbuf: converted output bytes
15819  * @outbytes_left: inout parameter, bytes available to fill in @outbuf
15820  *
15821  * Same as the standard UNIX routine iconv(), but
15822  * may be implemented via libiconv on UNIX flavors that lack
15823  * a native implementation.
15824  *
15825  * GLib provides g_convert() and g_locale_to_utf8() which are likely
15826  * more convenient than the raw iconv wrappers.
15827  *
15828  * Returns: count of non-reversible conversions, or -1 on error
15829  */
15830
15831
15832 /**
15833  * g_iconv_close:
15834  * @converter: a conversion descriptor from g_iconv_open()
15835  *
15836  * Same as the standard UNIX routine iconv_close(), but
15837  * may be implemented via libiconv on UNIX flavors that lack
15838  * a native implementation. Should be called to clean up
15839  * the conversion descriptor from g_iconv_open() when
15840  * you are done converting things.
15841  *
15842  * GLib provides g_convert() and g_locale_to_utf8() which are likely
15843  * more convenient than the raw iconv wrappers.
15844  *
15845  * Returns: -1 on error, 0 on success
15846  */
15847
15848
15849 /**
15850  * g_iconv_open:
15851  * @to_codeset: destination codeset
15852  * @from_codeset: source codeset
15853  *
15854  * Same as the standard UNIX routine iconv_open(), but
15855  * may be implemented via libiconv on UNIX flavors that lack
15856  * a native implementation.
15857  *
15858  * GLib provides g_convert() and g_locale_to_utf8() which are likely
15859  * more convenient than the raw iconv wrappers.
15860  *
15861  * Returns: a "conversion descriptor", or (GIConv)-1 if opening the converter failed.
15862  */
15863
15864
15865 /**
15866  * g_idle_add:
15867  * @function: function to call
15868  * @data: data to pass to @function.
15869  *
15870  * Adds a function to be called whenever there are no higher priority
15871  * events pending to the default main loop. The function is given the
15872  * default idle priority, #G_PRIORITY_DEFAULT_IDLE.  If the function
15873  * returns %FALSE it is automatically removed from the list of event
15874  * sources and will not be called again.
15875  *
15876  * This internally creates a main loop source using g_idle_source_new()
15877  * and attaches it to the main loop context using g_source_attach().
15878  * You can do these steps manually if you need greater control.
15879  *
15880  * Returns: the ID (greater than 0) of the event source.
15881  */
15882
15883
15884 /**
15885  * g_idle_add_full:
15886  * @priority: the priority of the idle source. Typically this will be in the range between #G_PRIORITY_DEFAULT_IDLE and #G_PRIORITY_HIGH_IDLE.
15887  * @function: function to call
15888  * @data: data to pass to @function
15889  * @notify: (allow-none): function to call when the idle is removed, or %NULL
15890  *
15891  * Adds a function to be called whenever there are no higher priority
15892  * events pending.  If the function returns %FALSE it is automatically
15893  * removed from the list of event sources and will not be called again.
15894  *
15895  * This internally creates a main loop source using g_idle_source_new()
15896  * and attaches it to the main loop context using g_source_attach().
15897  * You can do these steps manually if you need greater control.
15898  *
15899  * Returns: the ID (greater than 0) of the event source.
15900  * Rename to: g_idle_add
15901  */
15902
15903
15904 /**
15905  * g_idle_remove_by_data:
15906  * @data: the data for the idle source's callback.
15907  *
15908  * Removes the idle function with the given data.
15909  *
15910  * Returns: %TRUE if an idle source was found and removed.
15911  */
15912
15913
15914 /**
15915  * g_idle_source_new:
15916  *
15917  * Creates a new idle source.
15918  *
15919  * The source will not initially be associated with any #GMainContext
15920  * and must be added to one with g_source_attach() before it will be
15921  * executed. Note that the default priority for idle sources is
15922  * %G_PRIORITY_DEFAULT_IDLE, as compared to other sources which
15923  * have a default priority of %G_PRIORITY_DEFAULT.
15924  *
15925  * Returns: the newly-created idle source
15926  */
15927
15928
15929 /**
15930  * g_int64_equal:
15931  * @v1: a pointer to a #gint64 key
15932  * @v2: a pointer to a #gint64 key to compare with @v1
15933  *
15934  * Compares the two #gint64 values being pointed to and returns
15935  * %TRUE if they are equal.
15936  * It can be passed to g_hash_table_new() as the @key_equal_func
15937  * parameter, when using non-%NULL pointers to 64-bit integers as keys in a
15938  * #GHashTable.
15939  *
15940  * Returns: %TRUE if the two keys match.
15941  * Since: 2.22
15942  */
15943
15944
15945 /**
15946  * g_int64_hash:
15947  * @v: a pointer to a #gint64 key
15948  *
15949  * Converts a pointer to a #gint64 to a hash value.
15950  *
15951  * It can be passed to g_hash_table_new() as the @hash_func parameter,
15952  * when using non-%NULL pointers to 64-bit integer values as keys in a
15953  * #GHashTable.
15954  *
15955  * Returns: a hash value corresponding to the key.
15956  * Since: 2.22
15957  */
15958
15959
15960 /**
15961  * g_int_equal:
15962  * @v1: a pointer to a #gint key
15963  * @v2: a pointer to a #gint key to compare with @v1
15964  *
15965  * Compares the two #gint values being pointed to and returns
15966  * %TRUE if they are equal.
15967  * It can be passed to g_hash_table_new() as the @key_equal_func
15968  * parameter, when using non-%NULL pointers to integers as keys in a
15969  * #GHashTable.
15970  *
15971  * Note that this function acts on pointers to #gint, not on #gint directly:
15972  * if your hash table's keys are of the form
15973  * <literal>GINT_TO_POINTER (n)</literal>, use g_direct_equal() instead.
15974  *
15975  * Returns: %TRUE if the two keys match.
15976  */
15977
15978
15979 /**
15980  * g_int_hash:
15981  * @v: a pointer to a #gint key
15982  *
15983  * Converts a pointer to a #gint to a hash value.
15984  * It can be passed to g_hash_table_new() as the @hash_func parameter,
15985  * when using non-%NULL pointers to integer values as keys in a #GHashTable.
15986  *
15987  * Note that this function acts on pointers to #gint, not on #gint directly:
15988  * if your hash table's keys are of the form
15989  * <literal>GINT_TO_POINTER (n)</literal>, use g_direct_hash() instead.
15990  *
15991  * Returns: a hash value corresponding to the key.
15992  */
15993
15994
15995 /**
15996  * g_intern_static_string:
15997  * @string: (allow-none): a static string
15998  *
15999  * Returns a canonical representation for @string. Interned strings
16000  * can be compared for equality by comparing the pointers, instead of
16001  * using strcmp(). g_intern_static_string() does not copy the string,
16002  * therefore @string must not be freed or modified.
16003  *
16004  * Returns: a canonical representation for the string
16005  * Since: 2.10
16006  */
16007
16008
16009 /**
16010  * g_intern_string:
16011  * @string: (allow-none): a string
16012  *
16013  * Returns a canonical representation for @string. Interned strings
16014  * can be compared for equality by comparing the pointers, instead of
16015  * using strcmp().
16016  *
16017  * Returns: a canonical representation for the string
16018  * Since: 2.10
16019  */
16020
16021
16022 /**
16023  * g_io_add_watch:
16024  * @channel: a #GIOChannel
16025  * @condition: the condition to watch for
16026  * @func: the function to call when the condition is satisfied
16027  * @user_data: user data to pass to @func
16028  *
16029  * Adds the #GIOChannel into the default main loop context
16030  * with the default priority.
16031  *
16032  * Returns: the event source id
16033  */
16034
16035
16036 /**
16037  * g_io_add_watch_full:
16038  * @channel: a #GIOChannel
16039  * @priority: the priority of the #GIOChannel source
16040  * @condition: the condition to watch for
16041  * @func: the function to call when the condition is satisfied
16042  * @user_data: user data to pass to @func
16043  * @notify: the function to call when the source is removed
16044  *
16045  * Adds the #GIOChannel into the default main loop context
16046  * with the given priority.
16047  *
16048  * This internally creates a main loop source using g_io_create_watch()
16049  * and attaches it to the main loop context with g_source_attach().
16050  * You can do these steps manually if you need greater control.
16051  *
16052  * Returns: the event source id
16053  * Rename to: g_io_add_watch
16054  */
16055
16056
16057 /**
16058  * g_io_channel_close:
16059  * @channel: A #GIOChannel
16060  *
16061  * Close an IO channel. Any pending data to be written will be
16062  * flushed, ignoring errors. The channel will not be freed until the
16063  * last reference is dropped using g_io_channel_unref().
16064  *
16065  * Deprecated: 2.2: Use g_io_channel_shutdown() instead.
16066  */
16067
16068
16069 /**
16070  * g_io_channel_error_from_errno:
16071  * @en: an <literal>errno</literal> error number, e.g. <literal>EINVAL</literal>
16072  *
16073  * Converts an <literal>errno</literal> error number to a #GIOChannelError.
16074  *
16075  * Returns: a #GIOChannelError error number, e.g. %G_IO_CHANNEL_ERROR_INVAL.
16076  */
16077
16078
16079 /**
16080  * g_io_channel_error_quark:
16081  *
16082  * Returns: the quark used as %G_IO_CHANNEL_ERROR
16083  */
16084
16085
16086 /**
16087  * g_io_channel_flush:
16088  * @channel: a #GIOChannel
16089  * @error: location to store an error of type #GIOChannelError
16090  *
16091  * Flushes the write buffer for the GIOChannel.
16092  *
16093  * Returns: the status of the operation: One of #G_IO_STATUS_NORMAL, #G_IO_STATUS_AGAIN, or #G_IO_STATUS_ERROR.
16094  */
16095
16096
16097 /**
16098  * g_io_channel_get_buffer_condition:
16099  * @channel: A #GIOChannel
16100  *
16101  * This function returns a #GIOCondition depending on whether there
16102  * is data to be read/space to write data in the internal buffers in
16103  * the #GIOChannel. Only the flags %G_IO_IN and %G_IO_OUT may be set.
16104  *
16105  * Returns: A #GIOCondition
16106  */
16107
16108
16109 /**
16110  * g_io_channel_get_buffer_size:
16111  * @channel: a #GIOChannel
16112  *
16113  * Gets the buffer size.
16114  *
16115  * Returns: the size of the buffer.
16116  */
16117
16118
16119 /**
16120  * g_io_channel_get_buffered:
16121  * @channel: a #GIOChannel
16122  *
16123  * Returns whether @channel is buffered.
16124  *
16125  * Returns: %TRUE if the @channel is buffered.
16126  */
16127
16128
16129 /**
16130  * g_io_channel_get_close_on_unref:
16131  * @channel: a #GIOChannel.
16132  *
16133  * Returns whether the file/socket/whatever associated with @channel
16134  * will be closed when @channel receives its final unref and is
16135  * destroyed. The default value of this is %TRUE for channels created
16136  * by g_io_channel_new_file (), and %FALSE for all other channels.
16137  *
16138  * Returns: Whether the channel will be closed on the final unref of the GIOChannel data structure.
16139  */
16140
16141
16142 /**
16143  * g_io_channel_get_encoding:
16144  * @channel: a #GIOChannel
16145  *
16146  * Gets the encoding for the input/output of the channel.
16147  * The internal encoding is always UTF-8. The encoding %NULL
16148  * makes the channel safe for binary data.
16149  *
16150  * Returns: A string containing the encoding, this string is owned by GLib and must not be freed.
16151  */
16152
16153
16154 /**
16155  * g_io_channel_get_flags:
16156  * @channel: a #GIOChannel
16157  *
16158  * Gets the current flags for a #GIOChannel, including read-only
16159  * flags such as %G_IO_FLAG_IS_READABLE.
16160  *
16161  * The values of the flags %G_IO_FLAG_IS_READABLE and %G_IO_FLAG_IS_WRITABLE
16162  * are cached for internal use by the channel when it is created.
16163  * If they should change at some later point (e.g. partial shutdown
16164  * of a socket with the UNIX shutdown() function), the user
16165  * should immediately call g_io_channel_get_flags() to update
16166  * the internal values of these flags.
16167  *
16168  * Returns: the flags which are set on the channel
16169  */
16170
16171
16172 /**
16173  * g_io_channel_get_line_term:
16174  * @channel: a #GIOChannel
16175  * @length: a location to return the length of the line terminator
16176  *
16177  * This returns the string that #GIOChannel uses to determine
16178  * where in the file a line break occurs. A value of %NULL
16179  * indicates autodetection.
16180  *
16181  * Returns: The line termination string. This value is owned by GLib and must not be freed.
16182  */
16183
16184
16185 /**
16186  * g_io_channel_init:
16187  * @channel: a #GIOChannel
16188  *
16189  * Initializes a #GIOChannel struct.
16190  *
16191  * This is called by each of the above functions when creating a
16192  * #GIOChannel, and so is not often needed by the application
16193  * programmer (unless you are creating a new type of #GIOChannel).
16194  */
16195
16196
16197 /**
16198  * g_io_channel_new_file:
16199  * @filename: A string containing the name of a file
16200  * @mode: One of "r", "w", "a", "r+", "w+", "a+". These have the same meaning as in fopen()
16201  * @error: A location to return an error of type %G_FILE_ERROR
16202  *
16203  * Open a file @filename as a #GIOChannel using mode @mode. This
16204  * channel will be closed when the last reference to it is dropped,
16205  * so there is no need to call g_io_channel_close() (though doing
16206  * so will not cause problems, as long as no attempt is made to
16207  * access the channel after it is closed).
16208  *
16209  * Returns: A #GIOChannel on success, %NULL on failure.
16210  */
16211
16212
16213 /**
16214  * g_io_channel_read:
16215  * @channel: a #GIOChannel
16216  * @buf: a buffer to read the data into (which should be at least count bytes long)
16217  * @count: the number of bytes to read from the #GIOChannel
16218  * @bytes_read: returns the number of bytes actually read
16219  *
16220  * Reads data from a #GIOChannel.
16221  *
16222  * Returns: %G_IO_ERROR_NONE if the operation was successful.
16223  * Deprecated: 2.2: Use g_io_channel_read_chars() instead.
16224  */
16225
16226
16227 /**
16228  * g_io_channel_read_chars:
16229  * @channel: a #GIOChannel
16230  * @buf: (out caller-allocates) (array length=count) (element-type guint8): a buffer to read data into
16231  * @count: (in): the size of the buffer. Note that the buffer may not be complelely filled even if there is data in the buffer if the remaining data is not a complete character.
16232  * @bytes_read: (allow-none) (out): The number of bytes read. This may be zero even on success if count < 6 and the channel's encoding is non-%NULL. This indicates that the next UTF-8 character is too wide for the buffer.
16233  * @error: a location to return an error of type #GConvertError or #GIOChannelError.
16234  *
16235  * Replacement for g_io_channel_read() with the new API.
16236  *
16237  * Returns: the status of the operation.
16238  */
16239
16240
16241 /**
16242  * g_io_channel_read_line:
16243  * @channel: a #GIOChannel
16244  * @str_return: (out): The line read from the #GIOChannel, including the line terminator. This data should be freed with g_free() when no longer needed. This is a nul-terminated string. If a @length of zero is returned, this will be %NULL instead.
16245  * @length: (allow-none) (out): location to store length of the read data, or %NULL
16246  * @terminator_pos: (allow-none) (out): location to store position of line terminator, or %NULL
16247  * @error: A location to return an error of type #GConvertError or #GIOChannelError
16248  *
16249  * Reads a line, including the terminating character(s),
16250  * from a #GIOChannel into a newly-allocated string.
16251  * @str_return will contain allocated memory if the return
16252  * is %G_IO_STATUS_NORMAL.
16253  *
16254  * Returns: the status of the operation.
16255  */
16256
16257
16258 /**
16259  * g_io_channel_read_line_string:
16260  * @channel: a #GIOChannel
16261  * @buffer: a #GString into which the line will be written. If @buffer already contains data, the old data will be overwritten.
16262  * @terminator_pos: (allow-none): location to store position of line terminator, or %NULL
16263  * @error: a location to store an error of type #GConvertError or #GIOChannelError
16264  *
16265  * Reads a line from a #GIOChannel, using a #GString as a buffer.
16266  *
16267  * Returns: the status of the operation.
16268  */
16269
16270
16271 /**
16272  * g_io_channel_read_to_end:
16273  * @channel: a #GIOChannel
16274  * @str_return: (out) (array length=length) (element-type guint8): Location to store a pointer to a string holding the remaining data in the #GIOChannel. This data should be freed with g_free() when no longer needed. This data is terminated by an extra nul character, but there may be other nuls in the intervening data.
16275  * @length: (out): location to store length of the data
16276  * @error: location to return an error of type #GConvertError or #GIOChannelError
16277  *
16278  * Reads all the remaining data from the file.
16279  *
16280  * Returns: %G_IO_STATUS_NORMAL on success. This function never returns %G_IO_STATUS_EOF.
16281  */
16282
16283
16284 /**
16285  * g_io_channel_read_unichar:
16286  * @channel: a #GIOChannel
16287  * @thechar: a location to return a character
16288  * @error: a location to return an error of type #GConvertError or #GIOChannelError
16289  *
16290  * Reads a Unicode character from @channel.
16291  * This function cannot be called on a channel with %NULL encoding.
16292  *
16293  * Returns: a #GIOStatus
16294  */
16295
16296
16297 /**
16298  * g_io_channel_ref:
16299  * @channel: a #GIOChannel
16300  *
16301  * Increments the reference count of a #GIOChannel.
16302  *
16303  * Returns: the @channel that was passed in (since 2.6)
16304  */
16305
16306
16307 /**
16308  * g_io_channel_seek:
16309  * @channel: a #GIOChannel
16310  * @offset: an offset, in bytes, which is added to the position specified by @type
16311  * @type: the position in the file, which can be %G_SEEK_CUR (the current position), %G_SEEK_SET (the start of the file), or %G_SEEK_END (the end of the file)
16312  *
16313  * Sets the current position in the #GIOChannel, similar to the standard
16314  * library function fseek().
16315  *
16316  * Returns: %G_IO_ERROR_NONE if the operation was successful.
16317  * Deprecated: 2.2: Use g_io_channel_seek_position() instead.
16318  */
16319
16320
16321 /**
16322  * g_io_channel_seek_position:
16323  * @channel: a #GIOChannel
16324  * @offset: The offset in bytes from the position specified by @type
16325  * @type: a #GSeekType. The type %G_SEEK_CUR is only allowed in those cases where a call to g_io_channel_set_encoding () is allowed. See the documentation for g_io_channel_set_encoding () for details.
16326  * @error: A location to return an error of type #GIOChannelError
16327  *
16328  * Replacement for g_io_channel_seek() with the new API.
16329  *
16330  * Returns: the status of the operation.
16331  */
16332
16333
16334 /**
16335  * g_io_channel_set_buffer_size:
16336  * @channel: a #GIOChannel
16337  * @size: the size of the buffer, or 0 to let GLib pick a good size
16338  *
16339  * Sets the buffer size.
16340  */
16341
16342
16343 /**
16344  * g_io_channel_set_buffered:
16345  * @channel: a #GIOChannel
16346  * @buffered: whether to set the channel buffered or unbuffered
16347  *
16348  * The buffering state can only be set if the channel's encoding
16349  * is %NULL. For any other encoding, the channel must be buffered.
16350  *
16351  * A buffered channel can only be set unbuffered if the channel's
16352  * internal buffers have been flushed. Newly created channels or
16353  * channels which have returned %G_IO_STATUS_EOF
16354  * not require such a flush. For write-only channels, a call to
16355  * g_io_channel_flush () is sufficient. For all other channels,
16356  * the buffers may be flushed by a call to g_io_channel_seek_position ().
16357  * This includes the possibility of seeking with seek type %G_SEEK_CUR
16358  * and an offset of zero. Note that this means that socket-based
16359  * channels cannot be set unbuffered once they have had data
16360  * read from them.
16361  *
16362  * On unbuffered channels, it is safe to mix read and write
16363  * calls from the new and old APIs, if this is necessary for
16364  * maintaining old code.
16365  *
16366  * The default state of the channel is buffered.
16367  */
16368
16369
16370 /**
16371  * g_io_channel_set_close_on_unref:
16372  * @channel: a #GIOChannel
16373  * @do_close: Whether to close the channel on the final unref of the GIOChannel data structure. The default value of this is %TRUE for channels created by g_io_channel_new_file (), and %FALSE for all other channels.
16374  *
16375  * Setting this flag to %TRUE for a channel you have already closed
16376  * can cause problems.
16377  */
16378
16379
16380 /**
16381  * g_io_channel_set_encoding:
16382  * @channel: a #GIOChannel
16383  * @encoding: (allow-none): the encoding type
16384  * @error: location to store an error of type #GConvertError
16385  *
16386  * Sets the encoding for the input/output of the channel.
16387  * The internal encoding is always UTF-8. The default encoding
16388  * for the external file is UTF-8.
16389  *
16390  * The encoding %NULL is safe to use with binary data.
16391  *
16392  * The encoding can only be set if one of the following conditions
16393  * is true:
16394  * <itemizedlist>
16395  * <listitem><para>
16396  *    The channel was just created, and has not been written to or read
16397  *    from yet.
16398  * </para></listitem>
16399  * <listitem><para>
16400  *    The channel is write-only.
16401  * </para></listitem>
16402  * <listitem><para>
16403  *    The channel is a file, and the file pointer was just
16404  *    repositioned by a call to g_io_channel_seek_position().
16405  *    (This flushes all the internal buffers.)
16406  * </para></listitem>
16407  * <listitem><para>
16408  *    The current encoding is %NULL or UTF-8.
16409  * </para></listitem>
16410  * <listitem><para>
16411  *    One of the (new API) read functions has just returned %G_IO_STATUS_EOF
16412  *    (or, in the case of g_io_channel_read_to_end(), %G_IO_STATUS_NORMAL).
16413  * </para></listitem>
16414  * <listitem><para>
16415  *    One of the functions g_io_channel_read_chars() or
16416  *    g_io_channel_read_unichar() has returned %G_IO_STATUS_AGAIN or
16417  *    %G_IO_STATUS_ERROR. This may be useful in the case of
16418  *    %G_CONVERT_ERROR_ILLEGAL_SEQUENCE.
16419  *    Returning one of these statuses from g_io_channel_read_line(),
16420  *    g_io_channel_read_line_string(), or g_io_channel_read_to_end()
16421  *    does <emphasis>not</emphasis> guarantee that the encoding can
16422  *    be changed.
16423  * </para></listitem>
16424  * </itemizedlist>
16425  * Channels which do not meet one of the above conditions cannot call
16426  * g_io_channel_seek_position() with an offset of %G_SEEK_CUR, and, if
16427  * they are "seekable", cannot call g_io_channel_write_chars() after
16428  * calling one of the API "read" functions.
16429  *
16430  * Returns: %G_IO_STATUS_NORMAL if the encoding was successfully set.
16431  */
16432
16433
16434 /**
16435  * g_io_channel_set_flags:
16436  * @channel: a #GIOChannel
16437  * @flags: the flags to set on the IO channel
16438  * @error: A location to return an error of type #GIOChannelError
16439  *
16440  * Sets the (writeable) flags in @channel to (@flags & %G_IO_FLAG_SET_MASK).
16441  *
16442  * Returns: the status of the operation.
16443  */
16444
16445
16446 /**
16447  * g_io_channel_set_line_term:
16448  * @channel: a #GIOChannel
16449  * @line_term: (allow-none): The line termination string. Use %NULL for autodetect.  Autodetection breaks on "\n", "\r\n", "\r", "\0", and the Unicode paragraph separator. Autodetection should not be used for anything other than file-based channels.
16450  * @length: The length of the termination string. If -1 is passed, the string is assumed to be nul-terminated. This option allows termination strings with embedded nuls.
16451  *
16452  * This sets the string that #GIOChannel uses to determine
16453  * where in the file a line break occurs.
16454  */
16455
16456
16457 /**
16458  * g_io_channel_shutdown:
16459  * @channel: a #GIOChannel
16460  * @flush: if %TRUE, flush pending
16461  * @err: location to store a #GIOChannelError
16462  *
16463  * Close an IO channel. Any pending data to be written will be
16464  * flushed if @flush is %TRUE. The channel will not be freed until the
16465  * last reference is dropped using g_io_channel_unref().
16466  *
16467  * Returns: the status of the operation.
16468  */
16469
16470
16471 /**
16472  * g_io_channel_unix_get_fd:
16473  * @channel: a #GIOChannel, created with g_io_channel_unix_new().
16474  *
16475  * Returns the file descriptor of the #GIOChannel.
16476  *
16477  * On Windows this function returns the file descriptor or socket of
16478  * the #GIOChannel.
16479  *
16480  * Returns: the file descriptor of the #GIOChannel.
16481  */
16482
16483
16484 /**
16485  * g_io_channel_unix_new:
16486  * @fd: a file descriptor.
16487  *
16488  * Creates a new #GIOChannel given a file descriptor. On UNIX systems
16489  * this works for plain files, pipes, and sockets.
16490  *
16491  * The returned #GIOChannel has a reference count of 1.
16492  *
16493  * The default encoding for #GIOChannel is UTF-8. If your application
16494  * is reading output from a command using via pipe, you may need to set
16495  * the encoding to the encoding of the current locale (see
16496  * g_get_charset()) with the g_io_channel_set_encoding() function.
16497  *
16498  * If you want to read raw binary data without interpretation, then
16499  * call the g_io_channel_set_encoding() function with %NULL for the
16500  * encoding argument.
16501  *
16502  * This function is available in GLib on Windows, too, but you should
16503  * avoid using it on Windows. The domain of file descriptors and
16504  * sockets overlap. There is no way for GLib to know which one you mean
16505  * in case the argument you pass to this function happens to be both a
16506  * valid file descriptor and socket. If that happens a warning is
16507  * issued, and GLib assumes that it is the file descriptor you mean.
16508  *
16509  * Returns: a new #GIOChannel.
16510  */
16511
16512
16513 /**
16514  * g_io_channel_unref:
16515  * @channel: a #GIOChannel
16516  *
16517  * Decrements the reference count of a #GIOChannel.
16518  */
16519
16520
16521 /**
16522  * g_io_channel_win32_new_fd:
16523  * @fd: a C library file descriptor.
16524  *
16525  * Creates a new #GIOChannel given a file descriptor on Windows. This
16526  * works for file descriptors from the C runtime.
16527  *
16528  * This function works for file descriptors as returned by the open(),
16529  * creat(), pipe() and fileno() calls in the Microsoft C runtime. In
16530  * order to meaningfully use this function your code should use the
16531  * same C runtime as GLib uses, which is msvcrt.dll. Note that in
16532  * current Microsoft compilers it is near impossible to convince it to
16533  * build code that would use msvcrt.dll. The last Microsoft compiler
16534  * version that supported using msvcrt.dll as the C runtime was version
16535  * 6. The GNU compiler and toolchain for Windows, also known as Mingw,
16536  * fully supports msvcrt.dll.
16537  *
16538  * If you have created a #GIOChannel for a file descriptor and started
16539  * watching (polling) it, you shouldn't call read() on the file
16540  * descriptor. This is because adding polling for a file descriptor is
16541  * implemented in GLib on Windows by starting a thread that sits
16542  * blocked in a read() from the file descriptor most of the time. All
16543  * reads from the file descriptor should be done by this internal GLib
16544  * thread. Your code should call only g_io_channel_read().
16545  *
16546  * This function is available only in GLib on Windows.
16547  *
16548  * Returns: a new #GIOChannel.
16549  */
16550
16551
16552 /**
16553  * g_io_channel_win32_new_messages:
16554  * @hwnd: a window handle.
16555  *
16556  * Creates a new #GIOChannel given a window handle on Windows.
16557  *
16558  * This function creates a #GIOChannel that can be used to poll for
16559  * Windows messages for the window in question.
16560  *
16561  * Returns: a new #GIOChannel.
16562  */
16563
16564
16565 /**
16566  * g_io_channel_win32_new_socket:
16567  * @socket: a Winsock socket
16568  *
16569  * Creates a new #GIOChannel given a socket on Windows.
16570  *
16571  * This function works for sockets created by Winsock. It's available
16572  * only in GLib on Windows.
16573  *
16574  * Polling a #GSource created to watch a channel for a socket puts the
16575  * socket in non-blocking mode. This is a side-effect of the
16576  * implementation and unavoidable.
16577  *
16578  * Returns: a new #GIOChannel
16579  */
16580
16581
16582 /**
16583  * g_io_channel_write:
16584  * @channel: a #GIOChannel
16585  * @buf: the buffer containing the data to write
16586  * @count: the number of bytes to write
16587  * @bytes_written: the number of bytes actually written
16588  *
16589  * Writes data to a #GIOChannel.
16590  *
16591  * Returns: %G_IO_ERROR_NONE if the operation was successful.
16592  * Deprecated: 2.2: Use g_io_channel_write_chars() instead.
16593  */
16594
16595
16596 /**
16597  * g_io_channel_write_chars:
16598  * @channel: a #GIOChannel
16599  * @buf: (array) (element-type guint8): a buffer to write data from
16600  * @count: the size of the buffer. If -1, the buffer is taken to be a nul-terminated string.
16601  * @bytes_written: (out): The number of bytes written. This can be nonzero even if the return value is not %G_IO_STATUS_NORMAL. If the return value is %G_IO_STATUS_NORMAL and the channel is blocking, this will always be equal to @count if @count >= 0.
16602  * @error: a location to return an error of type #GConvertError or #GIOChannelError
16603  *
16604  * Replacement for g_io_channel_write() with the new API.
16605  *
16606  * On seekable channels with encodings other than %NULL or UTF-8, generic
16607  * mixing of reading and writing is not allowed. A call to g_io_channel_write_chars ()
16608  * may only be made on a channel from which data has been read in the
16609  * cases described in the documentation for g_io_channel_set_encoding ().
16610  *
16611  * Returns: the status of the operation.
16612  */
16613
16614
16615 /**
16616  * g_io_channel_write_unichar:
16617  * @channel: a #GIOChannel
16618  * @thechar: a character
16619  * @error: location to return an error of type #GConvertError or #GIOChannelError
16620  *
16621  * Writes a Unicode character to @channel.
16622  * This function cannot be called on a channel with %NULL encoding.
16623  *
16624  * Returns: a #GIOStatus
16625  */
16626
16627
16628 /**
16629  * g_io_create_watch:
16630  * @channel: a #GIOChannel to watch
16631  * @condition: conditions to watch for
16632  *
16633  * Creates a #GSource that's dispatched when @condition is met for the
16634  * given @channel. For example, if condition is #G_IO_IN, the source will
16635  * be dispatched when there's data available for reading.
16636  *
16637  * g_io_add_watch() is a simpler interface to this same functionality, for
16638  * the case where you want to add the source to the default main loop context
16639  * at the default priority.
16640  *
16641  * On Windows, polling a #GSource created to watch a channel for a socket
16642  * puts the socket in non-blocking mode. This is a side-effect of the
16643  * implementation and unavoidable.
16644  *
16645  * Returns: a new #GSource
16646  */
16647
16648
16649 /**
16650  * g_key_file_free: (skip)
16651  * @key_file: a #GKeyFile
16652  *
16653  * Clears all keys and groups from @key_file, and decreases the
16654  * reference count by 1. If the reference count reaches zero,
16655  * frees the key file and all its allocated memory.
16656  *
16657  * Since: 2.6
16658  */
16659
16660
16661 /**
16662  * g_key_file_get_boolean:
16663  * @key_file: a #GKeyFile
16664  * @group_name: a group name
16665  * @key: a key
16666  * @error: return location for a #GError
16667  *
16668  * Returns the value associated with @key under @group_name as a
16669  * boolean.
16670  *
16671  * If @key cannot be found then %FALSE is returned and @error is set
16672  * to #G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value
16673  * associated with @key cannot be interpreted as a boolean then %FALSE
16674  * is returned and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
16675  *
16676  * Returns: the value associated with the key as a boolean, or %FALSE if the key was not found or could not be parsed.
16677  * Since: 2.6
16678  */
16679
16680
16681 /**
16682  * g_key_file_get_boolean_list:
16683  * @key_file: a #GKeyFile
16684  * @group_name: a group name
16685  * @key: a key
16686  * @length: (out): the number of booleans returned
16687  * @error: return location for a #GError
16688  *
16689  * Returns the values associated with @key under @group_name as
16690  * booleans.
16691  *
16692  * If @key cannot be found then %NULL is returned and @error is set to
16693  * #G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated
16694  * with @key cannot be interpreted as booleans then %NULL is returned
16695  * and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
16696  *
16697  * Returns: (array length=length) (element-type gboolean) (transfer container): the values associated with the key as a list of booleans, or %NULL if the key was not found or could not be parsed. The returned list of booleans should be freed with g_free() when no longer needed.
16698  * Since: 2.6
16699  */
16700
16701
16702 /**
16703  * g_key_file_get_comment:
16704  * @key_file: a #GKeyFile
16705  * @group_name: (allow-none): a group name, or %NULL
16706  * @key: a key
16707  * @error: return location for a #GError
16708  *
16709  * Retrieves a comment above @key from @group_name.
16710  * If @key is %NULL then @comment will be read from above
16711  * @group_name. If both @key and @group_name are %NULL, then
16712  * @comment will be read from above the first group in the file.
16713  *
16714  * Returns: a comment that should be freed with g_free()
16715  * Since: 2.6
16716  */
16717
16718
16719 /**
16720  * g_key_file_get_double:
16721  * @key_file: a #GKeyFile
16722  * @group_name: a group name
16723  * @key: a key
16724  * @error: return location for a #GError
16725  *
16726  * Returns the value associated with @key under @group_name as a
16727  * double. If @group_name is %NULL, the start_group is used.
16728  *
16729  * If @key cannot be found then 0.0 is returned and @error is set to
16730  * #G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value associated
16731  * with @key cannot be interpreted as a double then 0.0 is returned
16732  * and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
16733  *
16734  * Returns: the value associated with the key as a double, or 0.0 if the key was not found or could not be parsed.
16735  * Since: 2.12
16736  */
16737
16738
16739 /**
16740  * g_key_file_get_double_list:
16741  * @key_file: a #GKeyFile
16742  * @group_name: a group name
16743  * @key: a key
16744  * @length: (out): the number of doubles returned
16745  * @error: return location for a #GError
16746  *
16747  * Returns the values associated with @key under @group_name as
16748  * doubles.
16749  *
16750  * If @key cannot be found then %NULL is returned and @error is set to
16751  * #G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated
16752  * with @key cannot be interpreted as doubles then %NULL is returned
16753  * and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
16754  *
16755  * Returns: (array length=length) (element-type gdouble) (transfer container): the values associated with the key as a list of doubles, or %NULL if the key was not found or could not be parsed. The returned list of doubles should be freed with g_free() when no longer needed.
16756  * Since: 2.12
16757  */
16758
16759
16760 /**
16761  * g_key_file_get_groups:
16762  * @key_file: a #GKeyFile
16763  * @length: (out) (allow-none): return location for the number of returned groups, or %NULL
16764  *
16765  * Returns all groups in the key file loaded with @key_file.
16766  * The array of returned groups will be %NULL-terminated, so
16767  * @length may optionally be %NULL.
16768  *
16769  * Returns: (array zero-terminated=1) (transfer full): a newly-allocated %NULL-terminated array of strings. Use g_strfreev() to free it.
16770  * Since: 2.6
16771  */
16772
16773
16774 /**
16775  * g_key_file_get_int64:
16776  * @key_file: a non-%NULL #GKeyFile
16777  * @group_name: a non-%NULL group name
16778  * @key: a non-%NULL key
16779  * @error: return location for a #GError
16780  *
16781  * Returns the value associated with @key under @group_name as a signed
16782  * 64-bit integer. This is similar to g_key_file_get_integer() but can return
16783  * 64-bit results without truncation.
16784  *
16785  * Returns: the value associated with the key as a signed 64-bit integer, or 0 if the key was not found or could not be parsed.
16786  * Since: 2.26
16787  */
16788
16789
16790 /**
16791  * g_key_file_get_integer:
16792  * @key_file: a #GKeyFile
16793  * @group_name: a group name
16794  * @key: a key
16795  * @error: return location for a #GError
16796  *
16797  * Returns the value associated with @key under @group_name as an
16798  * integer.
16799  *
16800  * If @key cannot be found then 0 is returned and @error is set to
16801  * #G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value associated
16802  * with @key cannot be interpreted as an integer then 0 is returned
16803  * and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
16804  *
16805  * Returns: the value associated with the key as an integer, or 0 if the key was not found or could not be parsed.
16806  * Since: 2.6
16807  */
16808
16809
16810 /**
16811  * g_key_file_get_integer_list:
16812  * @key_file: a #GKeyFile
16813  * @group_name: a group name
16814  * @key: a key
16815  * @length: (out): the number of integers returned
16816  * @error: return location for a #GError
16817  *
16818  * Returns the values associated with @key under @group_name as
16819  * integers.
16820  *
16821  * If @key cannot be found then %NULL is returned and @error is set to
16822  * #G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated
16823  * with @key cannot be interpreted as integers then %NULL is returned
16824  * and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
16825  *
16826  * Returns: (array length=length) (element-type gint) (transfer container): the values associated with the key as a list of integers, or %NULL if the key was not found or could not be parsed. The returned list of integers should be freed with g_free() when no longer needed.
16827  * Since: 2.6
16828  */
16829
16830
16831 /**
16832  * g_key_file_get_keys:
16833  * @key_file: a #GKeyFile
16834  * @group_name: a group name
16835  * @length: (out) (allow-none): return location for the number of keys returned, or %NULL
16836  * @error: return location for a #GError, or %NULL
16837  *
16838  * Returns all keys for the group name @group_name.  The array of
16839  * returned keys will be %NULL-terminated, so @length may
16840  * optionally be %NULL. In the event that the @group_name cannot
16841  * be found, %NULL is returned and @error is set to
16842  * #G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
16843  *
16844  * Returns: (array zero-terminated=1) (transfer full): a newly-allocated %NULL-terminated array of strings. Use g_strfreev() to free it.
16845  * Since: 2.6
16846  */
16847
16848
16849 /**
16850  * g_key_file_get_locale_string:
16851  * @key_file: a #GKeyFile
16852  * @group_name: a group name
16853  * @key: a key
16854  * @locale: (allow-none): a locale identifier or %NULL
16855  * @error: return location for a #GError, or %NULL
16856  *
16857  * Returns the value associated with @key under @group_name
16858  * translated in the given @locale if available.  If @locale is
16859  * %NULL then the current locale is assumed.
16860  *
16861  * If @key cannot be found then %NULL is returned and @error is set
16862  * to #G_KEY_FILE_ERROR_KEY_NOT_FOUND. If the value associated
16863  * with @key cannot be interpreted or no suitable translation can
16864  * be found then the untranslated value is returned.
16865  *
16866  * Returns: a newly allocated string or %NULL if the specified key cannot be found.
16867  * Since: 2.6
16868  */
16869
16870
16871 /**
16872  * g_key_file_get_locale_string_list:
16873  * @key_file: a #GKeyFile
16874  * @group_name: a group name
16875  * @key: a key
16876  * @locale: (allow-none): a locale identifier or %NULL
16877  * @length: (out) (allow-none): return location for the number of returned strings or %NULL
16878  * @error: return location for a #GError or %NULL
16879  *
16880  * Returns the values associated with @key under @group_name
16881  * translated in the given @locale if available.  If @locale is
16882  * %NULL then the current locale is assumed.
16883  *
16884  * If @key cannot be found then %NULL is returned and @error is set
16885  * to #G_KEY_FILE_ERROR_KEY_NOT_FOUND. If the values associated
16886  * with @key cannot be interpreted or no suitable translations
16887  * can be found then the untranslated values are returned. The
16888  * returned array is %NULL-terminated, so @length may optionally
16889  * be %NULL.
16890  *
16891  * Returns: (array zero-terminated=1 length=length) (element-type utf8) (transfer full): a newly allocated %NULL-terminated string array or %NULL if the key isn't found. The string array should be freed with g_strfreev().
16892  * Since: 2.6
16893  */
16894
16895
16896 /**
16897  * g_key_file_get_start_group:
16898  * @key_file: a #GKeyFile
16899  *
16900  * Returns the name of the start group of the file.
16901  *
16902  * Returns: The start group of the key file.
16903  * Since: 2.6
16904  */
16905
16906
16907 /**
16908  * g_key_file_get_string:
16909  * @key_file: a #GKeyFile
16910  * @group_name: a group name
16911  * @key: a key
16912  * @error: return location for a #GError, or %NULL
16913  *
16914  * Returns the string value associated with @key under @group_name.
16915  * Unlike g_key_file_get_value(), this function handles escape sequences
16916  * like \s.
16917  *
16918  * In the event the key cannot be found, %NULL is returned and
16919  * @error is set to #G_KEY_FILE_ERROR_KEY_NOT_FOUND.  In the
16920  * event that the @group_name cannot be found, %NULL is returned
16921  * and @error is set to #G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
16922  *
16923  * Returns: a newly allocated string or %NULL if the specified key cannot be found.
16924  * Since: 2.6
16925  */
16926
16927
16928 /**
16929  * g_key_file_get_string_list:
16930  * @key_file: a #GKeyFile
16931  * @group_name: a group name
16932  * @key: a key
16933  * @length: (out) (allow-none): return location for the number of returned strings, or %NULL
16934  * @error: return location for a #GError, or %NULL
16935  *
16936  * Returns the values associated with @key under @group_name.
16937  *
16938  * In the event the key cannot be found, %NULL is returned and
16939  * @error is set to #G_KEY_FILE_ERROR_KEY_NOT_FOUND.  In the
16940  * event that the @group_name cannot be found, %NULL is returned
16941  * and @error is set to #G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
16942  *
16943  * Returns: (array zero-terminated=1 length=length) (element-type utf8) (transfer full): a %NULL-terminated string array or %NULL if the specified key cannot be found. The array should be freed with g_strfreev().
16944  * Since: 2.6
16945  */
16946
16947
16948 /**
16949  * g_key_file_get_uint64:
16950  * @key_file: a non-%NULL #GKeyFile
16951  * @group_name: a non-%NULL group name
16952  * @key: a non-%NULL key
16953  * @error: return location for a #GError
16954  *
16955  * Returns the value associated with @key under @group_name as an unsigned
16956  * 64-bit integer. This is similar to g_key_file_get_integer() but can return
16957  * large positive results without truncation.
16958  *
16959  * Returns: the value associated with the key as an unsigned 64-bit integer, or 0 if the key was not found or could not be parsed.
16960  * Since: 2.26
16961  */
16962
16963
16964 /**
16965  * g_key_file_get_value:
16966  * @key_file: a #GKeyFile
16967  * @group_name: a group name
16968  * @key: a key
16969  * @error: return location for a #GError, or %NULL
16970  *
16971  * Returns the raw value associated with @key under @group_name.
16972  * Use g_key_file_get_string() to retrieve an unescaped UTF-8 string.
16973  *
16974  * In the event the key cannot be found, %NULL is returned and
16975  * @error is set to #G_KEY_FILE_ERROR_KEY_NOT_FOUND.  In the
16976  * event that the @group_name cannot be found, %NULL is returned
16977  * and @error is set to #G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
16978  *
16979  * Returns: a newly allocated string or %NULL if the specified key cannot be found.
16980  * Since: 2.6
16981  */
16982
16983
16984 /**
16985  * g_key_file_has_group:
16986  * @key_file: a #GKeyFile
16987  * @group_name: a group name
16988  *
16989  * Looks whether the key file has the group @group_name.
16990  *
16991  * Returns: %TRUE if @group_name is a part of @key_file, %FALSE otherwise.
16992  * Since: 2.6
16993  */
16994
16995
16996 /**
16997  * g_key_file_has_key: (skip)
16998  * @key_file: a #GKeyFile
16999  * @group_name: a group name
17000  * @key: a key name
17001  * @error: return location for a #GError
17002  *
17003  * Looks whether the key file has the key @key in the group
17004  * @group_name.
17005  *
17006  * <note>This function does not follow the rules for #GError strictly;
17007  * the return value both carries meaning and signals an error.  To use
17008  * this function, you must pass a #GError pointer in @error, and check
17009  * whether it is not %NULL to see if an error occurred.</note>
17010  *
17011  * Language bindings should use g_key_file_get_value() to test whether
17012  * or not a key exists.
17013  *
17014  * Returns: %TRUE if @key is a part of @group_name, %FALSE otherwise.
17015  * Since: 2.6
17016  */
17017
17018
17019 /**
17020  * g_key_file_load_from_data:
17021  * @key_file: an empty #GKeyFile struct
17022  * @data: key file loaded in memory
17023  * @length: the length of @data in bytes (or -1 if data is nul-terminated)
17024  * @flags: flags from #GKeyFileFlags
17025  * @error: return location for a #GError, or %NULL
17026  *
17027  * Loads a key file from memory into an empty #GKeyFile structure.
17028  * If the object cannot be created then %error is set to a #GKeyFileError.
17029  *
17030  * Returns: %TRUE if a key file could be loaded, %FALSE otherwise
17031  * Since: 2.6
17032  */
17033
17034
17035 /**
17036  * g_key_file_load_from_data_dirs:
17037  * @key_file: an empty #GKeyFile struct
17038  * @file: (type filename): a relative path to a filename to open and parse
17039  * @full_path: (out) (type filename) (allow-none): return location for a string containing the full path of the file, or %NULL
17040  * @flags: flags from #GKeyFileFlags
17041  * @error: return location for a #GError, or %NULL
17042  *
17043  * This function looks for a key file named @file in the paths
17044  * returned from g_get_user_data_dir() and g_get_system_data_dirs(),
17045  * loads the file into @key_file and returns the file's full path in
17046  * @full_path.  If the file could not be loaded then an %error is
17047  * set to either a #GFileError or #GKeyFileError.
17048  *
17049  * Returns: %TRUE if a key file could be loaded, %FALSE othewise
17050  * Since: 2.6
17051  */
17052
17053
17054 /**
17055  * g_key_file_load_from_dirs:
17056  * @key_file: an empty #GKeyFile struct
17057  * @file: (type filename): a relative path to a filename to open and parse
17058  * @search_dirs: (array zero-terminated=1) (element-type filename): %NULL-terminated array of directories to search
17059  * @full_path: (out) (type filename) (allow-none): return location for a string containing the full path of the file, or %NULL
17060  * @flags: flags from #GKeyFileFlags
17061  * @error: return location for a #GError, or %NULL
17062  *
17063  * This function looks for a key file named @file in the paths
17064  * specified in @search_dirs, loads the file into @key_file and
17065  * returns the file's full path in @full_path.  If the file could not
17066  * be loaded then an %error is set to either a #GFileError or
17067  * #GKeyFileError.
17068  *
17069  * Returns: %TRUE if a key file could be loaded, %FALSE otherwise
17070  * Since: 2.14
17071  */
17072
17073
17074 /**
17075  * g_key_file_load_from_file:
17076  * @key_file: an empty #GKeyFile struct
17077  * @file: (type filename): the path of a filename to load, in the GLib filename encoding
17078  * @flags: flags from #GKeyFileFlags
17079  * @error: return location for a #GError, or %NULL
17080  *
17081  * Loads a key file into an empty #GKeyFile structure.
17082  * If the file could not be loaded then @error is set to
17083  * either a #GFileError or #GKeyFileError.
17084  *
17085  * Returns: %TRUE if a key file could be loaded, %FALSE otherwise
17086  * Since: 2.6
17087  */
17088
17089
17090 /**
17091  * g_key_file_new:
17092  *
17093  * Creates a new empty #GKeyFile object. Use
17094  * g_key_file_load_from_file(), g_key_file_load_from_data(),
17095  * g_key_file_load_from_dirs() or g_key_file_load_from_data_dirs() to
17096  * read an existing key file.
17097  *
17098  * Returns: (transfer full): an empty #GKeyFile.
17099  * Since: 2.6
17100  */
17101
17102
17103 /**
17104  * g_key_file_ref: (skip)
17105  * @key_file: a #GKeyFile
17106  *
17107  * Increases the reference count of @key_file.
17108  *
17109  * Returns: the same @key_file.
17110  * Since: 2.32
17111  */
17112
17113
17114 /**
17115  * g_key_file_remove_comment:
17116  * @key_file: a #GKeyFile
17117  * @group_name: (allow-none): a group name, or %NULL
17118  * @key: (allow-none): a key
17119  * @error: return location for a #GError
17120  *
17121  * Removes a comment above @key from @group_name.
17122  * If @key is %NULL then @comment will be removed above @group_name.
17123  * If both @key and @group_name are %NULL, then @comment will
17124  * be removed above the first group in the file.
17125  *
17126  * Returns: %TRUE if the comment was removed, %FALSE otherwise
17127  * Since: 2.6
17128  */
17129
17130
17131 /**
17132  * g_key_file_remove_group:
17133  * @key_file: a #GKeyFile
17134  * @group_name: a group name
17135  * @error: return location for a #GError or %NULL
17136  *
17137  * Removes the specified group, @group_name,
17138  * from the key file.
17139  *
17140  * Returns: %TRUE if the group was removed, %FALSE otherwise
17141  * Since: 2.6
17142  */
17143
17144
17145 /**
17146  * g_key_file_remove_key:
17147  * @key_file: a #GKeyFile
17148  * @group_name: a group name
17149  * @key: a key name to remove
17150  * @error: return location for a #GError or %NULL
17151  *
17152  * Removes @key in @group_name from the key file.
17153  *
17154  * Returns: %TRUE if the key was removed, %FALSE otherwise
17155  * Since: 2.6
17156  */
17157
17158
17159 /**
17160  * g_key_file_set_boolean:
17161  * @key_file: a #GKeyFile
17162  * @group_name: a group name
17163  * @key: a key
17164  * @value: %TRUE or %FALSE
17165  *
17166  * Associates a new boolean value with @key under @group_name.
17167  * If @key cannot be found then it is created.
17168  *
17169  * Since: 2.6
17170  */
17171
17172
17173 /**
17174  * g_key_file_set_boolean_list:
17175  * @key_file: a #GKeyFile
17176  * @group_name: a group name
17177  * @key: a key
17178  * @list: (array length=length): an array of boolean values
17179  * @length: length of @list
17180  *
17181  * Associates a list of boolean values with @key under @group_name.
17182  * If @key cannot be found then it is created.
17183  * If @group_name is %NULL, the start_group is used.
17184  *
17185  * Since: 2.6
17186  */
17187
17188
17189 /**
17190  * g_key_file_set_comment:
17191  * @key_file: a #GKeyFile
17192  * @group_name: (allow-none): a group name, or %NULL
17193  * @key: (allow-none): a key
17194  * @comment: a comment
17195  * @error: return location for a #GError
17196  *
17197  * Places a comment above @key from @group_name.
17198  * If @key is %NULL then @comment will be written above @group_name.
17199  * If both @key and @group_name  are %NULL, then @comment will be
17200  * written above the first group in the file.
17201  *
17202  * Returns: %TRUE if the comment was written, %FALSE otherwise
17203  * Since: 2.6
17204  */
17205
17206
17207 /**
17208  * g_key_file_set_double:
17209  * @key_file: a #GKeyFile
17210  * @group_name: a group name
17211  * @key: a key
17212  * @value: an double value
17213  *
17214  * Associates a new double value with @key under @group_name.
17215  * If @key cannot be found then it is created.
17216  *
17217  * Since: 2.12
17218  */
17219
17220
17221 /**
17222  * g_key_file_set_double_list:
17223  * @key_file: a #GKeyFile
17224  * @group_name: a group name
17225  * @key: a key
17226  * @list: (array length=length): an array of double values
17227  * @length: number of double values in @list
17228  *
17229  * Associates a list of double values with @key under
17230  * @group_name.  If @key cannot be found then it is created.
17231  *
17232  * Since: 2.12
17233  */
17234
17235
17236 /**
17237  * g_key_file_set_int64:
17238  * @key_file: a #GKeyFile
17239  * @group_name: a group name
17240  * @key: a key
17241  * @value: an integer value
17242  *
17243  * Associates a new integer value with @key under @group_name.
17244  * If @key cannot be found then it is created.
17245  *
17246  * Since: 2.26
17247  */
17248
17249
17250 /**
17251  * g_key_file_set_integer:
17252  * @key_file: a #GKeyFile
17253  * @group_name: a group name
17254  * @key: a key
17255  * @value: an integer value
17256  *
17257  * Associates a new integer value with @key under @group_name.
17258  * If @key cannot be found then it is created.
17259  *
17260  * Since: 2.6
17261  */
17262
17263
17264 /**
17265  * g_key_file_set_integer_list:
17266  * @key_file: a #GKeyFile
17267  * @group_name: a group name
17268  * @key: a key
17269  * @list: (array length=length): an array of integer values
17270  * @length: number of integer values in @list
17271  *
17272  * Associates a list of integer values with @key under @group_name.
17273  * If @key cannot be found then it is created.
17274  *
17275  * Since: 2.6
17276  */
17277
17278
17279 /**
17280  * g_key_file_set_list_separator:
17281  * @key_file: a #GKeyFile
17282  * @separator: the separator
17283  *
17284  * Sets the character which is used to separate
17285  * values in lists. Typically ';' or ',' are used
17286  * as separators. The default list separator is ';'.
17287  *
17288  * Since: 2.6
17289  */
17290
17291
17292 /**
17293  * g_key_file_set_locale_string:
17294  * @key_file: a #GKeyFile
17295  * @group_name: a group name
17296  * @key: a key
17297  * @locale: a locale identifier
17298  * @string: a string
17299  *
17300  * Associates a string value for @key and @locale under @group_name.
17301  * If the translation for @key cannot be found then it is created.
17302  *
17303  * Since: 2.6
17304  */
17305
17306
17307 /**
17308  * g_key_file_set_locale_string_list:
17309  * @key_file: a #GKeyFile
17310  * @group_name: a group name
17311  * @key: a key
17312  * @locale: a locale identifier
17313  * @list: (array zero-terminated=1 length=length): a %NULL-terminated array of locale string values
17314  * @length: the length of @list
17315  *
17316  * Associates a list of string values for @key and @locale under
17317  * @group_name.  If the translation for @key cannot be found then
17318  * it is created.
17319  *
17320  * Since: 2.6
17321  */
17322
17323
17324 /**
17325  * g_key_file_set_string:
17326  * @key_file: a #GKeyFile
17327  * @group_name: a group name
17328  * @key: a key
17329  * @string: a string
17330  *
17331  * Associates a new string value with @key under @group_name.
17332  * If @key cannot be found then it is created.
17333  * If @group_name cannot be found then it is created.
17334  * Unlike g_key_file_set_value(), this function handles characters
17335  * that need escaping, such as newlines.
17336  *
17337  * Since: 2.6
17338  */
17339
17340
17341 /**
17342  * g_key_file_set_string_list:
17343  * @key_file: a #GKeyFile
17344  * @group_name: a group name
17345  * @key: a key
17346  * @list: (array zero-terminated=1 length=length) (element-type utf8): an array of string values
17347  * @length: number of string values in @list
17348  *
17349  * Associates a list of string values for @key under @group_name.
17350  * If @key cannot be found then it is created.
17351  * If @group_name cannot be found then it is created.
17352  *
17353  * Since: 2.6
17354  */
17355
17356
17357 /**
17358  * g_key_file_set_uint64:
17359  * @key_file: a #GKeyFile
17360  * @group_name: a group name
17361  * @key: a key
17362  * @value: an integer value
17363  *
17364  * Associates a new integer value with @key under @group_name.
17365  * If @key cannot be found then it is created.
17366  *
17367  * Since: 2.26
17368  */
17369
17370
17371 /**
17372  * g_key_file_set_value:
17373  * @key_file: a #GKeyFile
17374  * @group_name: a group name
17375  * @key: a key
17376  * @value: a string
17377  *
17378  * Associates a new value with @key under @group_name.
17379  *
17380  * If @key cannot be found then it is created. If @group_name cannot
17381  * be found then it is created. To set an UTF-8 string which may contain
17382  * characters that need escaping (such as newlines or spaces), use
17383  * g_key_file_set_string().
17384  *
17385  * Since: 2.6
17386  */
17387
17388
17389 /**
17390  * g_key_file_to_data:
17391  * @key_file: a #GKeyFile
17392  * @length: (out) (allow-none): return location for the length of the returned string, or %NULL
17393  * @error: return location for a #GError, or %NULL
17394  *
17395  * This function outputs @key_file as a string.
17396  *
17397  * Note that this function never reports an error,
17398  * so it is safe to pass %NULL as @error.
17399  *
17400  * Returns: a newly allocated string holding the contents of the #GKeyFile
17401  * Since: 2.6
17402  */
17403
17404
17405 /**
17406  * g_key_file_unref:
17407  * @key_file: a #GKeyFile
17408  *
17409  * Decreases the reference count of @key_file by 1. If the reference count
17410  * reaches zero, frees the key file and all its allocated memory.
17411  *
17412  * Since: 2.32
17413  */
17414
17415
17416 /**
17417  * g_list_alloc:
17418  *
17419  * Allocates space for one #GList element. It is called by
17420  * g_list_append(), g_list_prepend(), g_list_insert() and
17421  * g_list_insert_sorted() and so is rarely used on its own.
17422  *
17423  * Returns: a pointer to the newly-allocated #GList element.
17424  */
17425
17426
17427 /**
17428  * g_list_append:
17429  * @list: a pointer to a #GList
17430  * @data: the data for the new element
17431  *
17432  * Adds a new element on to the end of the list.
17433  *
17434  * <note><para>
17435  * The return value is the new start of the list, which
17436  * may have changed, so make sure you store the new value.
17437  * </para></note>
17438  *
17439  * <note><para>
17440  * Note that g_list_append() has to traverse the entire list
17441  * to find the end, which is inefficient when adding multiple
17442  * elements. A common idiom to avoid the inefficiency is to prepend
17443  * the elements and reverse the list when all elements have been added.
17444  * </para></note>
17445  *
17446  * |[
17447  * /&ast; Notice that these are initialized to the empty list. &ast;/
17448  * GList *list = NULL, *number_list = NULL;
17449  *
17450  * /&ast; This is a list of strings. &ast;/
17451  * list = g_list_append (list, "first");
17452  * list = g_list_append (list, "second");
17453  *
17454  * /&ast; This is a list of integers. &ast;/
17455  * number_list = g_list_append (number_list, GINT_TO_POINTER (27));
17456  * number_list = g_list_append (number_list, GINT_TO_POINTER (14));
17457  * ]|
17458  *
17459  * Returns: the new start of the #GList
17460  */
17461
17462
17463 /**
17464  * g_list_concat:
17465  * @list1: a #GList
17466  * @list2: the #GList to add to the end of the first #GList
17467  *
17468  * Adds the second #GList onto the end of the first #GList.
17469  * Note that the elements of the second #GList are not copied.
17470  * They are used directly.
17471  *
17472  * Returns: the start of the new #GList
17473  */
17474
17475
17476 /**
17477  * g_list_copy:
17478  * @list: a #GList
17479  *
17480  * Copies a #GList.
17481  *
17482  * <note><para>
17483  * Note that this is a "shallow" copy. If the list elements
17484  * consist of pointers to data, the pointers are copied but
17485  * the actual data is not. See g_list_copy_deep() if you need
17486  * to copy the data as well.
17487  * </para></note>
17488  *
17489  * Returns: a copy of @list
17490  */
17491
17492
17493 /**
17494  * g_list_copy_deep:
17495  * @list: a #GList
17496  * @func: a copy function used to copy every element in the list
17497  * @user_data: user data passed to the copy function @func, or #NULL
17498  *
17499  * Makes a full (deep) copy of a #GList.
17500  *
17501  * In contrast with g_list_copy(), this function uses @func to make a copy of
17502  * each list element, in addition to copying the list container itself.
17503  *
17504  * @func, as a #GCopyFunc, takes two arguments, the data to be copied and a user
17505  * pointer. It's safe to pass #NULL as user_data, if the copy function takes only
17506  * one argument.
17507  *
17508  * For instance, if @list holds a list of GObjects, you can do:
17509  * |[
17510  * another_list = g_list_copy_deep (list, (GCopyFunc) g_object_ref, NULL);
17511  * ]|
17512  *
17513  * And, to entirely free the new list, you could do:
17514  * |[
17515  * g_list_free_full (another_list, g_object_unref);
17516  * ]|
17517  *
17518  * Returns: a full copy of @list, use #g_list_free_full to free it
17519  * Since: 2.34
17520  */
17521
17522
17523 /**
17524  * g_list_delete_link:
17525  * @list: a #GList
17526  * @link_: node to delete from @list
17527  *
17528  * Removes the node link_ from the list and frees it.
17529  * Compare this to g_list_remove_link() which removes the node
17530  * without freeing it.
17531  *
17532  * Returns: the new head of @list
17533  */
17534
17535
17536 /**
17537  * g_list_find:
17538  * @list: a #GList
17539  * @data: the element data to find
17540  *
17541  * Finds the element in a #GList which
17542  * contains the given data.
17543  *
17544  * Returns: the found #GList element, or %NULL if it is not found
17545  */
17546
17547
17548 /**
17549  * g_list_find_custom:
17550  * @list: a #GList
17551  * @data: user data passed to the function
17552  * @func: the function to call for each element. It should return 0 when the desired element is found
17553  *
17554  * Finds an element in a #GList, using a supplied function to
17555  * find the desired element. It iterates over the list, calling
17556  * the given function which should return 0 when the desired
17557  * element is found. The function takes two #gconstpointer arguments,
17558  * the #GList element's data as the first argument and the
17559  * given user data.
17560  *
17561  * Returns: the found #GList element, or %NULL if it is not found
17562  */
17563
17564
17565 /**
17566  * g_list_first:
17567  * @list: a #GList
17568  *
17569  * Gets the first element in a #GList.
17570  *
17571  * Returns: the first element in the #GList, or %NULL if the #GList has no elements
17572  */
17573
17574
17575 /**
17576  * g_list_foreach:
17577  * @list: a #GList
17578  * @func: the function to call with each element's data
17579  * @user_data: user data to pass to the function
17580  *
17581  * Calls a function for each element of a #GList.
17582  */
17583
17584
17585 /**
17586  * g_list_free:
17587  * @list: a #GList
17588  *
17589  * Frees all of the memory used by a #GList.
17590  * The freed elements are returned to the slice allocator.
17591  *
17592  * <note><para>
17593  * If list elements contain dynamically-allocated memory,
17594  * you should either use g_list_free_full() or free them manually
17595  * first.
17596  * </para></note>
17597  */
17598
17599
17600 /**
17601  * g_list_free1:
17602  *
17603  * Another name for g_list_free_1().
17604  */
17605
17606
17607 /**
17608  * g_list_free_1:
17609  * @list: a #GList element
17610  *
17611  * Frees one #GList element.
17612  * It is usually used after g_list_remove_link().
17613  */
17614
17615
17616 /**
17617  * g_list_free_full:
17618  * @list: a pointer to a #GList
17619  * @free_func: the function to be called to free each element's data
17620  *
17621  * Convenience method, which frees all the memory used by a #GList, and
17622  * calls the specified destroy function on every element's data.
17623  *
17624  * Since: 2.28
17625  */
17626
17627
17628 /**
17629  * g_list_index:
17630  * @list: a #GList
17631  * @data: the data to find
17632  *
17633  * Gets the position of the element containing
17634  * the given data (starting from 0).
17635  *
17636  * Returns: the index of the element containing the data, or -1 if the data is not found
17637  */
17638
17639
17640 /**
17641  * g_list_insert:
17642  * @list: a pointer to a #GList
17643  * @data: the data for the new element
17644  * @position: the position to insert the element. If this is negative, or is larger than the number of elements in the list, the new element is added on to the end of the list.
17645  *
17646  * Inserts a new element into the list at the given position.
17647  *
17648  * Returns: the new start of the #GList
17649  */
17650
17651
17652 /**
17653  * g_list_insert_before:
17654  * @list: a pointer to a #GList
17655  * @sibling: the list element before which the new element is inserted or %NULL to insert at the end of the list
17656  * @data: the data for the new element
17657  *
17658  * Inserts a new element into the list before the given position.
17659  *
17660  * Returns: the new start of the #GList
17661  */
17662
17663
17664 /**
17665  * g_list_insert_sorted:
17666  * @list: a pointer to a #GList
17667  * @data: the data for the new element
17668  * @func: the function to compare elements in the list. It should return a number > 0 if the first parameter comes after the second parameter in the sort order.
17669  *
17670  * Inserts a new element into the list, using the given comparison
17671  * function to determine its position.
17672  *
17673  * Returns: the new start of the #GList
17674  */
17675
17676
17677 /**
17678  * g_list_insert_sorted_with_data:
17679  * @list: a pointer to a #GList
17680  * @data: the data for the new element
17681  * @func: the function to compare elements in the list. It should return a number > 0 if the first parameter comes after the second parameter in the sort order.
17682  * @user_data: user data to pass to comparison function.
17683  *
17684  * Inserts a new element into the list, using the given comparison
17685  * function to determine its position.
17686  *
17687  * Returns: the new start of the #GList
17688  * Since: 2.10
17689  */
17690
17691
17692 /**
17693  * g_list_last:
17694  * @list: a #GList
17695  *
17696  * Gets the last element in a #GList.
17697  *
17698  * Returns: the last element in the #GList, or %NULL if the #GList has no elements
17699  */
17700
17701
17702 /**
17703  * g_list_length:
17704  * @list: a #GList
17705  *
17706  * Gets the number of elements in a #GList.
17707  *
17708  * <note><para>
17709  * This function iterates over the whole list to
17710  * count its elements.
17711  * </para></note>
17712  *
17713  * Returns: the number of elements in the #GList
17714  */
17715
17716
17717 /**
17718  * g_list_next:
17719  * @list: an element in a #GList.
17720  *
17721  * A convenience macro to get the next element in a #GList.
17722  *
17723  * Returns: the next element, or %NULL if there are no more elements.
17724  */
17725
17726
17727 /**
17728  * g_list_nth:
17729  * @list: a #GList
17730  * @n: the position of the element, counting from 0
17731  *
17732  * Gets the element at the given position in a #GList.
17733  *
17734  * Returns: the element, or %NULL if the position is off the end of the #GList
17735  */
17736
17737
17738 /**
17739  * g_list_nth_data:
17740  * @list: a #GList
17741  * @n: the position of the element
17742  *
17743  * Gets the data of the element at the given position.
17744  *
17745  * Returns: the element's data, or %NULL if the position is off the end of the #GList
17746  */
17747
17748
17749 /**
17750  * g_list_nth_prev:
17751  * @list: a #GList
17752  * @n: the position of the element, counting from 0
17753  *
17754  * Gets the element @n places before @list.
17755  *
17756  * Returns: the element, or %NULL if the position is off the end of the #GList
17757  */
17758
17759
17760 /**
17761  * g_list_position:
17762  * @list: a #GList
17763  * @llink: an element in the #GList
17764  *
17765  * Gets the position of the given element
17766  * in the #GList (starting from 0).
17767  *
17768  * Returns: the position of the element in the #GList, or -1 if the element is not found
17769  */
17770
17771
17772 /**
17773  * g_list_prepend:
17774  * @list: a pointer to a #GList
17775  * @data: the data for the new element
17776  *
17777  * Adds a new element on to the start of the list.
17778  *
17779  * <note><para>
17780  * The return value is the new start of the list, which
17781  * may have changed, so make sure you store the new value.
17782  * </para></note>
17783  *
17784  * |[
17785  * /&ast; Notice that it is initialized to the empty list. &ast;/
17786  * GList *list = NULL;
17787  * list = g_list_prepend (list, "last");
17788  * list = g_list_prepend (list, "first");
17789  * ]|
17790  *
17791  * Returns: the new start of the #GList
17792  */
17793
17794
17795 /**
17796  * g_list_previous:
17797  * @list: an element in a #GList.
17798  *
17799  * A convenience macro to get the previous element in a #GList.
17800  *
17801  * Returns: the previous element, or %NULL if there are no previous elements.
17802  */
17803
17804
17805 /**
17806  * g_list_remove:
17807  * @list: a #GList
17808  * @data: the data of the element to remove
17809  *
17810  * Removes an element from a #GList.
17811  * If two elements contain the same data, only the first is removed.
17812  * If none of the elements contain the data, the #GList is unchanged.
17813  *
17814  * Returns: the new start of the #GList
17815  */
17816
17817
17818 /**
17819  * g_list_remove_all:
17820  * @list: a #GList
17821  * @data: data to remove
17822  *
17823  * Removes all list nodes with data equal to @data.
17824  * Returns the new head of the list. Contrast with
17825  * g_list_remove() which removes only the first node
17826  * matching the given data.
17827  *
17828  * Returns: new head of @list
17829  */
17830
17831
17832 /**
17833  * g_list_remove_link:
17834  * @list: a #GList
17835  * @llink: an element in the #GList
17836  *
17837  * Removes an element from a #GList, without freeing the element.
17838  * The removed element's prev and next links are set to %NULL, so
17839  * that it becomes a self-contained list with one element.
17840  *
17841  * Returns: the new start of the #GList, without the element
17842  */
17843
17844
17845 /**
17846  * g_list_reverse:
17847  * @list: a #GList
17848  *
17849  * Reverses a #GList.
17850  * It simply switches the next and prev pointers of each element.
17851  *
17852  * Returns: the start of the reversed #GList
17853  */
17854
17855
17856 /**
17857  * g_list_sort:
17858  * @list: a #GList
17859  * @compare_func: the comparison function used to sort the #GList. This function is passed the data from 2 elements of the #GList and should return 0 if they are equal, a negative value if the first element comes before the second, or a positive value if the first element comes after the second.
17860  *
17861  * Sorts a #GList using the given comparison function. The algorithm
17862  * used is a stable sort.
17863  *
17864  * Returns: the start of the sorted #GList
17865  */
17866
17867
17868 /**
17869  * g_list_sort_with_data:
17870  * @list: a #GList
17871  * @compare_func: comparison function
17872  * @user_data: user data to pass to comparison function
17873  *
17874  * Like g_list_sort(), but the comparison function accepts
17875  * a user data argument.
17876  *
17877  * Returns: the new head of @list
17878  */
17879
17880
17881 /**
17882  * g_listenv:
17883  *
17884  * Gets the names of all variables set in the environment.
17885  *
17886  * Programs that want to be portable to Windows should typically use
17887  * this function and g_getenv() instead of using the environ array
17888  * from the C library directly. On Windows, the strings in the environ
17889  * array are in system codepage encoding, while in most of the typical
17890  * use cases for environment variables in GLib-using programs you want
17891  * the UTF-8 encoding that this function and g_getenv() provide.
17892  *
17893  * Returns: (array zero-terminated=1) (transfer full): a %NULL-terminated list of strings which must be freed with g_strfreev().
17894  * Since: 2.8
17895  */
17896
17897
17898 /**
17899  * g_locale_from_utf8:
17900  * @utf8string: a UTF-8 encoded string
17901  * @len: the length of the string, or -1 if the string is nul-terminated<footnoteref linkend="nul-unsafe"/>.
17902  * @bytes_read: location to store the number of bytes in the input string that were successfully converted, or %NULL. Even if the conversion was successful, this may be less than @len if there were partial characters at the end of the input. If the error #G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will the byte offset after the last valid input sequence.
17903  * @bytes_written: the number of bytes stored in the output buffer (not including the terminating nul).
17904  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError may occur.
17905  *
17906  * Converts a string from UTF-8 to the encoding used for strings by
17907  * the C runtime (usually the same as that used by the operating
17908  * system) in the <link linkend="setlocale">current locale</link>. On
17909  * Windows this means the system codepage.
17910  *
17911  * Returns: The converted string, or %NULL on an error.
17912  */
17913
17914
17915 /**
17916  * g_locale_to_utf8:
17917  * @opsysstring: a string in the encoding of the current locale. On Windows this means the system codepage.
17918  * @len: the length of the string, or -1 if the string is nul-terminated<footnoteref linkend="nul-unsafe"/>.
17919  * @bytes_read: location to store the number of bytes in the input string that were successfully converted, or %NULL. Even if the conversion was successful, this may be less than @len if there were partial characters at the end of the input. If the error #G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will the byte offset after the last valid input sequence.
17920  * @bytes_written: the number of bytes stored in the output buffer (not including the terminating nul).
17921  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError may occur.
17922  *
17923  * Converts a string which is in the encoding used for strings by
17924  * the C runtime (usually the same as that used by the operating
17925  * system) in the <link linkend="setlocale">current locale</link> into a
17926  * UTF-8 string.
17927  *
17928  * Returns: The converted string, or %NULL on an error.
17929  */
17930
17931
17932 /**
17933  * g_log:
17934  * @log_domain: the log domain, usually #G_LOG_DOMAIN
17935  * @log_level: the log level, either from #GLogLevelFlags or a user-defined level
17936  * @format: the message format. See the printf() documentation
17937  * @...: the parameters to insert into the format string
17938  *
17939  * Logs an error or debugging message.
17940  *
17941  * If the log level has been set as fatal, the abort()
17942  * function is called to terminate the program.
17943  */
17944
17945
17946 /**
17947  * g_log_default_handler:
17948  * @log_domain: the log domain of the message
17949  * @log_level: the level of the message
17950  * @message: the message
17951  * @unused_data: data passed from g_log() which is unused
17952  *
17953  * The default log handler set up by GLib; g_log_set_default_handler()
17954  * allows to install an alternate default log handler.
17955  * This is used if no log handler has been set for the particular log
17956  * domain and log level combination. It outputs the message to stderr
17957  * or stdout and if the log level is fatal it calls abort().
17958  *
17959  * The behavior of this log handler can be influenced by a number of
17960  * environment variables:
17961  * <variablelist>
17962  *   <varlistentry>
17963  *     <term><envar>G_MESSAGES_PREFIXED</envar></term>
17964  *     <listitem>
17965  *       A :-separated list of log levels for which messages should
17966  *       be prefixed by the program name and PID of the aplication.
17967  *     </listitem>
17968  *   </varlistentry>
17969  *   <varlistentry>
17970  *     <term><envar>G_MESSAGES_DEBUG</envar></term>
17971  *     <listitem>
17972  *       A space-separated list of log domains for which debug and
17973  *       informational messages are printed. By default these
17974  *       messages are not printed.
17975  *     </listitem>
17976  *   </varlistentry>
17977  * </variablelist>
17978  *
17979  * stderr is used for levels %G_LOG_LEVEL_ERROR, %G_LOG_LEVEL_CRITICAL,
17980  * %G_LOG_LEVEL_WARNING and %G_LOG_LEVEL_MESSAGE. stdout is used for
17981  * the rest.
17982  */
17983
17984
17985 /**
17986  * g_log_remove_handler:
17987  * @log_domain: the log domain
17988  * @handler_id: the id of the handler, which was returned in g_log_set_handler()
17989  *
17990  * Removes the log handler.
17991  */
17992
17993
17994 /**
17995  * g_log_set_always_fatal:
17996  * @fatal_mask: the mask containing bits set for each level of error which is to be fatal
17997  *
17998  * Sets the message levels which are always fatal, in any log domain.
17999  * When a message with any of these levels is logged the program terminates.
18000  * You can only set the levels defined by GLib to be fatal.
18001  * %G_LOG_LEVEL_ERROR is always fatal.
18002  *
18003  * You can also make some message levels fatal at runtime by setting
18004  * the <envar>G_DEBUG</envar> environment variable (see
18005  * <ulink url="glib-running.html">Running GLib Applications</ulink>).
18006  *
18007  * Returns: the old fatal mask
18008  */
18009
18010
18011 /**
18012  * g_log_set_default_handler:
18013  * @log_func: the log handler function
18014  * @user_data: data passed to the log handler
18015  *
18016  * Installs a default log handler which is used if no
18017  * log handler has been set for the particular log domain
18018  * and log level combination. By default, GLib uses
18019  * g_log_default_handler() as default log handler.
18020  *
18021  * Returns: the previous default log handler
18022  * Since: 2.6
18023  */
18024
18025
18026 /**
18027  * g_log_set_fatal_mask:
18028  * @log_domain: the log domain
18029  * @fatal_mask: the new fatal mask
18030  *
18031  * Sets the log levels which are fatal in the given domain.
18032  * %G_LOG_LEVEL_ERROR is always fatal.
18033  *
18034  * Returns: the old fatal mask for the log domain
18035  */
18036
18037
18038 /**
18039  * g_log_set_handler:
18040  * @log_domain: (allow-none): the log domain, or %NULL for the default "" application domain
18041  * @log_levels: the log levels to apply the log handler for. To handle fatal and recursive messages as well, combine the log levels with the #G_LOG_FLAG_FATAL and #G_LOG_FLAG_RECURSION bit flags.
18042  * @log_func: the log handler function
18043  * @user_data: data passed to the log handler
18044  *
18045  * Sets the log handler for a domain and a set of log levels.
18046  * To handle fatal and recursive messages the @log_levels parameter
18047  * must be combined with the #G_LOG_FLAG_FATAL and #G_LOG_FLAG_RECURSION
18048  * bit flags.
18049  *
18050  * Note that since the #G_LOG_LEVEL_ERROR log level is always fatal, if
18051  * you want to set a handler for this log level you must combine it with
18052  * #G_LOG_FLAG_FATAL.
18053  *
18054  * <example>
18055  * <title>Adding a log handler for all warning messages in the default
18056  * (application) domain</title>
18057  * <programlisting>
18058  * g_log_set_handler (NULL, G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL
18059  *                    | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
18060  * </programlisting>
18061  * </example>
18062  *
18063  * <example>
18064  * <title>Adding a log handler for all critical messages from GTK+</title>
18065  * <programlisting>
18066  * g_log_set_handler ("Gtk", G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL
18067  *                    | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
18068  * </programlisting>
18069  * </example>
18070  *
18071  * <example>
18072  * <title>Adding a log handler for <emphasis>all</emphasis> messages from
18073  * GLib</title>
18074  * <programlisting>
18075  * g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL
18076  *                    | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
18077  * </programlisting>
18078  * </example>
18079  *
18080  * Returns: the id of the new handler
18081  */
18082
18083
18084 /**
18085  * g_logv:
18086  * @log_domain: the log domain
18087  * @log_level: the log level
18088  * @format: the message format. See the printf() documentation
18089  * @args: the parameters to insert into the format string
18090  *
18091  * Logs an error or debugging message.
18092  *
18093  * If the log level has been set as fatal, the abort()
18094  * function is called to terminate the program.
18095  */
18096
18097
18098 /**
18099  * g_lstat:
18100  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
18101  * @buf: a pointer to a <structname>stat</structname> struct, which will be filled with the file information
18102  *
18103  * A wrapper for the POSIX lstat() function. The lstat() function is
18104  * like stat() except that in the case of symbolic links, it returns
18105  * information about the symbolic link itself and not the file that it
18106  * refers to. If the system does not support symbolic links g_lstat()
18107  * is identical to g_stat().
18108  *
18109  * See your C library manual for more details about lstat().
18110  *
18111  * Returns: 0 if the information was successfully retrieved, -1 if an error occurred
18112  * Since: 2.6
18113  */
18114
18115
18116 /**
18117  * g_main_context_acquire:
18118  * @context: a #GMainContext
18119  *
18120  * Tries to become the owner of the specified context.
18121  * If some other thread is the owner of the context,
18122  * returns %FALSE immediately. Ownership is properly
18123  * recursive: the owner can require ownership again
18124  * and will release ownership when g_main_context_release()
18125  * is called as many times as g_main_context_acquire().
18126  *
18127  * You must be the owner of a context before you
18128  * can call g_main_context_prepare(), g_main_context_query(),
18129  * g_main_context_check(), g_main_context_dispatch().
18130  *
18131  * Returns: %TRUE if the operation succeeded, and this thread is now the owner of @context.
18132  */
18133
18134
18135 /**
18136  * g_main_context_add_poll:
18137  * @context: (allow-none): a #GMainContext (or %NULL for the default context)
18138  * @fd: a #GPollFD structure holding information about a file descriptor to watch.
18139  * @priority: the priority for this file descriptor which should be the same as the priority used for g_source_attach() to ensure that the file descriptor is polled whenever the results may be needed.
18140  *
18141  * Adds a file descriptor to the set of file descriptors polled for
18142  * this context. This will very seldom be used directly. Instead
18143  * a typical event source will use g_source_add_poll() instead.
18144  */
18145
18146
18147 /**
18148  * g_main_context_check:
18149  * @context: a #GMainContext
18150  * @max_priority: the maximum numerical priority of sources to check
18151  * @fds: (array length=n_fds): array of #GPollFD's that was passed to the last call to g_main_context_query()
18152  * @n_fds: return value of g_main_context_query()
18153  *
18154  * Passes the results of polling back to the main loop.
18155  *
18156  * Returns: %TRUE if some sources are ready to be dispatched.
18157  */
18158
18159
18160 /**
18161  * g_main_context_default:
18162  *
18163  * Returns the global default main context. This is the main context
18164  * used for main loop functions when a main loop is not explicitly
18165  * specified, and corresponds to the "main" main loop. See also
18166  * g_main_context_get_thread_default().
18167  *
18168  * Returns: (transfer none): the global default main context.
18169  */
18170
18171
18172 /**
18173  * g_main_context_dispatch:
18174  * @context: a #GMainContext
18175  *
18176  * Dispatches all pending sources.
18177  */
18178
18179
18180 /**
18181  * g_main_context_find_source_by_funcs_user_data:
18182  * @context: (allow-none): a #GMainContext (if %NULL, the default context will be used).
18183  * @funcs: the @source_funcs passed to g_source_new().
18184  * @user_data: the user data from the callback.
18185  *
18186  * Finds a source with the given source functions and user data.  If
18187  * multiple sources exist with the same source function and user data,
18188  * the first one found will be returned.
18189  *
18190  * Returns: (transfer none): the source, if one was found, otherwise %NULL
18191  */
18192
18193
18194 /**
18195  * g_main_context_find_source_by_id:
18196  * @context: (allow-none): a #GMainContext (if %NULL, the default context will be used)
18197  * @source_id: the source ID, as returned by g_source_get_id().
18198  *
18199  * Finds a #GSource given a pair of context and ID.
18200  *
18201  * Returns: (transfer none): the #GSource if found, otherwise, %NULL
18202  */
18203
18204
18205 /**
18206  * g_main_context_find_source_by_user_data:
18207  * @context: a #GMainContext
18208  * @user_data: the user_data for the callback.
18209  *
18210  * Finds a source with the given user data for the callback.  If
18211  * multiple sources exist with the same user data, the first
18212  * one found will be returned.
18213  *
18214  * Returns: (transfer none): the source, if one was found, otherwise %NULL
18215  */
18216
18217
18218 /**
18219  * g_main_context_get_poll_func:
18220  * @context: a #GMainContext
18221  *
18222  * Gets the poll function set by g_main_context_set_poll_func().
18223  *
18224  * Returns: the poll function
18225  */
18226
18227
18228 /**
18229  * g_main_context_get_thread_default:
18230  *
18231  * Gets the thread-default #GMainContext for this thread. Asynchronous
18232  * operations that want to be able to be run in contexts other than
18233  * the default one should call this method or
18234  * g_main_context_ref_thread_default() to get a #GMainContext to add
18235  * their #GSource<!-- -->s to. (Note that even in single-threaded
18236  * programs applications may sometimes want to temporarily push a
18237  * non-default context, so it is not safe to assume that this will
18238  * always return %NULL if you are running in the default thread.)
18239  *
18240  * If you need to hold a reference on the context, use
18241  * g_main_context_ref_thread_default() instead.
18242  *
18243  * Returns: (transfer none): the thread-default #GMainContext, or %NULL if the thread-default context is the global default context.
18244  * Since: 2.22
18245  */
18246
18247
18248 /**
18249  * g_main_context_invoke:
18250  * @context: (allow-none): a #GMainContext, or %NULL
18251  * @function: function to call
18252  * @data: data to pass to @function
18253  *
18254  * Invokes a function in such a way that @context is owned during the
18255  * invocation of @function.
18256  *
18257  * If @context is %NULL then the global default main context â€” as
18258  * returned by g_main_context_default() â€” is used.
18259  *
18260  * If @context is owned by the current thread, @function is called
18261  * directly.  Otherwise, if @context is the thread-default main context
18262  * of the current thread and g_main_context_acquire() succeeds, then
18263  * @function is called and g_main_context_release() is called
18264  * afterwards.
18265  *
18266  * In any other case, an idle source is created to call @function and
18267  * that source is attached to @context (presumably to be run in another
18268  * thread).  The idle source is attached with #G_PRIORITY_DEFAULT
18269  * priority.  If you want a different priority, use
18270  * g_main_context_invoke_full().
18271  *
18272  * Note that, as with normal idle functions, @function should probably
18273  * return %FALSE.  If it returns %TRUE, it will be continuously run in a
18274  * loop (and may prevent this call from returning).
18275  *
18276  * Since: 2.28
18277  */
18278
18279
18280 /**
18281  * g_main_context_invoke_full:
18282  * @context: (allow-none): a #GMainContext, or %NULL
18283  * @priority: the priority at which to run @function
18284  * @function: function to call
18285  * @data: data to pass to @function
18286  * @notify: (allow-none): a function to call when @data is no longer in use, or %NULL.
18287  *
18288  * Invokes a function in such a way that @context is owned during the
18289  * invocation of @function.
18290  *
18291  * This function is the same as g_main_context_invoke() except that it
18292  * lets you specify the priority incase @function ends up being
18293  * scheduled as an idle and also lets you give a #GDestroyNotify for @data.
18294  *
18295  * @notify should not assume that it is called from any particular
18296  * thread or with any particular context acquired.
18297  *
18298  * Since: 2.28
18299  */
18300
18301
18302 /**
18303  * g_main_context_is_owner:
18304  * @context: a #GMainContext
18305  *
18306  * Determines whether this thread holds the (recursive)
18307  * ownership of this #GMainContext. This is useful to
18308  * know before waiting on another thread that may be
18309  * blocking to get ownership of @context.
18310  *
18311  * Returns: %TRUE if current thread is owner of @context.
18312  * Since: 2.10
18313  */
18314
18315
18316 /**
18317  * g_main_context_iteration:
18318  * @context: (allow-none): a #GMainContext (if %NULL, the default context will be used)
18319  * @may_block: whether the call may block.
18320  *
18321  * Runs a single iteration for the given main loop. This involves
18322  * checking to see if any event sources are ready to be processed,
18323  * then if no events sources are ready and @may_block is %TRUE, waiting
18324  * for a source to become ready, then dispatching the highest priority
18325  * events sources that are ready. Otherwise, if @may_block is %FALSE
18326  * sources are not waited to become ready, only those highest priority
18327  * events sources will be dispatched (if any), that are ready at this
18328  * given moment without further waiting.
18329  *
18330  * Note that even when @may_block is %TRUE, it is still possible for
18331  * g_main_context_iteration() to return %FALSE, since the wait may
18332  * be interrupted for other reasons than an event source becoming ready.
18333  *
18334  * Returns: %TRUE if events were dispatched.
18335  */
18336
18337
18338 /**
18339  * g_main_context_new:
18340  *
18341  * Creates a new #GMainContext structure.
18342  *
18343  * Returns: the new #GMainContext
18344  */
18345
18346
18347 /**
18348  * g_main_context_pending:
18349  * @context: (allow-none): a #GMainContext (if %NULL, the default context will be used)
18350  *
18351  * Checks if any sources have pending events for the given context.
18352  *
18353  * Returns: %TRUE if events are pending.
18354  */
18355
18356
18357 /**
18358  * g_main_context_pop_thread_default:
18359  * @context: (allow-none): a #GMainContext object, or %NULL
18360  *
18361  * Pops @context off the thread-default context stack (verifying that
18362  * it was on the top of the stack).
18363  *
18364  * Since: 2.22
18365  */
18366
18367
18368 /**
18369  * g_main_context_prepare:
18370  * @context: a #GMainContext
18371  * @priority: location to store priority of highest priority source already ready.
18372  *
18373  * Prepares to poll sources within a main loop. The resulting information
18374  * for polling is determined by calling g_main_context_query ().
18375  *
18376  * Returns: %TRUE if some source is ready to be dispatched prior to polling.
18377  */
18378
18379
18380 /**
18381  * g_main_context_push_thread_default:
18382  * @context: (allow-none): a #GMainContext, or %NULL for the global default context
18383  *
18384  * Acquires @context and sets it as the thread-default context for the
18385  * current thread. This will cause certain asynchronous operations
18386  * (such as most <link linkend="gio">gio</link>-based I/O) which are
18387  * started in this thread to run under @context and deliver their
18388  * results to its main loop, rather than running under the global
18389  * default context in the main thread. Note that calling this function
18390  * changes the context returned by
18391  * g_main_context_get_thread_default(), <emphasis>not</emphasis> the
18392  * one returned by g_main_context_default(), so it does not affect the
18393  * context used by functions like g_idle_add().
18394  *
18395  * Normally you would call this function shortly after creating a new
18396  * thread, passing it a #GMainContext which will be run by a
18397  * #GMainLoop in that thread, to set a new default context for all
18398  * async operations in that thread. (In this case, you don't need to
18399  * ever call g_main_context_pop_thread_default().) In some cases
18400  * however, you may want to schedule a single operation in a
18401  * non-default context, or temporarily use a non-default context in
18402  * the main thread. In that case, you can wrap the call to the
18403  * asynchronous operation inside a
18404  * g_main_context_push_thread_default() /
18405  * g_main_context_pop_thread_default() pair, but it is up to you to
18406  * ensure that no other asynchronous operations accidentally get
18407  * started while the non-default context is active.
18408  *
18409  * Beware that libraries that predate this function may not correctly
18410  * handle being used from a thread with a thread-default context. Eg,
18411  * see g_file_supports_thread_contexts().
18412  *
18413  * Since: 2.22
18414  */
18415
18416
18417 /**
18418  * g_main_context_query:
18419  * @context: a #GMainContext
18420  * @max_priority: maximum priority source to check
18421  * @timeout_: (out): location to store timeout to be used in polling
18422  * @fds: (out caller-allocates) (array length=n_fds): location to store #GPollFD records that need to be polled.
18423  * @n_fds: length of @fds.
18424  *
18425  * Determines information necessary to poll this main loop.
18426  *
18427  * Returns: the number of records actually stored in @fds, or, if more than @n_fds records need to be stored, the number of records that need to be stored.
18428  */
18429
18430
18431 /**
18432  * g_main_context_ref:
18433  * @context: a #GMainContext
18434  *
18435  * Increases the reference count on a #GMainContext object by one.
18436  *
18437  * Returns: the @context that was passed in (since 2.6)
18438  */
18439
18440
18441 /**
18442  * g_main_context_ref_thread_default:
18443  *
18444  * Gets the thread-default #GMainContext for this thread, as with
18445  * g_main_context_get_thread_default(), but also adds a reference to
18446  * it with g_main_context_ref(). In addition, unlike
18447  * g_main_context_get_thread_default(), if the thread-default context
18448  * is the global default context, this will return that #GMainContext
18449  * (with a ref added to it) rather than returning %NULL.
18450  *
18451  * Returns: (transfer full): the thread-default #GMainContext. Unref with g_main_context_unref() when you are done with it.
18452  * Since: 2.32
18453  */
18454
18455
18456 /**
18457  * g_main_context_release:
18458  * @context: a #GMainContext
18459  *
18460  * Releases ownership of a context previously acquired by this thread
18461  * with g_main_context_acquire(). If the context was acquired multiple
18462  * times, the ownership will be released only when g_main_context_release()
18463  * is called as many times as it was acquired.
18464  */
18465
18466
18467 /**
18468  * g_main_context_remove_poll:
18469  * @context: a #GMainContext
18470  * @fd: a #GPollFD descriptor previously added with g_main_context_add_poll()
18471  *
18472  * Removes file descriptor from the set of file descriptors to be
18473  * polled for a particular context.
18474  */
18475
18476
18477 /**
18478  * g_main_context_set_poll_func:
18479  * @context: a #GMainContext
18480  * @func: the function to call to poll all file descriptors
18481  *
18482  * Sets the function to use to handle polling of file descriptors. It
18483  * will be used instead of the poll() system call
18484  * (or GLib's replacement function, which is used where
18485  * poll() isn't available).
18486  *
18487  * This function could possibly be used to integrate the GLib event
18488  * loop with an external event loop.
18489  */
18490
18491
18492 /**
18493  * g_main_context_unref:
18494  * @context: a #GMainContext
18495  *
18496  * Decreases the reference count on a #GMainContext object by one. If
18497  * the result is zero, free the context and free all associated memory.
18498  */
18499
18500
18501 /**
18502  * g_main_context_wait:
18503  * @context: a #GMainContext
18504  * @cond: a condition variable
18505  * @mutex: a mutex, currently held
18506  *
18507  * Tries to become the owner of the specified context,
18508  * as with g_main_context_acquire(). But if another thread
18509  * is the owner, atomically drop @mutex and wait on @cond until
18510  * that owner releases ownership or until @cond is signaled, then
18511  * try again (once) to become the owner.
18512  *
18513  * Returns: %TRUE if the operation succeeded, and this thread is now the owner of @context.
18514  */
18515
18516
18517 /**
18518  * g_main_context_wakeup:
18519  * @context: a #GMainContext
18520  *
18521  * If @context is currently waiting in a poll(), interrupt
18522  * the poll(), and continue the iteration process.
18523  */
18524
18525
18526 /**
18527  * g_main_current_source:
18528  *
18529  * Returns the currently firing source for this thread.
18530  *
18531  * Returns: (transfer none): The currently firing source or %NULL.
18532  * Since: 2.12
18533  */
18534
18535
18536 /**
18537  * g_main_depth:
18538  *
18539  * Returns the depth of the stack of calls to
18540  * g_main_context_dispatch() on any #GMainContext in the current thread.
18541  *  That is, when called from the toplevel, it gives 0. When
18542  * called from within a callback from g_main_context_iteration()
18543  * (or g_main_loop_run(), etc.) it returns 1. When called from within
18544  * a callback to a recursive call to g_main_context_iteration(),
18545  * it returns 2. And so forth.
18546  *
18547  * This function is useful in a situation like the following:
18548  * Imagine an extremely simple "garbage collected" system.
18549  *
18550  * |[
18551  * static GList *free_list;
18552  *
18553  * gpointer
18554  * allocate_memory (gsize size)
18555  * {
18556  *   gpointer result = g_malloc (size);
18557  *   free_list = g_list_prepend (free_list, result);
18558  *   return result;
18559  * }
18560  *
18561  * void
18562  * free_allocated_memory (void)
18563  * {
18564  *   GList *l;
18565  *   for (l = free_list; l; l = l->next);
18566  *     g_free (l->data);
18567  *   g_list_free (free_list);
18568  *   free_list = NULL;
18569  *  }
18570  *
18571  * [...]
18572  *
18573  * while (TRUE);
18574  *  {
18575  *    g_main_context_iteration (NULL, TRUE);
18576  *    free_allocated_memory();
18577  *   }
18578  * ]|
18579  *
18580  * This works from an application, however, if you want to do the same
18581  * thing from a library, it gets more difficult, since you no longer
18582  * control the main loop. You might think you can simply use an idle
18583  * function to make the call to free_allocated_memory(), but that
18584  * doesn't work, since the idle function could be called from a
18585  * recursive callback. This can be fixed by using g_main_depth()
18586  *
18587  * |[
18588  * gpointer
18589  * allocate_memory (gsize size)
18590  * {
18591  *   FreeListBlock *block = g_new (FreeListBlock, 1);
18592  *   block->mem = g_malloc (size);
18593  *   block->depth = g_main_depth ();
18594  *   free_list = g_list_prepend (free_list, block);
18595  *   return block->mem;
18596  * }
18597  *
18598  * void
18599  * free_allocated_memory (void)
18600  * {
18601  *   GList *l;
18602  *
18603  *   int depth = g_main_depth ();
18604  *   for (l = free_list; l; );
18605  *     {
18606  *       GList *next = l->next;
18607  *       FreeListBlock *block = l->data;
18608  *       if (block->depth > depth)
18609  *         {
18610  *           g_free (block->mem);
18611  *           g_free (block);
18612  *           free_list = g_list_delete_link (free_list, l);
18613  *         }
18614  *
18615  *       l = next;
18616  *     }
18617  *   }
18618  * ]|
18619  *
18620  * There is a temptation to use g_main_depth() to solve
18621  * problems with reentrancy. For instance, while waiting for data
18622  * to be received from the network in response to a menu item,
18623  * the menu item might be selected again. It might seem that
18624  * one could make the menu item's callback return immediately
18625  * and do nothing if g_main_depth() returns a value greater than 1.
18626  * However, this should be avoided since the user then sees selecting
18627  * the menu item do nothing. Furthermore, you'll find yourself adding
18628  * these checks all over your code, since there are doubtless many,
18629  * many things that the user could do. Instead, you can use the
18630  * following techniques:
18631  *
18632  * <orderedlist>
18633  *  <listitem>
18634  *   <para>
18635  *     Use gtk_widget_set_sensitive() or modal dialogs to prevent
18636  *     the user from interacting with elements while the main
18637  *     loop is recursing.
18638  *   </para>
18639  *  </listitem>
18640  *  <listitem>
18641  *   <para>
18642  *     Avoid main loop recursion in situations where you can't handle
18643  *     arbitrary  callbacks. Instead, structure your code so that you
18644  *     simply return to the main loop and then get called again when
18645  *     there is more work to do.
18646  *   </para>
18647  *  </listitem>
18648  * </orderedlist>
18649  *
18650  * Returns: The main loop recursion level in the current thread
18651  */
18652
18653
18654 /**
18655  * g_main_loop_get_context:
18656  * @loop: a #GMainLoop.
18657  *
18658  * Returns the #GMainContext of @loop.
18659  *
18660  * Returns: (transfer none): the #GMainContext of @loop
18661  */
18662
18663
18664 /**
18665  * g_main_loop_is_running:
18666  * @loop: a #GMainLoop.
18667  *
18668  * Checks to see if the main loop is currently being run via g_main_loop_run().
18669  *
18670  * Returns: %TRUE if the mainloop is currently being run.
18671  */
18672
18673
18674 /**
18675  * g_main_loop_new:
18676  * @context: (allow-none): a #GMainContext  (if %NULL, the default context will be used).
18677  * @is_running: set to %TRUE to indicate that the loop is running. This is not very important since calling g_main_loop_run() will set this to %TRUE anyway.
18678  *
18679  * Creates a new #GMainLoop structure.
18680  *
18681  * Returns: a new #GMainLoop.
18682  */
18683
18684
18685 /**
18686  * g_main_loop_quit:
18687  * @loop: a #GMainLoop
18688  *
18689  * Stops a #GMainLoop from running. Any calls to g_main_loop_run()
18690  * for the loop will return.
18691  *
18692  * Note that sources that have already been dispatched when
18693  * g_main_loop_quit() is called will still be executed.
18694  */
18695
18696
18697 /**
18698  * g_main_loop_ref:
18699  * @loop: a #GMainLoop
18700  *
18701  * Increases the reference count on a #GMainLoop object by one.
18702  *
18703  * Returns: @loop
18704  */
18705
18706
18707 /**
18708  * g_main_loop_run:
18709  * @loop: a #GMainLoop
18710  *
18711  * Runs a main loop until g_main_loop_quit() is called on the loop.
18712  * If this is called for the thread of the loop's #GMainContext,
18713  * it will process events from the loop, otherwise it will
18714  * simply wait.
18715  */
18716
18717
18718 /**
18719  * g_main_loop_unref:
18720  * @loop: a #GMainLoop
18721  *
18722  * Decreases the reference count on a #GMainLoop object by one. If
18723  * the result is zero, free the loop and free all associated memory.
18724  */
18725
18726
18727 /**
18728  * g_malloc:
18729  * @n_bytes: the number of bytes to allocate
18730  *
18731  * Allocates @n_bytes bytes of memory.
18732  * If @n_bytes is 0 it returns %NULL.
18733  *
18734  * Returns: a pointer to the allocated memory
18735  */
18736
18737
18738 /**
18739  * g_malloc0:
18740  * @n_bytes: the number of bytes to allocate
18741  *
18742  * Allocates @n_bytes bytes of memory, initialized to 0's.
18743  * If @n_bytes is 0 it returns %NULL.
18744  *
18745  * Returns: a pointer to the allocated memory
18746  */
18747
18748
18749 /**
18750  * g_malloc0_n:
18751  * @n_blocks: the number of blocks to allocate
18752  * @n_block_bytes: the size of each block in bytes
18753  *
18754  * This function is similar to g_malloc0(), allocating (@n_blocks * @n_block_bytes) bytes,
18755  * but care is taken to detect possible overflow during multiplication.
18756  *
18757  * Since: 2.24
18758  * Returns: a pointer to the allocated memory
18759  */
18760
18761
18762 /**
18763  * g_malloc_n:
18764  * @n_blocks: the number of blocks to allocate
18765  * @n_block_bytes: the size of each block in bytes
18766  *
18767  * This function is similar to g_malloc(), allocating (@n_blocks * @n_block_bytes) bytes,
18768  * but care is taken to detect possible overflow during multiplication.
18769  *
18770  * Since: 2.24
18771  * Returns: a pointer to the allocated memory
18772  */
18773
18774
18775 /**
18776  * g_mapped_file_free:
18777  * @file: a #GMappedFile
18778  *
18779  * This call existed before #GMappedFile had refcounting and is currently
18780  * exactly the same as g_mapped_file_unref().
18781  *
18782  * Since: 2.8
18783  * Deprecated: 2.22: Use g_mapped_file_unref() instead.
18784  */
18785
18786
18787 /**
18788  * g_mapped_file_get_bytes:
18789  * @file: a #GMappedFile
18790  *
18791  * Creates a new #GBytes which references the data mapped from @file.
18792  * The mapped contents of the file must not be modified after creating this
18793  * bytes object, because a #GBytes should be immutable.
18794  *
18795  * Returns: (transfer full): A newly allocated #GBytes referencing data from @file
18796  * Since: 2.34
18797  */
18798
18799
18800 /**
18801  * g_mapped_file_get_contents:
18802  * @file: a #GMappedFile
18803  *
18804  * Returns the contents of a #GMappedFile.
18805  *
18806  * Note that the contents may not be zero-terminated,
18807  * even if the #GMappedFile is backed by a text file.
18808  *
18809  * If the file is empty then %NULL is returned.
18810  *
18811  * Returns: the contents of @file, or %NULL.
18812  * Since: 2.8
18813  */
18814
18815
18816 /**
18817  * g_mapped_file_get_length:
18818  * @file: a #GMappedFile
18819  *
18820  * Returns the length of the contents of a #GMappedFile.
18821  *
18822  * Returns: the length of the contents of @file.
18823  * Since: 2.8
18824  */
18825
18826
18827 /**
18828  * g_mapped_file_new:
18829  * @filename: The path of the file to load, in the GLib filename encoding
18830  * @writable: whether the mapping should be writable
18831  * @error: return location for a #GError, or %NULL
18832  *
18833  * Maps a file into memory. On UNIX, this is using the mmap() function.
18834  *
18835  * If @writable is %TRUE, the mapped buffer may be modified, otherwise
18836  * it is an error to modify the mapped buffer. Modifications to the buffer
18837  * are not visible to other processes mapping the same file, and are not
18838  * written back to the file.
18839  *
18840  * Note that modifications of the underlying file might affect the contents
18841  * of the #GMappedFile. Therefore, mapping should only be used if the file
18842  * will not be modified, or if all modifications of the file are done
18843  * atomically (e.g. using g_file_set_contents()).
18844  *
18845  * If @filename is the name of an empty, regular file, the function
18846  * will successfully return an empty #GMappedFile. In other cases of
18847  * size 0 (e.g. device files such as /dev/null), @error will be set
18848  * to the #GFileError value #G_FILE_ERROR_INVAL.
18849  *
18850  * Returns: a newly allocated #GMappedFile which must be unref'd with g_mapped_file_unref(), or %NULL if the mapping failed.
18851  * Since: 2.8
18852  */
18853
18854
18855 /**
18856  * g_mapped_file_new_from_fd:
18857  * @fd: The file descriptor of the file to load
18858  * @writable: whether the mapping should be writable
18859  * @error: return location for a #GError, or %NULL
18860  *
18861  * Maps a file into memory. On UNIX, this is using the mmap() function.
18862  *
18863  * If @writable is %TRUE, the mapped buffer may be modified, otherwise
18864  * it is an error to modify the mapped buffer. Modifications to the buffer
18865  * are not visible to other processes mapping the same file, and are not
18866  * written back to the file.
18867  *
18868  * Note that modifications of the underlying file might affect the contents
18869  * of the #GMappedFile. Therefore, mapping should only be used if the file
18870  * will not be modified, or if all modifications of the file are done
18871  * atomically (e.g. using g_file_set_contents()).
18872  *
18873  * Returns: a newly allocated #GMappedFile which must be unref'd with g_mapped_file_unref(), or %NULL if the mapping failed.
18874  * Since: 2.32
18875  */
18876
18877
18878 /**
18879  * g_mapped_file_ref:
18880  * @file: a #GMappedFile
18881  *
18882  * Increments the reference count of @file by one.  It is safe to call
18883  * this function from any thread.
18884  *
18885  * Returns: the passed in #GMappedFile.
18886  * Since: 2.22
18887  */
18888
18889
18890 /**
18891  * g_mapped_file_unref:
18892  * @file: a #GMappedFile
18893  *
18894  * Decrements the reference count of @file by one.  If the reference count
18895  * drops to 0, unmaps the buffer of @file and frees it.
18896  *
18897  * It is safe to call this function from any thread.
18898  *
18899  * Since 2.22
18900  */
18901
18902
18903 /**
18904  * g_markup_collect_attributes:
18905  * @element_name: the current tag name
18906  * @attribute_names: the attribute names
18907  * @attribute_values: the attribute values
18908  * @error: a pointer to a #GError or %NULL
18909  * @first_type: the #GMarkupCollectType of the first attribute
18910  * @first_attr: the name of the first attribute
18911  * @...: a pointer to the storage location of the first attribute (or %NULL), followed by more types names and pointers, ending with %G_MARKUP_COLLECT_INVALID
18912  *
18913  * Collects the attributes of the element from the data passed to the
18914  * #GMarkupParser start_element function, dealing with common error
18915  * conditions and supporting boolean values.
18916  *
18917  * This utility function is not required to write a parser but can save
18918  * a lot of typing.
18919  *
18920  * The @element_name, @attribute_names, @attribute_values and @error
18921  * parameters passed to the start_element callback should be passed
18922  * unmodified to this function.
18923  *
18924  * Following these arguments is a list of "supported" attributes to collect.
18925  * It is an error to specify multiple attributes with the same name. If any
18926  * attribute not in the list appears in the @attribute_names array then an
18927  * unknown attribute error will result.
18928  *
18929  * The #GMarkupCollectType field allows specifying the type of collection
18930  * to perform and if a given attribute must appear or is optional.
18931  *
18932  * The attribute name is simply the name of the attribute to collect.
18933  *
18934  * The pointer should be of the appropriate type (see the descriptions
18935  * under #GMarkupCollectType) and may be %NULL in case a particular
18936  * attribute is to be allowed but ignored.
18937  *
18938  * This function deals with issuing errors for missing attributes
18939  * (of type %G_MARKUP_ERROR_MISSING_ATTRIBUTE), unknown attributes
18940  * (of type %G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE) and duplicate
18941  * attributes (of type %G_MARKUP_ERROR_INVALID_CONTENT) as well
18942  * as parse errors for boolean-valued attributes (again of type
18943  * %G_MARKUP_ERROR_INVALID_CONTENT). In all of these cases %FALSE
18944  * will be returned and @error will be set as appropriate.
18945  *
18946  * Returns: %TRUE if successful
18947  * Since: 2.16
18948  */
18949
18950
18951 /**
18952  * g_markup_escape_text:
18953  * @text: some valid UTF-8 text
18954  * @length: length of @text in bytes, or -1 if the text is nul-terminated
18955  *
18956  * Escapes text so that the markup parser will parse it verbatim.
18957  * Less than, greater than, ampersand, etc. are replaced with the
18958  * corresponding entities. This function would typically be used
18959  * when writing out a file to be parsed with the markup parser.
18960  *
18961  * Note that this function doesn't protect whitespace and line endings
18962  * from being processed according to the XML rules for normalization
18963  * of line endings and attribute values.
18964  *
18965  * Note also that this function will produce character references in
18966  * the range of &amp;#x1; ... &amp;#x1f; for all control sequences
18967  * except for tabstop, newline and carriage return.  The character
18968  * references in this range are not valid XML 1.0, but they are
18969  * valid XML 1.1 and will be accepted by the GMarkup parser.
18970  *
18971  * Returns: a newly allocated string with the escaped text
18972  */
18973
18974
18975 /**
18976  * g_markup_parse_context_end_parse:
18977  * @context: a #GMarkupParseContext
18978  * @error: return location for a #GError
18979  *
18980  * Signals to the #GMarkupParseContext that all data has been
18981  * fed into the parse context with g_markup_parse_context_parse().
18982  *
18983  * This function reports an error if the document isn't complete,
18984  * for example if elements are still open.
18985  *
18986  * Returns: %TRUE on success, %FALSE if an error was set
18987  */
18988
18989
18990 /**
18991  * g_markup_parse_context_free:
18992  * @context: a #GMarkupParseContext
18993  *
18994  * Frees a #GMarkupParseContext.
18995  *
18996  * This function can't be called from inside one of the
18997  * #GMarkupParser functions or while a subparser is pushed.
18998  */
18999
19000
19001 /**
19002  * g_markup_parse_context_get_element:
19003  * @context: a #GMarkupParseContext
19004  *
19005  * Retrieves the name of the currently open element.
19006  *
19007  * If called from the start_element or end_element handlers this will
19008  * give the element_name as passed to those functions. For the parent
19009  * elements, see g_markup_parse_context_get_element_stack().
19010  *
19011  * Returns: the name of the currently open element, or %NULL
19012  * Since: 2.2
19013  */
19014
19015
19016 /**
19017  * g_markup_parse_context_get_element_stack:
19018  * @context: a #GMarkupParseContext
19019  *
19020  * Retrieves the element stack from the internal state of the parser.
19021  *
19022  * The returned #GSList is a list of strings where the first item is
19023  * the currently open tag (as would be returned by
19024  * g_markup_parse_context_get_element()) and the next item is its
19025  * immediate parent.
19026  *
19027  * This function is intended to be used in the start_element and
19028  * end_element handlers where g_markup_parse_context_get_element()
19029  * would merely return the name of the element that is being
19030  * processed.
19031  *
19032  * Returns: the element stack, which must not be modified
19033  * Since: 2.16
19034  */
19035
19036
19037 /**
19038  * g_markup_parse_context_get_position:
19039  * @context: a #GMarkupParseContext
19040  * @line_number: (allow-none): return location for a line number, or %NULL
19041  * @char_number: (allow-none): return location for a char-on-line number, or %NULL
19042  *
19043  * Retrieves the current line number and the number of the character on
19044  * that line. Intended for use in error messages; there are no strict
19045  * semantics for what constitutes the "current" line number other than
19046  * "the best number we could come up with for error messages."
19047  */
19048
19049
19050 /**
19051  * g_markup_parse_context_get_user_data:
19052  * @context: a #GMarkupParseContext
19053  *
19054  * Returns the user_data associated with @context.
19055  *
19056  * This will either be the user_data that was provided to
19057  * g_markup_parse_context_new() or to the most recent call
19058  * of g_markup_parse_context_push().
19059  *
19060  * Returns: the provided user_data. The returned data belongs to the markup context and will be freed when g_markup_parse_context_free() is called.
19061  * Since: 2.18
19062  */
19063
19064
19065 /**
19066  * g_markup_parse_context_new:
19067  * @parser: a #GMarkupParser
19068  * @flags: one or more #GMarkupParseFlags
19069  * @user_data: user data to pass to #GMarkupParser functions
19070  * @user_data_dnotify: user data destroy notifier called when the parse context is freed
19071  *
19072  * Creates a new parse context. A parse context is used to parse
19073  * marked-up documents. You can feed any number of documents into
19074  * a context, as long as no errors occur; once an error occurs,
19075  * the parse context can't continue to parse text (you have to
19076  * free it and create a new parse context).
19077  *
19078  * Returns: a new #GMarkupParseContext
19079  */
19080
19081
19082 /**
19083  * g_markup_parse_context_parse:
19084  * @context: a #GMarkupParseContext
19085  * @text: chunk of text to parse
19086  * @text_len: length of @text in bytes
19087  * @error: return location for a #GError
19088  *
19089  * Feed some data to the #GMarkupParseContext.
19090  *
19091  * The data need not be valid UTF-8; an error will be signaled if
19092  * it's invalid. The data need not be an entire document; you can
19093  * feed a document into the parser incrementally, via multiple calls
19094  * to this function. Typically, as you receive data from a network
19095  * connection or file, you feed each received chunk of data into this
19096  * function, aborting the process if an error occurs. Once an error
19097  * is reported, no further data may be fed to the #GMarkupParseContext;
19098  * all errors are fatal.
19099  *
19100  * Returns: %FALSE if an error occurred, %TRUE on success
19101  */
19102
19103
19104 /**
19105  * g_markup_parse_context_pop:
19106  * @context: a #GMarkupParseContext
19107  *
19108  * Completes the process of a temporary sub-parser redirection.
19109  *
19110  * This function exists to collect the user_data allocated by a
19111  * matching call to g_markup_parse_context_push(). It must be called
19112  * in the end_element handler corresponding to the start_element
19113  * handler during which g_markup_parse_context_push() was called.
19114  * You must not call this function from the error callback -- the
19115  * @user_data is provided directly to the callback in that case.
19116  *
19117  * This function is not intended to be directly called by users
19118  * interested in invoking subparsers. Instead, it is intended to
19119  * be used by the subparsers themselves to implement a higher-level
19120  * interface.
19121  *
19122  * Returns: the user data passed to g_markup_parse_context_push()
19123  * Since: 2.18
19124  */
19125
19126
19127 /**
19128  * g_markup_parse_context_push:
19129  * @context: a #GMarkupParseContext
19130  * @parser: a #GMarkupParser
19131  * @user_data: user data to pass to #GMarkupParser functions
19132  *
19133  * Temporarily redirects markup data to a sub-parser.
19134  *
19135  * This function may only be called from the start_element handler of
19136  * a #GMarkupParser. It must be matched with a corresponding call to
19137  * g_markup_parse_context_pop() in the matching end_element handler
19138  * (except in the case that the parser aborts due to an error).
19139  *
19140  * All tags, text and other data between the matching tags is
19141  * redirected to the subparser given by @parser. @user_data is used
19142  * as the user_data for that parser. @user_data is also passed to the
19143  * error callback in the event that an error occurs. This includes
19144  * errors that occur in subparsers of the subparser.
19145  *
19146  * The end tag matching the start tag for which this call was made is
19147  * handled by the previous parser (which is given its own user_data)
19148  * which is why g_markup_parse_context_pop() is provided to allow "one
19149  * last access" to the @user_data provided to this function. In the
19150  * case of error, the @user_data provided here is passed directly to
19151  * the error callback of the subparser and g_markup_parse_context_pop()
19152  * should not be called. In either case, if @user_data was allocated
19153  * then it ought to be freed from both of these locations.
19154  *
19155  * This function is not intended to be directly called by users
19156  * interested in invoking subparsers. Instead, it is intended to be
19157  * used by the subparsers themselves to implement a higher-level
19158  * interface.
19159  *
19160  * As an example, see the following implementation of a simple
19161  * parser that counts the number of tags encountered.
19162  *
19163  * |[
19164  * typedef struct
19165  * {
19166  *   gint tag_count;
19167  * } CounterData;
19168  *
19169  * static void
19170  * counter_start_element (GMarkupParseContext  *context,
19171  *                        const gchar          *element_name,
19172  *                        const gchar         **attribute_names,
19173  *                        const gchar         **attribute_values,
19174  *                        gpointer              user_data,
19175  *                        GError              **error)
19176  * {
19177  *   CounterData *data = user_data;
19178  *
19179  *   data->tag_count++;
19180  * }
19181  *
19182  * static void
19183  * counter_error (GMarkupParseContext *context,
19184  *                GError              *error,
19185  *                gpointer             user_data)
19186  * {
19187  *   CounterData *data = user_data;
19188  *
19189  *   g_slice_free (CounterData, data);
19190  * }
19191  *
19192  * static GMarkupParser counter_subparser =
19193  * {
19194  *   counter_start_element,
19195  *   NULL,
19196  *   NULL,
19197  *   NULL,
19198  *   counter_error
19199  * };
19200  * ]|
19201  *
19202  * In order to allow this parser to be easily used as a subparser, the
19203  * following interface is provided:
19204  *
19205  * |[
19206  * void
19207  * start_counting (GMarkupParseContext *context)
19208  * {
19209  *   CounterData *data = g_slice_new (CounterData);
19210  *
19211  *   data->tag_count = 0;
19212  *   g_markup_parse_context_push (context, &counter_subparser, data);
19213  * }
19214  *
19215  * gint
19216  * end_counting (GMarkupParseContext *context)
19217  * {
19218  *   CounterData *data = g_markup_parse_context_pop (context);
19219  *   int result;
19220  *
19221  *   result = data->tag_count;
19222  *   g_slice_free (CounterData, data);
19223  *
19224  *   return result;
19225  * }
19226  * ]|
19227  *
19228  * The subparser would then be used as follows:
19229  *
19230  * |[
19231  * static void start_element (context, element_name, ...)
19232  * {
19233  *   if (strcmp (element_name, "count-these") == 0)
19234  *     start_counting (context);
19235  *
19236  *   /&ast; else, handle other tags... &ast;/
19237  * }
19238  *
19239  * static void end_element (context, element_name, ...)
19240  * {
19241  *   if (strcmp (element_name, "count-these") == 0)
19242  *     g_print ("Counted %d tags\n", end_counting (context));
19243  *
19244  *   /&ast; else, handle other tags... &ast;/
19245  * }
19246  * ]|
19247  *
19248  * Since: 2.18
19249  */
19250
19251
19252 /**
19253  * g_markup_printf_escaped:
19254  * @format: printf() style format string
19255  * @...: the arguments to insert in the format string
19256  *
19257  * Formats arguments according to @format, escaping
19258  * all string and character arguments in the fashion
19259  * of g_markup_escape_text(). This is useful when you
19260  * want to insert literal strings into XML-style markup
19261  * output, without having to worry that the strings
19262  * might themselves contain markup.
19263  *
19264  * |[
19265  * const char *store = "Fortnum &amp; Mason";
19266  * const char *item = "Tea";
19267  * char *output;
19268  * &nbsp;
19269  * output = g_markup_printf_escaped ("&lt;purchase&gt;"
19270  *                                   "&lt;store&gt;&percnt;s&lt;/store&gt;"
19271  *                                   "&lt;item&gt;&percnt;s&lt;/item&gt;"
19272  *                                   "&lt;/purchase&gt;",
19273  *                                   store, item);
19274  * ]|
19275  *
19276  * Returns: newly allocated result from formatting operation. Free with g_free().
19277  * Since: 2.4
19278  */
19279
19280
19281 /**
19282  * g_markup_vprintf_escaped:
19283  * @format: printf() style format string
19284  * @args: variable argument list, similar to vprintf()
19285  *
19286  * Formats the data in @args according to @format, escaping
19287  * all string and character arguments in the fashion
19288  * of g_markup_escape_text(). See g_markup_printf_escaped().
19289  *
19290  * Returns: newly allocated result from formatting operation. Free with g_free().
19291  * Since: 2.4
19292  */
19293
19294
19295 /**
19296  * g_match_info_expand_references:
19297  * @match_info: (allow-none): a #GMatchInfo or %NULL
19298  * @string_to_expand: the string to expand
19299  * @error: location to store the error occurring, or %NULL to ignore errors
19300  *
19301  * Returns a new string containing the text in @string_to_expand with
19302  * references and escape sequences expanded. References refer to the last
19303  * match done with @string against @regex and have the same syntax used by
19304  * g_regex_replace().
19305  *
19306  * The @string_to_expand must be UTF-8 encoded even if #G_REGEX_RAW was
19307  * passed to g_regex_new().
19308  *
19309  * The backreferences are extracted from the string passed to the match
19310  * function, so you cannot call this function after freeing the string.
19311  *
19312  * @match_info may be %NULL in which case @string_to_expand must not
19313  * contain references. For instance "foo\n" does not refer to an actual
19314  * pattern and '\n' merely will be replaced with \n character,
19315  * while to expand "\0" (whole match) one needs the result of a match.
19316  * Use g_regex_check_replacement() to find out whether @string_to_expand
19317  * contains references.
19318  *
19319  * Returns: (allow-none): the expanded string, or %NULL if an error occurred
19320  * Since: 2.14
19321  */
19322
19323
19324 /**
19325  * g_match_info_fetch:
19326  * @match_info: #GMatchInfo structure
19327  * @match_num: number of the sub expression
19328  *
19329  * Retrieves the text matching the @match_num<!-- -->'th capturing
19330  * parentheses. 0 is the full text of the match, 1 is the first paren
19331  * set, 2 the second, and so on.
19332  *
19333  * If @match_num is a valid sub pattern but it didn't match anything
19334  * (e.g. sub pattern 1, matching "b" against "(a)?b") then an empty
19335  * string is returned.
19336  *
19337  * If the match was obtained using the DFA algorithm, that is using
19338  * g_regex_match_all() or g_regex_match_all_full(), the retrieved
19339  * string is not that of a set of parentheses but that of a matched
19340  * substring. Substrings are matched in reverse order of length, so
19341  * 0 is the longest match.
19342  *
19343  * The string is fetched from the string passed to the match function,
19344  * so you cannot call this function after freeing the string.
19345  *
19346  * Returns: (allow-none): The matched substring, or %NULL if an error occurred. You have to free the string yourself
19347  * Since: 2.14
19348  */
19349
19350
19351 /**
19352  * g_match_info_fetch_all:
19353  * @match_info: a #GMatchInfo structure
19354  *
19355  * Bundles up pointers to each of the matching substrings from a match
19356  * and stores them in an array of gchar pointers. The first element in
19357  * the returned array is the match number 0, i.e. the entire matched
19358  * text.
19359  *
19360  * If a sub pattern didn't match anything (e.g. sub pattern 1, matching
19361  * "b" against "(a)?b") then an empty string is inserted.
19362  *
19363  * If the last match was obtained using the DFA algorithm, that is using
19364  * g_regex_match_all() or g_regex_match_all_full(), the retrieved
19365  * strings are not that matched by sets of parentheses but that of the
19366  * matched substring. Substrings are matched in reverse order of length,
19367  * so the first one is the longest match.
19368  *
19369  * The strings are fetched from the string passed to the match function,
19370  * so you cannot call this function after freeing the string.
19371  *
19372  * Returns: (transfer full): a %NULL-terminated array of gchar * pointers.  It must be freed using g_strfreev(). If the previous match failed %NULL is returned
19373  * Since: 2.14
19374  */
19375
19376
19377 /**
19378  * g_match_info_fetch_named:
19379  * @match_info: #GMatchInfo structure
19380  * @name: name of the subexpression
19381  *
19382  * Retrieves the text matching the capturing parentheses named @name.
19383  *
19384  * If @name is a valid sub pattern name but it didn't match anything
19385  * (e.g. sub pattern "X", matching "b" against "(?P&lt;X&gt;a)?b")
19386  * then an empty string is returned.
19387  *
19388  * The string is fetched from the string passed to the match function,
19389  * so you cannot call this function after freeing the string.
19390  *
19391  * Returns: (allow-none): The matched substring, or %NULL if an error occurred. You have to free the string yourself
19392  * Since: 2.14
19393  */
19394
19395
19396 /**
19397  * g_match_info_fetch_named_pos:
19398  * @match_info: #GMatchInfo structure
19399  * @name: name of the subexpression
19400  * @start_pos: (out) (allow-none): pointer to location where to store the start position, or %NULL
19401  * @end_pos: (out) (allow-none): pointer to location where to store the end position, or %NULL
19402  *
19403  * Retrieves the position in bytes of the capturing parentheses named @name.
19404  *
19405  * If @name is a valid sub pattern name but it didn't match anything
19406  * (e.g. sub pattern "X", matching "b" against "(?P&lt;X&gt;a)?b")
19407  * then @start_pos and @end_pos are set to -1 and %TRUE is returned.
19408  *
19409  * Returns: %TRUE if the position was fetched, %FALSE otherwise. If the position cannot be fetched, @start_pos and @end_pos are left unchanged.
19410  * Since: 2.14
19411  */
19412
19413
19414 /**
19415  * g_match_info_fetch_pos:
19416  * @match_info: #GMatchInfo structure
19417  * @match_num: number of the sub expression
19418  * @start_pos: (out) (allow-none): pointer to location where to store the start position, or %NULL
19419  * @end_pos: (out) (allow-none): pointer to location where to store the end position, or %NULL
19420  *
19421  * Retrieves the position in bytes of the @match_num<!-- -->'th capturing
19422  * parentheses. 0 is the full text of the match, 1 is the first
19423  * paren set, 2 the second, and so on.
19424  *
19425  * If @match_num is a valid sub pattern but it didn't match anything
19426  * (e.g. sub pattern 1, matching "b" against "(a)?b") then @start_pos
19427  * and @end_pos are set to -1 and %TRUE is returned.
19428  *
19429  * If the match was obtained using the DFA algorithm, that is using
19430  * g_regex_match_all() or g_regex_match_all_full(), the retrieved
19431  * position is not that of a set of parentheses but that of a matched
19432  * substring. Substrings are matched in reverse order of length, so
19433  * 0 is the longest match.
19434  *
19435  * Returns: %TRUE if the position was fetched, %FALSE otherwise. If the position cannot be fetched, @start_pos and @end_pos are left unchanged
19436  * Since: 2.14
19437  */
19438
19439
19440 /**
19441  * g_match_info_free:
19442  * @match_info: (allow-none): a #GMatchInfo, or %NULL
19443  *
19444  * If @match_info is not %NULL, calls g_match_info_unref(); otherwise does
19445  * nothing.
19446  *
19447  * Since: 2.14
19448  */
19449
19450
19451 /**
19452  * g_match_info_get_match_count:
19453  * @match_info: a #GMatchInfo structure
19454  *
19455  * Retrieves the number of matched substrings (including substring 0,
19456  * that is the whole matched text), so 1 is returned if the pattern
19457  * has no substrings in it and 0 is returned if the match failed.
19458  *
19459  * If the last match was obtained using the DFA algorithm, that is
19460  * using g_regex_match_all() or g_regex_match_all_full(), the retrieved
19461  * count is not that of the number of capturing parentheses but that of
19462  * the number of matched substrings.
19463  *
19464  * Returns: Number of matched substrings, or -1 if an error occurred
19465  * Since: 2.14
19466  */
19467
19468
19469 /**
19470  * g_match_info_get_regex:
19471  * @match_info: a #GMatchInfo
19472  *
19473  * Returns #GRegex object used in @match_info. It belongs to Glib
19474  * and must not be freed. Use g_regex_ref() if you need to keep it
19475  * after you free @match_info object.
19476  *
19477  * Returns: #GRegex object used in @match_info
19478  * Since: 2.14
19479  */
19480
19481
19482 /**
19483  * g_match_info_get_string:
19484  * @match_info: a #GMatchInfo
19485  *
19486  * Returns the string searched with @match_info. This is the
19487  * string passed to g_regex_match() or g_regex_replace() so
19488  * you may not free it before calling this function.
19489  *
19490  * Returns: the string searched with @match_info
19491  * Since: 2.14
19492  */
19493
19494
19495 /**
19496  * g_match_info_is_partial_match:
19497  * @match_info: a #GMatchInfo structure
19498  *
19499  * Usually if the string passed to g_regex_match*() matches as far as
19500  * it goes, but is too short to match the entire pattern, %FALSE is
19501  * returned. There are circumstances where it might be helpful to
19502  * distinguish this case from other cases in which there is no match.
19503  *
19504  * Consider, for example, an application where a human is required to
19505  * type in data for a field with specific formatting requirements. An
19506  * example might be a date in the form ddmmmyy, defined by the pattern
19507  * "^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$".
19508  * If the application sees the user’s keystrokes one by one, and can
19509  * check that what has been typed so far is potentially valid, it is
19510  * able to raise an error as soon as a mistake is made.
19511  *
19512  * GRegex supports the concept of partial matching by means of the
19513  * #G_REGEX_MATCH_PARTIAL_SOFT and #G_REGEX_MATCH_PARTIAL_HARD flags.
19514  * When they are used, the return code for
19515  * g_regex_match() or g_regex_match_full() is, as usual, %TRUE
19516  * for a complete match, %FALSE otherwise. But, when these functions
19517  * return %FALSE, you can check if the match was partial calling
19518  * g_match_info_is_partial_match().
19519  *
19520  * The difference between #G_REGEX_MATCH_PARTIAL_SOFT and
19521  * #G_REGEX_MATCH_PARTIAL_HARD is that when a partial match is encountered
19522  * with #G_REGEX_MATCH_PARTIAL_SOFT, matching continues to search for a
19523  * possible complete match, while with #G_REGEX_MATCH_PARTIAL_HARD matching
19524  * stops at the partial match.
19525  * When both #G_REGEX_MATCH_PARTIAL_SOFT and #G_REGEX_MATCH_PARTIAL_HARD
19526  * are set, the latter takes precedence.
19527  * See <ulink>man:pcrepartial</ulink> for more information on partial matching.
19528  *
19529  * Because of the way certain internal optimizations are implemented
19530  * the partial matching algorithm cannot be used with all patterns.
19531  * So repeated single characters such as "a{2,4}" and repeated single
19532  * meta-sequences such as "\d+" are not permitted if the maximum number
19533  * of occurrences is greater than one. Optional items such as "\d?"
19534  * (where the maximum is one) are permitted. Quantifiers with any values
19535  * are permitted after parentheses, so the invalid examples above can be
19536  * coded thus "(a){2,4}" and "(\d)+". If #G_REGEX_MATCH_PARTIAL or
19537  * #G_REGEX_MATCH_PARTIAL_HARD is set
19538  * for a pattern that does not conform to the restrictions, matching
19539  * functions return an error.
19540  *
19541  * Returns: %TRUE if the match was partial, %FALSE otherwise
19542  * Since: 2.14
19543  */
19544
19545
19546 /**
19547  * g_match_info_matches:
19548  * @match_info: a #GMatchInfo structure
19549  *
19550  * Returns whether the previous match operation succeeded.
19551  *
19552  * Returns: %TRUE if the previous match operation succeeded, %FALSE otherwise
19553  * Since: 2.14
19554  */
19555
19556
19557 /**
19558  * g_match_info_next:
19559  * @match_info: a #GMatchInfo structure
19560  * @error: location to store the error occurring, or %NULL to ignore errors
19561  *
19562  * Scans for the next match using the same parameters of the previous
19563  * call to g_regex_match_full() or g_regex_match() that returned
19564  * @match_info.
19565  *
19566  * The match is done on the string passed to the match function, so you
19567  * cannot free it before calling this function.
19568  *
19569  * Returns: %TRUE is the string matched, %FALSE otherwise
19570  * Since: 2.14
19571  */
19572
19573
19574 /**
19575  * g_match_info_ref:
19576  * @match_info: a #GMatchInfo
19577  *
19578  * Increases reference count of @match_info by 1.
19579  *
19580  * Returns: @match_info
19581  * Since: 2.30
19582  */
19583
19584
19585 /**
19586  * g_match_info_unref:
19587  * @match_info: a #GMatchInfo
19588  *
19589  * Decreases reference count of @match_info by 1. When reference count drops
19590  * to zero, it frees all the memory associated with the match_info structure.
19591  *
19592  * Since: 2.30
19593  */
19594
19595
19596 /**
19597  * g_mem_gc_friendly:
19598  *
19599  * This variable is %TRUE if the <envar>G_DEBUG</envar> environment variable
19600  * includes the key <literal>gc-friendly</literal>.
19601  */
19602
19603
19604 /**
19605  * g_mem_is_system_malloc:
19606  *
19607  * Checks whether the allocator used by g_malloc() is the system's
19608  * malloc implementation. If it returns %TRUE memory allocated with
19609  * malloc() can be used interchangeable with memory allocated using g_malloc().
19610  * This function is useful for avoiding an extra copy of allocated memory returned
19611  * by a non-GLib-based API.
19612  *
19613  * A different allocator can be set using g_mem_set_vtable().
19614  *
19615  * Returns: if %TRUE, malloc() and g_malloc() can be mixed.
19616  */
19617
19618
19619 /**
19620  * g_mem_profile:
19621  *
19622  * Outputs a summary of memory usage.
19623  *
19624  * It outputs the frequency of allocations of different sizes,
19625  * the total number of bytes which have been allocated,
19626  * the total number of bytes which have been freed,
19627  * and the difference between the previous two values, i.e. the number of bytes
19628  * still in use.
19629  *
19630  * Note that this function will not output anything unless you have
19631  * previously installed the #glib_mem_profiler_table with g_mem_set_vtable().
19632  */
19633
19634
19635 /**
19636  * g_mem_set_vtable:
19637  * @vtable: table of memory allocation routines.
19638  *
19639  * Sets the #GMemVTable to use for memory allocation. You can use this to provide
19640  * custom memory allocation routines. <emphasis>This function must be called
19641  * before using any other GLib functions.</emphasis> The @vtable only needs to
19642  * provide malloc(), realloc(), and free() functions; GLib can provide default
19643  * implementations of the others. The malloc() and realloc() implementations
19644  * should return %NULL on failure, GLib will handle error-checking for you.
19645  * @vtable is copied, so need not persist after this function has been called.
19646  */
19647
19648
19649 /**
19650  * g_memdup:
19651  * @mem: the memory to copy.
19652  * @byte_size: the number of bytes to copy.
19653  *
19654  * Allocates @byte_size bytes of memory, and copies @byte_size bytes into it
19655  * from @mem. If @mem is %NULL it returns %NULL.
19656  *
19657  * Returns: a pointer to the newly-allocated copy of the memory, or %NULL if @mem is %NULL.
19658  */
19659
19660
19661 /**
19662  * g_memmove:
19663  * @dest: the destination address to copy the bytes to.
19664  * @src: the source address to copy the bytes from.
19665  * @len: the number of bytes to copy.
19666  *
19667  * Copies a block of memory @len bytes long, from @src to @dest.
19668  * The source and destination areas may overlap.
19669  *
19670  * In order to use this function, you must include
19671  * <filename>string.h</filename> yourself, because this macro will
19672  * typically simply resolve to memmove() and GLib does not include
19673  * <filename>string.h</filename> for you.
19674  */
19675
19676
19677 /**
19678  * g_message:
19679  * @...: format string, followed by parameters to insert into the format string (as with printf())
19680  *
19681  * A convenience function/macro to log a normal message.
19682  */
19683
19684
19685 /**
19686  * g_mkdir:
19687  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
19688  * @mode: permissions to use for the newly created directory
19689  *
19690  * A wrapper for the POSIX mkdir() function. The mkdir() function
19691  * attempts to create a directory with the given name and permissions.
19692  * The mode argument is ignored on Windows.
19693  *
19694  * See your C library manual for more details about mkdir().
19695  *
19696  * Returns: 0 if the directory was successfully created, -1 if an error occurred
19697  * Since: 2.6
19698  */
19699
19700
19701 /**
19702  * g_mkdir_with_parents:
19703  * @pathname: a pathname in the GLib file name encoding
19704  * @mode: permissions to use for newly created directories
19705  *
19706  * Create a directory if it doesn't already exist. Create intermediate
19707  * parent directories as needed, too.
19708  *
19709  * Returns: 0 if the directory already exists, or was successfully created. Returns -1 if an error occurred, with errno set.
19710  * Since: 2.8
19711  */
19712
19713
19714 /**
19715  * g_mkdtemp:
19716  * @tmpl: (type filename): template directory name
19717  *
19718  * Creates a temporary directory. See the mkdtemp() documentation
19719  * on most UNIX-like systems.
19720  *
19721  * The parameter is a string that should follow the rules for
19722  * mkdtemp() templates, i.e. contain the string "XXXXXX".
19723  * g_mkdtemp() is slightly more flexible than mkdtemp() in that the
19724  * sequence does not have to occur at the very end of the template
19725  * and you can pass a @mode and additional @flags. The X string will
19726  * be modified to form the name of a directory that didn't exist.
19727  * The string should be in the GLib file name encoding. Most importantly,
19728  * on Windows it should be in UTF-8.
19729  *
19730  * Returns: A pointer to @tmpl, which has been modified to hold the directory name.  In case of errors, %NULL is returned and %errno will be set.
19731  * Since: 2.30
19732  */
19733
19734
19735 /**
19736  * g_mkdtemp_full:
19737  * @tmpl: (type filename): template directory name
19738  * @mode: permissions to create the temporary directory with
19739  *
19740  * Creates a temporary directory. See the mkdtemp() documentation
19741  * on most UNIX-like systems.
19742  *
19743  * The parameter is a string that should follow the rules for
19744  * mkdtemp() templates, i.e. contain the string "XXXXXX".
19745  * g_mkdtemp() is slightly more flexible than mkdtemp() in that the
19746  * sequence does not have to occur at the very end of the template
19747  * and you can pass a @mode. The X string will be modified to form
19748  * the name of a directory that didn't exist. The string should be
19749  * in the GLib file name encoding. Most importantly, on Windows it
19750  * should be in UTF-8.
19751  *
19752  * Returns: A pointer to @tmpl, which has been modified to hold the directory name. In case of errors, %NULL is returned, and %errno will be set.
19753  * Since: 2.30
19754  */
19755
19756
19757 /**
19758  * g_mkstemp:
19759  * @tmpl: (type filename): template filename
19760  *
19761  * Opens a temporary file. See the mkstemp() documentation
19762  * on most UNIX-like systems.
19763  *
19764  * The parameter is a string that should follow the rules for
19765  * mkstemp() templates, i.e. contain the string "XXXXXX".
19766  * g_mkstemp() is slightly more flexible than mkstemp() in that the
19767  * sequence does not have to occur at the very end of the template.
19768  * The X string will be modified to form the name of a file that
19769  * didn't exist. The string should be in the GLib file name encoding.
19770  * Most importantly, on Windows it should be in UTF-8.
19771  *
19772  * Returns: A file handle (as from open()) to the file opened for reading and writing. The file is opened in binary mode on platforms where there is a difference. The file handle should be closed with close(). In case of errors, -1 is returned and %errno will be set.
19773  */
19774
19775
19776 /**
19777  * g_mkstemp_full:
19778  * @tmpl: (type filename): template filename
19779  * @flags: flags to pass to an open() call in addition to O_EXCL and O_CREAT, which are passed automatically
19780  * @mode: permissions to create the temporary file with
19781  *
19782  * Opens a temporary file. See the mkstemp() documentation
19783  * on most UNIX-like systems.
19784  *
19785  * The parameter is a string that should follow the rules for
19786  * mkstemp() templates, i.e. contain the string "XXXXXX".
19787  * g_mkstemp_full() is slightly more flexible than mkstemp()
19788  * in that the sequence does not have to occur at the very end of the
19789  * template and you can pass a @mode and additional @flags. The X
19790  * string will be modified to form the name of a file that didn't exist.
19791  * The string should be in the GLib file name encoding. Most importantly,
19792  * on Windows it should be in UTF-8.
19793  *
19794  * Returns: A file handle (as from open()) to the file opened for reading and writing. The file handle should be closed with close(). In case of errors, -1 is returned and %errno will be set.
19795  * Since: 2.22
19796  */
19797
19798
19799 /**
19800  * g_mutex_clear:
19801  * @mutex: an initialized #GMutex
19802  *
19803  * Frees the resources allocated to a mutex with g_mutex_init().
19804  *
19805  * This function should not be used with a #GMutex that has been
19806  * statically allocated.
19807  *
19808  * Calling g_mutex_clear() on a locked mutex leads to undefined
19809  * behaviour.
19810  *
19811  * Sine: 2.32
19812  */
19813
19814
19815 /**
19816  * g_mutex_init:
19817  * @mutex: an uninitialized #GMutex
19818  *
19819  * Initializes a #GMutex so that it can be used.
19820  *
19821  * This function is useful to initialize a mutex that has been
19822  * allocated on the stack, or as part of a larger structure.
19823  * It is not necessary to initialize a mutex that has been
19824  * statically allocated.
19825  *
19826  * |[
19827  *   typedef struct {
19828  *     GMutex m;
19829  *     ...
19830  *   } Blob;
19831  *
19832  * Blob *b;
19833  *
19834  * b = g_new (Blob, 1);
19835  * g_mutex_init (&b->m);
19836  * ]|
19837  *
19838  * To undo the effect of g_mutex_init() when a mutex is no longer
19839  * needed, use g_mutex_clear().
19840  *
19841  * Calling g_mutex_init() on an already initialized #GMutex leads
19842  * to undefined behaviour.
19843  *
19844  * Since: 2.32
19845  */
19846
19847
19848 /**
19849  * g_mutex_lock:
19850  * @mutex: a #GMutex
19851  *
19852  * Locks @mutex. If @mutex is already locked by another thread, the
19853  * current thread will block until @mutex is unlocked by the other
19854  * thread.
19855  *
19856  * <note>#GMutex is neither guaranteed to be recursive nor to be
19857  * non-recursive.  As such, calling g_mutex_lock() on a #GMutex that has
19858  * already been locked by the same thread results in undefined behaviour
19859  * (including but not limited to deadlocks).</note>
19860  */
19861
19862
19863 /**
19864  * g_mutex_trylock:
19865  * @mutex: a #GMutex
19866  *
19867  * Tries to lock @mutex. If @mutex is already locked by another thread,
19868  * it immediately returns %FALSE. Otherwise it locks @mutex and returns
19869  * %TRUE.
19870  *
19871  * <note>#GMutex is neither guaranteed to be recursive nor to be
19872  * non-recursive.  As such, calling g_mutex_lock() on a #GMutex that has
19873  * already been locked by the same thread results in undefined behaviour
19874  * (including but not limited to deadlocks or arbitrary return values).
19875  * </note>
19876  *
19877  * Returns: %TRUE if @mutex could be locked
19878  */
19879
19880
19881 /**
19882  * g_mutex_unlock:
19883  * @mutex: a #GMutex
19884  *
19885  * Unlocks @mutex. If another thread is blocked in a g_mutex_lock()
19886  * call for @mutex, it will become unblocked and can lock @mutex itself.
19887  *
19888  * Calling g_mutex_unlock() on a mutex that is not locked by the
19889  * current thread leads to undefined behaviour.
19890  */
19891
19892
19893 /**
19894  * g_node_child_index:
19895  * @node: a #GNode
19896  * @data: the data to find
19897  *
19898  * Gets the position of the first child of a #GNode
19899  * which contains the given data.
19900  *
19901  * Returns: the index of the child of @node which contains @data, or -1 if the data is not found
19902  */
19903
19904
19905 /**
19906  * g_node_child_position:
19907  * @node: a #GNode
19908  * @child: a child of @node
19909  *
19910  * Gets the position of a #GNode with respect to its siblings.
19911  * @child must be a child of @node. The first child is numbered 0,
19912  * the second 1, and so on.
19913  *
19914  * Returns: the position of @child with respect to its siblings
19915  */
19916
19917
19918 /**
19919  * g_node_children_foreach:
19920  * @node: a #GNode
19921  * @flags: which types of children are to be visited, one of %G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
19922  * @func: the function to call for each visited node
19923  * @data: user data to pass to the function
19924  *
19925  * Calls a function for each of the children of a #GNode.
19926  * Note that it doesn't descend beneath the child nodes.
19927  */
19928
19929
19930 /**
19931  * g_node_copy:
19932  * @node: a #GNode
19933  *
19934  * Recursively copies a #GNode (but does not deep-copy the data inside the
19935  * nodes, see g_node_copy_deep() if you need that).
19936  *
19937  * Returns: a new #GNode containing the same data pointers
19938  */
19939
19940
19941 /**
19942  * g_node_copy_deep:
19943  * @node: a #GNode
19944  * @copy_func: the function which is called to copy the data inside each node, or %NULL to use the original data.
19945  * @data: data to pass to @copy_func
19946  *
19947  * Recursively copies a #GNode and its data.
19948  *
19949  * Returns: a new #GNode containing copies of the data in @node.
19950  * Since: 2.4
19951  */
19952
19953
19954 /**
19955  * g_node_depth:
19956  * @node: a #GNode
19957  *
19958  * Gets the depth of a #GNode.
19959  *
19960  * If @node is %NULL the depth is 0. The root node has a depth of 1.
19961  * For the children of the root node the depth is 2. And so on.
19962  *
19963  * Returns: the depth of the #GNode
19964  */
19965
19966
19967 /**
19968  * g_node_destroy:
19969  * @root: the root of the tree/subtree to destroy
19970  *
19971  * Removes @root and its children from the tree, freeing any memory
19972  * allocated.
19973  */
19974
19975
19976 /**
19977  * g_node_find:
19978  * @root: the root #GNode of the tree to search
19979  * @order: the order in which nodes are visited - %G_IN_ORDER, %G_PRE_ORDER, %G_POST_ORDER, or %G_LEVEL_ORDER
19980  * @flags: which types of children are to be searched, one of %G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
19981  * @data: the data to find
19982  *
19983  * Finds a #GNode in a tree.
19984  *
19985  * Returns: the found #GNode, or %NULL if the data is not found
19986  */
19987
19988
19989 /**
19990  * g_node_find_child:
19991  * @node: a #GNode
19992  * @flags: which types of children are to be searched, one of %G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
19993  * @data: the data to find
19994  *
19995  * Finds the first child of a #GNode with the given data.
19996  *
19997  * Returns: the found child #GNode, or %NULL if the data is not found
19998  */
19999
20000
20001 /**
20002  * g_node_first_sibling:
20003  * @node: a #GNode
20004  *
20005  * Gets the first sibling of a #GNode.
20006  * This could possibly be the node itself.
20007  *
20008  * Returns: the first sibling of @node
20009  */
20010
20011
20012 /**
20013  * g_node_get_root:
20014  * @node: a #GNode
20015  *
20016  * Gets the root of a tree.
20017  *
20018  * Returns: the root of the tree
20019  */
20020
20021
20022 /**
20023  * g_node_insert:
20024  * @parent: the #GNode to place @node under
20025  * @position: the position to place @node at, with respect to its siblings If position is -1, @node is inserted as the last child of @parent
20026  * @node: the #GNode to insert
20027  *
20028  * Inserts a #GNode beneath the parent at the given position.
20029  *
20030  * Returns: the inserted #GNode
20031  */
20032
20033
20034 /**
20035  * g_node_insert_after:
20036  * @parent: the #GNode to place @node under
20037  * @sibling: the sibling #GNode to place @node after. If sibling is %NULL, the node is inserted as the first child of @parent.
20038  * @node: the #GNode to insert
20039  *
20040  * Inserts a #GNode beneath the parent after the given sibling.
20041  *
20042  * Returns: the inserted #GNode
20043  */
20044
20045
20046 /**
20047  * g_node_insert_before:
20048  * @parent: the #GNode to place @node under
20049  * @sibling: the sibling #GNode to place @node before. If sibling is %NULL, the node is inserted as the last child of @parent.
20050  * @node: the #GNode to insert
20051  *
20052  * Inserts a #GNode beneath the parent before the given sibling.
20053  *
20054  * Returns: the inserted #GNode
20055  */
20056
20057
20058 /**
20059  * g_node_is_ancestor:
20060  * @node: a #GNode
20061  * @descendant: a #GNode
20062  *
20063  * Returns %TRUE if @node is an ancestor of @descendant.
20064  * This is true if node is the parent of @descendant,
20065  * or if node is the grandparent of @descendant etc.
20066  *
20067  * Returns: %TRUE if @node is an ancestor of @descendant
20068  */
20069
20070
20071 /**
20072  * g_node_last_child:
20073  * @node: a #GNode (must not be %NULL)
20074  *
20075  * Gets the last child of a #GNode.
20076  *
20077  * Returns: the last child of @node, or %NULL if @node has no children
20078  */
20079
20080
20081 /**
20082  * g_node_last_sibling:
20083  * @node: a #GNode
20084  *
20085  * Gets the last sibling of a #GNode.
20086  * This could possibly be the node itself.
20087  *
20088  * Returns: the last sibling of @node
20089  */
20090
20091
20092 /**
20093  * g_node_max_height:
20094  * @root: a #GNode
20095  *
20096  * Gets the maximum height of all branches beneath a #GNode.
20097  * This is the maximum distance from the #GNode to all leaf nodes.
20098  *
20099  * If @root is %NULL, 0 is returned. If @root has no children,
20100  * 1 is returned. If @root has children, 2 is returned. And so on.
20101  *
20102  * Returns: the maximum height of the tree beneath @root
20103  */
20104
20105
20106 /**
20107  * g_node_n_children:
20108  * @node: a #GNode
20109  *
20110  * Gets the number of children of a #GNode.
20111  *
20112  * Returns: the number of children of @node
20113  */
20114
20115
20116 /**
20117  * g_node_n_nodes:
20118  * @root: a #GNode
20119  * @flags: which types of children are to be counted, one of %G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
20120  *
20121  * Gets the number of nodes in a tree.
20122  *
20123  * Returns: the number of nodes in the tree
20124  */
20125
20126
20127 /**
20128  * g_node_new:
20129  * @data: the data of the new node
20130  *
20131  * Creates a new #GNode containing the given data.
20132  * Used to create the first node in a tree.
20133  *
20134  * Returns: a new #GNode
20135  */
20136
20137
20138 /**
20139  * g_node_nth_child:
20140  * @node: a #GNode
20141  * @n: the index of the desired child
20142  *
20143  * Gets a child of a #GNode, using the given index.
20144  * The first child is at index 0. If the index is
20145  * too big, %NULL is returned.
20146  *
20147  * Returns: the child of @node at index @n
20148  */
20149
20150
20151 /**
20152  * g_node_prepend:
20153  * @parent: the #GNode to place the new #GNode under
20154  * @node: the #GNode to insert
20155  *
20156  * Inserts a #GNode as the first child of the given parent.
20157  *
20158  * Returns: the inserted #GNode
20159  */
20160
20161
20162 /**
20163  * g_node_reverse_children:
20164  * @node: a #GNode.
20165  *
20166  * Reverses the order of the children of a #GNode.
20167  * (It doesn't change the order of the grandchildren.)
20168  */
20169
20170
20171 /**
20172  * g_node_traverse:
20173  * @root: the root #GNode of the tree to traverse
20174  * @order: the order in which nodes are visited - %G_IN_ORDER, %G_PRE_ORDER, %G_POST_ORDER, or %G_LEVEL_ORDER.
20175  * @flags: which types of children are to be visited, one of %G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
20176  * @max_depth: the maximum depth of the traversal. Nodes below this depth will not be visited. If max_depth is -1 all nodes in the tree are visited. If depth is 1, only the root is visited. If depth is 2, the root and its children are visited. And so on.
20177  * @func: the function to call for each visited #GNode
20178  * @data: user data to pass to the function
20179  *
20180  * Traverses a tree starting at the given root #GNode.
20181  * It calls the given function for each node visited.
20182  * The traversal can be halted at any point by returning %TRUE from @func.
20183  */
20184
20185
20186 /**
20187  * g_node_unlink:
20188  * @node: the #GNode to unlink, which becomes the root of a new tree
20189  *
20190  * Unlinks a #GNode from a tree, resulting in two separate trees.
20191  */
20192
20193
20194 /**
20195  * g_ntohl:
20196  * @val: a 32-bit integer value in network byte order
20197  *
20198  * Converts a 32-bit integer value from network to host byte order.
20199  *
20200  * Returns: @val converted to host byte order.
20201  */
20202
20203
20204 /**
20205  * g_ntohs:
20206  * @val: a 16-bit integer value in network byte order
20207  *
20208  * Converts a 16-bit integer value from network to host byte order.
20209  *
20210  * Returns: @val converted to host byte order
20211  */
20212
20213
20214 /**
20215  * g_nullify_pointer:
20216  * @nullify_location: the memory address of the pointer.
20217  *
20218  * Set the pointer at the specified location to %NULL.
20219  */
20220
20221
20222 /**
20223  * g_on_error_query:
20224  * @prg_name: the program name, needed by <command>gdb</command> for the [S]tack trace option. If @prg_name is %NULL, g_get_prgname() is called to get the program name (which will work correctly if gdk_init() or gtk_init() has been called)
20225  *
20226  * Prompts the user with
20227  * <computeroutput>[E]xit, [H]alt, show [S]tack trace or [P]roceed</computeroutput>.
20228  * This function is intended to be used for debugging use only.
20229  * The following example shows how it can be used together with
20230  * the g_log() functions.
20231  *
20232  * |[
20233  * &num;include &lt;glib.h&gt;
20234  *
20235  * static void
20236  * log_handler (const gchar   *log_domain,
20237  *              GLogLevelFlags log_level,
20238  *              const gchar   *message,
20239  *              gpointer       user_data)
20240  * {
20241  *   g_log_default_handler (log_domain, log_level, message, user_data);
20242  *
20243  *   g_on_error_query (MY_PROGRAM_NAME);
20244  * }
20245  *
20246  * int
20247  * main (int argc, char *argv[])
20248  * {
20249  *   g_log_set_handler (MY_LOG_DOMAIN,
20250  *                      G_LOG_LEVEL_WARNING |
20251  *                      G_LOG_LEVEL_ERROR |
20252  *                      G_LOG_LEVEL_CRITICAL,
20253  *                      log_handler,
20254  *                      NULL);
20255  *   /&ast; ... &ast;/
20256  * ]|
20257  *
20258  * If [E]xit is selected, the application terminates with a call
20259  * to <literal>_exit(0)</literal>.
20260  *
20261  * If [S]tack trace is selected, g_on_error_stack_trace() is called.
20262  * This invokes <command>gdb</command>, which attaches to the current
20263  * process and shows a stack trace. The prompt is then shown again.
20264  *
20265  * If [P]roceed is selected, the function returns.
20266  *
20267  * This function may cause different actions on non-UNIX platforms.
20268  */
20269
20270
20271 /**
20272  * g_on_error_stack_trace:
20273  * @prg_name: the program name, needed by <command>gdb</command> for the [S]tack trace option.
20274  *
20275  * Invokes <command>gdb</command>, which attaches to the current
20276  * process and shows a stack trace. Called by g_on_error_query()
20277  * when the [S]tack trace option is selected. You can get the current
20278  * process's "program name" with g_get_prgname(), assuming that you
20279  * have called gtk_init() or gdk_init().
20280  *
20281  * This function may cause different actions on non-UNIX platforms.
20282  */
20283
20284
20285 /**
20286  * g_once:
20287  * @once: a #GOnce structure
20288  * @func: the #GThreadFunc function associated to @once. This function is called only once, regardless of the number of times it and its associated #GOnce struct are passed to g_once().
20289  * @arg: data to be passed to @func
20290  *
20291  * The first call to this routine by a process with a given #GOnce
20292  * struct calls @func with the given argument. Thereafter, subsequent
20293  * calls to g_once()  with the same #GOnce struct do not call @func
20294  * again, but return the stored result of the first call. On return
20295  * from g_once(), the status of @once will be %G_ONCE_STATUS_READY.
20296  *
20297  * For example, a mutex or a thread-specific data key must be created
20298  * exactly once. In a threaded environment, calling g_once() ensures
20299  * that the initialization is serialized across multiple threads.
20300  *
20301  * Calling g_once() recursively on the same #GOnce struct in
20302  * @func will lead to a deadlock.
20303  *
20304  * |[
20305  *   gpointer
20306  *   get_debug_flags (void)
20307  *   {
20308  *     static GOnce my_once = G_ONCE_INIT;
20309  *
20310  *     g_once (&my_once, parse_debug_flags, NULL);
20311  *
20312  *     return my_once.retval;
20313  *   }
20314  * ]|
20315  *
20316  * Since: 2.4
20317  */
20318
20319
20320 /**
20321  * g_once_init_enter:
20322  * @location: location of a static initializable variable containing 0
20323  *
20324  * Function to be called when starting a critical initialization
20325  * section. The argument @location must point to a static
20326  * 0-initialized variable that will be set to a value other than 0 at
20327  * the end of the initialization section. In combination with
20328  * g_once_init_leave() and the unique address @value_location, it can
20329  * be ensured that an initialization section will be executed only once
20330  * during a program's life time, and that concurrent threads are
20331  * blocked until initialization completed. To be used in constructs
20332  * like this:
20333  *
20334  * |[
20335  *   static gsize initialization_value = 0;
20336  *
20337  *   if (g_once_init_enter (&amp;initialization_value))
20338  *     {
20339  *       gsize setup_value = 42; /&ast;* initialization code here *&ast;/
20340  *
20341  *       g_once_init_leave (&amp;initialization_value, setup_value);
20342  *     }
20343  *
20344  *   /&ast;* use initialization_value here *&ast;/
20345  * ]|
20346  *
20347  * Returns: %TRUE if the initialization section should be entered, %FALSE and blocks otherwise
20348  * Since: 2.14
20349  */
20350
20351
20352 /**
20353  * g_once_init_leave:
20354  * @location: location of a static initializable variable containing 0
20355  * @result: new non-0 value for *@value_location
20356  *
20357  * Counterpart to g_once_init_enter(). Expects a location of a static
20358  * 0-initialized initialization variable, and an initialization value
20359  * other than 0. Sets the variable to the initialization value, and
20360  * releases concurrent threads blocking in g_once_init_enter() on this
20361  * initialization variable.
20362  *
20363  * Since: 2.14
20364  */
20365
20366
20367 /**
20368  * g_open:
20369  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
20370  * @flags: as in open()
20371  * @mode: as in open()
20372  *
20373  * A wrapper for the POSIX open() function. The open() function is
20374  * used to convert a pathname into a file descriptor.
20375  *
20376  * On POSIX systems file descriptors are implemented by the operating
20377  * system. On Windows, it's the C library that implements open() and
20378  * file descriptors. The actual Win32 API for opening files is quite
20379  * different, see MSDN documentation for CreateFile(). The Win32 API
20380  * uses file handles, which are more randomish integers, not small
20381  * integers like file descriptors.
20382  *
20383  * Because file descriptors are specific to the C library on Windows,
20384  * the file descriptor returned by this function makes sense only to
20385  * functions in the same C library. Thus if the GLib-using code uses a
20386  * different C library than GLib does, the file descriptor returned by
20387  * this function cannot be passed to C library functions like write()
20388  * or read().
20389  *
20390  * See your C library manual for more details about open().
20391  *
20392  * Returns: a new file descriptor, or -1 if an error occurred. The return value can be used exactly like the return value from open().
20393  * Since: 2.6
20394  */
20395
20396
20397 /**
20398  * g_option_context_add_group:
20399  * @context: a #GOptionContext
20400  * @group: the group to add
20401  *
20402  * Adds a #GOptionGroup to the @context, so that parsing with @context
20403  * will recognize the options in the group. Note that the group will
20404  * be freed together with the context when g_option_context_free() is
20405  * called, so you must not free the group yourself after adding it
20406  * to a context.
20407  *
20408  * Since: 2.6
20409  */
20410
20411
20412 /**
20413  * g_option_context_add_main_entries:
20414  * @context: a #GOptionContext
20415  * @entries: a %NULL-terminated array of #GOptionEntry<!-- -->s
20416  * @translation_domain: (allow-none): a translation domain to use for translating the <option>--help</option> output for the options in @entries with gettext(), or %NULL
20417  *
20418  * A convenience function which creates a main group if it doesn't
20419  * exist, adds the @entries to it and sets the translation domain.
20420  *
20421  * Since: 2.6
20422  */
20423
20424
20425 /**
20426  * g_option_context_free:
20427  * @context: a #GOptionContext
20428  *
20429  * Frees context and all the groups which have been
20430  * added to it.
20431  *
20432  * Please note that parsed arguments need to be freed separately (see
20433  * #GOptionEntry).
20434  *
20435  * Since: 2.6
20436  */
20437
20438
20439 /**
20440  * g_option_context_get_description:
20441  * @context: a #GOptionContext
20442  *
20443  * Returns the description. See g_option_context_set_description().
20444  *
20445  * Returns: the description
20446  * Since: 2.12
20447  */
20448
20449
20450 /**
20451  * g_option_context_get_help:
20452  * @context: a #GOptionContext
20453  * @main_help: if %TRUE, only include the main group
20454  * @group: (allow-none): the #GOptionGroup to create help for, or %NULL
20455  *
20456  * Returns a formatted, translated help text for the given context.
20457  * To obtain the text produced by <option>--help</option>, call
20458  * <literal>g_option_context_get_help (context, TRUE, NULL)</literal>.
20459  * To obtain the text produced by <option>--help-all</option>, call
20460  * <literal>g_option_context_get_help (context, FALSE, NULL)</literal>.
20461  * To obtain the help text for an option group, call
20462  * <literal>g_option_context_get_help (context, FALSE, group)</literal>.
20463  *
20464  * Returns: A newly allocated string containing the help text
20465  * Since: 2.14
20466  */
20467
20468
20469 /**
20470  * g_option_context_get_help_enabled:
20471  * @context: a #GOptionContext
20472  *
20473  * Returns whether automatic <option>--help</option> generation
20474  * is turned on for @context. See g_option_context_set_help_enabled().
20475  *
20476  * Returns: %TRUE if automatic help generation is turned on.
20477  * Since: 2.6
20478  */
20479
20480
20481 /**
20482  * g_option_context_get_ignore_unknown_options:
20483  * @context: a #GOptionContext
20484  *
20485  * Returns whether unknown options are ignored or not. See
20486  * g_option_context_set_ignore_unknown_options().
20487  *
20488  * Returns: %TRUE if unknown options are ignored.
20489  * Since: 2.6
20490  */
20491
20492
20493 /**
20494  * g_option_context_get_main_group:
20495  * @context: a #GOptionContext
20496  *
20497  * Returns a pointer to the main group of @context.
20498  *
20499  * Returns: the main group of @context, or %NULL if @context doesn't have a main group. Note that group belongs to @context and should not be modified or freed.
20500  * Since: 2.6
20501  */
20502
20503
20504 /**
20505  * g_option_context_get_summary:
20506  * @context: a #GOptionContext
20507  *
20508  * Returns the summary. See g_option_context_set_summary().
20509  *
20510  * Returns: the summary
20511  * Since: 2.12
20512  */
20513
20514
20515 /**
20516  * g_option_context_new:
20517  * @parameter_string: a string which is displayed in the first line of <option>--help</option> output, after the usage summary <literal><replaceable>programname</replaceable> [OPTION...]</literal>
20518  *
20519  * Creates a new option context.
20520  *
20521  * The @parameter_string can serve multiple purposes. It can be used
20522  * to add descriptions for "rest" arguments, which are not parsed by
20523  * the #GOptionContext, typically something like "FILES" or
20524  * "FILE1 FILE2...". If you are using #G_OPTION_REMAINING for
20525  * collecting "rest" arguments, GLib handles this automatically by
20526  * using the @arg_description of the corresponding #GOptionEntry in
20527  * the usage summary.
20528  *
20529  * Another usage is to give a short summary of the program
20530  * functionality, like " - frob the strings", which will be displayed
20531  * in the same line as the usage. For a longer description of the
20532  * program functionality that should be displayed as a paragraph
20533  * below the usage line, use g_option_context_set_summary().
20534  *
20535  * Note that the @parameter_string is translated using the
20536  * function set with g_option_context_set_translate_func(), so
20537  * it should normally be passed untranslated.
20538  *
20539  * Returns: a newly created #GOptionContext, which must be freed with g_option_context_free() after use.
20540  * Since: 2.6
20541  */
20542
20543
20544 /**
20545  * g_option_context_parse:
20546  * @context: a #GOptionContext
20547  * @argc: (inout) (allow-none): a pointer to the number of command line arguments
20548  * @argv: (inout) (array length=argc) (allow-none): a pointer to the array of command line arguments
20549  * @error: a return location for errors
20550  *
20551  * Parses the command line arguments, recognizing options
20552  * which have been added to @context. A side-effect of
20553  * calling this function is that g_set_prgname() will be
20554  * called.
20555  *
20556  * If the parsing is successful, any parsed arguments are
20557  * removed from the array and @argc and @argv are updated
20558  * accordingly. A '--' option is stripped from @argv
20559  * unless there are unparsed options before and after it,
20560  * or some of the options after it start with '-'. In case
20561  * of an error, @argc and @argv are left unmodified.
20562  *
20563  * If automatic <option>--help</option> support is enabled
20564  * (see g_option_context_set_help_enabled()), and the
20565  * @argv array contains one of the recognized help options,
20566  * this function will produce help output to stdout and
20567  * call <literal>exit (0)</literal>.
20568  *
20569  * Note that function depends on the
20570  * <link linkend="setlocale">current locale</link> for
20571  * automatic character set conversion of string and filename
20572  * arguments.
20573  *
20574  * Returns: %TRUE if the parsing was successful, %FALSE if an error occurred
20575  * Since: 2.6
20576  */
20577
20578
20579 /**
20580  * g_option_context_set_description:
20581  * @context: a #GOptionContext
20582  * @description: (allow-none): a string to be shown in <option>--help</option> output after the list of options, or %NULL
20583  *
20584  * Adds a string to be displayed in <option>--help</option> output
20585  * after the list of options. This text often includes a bug reporting
20586  * address.
20587  *
20588  * Note that the summary is translated (see
20589  * g_option_context_set_translate_func()).
20590  *
20591  * Since: 2.12
20592  */
20593
20594
20595 /**
20596  * g_option_context_set_help_enabled:
20597  * @context: a #GOptionContext
20598  * @help_enabled: %TRUE to enable <option>--help</option>, %FALSE to disable it
20599  *
20600  * Enables or disables automatic generation of <option>--help</option>
20601  * output. By default, g_option_context_parse() recognizes
20602  * <option>--help</option>, <option>-h</option>,
20603  * <option>-?</option>, <option>--help-all</option>
20604  * and <option>--help-</option><replaceable>groupname</replaceable> and creates
20605  * suitable output to stdout.
20606  *
20607  * Since: 2.6
20608  */
20609
20610
20611 /**
20612  * g_option_context_set_ignore_unknown_options:
20613  * @context: a #GOptionContext
20614  * @ignore_unknown: %TRUE to ignore unknown options, %FALSE to produce an error when unknown options are met
20615  *
20616  * Sets whether to ignore unknown options or not. If an argument is
20617  * ignored, it is left in the @argv array after parsing. By default,
20618  * g_option_context_parse() treats unknown options as error.
20619  *
20620  * This setting does not affect non-option arguments (i.e. arguments
20621  * which don't start with a dash). But note that GOption cannot reliably
20622  * determine whether a non-option belongs to a preceding unknown option.
20623  *
20624  * Since: 2.6
20625  */
20626
20627
20628 /**
20629  * g_option_context_set_main_group:
20630  * @context: a #GOptionContext
20631  * @group: the group to set as main group
20632  *
20633  * Sets a #GOptionGroup as main group of the @context.
20634  * This has the same effect as calling g_option_context_add_group(),
20635  * the only difference is that the options in the main group are
20636  * treated differently when generating <option>--help</option> output.
20637  *
20638  * Since: 2.6
20639  */
20640
20641
20642 /**
20643  * g_option_context_set_summary:
20644  * @context: a #GOptionContext
20645  * @summary: (allow-none): a string to be shown in <option>--help</option> output before the list of options, or %NULL
20646  *
20647  * Adds a string to be displayed in <option>--help</option> output
20648  * before the list of options. This is typically a summary of the
20649  * program functionality.
20650  *
20651  * Note that the summary is translated (see
20652  * g_option_context_set_translate_func() and
20653  * g_option_context_set_translation_domain()).
20654  *
20655  * Since: 2.12
20656  */
20657
20658
20659 /**
20660  * g_option_context_set_translate_func:
20661  * @context: a #GOptionContext
20662  * @func: (allow-none): the #GTranslateFunc, or %NULL
20663  * @data: (allow-none): user data to pass to @func, or %NULL
20664  * @destroy_notify: (allow-none): a function which gets called to free @data, or %NULL
20665  *
20666  * Sets the function which is used to translate the contexts
20667  * user-visible strings, for <option>--help</option> output.
20668  * If @func is %NULL, strings are not translated.
20669  *
20670  * Note that option groups have their own translation functions,
20671  * this function only affects the @parameter_string (see g_option_context_new()),
20672  * the summary (see g_option_context_set_summary()) and the description
20673  * (see g_option_context_set_description()).
20674  *
20675  * If you are using gettext(), you only need to set the translation
20676  * domain, see g_option_context_set_translation_domain().
20677  *
20678  * Since: 2.12
20679  */
20680
20681
20682 /**
20683  * g_option_context_set_translation_domain:
20684  * @context: a #GOptionContext
20685  * @domain: the domain to use
20686  *
20687  * A convenience function to use gettext() for translating
20688  * user-visible strings.
20689  *
20690  * Since: 2.12
20691  */
20692
20693
20694 /**
20695  * g_option_group_add_entries:
20696  * @group: a #GOptionGroup
20697  * @entries: a %NULL-terminated array of #GOptionEntry<!-- -->s
20698  *
20699  * Adds the options specified in @entries to @group.
20700  *
20701  * Since: 2.6
20702  */
20703
20704
20705 /**
20706  * g_option_group_free:
20707  * @group: a #GOptionGroup
20708  *
20709  * Frees a #GOptionGroup. Note that you must <emphasis>not</emphasis>
20710  * free groups which have been added to a #GOptionContext.
20711  *
20712  * Since: 2.6
20713  */
20714
20715
20716 /**
20717  * g_option_group_new:
20718  * @name: the name for the option group, this is used to provide help for the options in this group with <option>--help-</option>@name
20719  * @description: a description for this group to be shown in <option>--help</option>. This string is translated using the translation domain or translation function of the group
20720  * @help_description: a description for the <option>--help-</option>@name option. This string is translated using the translation domain or translation function of the group
20721  * @user_data: (allow-none): user data that will be passed to the pre- and post-parse hooks, the error hook and to callbacks of %G_OPTION_ARG_CALLBACK options, or %NULL
20722  * @destroy: (allow-none): a function that will be called to free @user_data, or %NULL
20723  *
20724  * Creates a new #GOptionGroup.
20725  *
20726  * Returns: a newly created option group. It should be added to a #GOptionContext or freed with g_option_group_free().
20727  * Since: 2.6
20728  */
20729
20730
20731 /**
20732  * g_option_group_set_error_hook:
20733  * @group: a #GOptionGroup
20734  * @error_func: a function to call when an error occurs
20735  *
20736  * Associates a function with @group which will be called
20737  * from g_option_context_parse() when an error occurs.
20738  *
20739  * Note that the user data to be passed to @error_func can be
20740  * specified when constructing the group with g_option_group_new().
20741  *
20742  * Since: 2.6
20743  */
20744
20745
20746 /**
20747  * g_option_group_set_parse_hooks:
20748  * @group: a #GOptionGroup
20749  * @pre_parse_func: (allow-none): a function to call before parsing, or %NULL
20750  * @post_parse_func: (allow-none): a function to call after parsing, or %NULL
20751  *
20752  * Associates two functions with @group which will be called
20753  * from g_option_context_parse() before the first option is parsed
20754  * and after the last option has been parsed, respectively.
20755  *
20756  * Note that the user data to be passed to @pre_parse_func and
20757  * @post_parse_func can be specified when constructing the group
20758  * with g_option_group_new().
20759  *
20760  * Since: 2.6
20761  */
20762
20763
20764 /**
20765  * g_option_group_set_translate_func:
20766  * @group: a #GOptionGroup
20767  * @func: (allow-none): the #GTranslateFunc, or %NULL
20768  * @data: (allow-none): user data to pass to @func, or %NULL
20769  * @destroy_notify: (allow-none): a function which gets called to free @data, or %NULL
20770  *
20771  * Sets the function which is used to translate user-visible
20772  * strings, for <option>--help</option> output. Different
20773  * groups can use different #GTranslateFunc<!-- -->s. If @func
20774  * is %NULL, strings are not translated.
20775  *
20776  * If you are using gettext(), you only need to set the translation
20777  * domain, see g_option_group_set_translation_domain().
20778  *
20779  * Since: 2.6
20780  */
20781
20782
20783 /**
20784  * g_option_group_set_translation_domain:
20785  * @group: a #GOptionGroup
20786  * @domain: the domain to use
20787  *
20788  * A convenience function to use gettext() for translating
20789  * user-visible strings.
20790  *
20791  * Since: 2.6
20792  */
20793
20794
20795 /**
20796  * g_parse_debug_string:
20797  * @string: (allow-none): a list of debug options separated by colons, spaces, or commas, or %NULL.
20798  * @keys: (array length=nkeys): pointer to an array of #GDebugKey which associate strings with bit flags.
20799  * @nkeys: the number of #GDebugKey<!-- -->s in the array.
20800  *
20801  * Parses a string containing debugging options
20802  * into a %guint containing bit flags. This is used
20803  * within GDK and GTK+ to parse the debug options passed on the
20804  * command line or through environment variables.
20805  *
20806  * If @string is equal to <code>"all"</code>, all flags are set. Any flags
20807  * specified along with <code>"all"</code> in @string are inverted; thus,
20808  * <code>"all,foo,bar"</code> or <code>"foo,bar,all"</code> sets all flags
20809  * except those corresponding to <code>"foo"</code> and <code>"bar"</code>.
20810  *
20811  * If @string is equal to <code>"help"</code>, all the available keys in @keys
20812  * are printed out to standard error.
20813  *
20814  * Returns: the combined set of bit flags.
20815  */
20816
20817
20818 /**
20819  * g_path_get_basename:
20820  * @file_name: the name of the file
20821  *
20822  * Gets the last component of the filename.
20823  *
20824  * If @file_name ends with a directory separator it gets the component
20825  * before the last slash. If @file_name consists only of directory
20826  * separators (and on Windows, possibly a drive letter), a single
20827  * separator is returned. If @file_name is empty, it gets ".".
20828  *
20829  * Returns: a newly allocated string containing the last component of the filename
20830  */
20831
20832
20833 /**
20834  * g_path_get_dirname:
20835  * @file_name: the name of the file
20836  *
20837  * Gets the directory components of a file name.
20838  *
20839  * If the file name has no directory components "." is returned.
20840  * The returned string should be freed when no longer needed.
20841  *
20842  * Returns: the directory components of the file
20843  */
20844
20845
20846 /**
20847  * g_path_is_absolute:
20848  * @file_name: a file name
20849  *
20850  * Returns %TRUE if the given @file_name is an absolute file name.
20851  * Note that this is a somewhat vague concept on Windows.
20852  *
20853  * On POSIX systems, an absolute file name is well-defined. It always
20854  * starts from the single root directory. For example "/usr/local".
20855  *
20856  * On Windows, the concepts of current drive and drive-specific
20857  * current directory introduce vagueness. This function interprets as
20858  * an absolute file name one that either begins with a directory
20859  * separator such as "\Users\tml" or begins with the root on a drive,
20860  * for example "C:\Windows". The first case also includes UNC paths
20861  * such as "\\myserver\docs\foo". In all cases, either slashes or
20862  * backslashes are accepted.
20863  *
20864  * Note that a file name relative to the current drive root does not
20865  * truly specify a file uniquely over time and across processes, as
20866  * the current drive is a per-process value and can be changed.
20867  *
20868  * File names relative the current directory on some specific drive,
20869  * such as "D:foo/bar", are not interpreted as absolute by this
20870  * function, but they obviously are not relative to the normal current
20871  * directory as returned by getcwd() or g_get_current_dir()
20872  * either. Such paths should be avoided, or need to be handled using
20873  * Windows-specific code.
20874  *
20875  * Returns: %TRUE if @file_name is absolute
20876  */
20877
20878
20879 /**
20880  * g_path_skip_root:
20881  * @file_name: a file name
20882  *
20883  * Returns a pointer into @file_name after the root component,
20884  * i.e. after the "/" in UNIX or "C:\" under Windows. If @file_name
20885  * is not an absolute path it returns %NULL.
20886  *
20887  * Returns: a pointer into @file_name after the root component
20888  */
20889
20890
20891 /**
20892  * g_pattern_match:
20893  * @pspec: a #GPatternSpec
20894  * @string_length: the length of @string (in bytes, i.e. strlen(), <emphasis>not</emphasis> g_utf8_strlen())
20895  * @string: the UTF-8 encoded string to match
20896  * @string_reversed: (allow-none): the reverse of @string or %NULL
20897  *
20898  * Matches a string against a compiled pattern. Passing the correct
20899  * length of the string given is mandatory. The reversed string can be
20900  * omitted by passing %NULL, this is more efficient if the reversed
20901  * version of the string to be matched is not at hand, as
20902  * g_pattern_match() will only construct it if the compiled pattern
20903  * requires reverse matches.
20904  *
20905  * Note that, if the user code will (possibly) match a string against a
20906  * multitude of patterns containing wildcards, chances are high that
20907  * some patterns will require a reversed string. In this case, it's
20908  * more efficient to provide the reversed string to avoid multiple
20909  * constructions thereof in the various calls to g_pattern_match().
20910  *
20911  * Note also that the reverse of a UTF-8 encoded string can in general
20912  * <emphasis>not</emphasis> be obtained by g_strreverse(). This works
20913  * only if the string doesn't contain any multibyte characters. GLib
20914  * offers the g_utf8_strreverse() function to reverse UTF-8 encoded
20915  * strings.
20916  *
20917  * Returns: %TRUE if @string matches @pspec
20918  */
20919
20920
20921 /**
20922  * g_pattern_match_simple:
20923  * @pattern: the UTF-8 encoded pattern
20924  * @string: the UTF-8 encoded string to match
20925  *
20926  * Matches a string against a pattern given as a string. If this
20927  * function is to be called in a loop, it's more efficient to compile
20928  * the pattern once with g_pattern_spec_new() and call
20929  * g_pattern_match_string() repeatedly.
20930  *
20931  * Returns: %TRUE if @string matches @pspec
20932  */
20933
20934
20935 /**
20936  * g_pattern_match_string:
20937  * @pspec: a #GPatternSpec
20938  * @string: the UTF-8 encoded string to match
20939  *
20940  * Matches a string against a compiled pattern. If the string is to be
20941  * matched against more than one pattern, consider using
20942  * g_pattern_match() instead while supplying the reversed string.
20943  *
20944  * Returns: %TRUE if @string matches @pspec
20945  */
20946
20947
20948 /**
20949  * g_pattern_spec_equal:
20950  * @pspec1: a #GPatternSpec
20951  * @pspec2: another #GPatternSpec
20952  *
20953  * Compares two compiled pattern specs and returns whether they will
20954  * match the same set of strings.
20955  *
20956  * Returns: Whether the compiled patterns are equal
20957  */
20958
20959
20960 /**
20961  * g_pattern_spec_free:
20962  * @pspec: a #GPatternSpec
20963  *
20964  * Frees the memory allocated for the #GPatternSpec.
20965  */
20966
20967
20968 /**
20969  * g_pattern_spec_new:
20970  * @pattern: a zero-terminated UTF-8 encoded string
20971  *
20972  * Compiles a pattern to a #GPatternSpec.
20973  *
20974  * Returns: a newly-allocated #GPatternSpec
20975  */
20976
20977
20978 /**
20979  * g_pointer_bit_lock:
20980  * @address: a pointer to a #gpointer-sized value
20981  * @lock_bit: a bit value between 0 and 31
20982  *
20983  * This is equivalent to g_bit_lock, but working on pointers (or other
20984  * pointer-sized values).
20985  *
20986  * For portability reasons, you may only lock on the bottom 32 bits of
20987  * the pointer.
20988  *
20989  * Since: 2.30
20990  */
20991
20992
20993 /**
20994  * g_pointer_bit_trylock:
20995  * @address: a pointer to a #gpointer-sized value
20996  * @lock_bit: a bit value between 0 and 31
20997  *
20998  * This is equivalent to g_bit_trylock, but working on pointers (or
20999  * other pointer-sized values).
21000  *
21001  * For portability reasons, you may only lock on the bottom 32 bits of
21002  * the pointer.
21003  *
21004  * Returns: %TRUE if the lock was acquired
21005  * Since: 2.30
21006  */
21007
21008
21009 /**
21010  * g_pointer_bit_unlock:
21011  * @address: a pointer to a #gpointer-sized value
21012  * @lock_bit: a bit value between 0 and 31
21013  *
21014  * This is equivalent to g_bit_unlock, but working on pointers (or other
21015  * pointer-sized values).
21016  *
21017  * For portability reasons, you may only lock on the bottom 32 bits of
21018  * the pointer.
21019  *
21020  * Since: 2.30
21021  */
21022
21023
21024 /**
21025  * g_poll:
21026  * @fds: file descriptors to poll
21027  * @nfds: the number of file descriptors in @fds
21028  * @timeout: amount of time to wait, in milliseconds, or -1 to wait forever
21029  *
21030  * Polls @fds, as with the poll() system call, but portably. (On
21031  * systems that don't have poll(), it is emulated using select().)
21032  * This is used internally by #GMainContext, but it can be called
21033  * directly if you need to block until a file descriptor is ready, but
21034  * don't want to run the full main loop.
21035  *
21036  * Each element of @fds is a #GPollFD describing a single file
21037  * descriptor to poll. The %fd field indicates the file descriptor,
21038  * and the %events field indicates the events to poll for. On return,
21039  * the %revents fields will be filled with the events that actually
21040  * occurred.
21041  *
21042  * On POSIX systems, the file descriptors in @fds can be any sort of
21043  * file descriptor, but the situation is much more complicated on
21044  * Windows. If you need to use g_poll() in code that has to run on
21045  * Windows, the easiest solution is to construct all of your
21046  * #GPollFD<!-- -->s with g_io_channel_win32_make_pollfd().
21047  *
21048  * Returns: the number of entries in @fds whose %revents fields were filled in, or 0 if the operation timed out, or -1 on error or if the call was interrupted.
21049  * Since: 2.20
21050  */
21051
21052
21053 /**
21054  * g_prefix_error:
21055  * @err: (allow-none): a return location for a #GError, or %NULL
21056  * @format: printf()-style format string
21057  * @...: arguments to @format
21058  *
21059  * Formats a string according to @format and
21060  * prefix it to an existing error message.  If
21061  * @err is %NULL (ie: no error variable) then do
21062  * nothing.
21063  *
21064  * If *@err is %NULL (ie: an error variable is
21065  * present but there is no error condition) then
21066  * also do nothing.  Whether or not it makes
21067  * sense to take advantage of this feature is up
21068  * to you.
21069  *
21070  * Since: 2.16
21071  */
21072
21073
21074 /**
21075  * g_print:
21076  * @format: the message format. See the printf() documentation
21077  * @...: the parameters to insert into the format string
21078  *
21079  * Outputs a formatted message via the print handler.
21080  * The default print handler simply outputs the message to stdout.
21081  *
21082  * g_print() should not be used from within libraries for debugging
21083  * messages, since it may be redirected by applications to special
21084  * purpose message windows or even files. Instead, libraries should
21085  * use g_log(), or the convenience functions g_message(), g_warning()
21086  * and g_error().
21087  */
21088
21089
21090 /**
21091  * g_printerr:
21092  * @format: the message format. See the printf() documentation
21093  * @...: the parameters to insert into the format string
21094  *
21095  * Outputs a formatted message via the error message handler.
21096  * The default handler simply outputs the message to stderr.
21097  *
21098  * g_printerr() should not be used from within libraries.
21099  * Instead g_log() should be used, or the convenience functions
21100  * g_message(), g_warning() and g_error().
21101  */
21102
21103
21104 /**
21105  * g_printf:
21106  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
21107  * @...: the arguments to insert in the output.
21108  *
21109  * An implementation of the standard printf() function which supports
21110  * positional parameters, as specified in the Single Unix Specification.
21111  *
21112  * Returns: the number of bytes printed.
21113  * Since: 2.2
21114  */
21115
21116
21117 /**
21118  * g_printf_string_upper_bound:
21119  * @format: the format string. See the printf() documentation
21120  * @args: the parameters to be inserted into the format string
21121  *
21122  * Calculates the maximum space needed to store the output
21123  * of the sprintf() function.
21124  *
21125  * Returns: the maximum space needed to store the formatted string
21126  */
21127
21128
21129 /**
21130  * g_private_get:
21131  * @key: a #GPrivate
21132  *
21133  * Returns the current value of the thread local variable @key.
21134  *
21135  * If the value has not yet been set in this thread, %NULL is returned.
21136  * Values are never copied between threads (when a new thread is
21137  * created, for example).
21138  *
21139  * Returns: the thread-local value
21140  */
21141
21142
21143 /**
21144  * g_private_replace:
21145  * @key: a #GPrivate
21146  * @value: the new value
21147  *
21148  * Sets the thread local variable @key to have the value @value in the
21149  * current thread.
21150  *
21151  * This function differs from g_private_set() in the following way: if
21152  * the previous value was non-%NULL then the #GDestroyNotify handler for
21153  * @key is run on it.
21154  *
21155  * Since: 2.32
21156  */
21157
21158
21159 /**
21160  * g_private_set:
21161  * @key: a #GPrivate
21162  * @value: the new value
21163  *
21164  * Sets the thread local variable @key to have the value @value in the
21165  * current thread.
21166  *
21167  * This function differs from g_private_replace() in the following way:
21168  * the #GDestroyNotify for @key is not called on the old value.
21169  */
21170
21171
21172 /**
21173  * g_propagate_error:
21174  * @dest: error return location
21175  * @src: error to move into the return location
21176  *
21177  * If @dest is %NULL, free @src; otherwise, moves @src into *@dest.
21178  * The error variable @dest points to must be %NULL.
21179  */
21180
21181
21182 /**
21183  * g_propagate_prefixed_error:
21184  * @dest: error return location
21185  * @src: error to move into the return location
21186  * @format: printf()-style format string
21187  * @...: arguments to @format
21188  *
21189  * If @dest is %NULL, free @src; otherwise,
21190  * moves @src into *@dest. *@dest must be %NULL.
21191  * After the move, add a prefix as with
21192  * g_prefix_error().
21193  *
21194  * Since: 2.16
21195  */
21196
21197
21198 /**
21199  * g_ptr_array_add:
21200  * @array: a #GPtrArray.
21201  * @data: the pointer to add.
21202  *
21203  * Adds a pointer to the end of the pointer array. The array will grow
21204  * in size automatically if necessary.
21205  */
21206
21207
21208 /**
21209  * g_ptr_array_foreach:
21210  * @array: a #GPtrArray
21211  * @func: the function to call for each array element
21212  * @user_data: user data to pass to the function
21213  *
21214  * Calls a function for each element of a #GPtrArray.
21215  *
21216  * Since: 2.4
21217  */
21218
21219
21220 /**
21221  * g_ptr_array_free:
21222  * @array: a #GPtrArray.
21223  * @free_seg: if %TRUE the actual pointer array is freed as well.
21224  *
21225  * Frees the memory allocated for the #GPtrArray. If @free_seg is %TRUE
21226  * it frees the memory block holding the elements as well. Pass %FALSE
21227  * if you want to free the #GPtrArray wrapper but preserve the
21228  * underlying array for use elsewhere. If the reference count of @array
21229  * is greater than one, the #GPtrArray wrapper is preserved but the
21230  * size of @array will be set to zero.
21231  *
21232  * <note><para>If array contents point to dynamically-allocated
21233  * memory, they should be freed separately if @free_seg is %TRUE and no
21234  * #GDestroyNotify function has been set for @array.</para></note>
21235  *
21236  * Returns: the pointer array if @free_seg is %FALSE, otherwise %NULL. The pointer array should be freed using g_free().
21237  */
21238
21239
21240 /**
21241  * g_ptr_array_index:
21242  * @array: a #GPtrArray.
21243  * @index_: the index of the pointer to return.
21244  *
21245  * Returns the pointer at the given index of the pointer array.
21246  *
21247  * Returns: the pointer at the given index.
21248  */
21249
21250
21251 /**
21252  * g_ptr_array_new:
21253  *
21254  * Creates a new #GPtrArray with a reference count of 1.
21255  *
21256  * Returns: the new #GPtrArray.
21257  */
21258
21259
21260 /**
21261  * g_ptr_array_new_full:
21262  * @reserved_size: number of pointers preallocated.
21263  * @element_free_func: (allow-none): A function to free elements with destroy @array or %NULL.
21264  *
21265  * Creates a new #GPtrArray with @reserved_size pointers preallocated
21266  * and a reference count of 1. This avoids frequent reallocation, if
21267  * you are going to add many pointers to the array. Note however that
21268  * the size of the array is still 0. It also set @element_free_func
21269  * for freeing each element when the array is destroyed either via
21270  * g_ptr_array_unref(), when g_ptr_array_free() is called with @free_segment
21271  * set to %TRUE or when removing elements.
21272  *
21273  * Returns: A new #GPtrArray.
21274  * Since: 2.30
21275  */
21276
21277
21278 /**
21279  * g_ptr_array_new_with_free_func:
21280  * @element_free_func: (allow-none): A function to free elements with destroy @array or %NULL.
21281  *
21282  * Creates a new #GPtrArray with a reference count of 1 and use @element_free_func
21283  * for freeing each element when the array is destroyed either via
21284  * g_ptr_array_unref(), when g_ptr_array_free() is called with @free_segment
21285  * set to %TRUE or when removing elements.
21286  *
21287  * Returns: A new #GPtrArray.
21288  * Since: 2.22
21289  */
21290
21291
21292 /**
21293  * g_ptr_array_ref:
21294  * @array: a #GPtrArray
21295  *
21296  * Atomically increments the reference count of @array by one.
21297  * This function is thread-safe and may be called from any thread.
21298  *
21299  * Returns: The passed in #GPtrArray
21300  * Since: 2.22
21301  */
21302
21303
21304 /**
21305  * g_ptr_array_remove:
21306  * @array: a #GPtrArray.
21307  * @data: the pointer to remove.
21308  *
21309  * Removes the first occurrence of the given pointer from the pointer
21310  * array. The following elements are moved down one place. If @array
21311  * has a non-%NULL #GDestroyNotify function it is called for the
21312  * removed element.
21313  *
21314  * It returns %TRUE if the pointer was removed, or %FALSE if the
21315  * pointer was not found.
21316  *
21317  * Returns: %TRUE if the pointer is removed. %FALSE if the pointer is not found in the array.
21318  */
21319
21320
21321 /**
21322  * g_ptr_array_remove_fast:
21323  * @array: a #GPtrArray.
21324  * @data: the pointer to remove.
21325  *
21326  * Removes the first occurrence of the given pointer from the pointer
21327  * array. The last element in the array is used to fill in the space,
21328  * so this function does not preserve the order of the array. But it is
21329  * faster than g_ptr_array_remove(). If @array has a non-%NULL
21330  * #GDestroyNotify function it is called for the removed element.
21331  *
21332  * It returns %TRUE if the pointer was removed, or %FALSE if the
21333  * pointer was not found.
21334  *
21335  * Returns: %TRUE if the pointer was found in the array.
21336  */
21337
21338
21339 /**
21340  * g_ptr_array_remove_index:
21341  * @array: a #GPtrArray.
21342  * @index_: the index of the pointer to remove.
21343  *
21344  * Removes the pointer at the given index from the pointer array. The
21345  * following elements are moved down one place. If @array has a
21346  * non-%NULL #GDestroyNotify function it is called for the removed
21347  * element.
21348  *
21349  * Returns: the pointer which was removed.
21350  */
21351
21352
21353 /**
21354  * g_ptr_array_remove_index_fast:
21355  * @array: a #GPtrArray.
21356  * @index_: the index of the pointer to remove.
21357  *
21358  * Removes the pointer at the given index from the pointer array. The
21359  * last element in the array is used to fill in the space, so this
21360  * function does not preserve the order of the array. But it is faster
21361  * than g_ptr_array_remove_index(). If @array has a non-%NULL
21362  * #GDestroyNotify function it is called for the removed element.
21363  *
21364  * Returns: the pointer which was removed.
21365  */
21366
21367
21368 /**
21369  * g_ptr_array_remove_range:
21370  * @array: a @GPtrArray.
21371  * @index_: the index of the first pointer to remove.
21372  * @length: the number of pointers to remove.
21373  *
21374  * Removes the given number of pointers starting at the given index
21375  * from a #GPtrArray.  The following elements are moved to close the
21376  * gap. If @array has a non-%NULL #GDestroyNotify function it is called
21377  * for the removed elements.
21378  *
21379  * Since: 2.4
21380  */
21381
21382
21383 /**
21384  * g_ptr_array_set_free_func:
21385  * @array: A #GPtrArray.
21386  * @element_free_func: (allow-none): A function to free elements with destroy @array or %NULL.
21387  *
21388  * Sets a function for freeing each element when @array is destroyed
21389  * either via g_ptr_array_unref(), when g_ptr_array_free() is called
21390  * with @free_segment set to %TRUE or when removing elements.
21391  *
21392  * Since: 2.22
21393  */
21394
21395
21396 /**
21397  * g_ptr_array_set_size:
21398  * @array: a #GPtrArray.
21399  * @length: the new length of the pointer array.
21400  *
21401  * Sets the size of the array. When making the array larger,
21402  * newly-added elements will be set to %NULL. When making it smaller,
21403  * if @array has a non-%NULL #GDestroyNotify function then it will be
21404  * called for the removed elements.
21405  */
21406
21407
21408 /**
21409  * g_ptr_array_sized_new:
21410  * @reserved_size: number of pointers preallocated.
21411  *
21412  * Creates a new #GPtrArray with @reserved_size pointers preallocated
21413  * and a reference count of 1. This avoids frequent reallocation, if
21414  * you are going to add many pointers to the array. Note however that
21415  * the size of the array is still 0.
21416  *
21417  * Returns: the new #GPtrArray.
21418  */
21419
21420
21421 /**
21422  * g_ptr_array_sort:
21423  * @array: a #GPtrArray.
21424  * @compare_func: comparison function.
21425  *
21426  * Sorts the array, using @compare_func which should be a qsort()-style
21427  * comparison function (returns less than zero for first arg is less
21428  * than second arg, zero for equal, greater than zero if irst arg is
21429  * greater than second arg).
21430  *
21431  * <note><para>The comparison function for g_ptr_array_sort() doesn't
21432  * take the pointers from the array as arguments, it takes pointers to
21433  * the pointers in the array.</para></note>
21434  *
21435  * This is guaranteed to be a stable sort since version 2.32.
21436  */
21437
21438
21439 /**
21440  * g_ptr_array_sort_with_data:
21441  * @array: a #GPtrArray.
21442  * @compare_func: comparison function.
21443  * @user_data: data to pass to @compare_func.
21444  *
21445  * Like g_ptr_array_sort(), but the comparison function has an extra
21446  * user data argument.
21447  *
21448  * <note><para>The comparison function for g_ptr_array_sort_with_data()
21449  * doesn't take the pointers from the array as arguments, it takes
21450  * pointers to the pointers in the array.</para></note>
21451  *
21452  * This is guaranteed to be a stable sort since version 2.32.
21453  */
21454
21455
21456 /**
21457  * g_ptr_array_unref:
21458  * @array: A #GPtrArray.
21459  *
21460  * Atomically decrements the reference count of @array by one. If the
21461  * reference count drops to 0, the effect is the same as calling
21462  * g_ptr_array_free() with @free_segment set to %TRUE. This function
21463  * is MT-safe and may be called from any thread.
21464  *
21465  * Since: 2.22
21466  */
21467
21468
21469 /**
21470  * g_qsort_with_data:
21471  * @pbase: start of array to sort
21472  * @total_elems: elements in the array
21473  * @size: size of each element
21474  * @compare_func: function to compare elements
21475  * @user_data: data to pass to @compare_func
21476  *
21477  * This is just like the standard C qsort() function, but
21478  * the comparison routine accepts a user data argument.
21479  *
21480  * This is guaranteed to be a stable sort since version 2.32.
21481  */
21482
21483
21484 /**
21485  * g_quark_from_static_string:
21486  * @string: (allow-none): a string.
21487  *
21488  * Gets the #GQuark identifying the given (static) string. If the
21489  * string does not currently have an associated #GQuark, a new #GQuark
21490  * is created, linked to the given string.
21491  *
21492  * Note that this function is identical to g_quark_from_string() except
21493  * that if a new #GQuark is created the string itself is used rather
21494  * than a copy. This saves memory, but can only be used if the string
21495  * will <emphasis>always</emphasis> exist. It can be used with
21496  * statically allocated strings in the main program, but not with
21497  * statically allocated memory in dynamically loaded modules, if you
21498  * expect to ever unload the module again (e.g. do not use this
21499  * function in GTK+ theme engines).
21500  *
21501  * Returns: the #GQuark identifying the string, or 0 if @string is %NULL.
21502  */
21503
21504
21505 /**
21506  * g_quark_from_string:
21507  * @string: (allow-none): a string.
21508  *
21509  * Gets the #GQuark identifying the given string. If the string does
21510  * not currently have an associated #GQuark, a new #GQuark is created,
21511  * using a copy of the string.
21512  *
21513  * Returns: the #GQuark identifying the string, or 0 if @string is %NULL.
21514  */
21515
21516
21517 /**
21518  * g_quark_to_string:
21519  * @quark: a #GQuark.
21520  *
21521  * Gets the string associated with the given #GQuark.
21522  *
21523  * Returns: the string associated with the #GQuark
21524  */
21525
21526
21527 /**
21528  * g_quark_try_string:
21529  * @string: (allow-none): a string.
21530  *
21531  * Gets the #GQuark associated with the given string, or 0 if string is
21532  * %NULL or it has no associated #GQuark.
21533  *
21534  * If you want the GQuark to be created if it doesn't already exist,
21535  * use g_quark_from_string() or g_quark_from_static_string().
21536  *
21537  * Returns: the #GQuark associated with the string, or 0 if @string is %NULL or there is no #GQuark associated with it.
21538  */
21539
21540
21541 /**
21542  * g_queue_clear:
21543  * @queue: a #GQueue
21544  *
21545  * Removes all the elements in @queue. If queue elements contain
21546  * dynamically-allocated memory, they should be freed first.
21547  *
21548  * Since: 2.14
21549  */
21550
21551
21552 /**
21553  * g_queue_copy:
21554  * @queue: a #GQueue
21555  *
21556  * Copies a @queue. Note that is a shallow copy. If the elements in the
21557  * queue consist of pointers to data, the pointers are copied, but the
21558  * actual data is not.
21559  *
21560  * Returns: A copy of @queue
21561  * Since: 2.4
21562  */
21563
21564
21565 /**
21566  * g_queue_delete_link:
21567  * @queue: a #GQueue
21568  * @link_: a #GList link that <emphasis>must</emphasis> be part of @queue
21569  *
21570  * Removes @link_ from @queue and frees it.
21571  *
21572  * @link_ must be part of @queue.
21573  *
21574  * Since: 2.4
21575  */
21576
21577
21578 /**
21579  * g_queue_find:
21580  * @queue: a #GQueue
21581  * @data: data to find
21582  *
21583  * Finds the first link in @queue which contains @data.
21584  *
21585  * Returns: The first link in @queue which contains @data.
21586  * Since: 2.4
21587  */
21588
21589
21590 /**
21591  * g_queue_find_custom:
21592  * @queue: a #GQueue
21593  * @data: user data passed to @func
21594  * @func: a #GCompareFunc to call for each element. It should return 0 when the desired element is found
21595  *
21596  * Finds an element in a #GQueue, using a supplied function to find the
21597  * desired element. It iterates over the queue, calling the given function
21598  * which should return 0 when the desired element is found. The function
21599  * takes two gconstpointer arguments, the #GQueue element's data as the
21600  * first argument and the given user data as the second argument.
21601  *
21602  * Returns: The found link, or %NULL if it wasn't found
21603  * Since: 2.4
21604  */
21605
21606
21607 /**
21608  * g_queue_foreach:
21609  * @queue: a #GQueue
21610  * @func: the function to call for each element's data
21611  * @user_data: user data to pass to @func
21612  *
21613  * Calls @func for each element in the queue passing @user_data to the
21614  * function.
21615  *
21616  * Since: 2.4
21617  */
21618
21619
21620 /**
21621  * g_queue_free:
21622  * @queue: a #GQueue.
21623  *
21624  * Frees the memory allocated for the #GQueue. Only call this function if
21625  * @queue was created with g_queue_new(). If queue elements contain
21626  * dynamically-allocated memory, they should be freed first.
21627  *
21628  * <note><para>
21629  * If queue elements contain dynamically-allocated memory,
21630  * you should either use g_queue_free_full() or free them manually
21631  * first.
21632  * </para></note>
21633  */
21634
21635
21636 /**
21637  * g_queue_free_full:
21638  * @queue: a pointer to a #GQueue
21639  * @free_func: the function to be called to free each element's data
21640  *
21641  * Convenience method, which frees all the memory used by a #GQueue, and
21642  * calls the specified destroy function on every element's data.
21643  *
21644  * Since: 2.32
21645  */
21646
21647
21648 /**
21649  * g_queue_get_length:
21650  * @queue: a #GQueue
21651  *
21652  * Returns the number of items in @queue.
21653  *
21654  * Returns: The number of items in @queue.
21655  * Since: 2.4
21656  */
21657
21658
21659 /**
21660  * g_queue_index:
21661  * @queue: a #GQueue
21662  * @data: the data to find.
21663  *
21664  * Returns the position of the first element in @queue which contains @data.
21665  *
21666  * Returns: The position of the first element in @queue which contains @data, or -1 if no element in @queue contains @data.
21667  * Since: 2.4
21668  */
21669
21670
21671 /**
21672  * g_queue_init:
21673  * @queue: an uninitialized #GQueue
21674  *
21675  * A statically-allocated #GQueue must be initialized with this function
21676  * before it can be used. Alternatively you can initialize it with
21677  * #G_QUEUE_INIT. It is not necessary to initialize queues created with
21678  * g_queue_new().
21679  *
21680  * Since: 2.14
21681  */
21682
21683
21684 /**
21685  * g_queue_insert_after:
21686  * @queue: a #GQueue
21687  * @sibling: a #GList link that <emphasis>must</emphasis> be part of @queue
21688  * @data: the data to insert
21689  *
21690  * Inserts @data into @queue after @sibling
21691  *
21692  * @sibling must be part of @queue
21693  *
21694  * Since: 2.4
21695  */
21696
21697
21698 /**
21699  * g_queue_insert_before:
21700  * @queue: a #GQueue
21701  * @sibling: a #GList link that <emphasis>must</emphasis> be part of @queue
21702  * @data: the data to insert
21703  *
21704  * Inserts @data into @queue before @sibling.
21705  *
21706  * @sibling must be part of @queue.
21707  *
21708  * Since: 2.4
21709  */
21710
21711
21712 /**
21713  * g_queue_insert_sorted:
21714  * @queue: a #GQueue
21715  * @data: the data to insert
21716  * @func: the #GCompareDataFunc used to compare elements in the queue. It is called with two elements of the @queue and @user_data. It should return 0 if the elements are equal, a negative value if the first element comes before the second, and a positive value if the second element comes before the first.
21717  * @user_data: user data passed to @func.
21718  *
21719  * Inserts @data into @queue using @func to determine the new position.
21720  *
21721  * Since: 2.4
21722  */
21723
21724
21725 /**
21726  * g_queue_is_empty:
21727  * @queue: a #GQueue.
21728  *
21729  * Returns %TRUE if the queue is empty.
21730  *
21731  * Returns: %TRUE if the queue is empty.
21732  */
21733
21734
21735 /**
21736  * g_queue_link_index:
21737  * @queue: a #GQueue
21738  * @link_: A #GList link
21739  *
21740  * Returns the position of @link_ in @queue.
21741  *
21742  * Returns: The position of @link_, or -1 if the link is not part of @queue
21743  * Since: 2.4
21744  */
21745
21746
21747 /**
21748  * g_queue_new:
21749  *
21750  * Creates a new #GQueue.
21751  *
21752  * Returns: a new #GQueue.
21753  */
21754
21755
21756 /**
21757  * g_queue_peek_head:
21758  * @queue: a #GQueue.
21759  *
21760  * Returns the first element of the queue.
21761  *
21762  * Returns: the data of the first element in the queue, or %NULL if the queue is empty.
21763  */
21764
21765
21766 /**
21767  * g_queue_peek_head_link:
21768  * @queue: a #GQueue
21769  *
21770  * Returns the first link in @queue
21771  *
21772  * Returns: the first link in @queue, or %NULL if @queue is empty
21773  * Since: 2.4
21774  */
21775
21776
21777 /**
21778  * g_queue_peek_nth:
21779  * @queue: a #GQueue
21780  * @n: the position of the element.
21781  *
21782  * Returns the @n'th element of @queue.
21783  *
21784  * Returns: The data for the @n'th element of @queue, or %NULL if @n is off the end of @queue.
21785  * Since: 2.4
21786  */
21787
21788
21789 /**
21790  * g_queue_peek_nth_link:
21791  * @queue: a #GQueue
21792  * @n: the position of the link
21793  *
21794  * Returns the link at the given position
21795  *
21796  * Returns: The link at the @n'th position, or %NULL if @n is off the end of the list
21797  * Since: 2.4
21798  */
21799
21800
21801 /**
21802  * g_queue_peek_tail:
21803  * @queue: a #GQueue.
21804  *
21805  * Returns the last element of the queue.
21806  *
21807  * Returns: the data of the last element in the queue, or %NULL if the queue is empty.
21808  */
21809
21810
21811 /**
21812  * g_queue_peek_tail_link:
21813  * @queue: a #GQueue
21814  *
21815  * Returns the last link @queue.
21816  *
21817  * Returns: the last link in @queue, or %NULL if @queue is empty
21818  * Since: 2.4
21819  */
21820
21821
21822 /**
21823  * g_queue_pop_head:
21824  * @queue: a #GQueue.
21825  *
21826  * Removes the first element of the queue.
21827  *
21828  * Returns: the data of the first element in the queue, or %NULL if the queue is empty.
21829  */
21830
21831
21832 /**
21833  * g_queue_pop_head_link:
21834  * @queue: a #GQueue.
21835  *
21836  * Removes the first element of the queue.
21837  *
21838  * Returns: the #GList element at the head of the queue, or %NULL if the queue is empty.
21839  */
21840
21841
21842 /**
21843  * g_queue_pop_nth:
21844  * @queue: a #GQueue
21845  * @n: the position of the element.
21846  *
21847  * Removes the @n'th element of @queue.
21848  *
21849  * Returns: the element's data, or %NULL if @n is off the end of @queue.
21850  * Since: 2.4
21851  */
21852
21853
21854 /**
21855  * g_queue_pop_nth_link:
21856  * @queue: a #GQueue
21857  * @n: the link's position
21858  *
21859  * Removes and returns the link at the given position.
21860  *
21861  * Returns: The @n'th link, or %NULL if @n is off the end of @queue.
21862  * Since: 2.4
21863  */
21864
21865
21866 /**
21867  * g_queue_pop_tail:
21868  * @queue: a #GQueue.
21869  *
21870  * Removes the last element of the queue.
21871  *
21872  * Returns: the data of the last element in the queue, or %NULL if the queue is empty.
21873  */
21874
21875
21876 /**
21877  * g_queue_pop_tail_link:
21878  * @queue: a #GQueue.
21879  *
21880  * Removes the last element of the queue.
21881  *
21882  * Returns: the #GList element at the tail of the queue, or %NULL if the queue is empty.
21883  */
21884
21885
21886 /**
21887  * g_queue_push_head:
21888  * @queue: a #GQueue.
21889  * @data: the data for the new element.
21890  *
21891  * Adds a new element at the head of the queue.
21892  */
21893
21894
21895 /**
21896  * g_queue_push_head_link:
21897  * @queue: a #GQueue.
21898  * @link_: a single #GList element, <emphasis>not</emphasis> a list with more than one element.
21899  *
21900  * Adds a new element at the head of the queue.
21901  */
21902
21903
21904 /**
21905  * g_queue_push_nth:
21906  * @queue: a #GQueue
21907  * @data: the data for the new element
21908  * @n: the position to insert the new element. If @n is negative or larger than the number of elements in the @queue, the element is added to the end of the queue.
21909  *
21910  * Inserts a new element into @queue at the given position
21911  *
21912  * Since: 2.4
21913  */
21914
21915
21916 /**
21917  * g_queue_push_nth_link:
21918  * @queue: a #GQueue
21919  * @n: the position to insert the link. If this is negative or larger than the number of elements in @queue, the link is added to the end of @queue.
21920  * @link_: the link to add to @queue
21921  *
21922  * Inserts @link into @queue at the given position.
21923  *
21924  * Since: 2.4
21925  */
21926
21927
21928 /**
21929  * g_queue_push_tail:
21930  * @queue: a #GQueue.
21931  * @data: the data for the new element.
21932  *
21933  * Adds a new element at the tail of the queue.
21934  */
21935
21936
21937 /**
21938  * g_queue_push_tail_link:
21939  * @queue: a #GQueue.
21940  * @link_: a single #GList element, <emphasis>not</emphasis> a list with more than one element.
21941  *
21942  * Adds a new element at the tail of the queue.
21943  */
21944
21945
21946 /**
21947  * g_queue_remove:
21948  * @queue: a #GQueue
21949  * @data: data to remove.
21950  *
21951  * Removes the first element in @queue that contains @data.
21952  *
21953  * Returns: %TRUE if @data was found and removed from @queue
21954  * Since: 2.4
21955  */
21956
21957
21958 /**
21959  * g_queue_remove_all:
21960  * @queue: a #GQueue
21961  * @data: data to remove
21962  *
21963  * Remove all elements whose data equals @data from @queue.
21964  *
21965  * Returns: the number of elements removed from @queue
21966  * Since: 2.4
21967  */
21968
21969
21970 /**
21971  * g_queue_reverse:
21972  * @queue: a #GQueue
21973  *
21974  * Reverses the order of the items in @queue.
21975  *
21976  * Since: 2.4
21977  */
21978
21979
21980 /**
21981  * g_queue_sort:
21982  * @queue: a #GQueue
21983  * @compare_func: the #GCompareDataFunc used to sort @queue. This function is passed two elements of the queue and should return 0 if they are equal, a negative value if the first comes before the second, and a positive value if the second comes before the first.
21984  * @user_data: user data passed to @compare_func
21985  *
21986  * Sorts @queue using @compare_func.
21987  *
21988  * Since: 2.4
21989  */
21990
21991
21992 /**
21993  * g_queue_unlink:
21994  * @queue: a #GQueue
21995  * @link_: a #GList link that <emphasis>must</emphasis> be part of @queue
21996  *
21997  * Unlinks @link_ so that it will no longer be part of @queue. The link is
21998  * not freed.
21999  *
22000  * @link_ must be part of @queue,
22001  *
22002  * Since: 2.4
22003  */
22004
22005
22006 /**
22007  * g_rand_boolean:
22008  * @rand_: a #GRand.
22009  *
22010  * Returns a random #gboolean from @rand_. This corresponds to a
22011  * unbiased coin toss.
22012  *
22013  * Returns: a random #gboolean.
22014  */
22015
22016
22017 /**
22018  * g_rand_copy:
22019  * @rand_: a #GRand.
22020  *
22021  * Copies a #GRand into a new one with the same exact state as before.
22022  * This way you can take a snapshot of the random number generator for
22023  * replaying later.
22024  *
22025  * Returns: the new #GRand.
22026  * Since: 2.4
22027  */
22028
22029
22030 /**
22031  * g_rand_double:
22032  * @rand_: a #GRand.
22033  *
22034  * Returns the next random #gdouble from @rand_ equally distributed over
22035  * the range [0..1).
22036  *
22037  * Returns: A random number.
22038  */
22039
22040
22041 /**
22042  * g_rand_double_range:
22043  * @rand_: a #GRand.
22044  * @begin: lower closed bound of the interval.
22045  * @end: upper open bound of the interval.
22046  *
22047  * Returns the next random #gdouble from @rand_ equally distributed over
22048  * the range [@begin..@end).
22049  *
22050  * Returns: A random number.
22051  */
22052
22053
22054 /**
22055  * g_rand_free:
22056  * @rand_: a #GRand.
22057  *
22058  * Frees the memory allocated for the #GRand.
22059  */
22060
22061
22062 /**
22063  * g_rand_int:
22064  * @rand_: a #GRand.
22065  *
22066  * Returns the next random #guint32 from @rand_ equally distributed over
22067  * the range [0..2^32-1].
22068  *
22069  * Returns: A random number.
22070  */
22071
22072
22073 /**
22074  * g_rand_int_range:
22075  * @rand_: a #GRand.
22076  * @begin: lower closed bound of the interval.
22077  * @end: upper open bound of the interval.
22078  *
22079  * Returns the next random #gint32 from @rand_ equally distributed over
22080  * the range [@begin..@end-1].
22081  *
22082  * Returns: A random number.
22083  */
22084
22085
22086 /**
22087  * g_rand_new:
22088  *
22089  * Creates a new random number generator initialized with a seed taken
22090  * either from <filename>/dev/urandom</filename> (if existing) or from
22091  * the current time (as a fallback).
22092  *
22093  * Returns: the new #GRand.
22094  */
22095
22096
22097 /**
22098  * g_rand_new_with_seed:
22099  * @seed: a value to initialize the random number generator.
22100  *
22101  * Creates a new random number generator initialized with @seed.
22102  *
22103  * Returns: the new #GRand.
22104  */
22105
22106
22107 /**
22108  * g_rand_new_with_seed_array:
22109  * @seed: an array of seeds to initialize the random number generator.
22110  * @seed_length: an array of seeds to initialize the random number generator.
22111  *
22112  * Creates a new random number generator initialized with @seed.
22113  *
22114  * Returns: the new #GRand.
22115  * Since: 2.4
22116  */
22117
22118
22119 /**
22120  * g_rand_set_seed:
22121  * @rand_: a #GRand.
22122  * @seed: a value to reinitialize the random number generator.
22123  *
22124  * Sets the seed for the random number generator #GRand to @seed.
22125  */
22126
22127
22128 /**
22129  * g_rand_set_seed_array:
22130  * @rand_: a #GRand.
22131  * @seed: array to initialize with
22132  * @seed_length: length of array
22133  *
22134  * Initializes the random number generator by an array of
22135  * longs.  Array can be of arbitrary size, though only the
22136  * first 624 values are taken.  This function is useful
22137  * if you have many low entropy seeds, or if you require more then
22138  * 32bits of actual entropy for your application.
22139  *
22140  * Since: 2.4
22141  */
22142
22143
22144 /**
22145  * g_random_boolean:
22146  *
22147  * Returns a random #gboolean. This corresponds to a unbiased coin toss.
22148  *
22149  * Returns: a random #gboolean.
22150  */
22151
22152
22153 /**
22154  * g_random_double:
22155  *
22156  * Returns a random #gdouble equally distributed over the range [0..1).
22157  *
22158  * Returns: A random number.
22159  */
22160
22161
22162 /**
22163  * g_random_double_range:
22164  * @begin: lower closed bound of the interval.
22165  * @end: upper open bound of the interval.
22166  *
22167  * Returns a random #gdouble equally distributed over the range [@begin..@end).
22168  *
22169  * Returns: A random number.
22170  */
22171
22172
22173 /**
22174  * g_random_int:
22175  *
22176  * Return a random #guint32 equally distributed over the range
22177  * [0..2^32-1].
22178  *
22179  * Returns: A random number.
22180  */
22181
22182
22183 /**
22184  * g_random_int_range:
22185  * @begin: lower closed bound of the interval.
22186  * @end: upper open bound of the interval.
22187  *
22188  * Returns a random #gint32 equally distributed over the range
22189  * [@begin..@end-1].
22190  *
22191  * Returns: A random number.
22192  */
22193
22194
22195 /**
22196  * g_random_set_seed:
22197  * @seed: a value to reinitialize the global random number generator.
22198  *
22199  * Sets the seed for the global random number generator, which is used
22200  * by the <function>g_random_*</function> functions, to @seed.
22201  */
22202
22203
22204 /**
22205  * g_realloc:
22206  * @mem: the memory to reallocate
22207  * @n_bytes: new size of the memory in bytes
22208  *
22209  * Reallocates the memory pointed to by @mem, so that it now has space for
22210  * @n_bytes bytes of memory. It returns the new address of the memory, which may
22211  * have been moved. @mem may be %NULL, in which case it's considered to
22212  * have zero-length. @n_bytes may be 0, in which case %NULL will be returned
22213  * and @mem will be freed unless it is %NULL.
22214  *
22215  * Returns: the new address of the allocated memory
22216  */
22217
22218
22219 /**
22220  * g_realloc_n:
22221  * @mem: the memory to reallocate
22222  * @n_blocks: the number of blocks to allocate
22223  * @n_block_bytes: the size of each block in bytes
22224  *
22225  * This function is similar to g_realloc(), allocating (@n_blocks * @n_block_bytes) bytes,
22226  * but care is taken to detect possible overflow during multiplication.
22227  *
22228  * Since: 2.24
22229  * Returns: the new address of the allocated memory
22230  */
22231
22232
22233 /**
22234  * g_rec_mutex_clear:
22235  * @rec_mutex: an initialized #GRecMutex
22236  *
22237  * Frees the resources allocated to a recursive mutex with
22238  * g_rec_mutex_init().
22239  *
22240  * This function should not be used with a #GRecMutex that has been
22241  * statically allocated.
22242  *
22243  * Calling g_rec_mutex_clear() on a locked recursive mutex leads
22244  * to undefined behaviour.
22245  *
22246  * Sine: 2.32
22247  */
22248
22249
22250 /**
22251  * g_rec_mutex_init:
22252  * @rec_mutex: an uninitialized #GRecMutex
22253  *
22254  * Initializes a #GRecMutex so that it can be used.
22255  *
22256  * This function is useful to initialize a recursive mutex
22257  * that has been allocated on the stack, or as part of a larger
22258  * structure.
22259  *
22260  * It is not necessary to initialise a recursive mutex that has been
22261  * statically allocated.
22262  *
22263  * |[
22264  *   typedef struct {
22265  *     GRecMutex m;
22266  *     ...
22267  *   } Blob;
22268  *
22269  * Blob *b;
22270  *
22271  * b = g_new (Blob, 1);
22272  * g_rec_mutex_init (&b->m);
22273  * ]|
22274  *
22275  * Calling g_rec_mutex_init() on an already initialized #GRecMutex
22276  * leads to undefined behaviour.
22277  *
22278  * To undo the effect of g_rec_mutex_init() when a recursive mutex
22279  * is no longer needed, use g_rec_mutex_clear().
22280  *
22281  * Since: 2.32
22282  */
22283
22284
22285 /**
22286  * g_rec_mutex_lock:
22287  * @rec_mutex: a #GRecMutex
22288  *
22289  * Locks @rec_mutex. If @rec_mutex is already locked by another
22290  * thread, the current thread will block until @rec_mutex is
22291  * unlocked by the other thread. If @rec_mutex is already locked
22292  * by the current thread, the 'lock count' of @rec_mutex is increased.
22293  * The mutex will only become available again when it is unlocked
22294  * as many times as it has been locked.
22295  *
22296  * Since: 2.32
22297  */
22298
22299
22300 /**
22301  * g_rec_mutex_trylock:
22302  * @rec_mutex: a #GRecMutex
22303  *
22304  * Tries to lock @rec_mutex. If @rec_mutex is already locked
22305  * by another thread, it immediately returns %FALSE. Otherwise
22306  * it locks @rec_mutex and returns %TRUE.
22307  *
22308  * Returns: %TRUE if @rec_mutex could be locked
22309  * Since: 2.32
22310  */
22311
22312
22313 /**
22314  * g_rec_mutex_unlock:
22315  * @rec_mutex: a #GRecMutex
22316  *
22317  * Unlocks @rec_mutex. If another thread is blocked in a
22318  * g_rec_mutex_lock() call for @rec_mutex, it will become unblocked
22319  * and can lock @rec_mutex itself.
22320  *
22321  * Calling g_rec_mutex_unlock() on a recursive mutex that is not
22322  * locked by the current thread leads to undefined behaviour.
22323  *
22324  * Since: 2.32
22325  */
22326
22327
22328 /**
22329  * g_regex_check_replacement:
22330  * @replacement: the replacement string
22331  * @has_references: (out) (allow-none): location to store information about references in @replacement or %NULL
22332  * @error: location to store error
22333  *
22334  * Checks whether @replacement is a valid replacement string
22335  * (see g_regex_replace()), i.e. that all escape sequences in
22336  * it are valid.
22337  *
22338  * If @has_references is not %NULL then @replacement is checked
22339  * for pattern references. For instance, replacement text 'foo\n'
22340  * does not contain references and may be evaluated without information
22341  * about actual match, but '\0\1' (whole match followed by first
22342  * subpattern) requires valid #GMatchInfo object.
22343  *
22344  * Returns: whether @replacement is a valid replacement string
22345  * Since: 2.14
22346  */
22347
22348
22349 /**
22350  * g_regex_escape_nul:
22351  * @string: the string to escape
22352  * @length: the length of @string
22353  *
22354  * Escapes the nul characters in @string to "\x00".  It can be used
22355  * to compile a regex with embedded nul characters.
22356  *
22357  * For completeness, @length can be -1 for a nul-terminated string.
22358  * In this case the output string will be of course equal to @string.
22359  *
22360  * Returns: a newly-allocated escaped string
22361  * Since: 2.30
22362  */
22363
22364
22365 /**
22366  * g_regex_escape_string:
22367  * @string: (array length=length): the string to escape
22368  * @length: the length of @string, or -1 if @string is nul-terminated
22369  *
22370  * Escapes the special characters used for regular expressions
22371  * in @string, for instance "a.b*c" becomes "a\.b\*c". This
22372  * function is useful to dynamically generate regular expressions.
22373  *
22374  * @string can contain nul characters that are replaced with "\0",
22375  * in this case remember to specify the correct length of @string
22376  * in @length.
22377  *
22378  * Returns: a newly-allocated escaped string
22379  * Since: 2.14
22380  */
22381
22382
22383 /**
22384  * g_regex_get_capture_count:
22385  * @regex: a #GRegex
22386  *
22387  * Returns the number of capturing subpatterns in the pattern.
22388  *
22389  * Returns: the number of capturing subpatterns
22390  * Since: 2.14
22391  */
22392
22393
22394 /**
22395  * g_regex_get_compile_flags:
22396  * @regex: a #GRegex
22397  *
22398  * Returns the compile options that @regex was created with.
22399  *
22400  * Returns: flags from #GRegexCompileFlags
22401  * Since: 2.26
22402  */
22403
22404
22405 /**
22406  * g_regex_get_has_cr_or_lf:
22407  * @regex: a #GRegex structure
22408  *
22409  * Checks whether the pattern contains explicit CR or LF references.
22410  *
22411  * Returns: %TRUE if the pattern contains explicit CR or LF references
22412  * Since: 2.34
22413  */
22414
22415
22416 /**
22417  * g_regex_get_match_flags:
22418  * @regex: a #GRegex
22419  *
22420  * Returns the match options that @regex was created with.
22421  *
22422  * Returns: flags from #GRegexMatchFlags
22423  * Since: 2.26
22424  */
22425
22426
22427 /**
22428  * g_regex_get_max_backref:
22429  * @regex: a #GRegex
22430  *
22431  * Returns the number of the highest back reference
22432  * in the pattern, or 0 if the pattern does not contain
22433  * back references.
22434  *
22435  * Returns: the number of the highest back reference
22436  * Since: 2.14
22437  */
22438
22439
22440 /**
22441  * g_regex_get_pattern:
22442  * @regex: a #GRegex structure
22443  *
22444  * Gets the pattern string associated with @regex, i.e. a copy of
22445  * the string passed to g_regex_new().
22446  *
22447  * Returns: the pattern of @regex
22448  * Since: 2.14
22449  */
22450
22451
22452 /**
22453  * g_regex_get_string_number:
22454  * @regex: #GRegex structure
22455  * @name: name of the subexpression
22456  *
22457  * Retrieves the number of the subexpression named @name.
22458  *
22459  * Returns: The number of the subexpression or -1 if @name does not exists
22460  * Since: 2.14
22461  */
22462
22463
22464 /**
22465  * g_regex_match:
22466  * @regex: a #GRegex structure from g_regex_new()
22467  * @string: the string to scan for matches
22468  * @match_options: match options
22469  * @match_info: (out) (allow-none): pointer to location where to store the #GMatchInfo, or %NULL if you do not need it
22470  *
22471  * Scans for a match in string for the pattern in @regex.
22472  * The @match_options are combined with the match options specified
22473  * when the @regex structure was created, letting you have more
22474  * flexibility in reusing #GRegex structures.
22475  *
22476  * A #GMatchInfo structure, used to get information on the match,
22477  * is stored in @match_info if not %NULL. Note that if @match_info
22478  * is not %NULL then it is created even if the function returns %FALSE,
22479  * i.e. you must free it regardless if regular expression actually matched.
22480  *
22481  * To retrieve all the non-overlapping matches of the pattern in
22482  * string you can use g_match_info_next().
22483  *
22484  * |[
22485  * static void
22486  * print_uppercase_words (const gchar *string)
22487  * {
22488  *   /&ast; Print all uppercase-only words. &ast;/
22489  *   GRegex *regex;
22490  *   GMatchInfo *match_info;
22491  *   &nbsp;
22492  *   regex = g_regex_new ("[A-Z]+", 0, 0, NULL);
22493  *   g_regex_match (regex, string, 0, &amp;match_info);
22494  *   while (g_match_info_matches (match_info))
22495  *     {
22496  *       gchar *word = g_match_info_fetch (match_info, 0);
22497  *       g_print ("Found: %s\n", word);
22498  *       g_free (word);
22499  *       g_match_info_next (match_info, NULL);
22500  *     }
22501  *   g_match_info_free (match_info);
22502  *   g_regex_unref (regex);
22503  * }
22504  * ]|
22505  *
22506  * @string is not copied and is used in #GMatchInfo internally. If
22507  * you use any #GMatchInfo method (except g_match_info_free()) after
22508  * freeing or modifying @string then the behaviour is undefined.
22509  *
22510  * Returns: %TRUE is the string matched, %FALSE otherwise
22511  * Since: 2.14
22512  */
22513
22514
22515 /**
22516  * g_regex_match_all:
22517  * @regex: a #GRegex structure from g_regex_new()
22518  * @string: the string to scan for matches
22519  * @match_options: match options
22520  * @match_info: (out) (allow-none): pointer to location where to store the #GMatchInfo, or %NULL if you do not need it
22521  *
22522  * Using the standard algorithm for regular expression matching only
22523  * the longest match in the string is retrieved. This function uses
22524  * a different algorithm so it can retrieve all the possible matches.
22525  * For more documentation see g_regex_match_all_full().
22526  *
22527  * A #GMatchInfo structure, used to get information on the match, is
22528  * stored in @match_info if not %NULL. Note that if @match_info is
22529  * not %NULL then it is created even if the function returns %FALSE,
22530  * i.e. you must free it regardless if regular expression actually
22531  * matched.
22532  *
22533  * @string is not copied and is used in #GMatchInfo internally. If
22534  * you use any #GMatchInfo method (except g_match_info_free()) after
22535  * freeing or modifying @string then the behaviour is undefined.
22536  *
22537  * Returns: %TRUE is the string matched, %FALSE otherwise
22538  * Since: 2.14
22539  */
22540
22541
22542 /**
22543  * g_regex_match_all_full:
22544  * @regex: a #GRegex structure from g_regex_new()
22545  * @string: (array length=string_len): the string to scan for matches
22546  * @string_len: the length of @string, or -1 if @string is nul-terminated
22547  * @start_position: starting index of the string to match
22548  * @match_options: match options
22549  * @match_info: (out) (allow-none): pointer to location where to store the #GMatchInfo, or %NULL if you do not need it
22550  * @error: location to store the error occurring, or %NULL to ignore errors
22551  *
22552  * Using the standard algorithm for regular expression matching only
22553  * the longest match in the string is retrieved, it is not possible
22554  * to obtain all the available matches. For instance matching
22555  * "&lt;a&gt; &lt;b&gt; &lt;c&gt;" against the pattern "&lt;.*&gt;"
22556  * you get "&lt;a&gt; &lt;b&gt; &lt;c&gt;".
22557  *
22558  * This function uses a different algorithm (called DFA, i.e. deterministic
22559  * finite automaton), so it can retrieve all the possible matches, all
22560  * starting at the same point in the string. For instance matching
22561  * "&lt;a&gt; &lt;b&gt; &lt;c&gt;" against the pattern "&lt;.*&gt;"
22562  * you would obtain three matches: "&lt;a&gt; &lt;b&gt; &lt;c&gt;",
22563  * "&lt;a&gt; &lt;b&gt;" and "&lt;a&gt;".
22564  *
22565  * The number of matched strings is retrieved using
22566  * g_match_info_get_match_count(). To obtain the matched strings and
22567  * their position you can use, respectively, g_match_info_fetch() and
22568  * g_match_info_fetch_pos(). Note that the strings are returned in
22569  * reverse order of length; that is, the longest matching string is
22570  * given first.
22571  *
22572  * Note that the DFA algorithm is slower than the standard one and it
22573  * is not able to capture substrings, so backreferences do not work.
22574  *
22575  * Setting @start_position differs from just passing over a shortened
22576  * string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern
22577  * that begins with any kind of lookbehind assertion, such as "\b".
22578  *
22579  * A #GMatchInfo structure, used to get information on the match, is
22580  * stored in @match_info if not %NULL. Note that if @match_info is
22581  * not %NULL then it is created even if the function returns %FALSE,
22582  * i.e. you must free it regardless if regular expression actually
22583  * matched.
22584  *
22585  * @string is not copied and is used in #GMatchInfo internally. If
22586  * you use any #GMatchInfo method (except g_match_info_free()) after
22587  * freeing or modifying @string then the behaviour is undefined.
22588  *
22589  * Returns: %TRUE is the string matched, %FALSE otherwise
22590  * Since: 2.14
22591  */
22592
22593
22594 /**
22595  * g_regex_match_full:
22596  * @regex: a #GRegex structure from g_regex_new()
22597  * @string: (array length=string_len): the string to scan for matches
22598  * @string_len: the length of @string, or -1 if @string is nul-terminated
22599  * @start_position: starting index of the string to match
22600  * @match_options: match options
22601  * @match_info: (out) (allow-none): pointer to location where to store the #GMatchInfo, or %NULL if you do not need it
22602  * @error: location to store the error occurring, or %NULL to ignore errors
22603  *
22604  * Scans for a match in string for the pattern in @regex.
22605  * The @match_options are combined with the match options specified
22606  * when the @regex structure was created, letting you have more
22607  * flexibility in reusing #GRegex structures.
22608  *
22609  * Setting @start_position differs from just passing over a shortened
22610  * string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern
22611  * that begins with any kind of lookbehind assertion, such as "\b".
22612  *
22613  * A #GMatchInfo structure, used to get information on the match, is
22614  * stored in @match_info if not %NULL. Note that if @match_info is
22615  * not %NULL then it is created even if the function returns %FALSE,
22616  * i.e. you must free it regardless if regular expression actually
22617  * matched.
22618  *
22619  * @string is not copied and is used in #GMatchInfo internally. If
22620  * you use any #GMatchInfo method (except g_match_info_free()) after
22621  * freeing or modifying @string then the behaviour is undefined.
22622  *
22623  * To retrieve all the non-overlapping matches of the pattern in
22624  * string you can use g_match_info_next().
22625  *
22626  * |[
22627  * static void
22628  * print_uppercase_words (const gchar *string)
22629  * {
22630  *   /&ast; Print all uppercase-only words. &ast;/
22631  *   GRegex *regex;
22632  *   GMatchInfo *match_info;
22633  *   GError *error = NULL;
22634  *   &nbsp;
22635  *   regex = g_regex_new ("[A-Z]+", 0, 0, NULL);
22636  *   g_regex_match_full (regex, string, -1, 0, 0, &amp;match_info, &amp;error);
22637  *   while (g_match_info_matches (match_info))
22638  *     {
22639  *       gchar *word = g_match_info_fetch (match_info, 0);
22640  *       g_print ("Found: %s\n", word);
22641  *       g_free (word);
22642  *       g_match_info_next (match_info, &amp;error);
22643  *     }
22644  *   g_match_info_free (match_info);
22645  *   g_regex_unref (regex);
22646  *   if (error != NULL)
22647  *     {
22648  *       g_printerr ("Error while matching: %s\n", error->message);
22649  *       g_error_free (error);
22650  *     }
22651  * }
22652  * ]|
22653  *
22654  * Returns: %TRUE is the string matched, %FALSE otherwise
22655  * Since: 2.14
22656  */
22657
22658
22659 /**
22660  * g_regex_match_simple:
22661  * @pattern: the regular expression
22662  * @string: the string to scan for matches
22663  * @compile_options: compile options for the regular expression, or 0
22664  * @match_options: match options, or 0
22665  *
22666  * Scans for a match in @string for @pattern.
22667  *
22668  * This function is equivalent to g_regex_match() but it does not
22669  * require to compile the pattern with g_regex_new(), avoiding some
22670  * lines of code when you need just to do a match without extracting
22671  * substrings, capture counts, and so on.
22672  *
22673  * If this function is to be called on the same @pattern more than
22674  * once, it's more efficient to compile the pattern once with
22675  * g_regex_new() and then use g_regex_match().
22676  *
22677  * Returns: %TRUE if the string matched, %FALSE otherwise
22678  * Since: 2.14
22679  */
22680
22681
22682 /**
22683  * g_regex_new:
22684  * @pattern: the regular expression
22685  * @compile_options: compile options for the regular expression, or 0
22686  * @match_options: match options for the regular expression, or 0
22687  * @error: return location for a #GError
22688  *
22689  * Compiles the regular expression to an internal form, and does
22690  * the initial setup of the #GRegex structure.
22691  *
22692  * Returns: a #GRegex structure. Call g_regex_unref() when you are done with it
22693  * Since: 2.14
22694  */
22695
22696
22697 /**
22698  * g_regex_ref:
22699  * @regex: a #GRegex
22700  *
22701  * Increases reference count of @regex by 1.
22702  *
22703  * Returns: @regex
22704  * Since: 2.14
22705  */
22706
22707
22708 /**
22709  * g_regex_replace:
22710  * @regex: a #GRegex structure
22711  * @string: (array length=string_len): the string to perform matches against
22712  * @string_len: the length of @string, or -1 if @string is nul-terminated
22713  * @start_position: starting index of the string to match
22714  * @replacement: text to replace each match with
22715  * @match_options: options for the match
22716  * @error: location to store the error occurring, or %NULL to ignore errors
22717  *
22718  * Replaces all occurrences of the pattern in @regex with the
22719  * replacement text. Backreferences of the form '\number' or
22720  * '\g&lt;number&gt;' in the replacement text are interpolated by the
22721  * number-th captured subexpression of the match, '\g&lt;name&gt;' refers
22722  * to the captured subexpression with the given name. '\0' refers to the
22723  * complete match, but '\0' followed by a number is the octal representation
22724  * of a character. To include a literal '\' in the replacement, write '\\'.
22725  * There are also escapes that changes the case of the following text:
22726  *
22727  * <variablelist>
22728  * <varlistentry><term>\l</term>
22729  * <listitem>
22730  * <para>Convert to lower case the next character</para>
22731  * </listitem>
22732  * </varlistentry>
22733  * <varlistentry><term>\u</term>
22734  * <listitem>
22735  * <para>Convert to upper case the next character</para>
22736  * </listitem>
22737  * </varlistentry>
22738  * <varlistentry><term>\L</term>
22739  * <listitem>
22740  * <para>Convert to lower case till \E</para>
22741  * </listitem>
22742  * </varlistentry>
22743  * <varlistentry><term>\U</term>
22744  * <listitem>
22745  * <para>Convert to upper case till \E</para>
22746  * </listitem>
22747  * </varlistentry>
22748  * <varlistentry><term>\E</term>
22749  * <listitem>
22750  * <para>End case modification</para>
22751  * </listitem>
22752  * </varlistentry>
22753  * </variablelist>
22754  *
22755  * If you do not need to use backreferences use g_regex_replace_literal().
22756  *
22757  * The @replacement string must be UTF-8 encoded even if #G_REGEX_RAW was
22758  * passed to g_regex_new(). If you want to use not UTF-8 encoded stings
22759  * you can use g_regex_replace_literal().
22760  *
22761  * Setting @start_position differs from just passing over a shortened
22762  * string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern that
22763  * begins with any kind of lookbehind assertion, such as "\b".
22764  *
22765  * Returns: a newly allocated string containing the replacements
22766  * Since: 2.14
22767  */
22768
22769
22770 /**
22771  * g_regex_replace_eval:
22772  * @regex: a #GRegex structure from g_regex_new()
22773  * @string: (array length=string_len): string to perform matches against
22774  * @string_len: the length of @string, or -1 if @string is nul-terminated
22775  * @start_position: starting index of the string to match
22776  * @match_options: options for the match
22777  * @eval: a function to call for each match
22778  * @user_data: user data to pass to the function
22779  * @error: location to store the error occurring, or %NULL to ignore errors
22780  *
22781  * Replaces occurrences of the pattern in regex with the output of
22782  * @eval for that occurrence.
22783  *
22784  * Setting @start_position differs from just passing over a shortened
22785  * string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern
22786  * that begins with any kind of lookbehind assertion, such as "\b".
22787  *
22788  * The following example uses g_regex_replace_eval() to replace multiple
22789  * strings at once:
22790  * |[
22791  * static gboolean
22792  * eval_cb (const GMatchInfo *info,
22793  *          GString          *res,
22794  *          gpointer          data)
22795  * {
22796  *   gchar *match;
22797  *   gchar *r;
22798  *
22799  *    match = g_match_info_fetch (info, 0);
22800  *    r = g_hash_table_lookup ((GHashTable *)data, match);
22801  *    g_string_append (res, r);
22802  *    g_free (match);
22803  *
22804  *    return FALSE;
22805  * }
22806  *
22807  * /&ast; ... &ast;/
22808  *
22809  * GRegex *reg;
22810  * GHashTable *h;
22811  * gchar *res;
22812  *
22813  * h = g_hash_table_new (g_str_hash, g_str_equal);
22814  *
22815  * g_hash_table_insert (h, "1", "ONE");
22816  * g_hash_table_insert (h, "2", "TWO");
22817  * g_hash_table_insert (h, "3", "THREE");
22818  * g_hash_table_insert (h, "4", "FOUR");
22819  *
22820  * reg = g_regex_new ("1|2|3|4", 0, 0, NULL);
22821  * res = g_regex_replace_eval (reg, text, -1, 0, 0, eval_cb, h, NULL);
22822  * g_hash_table_destroy (h);
22823  *
22824  * /&ast; ... &ast;/
22825  * ]|
22826  *
22827  * Returns: a newly allocated string containing the replacements
22828  * Since: 2.14
22829  */
22830
22831
22832 /**
22833  * g_regex_replace_literal:
22834  * @regex: a #GRegex structure
22835  * @string: (array length=string_len): the string to perform matches against
22836  * @string_len: the length of @string, or -1 if @string is nul-terminated
22837  * @start_position: starting index of the string to match
22838  * @replacement: text to replace each match with
22839  * @match_options: options for the match
22840  * @error: location to store the error occurring, or %NULL to ignore errors
22841  *
22842  * Replaces all occurrences of the pattern in @regex with the
22843  * replacement text. @replacement is replaced literally, to
22844  * include backreferences use g_regex_replace().
22845  *
22846  * Setting @start_position differs from just passing over a
22847  * shortened string and setting #G_REGEX_MATCH_NOTBOL in the
22848  * case of a pattern that begins with any kind of lookbehind
22849  * assertion, such as "\b".
22850  *
22851  * Returns: a newly allocated string containing the replacements
22852  * Since: 2.14
22853  */
22854
22855
22856 /**
22857  * g_regex_split:
22858  * @regex: a #GRegex structure
22859  * @string: the string to split with the pattern
22860  * @match_options: match time option flags
22861  *
22862  * Breaks the string on the pattern, and returns an array of the tokens.
22863  * If the pattern contains capturing parentheses, then the text for each
22864  * of the substrings will also be returned. If the pattern does not match
22865  * anywhere in the string, then the whole string is returned as the first
22866  * token.
22867  *
22868  * As a special case, the result of splitting the empty string "" is an
22869  * empty vector, not a vector containing a single string. The reason for
22870  * this special case is that being able to represent a empty vector is
22871  * typically more useful than consistent handling of empty elements. If
22872  * you do need to represent empty elements, you'll need to check for the
22873  * empty string before calling this function.
22874  *
22875  * A pattern that can match empty strings splits @string into separate
22876  * characters wherever it matches the empty string between characters.
22877  * For example splitting "ab c" using as a separator "\s*", you will get
22878  * "a", "b" and "c".
22879  *
22880  * Returns: (transfer full): a %NULL-terminated gchar ** array. Free it using g_strfreev()
22881  * Since: 2.14
22882  */
22883
22884
22885 /**
22886  * g_regex_split_full:
22887  * @regex: a #GRegex structure
22888  * @string: (array length=string_len): the string to split with the pattern
22889  * @string_len: the length of @string, or -1 if @string is nul-terminated
22890  * @start_position: starting index of the string to match
22891  * @match_options: match time option flags
22892  * @max_tokens: the maximum number of tokens to split @string into. If this is less than 1, the string is split completely
22893  * @error: return location for a #GError
22894  *
22895  * Breaks the string on the pattern, and returns an array of the tokens.
22896  * If the pattern contains capturing parentheses, then the text for each
22897  * of the substrings will also be returned. If the pattern does not match
22898  * anywhere in the string, then the whole string is returned as the first
22899  * token.
22900  *
22901  * As a special case, the result of splitting the empty string "" is an
22902  * empty vector, not a vector containing a single string. The reason for
22903  * this special case is that being able to represent a empty vector is
22904  * typically more useful than consistent handling of empty elements. If
22905  * you do need to represent empty elements, you'll need to check for the
22906  * empty string before calling this function.
22907  *
22908  * A pattern that can match empty strings splits @string into separate
22909  * characters wherever it matches the empty string between characters.
22910  * For example splitting "ab c" using as a separator "\s*", you will get
22911  * "a", "b" and "c".
22912  *
22913  * Setting @start_position differs from just passing over a shortened
22914  * string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern
22915  * that begins with any kind of lookbehind assertion, such as "\b".
22916  *
22917  * Returns: (transfer full): a %NULL-terminated gchar ** array. Free it using g_strfreev()
22918  * Since: 2.14
22919  */
22920
22921
22922 /**
22923  * g_regex_split_simple:
22924  * @pattern: the regular expression
22925  * @string: the string to scan for matches
22926  * @compile_options: compile options for the regular expression, or 0
22927  * @match_options: match options, or 0
22928  *
22929  * Breaks the string on the pattern, and returns an array of
22930  * the tokens. If the pattern contains capturing parentheses,
22931  * then the text for each of the substrings will also be returned.
22932  * If the pattern does not match anywhere in the string, then the
22933  * whole string is returned as the first token.
22934  *
22935  * This function is equivalent to g_regex_split() but it does
22936  * not require to compile the pattern with g_regex_new(), avoiding
22937  * some lines of code when you need just to do a split without
22938  * extracting substrings, capture counts, and so on.
22939  *
22940  * If this function is to be called on the same @pattern more than
22941  * once, it's more efficient to compile the pattern once with
22942  * g_regex_new() and then use g_regex_split().
22943  *
22944  * As a special case, the result of splitting the empty string ""
22945  * is an empty vector, not a vector containing a single string.
22946  * The reason for this special case is that being able to represent
22947  * a empty vector is typically more useful than consistent handling
22948  * of empty elements. If you do need to represent empty elements,
22949  * you'll need to check for the empty string before calling this
22950  * function.
22951  *
22952  * A pattern that can match empty strings splits @string into
22953  * separate characters wherever it matches the empty string between
22954  * characters. For example splitting "ab c" using as a separator
22955  * "\s*", you will get "a", "b" and "c".
22956  *
22957  * Returns: (transfer full): a %NULL-terminated array of strings. Free it using g_strfreev()
22958  * Since: 2.14
22959  */
22960
22961
22962 /**
22963  * g_regex_unref:
22964  * @regex: a #GRegex
22965  *
22966  * Decreases reference count of @regex by 1. When reference count drops
22967  * to zero, it frees all the memory associated with the regex structure.
22968  *
22969  * Since: 2.14
22970  */
22971
22972
22973 /**
22974  * g_reload_user_special_dirs_cache:
22975  *
22976  * Resets the cache used for g_get_user_special_dir(), so
22977  * that the latest on-disk version is used. Call this only
22978  * if you just changed the data on disk yourself.
22979  *
22980  * Due to threadsafety issues this may cause leaking of strings
22981  * that were previously returned from g_get_user_special_dir()
22982  * that can't be freed. We ensure to only leak the data for
22983  * the directories that actually changed value though.
22984  *
22985  * Since: 2.22
22986  */
22987
22988
22989 /**
22990  * g_remove:
22991  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
22992  *
22993  * A wrapper for the POSIX remove() function. The remove() function
22994  * deletes a name from the filesystem.
22995  *
22996  * See your C library manual for more details about how remove() works
22997  * on your system. On Unix, remove() removes also directories, as it
22998  * calls unlink() for files and rmdir() for directories. On Windows,
22999  * although remove() in the C library only works for files, this
23000  * function tries first remove() and then if that fails rmdir(), and
23001  * thus works for both files and directories. Note however, that on
23002  * Windows, it is in general not possible to remove a file that is
23003  * open to some process, or mapped into memory.
23004  *
23005  * If this function fails on Windows you can't infer too much from the
23006  * errno value. rmdir() is tried regardless of what caused remove() to
23007  * fail. Any errno value set by remove() will be overwritten by that
23008  * set by rmdir().
23009  *
23010  * Returns: 0 if the file was successfully removed, -1 if an error occurred
23011  * Since: 2.6
23012  */
23013
23014
23015 /**
23016  * g_rename:
23017  * @oldfilename: a pathname in the GLib file name encoding (UTF-8 on Windows)
23018  * @newfilename: a pathname in the GLib file name encoding
23019  *
23020  * A wrapper for the POSIX rename() function. The rename() function
23021  * renames a file, moving it between directories if required.
23022  *
23023  * See your C library manual for more details about how rename() works
23024  * on your system. It is not possible in general on Windows to rename
23025  * a file that is open to some process.
23026  *
23027  * Returns: 0 if the renaming succeeded, -1 if an error occurred
23028  * Since: 2.6
23029  */
23030
23031
23032 /**
23033  * g_rmdir:
23034  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
23035  *
23036  * A wrapper for the POSIX rmdir() function. The rmdir() function
23037  * deletes a directory from the filesystem.
23038  *
23039  * See your C library manual for more details about how rmdir() works
23040  * on your system.
23041  *
23042  * Returns: 0 if the directory was successfully removed, -1 if an error occurred
23043  * Since: 2.6
23044  */
23045
23046
23047 /**
23048  * g_rw_lock_clear:
23049  * @rw_lock: an initialized #GRWLock
23050  *
23051  * Frees the resources allocated to a lock with g_rw_lock_init().
23052  *
23053  * This function should not be used with a #GRWLock that has been
23054  * statically allocated.
23055  *
23056  * Calling g_rw_lock_clear() when any thread holds the lock
23057  * leads to undefined behaviour.
23058  *
23059  * Sine: 2.32
23060  */
23061
23062
23063 /**
23064  * g_rw_lock_init:
23065  * @rw_lock: an uninitialized #GRWLock
23066  *
23067  * Initializes a #GRWLock so that it can be used.
23068  *
23069  * This function is useful to initialize a lock that has been
23070  * allocated on the stack, or as part of a larger structure.  It is not
23071  * necessary to initialise a reader-writer lock that has been statically
23072  * allocated.
23073  *
23074  * |[
23075  *   typedef struct {
23076  *     GRWLock l;
23077  *     ...
23078  *   } Blob;
23079  *
23080  * Blob *b;
23081  *
23082  * b = g_new (Blob, 1);
23083  * g_rw_lock_init (&b->l);
23084  * ]|
23085  *
23086  * To undo the effect of g_rw_lock_init() when a lock is no longer
23087  * needed, use g_rw_lock_clear().
23088  *
23089  * Calling g_rw_lock_init() on an already initialized #GRWLock leads
23090  * to undefined behaviour.
23091  *
23092  * Since: 2.32
23093  */
23094
23095
23096 /**
23097  * g_rw_lock_reader_lock:
23098  * @rw_lock: a #GRWLock
23099  *
23100  * Obtain a read lock on @rw_lock. If another thread currently holds
23101  * the write lock on @rw_lock or blocks waiting for it, the current
23102  * thread will block. Read locks can be taken recursively.
23103  *
23104  * It is implementation-defined how many threads are allowed to
23105  * hold read locks on the same lock simultaneously.
23106  *
23107  * Since: 2.32
23108  */
23109
23110
23111 /**
23112  * g_rw_lock_reader_trylock:
23113  * @rw_lock: a #GRWLock
23114  *
23115  * Tries to obtain a read lock on @rw_lock and returns %TRUE if
23116  * the read lock was successfully obtained. Otherwise it
23117  * returns %FALSE.
23118  *
23119  * Returns: %TRUE if @rw_lock could be locked
23120  * Since: 2.32
23121  */
23122
23123
23124 /**
23125  * g_rw_lock_reader_unlock:
23126  * @rw_lock: a #GRWLock
23127  *
23128  * Release a read lock on @rw_lock.
23129  *
23130  * Calling g_rw_lock_reader_unlock() on a lock that is not held
23131  * by the current thread leads to undefined behaviour.
23132  *
23133  * Since: 2.32
23134  */
23135
23136
23137 /**
23138  * g_rw_lock_writer_lock:
23139  * @rw_lock: a #GRWLock
23140  *
23141  * Obtain a write lock on @rw_lock. If any thread already holds
23142  * a read or write lock on @rw_lock, the current thread will block
23143  * until all other threads have dropped their locks on @rw_lock.
23144  *
23145  * Since: 2.32
23146  */
23147
23148
23149 /**
23150  * g_rw_lock_writer_trylock:
23151  * @rw_lock: a #GRWLock
23152  *
23153  * Tries to obtain a write lock on @rw_lock. If any other thread holds
23154  * a read or write lock on @rw_lock, it immediately returns %FALSE.
23155  * Otherwise it locks @rw_lock and returns %TRUE.
23156  *
23157  * Returns: %TRUE if @rw_lock could be locked
23158  * Since: 2.32
23159  */
23160
23161
23162 /**
23163  * g_rw_lock_writer_unlock:
23164  * @rw_lock: a #GRWLock
23165  *
23166  * Release a write lock on @rw_lock.
23167  *
23168  * Calling g_rw_lock_writer_unlock() on a lock that is not held
23169  * by the current thread leads to undefined behaviour.
23170  *
23171  * Since: 2.32
23172  */
23173
23174
23175 /**
23176  * g_scanner_add_symbol:
23177  * @scanner: a #GScanner
23178  * @symbol: the symbol to add
23179  * @value: the value of the symbol
23180  *
23181  * Adds a symbol to the default scope.
23182  *
23183  * Deprecated: 2.2: Use g_scanner_scope_add_symbol() instead.
23184  */
23185
23186
23187 /**
23188  * g_scanner_cur_line:
23189  * @scanner: a #GScanner
23190  *
23191  * Returns the current line in the input stream (counting
23192  * from 1). This is the line of the last token parsed via
23193  * g_scanner_get_next_token().
23194  *
23195  * Returns: the current line
23196  */
23197
23198
23199 /**
23200  * g_scanner_cur_position:
23201  * @scanner: a #GScanner
23202  *
23203  * Returns the current position in the current line (counting
23204  * from 0). This is the position of the last token parsed via
23205  * g_scanner_get_next_token().
23206  *
23207  * Returns: the current position on the line
23208  */
23209
23210
23211 /**
23212  * g_scanner_cur_token:
23213  * @scanner: a #GScanner
23214  *
23215  * Gets the current token type. This is simply the @token
23216  * field in the #GScanner structure.
23217  *
23218  * Returns: the current token type
23219  */
23220
23221
23222 /**
23223  * g_scanner_cur_value:
23224  * @scanner: a #GScanner
23225  *
23226  * Gets the current token value. This is simply the @value
23227  * field in the #GScanner structure.
23228  *
23229  * Returns: the current token value
23230  */
23231
23232
23233 /**
23234  * g_scanner_destroy:
23235  * @scanner: a #GScanner
23236  *
23237  * Frees all memory used by the #GScanner.
23238  */
23239
23240
23241 /**
23242  * g_scanner_eof:
23243  * @scanner: a #GScanner
23244  *
23245  * Returns %TRUE if the scanner has reached the end of
23246  * the file or text buffer.
23247  *
23248  * Returns: %TRUE if the scanner has reached the end of the file or text buffer
23249  */
23250
23251
23252 /**
23253  * g_scanner_error:
23254  * @scanner: a #GScanner
23255  * @format: the message format. See the printf() documentation
23256  * @...: the parameters to insert into the format string
23257  *
23258  * Outputs an error message, via the #GScanner message handler.
23259  */
23260
23261
23262 /**
23263  * g_scanner_foreach_symbol:
23264  * @scanner: a #GScanner
23265  * @func: the function to call with each symbol
23266  * @data: data to pass to the function
23267  *
23268  * Calls a function for each symbol in the default scope.
23269  *
23270  * Deprecated: 2.2: Use g_scanner_scope_foreach_symbol() instead.
23271  */
23272
23273
23274 /**
23275  * g_scanner_freeze_symbol_table:
23276  * @scanner: a #GScanner
23277  *
23278  * There is no reason to use this macro, since it does nothing.
23279  *
23280  * Deprecated: 2.2: This macro does nothing.
23281  */
23282
23283
23284 /**
23285  * g_scanner_get_next_token:
23286  * @scanner: a #GScanner
23287  *
23288  * Parses the next token just like g_scanner_peek_next_token()
23289  * and also removes it from the input stream. The token data is
23290  * placed in the @token, @value, @line, and @position fields of
23291  * the #GScanner structure.
23292  *
23293  * Returns: the type of the token
23294  */
23295
23296
23297 /**
23298  * g_scanner_input_file:
23299  * @scanner: a #GScanner
23300  * @input_fd: a file descriptor
23301  *
23302  * Prepares to scan a file.
23303  */
23304
23305
23306 /**
23307  * g_scanner_input_text:
23308  * @scanner: a #GScanner
23309  * @text: the text buffer to scan
23310  * @text_len: the length of the text buffer
23311  *
23312  * Prepares to scan a text buffer.
23313  */
23314
23315
23316 /**
23317  * g_scanner_lookup_symbol:
23318  * @scanner: a #GScanner
23319  * @symbol: the symbol to look up
23320  *
23321  * Looks up a symbol in the current scope and return its value.
23322  * If the symbol is not bound in the current scope, %NULL is
23323  * returned.
23324  *
23325  * Returns: the value of @symbol in the current scope, or %NULL if @symbol is not bound in the current scope
23326  */
23327
23328
23329 /**
23330  * g_scanner_new:
23331  * @config_templ: the initial scanner settings
23332  *
23333  * Creates a new #GScanner.
23334  *
23335  * The @config_templ structure specifies the initial settings
23336  * of the scanner, which are copied into the #GScanner
23337  * @config field. If you pass %NULL then the default settings
23338  * are used.
23339  *
23340  * Returns: the new #GScanner
23341  */
23342
23343
23344 /**
23345  * g_scanner_peek_next_token:
23346  * @scanner: a #GScanner
23347  *
23348  * Parses the next token, without removing it from the input stream.
23349  * The token data is placed in the @next_token, @next_value, @next_line,
23350  * and @next_position fields of the #GScanner structure.
23351  *
23352  * Note that, while the token is not removed from the input stream
23353  * (i.e. the next call to g_scanner_get_next_token() will return the
23354  * same token), it will not be reevaluated. This can lead to surprising
23355  * results when changing scope or the scanner configuration after peeking
23356  * the next token. Getting the next token after switching the scope or
23357  * configuration will return whatever was peeked before, regardless of
23358  * any symbols that may have been added or removed in the new scope.
23359  *
23360  * Returns: the type of the token
23361  */
23362
23363
23364 /**
23365  * g_scanner_remove_symbol:
23366  * @scanner: a #GScanner
23367  * @symbol: the symbol to remove
23368  *
23369  * Removes a symbol from the default scope.
23370  *
23371  * Deprecated: 2.2: Use g_scanner_scope_remove_symbol() instead.
23372  */
23373
23374
23375 /**
23376  * g_scanner_scope_add_symbol:
23377  * @scanner: a #GScanner
23378  * @scope_id: the scope id
23379  * @symbol: the symbol to add
23380  * @value: the value of the symbol
23381  *
23382  * Adds a symbol to the given scope.
23383  */
23384
23385
23386 /**
23387  * g_scanner_scope_foreach_symbol:
23388  * @scanner: a #GScanner
23389  * @scope_id: the scope id
23390  * @func: the function to call for each symbol/value pair
23391  * @user_data: user data to pass to the function
23392  *
23393  * Calls the given function for each of the symbol/value pairs
23394  * in the given scope of the #GScanner. The function is passed
23395  * the symbol and value of each pair, and the given @user_data
23396  * parameter.
23397  */
23398
23399
23400 /**
23401  * g_scanner_scope_lookup_symbol:
23402  * @scanner: a #GScanner
23403  * @scope_id: the scope id
23404  * @symbol: the symbol to look up
23405  *
23406  * Looks up a symbol in a scope and return its value. If the
23407  * symbol is not bound in the scope, %NULL is returned.
23408  *
23409  * Returns: the value of @symbol in the given scope, or %NULL if @symbol is not bound in the given scope.
23410  */
23411
23412
23413 /**
23414  * g_scanner_scope_remove_symbol:
23415  * @scanner: a #GScanner
23416  * @scope_id: the scope id
23417  * @symbol: the symbol to remove
23418  *
23419  * Removes a symbol from a scope.
23420  */
23421
23422
23423 /**
23424  * g_scanner_set_scope:
23425  * @scanner: a #GScanner
23426  * @scope_id: the new scope id
23427  *
23428  * Sets the current scope.
23429  *
23430  * Returns: the old scope id
23431  */
23432
23433
23434 /**
23435  * g_scanner_sync_file_offset:
23436  * @scanner: a #GScanner
23437  *
23438  * Rewinds the filedescriptor to the current buffer position
23439  * and blows the file read ahead buffer. This is useful for
23440  * third party uses of the scanners filedescriptor, which hooks
23441  * onto the current scanning position.
23442  */
23443
23444
23445 /**
23446  * g_scanner_thaw_symbol_table:
23447  * @scanner: a #GScanner
23448  *
23449  * There is no reason to use this macro, since it does nothing.
23450  *
23451  * Deprecated: 2.2: This macro does nothing.
23452  */
23453
23454
23455 /**
23456  * g_scanner_unexp_token:
23457  * @scanner: a #GScanner
23458  * @expected_token: the expected token
23459  * @identifier_spec: a string describing how the scanner's user refers to identifiers (%NULL defaults to "identifier"). This is used if @expected_token is %G_TOKEN_IDENTIFIER or %G_TOKEN_IDENTIFIER_NULL.
23460  * @symbol_spec: a string describing how the scanner's user refers to symbols (%NULL defaults to "symbol"). This is used if @expected_token is %G_TOKEN_SYMBOL or any token value greater than %G_TOKEN_LAST.
23461  * @symbol_name: the name of the symbol, if the scanner's current token is a symbol.
23462  * @message: a message string to output at the end of the warning/error, or %NULL.
23463  * @is_error: if %TRUE it is output as an error. If %FALSE it is output as a warning.
23464  *
23465  * Outputs a message through the scanner's msg_handler,
23466  * resulting from an unexpected token in the input stream.
23467  * Note that you should not call g_scanner_peek_next_token()
23468  * followed by g_scanner_unexp_token() without an intermediate
23469  * call to g_scanner_get_next_token(), as g_scanner_unexp_token()
23470  * evaluates the scanner's current token (not the peeked token)
23471  * to construct part of the message.
23472  */
23473
23474
23475 /**
23476  * g_scanner_warn:
23477  * @scanner: a #GScanner
23478  * @format: the message format. See the printf() documentation
23479  * @...: the parameters to insert into the format string
23480  *
23481  * Outputs a warning message, via the #GScanner message handler.
23482  */
23483
23484
23485 /**
23486  * g_sequence_append:
23487  * @seq: a #GSequence
23488  * @data: the data for the new item
23489  *
23490  * Adds a new item to the end of @seq.
23491  *
23492  * Returns: an iterator pointing to the new item
23493  * Since: 2.14
23494  */
23495
23496
23497 /**
23498  * g_sequence_foreach:
23499  * @seq: a #GSequence
23500  * @func: the function to call for each item in @seq
23501  * @user_data: user data passed to @func
23502  *
23503  * Calls @func for each item in the sequence passing @user_data
23504  * to the function.
23505  *
23506  * Since: 2.14
23507  */
23508
23509
23510 /**
23511  * g_sequence_foreach_range:
23512  * @begin: a #GSequenceIter
23513  * @end: a #GSequenceIter
23514  * @func: a #GFunc
23515  * @user_data: user data passed to @func
23516  *
23517  * Calls @func for each item in the range (@begin, @end) passing
23518  * @user_data to the function.
23519  *
23520  * Since: 2.14
23521  */
23522
23523
23524 /**
23525  * g_sequence_free:
23526  * @seq: a #GSequence
23527  *
23528  * Frees the memory allocated for @seq. If @seq has a data destroy
23529  * function associated with it, that function is called on all items in
23530  * @seq.
23531  *
23532  * Since: 2.14
23533  */
23534
23535
23536 /**
23537  * g_sequence_get:
23538  * @iter: a #GSequenceIter
23539  *
23540  * Returns the data that @iter points to.
23541  *
23542  * Returns: the data that @iter points to
23543  * Since: 2.14
23544  */
23545
23546
23547 /**
23548  * g_sequence_get_begin_iter:
23549  * @seq: a #GSequence
23550  *
23551  * Returns the begin iterator for @seq.
23552  *
23553  * Returns: the begin iterator for @seq.
23554  * Since: 2.14
23555  */
23556
23557
23558 /**
23559  * g_sequence_get_end_iter:
23560  * @seq: a #GSequence
23561  *
23562  * Returns the end iterator for @seg
23563  *
23564  * Returns: the end iterator for @seq
23565  * Since: 2.14
23566  */
23567
23568
23569 /**
23570  * g_sequence_get_iter_at_pos:
23571  * @seq: a #GSequence
23572  * @pos: a position in @seq, or -1 for the end.
23573  *
23574  * Returns the iterator at position @pos. If @pos is negative or larger
23575  * than the number of items in @seq, the end iterator is returned.
23576  *
23577  * Returns: The #GSequenceIter at position @pos
23578  * Since: 2.14
23579  */
23580
23581
23582 /**
23583  * g_sequence_get_length:
23584  * @seq: a #GSequence
23585  *
23586  * Returns the length of @seq
23587  *
23588  * Returns: the length of @seq
23589  * Since: 2.14
23590  */
23591
23592
23593 /**
23594  * g_sequence_insert_before:
23595  * @iter: a #GSequenceIter
23596  * @data: the data for the new item
23597  *
23598  * Inserts a new item just before the item pointed to by @iter.
23599  *
23600  * Returns: an iterator pointing to the new item
23601  * Since: 2.14
23602  */
23603
23604
23605 /**
23606  * g_sequence_insert_sorted:
23607  * @seq: a #GSequence
23608  * @data: the data to insert
23609  * @cmp_func: the function used to compare items in the sequence
23610  * @cmp_data: user data passed to @cmp_func.
23611  *
23612  * Inserts @data into @sequence using @func to determine the new
23613  * position. The sequence must already be sorted according to @cmp_func;
23614  * otherwise the new position of @data is undefined.
23615  *
23616  * @cmp_func is called with two items of the @seq and @user_data.
23617  * It should return 0 if the items are equal, a negative value
23618  * if the first item comes before the second, and a positive value
23619  * if the second  item comes before the first.
23620  *
23621  * Returns: a #GSequenceIter pointing to the new item.
23622  * Since: 2.14
23623  */
23624
23625
23626 /**
23627  * g_sequence_insert_sorted_iter:
23628  * @seq: a #GSequence
23629  * @data: data for the new item
23630  * @iter_cmp: the function used to compare iterators in the sequence
23631  * @cmp_data: user data passed to @cmp_func
23632  *
23633  * Like g_sequence_insert_sorted(), but uses
23634  * a #GSequenceIterCompareFunc instead of a #GCompareDataFunc as
23635  * the compare function.
23636  *
23637  * @iter_cmp is called with two iterators pointing into @seq.
23638  * It should return 0 if the iterators are equal, a negative
23639  * value if the first iterator comes before the second, and a
23640  * positive value if the second iterator comes before the first.
23641  *
23642  * It is called with two iterators pointing into @seq. It should
23643  * return 0 if the iterators are equal, a negative value if the
23644  * first iterator comes before the second, and a positive value
23645  * if the second iterator comes before the first.
23646  *
23647  * Returns: a #GSequenceIter pointing to the new item
23648  * Since: 2.14
23649  */
23650
23651
23652 /**
23653  * g_sequence_iter_compare:
23654  * @a: a #GSequenceIter
23655  * @b: a #GSequenceIter
23656  *
23657  * Returns a negative number if @a comes before @b, 0 if they are equal,
23658  * and a positive number if @a comes after @b.
23659  *
23660  * The @a and @b iterators must point into the same sequence.
23661  *
23662  * Returns: A negative number if @a comes before @b, 0 if they are equal, and a positive number if @a comes after @b.
23663  * Since: 2.14
23664  */
23665
23666
23667 /**
23668  * g_sequence_iter_get_position:
23669  * @iter: a #GSequenceIter
23670  *
23671  * Returns the position of @iter
23672  *
23673  * Returns: the position of @iter
23674  * Since: 2.14
23675  */
23676
23677
23678 /**
23679  * g_sequence_iter_get_sequence:
23680  * @iter: a #GSequenceIter
23681  *
23682  * Returns the #GSequence that @iter points into.
23683  *
23684  * Returns: the #GSequence that @iter points into.
23685  * Since: 2.14
23686  */
23687
23688
23689 /**
23690  * g_sequence_iter_is_begin:
23691  * @iter: a #GSequenceIter
23692  *
23693  * Returns whether @iter is the begin iterator
23694  *
23695  * Returns: whether @iter is the begin iterator
23696  * Since: 2.14
23697  */
23698
23699
23700 /**
23701  * g_sequence_iter_is_end:
23702  * @iter: a #GSequenceIter
23703  *
23704  * Returns whether @iter is the end iterator
23705  *
23706  * Returns: Whether @iter is the end iterator.
23707  * Since: 2.14
23708  */
23709
23710
23711 /**
23712  * g_sequence_iter_move:
23713  * @iter: a #GSequenceIter
23714  * @delta: A positive or negative number indicating how many positions away from @iter the returned #GSequenceIter will be.
23715  *
23716  * Returns the #GSequenceIter which is @delta positions away from @iter.
23717  * If @iter is closer than -@delta positions to the beginning of the sequence,
23718  * the begin iterator is returned. If @iter is closer than @delta positions
23719  * to the end of the sequence, the end iterator is returned.
23720  *
23721  * Returns: a #GSequenceIter which is @delta positions away from @iter.
23722  * Since: 2.14
23723  */
23724
23725
23726 /**
23727  * g_sequence_iter_next:
23728  * @iter: a #GSequenceIter
23729  *
23730  * Returns an iterator pointing to the next position after @iter. If
23731  * @iter is the end iterator, the end iterator is returned.
23732  *
23733  * Returns: a #GSequenceIter pointing to the next position after @iter.
23734  * Since: 2.14
23735  */
23736
23737
23738 /**
23739  * g_sequence_iter_prev:
23740  * @iter: a #GSequenceIter
23741  *
23742  * Returns an iterator pointing to the previous position before @iter. If
23743  * @iter is the begin iterator, the begin iterator is returned.
23744  *
23745  * Returns: a #GSequenceIter pointing to the previous position before @iter.
23746  * Since: 2.14
23747  */
23748
23749
23750 /**
23751  * g_sequence_lookup:
23752  * @seq: a #GSequence
23753  * @data: data to lookup
23754  * @cmp_func: the function used to compare items in the sequence
23755  * @cmp_data: user data passed to @cmp_func.
23756  *
23757  * Returns an iterator pointing to the position of the first item found
23758  * equal to @data according to @cmp_func and @cmp_data. If more than one
23759  * item is equal, it is not guaranteed that it is the first which is
23760  * returned. In that case, you can use g_sequence_iter_next() and
23761  * g_sequence_iter_prev() to get others.
23762  *
23763  * @cmp_func is called with two items of the @seq and @user_data.
23764  * It should return 0 if the items are equal, a negative value if
23765  * the first item comes before the second, and a positive value if
23766  * the second item comes before the first.
23767  *
23768  * <note><para>
23769  * This function will fail if the data contained in the sequence is
23770  * unsorted.  Use g_sequence_insert_sorted() or
23771  * g_sequence_insert_sorted_iter() to add data to your sequence or, if
23772  * you want to add a large amount of data, call g_sequence_sort() after
23773  * doing unsorted insertions.
23774  * </para></note>
23775  *
23776  * Returns: an #GSequenceIter pointing to the position of the first item found equal to @data according to @cmp_func and @cmp_data.
23777  * Since: 2.28
23778  */
23779
23780
23781 /**
23782  * g_sequence_lookup_iter:
23783  * @seq: a #GSequence
23784  * @data: data to lookup
23785  * @iter_cmp: the function used to compare iterators in the sequence
23786  * @cmp_data: user data passed to @iter_cmp
23787  *
23788  * Like g_sequence_lookup(), but uses a #GSequenceIterCompareFunc
23789  * instead of a #GCompareDataFunc as the compare function.
23790  *
23791  * @iter_cmp is called with two iterators pointing into @seq.
23792  * It should return 0 if the iterators are equal, a negative value
23793  * if the first iterator comes before the second, and a positive
23794  * value if the second iterator comes before the first.
23795  *
23796  * <note><para>
23797  * This function will fail if the data contained in the sequence is
23798  * unsorted.  Use g_sequence_insert_sorted() or
23799  * g_sequence_insert_sorted_iter() to add data to your sequence or, if
23800  * you want to add a large amount of data, call g_sequence_sort() after
23801  * doing unsorted insertions.
23802  * </para></note>
23803  *
23804  * Returns: an #GSequenceIter pointing to the position of the first item found equal to @data according to @cmp_func and @cmp_data.
23805  * Since: 2.28
23806  */
23807
23808
23809 /**
23810  * g_sequence_move:
23811  * @src: a #GSequenceIter pointing to the item to move
23812  * @dest: a #GSequenceIter pointing to the position to which the item is moved.
23813  *
23814  * Moves the item pointed to by @src to the position indicated by @dest.
23815  * After calling this function @dest will point to the position immediately
23816  * after @src. It is allowed for @src and @dest to point into different
23817  * sequences.
23818  *
23819  * Since: 2.14
23820  */
23821
23822
23823 /**
23824  * g_sequence_move_range:
23825  * @dest: a #GSequenceIter
23826  * @begin: a #GSequenceIter
23827  * @end: a #GSequenceIter
23828  *
23829  * Inserts the (@begin, @end) range at the destination pointed to by ptr.
23830  * The @begin and @end iters must point into the same sequence. It is
23831  * allowed for @dest to point to a different sequence than the one pointed
23832  * into by @begin and @end.
23833  *
23834  * If @dest is NULL, the range indicated by @begin and @end is
23835  * removed from the sequence. If @dest iter points to a place within
23836  * the (@begin, @end) range, the range does not move.
23837  *
23838  * Since: 2.14
23839  */
23840
23841
23842 /**
23843  * g_sequence_new:
23844  * @data_destroy: (allow-none): a #GDestroyNotify function, or %NULL
23845  *
23846  * Creates a new GSequence. The @data_destroy function, if non-%NULL will
23847  * be called on all items when the sequence is destroyed and on items that
23848  * are removed from the sequence.
23849  *
23850  * Returns: a new #GSequence
23851  * Since: 2.14
23852  */
23853
23854
23855 /**
23856  * g_sequence_prepend:
23857  * @seq: a #GSequence
23858  * @data: the data for the new item
23859  *
23860  * Adds a new item to the front of @seq
23861  *
23862  * Returns: an iterator pointing to the new item
23863  * Since: 2.14
23864  */
23865
23866
23867 /**
23868  * g_sequence_range_get_midpoint:
23869  * @begin: a #GSequenceIter
23870  * @end: a #GSequenceIter
23871  *
23872  * Finds an iterator somewhere in the range (@begin, @end). This
23873  * iterator will be close to the middle of the range, but is not
23874  * guaranteed to be <emphasis>exactly</emphasis> in the middle.
23875  *
23876  * The @begin and @end iterators must both point to the same sequence and
23877  * @begin must come before or be equal to @end in the sequence.
23878  *
23879  * Returns: A #GSequenceIter pointing somewhere in the (@begin, @end) range.
23880  * Since: 2.14
23881  */
23882
23883
23884 /**
23885  * g_sequence_remove:
23886  * @iter: a #GSequenceIter
23887  *
23888  * Removes the item pointed to by @iter. It is an error to pass the
23889  * end iterator to this function.
23890  *
23891  * If the sequence has a data destroy function associated with it, this
23892  * function is called on the data for the removed item.
23893  *
23894  * Since: 2.14
23895  */
23896
23897
23898 /**
23899  * g_sequence_remove_range:
23900  * @begin: a #GSequenceIter
23901  * @end: a #GSequenceIter
23902  *
23903  * Removes all items in the (@begin, @end) range.
23904  *
23905  * If the sequence has a data destroy function associated with it, this
23906  * function is called on the data for the removed items.
23907  *
23908  * Since: 2.14
23909  */
23910
23911
23912 /**
23913  * g_sequence_search:
23914  * @seq: a #GSequence
23915  * @data: data for the new item
23916  * @cmp_func: the function used to compare items in the sequence
23917  * @cmp_data: user data passed to @cmp_func.
23918  *
23919  * Returns an iterator pointing to the position where @data would
23920  * be inserted according to @cmp_func and @cmp_data.
23921  *
23922  * @cmp_func is called with two items of the @seq and @user_data.
23923  * It should return 0 if the items are equal, a negative value if
23924  * the first item comes before the second, and a positive value if
23925  * the second item comes before the first.
23926  *
23927  * If you are simply searching for an existing element of the sequence,
23928  * consider using g_sequence_lookup().
23929  *
23930  * <note><para>
23931  * This function will fail if the data contained in the sequence is
23932  * unsorted.  Use g_sequence_insert_sorted() or
23933  * g_sequence_insert_sorted_iter() to add data to your sequence or, if
23934  * you want to add a large amount of data, call g_sequence_sort() after
23935  * doing unsorted insertions.
23936  * </para></note>
23937  *
23938  * Returns: an #GSequenceIter pointing to the position where @data would have been inserted according to @cmp_func and @cmp_data.
23939  * Since: 2.14
23940  */
23941
23942
23943 /**
23944  * g_sequence_search_iter:
23945  * @seq: a #GSequence
23946  * @data: data for the new item
23947  * @iter_cmp: the function used to compare iterators in the sequence
23948  * @cmp_data: user data passed to @iter_cmp
23949  *
23950  * Like g_sequence_search(), but uses a #GSequenceIterCompareFunc
23951  * instead of a #GCompareDataFunc as the compare function.
23952  *
23953  * @iter_cmp is called with two iterators pointing into @seq.
23954  * It should return 0 if the iterators are equal, a negative value
23955  * if the first iterator comes before the second, and a positive
23956  * value if the second iterator comes before the first.
23957  *
23958  * If you are simply searching for an existing element of the sequence,
23959  * consider using g_sequence_lookup_iter().
23960  *
23961  * <note><para>
23962  * This function will fail if the data contained in the sequence is
23963  * unsorted.  Use g_sequence_insert_sorted() or
23964  * g_sequence_insert_sorted_iter() to add data to your sequence or, if
23965  * you want to add a large amount of data, call g_sequence_sort() after
23966  * doing unsorted insertions.
23967  * </para></note>
23968  *
23969  * Returns: a #GSequenceIter pointing to the position in @seq where @data would have been inserted according to @iter_cmp and @cmp_data.
23970  * Since: 2.14
23971  */
23972
23973
23974 /**
23975  * g_sequence_set:
23976  * @iter: a #GSequenceIter
23977  * @data: new data for the item
23978  *
23979  * Changes the data for the item pointed to by @iter to be @data. If
23980  * the sequence has a data destroy function associated with it, that
23981  * function is called on the existing data that @iter pointed to.
23982  *
23983  * Since: 2.14
23984  */
23985
23986
23987 /**
23988  * g_sequence_sort:
23989  * @seq: a #GSequence
23990  * @cmp_func: the function used to sort the sequence
23991  * @cmp_data: user data passed to @cmp_func
23992  *
23993  * Sorts @seq using @cmp_func.
23994  *
23995  * @cmp_func is passed two items of @seq and should
23996  * return 0 if they are equal, a negative value if the
23997  * first comes before the second, and a positive value
23998  * if the second comes before the first.
23999  *
24000  * Since: 2.14
24001  */
24002
24003
24004 /**
24005  * g_sequence_sort_changed:
24006  * @iter: A #GSequenceIter
24007  * @cmp_func: the function used to compare items in the sequence
24008  * @cmp_data: user data passed to @cmp_func.
24009  *
24010  * Moves the data pointed to a new position as indicated by @cmp_func. This
24011  * function should be called for items in a sequence already sorted according
24012  * to @cmp_func whenever some aspect of an item changes so that @cmp_func
24013  * may return different values for that item.
24014  *
24015  * @cmp_func is called with two items of the @seq and @user_data.
24016  * It should return 0 if the items are equal, a negative value if
24017  * the first item comes before the second, and a positive value if
24018  * the second item comes before the first.
24019  *
24020  * Since: 2.14
24021  */
24022
24023
24024 /**
24025  * g_sequence_sort_changed_iter:
24026  * @iter: a #GSequenceIter
24027  * @iter_cmp: the function used to compare iterators in the sequence
24028  * @cmp_data: user data passed to @cmp_func
24029  *
24030  * Like g_sequence_sort_changed(), but uses
24031  * a #GSequenceIterCompareFunc instead of a #GCompareDataFunc as
24032  * the compare function.
24033  *
24034  * @iter_cmp is called with two iterators pointing into @seq. It should
24035  * return 0 if the iterators are equal, a negative value if the first
24036  * iterator comes before the second, and a positive value if the second
24037  * iterator comes before the first.
24038  *
24039  * Since: 2.14
24040  */
24041
24042
24043 /**
24044  * g_sequence_sort_iter:
24045  * @seq: a #GSequence
24046  * @cmp_func: the function used to compare iterators in the sequence
24047  * @cmp_data: user data passed to @cmp_func
24048  *
24049  * Like g_sequence_sort(), but uses a #GSequenceIterCompareFunc instead
24050  * of a GCompareDataFunc as the compare function
24051  *
24052  * @cmp_func is called with two iterators pointing into @seq. It should
24053  * return 0 if the iterators are equal, a negative value if the first
24054  * iterator comes before the second, and a positive value if the second
24055  * iterator comes before the first.
24056  *
24057  * Since: 2.14
24058  */
24059
24060
24061 /**
24062  * g_sequence_swap:
24063  * @a: a #GSequenceIter
24064  * @b: a #GSequenceIter
24065  *
24066  * Swaps the items pointed to by @a and @b. It is allowed for @a and @b
24067  * to point into difference sequences.
24068  *
24069  * Since: 2.14
24070  */
24071
24072
24073 /**
24074  * g_set_application_name:
24075  * @application_name: localized name of the application
24076  *
24077  * Sets a human-readable name for the application. This name should be
24078  * localized if possible, and is intended for display to the user.
24079  * Contrast with g_set_prgname(), which sets a non-localized name.
24080  * g_set_prgname() will be called automatically by gtk_init(),
24081  * but g_set_application_name() will not.
24082  *
24083  * Note that for thread safety reasons, this function can only
24084  * be called once.
24085  *
24086  * The application name will be used in contexts such as error messages,
24087  * or when displaying an application's name in the task list.
24088  *
24089  * Since: 2.2
24090  */
24091
24092
24093 /**
24094  * g_set_error:
24095  * @err: (allow-none): a return location for a #GError, or %NULL
24096  * @domain: error domain
24097  * @code: error code
24098  * @format: printf()-style format
24099  * @...: args for @format
24100  *
24101  * Does nothing if @err is %NULL; if @err is non-%NULL, then *@err
24102  * must be %NULL. A new #GError is created and assigned to *@err.
24103  */
24104
24105
24106 /**
24107  * g_set_error_literal:
24108  * @err: (allow-none): a return location for a #GError, or %NULL
24109  * @domain: error domain
24110  * @code: error code
24111  * @message: error message
24112  *
24113  * Does nothing if @err is %NULL; if @err is non-%NULL, then *@err
24114  * must be %NULL. A new #GError is created and assigned to *@err.
24115  * Unlike g_set_error(), @message is not a printf()-style format string.
24116  * Use this function if @message contains text you don't have control over,
24117  * that could include printf() escape sequences.
24118  *
24119  * Since: 2.18
24120  */
24121
24122
24123 /**
24124  * g_set_prgname:
24125  * @prgname: the name of the program.
24126  *
24127  * Sets the name of the program. This name should <emphasis>not</emphasis>
24128  * be localized, contrast with g_set_application_name(). Note that for
24129  * thread-safety reasons this function can only be called once.
24130  */
24131
24132
24133 /**
24134  * g_set_print_handler:
24135  * @func: the new print handler
24136  *
24137  * Sets the print handler.
24138  *
24139  * Any messages passed to g_print() will be output via
24140  * the new handler. The default handler simply outputs
24141  * the message to stdout. By providing your own handler
24142  * you can redirect the output, to a GTK+ widget or a
24143  * log file for example.
24144  *
24145  * Returns: the old print handler
24146  */
24147
24148
24149 /**
24150  * g_set_printerr_handler:
24151  * @func: the new error message handler
24152  *
24153  * Sets the handler for printing error messages.
24154  *
24155  * Any messages passed to g_printerr() will be output via
24156  * the new handler. The default handler simply outputs the
24157  * message to stderr. By providing your own handler you can
24158  * redirect the output, to a GTK+ widget or a log file for
24159  * example.
24160  *
24161  * Returns: the old error message handler
24162  */
24163
24164
24165 /**
24166  * g_setenv:
24167  * @variable: the environment variable to set, must not contain '='.
24168  * @value: the value for to set the variable to.
24169  * @overwrite: whether to change the variable if it already exists.
24170  *
24171  * Sets an environment variable. Both the variable's name and value
24172  * should be in the GLib file name encoding. On UNIX, this means that
24173  * they can be arbitrary byte strings. On Windows, they should be in
24174  * UTF-8.
24175  *
24176  * Note that on some systems, when variables are overwritten, the memory
24177  * used for the previous variables and its value isn't reclaimed.
24178  *
24179  * <warning><para>
24180  * Environment variable handling in UNIX is not thread-safe, and your
24181  * program may crash if one thread calls g_setenv() while another
24182  * thread is calling getenv(). (And note that many functions, such as
24183  * gettext(), call getenv() internally.) This function is only safe to
24184  * use at the very start of your program, before creating any other
24185  * threads (or creating objects that create worker threads of their
24186  * own).
24187  * </para><para>
24188  * If you need to set up the environment for a child process, you can
24189  * use g_get_environ() to get an environment array, modify that with
24190  * g_environ_setenv() and g_environ_unsetenv(), and then pass that
24191  * array directly to execvpe(), g_spawn_async(), or the like.
24192  * </para></warning>
24193  *
24194  * Returns: %FALSE if the environment variable couldn't be set.
24195  * Since: 2.4
24196  */
24197
24198
24199 /**
24200  * g_shell_parse_argv:
24201  * @command_line: command line to parse
24202  * @argcp: (out): return location for number of args
24203  * @argvp: (out) (array length=argcp zero-terminated=1): return location for array of args
24204  * @error: return location for error
24205  *
24206  * Parses a command line into an argument vector, in much the same way
24207  * the shell would, but without many of the expansions the shell would
24208  * perform (variable expansion, globs, operators, filename expansion,
24209  * etc. are not supported). The results are defined to be the same as
24210  * those you would get from a UNIX98 /bin/sh, as long as the input
24211  * contains none of the unsupported shell expansions. If the input
24212  * does contain such expansions, they are passed through
24213  * literally. Possible errors are those from the #G_SHELL_ERROR
24214  * domain. Free the returned vector with g_strfreev().
24215  *
24216  * Returns: %TRUE on success, %FALSE if error set
24217  */
24218
24219
24220 /**
24221  * g_shell_quote:
24222  * @unquoted_string: a literal string
24223  *
24224  * Quotes a string so that the shell (/bin/sh) will interpret the
24225  * quoted string to mean @unquoted_string. If you pass a filename to
24226  * the shell, for example, you should first quote it with this
24227  * function.  The return value must be freed with g_free(). The
24228  * quoting style used is undefined (single or double quotes may be
24229  * used).
24230  *
24231  * Returns: quoted string
24232  */
24233
24234
24235 /**
24236  * g_shell_unquote:
24237  * @quoted_string: shell-quoted string
24238  * @error: error return location or NULL
24239  *
24240  * Unquotes a string as the shell (/bin/sh) would. Only handles
24241  * quotes; if a string contains file globs, arithmetic operators,
24242  * variables, backticks, redirections, or other special-to-the-shell
24243  * features, the result will be different from the result a real shell
24244  * would produce (the variables, backticks, etc. will be passed
24245  * through literally instead of being expanded). This function is
24246  * guaranteed to succeed if applied to the result of
24247  * g_shell_quote(). If it fails, it returns %NULL and sets the
24248  * error. The @quoted_string need not actually contain quoted or
24249  * escaped text; g_shell_unquote() simply goes through the string and
24250  * unquotes/unescapes anything that the shell would. Both single and
24251  * double quotes are handled, as are escapes including escaped
24252  * newlines. The return value must be freed with g_free(). Possible
24253  * errors are in the #G_SHELL_ERROR domain.
24254  *
24255  * Shell quoting rules are a bit strange. Single quotes preserve the
24256  * literal string exactly. escape sequences are not allowed; not even
24257  * \' - if you want a ' in the quoted text, you have to do something
24258  * like 'foo'\''bar'.  Double quotes allow $, `, ", \, and newline to
24259  * be escaped with backslash. Otherwise double quotes preserve things
24260  * literally.
24261  *
24262  * Returns: an unquoted string
24263  */
24264
24265
24266 /**
24267  * g_slice_alloc:
24268  * @block_size: the number of bytes to allocate
24269  *
24270  * Allocates a block of memory from the slice allocator.
24271  * The block adress handed out can be expected to be aligned
24272  * to at least <literal>1 * sizeof (void*)</literal>,
24273  * though in general slices are 2 * sizeof (void*) bytes aligned,
24274  * if a malloc() fallback implementation is used instead,
24275  * the alignment may be reduced in a libc dependent fashion.
24276  * Note that the underlying slice allocation mechanism can
24277  * be changed with the <link linkend="G_SLICE">G_SLICE=always-malloc</link>
24278  * environment variable.
24279  *
24280  * Returns: a pointer to the allocated memory block
24281  * Since: 2.10
24282  */
24283
24284
24285 /**
24286  * g_slice_alloc0:
24287  * @block_size: the number of bytes to allocate
24288  *
24289  * Allocates a block of memory via g_slice_alloc() and initializes
24290  * the returned memory to 0. Note that the underlying slice allocation
24291  * mechanism can be changed with the
24292  * <link linkend="G_SLICE">G_SLICE=always-malloc</link>
24293  * environment variable.
24294  *
24295  * Returns: a pointer to the allocated block
24296  * Since: 2.10
24297  */
24298
24299
24300 /**
24301  * g_slice_copy:
24302  * @block_size: the number of bytes to allocate
24303  * @mem_block: the memory to copy
24304  *
24305  * Allocates a block of memory from the slice allocator
24306  * and copies @block_size bytes into it from @mem_block.
24307  *
24308  * Returns: a pointer to the allocated memory block
24309  * Since: 2.14
24310  */
24311
24312
24313 /**
24314  * g_slice_dup:
24315  * @type: the type to duplicate, typically a structure name
24316  * @mem: the memory to copy into the allocated block
24317  *
24318  * A convenience macro to duplicate a block of memory using
24319  * the slice allocator.
24320  *
24321  * It calls g_slice_copy() with <literal>sizeof (@type)</literal>
24322  * and casts the returned pointer to a pointer of the given type,
24323  * avoiding a type cast in the source code.
24324  * Note that the underlying slice allocation mechanism can
24325  * be changed with the <link linkend="G_SLICE">G_SLICE=always-malloc</link>
24326  * environment variable.
24327  *
24328  * Returns: a pointer to the allocated block, cast to a pointer to @type
24329  * Since: 2.14
24330  */
24331
24332
24333 /**
24334  * g_slice_free:
24335  * @type: the type of the block to free, typically a structure name
24336  * @mem: a pointer to the block to free
24337  *
24338  * A convenience macro to free a block of memory that has
24339  * been allocated from the slice allocator.
24340  *
24341  * It calls g_slice_free1() using <literal>sizeof (type)</literal>
24342  * as the block size.
24343  * Note that the exact release behaviour can be changed with the
24344  * <link linkend="G_DEBUG">G_DEBUG=gc-friendly</link> environment
24345  * variable, also see <link linkend="G_SLICE">G_SLICE</link> for
24346  * related debugging options.
24347  *
24348  * Since: 2.10
24349  */
24350
24351
24352 /**
24353  * g_slice_free1:
24354  * @block_size: the size of the block
24355  * @mem_block: a pointer to the block to free
24356  *
24357  * Frees a block of memory.
24358  *
24359  * The memory must have been allocated via g_slice_alloc() or
24360  * g_slice_alloc0() and the @block_size has to match the size
24361  * specified upon allocation. Note that the exact release behaviour
24362  * can be changed with the
24363  * <link linkend="G_DEBUG">G_DEBUG=gc-friendly</link> environment
24364  * variable, also see <link linkend="G_SLICE">G_SLICE</link> for
24365  * related debugging options.
24366  *
24367  * Since: 2.10
24368  */
24369
24370
24371 /**
24372  * g_slice_free_chain:
24373  * @type: the type of the @mem_chain blocks
24374  * @mem_chain: a pointer to the first block of the chain
24375  * @next: the field name of the next pointer in @type
24376  *
24377  * Frees a linked list of memory blocks of structure type @type.
24378  * The memory blocks must be equal-sized, allocated via
24379  * g_slice_alloc() or g_slice_alloc0() and linked together by
24380  * a @next pointer (similar to #GSList). The name of the
24381  * @next field in @type is passed as third argument.
24382  * Note that the exact release behaviour can be changed with the
24383  * <link linkend="G_DEBUG">G_DEBUG=gc-friendly</link> environment
24384  * variable, also see <link linkend="G_SLICE">G_SLICE</link> for
24385  * related debugging options.
24386  *
24387  * Since: 2.10
24388  */
24389
24390
24391 /**
24392  * g_slice_free_chain_with_offset:
24393  * @block_size: the size of the blocks
24394  * @mem_chain: a pointer to the first block of the chain
24395  * @next_offset: the offset of the @next field in the blocks
24396  *
24397  * Frees a linked list of memory blocks of structure type @type.
24398  *
24399  * The memory blocks must be equal-sized, allocated via
24400  * g_slice_alloc() or g_slice_alloc0() and linked together by a
24401  * @next pointer (similar to #GSList). The offset of the @next
24402  * field in each block is passed as third argument.
24403  * Note that the exact release behaviour can be changed with the
24404  * <link linkend="G_DEBUG">G_DEBUG=gc-friendly</link> environment
24405  * variable, also see <link linkend="G_SLICE">G_SLICE</link> for
24406  * related debugging options.
24407  *
24408  * Since: 2.10
24409  */
24410
24411
24412 /**
24413  * g_slice_new:
24414  * @type: the type to allocate, typically a structure name
24415  *
24416  * A convenience macro to allocate a block of memory from the
24417  * slice allocator.
24418  *
24419  * It calls g_slice_alloc() with <literal>sizeof (@type)</literal>
24420  * and casts the returned pointer to a pointer of the given type,
24421  * avoiding a type cast in the source code.
24422  * Note that the underlying slice allocation mechanism can
24423  * be changed with the <link linkend="G_SLICE">G_SLICE=always-malloc</link>
24424  * environment variable.
24425  *
24426  * Returns: a pointer to the allocated block, cast to a pointer to @type
24427  * Since: 2.10
24428  */
24429
24430
24431 /**
24432  * g_slice_new0:
24433  * @type: the type to allocate, typically a structure name
24434  *
24435  * A convenience macro to allocate a block of memory from the
24436  * slice allocator and set the memory to 0.
24437  *
24438  * It calls g_slice_alloc0() with <literal>sizeof (@type)</literal>
24439  * and casts the returned pointer to a pointer of the given type,
24440  * avoiding a type cast in the source code.
24441  * Note that the underlying slice allocation mechanism can
24442  * be changed with the <link linkend="G_SLICE">G_SLICE=always-malloc</link>
24443  * environment variable.
24444  *
24445  * Since: 2.10
24446  */
24447
24448
24449 /**
24450  * g_slist_alloc:
24451  *
24452  * Allocates space for one #GSList element. It is called by the
24453  * g_slist_append(), g_slist_prepend(), g_slist_insert() and
24454  * g_slist_insert_sorted() functions and so is rarely used on its own.
24455  *
24456  * Returns: a pointer to the newly-allocated #GSList element.
24457  */
24458
24459
24460 /**
24461  * g_slist_append:
24462  * @list: a #GSList
24463  * @data: the data for the new element
24464  *
24465  * Adds a new element on to the end of the list.
24466  *
24467  * <note><para>
24468  * The return value is the new start of the list, which may
24469  * have changed, so make sure you store the new value.
24470  * </para></note>
24471  *
24472  * <note><para>
24473  * Note that g_slist_append() has to traverse the entire list
24474  * to find the end, which is inefficient when adding multiple
24475  * elements. A common idiom to avoid the inefficiency is to prepend
24476  * the elements and reverse the list when all elements have been added.
24477  * </para></note>
24478  *
24479  * |[
24480  * /&ast; Notice that these are initialized to the empty list. &ast;/
24481  * GSList *list = NULL, *number_list = NULL;
24482  *
24483  * /&ast; This is a list of strings. &ast;/
24484  * list = g_slist_append (list, "first");
24485  * list = g_slist_append (list, "second");
24486  *
24487  * /&ast; This is a list of integers. &ast;/
24488  * number_list = g_slist_append (number_list, GINT_TO_POINTER (27));
24489  * number_list = g_slist_append (number_list, GINT_TO_POINTER (14));
24490  * ]|
24491  *
24492  * Returns: the new start of the #GSList
24493  */
24494
24495
24496 /**
24497  * g_slist_concat:
24498  * @list1: a #GSList
24499  * @list2: the #GSList to add to the end of the first #GSList
24500  *
24501  * Adds the second #GSList onto the end of the first #GSList.
24502  * Note that the elements of the second #GSList are not copied.
24503  * They are used directly.
24504  *
24505  * Returns: the start of the new #GSList
24506  */
24507
24508
24509 /**
24510  * g_slist_copy:
24511  * @list: a #GSList
24512  *
24513  * Copies a #GSList.
24514  *
24515  * <note><para>
24516  * Note that this is a "shallow" copy. If the list elements
24517  * consist of pointers to data, the pointers are copied but
24518  * the actual data isn't. See g_slist_copy_deep() if you need
24519  * to copy the data as well.
24520  * </para></note>
24521  *
24522  * Returns: a copy of @list
24523  */
24524
24525
24526 /**
24527  * g_slist_copy_deep:
24528  * @list: a #GSList
24529  * @func: a copy function used to copy every element in the list
24530  * @user_data: user data passed to the copy function @func, or #NULL
24531  *
24532  * Makes a full (deep) copy of a #GSList.
24533  *
24534  * In contrast with g_slist_copy(), this function uses @func to make a copy of
24535  * each list element, in addition to copying the list container itself.
24536  *
24537  * @func, as a #GCopyFunc, takes two arguments, the data to be copied and a user
24538  * pointer. It's safe to pass #NULL as user_data, if the copy function takes only
24539  * one argument.
24540  *
24541  * For instance, if @list holds a list of GObjects, you can do:
24542  * |[
24543  * another_list = g_slist_copy_deep (list, (GCopyFunc) g_object_ref, NULL);
24544  * ]|
24545  *
24546  * And, to entirely free the new list, you could do:
24547  * |[
24548  * g_slist_free_full (another_list, g_object_unref);
24549  * ]|
24550  *
24551  * Returns: a full copy of @list, use #g_slist_free_full to free it
24552  * Since: 2.34
24553  */
24554
24555
24556 /**
24557  * g_slist_delete_link:
24558  * @list: a #GSList
24559  * @link_: node to delete
24560  *
24561  * Removes the node link_ from the list and frees it.
24562  * Compare this to g_slist_remove_link() which removes the node
24563  * without freeing it.
24564  *
24565  * <note>Removing arbitrary nodes from a singly-linked list
24566  * requires time that is proportional to the length of the list
24567  * (ie. O(n)). If you find yourself using g_slist_delete_link()
24568  * frequently, you should consider a different data structure, such
24569  * as the doubly-linked #GList.</note>
24570  *
24571  * Returns: the new head of @list
24572  */
24573
24574
24575 /**
24576  * g_slist_find:
24577  * @list: a #GSList
24578  * @data: the element data to find
24579  *
24580  * Finds the element in a #GSList which
24581  * contains the given data.
24582  *
24583  * Returns: the found #GSList element, or %NULL if it is not found
24584  */
24585
24586
24587 /**
24588  * g_slist_find_custom:
24589  * @list: a #GSList
24590  * @data: user data passed to the function
24591  * @func: the function to call for each element. It should return 0 when the desired element is found
24592  *
24593  * Finds an element in a #GSList, using a supplied function to
24594  * find the desired element. It iterates over the list, calling
24595  * the given function which should return 0 when the desired
24596  * element is found. The function takes two #gconstpointer arguments,
24597  * the #GSList element's data as the first argument and the
24598  * given user data.
24599  *
24600  * Returns: the found #GSList element, or %NULL if it is not found
24601  */
24602
24603
24604 /**
24605  * g_slist_foreach:
24606  * @list: a #GSList
24607  * @func: the function to call with each element's data
24608  * @user_data: user data to pass to the function
24609  *
24610  * Calls a function for each element of a #GSList.
24611  */
24612
24613
24614 /**
24615  * g_slist_free:
24616  * @list: a #GSList
24617  *
24618  * Frees all of the memory used by a #GSList.
24619  * The freed elements are returned to the slice allocator.
24620  *
24621  * <note><para>
24622  * If list elements contain dynamically-allocated memory,
24623  * you should either use g_slist_free_full() or free them manually
24624  * first.
24625  * </para></note>
24626  */
24627
24628
24629 /**
24630  * g_slist_free1:
24631  *
24632  * A macro which does the same as g_slist_free_1().
24633  *
24634  * Since: 2.10
24635  */
24636
24637
24638 /**
24639  * g_slist_free_1:
24640  * @list: a #GSList element
24641  *
24642  * Frees one #GSList element.
24643  * It is usually used after g_slist_remove_link().
24644  */
24645
24646
24647 /**
24648  * g_slist_free_full:
24649  * @list: a pointer to a #GSList
24650  * @free_func: the function to be called to free each element's data
24651  *
24652  * Convenience method, which frees all the memory used by a #GSList, and
24653  * calls the specified destroy function on every element's data.
24654  *
24655  * Since: 2.28
24656  */
24657
24658
24659 /**
24660  * g_slist_index:
24661  * @list: a #GSList
24662  * @data: the data to find
24663  *
24664  * Gets the position of the element containing
24665  * the given data (starting from 0).
24666  *
24667  * Returns: the index of the element containing the data, or -1 if the data is not found
24668  */
24669
24670
24671 /**
24672  * g_slist_insert:
24673  * @list: a #GSList
24674  * @data: the data for the new element
24675  * @position: the position to insert the element. If this is negative, or is larger than the number of elements in the list, the new element is added on to the end of the list.
24676  *
24677  * Inserts a new element into the list at the given position.
24678  *
24679  * Returns: the new start of the #GSList
24680  */
24681
24682
24683 /**
24684  * g_slist_insert_before:
24685  * @slist: a #GSList
24686  * @sibling: node to insert @data before
24687  * @data: data to put in the newly-inserted node
24688  *
24689  * Inserts a node before @sibling containing @data.
24690  *
24691  * Returns: the new head of the list.
24692  */
24693
24694
24695 /**
24696  * g_slist_insert_sorted:
24697  * @list: a #GSList
24698  * @data: the data for the new element
24699  * @func: the function to compare elements in the list. It should return a number > 0 if the first parameter comes after the second parameter in the sort order.
24700  *
24701  * Inserts a new element into the list, using the given
24702  * comparison function to determine its position.
24703  *
24704  * Returns: the new start of the #GSList
24705  */
24706
24707
24708 /**
24709  * g_slist_insert_sorted_with_data:
24710  * @list: a #GSList
24711  * @data: the data for the new element
24712  * @func: the function to compare elements in the list. It should return a number > 0 if the first parameter comes after the second parameter in the sort order.
24713  * @user_data: data to pass to comparison function
24714  *
24715  * Inserts a new element into the list, using the given
24716  * comparison function to determine its position.
24717  *
24718  * Returns: the new start of the #GSList
24719  * Since: 2.10
24720  */
24721
24722
24723 /**
24724  * g_slist_last:
24725  * @list: a #GSList
24726  *
24727  * Gets the last element in a #GSList.
24728  *
24729  * <note><para>
24730  * This function iterates over the whole list.
24731  * </para></note>
24732  *
24733  * Returns: the last element in the #GSList, or %NULL if the #GSList has no elements
24734  */
24735
24736
24737 /**
24738  * g_slist_length:
24739  * @list: a #GSList
24740  *
24741  * Gets the number of elements in a #GSList.
24742  *
24743  * <note><para>
24744  * This function iterates over the whole list to
24745  * count its elements.
24746  * </para></note>
24747  *
24748  * Returns: the number of elements in the #GSList
24749  */
24750
24751
24752 /**
24753  * g_slist_next:
24754  * @slist: an element in a #GSList.
24755  *
24756  * A convenience macro to get the next element in a #GSList.
24757  *
24758  * Returns: the next element, or %NULL if there are no more elements.
24759  */
24760
24761
24762 /**
24763  * g_slist_nth:
24764  * @list: a #GSList
24765  * @n: the position of the element, counting from 0
24766  *
24767  * Gets the element at the given position in a #GSList.
24768  *
24769  * Returns: the element, or %NULL if the position is off the end of the #GSList
24770  */
24771
24772
24773 /**
24774  * g_slist_nth_data:
24775  * @list: a #GSList
24776  * @n: the position of the element
24777  *
24778  * Gets the data of the element at the given position.
24779  *
24780  * Returns: the element's data, or %NULL if the position is off the end of the #GSList
24781  */
24782
24783
24784 /**
24785  * g_slist_position:
24786  * @list: a #GSList
24787  * @llink: an element in the #GSList
24788  *
24789  * Gets the position of the given element
24790  * in the #GSList (starting from 0).
24791  *
24792  * Returns: the position of the element in the #GSList, or -1 if the element is not found
24793  */
24794
24795
24796 /**
24797  * g_slist_prepend:
24798  * @list: a #GSList
24799  * @data: the data for the new element
24800  *
24801  * Adds a new element on to the start of the list.
24802  *
24803  * <note><para>
24804  * The return value is the new start of the list, which
24805  * may have changed, so make sure you store the new value.
24806  * </para></note>
24807  *
24808  * |[
24809  * /&ast; Notice that it is initialized to the empty list. &ast;/
24810  * GSList *list = NULL;
24811  * list = g_slist_prepend (list, "last");
24812  * list = g_slist_prepend (list, "first");
24813  * ]|
24814  *
24815  * Returns: the new start of the #GSList
24816  */
24817
24818
24819 /**
24820  * g_slist_remove:
24821  * @list: a #GSList
24822  * @data: the data of the element to remove
24823  *
24824  * Removes an element from a #GSList.
24825  * If two elements contain the same data, only the first is removed.
24826  * If none of the elements contain the data, the #GSList is unchanged.
24827  *
24828  * Returns: the new start of the #GSList
24829  */
24830
24831
24832 /**
24833  * g_slist_remove_all:
24834  * @list: a #GSList
24835  * @data: data to remove
24836  *
24837  * Removes all list nodes with data equal to @data.
24838  * Returns the new head of the list. Contrast with
24839  * g_slist_remove() which removes only the first node
24840  * matching the given data.
24841  *
24842  * Returns: new head of @list
24843  */
24844
24845
24846 /**
24847  * g_slist_remove_link:
24848  * @list: a #GSList
24849  * @link_: an element in the #GSList
24850  *
24851  * Removes an element from a #GSList, without
24852  * freeing the element. The removed element's next
24853  * link is set to %NULL, so that it becomes a
24854  * self-contained list with one element.
24855  *
24856  * <note>Removing arbitrary nodes from a singly-linked list
24857  * requires time that is proportional to the length of the list
24858  * (ie. O(n)). If you find yourself using g_slist_remove_link()
24859  * frequently, you should consider a different data structure, such
24860  * as the doubly-linked #GList.</note>
24861  *
24862  * Returns: the new start of the #GSList, without the element
24863  */
24864
24865
24866 /**
24867  * g_slist_reverse:
24868  * @list: a #GSList
24869  *
24870  * Reverses a #GSList.
24871  *
24872  * Returns: the start of the reversed #GSList
24873  */
24874
24875
24876 /**
24877  * g_slist_sort:
24878  * @list: a #GSList
24879  * @compare_func: the comparison function used to sort the #GSList. This function is passed the data from 2 elements of the #GSList and should return 0 if they are equal, a negative value if the first element comes before the second, or a positive value if the first element comes after the second.
24880  *
24881  * Sorts a #GSList using the given comparison function.
24882  *
24883  * Returns: the start of the sorted #GSList
24884  */
24885
24886
24887 /**
24888  * g_slist_sort_with_data:
24889  * @list: a #GSList
24890  * @compare_func: comparison function
24891  * @user_data: data to pass to comparison function
24892  *
24893  * Like g_slist_sort(), but the sort function accepts a user data argument.
24894  *
24895  * Returns: new head of the list
24896  */
24897
24898
24899 /**
24900  * g_snprintf:
24901  * @string: the buffer to hold the output.
24902  * @n: the maximum number of bytes to produce (including the terminating nul character).
24903  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
24904  * @...: the arguments to insert in the output.
24905  *
24906  * A safer form of the standard sprintf() function. The output is guaranteed
24907  * to not exceed @n characters (including the terminating nul character), so
24908  * it is easy to ensure that a buffer overflow cannot occur.
24909  *
24910  * See also g_strdup_printf().
24911  *
24912  * In versions of GLib prior to 1.2.3, this function may return -1 if the
24913  * output was truncated, and the truncated string may not be nul-terminated.
24914  * In versions prior to 1.3.12, this function returns the length of the output
24915  * string.
24916  *
24917  * The return value of g_snprintf() conforms to the snprintf()
24918  * function as standardized in ISO C99. Note that this is different from
24919  * traditional snprintf(), which returns the length of the output string.
24920  *
24921  * The format string may contain positional parameters, as specified in
24922  * the Single Unix Specification.
24923  *
24924  * Returns: the number of bytes which would be produced if the buffer was large enough.
24925  */
24926
24927
24928 /**
24929  * g_source_add_child_source:
24930  * @source: a #GSource
24931  * @child_source: a second #GSource that @source should "poll"
24932  *
24933  * Adds @child_source to @source as a "polled" source; when @source is
24934  * added to a #GMainContext, @child_source will be automatically added
24935  * with the same priority, when @child_source is triggered, it will
24936  * cause @source to dispatch (in addition to calling its own
24937  * callback), and when @source is destroyed, it will destroy
24938  * @child_source as well. (@source will also still be dispatched if
24939  * its own prepare/check functions indicate that it is ready.)
24940  *
24941  * If you don't need @child_source to do anything on its own when it
24942  * triggers, you can call g_source_set_dummy_callback() on it to set a
24943  * callback that does nothing (except return %TRUE if appropriate).
24944  *
24945  * @source will hold a reference on @child_source while @child_source
24946  * is attached to it.
24947  *
24948  * Since: 2.28
24949  */
24950
24951
24952 /**
24953  * g_source_add_poll:
24954  * @source: a #GSource
24955  * @fd: a #GPollFD structure holding information about a file descriptor to watch.
24956  *
24957  * Adds a file descriptor to the set of file descriptors polled for
24958  * this source. This is usually combined with g_source_new() to add an
24959  * event source. The event source's check function will typically test
24960  * the @revents field in the #GPollFD struct and return %TRUE if events need
24961  * to be processed.
24962  */
24963
24964
24965 /**
24966  * g_source_attach:
24967  * @source: a #GSource
24968  * @context: (allow-none): a #GMainContext (if %NULL, the default context will be used)
24969  *
24970  * Adds a #GSource to a @context so that it will be executed within
24971  * that context. Remove it by calling g_source_destroy().
24972  *
24973  * Returns: the ID (greater than 0) for the source within the #GMainContext.
24974  */
24975
24976
24977 /**
24978  * g_source_destroy:
24979  * @source: a #GSource
24980  *
24981  * Removes a source from its #GMainContext, if any, and mark it as
24982  * destroyed.  The source cannot be subsequently added to another
24983  * context.
24984  */
24985
24986
24987 /**
24988  * g_source_get_can_recurse:
24989  * @source: a #GSource
24990  *
24991  * Checks whether a source is allowed to be called recursively.
24992  * see g_source_set_can_recurse().
24993  *
24994  * Returns: whether recursion is allowed.
24995  */
24996
24997
24998 /**
24999  * g_source_get_context:
25000  * @source: a #GSource
25001  *
25002  * Gets the #GMainContext with which the source is associated.
25003  *
25004  * You can call this on a source that has been destroyed, provided
25005  * that the #GMainContext it was attached to still exists (in which
25006  * case it will return that #GMainContext). In particular, you can
25007  * always call this function on the source returned from
25008  * g_main_current_source(). But calling this function on a source
25009  * whose #GMainContext has been destroyed is an error.
25010  *
25011  * Returns: (transfer none) (allow-none): the #GMainContext with which the source is associated, or %NULL if the context has not yet been added to a source.
25012  */
25013
25014
25015 /**
25016  * g_source_get_current_time:
25017  * @source: a #GSource
25018  * @timeval: #GTimeVal structure in which to store current time.
25019  *
25020  * This function ignores @source and is otherwise the same as
25021  * g_get_current_time().
25022  *
25023  * Deprecated: 2.28: use g_source_get_time() instead
25024  */
25025
25026
25027 /**
25028  * g_source_get_id:
25029  * @source: a #GSource
25030  *
25031  * Returns the numeric ID for a particular source. The ID of a source
25032  * is a positive integer which is unique within a particular main loop
25033  * context. The reverse
25034  * mapping from ID to source is done by g_main_context_find_source_by_id().
25035  *
25036  * Returns: the ID (greater than 0) for the source
25037  */
25038
25039
25040 /**
25041  * g_source_get_name:
25042  * @source: a #GSource
25043  *
25044  * Gets a name for the source, used in debugging and profiling.
25045  * The name may be #NULL if it has never been set with
25046  * g_source_set_name().
25047  *
25048  * Returns: the name of the source
25049  * Since: 2.26
25050  */
25051
25052
25053 /**
25054  * g_source_get_priority:
25055  * @source: a #GSource
25056  *
25057  * Gets the priority of a source.
25058  *
25059  * Returns: the priority of the source
25060  */
25061
25062
25063 /**
25064  * g_source_get_time:
25065  * @source: a #GSource
25066  *
25067  * Gets the time to be used when checking this source. The advantage of
25068  * calling this function over calling g_get_monotonic_time() directly is
25069  * that when checking multiple sources, GLib can cache a single value
25070  * instead of having to repeatedly get the system monotonic time.
25071  *
25072  * The time here is the system monotonic time, if available, or some
25073  * other reasonable alternative otherwise.  See g_get_monotonic_time().
25074  *
25075  * Returns: the monotonic time in microseconds
25076  * Since: 2.28
25077  */
25078
25079
25080 /**
25081  * g_source_is_destroyed:
25082  * @source: a #GSource
25083  *
25084  * Returns whether @source has been destroyed.
25085  *
25086  * This is important when you operate upon your objects
25087  * from within idle handlers, but may have freed the object
25088  * before the dispatch of your idle handler.
25089  *
25090  * |[
25091  * static gboolean
25092  * idle_callback (gpointer data)
25093  * {
25094  *   SomeWidget *self = data;
25095  *
25096  *   GDK_THREADS_ENTER (<!-- -->);
25097  *   /<!-- -->* do stuff with self *<!-- -->/
25098  *   self->idle_id = 0;
25099  *   GDK_THREADS_LEAVE (<!-- -->);
25100  *
25101  *   return G_SOURCE_REMOVE;
25102  * }
25103  *
25104  * static void
25105  * some_widget_do_stuff_later (SomeWidget *self)
25106  * {
25107  *   self->idle_id = g_idle_add (idle_callback, self);
25108  * }
25109  *
25110  * static void
25111  * some_widget_finalize (GObject *object)
25112  * {
25113  *   SomeWidget *self = SOME_WIDGET (object);
25114  *
25115  *   if (self->idle_id)
25116  *     g_source_remove (self->idle_id);
25117  *
25118  *   G_OBJECT_CLASS (parent_class)->finalize (object);
25119  * }
25120  * ]|
25121  *
25122  * This will fail in a multi-threaded application if the
25123  * widget is destroyed before the idle handler fires due
25124  * to the use after free in the callback. A solution, to
25125  * this particular problem, is to check to if the source
25126  * has already been destroy within the callback.
25127  *
25128  * |[
25129  * static gboolean
25130  * idle_callback (gpointer data)
25131  * {
25132  *   SomeWidget *self = data;
25133  *
25134  *   GDK_THREADS_ENTER ();
25135  *   if (!g_source_is_destroyed (g_main_current_source ()))
25136  *     {
25137  *       /<!-- -->* do stuff with self *<!-- -->/
25138  *     }
25139  *   GDK_THREADS_LEAVE ();
25140  *
25141  *   return FALSE;
25142  * }
25143  * ]|
25144  *
25145  * Returns: %TRUE if the source has been destroyed
25146  * Since: 2.12
25147  */
25148
25149
25150 /**
25151  * g_source_new:
25152  * @source_funcs: structure containing functions that implement the sources behavior.
25153  * @struct_size: size of the #GSource structure to create.
25154  *
25155  * Creates a new #GSource structure. The size is specified to
25156  * allow creating structures derived from #GSource that contain
25157  * additional data. The size passed in must be at least
25158  * <literal>sizeof (GSource)</literal>.
25159  *
25160  * The source will not initially be associated with any #GMainContext
25161  * and must be added to one with g_source_attach() before it will be
25162  * executed.
25163  *
25164  * Returns: the newly-created #GSource.
25165  */
25166
25167
25168 /**
25169  * g_source_ref:
25170  * @source: a #GSource
25171  *
25172  * Increases the reference count on a source by one.
25173  *
25174  * Returns: @source
25175  */
25176
25177
25178 /**
25179  * g_source_remove:
25180  * @tag: the ID of the source to remove.
25181  *
25182  * Removes the source with the given id from the default main context.
25183  * The id of
25184  * a #GSource is given by g_source_get_id(), or will be returned by the
25185  * functions g_source_attach(), g_idle_add(), g_idle_add_full(),
25186  * g_timeout_add(), g_timeout_add_full(), g_child_watch_add(),
25187  * g_child_watch_add_full(), g_io_add_watch(), and g_io_add_watch_full().
25188  *
25189  * See also g_source_destroy(). You must use g_source_destroy() for sources
25190  * added to a non-default main context.
25191  *
25192  * Returns: %TRUE if the source was found and removed.
25193  */
25194
25195
25196 /**
25197  * g_source_remove_by_funcs_user_data:
25198  * @funcs: The @source_funcs passed to g_source_new()
25199  * @user_data: the user data for the callback
25200  *
25201  * Removes a source from the default main loop context given the
25202  * source functions and user data. If multiple sources exist with the
25203  * same source functions and user data, only one will be destroyed.
25204  *
25205  * Returns: %TRUE if a source was found and removed.
25206  */
25207
25208
25209 /**
25210  * g_source_remove_by_user_data:
25211  * @user_data: the user_data for the callback.
25212  *
25213  * Removes a source from the default main loop context given the user
25214  * data for the callback. If multiple sources exist with the same user
25215  * data, only one will be destroyed.
25216  *
25217  * Returns: %TRUE if a source was found and removed.
25218  */
25219
25220
25221 /**
25222  * g_source_remove_child_source:
25223  * @source: a #GSource
25224  * @child_source: a #GSource previously passed to g_source_add_child_source().
25225  *
25226  * Detaches @child_source from @source and destroys it.
25227  *
25228  * Since: 2.28
25229  */
25230
25231
25232 /**
25233  * g_source_remove_poll:
25234  * @source: a #GSource
25235  * @fd: a #GPollFD structure previously passed to g_source_add_poll().
25236  *
25237  * Removes a file descriptor from the set of file descriptors polled for
25238  * this source.
25239  */
25240
25241
25242 /**
25243  * g_source_set_callback:
25244  * @source: the source
25245  * @func: a callback function
25246  * @data: the data to pass to callback function
25247  * @notify: (allow-none): a function to call when @data is no longer in use, or %NULL.
25248  *
25249  * Sets the callback function for a source. The callback for a source is
25250  * called from the source's dispatch function.
25251  *
25252  * The exact type of @func depends on the type of source; ie. you
25253  * should not count on @func being called with @data as its first
25254  * parameter.
25255  *
25256  * Typically, you won't use this function. Instead use functions specific
25257  * to the type of source you are using.
25258  */
25259
25260
25261 /**
25262  * g_source_set_callback_indirect:
25263  * @source: the source
25264  * @callback_data: pointer to callback data "object"
25265  * @callback_funcs: functions for reference counting @callback_data and getting the callback and data
25266  *
25267  * Sets the callback function storing the data as a refcounted callback
25268  * "object". This is used internally. Note that calling
25269  * g_source_set_callback_indirect() assumes
25270  * an initial reference count on @callback_data, and thus
25271  * @callback_funcs->unref will eventually be called once more
25272  * than @callback_funcs->ref.
25273  */
25274
25275
25276 /**
25277  * g_source_set_can_recurse:
25278  * @source: a #GSource
25279  * @can_recurse: whether recursion is allowed for this source
25280  *
25281  * Sets whether a source can be called recursively. If @can_recurse is
25282  * %TRUE, then while the source is being dispatched then this source
25283  * will be processed normally. Otherwise, all processing of this
25284  * source is blocked until the dispatch function returns.
25285  */
25286
25287
25288 /**
25289  * g_source_set_funcs:
25290  * @source: a #GSource
25291  * @funcs: the new #GSourceFuncs
25292  *
25293  * Sets the source functions (can be used to override
25294  * default implementations) of an unattached source.
25295  *
25296  * Since: 2.12
25297  */
25298
25299
25300 /**
25301  * g_source_set_name:
25302  * @source: a #GSource
25303  * @name: debug name for the source
25304  *
25305  * Sets a name for the source, used in debugging and profiling.
25306  * The name defaults to #NULL.
25307  *
25308  * The source name should describe in a human-readable way
25309  * what the source does. For example, "X11 event queue"
25310  * or "GTK+ repaint idle handler" or whatever it is.
25311  *
25312  * It is permitted to call this function multiple times, but is not
25313  * recommended due to the potential performance impact.  For example,
25314  * one could change the name in the "check" function of a #GSourceFuncs
25315  * to include details like the event type in the source name.
25316  *
25317  * Since: 2.26
25318  */
25319
25320
25321 /**
25322  * g_source_set_name_by_id:
25323  * @tag: a #GSource ID
25324  * @name: debug name for the source
25325  *
25326  * Sets the name of a source using its ID.
25327  *
25328  * This is a convenience utility to set source names from the return
25329  * value of g_idle_add(), g_timeout_add(), etc.
25330  *
25331  * Since: 2.26
25332  */
25333
25334
25335 /**
25336  * g_source_set_priority:
25337  * @source: a #GSource
25338  * @priority: the new priority.
25339  *
25340  * Sets the priority of a source. While the main loop is being run, a
25341  * source will be dispatched if it is ready to be dispatched and no
25342  * sources at a higher (numerically smaller) priority are ready to be
25343  * dispatched.
25344  */
25345
25346
25347 /**
25348  * g_source_unref:
25349  * @source: a #GSource
25350  *
25351  * Decreases the reference count of a source by one. If the
25352  * resulting reference count is zero the source and associated
25353  * memory will be destroyed.
25354  */
25355
25356
25357 /**
25358  * g_spaced_primes_closest:
25359  * @num: a #guint
25360  *
25361  * Gets the smallest prime number from a built-in array of primes which
25362  * is larger than @num. This is used within GLib to calculate the optimum
25363  * size of a #GHashTable.
25364  *
25365  * The built-in array of primes ranges from 11 to 13845163 such that
25366  * each prime is approximately 1.5-2 times the previous prime.
25367  *
25368  * Returns: the smallest prime number from a built-in array of primes which is larger than @num
25369  */
25370
25371
25372 /**
25373  * g_spawn_async:
25374  * @working_directory: (allow-none): child's current working directory, or %NULL to inherit parent's
25375  * @argv: (array zero-terminated=1): child's argument vector
25376  * @envp: (array zero-terminated=1) (allow-none): child's environment, or %NULL to inherit parent's
25377  * @flags: flags from #GSpawnFlags
25378  * @child_setup: (scope async) (allow-none): function to run in the child just before exec()
25379  * @user_data: (closure): user data for @child_setup
25380  * @child_pid: (out) (allow-none): return location for child process reference, or %NULL
25381  * @error: return location for error
25382  *
25383  * See g_spawn_async_with_pipes() for a full description; this function
25384  * simply calls the g_spawn_async_with_pipes() without any pipes.
25385  *
25386  * You should call g_spawn_close_pid() on the returned child process
25387  * reference when you don't need it any more.
25388  *
25389  * <note><para>
25390  * If you are writing a GTK+ application, and the program you
25391  * are spawning is a graphical application, too, then you may
25392  * want to use gdk_spawn_on_screen() instead to ensure that
25393  * the spawned program opens its windows on the right screen.
25394  * </para></note>
25395  *
25396  * <note><para> Note that the returned @child_pid on Windows is a
25397  * handle to the child process and not its identifier. Process handles
25398  * and process identifiers are different concepts on Windows.
25399  * </para></note>
25400  *
25401  * Returns: %TRUE on success, %FALSE if error is set
25402  */
25403
25404
25405 /**
25406  * g_spawn_async_with_pipes:
25407  * @working_directory: (allow-none): child's current working directory, or %NULL to inherit parent's, in the GLib file name encoding
25408  * @argv: (array zero-terminated=1): child's argument vector, in the GLib file name encoding
25409  * @envp: (array zero-terminated=1) (allow-none): child's environment, or %NULL to inherit parent's, in the GLib file name encoding
25410  * @flags: flags from #GSpawnFlags
25411  * @child_setup: (scope async) (allow-none): function to run in the child just before exec()
25412  * @user_data: (closure): user data for @child_setup
25413  * @child_pid: (out) (allow-none): return location for child process ID, or %NULL
25414  * @standard_input: (out) (allow-none): return location for file descriptor to write to child's stdin, or %NULL
25415  * @standard_output: (out) (allow-none): return location for file descriptor to read child's stdout, or %NULL
25416  * @standard_error: (out) (allow-none): return location for file descriptor to read child's stderr, or %NULL
25417  * @error: return location for error
25418  *
25419  * Executes a child program asynchronously (your program will not
25420  * block waiting for the child to exit). The child program is
25421  * specified by the only argument that must be provided, @argv. @argv
25422  * should be a %NULL-terminated array of strings, to be passed as the
25423  * argument vector for the child. The first string in @argv is of
25424  * course the name of the program to execute. By default, the name of
25425  * the program must be a full path. If @flags contains the
25426  * %G_SPAWN_SEARCH_PATH flag, the <envar>PATH</envar> environment variable
25427  * is used to search for the executable. If @flags contains the
25428  * %G_SPAWN_SEARCH_PATH_FROM_ENVP flag, the <envar>PATH</envar> variable from
25429  * @envp is used to search for the executable.
25430  * If both the %G_SPAWN_SEARCH_PATH and %G_SPAWN_SEARCH_PATH_FROM_ENVP
25431  * flags are set, the <envar>PATH</envar> variable from @envp takes precedence
25432  * over the environment variable.
25433  *
25434  * If the program name is not a full path and %G_SPAWN_SEARCH_PATH flag is not
25435  * used, then the program will be run from the current directory (or
25436  * @working_directory, if specified); this might be unexpected or even
25437  * dangerous in some cases when the current directory is world-writable.
25438  *
25439  * On Windows, note that all the string or string vector arguments to
25440  * this function and the other g_spawn*() functions are in UTF-8, the
25441  * GLib file name encoding. Unicode characters that are not part of
25442  * the system codepage passed in these arguments will be correctly
25443  * available in the spawned program only if it uses wide character API
25444  * to retrieve its command line. For C programs built with Microsoft's
25445  * tools it is enough to make the program have a wmain() instead of
25446  * main(). wmain() has a wide character argument vector as parameter.
25447  *
25448  * At least currently, mingw doesn't support wmain(), so if you use
25449  * mingw to develop the spawned program, it will have to call the
25450  * undocumented function __wgetmainargs() to get the wide character
25451  * argument vector and environment. See gspawn-win32-helper.c in the
25452  * GLib sources or init.c in the mingw runtime sources for a prototype
25453  * for that function. Alternatively, you can retrieve the Win32 system
25454  * level wide character command line passed to the spawned program
25455  * using the GetCommandLineW() function.
25456  *
25457  * On Windows the low-level child process creation API
25458  * <function>CreateProcess()</function> doesn't use argument vectors,
25459  * but a command line. The C runtime library's
25460  * <function>spawn*()</function> family of functions (which
25461  * g_spawn_async_with_pipes() eventually calls) paste the argument
25462  * vector elements together into a command line, and the C runtime startup code
25463  * does a corresponding reconstruction of an argument vector from the
25464  * command line, to be passed to main(). Complications arise when you have
25465  * argument vector elements that contain spaces of double quotes. The
25466  * <function>spawn*()</function> functions don't do any quoting or
25467  * escaping, but on the other hand the startup code does do unquoting
25468  * and unescaping in order to enable receiving arguments with embedded
25469  * spaces or double quotes. To work around this asymmetry,
25470  * g_spawn_async_with_pipes() will do quoting and escaping on argument
25471  * vector elements that need it before calling the C runtime
25472  * spawn() function.
25473  *
25474  * The returned @child_pid on Windows is a handle to the child
25475  * process, not its identifier. Process handles and process
25476  * identifiers are different concepts on Windows.
25477  *
25478  * @envp is a %NULL-terminated array of strings, where each string
25479  * has the form <literal>KEY=VALUE</literal>. This will become
25480  * the child's environment. If @envp is %NULL, the child inherits its
25481  * parent's environment.
25482  *
25483  * @flags should be the bitwise OR of any flags you want to affect the
25484  * function's behaviour. The %G_SPAWN_DO_NOT_REAP_CHILD means that the
25485  * child will not automatically be reaped; you must use a child watch to
25486  * be notified about the death of the child process. Eventually you must
25487  * call g_spawn_close_pid() on the @child_pid, in order to free
25488  * resources which may be associated with the child process. (On Unix,
25489  * using a child watch is equivalent to calling waitpid() or handling
25490  * the <literal>SIGCHLD</literal> signal manually. On Windows, calling g_spawn_close_pid()
25491  * is equivalent to calling CloseHandle() on the process handle returned
25492  * in @child_pid).  See g_child_watch_add().
25493  *
25494  * %G_SPAWN_LEAVE_DESCRIPTORS_OPEN means that the parent's open file
25495  * descriptors will be inherited by the child; otherwise all
25496  * descriptors except stdin/stdout/stderr will be closed before
25497  * calling exec() in the child. %G_SPAWN_SEARCH_PATH
25498  * means that <literal>argv[0]</literal> need not be an absolute path, it
25499  * will be looked for in the <envar>PATH</envar> environment variable.
25500  * %G_SPAWN_SEARCH_PATH_FROM_ENVP means need not be an absolute path, it
25501  * will be looked for in the <envar>PATH</envar> variable from @envp. If
25502  * both %G_SPAWN_SEARCH_PATH and %G_SPAWN_SEARCH_PATH_FROM_ENVP are used,
25503  * the value from @envp takes precedence over the environment.
25504  * %G_SPAWN_STDOUT_TO_DEV_NULL means that the child's standard output will
25505  * be discarded, instead of going to the same location as the parent's
25506  * standard output. If you use this flag, @standard_output must be %NULL.
25507  * %G_SPAWN_STDERR_TO_DEV_NULL means that the child's standard error
25508  * will be discarded, instead of going to the same location as the parent's
25509  * standard error. If you use this flag, @standard_error must be %NULL.
25510  * %G_SPAWN_CHILD_INHERITS_STDIN means that the child will inherit the parent's
25511  * standard input (by default, the child's standard input is attached to
25512  * /dev/null). If you use this flag, @standard_input must be %NULL.
25513  * %G_SPAWN_FILE_AND_ARGV_ZERO means that the first element of @argv is
25514  * the file to execute, while the remaining elements are the
25515  * actual argument vector to pass to the file. Normally
25516  * g_spawn_async_with_pipes() uses @argv[0] as the file to execute, and
25517  * passes all of @argv to the child.
25518  *
25519  * @child_setup and @user_data are a function and user data. On POSIX
25520  * platforms, the function is called in the child after GLib has
25521  * performed all the setup it plans to perform (including creating
25522  * pipes, closing file descriptors, etc.) but before calling
25523  * exec(). That is, @child_setup is called just
25524  * before calling exec() in the child. Obviously
25525  * actions taken in this function will only affect the child, not the
25526  * parent.
25527  *
25528  * On Windows, there is no separate fork() and exec()
25529  * functionality. Child processes are created and run with a single
25530  * API call, CreateProcess(). There is no sensible thing @child_setup
25531  * could be used for on Windows so it is ignored and not called.
25532  *
25533  * If non-%NULL, @child_pid will on Unix be filled with the child's
25534  * process ID. You can use the process ID to send signals to the
25535  * child, or to use g_child_watch_add() (or waitpid()) if you specified the
25536  * %G_SPAWN_DO_NOT_REAP_CHILD flag. On Windows, @child_pid will be
25537  * filled with a handle to the child process only if you specified the
25538  * %G_SPAWN_DO_NOT_REAP_CHILD flag. You can then access the child
25539  * process using the Win32 API, for example wait for its termination
25540  * with the <function>WaitFor*()</function> functions, or examine its
25541  * exit code with GetExitCodeProcess(). You should close the handle
25542  * with CloseHandle() or g_spawn_close_pid() when you no longer need it.
25543  *
25544  * If non-%NULL, the @standard_input, @standard_output, @standard_error
25545  * locations will be filled with file descriptors for writing to the child's
25546  * standard input or reading from its standard output or standard error.
25547  * The caller of g_spawn_async_with_pipes() must close these file descriptors
25548  * when they are no longer in use. If these parameters are %NULL, the corresponding
25549  * pipe won't be created.
25550  *
25551  * If @standard_input is NULL, the child's standard input is attached to
25552  * /dev/null unless %G_SPAWN_CHILD_INHERITS_STDIN is set.
25553  *
25554  * If @standard_error is NULL, the child's standard error goes to the same
25555  * location as the parent's standard error unless %G_SPAWN_STDERR_TO_DEV_NULL
25556  * is set.
25557  *
25558  * If @standard_output is NULL, the child's standard output goes to the same
25559  * location as the parent's standard output unless %G_SPAWN_STDOUT_TO_DEV_NULL
25560  * is set.
25561  *
25562  * @error can be %NULL to ignore errors, or non-%NULL to report errors.
25563  * If an error is set, the function returns %FALSE. Errors
25564  * are reported even if they occur in the child (for example if the
25565  * executable in <literal>argv[0]</literal> is not found). Typically
25566  * the <literal>message</literal> field of returned errors should be displayed
25567  * to users. Possible errors are those from the #G_SPAWN_ERROR domain.
25568  *
25569  * If an error occurs, @child_pid, @standard_input, @standard_output,
25570  * and @standard_error will not be filled with valid values.
25571  *
25572  * If @child_pid is not %NULL and an error does not occur then the returned
25573  * process reference must be closed using g_spawn_close_pid().
25574  *
25575  * <note><para>
25576  * If you are writing a GTK+ application, and the program you
25577  * are spawning is a graphical application, too, then you may
25578  * want to use gdk_spawn_on_screen_with_pipes() instead to ensure that
25579  * the spawned program opens its windows on the right screen.
25580  * </para></note>
25581  *
25582  * Returns: %TRUE on success, %FALSE if an error was set
25583  */
25584
25585
25586 /**
25587  * g_spawn_check_exit_status:
25588  * @exit_status: An exit code as returned from g_spawn_sync()
25589  * @error: a #GError
25590  *
25591  * Set @error if @exit_status indicates the child exited abnormally
25592  * (e.g. with a nonzero exit code, or via a fatal signal).
25593  *
25594  * The g_spawn_sync() and g_child_watch_add() family of APIs return an
25595  * exit status for subprocesses encoded in a platform-specific way.
25596  * On Unix, this is guaranteed to be in the same format
25597  * <literal>waitpid(2)</literal> returns, and on Windows it is
25598  * guaranteed to be the result of
25599  * <literal>GetExitCodeProcess()</literal>.  Prior to the introduction
25600  * of this function in GLib 2.34, interpreting @exit_status required
25601  * use of platform-specific APIs, which is problematic for software
25602  * using GLib as a cross-platform layer.
25603  *
25604  * Additionally, many programs simply want to determine whether or not
25605  * the child exited successfully, and either propagate a #GError or
25606  * print a message to standard error.  In that common case, this
25607  * function can be used.  Note that the error message in @error will
25608  * contain human-readable information about the exit status.
25609  *
25610  * The <literal>domain</literal> and <literal>code</literal> of @error
25611  * have special semantics in the case where the process has an "exit
25612  * code", as opposed to being killed by a signal.  On Unix, this
25613  * happens if <literal>WIFEXITED</literal> would be true of
25614  * @exit_status.  On Windows, it is always the case.
25615  *
25616  * The special semantics are that the actual exit code will be the
25617  * code set in @error, and the domain will be %G_SPAWN_EXIT_ERROR.
25618  * This allows you to differentiate between different exit codes.
25619  *
25620  * If the process was terminated by some means other than an exit
25621  * status, the domain will be %G_SPAWN_ERROR, and the code will be
25622  * %G_SPAWN_ERROR_FAILED.
25623  *
25624  * This function just offers convenience; you can of course also check
25625  * the available platform via a macro such as %G_OS_UNIX, and use
25626  * <literal>WIFEXITED()</literal> and <literal>WEXITSTATUS()</literal>
25627  * on @exit_status directly.  Do not attempt to scan or parse the
25628  * error message string; it may be translated and/or change in future
25629  * versions of GLib.
25630  *
25631  * Returns: %TRUE if child exited successfully, %FALSE otherwise (and @error will be set)
25632  * Since: 2.34
25633  */
25634
25635
25636 /**
25637  * g_spawn_close_pid:
25638  * @pid: The process reference to close
25639  *
25640  * On some platforms, notably Windows, the #GPid type represents a resource
25641  * which must be closed to prevent resource leaking. g_spawn_close_pid()
25642  * is provided for this purpose. It should be used on all platforms, even
25643  * though it doesn't do anything under UNIX.
25644  */
25645
25646
25647 /**
25648  * g_spawn_command_line_async:
25649  * @command_line: a command line
25650  * @error: return location for errors
25651  *
25652  * A simple version of g_spawn_async() that parses a command line with
25653  * g_shell_parse_argv() and passes it to g_spawn_async(). Runs a
25654  * command line in the background. Unlike g_spawn_async(), the
25655  * %G_SPAWN_SEARCH_PATH flag is enabled, other flags are not. Note
25656  * that %G_SPAWN_SEARCH_PATH can have security implications, so
25657  * consider using g_spawn_async() directly if appropriate. Possible
25658  * errors are those from g_shell_parse_argv() and g_spawn_async().
25659  *
25660  * The same concerns on Windows apply as for g_spawn_command_line_sync().
25661  *
25662  * Returns: %TRUE on success, %FALSE if error is set.
25663  */
25664
25665
25666 /**
25667  * g_spawn_command_line_sync:
25668  * @command_line: a command line
25669  * @standard_output: (out) (array zero-terminated=1) (element-type guint8) (allow-none): return location for child output
25670  * @standard_error: (out) (array zero-terminated=1) (element-type guint8) (allow-none): return location for child errors
25671  * @exit_status: (out) (allow-none): return location for child exit status, as returned by waitpid()
25672  * @error: return location for errors
25673  *
25674  * A simple version of g_spawn_sync() with little-used parameters
25675  * removed, taking a command line instead of an argument vector.  See
25676  * g_spawn_sync() for full details. @command_line will be parsed by
25677  * g_shell_parse_argv(). Unlike g_spawn_sync(), the %G_SPAWN_SEARCH_PATH flag
25678  * is enabled. Note that %G_SPAWN_SEARCH_PATH can have security
25679  * implications, so consider using g_spawn_sync() directly if
25680  * appropriate. Possible errors are those from g_spawn_sync() and those
25681  * from g_shell_parse_argv().
25682  *
25683  * If @exit_status is non-%NULL, the platform-specific exit status of
25684  * the child is stored there; see the documentation of
25685  * g_spawn_check_exit_status() for how to use and interpret this.
25686  *
25687  * On Windows, please note the implications of g_shell_parse_argv()
25688  * parsing @command_line. Parsing is done according to Unix shell rules, not
25689  * Windows command interpreter rules.
25690  * Space is a separator, and backslashes are
25691  * special. Thus you cannot simply pass a @command_line containing
25692  * canonical Windows paths, like "c:\\program files\\app\\app.exe", as
25693  * the backslashes will be eaten, and the space will act as a
25694  * separator. You need to enclose such paths with single quotes, like
25695  * "'c:\\program files\\app\\app.exe' 'e:\\folder\\argument.txt'".
25696  *
25697  * Returns: %TRUE on success, %FALSE if an error was set
25698  */
25699
25700
25701 /**
25702  * g_spawn_sync:
25703  * @working_directory: (allow-none): child's current working directory, or %NULL to inherit parent's
25704  * @argv: (array zero-terminated=1): child's argument vector
25705  * @envp: (array zero-terminated=1) (allow-none): child's environment, or %NULL to inherit parent's
25706  * @flags: flags from #GSpawnFlags
25707  * @child_setup: (scope async) (allow-none): function to run in the child just before exec()
25708  * @user_data: (closure): user data for @child_setup
25709  * @standard_output: (out) (array zero-terminated=1) (element-type guint8) (allow-none): return location for child output, or %NULL
25710  * @standard_error: (out) (array zero-terminated=1) (element-type guint8) (allow-none): return location for child error messages, or %NULL
25711  * @exit_status: (out) (allow-none): return location for child exit status, as returned by waitpid(), or %NULL
25712  * @error: return location for error, or %NULL
25713  *
25714  * Executes a child synchronously (waits for the child to exit before returning).
25715  * All output from the child is stored in @standard_output and @standard_error,
25716  * if those parameters are non-%NULL. Note that you must set the
25717  * %G_SPAWN_STDOUT_TO_DEV_NULL and %G_SPAWN_STDERR_TO_DEV_NULL flags when
25718  * passing %NULL for @standard_output and @standard_error.
25719  *
25720  * If @exit_status is non-%NULL, the platform-specific exit status of
25721  * the child is stored there; see the doucumentation of
25722  * g_spawn_check_exit_status() for how to use and interpret this.
25723  * Note that it is invalid to pass %G_SPAWN_DO_NOT_REAP_CHILD in
25724  * @flags.
25725  *
25726  * If an error occurs, no data is returned in @standard_output,
25727  * @standard_error, or @exit_status.
25728  *
25729  * This function calls g_spawn_async_with_pipes() internally; see that
25730  * function for full details on the other parameters and details on
25731  * how these functions work on Windows.
25732  *
25733  * Returns: %TRUE on success, %FALSE if an error was set.
25734  */
25735
25736
25737 /**
25738  * g_sprintf:
25739  * @string: A pointer to a memory buffer to contain the resulting string. It is up to the caller to ensure that the allocated buffer is large enough to hold the formatted result
25740  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
25741  * @...: the arguments to insert in the output.
25742  *
25743  * An implementation of the standard sprintf() function which supports
25744  * positional parameters, as specified in the Single Unix Specification.
25745  *
25746  * Note that it is usually better to use g_snprintf(), to avoid the
25747  * risk of buffer overflow.
25748  *
25749  * See also g_strdup_printf().
25750  *
25751  * Returns: the number of bytes printed.
25752  * Since: 2.2
25753  */
25754
25755
25756 /**
25757  * g_stat:
25758  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
25759  * @buf: a pointer to a <structname>stat</structname> struct, which will be filled with the file information
25760  *
25761  * A wrapper for the POSIX stat() function. The stat() function
25762  * returns information about a file. On Windows the stat() function in
25763  * the C library checks only the FAT-style READONLY attribute and does
25764  * not look at the ACL at all. Thus on Windows the protection bits in
25765  * the st_mode field are a fabrication of little use.
25766  *
25767  * On Windows the Microsoft C libraries have several variants of the
25768  * <structname>stat</structname> struct and stat() function with names
25769  * like "_stat", "_stat32", "_stat32i64" and "_stat64i32". The one
25770  * used here is for 32-bit code the one with 32-bit size and time
25771  * fields, specifically called "_stat32".
25772  *
25773  * In Microsoft's compiler, by default "struct stat" means one with
25774  * 64-bit time fields while in MinGW "struct stat" is the legacy one
25775  * with 32-bit fields. To hopefully clear up this messs, the gstdio.h
25776  * header defines a type GStatBuf which is the appropriate struct type
25777  * depending on the platform and/or compiler being used. On POSIX it
25778  * is just "struct stat", but note that even on POSIX platforms,
25779  * "stat" might be a macro.
25780  *
25781  * See your C library manual for more details about stat().
25782  *
25783  * Returns: 0 if the information was successfully retrieved, -1 if an error occurred
25784  * Since: 2.6
25785  */
25786
25787
25788 /**
25789  * g_stpcpy:
25790  * @dest: destination buffer.
25791  * @src: source string.
25792  *
25793  * Copies a nul-terminated string into the dest buffer, include the
25794  * trailing nul, and return a pointer to the trailing nul byte.
25795  * This is useful for concatenating multiple strings together
25796  * without having to repeatedly scan for the end.
25797  *
25798  * Returns: a pointer to trailing nul byte.
25799  */
25800
25801
25802 /**
25803  * g_str_equal:
25804  * @v1: a key
25805  * @v2: a key to compare with @v1
25806  *
25807  * Compares two strings for byte-by-byte equality and returns %TRUE
25808  * if they are equal. It can be passed to g_hash_table_new() as the
25809  * @key_equal_func parameter, when using non-%NULL strings as keys in a
25810  * #GHashTable.
25811  *
25812  * Note that this function is primarily meant as a hash table comparison
25813  * function. For a general-purpose, %NULL-safe string comparison function,
25814  * see g_strcmp0().
25815  *
25816  * Returns: %TRUE if the two keys match
25817  */
25818
25819
25820 /**
25821  * g_str_has_prefix:
25822  * @str: a nul-terminated string
25823  * @prefix: the nul-terminated prefix to look for
25824  *
25825  * Looks whether the string @str begins with @prefix.
25826  *
25827  * Returns: %TRUE if @str begins with @prefix, %FALSE otherwise.
25828  * Since: 2.2
25829  */
25830
25831
25832 /**
25833  * g_str_has_suffix:
25834  * @str: a nul-terminated string
25835  * @suffix: the nul-terminated suffix to look for
25836  *
25837  * Looks whether the string @str ends with @suffix.
25838  *
25839  * Returns: %TRUE if @str end with @suffix, %FALSE otherwise.
25840  * Since: 2.2
25841  */
25842
25843
25844 /**
25845  * g_str_hash:
25846  * @v: a string key
25847  *
25848  * Converts a string to a hash value.
25849  *
25850  * This function implements the widely used "djb" hash apparently posted
25851  * by Daniel Bernstein to comp.lang.c some time ago.  The 32 bit
25852  * unsigned hash value starts at 5381 and for each byte 'c' in the
25853  * string, is updated: <literal>hash = hash * 33 + c</literal>.  This
25854  * function uses the signed value of each byte.
25855  *
25856  * It can be passed to g_hash_table_new() as the @hash_func parameter,
25857  * when using non-%NULL strings as keys in a #GHashTable.
25858  *
25859  * Returns: a hash value corresponding to the key
25860  */
25861
25862
25863 /**
25864  * g_strcanon:
25865  * @string: a nul-terminated array of bytes
25866  * @valid_chars: bytes permitted in @string
25867  * @substitutor: replacement character for disallowed bytes
25868  *
25869  * For each character in @string, if the character is not in
25870  * @valid_chars, replaces the character with @substitutor.
25871  * Modifies @string in place, and return @string itself, not
25872  * a copy. The return value is to allow nesting such as
25873  * |[
25874  *   g_ascii_strup (g_strcanon (str, "abc", '?'))
25875  * ]|
25876  *
25877  * Returns: @string
25878  */
25879
25880
25881 /**
25882  * g_strcasecmp:
25883  * @s1: a string.
25884  * @s2: a string to compare with @s1.
25885  *
25886  * A case-insensitive string comparison, corresponding to the standard
25887  * strcasecmp() function on platforms which support it.
25888  *
25889  * Returns: 0 if the strings match, a negative value if @s1 &lt; @s2, or a positive value if @s1 &gt; @s2.
25890  * Deprecated: 2.2: See g_strncasecmp() for a discussion of why this function is deprecated and how to replace it.
25891  */
25892
25893
25894 /**
25895  * g_strchomp:
25896  * @string: a string to remove the trailing whitespace from
25897  *
25898  * Removes trailing whitespace from a string.
25899  *
25900  * This function doesn't allocate or reallocate any memory;
25901  * it modifies @string in place. The pointer to @string is
25902  * returned to allow the nesting of functions.
25903  *
25904  * Also see g_strchug() and g_strstrip().
25905  *
25906  * Returns: @string.
25907  */
25908
25909
25910 /**
25911  * g_strchug:
25912  * @string: a string to remove the leading whitespace from
25913  *
25914  * Removes leading whitespace from a string, by moving the rest
25915  * of the characters forward.
25916  *
25917  * This function doesn't allocate or reallocate any memory;
25918  * it modifies @string in place. The pointer to @string is
25919  * returned to allow the nesting of functions.
25920  *
25921  * Also see g_strchomp() and g_strstrip().
25922  *
25923  * Returns: @string
25924  */
25925
25926
25927 /**
25928  * g_strcmp0:
25929  * @str1: (allow-none): a C string or %NULL
25930  * @str2: (allow-none): another C string or %NULL
25931  *
25932  * Compares @str1 and @str2 like strcmp(). Handles %NULL
25933  * gracefully by sorting it before non-%NULL strings.
25934  * Comparing two %NULL pointers returns 0.
25935  *
25936  * Returns: an integer less than, equal to, or greater than zero, if @str1 is <, == or > than @str2.
25937  * Since: 2.16
25938  */
25939
25940
25941 /**
25942  * g_strcompress:
25943  * @source: a string to compress
25944  *
25945  * Replaces all escaped characters with their one byte equivalent.
25946  *
25947  * This function does the reverse conversion of g_strescape().
25948  *
25949  * Returns: a newly-allocated copy of @source with all escaped character compressed
25950  */
25951
25952
25953 /**
25954  * g_strconcat:
25955  * @string1: the first string to add, which must not be %NULL
25956  * @...: a %NULL-terminated list of strings to append to the string
25957  *
25958  * Concatenates all of the given strings into one long string.
25959  * The returned string should be freed with g_free() when no longer needed.
25960  *
25961  * Note that this function is usually not the right function to use to
25962  * assemble a translated message from pieces, since proper translation
25963  * often requires the pieces to be reordered.
25964  *
25965  * <warning><para>The variable argument list <emphasis>must</emphasis> end
25966  * with %NULL. If you forget the %NULL, g_strconcat() will start appending
25967  * random memory junk to your string.</para></warning>
25968  *
25969  * Returns: a newly-allocated string containing all the string arguments
25970  */
25971
25972
25973 /**
25974  * g_strdelimit:
25975  * @string: the string to convert
25976  * @delimiters: (allow-none): a string containing the current delimiters, or %NULL to use the standard delimiters defined in #G_STR_DELIMITERS
25977  * @new_delimiter: the new delimiter character
25978  *
25979  * Converts any delimiter characters in @string to @new_delimiter.
25980  * Any characters in @string which are found in @delimiters are
25981  * changed to the @new_delimiter character. Modifies @string in place,
25982  * and returns @string itself, not a copy. The return value is to
25983  * allow nesting such as
25984  * |[
25985  *   g_ascii_strup (g_strdelimit (str, "abc", '?'))
25986  * ]|
25987  *
25988  * Returns: @string
25989  */
25990
25991
25992 /**
25993  * g_strdown:
25994  * @string: the string to convert.
25995  *
25996  * Converts a string to lower case.
25997  *
25998  * Returns: the string
25999  * Deprecated: 2.2: This function is totally broken for the reasons discussed in the g_strncasecmp() docs - use g_ascii_strdown() or g_utf8_strdown() instead.
26000  */
26001
26002
26003 /**
26004  * g_strdup:
26005  * @str: the string to duplicate
26006  *
26007  * Duplicates a string. If @str is %NULL it returns %NULL.
26008  * The returned string should be freed with g_free()
26009  * when no longer needed.
26010  *
26011  * Returns: a newly-allocated copy of @str
26012  */
26013
26014
26015 /**
26016  * g_strdup_printf:
26017  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>
26018  * @...: the parameters to insert into the format string
26019  *
26020  * Similar to the standard C sprintf() function but safer, since it
26021  * calculates the maximum space required and allocates memory to hold
26022  * the result. The returned string should be freed with g_free() when no
26023  * longer needed.
26024  *
26025  * Returns: a newly-allocated string holding the result
26026  */
26027
26028
26029 /**
26030  * g_strdup_vprintf:
26031  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>
26032  * @args: the list of parameters to insert into the format string
26033  *
26034  * Similar to the standard C vsprintf() function but safer, since it
26035  * calculates the maximum space required and allocates memory to hold
26036  * the result. The returned string should be freed with g_free() when
26037  * no longer needed.
26038  *
26039  * See also g_vasprintf(), which offers the same functionality, but
26040  * additionally returns the length of the allocated string.
26041  *
26042  * Returns: a newly-allocated string holding the result
26043  */
26044
26045
26046 /**
26047  * g_strdupv:
26048  * @str_array: a %NULL-terminated array of strings
26049  *
26050  * Copies %NULL-terminated array of strings. The copy is a deep copy;
26051  * the new array should be freed by first freeing each string, then
26052  * the array itself. g_strfreev() does this for you. If called
26053  * on a %NULL value, g_strdupv() simply returns %NULL.
26054  *
26055  * Returns: a new %NULL-terminated array of strings.
26056  */
26057
26058
26059 /**
26060  * g_strerror:
26061  * @errnum: the system error number. See the standard C %errno documentation
26062  *
26063  * Returns a string corresponding to the given error code, e.g.
26064  * "no such process". You should use this function in preference to
26065  * strerror(), because it returns a string in UTF-8 encoding, and since
26066  * not all platforms support the strerror() function.
26067  *
26068  * Returns: a UTF-8 string describing the error code. If the error code is unknown, it returns "unknown error (&lt;code&gt;)".
26069  */
26070
26071
26072 /**
26073  * g_strescape:
26074  * @source: a string to escape
26075  * @exceptions: a string of characters not to escape in @source
26076  *
26077  * Escapes the special characters '\b', '\f', '\n', '\r', '\t', '\v', '\'
26078  * and '&quot;' in the string @source by inserting a '\' before
26079  * them. Additionally all characters in the range 0x01-0x1F (everything
26080  * below SPACE) and in the range 0x7F-0xFF (all non-ASCII chars) are
26081  * replaced with a '\' followed by their octal representation.
26082  * Characters supplied in @exceptions are not escaped.
26083  *
26084  * g_strcompress() does the reverse conversion.
26085  *
26086  * Returns: a newly-allocated copy of @source with certain characters escaped. See above.
26087  */
26088
26089
26090 /**
26091  * g_strfreev:
26092  * @str_array: a %NULL-terminated array of strings to free
26093  *
26094  * Frees a %NULL-terminated array of strings, and the array itself.
26095  * If called on a %NULL value, g_strfreev() simply returns.
26096  */
26097
26098
26099 /**
26100  * g_string_append:
26101  * @string: a #GString
26102  * @val: the string to append onto the end of @string
26103  *
26104  * Adds a string onto the end of a #GString, expanding
26105  * it if necessary.
26106  *
26107  * Returns: @string
26108  */
26109
26110
26111 /**
26112  * g_string_append_c:
26113  * @string: a #GString
26114  * @c: the byte to append onto the end of @string
26115  *
26116  * Adds a byte onto the end of a #GString, expanding
26117  * it if necessary.
26118  *
26119  * Returns: @string
26120  */
26121
26122
26123 /**
26124  * g_string_append_len:
26125  * @string: a #GString
26126  * @val: bytes to append
26127  * @len: number of bytes of @val to use
26128  *
26129  * Appends @len bytes of @val to @string. Because @len is
26130  * provided, @val may contain embedded nuls and need not
26131  * be nul-terminated.
26132  *
26133  * Since this function does not stop at nul bytes, it is
26134  * the caller's responsibility to ensure that @val has at
26135  * least @len addressable bytes.
26136  *
26137  * Returns: @string
26138  */
26139
26140
26141 /**
26142  * g_string_append_printf:
26143  * @string: a #GString
26144  * @format: the string format. See the printf() documentation
26145  * @...: the parameters to insert into the format string
26146  *
26147  * Appends a formatted string onto the end of a #GString.
26148  * This function is similar to g_string_printf() except
26149  * that the text is appended to the #GString.
26150  */
26151
26152
26153 /**
26154  * g_string_append_unichar:
26155  * @string: a #GString
26156  * @wc: a Unicode character
26157  *
26158  * Converts a Unicode character into UTF-8, and appends it
26159  * to the string.
26160  *
26161  * Returns: @string
26162  */
26163
26164
26165 /**
26166  * g_string_append_uri_escaped:
26167  * @string: a #GString
26168  * @unescaped: a string
26169  * @reserved_chars_allowed: a string of reserved characters allowed to be used, or %NULL
26170  * @allow_utf8: set %TRUE if the escaped string may include UTF8 characters
26171  *
26172  * Appends @unescaped to @string, escaped any characters that
26173  * are reserved in URIs using URI-style escape sequences.
26174  *
26175  * Returns: @string
26176  * Since: 2.16
26177  */
26178
26179
26180 /**
26181  * g_string_append_vprintf:
26182  * @string: a #GString
26183  * @format: the string format. See the printf() documentation
26184  * @args: the list of arguments to insert in the output
26185  *
26186  * Appends a formatted string onto the end of a #GString.
26187  * This function is similar to g_string_append_printf()
26188  * except that the arguments to the format string are passed
26189  * as a va_list.
26190  *
26191  * Since: 2.14
26192  */
26193
26194
26195 /**
26196  * g_string_ascii_down:
26197  * @string: a GString
26198  *
26199  * Converts all uppercase ASCII letters to lowercase ASCII letters.
26200  *
26201  * Returns: passed-in @string pointer, with all the uppercase characters converted to lowercase in place, with semantics that exactly match g_ascii_tolower().
26202  */
26203
26204
26205 /**
26206  * g_string_ascii_up:
26207  * @string: a GString
26208  *
26209  * Converts all lowercase ASCII letters to uppercase ASCII letters.
26210  *
26211  * Returns: passed-in @string pointer, with all the lowercase characters converted to uppercase in place, with semantics that exactly match g_ascii_toupper().
26212  */
26213
26214
26215 /**
26216  * g_string_assign:
26217  * @string: the destination #GString. Its current contents are destroyed.
26218  * @rval: the string to copy into @string
26219  *
26220  * Copies the bytes from a string into a #GString,
26221  * destroying any previous contents. It is rather like
26222  * the standard strcpy() function, except that you do not
26223  * have to worry about having enough space to copy the string.
26224  *
26225  * Returns: @string
26226  */
26227
26228
26229 /**
26230  * g_string_chunk_clear:
26231  * @chunk: a #GStringChunk
26232  *
26233  * Frees all strings contained within the #GStringChunk.
26234  * After calling g_string_chunk_clear() it is not safe to
26235  * access any of the strings which were contained within it.
26236  *
26237  * Since: 2.14
26238  */
26239
26240
26241 /**
26242  * g_string_chunk_free:
26243  * @chunk: a #GStringChunk
26244  *
26245  * Frees all memory allocated by the #GStringChunk.
26246  * After calling g_string_chunk_free() it is not safe to
26247  * access any of the strings which were contained within it.
26248  */
26249
26250
26251 /**
26252  * g_string_chunk_insert:
26253  * @chunk: a #GStringChunk
26254  * @string: the string to add
26255  *
26256  * Adds a copy of @string to the #GStringChunk.
26257  * It returns a pointer to the new copy of the string
26258  * in the #GStringChunk. The characters in the string
26259  * can be changed, if necessary, though you should not
26260  * change anything after the end of the string.
26261  *
26262  * Unlike g_string_chunk_insert_const(), this function
26263  * does not check for duplicates. Also strings added
26264  * with g_string_chunk_insert() will not be searched
26265  * by g_string_chunk_insert_const() when looking for
26266  * duplicates.
26267  *
26268  * Returns: a pointer to the copy of @string within the #GStringChunk
26269  */
26270
26271
26272 /**
26273  * g_string_chunk_insert_const:
26274  * @chunk: a #GStringChunk
26275  * @string: the string to add
26276  *
26277  * Adds a copy of @string to the #GStringChunk, unless the same
26278  * string has already been added to the #GStringChunk with
26279  * g_string_chunk_insert_const().
26280  *
26281  * This function is useful if you need to copy a large number
26282  * of strings but do not want to waste space storing duplicates.
26283  * But you must remember that there may be several pointers to
26284  * the same string, and so any changes made to the strings
26285  * should be done very carefully.
26286  *
26287  * Note that g_string_chunk_insert_const() will not return a
26288  * pointer to a string added with g_string_chunk_insert(), even
26289  * if they do match.
26290  *
26291  * Returns: a pointer to the new or existing copy of @string within the #GStringChunk
26292  */
26293
26294
26295 /**
26296  * g_string_chunk_insert_len:
26297  * @chunk: a #GStringChunk
26298  * @string: bytes to insert
26299  * @len: number of bytes of @string to insert, or -1 to insert a nul-terminated string
26300  *
26301  * Adds a copy of the first @len bytes of @string to the #GStringChunk.
26302  * The copy is nul-terminated.
26303  *
26304  * Since this function does not stop at nul bytes, it is the caller's
26305  * responsibility to ensure that @string has at least @len addressable
26306  * bytes.
26307  *
26308  * The characters in the returned string can be changed, if necessary,
26309  * though you should not change anything after the end of the string.
26310  *
26311  * Returns: a pointer to the copy of @string within the #GStringChunk
26312  * Since: 2.4
26313  */
26314
26315
26316 /**
26317  * g_string_chunk_new:
26318  * @size: the default size of the blocks of memory which are allocated to store the strings. If a particular string is larger than this default size, a larger block of memory will be allocated for it.
26319  *
26320  * Creates a new #GStringChunk.
26321  *
26322  * Returns: a new #GStringChunk
26323  */
26324
26325
26326 /**
26327  * g_string_down:
26328  * @string: a #GString
26329  *
26330  * Converts a #GString to lowercase.
26331  *
26332  * Returns: the #GString
26333  * Deprecated: 2.2: This function uses the locale-specific tolower() function, which is almost never the right thing. Use g_string_ascii_down() or g_utf8_strdown() instead.
26334  */
26335
26336
26337 /**
26338  * g_string_equal:
26339  * @v: a #GString
26340  * @v2: another #GString
26341  *
26342  * Compares two strings for equality, returning %TRUE if they are equal.
26343  * For use with #GHashTable.
26344  *
26345  * Returns: %TRUE if they strings are the same length and contain the same bytes
26346  */
26347
26348
26349 /**
26350  * g_string_erase:
26351  * @string: a #GString
26352  * @pos: the position of the content to remove
26353  * @len: the number of bytes to remove, or -1 to remove all following bytes
26354  *
26355  * Removes @len bytes from a #GString, starting at position @pos.
26356  * The rest of the #GString is shifted down to fill the gap.
26357  *
26358  * Returns: @string
26359  */
26360
26361
26362 /**
26363  * g_string_free:
26364  * @string: a #GString
26365  * @free_segment: if %TRUE, the actual character data is freed as well
26366  *
26367  * Frees the memory allocated for the #GString.
26368  * If @free_segment is %TRUE it also frees the character data.  If
26369  * it's %FALSE, the caller gains ownership of the buffer and must
26370  * free it after use with g_free().
26371  *
26372  * Returns: the character data of @string (i.e. %NULL if @free_segment is %TRUE)
26373  */
26374
26375
26376 /**
26377  * g_string_free_to_bytes:
26378  * @string: (transfer full): a #GString
26379  *
26380  * Transfers ownership of the contents of @string to a newly allocated
26381  * #GBytes.  The #GString structure itself is deallocated, and it is
26382  * therefore invalid to use @string after invoking this function.
26383  *
26384  * Note that while #GString ensures that its buffer always has a
26385  * trailing nul character (not reflected in its "len"), the returned
26386  * #GBytes does not include this extra nul; i.e. it has length exactly
26387  * equal to the "len" member.
26388  *
26389  * Returns: A newly allocated #GBytes containing contents of @string; @string itself is freed
26390  * Since: 2.34
26391  */
26392
26393
26394 /**
26395  * g_string_hash:
26396  * @str: a string to hash
26397  *
26398  * Creates a hash code for @str; for use with #GHashTable.
26399  *
26400  * Returns: hash code for @str
26401  */
26402
26403
26404 /**
26405  * g_string_insert:
26406  * @string: a #GString
26407  * @pos: the position to insert the copy of the string
26408  * @val: the string to insert
26409  *
26410  * Inserts a copy of a string into a #GString,
26411  * expanding it if necessary.
26412  *
26413  * Returns: @string
26414  */
26415
26416
26417 /**
26418  * g_string_insert_c:
26419  * @string: a #GString
26420  * @pos: the position to insert the byte
26421  * @c: the byte to insert
26422  *
26423  * Inserts a byte into a #GString, expanding it if necessary.
26424  *
26425  * Returns: @string
26426  */
26427
26428
26429 /**
26430  * g_string_insert_len:
26431  * @string: a #GString
26432  * @pos: position in @string where insertion should happen, or -1 for at the end
26433  * @val: bytes to insert
26434  * @len: number of bytes of @val to insert
26435  *
26436  * Inserts @len bytes of @val into @string at @pos.
26437  * Because @len is provided, @val may contain embedded
26438  * nuls and need not be nul-terminated. If @pos is -1,
26439  * bytes are inserted at the end of the string.
26440  *
26441  * Since this function does not stop at nul bytes, it is
26442  * the caller's responsibility to ensure that @val has at
26443  * least @len addressable bytes.
26444  *
26445  * Returns: @string
26446  */
26447
26448
26449 /**
26450  * g_string_insert_unichar:
26451  * @string: a #GString
26452  * @pos: the position at which to insert character, or -1 to append at the end of the string
26453  * @wc: a Unicode character
26454  *
26455  * Converts a Unicode character into UTF-8, and insert it
26456  * into the string at the given position.
26457  *
26458  * Returns: @string
26459  */
26460
26461
26462 /**
26463  * g_string_new:
26464  * @init: the initial text to copy into the string
26465  *
26466  * Creates a new #GString, initialized with the given string.
26467  *
26468  * Returns: the new #GString
26469  */
26470
26471
26472 /**
26473  * g_string_new_len:
26474  * @init: initial contents of the string
26475  * @len: length of @init to use
26476  *
26477  * Creates a new #GString with @len bytes of the @init buffer.
26478  * Because a length is provided, @init need not be nul-terminated,
26479  * and can contain embedded nul bytes.
26480  *
26481  * Since this function does not stop at nul bytes, it is the caller's
26482  * responsibility to ensure that @init has at least @len addressable
26483  * bytes.
26484  *
26485  * Returns: a new #GString
26486  */
26487
26488
26489 /**
26490  * g_string_overwrite:
26491  * @string: a #GString
26492  * @pos: the position at which to start overwriting
26493  * @val: the string that will overwrite the @string starting at @pos
26494  *
26495  * Overwrites part of a string, lengthening it if necessary.
26496  *
26497  * Returns: @string
26498  * Since: 2.14
26499  */
26500
26501
26502 /**
26503  * g_string_overwrite_len:
26504  * @string: a #GString
26505  * @pos: the position at which to start overwriting
26506  * @val: the string that will overwrite the @string starting at @pos
26507  * @len: the number of bytes to write from @val
26508  *
26509  * Overwrites part of a string, lengthening it if necessary.
26510  * This function will work with embedded nuls.
26511  *
26512  * Returns: @string
26513  * Since: 2.14
26514  */
26515
26516
26517 /**
26518  * g_string_prepend:
26519  * @string: a #GString
26520  * @val: the string to prepend on the start of @string
26521  *
26522  * Adds a string on to the start of a #GString,
26523  * expanding it if necessary.
26524  *
26525  * Returns: @string
26526  */
26527
26528
26529 /**
26530  * g_string_prepend_c:
26531  * @string: a #GString
26532  * @c: the byte to prepend on the start of the #GString
26533  *
26534  * Adds a byte onto the start of a #GString,
26535  * expanding it if necessary.
26536  *
26537  * Returns: @string
26538  */
26539
26540
26541 /**
26542  * g_string_prepend_len:
26543  * @string: a #GString
26544  * @val: bytes to prepend
26545  * @len: number of bytes in @val to prepend
26546  *
26547  * Prepends @len bytes of @val to @string.
26548  * Because @len is provided, @val may contain
26549  * embedded nuls and need not be nul-terminated.
26550  *
26551  * Since this function does not stop at nul bytes,
26552  * it is the caller's responsibility to ensure that
26553  * @val has at least @len addressable bytes.
26554  *
26555  * Returns: @string
26556  */
26557
26558
26559 /**
26560  * g_string_prepend_unichar:
26561  * @string: a #GString
26562  * @wc: a Unicode character
26563  *
26564  * Converts a Unicode character into UTF-8, and prepends it
26565  * to the string.
26566  *
26567  * Returns: @string
26568  */
26569
26570
26571 /**
26572  * g_string_printf:
26573  * @string: a #GString
26574  * @format: the string format. See the printf() documentation
26575  * @...: the parameters to insert into the format string
26576  *
26577  * Writes a formatted string into a #GString.
26578  * This is similar to the standard sprintf() function,
26579  * except that the #GString buffer automatically expands
26580  * to contain the results. The previous contents of the
26581  * #GString are destroyed.
26582  */
26583
26584
26585 /**
26586  * g_string_set_size:
26587  * @string: a #GString
26588  * @len: the new length
26589  *
26590  * Sets the length of a #GString. If the length is less than
26591  * the current length, the string will be truncated. If the
26592  * length is greater than the current length, the contents
26593  * of the newly added area are undefined. (However, as
26594  * always, string->str[string->len] will be a nul byte.)
26595  *
26596  * Returns: @string
26597  */
26598
26599
26600 /**
26601  * g_string_sized_new:
26602  * @dfl_size: the default size of the space allocated to hold the string
26603  *
26604  * Creates a new #GString, with enough space for @dfl_size
26605  * bytes. This is useful if you are going to add a lot of
26606  * text to the string and don't want it to be reallocated
26607  * too often.
26608  *
26609  * Returns: the new #GString
26610  */
26611
26612
26613 /**
26614  * g_string_sprintf:
26615  * @string: a #GString
26616  * @format: the string format. See the sprintf() documentation
26617  * @...: the parameters to insert into the format string
26618  *
26619  * Writes a formatted string into a #GString.
26620  * This is similar to the standard sprintf() function,
26621  * except that the #GString buffer automatically expands
26622  * to contain the results. The previous contents of the
26623  * #GString are destroyed.
26624  *
26625  * Deprecated: This function has been renamed to g_string_printf().
26626  */
26627
26628
26629 /**
26630  * g_string_sprintfa:
26631  * @string: a #GString
26632  * @format: the string format. See the sprintf() documentation
26633  * @...: the parameters to insert into the format string
26634  *
26635  * Appends a formatted string onto the end of a #GString.
26636  * This function is similar to g_string_sprintf() except that
26637  * the text is appended to the #GString.
26638  *
26639  * Deprecated: This function has been renamed to g_string_append_printf()
26640  */
26641
26642
26643 /**
26644  * g_string_truncate:
26645  * @string: a #GString
26646  * @len: the new size of @string
26647  *
26648  * Cuts off the end of the GString, leaving the first @len bytes.
26649  *
26650  * Returns: @string
26651  */
26652
26653
26654 /**
26655  * g_string_up:
26656  * @string: a #GString
26657  *
26658  * Converts a #GString to uppercase.
26659  *
26660  * Returns: @string
26661  * Deprecated: 2.2: This function uses the locale-specific toupper() function, which is almost never the right thing. Use g_string_ascii_up() or g_utf8_strup() instead.
26662  */
26663
26664
26665 /**
26666  * g_string_vprintf:
26667  * @string: a #GString
26668  * @format: the string format. See the printf() documentation
26669  * @args: the parameters to insert into the format string
26670  *
26671  * Writes a formatted string into a #GString.
26672  * This function is similar to g_string_printf() except that
26673  * the arguments to the format string are passed as a va_list.
26674  *
26675  * Since: 2.14
26676  */
26677
26678
26679 /**
26680  * g_strip_context:
26681  * @msgid: a string
26682  * @msgval: another string
26683  *
26684  * An auxiliary function for gettext() support (see Q_()).
26685  *
26686  * Returns: @msgval, unless @msgval is identical to @msgid and contains a '|' character, in which case a pointer to the substring of msgid after the first '|' character is returned.
26687  * Since: 2.4
26688  */
26689
26690
26691 /**
26692  * g_strjoin:
26693  * @separator: (allow-none): a string to insert between each of the strings, or %NULL
26694  * @...: a %NULL-terminated list of strings to join
26695  *
26696  * Joins a number of strings together to form one long string, with the
26697  * optional @separator inserted between each of them. The returned string
26698  * should be freed with g_free().
26699  *
26700  * Returns: a newly-allocated string containing all of the strings joined together, with @separator between them
26701  */
26702
26703
26704 /**
26705  * g_strjoinv:
26706  * @separator: (allow-none): a string to insert between each of the strings, or %NULL
26707  * @str_array: a %NULL-terminated array of strings to join
26708  *
26709  * Joins a number of strings together to form one long string, with the
26710  * optional @separator inserted between each of them. The returned string
26711  * should be freed with g_free().
26712  *
26713  * Returns: a newly-allocated string containing all of the strings joined together, with @separator between them
26714  */
26715
26716
26717 /**
26718  * g_strlcat:
26719  * @dest: destination buffer, already containing one nul-terminated string
26720  * @src: source buffer
26721  * @dest_size: length of @dest buffer in bytes (not length of existing string inside @dest)
26722  *
26723  * Portability wrapper that calls strlcat() on systems which have it,
26724  * and emulates it otherwise. Appends nul-terminated @src string to @dest,
26725  * guaranteeing nul-termination for @dest. The total size of @dest won't
26726  * exceed @dest_size.
26727  *
26728  * At most dest_size - 1 characters will be copied.
26729  * Unlike strncat, dest_size is the full size of dest, not the space left over.
26730  * This function does NOT allocate memory.
26731  * This always NUL terminates (unless siz == 0 or there were no NUL characters
26732  * in the dest_size characters of dest to start with).
26733  *
26734  * <note><para>Caveat: this is supposedly a more secure alternative to
26735  * strcat() or strncat(), but for real security g_strconcat() is harder
26736  * to mess up.</para></note>
26737  *
26738  * Returns: size of attempted result, which is MIN (dest_size, strlen (original dest)) + strlen (src), so if retval >= dest_size, truncation occurred.
26739  */
26740
26741
26742 /**
26743  * g_strlcpy:
26744  * @dest: destination buffer
26745  * @src: source buffer
26746  * @dest_size: length of @dest in bytes
26747  *
26748  * Portability wrapper that calls strlcpy() on systems which have it,
26749  * and emulates strlcpy() otherwise. Copies @src to @dest; @dest is
26750  * guaranteed to be nul-terminated; @src must be nul-terminated;
26751  * @dest_size is the buffer size, not the number of chars to copy.
26752  *
26753  * At most dest_size - 1 characters will be copied. Always nul-terminates
26754  * (unless dest_size == 0). This function does <emphasis>not</emphasis>
26755  * allocate memory. Unlike strncpy(), this function doesn't pad dest (so
26756  * it's often faster). It returns the size of the attempted result,
26757  * strlen (src), so if @retval >= @dest_size, truncation occurred.
26758  *
26759  * <note><para>Caveat: strlcpy() is supposedly more secure than
26760  * strcpy() or strncpy(), but if you really want to avoid screwups,
26761  * g_strdup() is an even better idea.</para></note>
26762  *
26763  * Returns: length of @src
26764  */
26765
26766
26767 /**
26768  * g_strncasecmp:
26769  * @s1: a string.
26770  * @s2: a string to compare with @s1.
26771  * @n: the maximum number of characters to compare.
26772  *
26773  * A case-insensitive string comparison, corresponding to the standard
26774  * strncasecmp() function on platforms which support it.
26775  * It is similar to g_strcasecmp() except it only compares the first @n
26776  * characters of the strings.
26777  *
26778  * Returns: 0 if the strings match, a negative value if @s1 &lt; @s2, or a positive value if @s1 &gt; @s2.
26779  * Deprecated: 2.2: The problem with g_strncasecmp() is that it does the comparison by calling toupper()/tolower(). These functions are locale-specific and operate on single bytes. However, it is impossible to handle things correctly from an I18N standpoint by operating on bytes, since characters may be multibyte. Thus g_strncasecmp() is broken if your string is guaranteed to be ASCII, since it's locale-sensitive, and it's broken if your string is localized, since it doesn't work on many encodings at all, including UTF-8, EUC-JP, etc.  There are therefore two replacement functions: g_ascii_strncasecmp(), which only works on ASCII and is not locale-sensitive, and g_utf8_casefold(), which is good for case-insensitive sorting of UTF-8.
26780  */
26781
26782
26783 /**
26784  * g_strndup:
26785  * @str: the string to duplicate
26786  * @n: the maximum number of bytes to copy from @str
26787  *
26788  * Duplicates the first @n bytes of a string, returning a newly-allocated
26789  * buffer @n + 1 bytes long which will always be nul-terminated.
26790  * If @str is less than @n bytes long the buffer is padded with nuls.
26791  * If @str is %NULL it returns %NULL.
26792  * The returned value should be freed when no longer needed.
26793  *
26794  * <note><para>
26795  * To copy a number of characters from a UTF-8 encoded string, use
26796  * g_utf8_strncpy() instead.
26797  * </para></note>
26798  *
26799  * Returns: a newly-allocated buffer containing the first @n bytes of @str, nul-terminated
26800  */
26801
26802
26803 /**
26804  * g_strnfill:
26805  * @length: the length of the new string
26806  * @fill_char: the byte to fill the string with
26807  *
26808  * Creates a new string @length bytes long filled with @fill_char.
26809  * The returned string should be freed when no longer needed.
26810  *
26811  * Returns: a newly-allocated string filled the @fill_char
26812  */
26813
26814
26815 /**
26816  * g_strreverse:
26817  * @string: the string to reverse
26818  *
26819  * Reverses all of the bytes in a string. For example,
26820  * <literal>g_strreverse ("abcdef")</literal> will result
26821  * in "fedcba".
26822  *
26823  * Note that g_strreverse() doesn't work on UTF-8 strings
26824  * containing multibyte characters. For that purpose, use
26825  * g_utf8_strreverse().
26826  *
26827  * Returns: the same pointer passed in as @string
26828  */
26829
26830
26831 /**
26832  * g_strrstr:
26833  * @haystack: a nul-terminated string
26834  * @needle: the nul-terminated string to search for
26835  *
26836  * Searches the string @haystack for the last occurrence
26837  * of the string @needle.
26838  *
26839  * Returns: a pointer to the found occurrence, or %NULL if not found.
26840  */
26841
26842
26843 /**
26844  * g_strrstr_len:
26845  * @haystack: a nul-terminated string
26846  * @haystack_len: the maximum length of @haystack
26847  * @needle: the nul-terminated string to search for
26848  *
26849  * Searches the string @haystack for the last occurrence
26850  * of the string @needle, limiting the length of the search
26851  * to @haystack_len.
26852  *
26853  * Returns: a pointer to the found occurrence, or %NULL if not found.
26854  */
26855
26856
26857 /**
26858  * g_strsignal:
26859  * @signum: the signal number. See the <literal>signal</literal> documentation
26860  *
26861  * Returns a string describing the given signal, e.g. "Segmentation fault".
26862  * You should use this function in preference to strsignal(), because it
26863  * returns a string in UTF-8 encoding, and since not all platforms support
26864  * the strsignal() function.
26865  *
26866  * Returns: a UTF-8 string describing the signal. If the signal is unknown, it returns "unknown signal (&lt;signum&gt;)".
26867  */
26868
26869
26870 /**
26871  * g_strsplit:
26872  * @string: a string to split
26873  * @delimiter: a string which specifies the places at which to split the string. The delimiter is not included in any of the resulting strings, unless @max_tokens is reached.
26874  * @max_tokens: the maximum number of pieces to split @string into. If this is less than 1, the string is split completely.
26875  *
26876  * Splits a string into a maximum of @max_tokens pieces, using the given
26877  * @delimiter. If @max_tokens is reached, the remainder of @string is
26878  * appended to the last token.
26879  *
26880  * As a special case, the result of splitting the empty string "" is an empty
26881  * vector, not a vector containing a single string. The reason for this
26882  * special case is that being able to represent a empty vector is typically
26883  * more useful than consistent handling of empty elements. If you do need
26884  * to represent empty elements, you'll need to check for the empty string
26885  * before calling g_strsplit().
26886  *
26887  * Returns: a newly-allocated %NULL-terminated array of strings. Use g_strfreev() to free it.
26888  */
26889
26890
26891 /**
26892  * g_strsplit_set:
26893  * @string: The string to be tokenized
26894  * @delimiters: A nul-terminated string containing bytes that are used to split the string.
26895  * @max_tokens: The maximum number of tokens to split @string into. If this is less than 1, the string is split completely
26896  *
26897  * Splits @string into a number of tokens not containing any of the characters
26898  * in @delimiter. A token is the (possibly empty) longest string that does not
26899  * contain any of the characters in @delimiters. If @max_tokens is reached, the
26900  * remainder is appended to the last token.
26901  *
26902  * For example the result of g_strsplit_set ("abc:def/ghi", ":/", -1) is a
26903  * %NULL-terminated vector containing the three strings "abc", "def",
26904  * and "ghi".
26905  *
26906  * The result if g_strsplit_set (":def/ghi:", ":/", -1) is a %NULL-terminated
26907  * vector containing the four strings "", "def", "ghi", and "".
26908  *
26909  * As a special case, the result of splitting the empty string "" is an empty
26910  * vector, not a vector containing a single string. The reason for this
26911  * special case is that being able to represent a empty vector is typically
26912  * more useful than consistent handling of empty elements. If you do need
26913  * to represent empty elements, you'll need to check for the empty string
26914  * before calling g_strsplit_set().
26915  *
26916  * Note that this function works on bytes not characters, so it can't be used
26917  * to delimit UTF-8 strings for anything but ASCII characters.
26918  *
26919  * Returns: a newly-allocated %NULL-terminated array of strings. Use g_strfreev() to free it.
26920  * Since: 2.4
26921  */
26922
26923
26924 /**
26925  * g_strstr_len:
26926  * @haystack: a string
26927  * @haystack_len: the maximum length of @haystack. Note that -1 is a valid length, if @haystack is nul-terminated, meaning it will search through the whole string.
26928  * @needle: the string to search for
26929  *
26930  * Searches the string @haystack for the first occurrence
26931  * of the string @needle, limiting the length of the search
26932  * to @haystack_len.
26933  *
26934  * Returns: a pointer to the found occurrence, or %NULL if not found.
26935  */
26936
26937
26938 /**
26939  * g_strstrip:
26940  * @string: a string to remove the leading and trailing whitespace from
26941  *
26942  * Removes leading and trailing whitespace from a string.
26943  * See g_strchomp() and g_strchug().
26944  *
26945  * Returns: @string
26946  */
26947
26948
26949 /**
26950  * g_strtod:
26951  * @nptr: the string to convert to a numeric value.
26952  * @endptr: if non-%NULL, it returns the character after the last character used in the conversion.
26953  *
26954  * Converts a string to a #gdouble value.
26955  * It calls the standard strtod() function to handle the conversion, but
26956  * if the string is not completely converted it attempts the conversion
26957  * again with g_ascii_strtod(), and returns the best match.
26958  *
26959  * This function should seldom be used. The normal situation when reading
26960  * numbers not for human consumption is to use g_ascii_strtod(). Only when
26961  * you know that you must expect both locale formatted and C formatted numbers
26962  * should you use this. Make sure that you don't pass strings such as comma
26963  * separated lists of values, since the commas may be interpreted as a decimal
26964  * point in some locales, causing unexpected results.
26965  *
26966  * Returns: the #gdouble value.
26967  */
26968
26969
26970 /**
26971  * g_strup:
26972  * @string: the string to convert.
26973  *
26974  * Converts a string to upper case.
26975  *
26976  * Returns: the string
26977  * Deprecated: 2.2: This function is totally broken for the reasons discussed in the g_strncasecmp() docs - use g_ascii_strup() or g_utf8_strup() instead.
26978  */
26979
26980
26981 /**
26982  * g_strv_length:
26983  * @str_array: a %NULL-terminated array of strings
26984  *
26985  * Returns the length of the given %NULL-terminated
26986  * string array @str_array.
26987  *
26988  * Returns: length of @str_array.
26989  * Since: 2.6
26990  */
26991
26992
26993 /**
26994  * g_test_add:
26995  * @testpath: The test path for a new test case.
26996  * @Fixture: The type of a fixture data structure.
26997  * @tdata: Data argument for the test functions.
26998  * @fsetup: The function to set up the fixture data.
26999  * @ftest: The actual test function.
27000  * @fteardown: The function to tear down the fixture data.
27001  *
27002  * Hook up a new test case at @testpath, similar to g_test_add_func().
27003  * A fixture data structure with setup and teardown function may be provided
27004  * though, similar to g_test_create_case().
27005  * g_test_add() is implemented as a macro, so that the fsetup(), ftest() and
27006  * fteardown() callbacks can expect a @Fixture pointer as first argument in
27007  * a type safe manner.
27008  *
27009  * Since: 2.16
27010  */
27011
27012
27013 /**
27014  * g_test_add_data_func:
27015  * @testpath: /-separated test case path name for the test.
27016  * @test_data: Test data argument for the test function.
27017  * @test_func: The test function to invoke for this test.
27018  *
27019  * Create a new test case, similar to g_test_create_case(). However
27020  * the test is assumed to use no fixture, and test suites are automatically
27021  * created on the fly and added to the root fixture, based on the
27022  * slash-separated portions of @testpath. The @test_data argument
27023  * will be passed as first argument to @test_func.
27024  *
27025  * Since: 2.16
27026  */
27027
27028
27029 /**
27030  * g_test_add_data_func_full:
27031  * @testpath: /-separated test case path name for the test.
27032  * @test_data: Test data argument for the test function.
27033  * @test_func: The test function to invoke for this test.
27034  * @data_free_func: #GDestroyNotify for @test_data.
27035  *
27036  * Create a new test case, as with g_test_add_data_func(), but freeing
27037  * @test_data after the test run is complete.
27038  *
27039  * Since: 2.34
27040  */
27041
27042
27043 /**
27044  * g_test_add_func:
27045  * @testpath: /-separated test case path name for the test.
27046  * @test_func: The test function to invoke for this test.
27047  *
27048  * Create a new test case, similar to g_test_create_case(). However
27049  * the test is assumed to use no fixture, and test suites are automatically
27050  * created on the fly and added to the root fixture, based on the
27051  * slash-separated portions of @testpath.
27052  *
27053  * Since: 2.16
27054  */
27055
27056
27057 /**
27058  * g_test_assert_expected_messages:
27059  *
27060  * Asserts that all messages previously indicated via
27061  * g_test_expect_message() have been seen and suppressed.
27062  *
27063  * Since: 2.34
27064  */
27065
27066
27067 /**
27068  * g_test_bug:
27069  * @bug_uri_snippet: Bug specific bug tracker URI portion.
27070  *
27071  * This function adds a message to test reports that
27072  * associates a bug URI with a test case.
27073  * Bug URIs are constructed from a base URI set with g_test_bug_base()
27074  * and @bug_uri_snippet.
27075  *
27076  * Since: 2.16
27077  */
27078
27079
27080 /**
27081  * g_test_bug_base:
27082  * @uri_pattern: the base pattern for bug URIs
27083  *
27084  * Specify the base URI for bug reports.
27085  *
27086  * The base URI is used to construct bug report messages for
27087  * g_test_message() when g_test_bug() is called.
27088  * Calling this function outside of a test case sets the
27089  * default base URI for all test cases. Calling it from within
27090  * a test case changes the base URI for the scope of the test
27091  * case only.
27092  * Bug URIs are constructed by appending a bug specific URI
27093  * portion to @uri_pattern, or by replacing the special string
27094  * '\%s' within @uri_pattern if that is present.
27095  *
27096  * Since: 2.16
27097  */
27098
27099
27100 /**
27101  * g_test_create_case:
27102  * @test_name: the name for the test case
27103  * @data_size: the size of the fixture data structure
27104  * @test_data: test data argument for the test functions
27105  * @data_setup: the function to set up the fixture data
27106  * @data_test: the actual test function
27107  * @data_teardown: the function to teardown the fixture data
27108  *
27109  * Create a new #GTestCase, named @test_name, this API is fairly
27110  * low level, calling g_test_add() or g_test_add_func() is preferable.
27111  * When this test is executed, a fixture structure of size @data_size
27112  * will be allocated and filled with 0s. Then @data_setup is called
27113  * to initialize the fixture. After fixture setup, the actual test
27114  * function @data_test is called. Once the test run completed, the
27115  * fixture structure is torn down  by calling @data_teardown and
27116  * after that the memory is released.
27117  *
27118  * Splitting up a test run into fixture setup, test function and
27119  * fixture teardown is most usful if the same fixture is used for
27120  * multiple tests. In this cases, g_test_create_case() will be
27121  * called with the same fixture, but varying @test_name and
27122  * @data_test arguments.
27123  *
27124  * Returns: a newly allocated #GTestCase.
27125  * Since: 2.16
27126  */
27127
27128
27129 /**
27130  * g_test_create_suite:
27131  * @suite_name: a name for the suite
27132  *
27133  * Create a new test suite with the name @suite_name.
27134  *
27135  * Returns: A newly allocated #GTestSuite instance.
27136  * Since: 2.16
27137  */
27138
27139
27140 /**
27141  * g_test_expect_message:
27142  * @log_domain: the log domain of the message
27143  * @log_level: the log level of the message
27144  * @pattern: a glob-style <link linkend="glib-Glob-style-pattern-matching">pattern</link>
27145  *
27146  * Indicates that a message with the given @log_domain and @log_level,
27147  * with text matching @pattern, is expected to be logged. When this
27148  * message is logged, it will not be printed, and the test case will
27149  * not abort.
27150  *
27151  * Use g_test_assert_expected_messages() to assert that all
27152  * previously-expected messages have been seen and suppressed.
27153  *
27154  * You can call this multiple times in a row, if multiple messages are
27155  * expected as a result of a single call. (The messages must appear in
27156  * the same order as the calls to g_test_expect_message().)
27157  *
27158  * For example:
27159  *
27160  * |[
27161  *   /&ast; g_main_context_push_thread_default() should fail if the
27162  *    &ast; context is already owned by another thread.
27163  *    &ast;/
27164  *   g_test_expect_message (G_LOG_DOMAIN,
27165  *                          G_LOG_LEVEL_CRITICAL,
27166  *                          "assertion.*acquired_context.*failed");
27167  *   g_main_context_push_thread_default (bad_context);
27168  *   g_test_assert_expected_messages ();
27169  * ]|
27170  *
27171  * Note that you cannot use this to test g_error() messages, since
27172  * g_error() intentionally never returns even if the program doesn't
27173  * abort; use g_test_trap_fork() in this case.
27174  *
27175  * Since: 2.34
27176  */
27177
27178
27179 /**
27180  * g_test_fail:
27181  *
27182  * Indicates that a test failed. This function can be called
27183  * multiple times from the same test. You can use this function
27184  * if your test failed in a recoverable way.
27185  *
27186  * Do not use this function if the failure of a test could cause
27187  * other tests to malfunction.
27188  *
27189  * Calling this function will not stop the test from running, you
27190  * need to return from the test function yourself. So you can
27191  * produce additional diagnostic messages or even continue running
27192  * the test.
27193  *
27194  * If not called from inside a test, this function does nothing.
27195  *
27196  * Since: 2.30
27197  */
27198
27199
27200 /**
27201  * g_test_get_root:
27202  *
27203  * Get the toplevel test suite for the test path API.
27204  *
27205  * Returns: the toplevel #GTestSuite
27206  * Since: 2.16
27207  */
27208
27209
27210 /**
27211  * g_test_init:
27212  * @argc: Address of the @argc parameter of the main() function. Changed if any arguments were handled.
27213  * @argv: Address of the @argv parameter of main(). Any parameters understood by g_test_init() stripped before return.
27214  * @...: Reserved for future extension. Currently, you must pass %NULL.
27215  *
27216  * Initialize the GLib testing framework, e.g. by seeding the
27217  * test random number generator, the name for g_get_prgname()
27218  * and parsing test related command line args.
27219  * So far, the following arguments are understood:
27220  * <variablelist>
27221  *   <varlistentry>
27222  *     <term><option>-l</option></term>
27223  *     <listitem><para>
27224  *       List test cases available in a test executable.
27225  *     </para></listitem>
27226  *   </varlistentry>
27227  *   <varlistentry>
27228  *     <term><option>--seed=<replaceable>RANDOMSEED</replaceable></option></term>
27229  *     <listitem><para>
27230  *       Provide a random seed to reproduce test runs using random numbers.
27231  *     </para></listitem>
27232  *     </varlistentry>
27233  *     <varlistentry>
27234  *       <term><option>--verbose</option></term>
27235  *       <listitem><para>Run tests verbosely.</para></listitem>
27236  *     </varlistentry>
27237  *     <varlistentry>
27238  *       <term><option>-q</option>, <option>--quiet</option></term>
27239  *       <listitem><para>Run tests quietly.</para></listitem>
27240  *     </varlistentry>
27241  *     <varlistentry>
27242  *       <term><option>-p <replaceable>TESTPATH</replaceable></option></term>
27243  *       <listitem><para>
27244  *         Execute all tests matching <replaceable>TESTPATH</replaceable>.
27245  *       </para></listitem>
27246  *     </varlistentry>
27247  *     <varlistentry>
27248  *       <term><option>-m {perf|slow|thorough|quick|undefined|no-undefined}</option></term>
27249  *       <listitem><para>
27250  *         Execute tests according to these test modes:
27251  *         <variablelist>
27252  *           <varlistentry>
27253  *             <term>perf</term>
27254  *             <listitem><para>
27255  *               Performance tests, may take long and report results.
27256  *             </para></listitem>
27257  *           </varlistentry>
27258  *           <varlistentry>
27259  *             <term>slow, thorough</term>
27260  *             <listitem><para>
27261  *               Slow and thorough tests, may take quite long and
27262  *               maximize coverage.
27263  *             </para></listitem>
27264  *           </varlistentry>
27265  *           <varlistentry>
27266  *             <term>quick</term>
27267  *             <listitem><para>
27268  *               Quick tests, should run really quickly and give good coverage.
27269  *             </para></listitem>
27270  *           </varlistentry>
27271  *           <varlistentry>
27272  *             <term>undefined</term>
27273  *             <listitem><para>
27274  *               Tests for undefined behaviour, may provoke programming errors
27275  *               under g_test_trap_fork() to check that appropriate assertions
27276  *               or warnings are given
27277  *             </para></listitem>
27278  *           </varlistentry>
27279  *           <varlistentry>
27280  *             <term>no-undefined</term>
27281  *             <listitem><para>
27282  *               Avoid tests for undefined behaviour
27283  *             </para></listitem>
27284  *           </varlistentry>
27285  *         </variablelist>
27286  *       </para></listitem>
27287  *     </varlistentry>
27288  *     <varlistentry>
27289  *       <term><option>--debug-log</option></term>
27290  *       <listitem><para>Debug test logging output.</para></listitem>
27291  *     </varlistentry>
27292  *  </variablelist>
27293  *
27294  * Since: 2.16
27295  */
27296
27297
27298 /**
27299  * g_test_log_buffer_free:
27300  *
27301  * Internal function for gtester to free test log messages, no ABI guarantees provided.
27302  */
27303
27304
27305 /**
27306  * g_test_log_buffer_new:
27307  *
27308  * Internal function for gtester to decode test log messages, no ABI guarantees provided.
27309  */
27310
27311
27312 /**
27313  * g_test_log_buffer_pop:
27314  *
27315  * Internal function for gtester to retrieve test log messages, no ABI guarantees provided.
27316  */
27317
27318
27319 /**
27320  * g_test_log_buffer_push:
27321  *
27322  * Internal function for gtester to decode test log messages, no ABI guarantees provided.
27323  */
27324
27325
27326 /**
27327  * g_test_log_msg_free:
27328  *
27329  * Internal function for gtester to free test log messages, no ABI guarantees provided.
27330  */
27331
27332
27333 /**
27334  * g_test_log_set_fatal_handler:
27335  * @log_func: the log handler function.
27336  * @user_data: data passed to the log handler.
27337  *
27338  * Installs a non-error fatal log handler which can be
27339  * used to decide whether log messages which are counted
27340  * as fatal abort the program.
27341  *
27342  * The use case here is that you are running a test case
27343  * that depends on particular libraries or circumstances
27344  * and cannot prevent certain known critical or warning
27345  * messages. So you install a handler that compares the
27346  * domain and message to precisely not abort in such a case.
27347  *
27348  * Note that the handler is reset at the beginning of
27349  * any test case, so you have to set it inside each test
27350  * function which needs the special behavior.
27351  *
27352  * This handler has no effect on g_error messages.
27353  *
27354  * Since: 2.22
27355  */
27356
27357
27358 /**
27359  * g_test_maximized_result:
27360  * @maximized_quantity: the reported value
27361  * @format: the format string of the report message
27362  * @...: arguments to pass to the printf() function
27363  *
27364  * Report the result of a performance or measurement test.
27365  * The test should generally strive to maximize the reported
27366  * quantities (larger values are better than smaller ones),
27367  * this and @maximized_quantity can determine sorting
27368  * order for test result reports.
27369  *
27370  * Since: 2.16
27371  */
27372
27373
27374 /**
27375  * g_test_message:
27376  * @format: the format string
27377  * @...: printf-like arguments to @format
27378  *
27379  * Add a message to the test report.
27380  *
27381  * Since: 2.16
27382  */
27383
27384
27385 /**
27386  * g_test_minimized_result:
27387  * @minimized_quantity: the reported value
27388  * @format: the format string of the report message
27389  * @...: arguments to pass to the printf() function
27390  *
27391  * Report the result of a performance or measurement test.
27392  * The test should generally strive to minimize the reported
27393  * quantities (smaller values are better than larger ones),
27394  * this and @minimized_quantity can determine sorting
27395  * order for test result reports.
27396  *
27397  * Since: 2.16
27398  */
27399
27400
27401 /**
27402  * g_test_perf:
27403  *
27404  * Returns %TRUE if tests are run in performance mode.
27405  *
27406  * Returns: %TRUE if in performance mode
27407  */
27408
27409
27410 /**
27411  * g_test_queue_destroy:
27412  * @destroy_func: Destroy callback for teardown phase.
27413  * @destroy_data: Destroy callback data.
27414  *
27415  * This function enqueus a callback @destroy_func to be executed
27416  * during the next test case teardown phase. This is most useful
27417  * to auto destruct allocted test resources at the end of a test run.
27418  * Resources are released in reverse queue order, that means enqueueing
27419  * callback A before callback B will cause B() to be called before
27420  * A() during teardown.
27421  *
27422  * Since: 2.16
27423  */
27424
27425
27426 /**
27427  * g_test_queue_free:
27428  * @gfree_pointer: the pointer to be stored.
27429  *
27430  * Enqueue a pointer to be released with g_free() during the next
27431  * teardown phase. This is equivalent to calling g_test_queue_destroy()
27432  * with a destroy callback of g_free().
27433  *
27434  * Since: 2.16
27435  */
27436
27437
27438 /**
27439  * g_test_queue_unref:
27440  * @gobject: the object to unref
27441  *
27442  * Enqueue an object to be released with g_object_unref() during
27443  * the next teardown phase. This is equivalent to calling
27444  * g_test_queue_destroy() with a destroy callback of g_object_unref().
27445  *
27446  * Since: 2.16
27447  */
27448
27449
27450 /**
27451  * g_test_quick:
27452  *
27453  * Returns %TRUE if tests are run in quick mode.
27454  * Exactly one of g_test_quick() and g_test_slow() is active in any run;
27455  * there is no "medium speed".
27456  *
27457  * Returns: %TRUE if in quick mode
27458  */
27459
27460
27461 /**
27462  * g_test_quiet:
27463  *
27464  * Returns %TRUE if tests are run in quiet mode.
27465  * The default is neither g_test_verbose() nor g_test_quiet().
27466  *
27467  * Returns: %TRUE if in quiet mode
27468  */
27469
27470
27471 /**
27472  * g_test_rand_bit:
27473  *
27474  * Get a reproducible random bit (0 or 1), see g_test_rand_int()
27475  * for details on test case random numbers.
27476  *
27477  * Since: 2.16
27478  */
27479
27480
27481 /**
27482  * g_test_rand_double:
27483  *
27484  * Get a reproducible random floating point number,
27485  * see g_test_rand_int() for details on test case random numbers.
27486  *
27487  * Returns: a random number from the seeded random number generator.
27488  * Since: 2.16
27489  */
27490
27491
27492 /**
27493  * g_test_rand_double_range:
27494  * @range_start: the minimum value returned by this function
27495  * @range_end: the minimum value not returned by this function
27496  *
27497  * Get a reproducible random floating pointer number out of a specified range,
27498  * see g_test_rand_int() for details on test case random numbers.
27499  *
27500  * Returns: a number with @range_start <= number < @range_end.
27501  * Since: 2.16
27502  */
27503
27504
27505 /**
27506  * g_test_rand_int:
27507  *
27508  * Get a reproducible random integer number.
27509  *
27510  * The random numbers generated by the g_test_rand_*() family of functions
27511  * change with every new test program start, unless the --seed option is
27512  * given when starting test programs.
27513  *
27514  * For individual test cases however, the random number generator is
27515  * reseeded, to avoid dependencies between tests and to make --seed
27516  * effective for all test cases.
27517  *
27518  * Returns: a random number from the seeded random number generator.
27519  * Since: 2.16
27520  */
27521
27522
27523 /**
27524  * g_test_rand_int_range:
27525  * @begin: the minimum value returned by this function
27526  * @end: the smallest value not to be returned by this function
27527  *
27528  * Get a reproducible random integer number out of a specified range,
27529  * see g_test_rand_int() for details on test case random numbers.
27530  *
27531  * Returns: a number with @begin <= number < @end.
27532  * Since: 2.16
27533  */
27534
27535
27536 /**
27537  * g_test_run:
27538  *
27539  * Runs all tests under the toplevel suite which can be retrieved
27540  * with g_test_get_root(). Similar to g_test_run_suite(), the test
27541  * cases to be run are filtered according to
27542  * test path arguments (-p <replaceable>testpath</replaceable>) as
27543  * parsed by g_test_init().
27544  * g_test_run_suite() or g_test_run() may only be called once
27545  * in a program.
27546  *
27547  * Returns: 0 on success
27548  * Since: 2.16
27549  */
27550
27551
27552 /**
27553  * g_test_run_suite:
27554  * @suite: a #GTestSuite
27555  *
27556  * Execute the tests within @suite and all nested #GTestSuites.
27557  * The test suites to be executed are filtered according to
27558  * test path arguments (-p <replaceable>testpath</replaceable>)
27559  * as parsed by g_test_init().
27560  * g_test_run_suite() or g_test_run() may only be called once
27561  * in a program.
27562  *
27563  * Returns: 0 on success
27564  * Since: 2.16
27565  */
27566
27567
27568 /**
27569  * g_test_slow:
27570  *
27571  * Returns %TRUE if tests are run in slow mode.
27572  * Exactly one of g_test_quick() and g_test_slow() is active in any run;
27573  * there is no "medium speed".
27574  *
27575  * Returns: the opposite of g_test_quick()
27576  */
27577
27578
27579 /**
27580  * g_test_suite_add:
27581  * @suite: a #GTestSuite
27582  * @test_case: a #GTestCase
27583  *
27584  * Adds @test_case to @suite.
27585  *
27586  * Since: 2.16
27587  */
27588
27589
27590 /**
27591  * g_test_suite_add_suite:
27592  * @suite: a #GTestSuite
27593  * @nestedsuite: another #GTestSuite
27594  *
27595  * Adds @nestedsuite to @suite.
27596  *
27597  * Since: 2.16
27598  */
27599
27600
27601 /**
27602  * g_test_thorough:
27603  *
27604  * Returns %TRUE if tests are run in thorough mode, equivalent to
27605  * g_test_slow().
27606  *
27607  * Returns: the same thing as g_test_slow()
27608  */
27609
27610
27611 /**
27612  * g_test_timer_elapsed:
27613  *
27614  * Get the time since the last start of the timer with g_test_timer_start().
27615  *
27616  * Returns: the time since the last start of the timer, as a double
27617  * Since: 2.16
27618  */
27619
27620
27621 /**
27622  * g_test_timer_last:
27623  *
27624  * Report the last result of g_test_timer_elapsed().
27625  *
27626  * Returns: the last result of g_test_timer_elapsed(), as a double
27627  * Since: 2.16
27628  */
27629
27630
27631 /**
27632  * g_test_timer_start:
27633  *
27634  * Start a timing test. Call g_test_timer_elapsed() when the task is supposed
27635  * to be done. Call this function again to restart the timer.
27636  *
27637  * Since: 2.16
27638  */
27639
27640
27641 /**
27642  * g_test_trap_assert_failed:
27643  *
27644  * Assert that the last forked test failed.
27645  * See g_test_trap_fork().
27646  *
27647  * This is sometimes used to test situations that are formally considered to
27648  * be undefined behaviour, like inputs that fail a g_return_if_fail()
27649  * check. In these situations you should skip the entire test, including the
27650  * call to g_test_trap_fork(), unless g_test_undefined() returns %TRUE
27651  * to indicate that undefined behaviour may be tested.
27652  *
27653  * Since: 2.16
27654  */
27655
27656
27657 /**
27658  * g_test_trap_assert_passed:
27659  *
27660  * Assert that the last forked test passed.
27661  * See g_test_trap_fork().
27662  *
27663  * Since: 2.16
27664  */
27665
27666
27667 /**
27668  * g_test_trap_assert_stderr:
27669  * @serrpattern: a glob-style <link linkend="glib-Glob-style-pattern-matching">pattern</link>
27670  *
27671  * Assert that the stderr output of the last forked test
27672  * matches @serrpattern. See  g_test_trap_fork().
27673  *
27674  * This is sometimes used to test situations that are formally considered to
27675  * be undefined behaviour, like inputs that fail a g_return_if_fail()
27676  * check. In these situations you should skip the entire test, including the
27677  * call to g_test_trap_fork(), unless g_test_undefined() returns %TRUE
27678  * to indicate that undefined behaviour may be tested.
27679  *
27680  * Since: 2.16
27681  */
27682
27683
27684 /**
27685  * g_test_trap_assert_stderr_unmatched:
27686  * @serrpattern: a glob-style <link linkend="glib-Glob-style-pattern-matching">pattern</link>
27687  *
27688  * Assert that the stderr output of the last forked test
27689  * does not match @serrpattern. See g_test_trap_fork().
27690  *
27691  * Since: 2.16
27692  */
27693
27694
27695 /**
27696  * g_test_trap_assert_stdout:
27697  * @soutpattern: a glob-style <link linkend="glib-Glob-style-pattern-matching">pattern</link>
27698  *
27699  * Assert that the stdout output of the last forked test matches
27700  * @soutpattern. See g_test_trap_fork().
27701  *
27702  * Since: 2.16
27703  */
27704
27705
27706 /**
27707  * g_test_trap_assert_stdout_unmatched:
27708  * @soutpattern: a glob-style <link linkend="glib-Glob-style-pattern-matching">pattern</link>
27709  *
27710  * Assert that the stdout output of the last forked test
27711  * does not match @soutpattern. See g_test_trap_fork().
27712  *
27713  * Since: 2.16
27714  */
27715
27716
27717 /**
27718  * g_test_trap_fork:
27719  * @usec_timeout: Timeout for the forked test in micro seconds.
27720  * @test_trap_flags: Flags to modify forking behaviour.
27721  *
27722  * Fork the current test program to execute a test case that might
27723  * not return or that might abort. The forked test case is aborted
27724  * and considered failing if its run time exceeds @usec_timeout.
27725  *
27726  * The forking behavior can be configured with the #GTestTrapFlags flags.
27727  *
27728  * In the following example, the test code forks, the forked child
27729  * process produces some sample output and exits successfully.
27730  * The forking parent process then asserts successful child program
27731  * termination and validates child program outputs.
27732  *
27733  * |[
27734  *   static void
27735  *   test_fork_patterns (void)
27736  *   {
27737  *     if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
27738  *       {
27739  *         g_print ("some stdout text: somagic17\n");
27740  *         g_printerr ("some stderr text: semagic43\n");
27741  *         exit (0); /&ast; successful test run &ast;/
27742  *       }
27743  *     g_test_trap_assert_passed();
27744  *     g_test_trap_assert_stdout ("*somagic17*");
27745  *     g_test_trap_assert_stderr ("*semagic43*");
27746  *   }
27747  * ]|
27748  *
27749  * This function is implemented only on Unix platforms.
27750  *
27751  * Returns: %TRUE for the forked child and %FALSE for the executing parent process.
27752  * Since: 2.16
27753  */
27754
27755
27756 /**
27757  * g_test_trap_has_passed:
27758  *
27759  * Check the result of the last g_test_trap_fork() call.
27760  *
27761  * Returns: %TRUE if the last forked child terminated successfully.
27762  * Since: 2.16
27763  */
27764
27765
27766 /**
27767  * g_test_trap_reached_timeout:
27768  *
27769  * Check the result of the last g_test_trap_fork() call.
27770  *
27771  * Returns: %TRUE if the last forked child got killed due to a fork timeout.
27772  * Since: 2.16
27773  */
27774
27775
27776 /**
27777  * g_test_undefined:
27778  *
27779  * Returns %TRUE if tests may provoke assertions and other formally-undefined
27780  * behaviour under g_test_trap_fork(), to verify that appropriate warnings
27781  * are given. It can be useful to turn this off if running tests under
27782  * valgrind.
27783  *
27784  * Returns: %TRUE if tests may provoke programming errors
27785  */
27786
27787
27788 /**
27789  * g_test_verbose:
27790  *
27791  * Returns %TRUE if tests are run in verbose mode.
27792  * The default is neither g_test_verbose() nor g_test_quiet().
27793  *
27794  * Returns: %TRUE if in verbose mode
27795  */
27796
27797
27798 /**
27799  * g_thread_exit:
27800  * @retval: the return value of this thread
27801  *
27802  * Terminates the current thread.
27803  *
27804  * If another thread is waiting for us using g_thread_join() then the
27805  * waiting thread will be woken up and get @retval as the return value
27806  * of g_thread_join().
27807  *
27808  * Calling <literal>g_thread_exit (retval)</literal> is equivalent to
27809  * returning @retval from the function @func, as given to g_thread_new().
27810  *
27811  * <note><para>
27812  *   You must only call g_thread_exit() from a thread that you created
27813  *   yourself with g_thread_new() or related APIs.  You must not call
27814  *   this function from a thread created with another threading library
27815  *   or or from within a #GThreadPool.
27816  * </para></note>
27817  */
27818
27819
27820 /**
27821  * g_thread_join:
27822  * @thread: a #GThread
27823  *
27824  * Waits until @thread finishes, i.e. the function @func, as
27825  * given to g_thread_new(), returns or g_thread_exit() is called.
27826  * If @thread has already terminated, then g_thread_join()
27827  * returns immediately.
27828  *
27829  * Any thread can wait for any other thread by calling g_thread_join(),
27830  * not just its 'creator'. Calling g_thread_join() from multiple threads
27831  * for the same @thread leads to undefined behaviour.
27832  *
27833  * The value returned by @func or given to g_thread_exit() is
27834  * returned by this function.
27835  *
27836  * g_thread_join() consumes the reference to the passed-in @thread.
27837  * This will usually cause the #GThread struct and associated resources
27838  * to be freed. Use g_thread_ref() to obtain an extra reference if you
27839  * want to keep the GThread alive beyond the g_thread_join() call.
27840  *
27841  * Returns: the return value of the thread
27842  */
27843
27844
27845 /**
27846  * g_thread_new:
27847  * @name: a name for the new thread
27848  * @func: a function to execute in the new thread
27849  * @data: an argument to supply to the new thread
27850  *
27851  * This function creates a new thread. The new thread starts by invoking
27852  * @func with the argument data. The thread will run until @func returns
27853  * or until g_thread_exit() is called from the new thread. The return value
27854  * of @func becomes the return value of the thread, which can be obtained
27855  * with g_thread_join().
27856  *
27857  * The @name can be useful for discriminating threads in a debugger.
27858  * Some systems restrict the length of @name to 16 bytes.
27859  *
27860  * If the thread can not be created the program aborts. See
27861  * g_thread_try_new() if you want to attempt to deal with failures.
27862  *
27863  * To free the struct returned by this function, use g_thread_unref().
27864  * Note that g_thread_join() implicitly unrefs the #GThread as well.
27865  *
27866  * Returns: the new #GThread
27867  * Since: 2.32
27868  */
27869
27870
27871 /**
27872  * g_thread_pool_free:
27873  * @pool: a #GThreadPool
27874  * @immediate: should @pool shut down immediately?
27875  * @wait_: should the function wait for all tasks to be finished?
27876  *
27877  * Frees all resources allocated for @pool.
27878  *
27879  * If @immediate is %TRUE, no new task is processed for @pool.
27880  * Otherwise @pool is not freed before the last task is processed.
27881  * Note however, that no thread of this pool is interrupted while
27882  * processing a task. Instead at least all still running threads
27883  * can finish their tasks before the @pool is freed.
27884  *
27885  * If @wait_ is %TRUE, the functions does not return before all
27886  * tasks to be processed (dependent on @immediate, whether all
27887  * or only the currently running) are ready.
27888  * Otherwise the function returns immediately.
27889  *
27890  * After calling this function @pool must not be used anymore.
27891  */
27892
27893
27894 /**
27895  * g_thread_pool_get_max_idle_time:
27896  *
27897  * This function will return the maximum @interval that a
27898  * thread will wait in the thread pool for new tasks before
27899  * being stopped.
27900  *
27901  * If this function returns 0, threads waiting in the thread
27902  * pool for new work are not stopped.
27903  *
27904  * Returns: the maximum @interval (milliseconds) to wait for new tasks in the thread pool before stopping the thread
27905  * Since: 2.10
27906  */
27907
27908
27909 /**
27910  * g_thread_pool_get_max_threads:
27911  * @pool: a #GThreadPool
27912  *
27913  * Returns the maximal number of threads for @pool.
27914  *
27915  * Returns: the maximal number of threads
27916  */
27917
27918
27919 /**
27920  * g_thread_pool_get_max_unused_threads:
27921  *
27922  * Returns the maximal allowed number of unused threads.
27923  *
27924  * Returns: the maximal number of unused threads
27925  */
27926
27927
27928 /**
27929  * g_thread_pool_get_num_threads:
27930  * @pool: a #GThreadPool
27931  *
27932  * Returns the number of threads currently running in @pool.
27933  *
27934  * Returns: the number of threads currently running
27935  */
27936
27937
27938 /**
27939  * g_thread_pool_get_num_unused_threads:
27940  *
27941  * Returns the number of currently unused threads.
27942  *
27943  * Returns: the number of currently unused threads
27944  */
27945
27946
27947 /**
27948  * g_thread_pool_new:
27949  * @func: a function to execute in the threads of the new thread pool
27950  * @user_data: user data that is handed over to @func every time it is called
27951  * @max_threads: the maximal number of threads to execute concurrently in  the new thread pool, -1 means no limit
27952  * @exclusive: should this thread pool be exclusive?
27953  * @error: return location for error, or %NULL
27954  *
27955  * This function creates a new thread pool.
27956  *
27957  * Whenever you call g_thread_pool_push(), either a new thread is
27958  * created or an unused one is reused. At most @max_threads threads
27959  * are running concurrently for this thread pool. @max_threads = -1
27960  * allows unlimited threads to be created for this thread pool. The
27961  * newly created or reused thread now executes the function @func
27962  * with the two arguments. The first one is the parameter to
27963  * g_thread_pool_push() and the second one is @user_data.
27964  *
27965  * The parameter @exclusive determines whether the thread pool owns
27966  * all threads exclusive or shares them with other thread pools.
27967  * If @exclusive is %TRUE, @max_threads threads are started
27968  * immediately and they will run exclusively for this thread pool
27969  * until it is destroyed by g_thread_pool_free(). If @exclusive is
27970  * %FALSE, threads are created when needed and shared between all
27971  * non-exclusive thread pools. This implies that @max_threads may
27972  * not be -1 for exclusive thread pools.
27973  *
27974  * @error can be %NULL to ignore errors, or non-%NULL to report
27975  * errors. An error can only occur when @exclusive is set to %TRUE
27976  * and not all @max_threads threads could be created.
27977  *
27978  * Returns: the new #GThreadPool
27979  */
27980
27981
27982 /**
27983  * g_thread_pool_push:
27984  * @pool: a #GThreadPool
27985  * @data: a new task for @pool
27986  * @error: return location for error, or %NULL
27987  *
27988  * Inserts @data into the list of tasks to be executed by @pool.
27989  *
27990  * When the number of currently running threads is lower than the
27991  * maximal allowed number of threads, a new thread is started (or
27992  * reused) with the properties given to g_thread_pool_new().
27993  * Otherwise, @data stays in the queue until a thread in this pool
27994  * finishes its previous task and processes @data.
27995  *
27996  * @error can be %NULL to ignore errors, or non-%NULL to report
27997  * errors. An error can only occur when a new thread couldn't be
27998  * created. In that case @data is simply appended to the queue of
27999  * work to do.
28000  *
28001  * Before version 2.32, this function did not return a success status.
28002  *
28003  * Returns: %TRUE on success, %FALSE if an error occurred
28004  */
28005
28006
28007 /**
28008  * g_thread_pool_set_max_idle_time:
28009  * @interval: the maximum @interval (in milliseconds) a thread can be idle
28010  *
28011  * This function will set the maximum @interval that a thread
28012  * waiting in the pool for new tasks can be idle for before
28013  * being stopped. This function is similar to calling
28014  * g_thread_pool_stop_unused_threads() on a regular timeout,
28015  * except this is done on a per thread basis.
28016  *
28017  * By setting @interval to 0, idle threads will not be stopped.
28018  *
28019  * The default value is 15000 (15 seconds).
28020  *
28021  * Since: 2.10
28022  */
28023
28024
28025 /**
28026  * g_thread_pool_set_max_threads:
28027  * @pool: a #GThreadPool
28028  * @max_threads: a new maximal number of threads for @pool, or -1 for unlimited
28029  * @error: return location for error, or %NULL
28030  *
28031  * Sets the maximal allowed number of threads for @pool.
28032  * A value of -1 means that the maximal number of threads
28033  * is unlimited. If @pool is an exclusive thread pool, setting
28034  * the maximal number of threads to -1 is not allowed.
28035  *
28036  * Setting @max_threads to 0 means stopping all work for @pool.
28037  * It is effectively frozen until @max_threads is set to a non-zero
28038  * value again.
28039  *
28040  * A thread is never terminated while calling @func, as supplied by
28041  * g_thread_pool_new(). Instead the maximal number of threads only
28042  * has effect for the allocation of new threads in g_thread_pool_push().
28043  * A new thread is allocated, whenever the number of currently
28044  * running threads in @pool is smaller than the maximal number.
28045  *
28046  * @error can be %NULL to ignore errors, or non-%NULL to report
28047  * errors. An error can only occur when a new thread couldn't be
28048  * created.
28049  *
28050  * Before version 2.32, this function did not return a success status.
28051  *
28052  * Returns: %TRUE on success, %FALSE if an error occurred
28053  */
28054
28055
28056 /**
28057  * g_thread_pool_set_max_unused_threads:
28058  * @max_threads: maximal number of unused threads
28059  *
28060  * Sets the maximal number of unused threads to @max_threads.
28061  * If @max_threads is -1, no limit is imposed on the number
28062  * of unused threads.
28063  *
28064  * The default value is 2.
28065  */
28066
28067
28068 /**
28069  * g_thread_pool_set_sort_function:
28070  * @pool: a #GThreadPool
28071  * @func: the #GCompareDataFunc used to sort the list of tasks. This function is passed two tasks. It should return 0 if the order in which they are handled does not matter, a negative value if the first task should be processed before the second or a positive value if the second task should be processed first.
28072  * @user_data: user data passed to @func
28073  *
28074  * Sets the function used to sort the list of tasks. This allows the
28075  * tasks to be processed by a priority determined by @func, and not
28076  * just in the order in which they were added to the pool.
28077  *
28078  * Note, if the maximum number of threads is more than 1, the order
28079  * that threads are executed cannot be guaranteed 100%. Threads are
28080  * scheduled by the operating system and are executed at random. It
28081  * cannot be assumed that threads are executed in the order they are
28082  * created.
28083  *
28084  * Since: 2.10
28085  */
28086
28087
28088 /**
28089  * g_thread_pool_stop_unused_threads:
28090  *
28091  * Stops all currently unused threads. This does not change the
28092  * maximal number of unused threads. This function can be used to
28093  * regularly stop all unused threads e.g. from g_timeout_add().
28094  */
28095
28096
28097 /**
28098  * g_thread_pool_unprocessed:
28099  * @pool: a #GThreadPool
28100  *
28101  * Returns the number of tasks still unprocessed in @pool.
28102  *
28103  * Returns: the number of unprocessed tasks
28104  */
28105
28106
28107 /**
28108  * g_thread_ref:
28109  * @thread: a #GThread
28110  *
28111  * Increase the reference count on @thread.
28112  *
28113  * Returns: a new reference to @thread
28114  * Since: 2.32
28115  */
28116
28117
28118 /**
28119  * g_thread_self:
28120  *
28121  * This functions returns the #GThread corresponding to the
28122  * current thread. Note that this function does not increase
28123  * the reference count of the returned struct.
28124  *
28125  * This function will return a #GThread even for threads that
28126  * were not created by GLib (i.e. those created by other threading
28127  * APIs). This may be useful for thread identification purposes
28128  * (i.e. comparisons) but you must not use GLib functions (such
28129  * as g_thread_join()) on these threads.
28130  *
28131  * Returns: the #GThread representing the current thread
28132  */
28133
28134
28135 /**
28136  * g_thread_supported:
28137  *
28138  * This macro returns %TRUE if the thread system is initialized,
28139  * and %FALSE if it is not.
28140  *
28141  * For language bindings, g_thread_get_initialized() provides
28142  * the same functionality as a function.
28143  *
28144  * Returns: %TRUE, if the thread system is initialized
28145  */
28146
28147
28148 /**
28149  * g_thread_try_new:
28150  * @name: a name for the new thread
28151  * @func: a function to execute in the new thread
28152  * @data: an argument to supply to the new thread
28153  * @error: return location for error, or %NULL
28154  *
28155  * This function is the same as g_thread_new() except that
28156  * it allows for the possibility of failure.
28157  *
28158  * If a thread can not be created (due to resource limits),
28159  * @error is set and %NULL is returned.
28160  *
28161  * Returns: the new #GThread, or %NULL if an error occurred
28162  * Since: 2.32
28163  */
28164
28165
28166 /**
28167  * g_thread_unref:
28168  * @thread: a #GThread
28169  *
28170  * Decrease the reference count on @thread, possibly freeing all
28171  * resources associated with it.
28172  *
28173  * Note that each thread holds a reference to its #GThread while
28174  * it is running, so it is safe to drop your own reference to it
28175  * if you don't need it anymore.
28176  *
28177  * Since: 2.32
28178  */
28179
28180
28181 /**
28182  * g_thread_yield:
28183  *
28184  * Causes the calling thread to voluntarily relinquish the CPU, so
28185  * that other threads can run.
28186  *
28187  * This function is often used as a method to make busy wait less evil.
28188  */
28189
28190
28191 /**
28192  * g_time_val_add:
28193  * @time_: a #GTimeVal
28194  * @microseconds: number of microseconds to add to @time
28195  *
28196  * Adds the given number of microseconds to @time_. @microseconds can
28197  * also be negative to decrease the value of @time_.
28198  */
28199
28200
28201 /**
28202  * g_time_val_from_iso8601:
28203  * @iso_date: an ISO 8601 encoded date string
28204  * @time_: (out): a #GTimeVal
28205  *
28206  * Converts a string containing an ISO 8601 encoded date and time
28207  * to a #GTimeVal and puts it into @time_.
28208  *
28209  * @iso_date must include year, month, day, hours, minutes, and
28210  * seconds. It can optionally include fractions of a second and a time
28211  * zone indicator. (In the absence of any time zone indication, the
28212  * timestamp is assumed to be in local time.)
28213  *
28214  * Returns: %TRUE if the conversion was successful.
28215  * Since: 2.12
28216  */
28217
28218
28219 /**
28220  * g_time_val_to_iso8601:
28221  * @time_: a #GTimeVal
28222  *
28223  * Converts @time_ into an RFC 3339 encoded string, relative to the
28224  * Coordinated Universal Time (UTC). This is one of the many formats
28225  * allowed by ISO 8601.
28226  *
28227  * ISO 8601 allows a large number of date/time formats, with or without
28228  * punctuation and optional elements. The format returned by this function
28229  * is a complete date and time, with optional punctuation included, the
28230  * UTC time zone represented as "Z", and the @tv_usec part included if
28231  * and only if it is nonzero, i.e. either
28232  * "YYYY-MM-DDTHH:MM:SSZ" or "YYYY-MM-DDTHH:MM:SS.fffffZ".
28233  *
28234  * This corresponds to the Internet date/time format defined by
28235  * <ulink url="https://www.ietf.org/rfc/rfc3339.txt">RFC 3339</ulink>, and
28236  * to either of the two most-precise formats defined by
28237  * <ulink url="http://www.w3.org/TR/NOTE-datetime-19980827">the W3C Note
28238  * "Date and Time Formats"</ulink>. Both of these documents are profiles of
28239  * ISO 8601.
28240  *
28241  * Use g_date_time_format() or g_strdup_printf() if a different
28242  * variation of ISO 8601 format is required.
28243  *
28244  * Returns: a newly allocated string containing an ISO 8601 date
28245  * Since: 2.12
28246  */
28247
28248
28249 /**
28250  * g_time_zone_adjust_time:
28251  * @tz: a #GTimeZone
28252  * @type: the #GTimeType of @time_
28253  * @time_: a pointer to a number of seconds since January 1, 1970
28254  *
28255  * Finds an interval within @tz that corresponds to the given @time_,
28256  * possibly adjusting @time_ if required to fit into an interval.
28257  * The meaning of @time_ depends on @type.
28258  *
28259  * This function is similar to g_time_zone_find_interval(), with the
28260  * difference that it always succeeds (by making the adjustments
28261  * described below).
28262  *
28263  * In any of the cases where g_time_zone_find_interval() succeeds then
28264  * this function returns the same value, without modifying @time_.
28265  *
28266  * This function may, however, modify @time_ in order to deal with
28267  * non-existent times.  If the non-existent local @time_ of 02:30 were
28268  * requested on March 14th 2010 in Toronto then this function would
28269  * adjust @time_ to be 03:00 and return the interval containing the
28270  * adjusted time.
28271  *
28272  * Returns: the interval containing @time_, never -1
28273  * Since: 2.26
28274  */
28275
28276
28277 /**
28278  * g_time_zone_find_interval:
28279  * @tz: a #GTimeZone
28280  * @type: the #GTimeType of @time_
28281  * @time_: a number of seconds since January 1, 1970
28282  *
28283  * Finds an the interval within @tz that corresponds to the given @time_.
28284  * The meaning of @time_ depends on @type.
28285  *
28286  * If @type is %G_TIME_TYPE_UNIVERSAL then this function will always
28287  * succeed (since universal time is monotonic and continuous).
28288  *
28289  * Otherwise @time_ is treated is local time.  The distinction between
28290  * %G_TIME_TYPE_STANDARD and %G_TIME_TYPE_DAYLIGHT is ignored except in
28291  * the case that the given @time_ is ambiguous.  In Toronto, for example,
28292  * 01:30 on November 7th 2010 occurred twice (once inside of daylight
28293  * savings time and the next, an hour later, outside of daylight savings
28294  * time).  In this case, the different value of @type would result in a
28295  * different interval being returned.
28296  *
28297  * It is still possible for this function to fail.  In Toronto, for
28298  * example, 02:00 on March 14th 2010 does not exist (due to the leap
28299  * forward to begin daylight savings time).  -1 is returned in that
28300  * case.
28301  *
28302  * Returns: the interval containing @time_, or -1 in case of failure
28303  * Since: 2.26
28304  */
28305
28306
28307 /**
28308  * g_time_zone_get_abbreviation:
28309  * @tz: a #GTimeZone
28310  * @interval: an interval within the timezone
28311  *
28312  * Determines the time zone abbreviation to be used during a particular
28313  * @interval of time in the time zone @tz.
28314  *
28315  * For example, in Toronto this is currently "EST" during the winter
28316  * months and "EDT" during the summer months when daylight savings time
28317  * is in effect.
28318  *
28319  * Returns: the time zone abbreviation, which belongs to @tz
28320  * Since: 2.26
28321  */
28322
28323
28324 /**
28325  * g_time_zone_get_offset:
28326  * @tz: a #GTimeZone
28327  * @interval: an interval within the timezone
28328  *
28329  * Determines the offset to UTC in effect during a particular @interval
28330  * of time in the time zone @tz.
28331  *
28332  * The offset is the number of seconds that you add to UTC time to
28333  * arrive at local time for @tz (ie: negative numbers for time zones
28334  * west of GMT, positive numbers for east).
28335  *
28336  * Returns: the number of seconds that should be added to UTC to get the local time in @tz
28337  * Since: 2.26
28338  */
28339
28340
28341 /**
28342  * g_time_zone_is_dst:
28343  * @tz: a #GTimeZone
28344  * @interval: an interval within the timezone
28345  *
28346  * Determines if daylight savings time is in effect during a particular
28347  * @interval of time in the time zone @tz.
28348  *
28349  * Returns: %TRUE if daylight savings time is in effect
28350  * Since: 2.26
28351  */
28352
28353
28354 /**
28355  * g_time_zone_new:
28356  * @identifier: (allow-none): a timezone identifier
28357  *
28358  * Creates a #GTimeZone corresponding to @identifier.
28359  *
28360  * @identifier can either be an RFC3339/ISO 8601 time offset or
28361  * something that would pass as a valid value for the
28362  * <varname>TZ</varname> environment variable (including %NULL).
28363  *
28364  * Valid RFC3339 time offsets are <literal>"Z"</literal> (for UTC) or
28365  * <literal>"±hh:mm"</literal>.  ISO 8601 additionally specifies
28366  * <literal>"±hhmm"</literal> and <literal>"±hh"</literal>.
28367  *
28368  * The <varname>TZ</varname> environment variable typically corresponds
28369  * to the name of a file in the zoneinfo database, but there are many
28370  * other possibilities.  Note that those other possibilities are not
28371  * currently implemented, but are planned.
28372  *
28373  * g_time_zone_new_local() calls this function with the value of the
28374  * <varname>TZ</varname> environment variable.  This function itself is
28375  * independent of the value of <varname>TZ</varname>, but if @identifier
28376  * is %NULL then <filename>/etc/localtime</filename> will be consulted
28377  * to discover the correct timezone.
28378  *
28379  * See <ulink
28380  * url='http://tools.ietf.org/html/rfc3339#section-5.6'>RFC3339
28381  * Â§5.6</ulink> for a precise definition of valid RFC3339 time offsets
28382  * (the <varname>time-offset</varname> expansion) and ISO 8601 for the
28383  * full list of valid time offsets.  See <ulink
28384  * url='http://www.gnu.org/s/libc/manual/html_node/TZ-Variable.html'>The
28385  * GNU C Library manual</ulink> for an explanation of the possible
28386  * values of the <varname>TZ</varname> environment variable.
28387  *
28388  * You should release the return value by calling g_time_zone_unref()
28389  * when you are done with it.
28390  *
28391  * Returns: the requested timezone
28392  * Since: 2.26
28393  */
28394
28395
28396 /**
28397  * g_time_zone_new_local:
28398  *
28399  * Creates a #GTimeZone corresponding to local time.  The local time
28400  * zone may change between invocations to this function; for example,
28401  * if the system administrator changes it.
28402  *
28403  * This is equivalent to calling g_time_zone_new() with the value of the
28404  * <varname>TZ</varname> environment variable (including the possibility
28405  * of %NULL).
28406  *
28407  * You should release the return value by calling g_time_zone_unref()
28408  * when you are done with it.
28409  *
28410  * Returns: the local timezone
28411  * Since: 2.26
28412  */
28413
28414
28415 /**
28416  * g_time_zone_new_utc:
28417  *
28418  * Creates a #GTimeZone corresponding to UTC.
28419  *
28420  * This is equivalent to calling g_time_zone_new() with a value like
28421  * "Z", "UTC", "+00", etc.
28422  *
28423  * You should release the return value by calling g_time_zone_unref()
28424  * when you are done with it.
28425  *
28426  * Returns: the universal timezone
28427  * Since: 2.26
28428  */
28429
28430
28431 /**
28432  * g_time_zone_ref:
28433  * @tz: a #GTimeZone
28434  *
28435  * Increases the reference count on @tz.
28436  *
28437  * Returns: a new reference to @tz.
28438  * Since: 2.26
28439  */
28440
28441
28442 /**
28443  * g_time_zone_unref:
28444  * @tz: a #GTimeZone
28445  *
28446  * Decreases the reference count on @tz.
28447  *
28448  * Since: 2.26
28449  */
28450
28451
28452 /**
28453  * g_timeout_add:
28454  * @interval: the time between calls to the function, in milliseconds (1/1000ths of a second)
28455  * @function: function to call
28456  * @data: data to pass to @function
28457  *
28458  * Sets a function to be called at regular intervals, with the default
28459  * priority, #G_PRIORITY_DEFAULT.  The function is called repeatedly
28460  * until it returns %FALSE, at which point the timeout is automatically
28461  * destroyed and the function will not be called again.  The first call
28462  * to the function will be at the end of the first @interval.
28463  *
28464  * Note that timeout functions may be delayed, due to the processing of other
28465  * event sources. Thus they should not be relied on for precise timing.
28466  * After each call to the timeout function, the time of the next
28467  * timeout is recalculated based on the current time and the given interval
28468  * (it does not try to 'catch up' time lost in delays).
28469  *
28470  * If you want to have a timer in the "seconds" range and do not care
28471  * about the exact time of the first call of the timer, use the
28472  * g_timeout_add_seconds() function; this function allows for more
28473  * optimizations and more efficient system power usage.
28474  *
28475  * This internally creates a main loop source using g_timeout_source_new()
28476  * and attaches it to the main loop context using g_source_attach(). You can
28477  * do these steps manually if you need greater control.
28478  *
28479  * The interval given is in terms of monotonic time, not wall clock
28480  * time.  See g_get_monotonic_time().
28481  *
28482  * Returns: the ID (greater than 0) of the event source.
28483  */
28484
28485
28486 /**
28487  * g_timeout_add_full:
28488  * @priority: the priority of the timeout source. Typically this will be in the range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.
28489  * @interval: the time between calls to the function, in milliseconds (1/1000ths of a second)
28490  * @function: function to call
28491  * @data: data to pass to @function
28492  * @notify: (allow-none): function to call when the timeout is removed, or %NULL
28493  *
28494  * Sets a function to be called at regular intervals, with the given
28495  * priority.  The function is called repeatedly until it returns
28496  * %FALSE, at which point the timeout is automatically destroyed and
28497  * the function will not be called again.  The @notify function is
28498  * called when the timeout is destroyed.  The first call to the
28499  * function will be at the end of the first @interval.
28500  *
28501  * Note that timeout functions may be delayed, due to the processing of other
28502  * event sources. Thus they should not be relied on for precise timing.
28503  * After each call to the timeout function, the time of the next
28504  * timeout is recalculated based on the current time and the given interval
28505  * (it does not try to 'catch up' time lost in delays).
28506  *
28507  * This internally creates a main loop source using g_timeout_source_new()
28508  * and attaches it to the main loop context using g_source_attach(). You can
28509  * do these steps manually if you need greater control.
28510  *
28511  * The interval given in terms of monotonic time, not wall clock time.
28512  * See g_get_monotonic_time().
28513  *
28514  * Returns: the ID (greater than 0) of the event source.
28515  * Rename to: g_timeout_add
28516  */
28517
28518
28519 /**
28520  * g_timeout_add_seconds:
28521  * @interval: the time between calls to the function, in seconds
28522  * @function: function to call
28523  * @data: data to pass to @function
28524  *
28525  * Sets a function to be called at regular intervals with the default
28526  * priority, #G_PRIORITY_DEFAULT. The function is called repeatedly until
28527  * it returns %FALSE, at which point the timeout is automatically destroyed
28528  * and the function will not be called again.
28529  *
28530  * This internally creates a main loop source using
28531  * g_timeout_source_new_seconds() and attaches it to the main loop context
28532  * using g_source_attach(). You can do these steps manually if you need
28533  * greater control. Also see g_timeout_add_seconds_full().
28534  *
28535  * Note that the first call of the timer may not be precise for timeouts
28536  * of one second. If you need finer precision and have such a timeout,
28537  * you may want to use g_timeout_add() instead.
28538  *
28539  * The interval given is in terms of monotonic time, not wall clock
28540  * time.  See g_get_monotonic_time().
28541  *
28542  * Returns: the ID (greater than 0) of the event source.
28543  * Since: 2.14
28544  */
28545
28546
28547 /**
28548  * g_timeout_add_seconds_full:
28549  * @priority: the priority of the timeout source. Typically this will be in the range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.
28550  * @interval: the time between calls to the function, in seconds
28551  * @function: function to call
28552  * @data: data to pass to @function
28553  * @notify: (allow-none): function to call when the timeout is removed, or %NULL
28554  *
28555  * Sets a function to be called at regular intervals, with @priority.
28556  * The function is called repeatedly until it returns %FALSE, at which
28557  * point the timeout is automatically destroyed and the function will
28558  * not be called again.
28559  *
28560  * Unlike g_timeout_add(), this function operates at whole second granularity.
28561  * The initial starting point of the timer is determined by the implementation
28562  * and the implementation is expected to group multiple timers together so that
28563  * they fire all at the same time.
28564  * To allow this grouping, the @interval to the first timer is rounded
28565  * and can deviate up to one second from the specified interval.
28566  * Subsequent timer iterations will generally run at the specified interval.
28567  *
28568  * Note that timeout functions may be delayed, due to the processing of other
28569  * event sources. Thus they should not be relied on for precise timing.
28570  * After each call to the timeout function, the time of the next
28571  * timeout is recalculated based on the current time and the given @interval
28572  *
28573  * If you want timing more precise than whole seconds, use g_timeout_add()
28574  * instead.
28575  *
28576  * The grouping of timers to fire at the same time results in a more power
28577  * and CPU efficient behavior so if your timer is in multiples of seconds
28578  * and you don't require the first timer exactly one second from now, the
28579  * use of g_timeout_add_seconds() is preferred over g_timeout_add().
28580  *
28581  * This internally creates a main loop source using
28582  * g_timeout_source_new_seconds() and attaches it to the main loop context
28583  * using g_source_attach(). You can do these steps manually if you need
28584  * greater control.
28585  *
28586  * The interval given is in terms of monotonic time, not wall clock
28587  * time.  See g_get_monotonic_time().
28588  *
28589  * Returns: the ID (greater than 0) of the event source.
28590  * Rename to: g_timeout_add_seconds
28591  * Since: 2.14
28592  */
28593
28594
28595 /**
28596  * g_timeout_source_new:
28597  * @interval: the timeout interval in milliseconds.
28598  *
28599  * Creates a new timeout source.
28600  *
28601  * The source will not initially be associated with any #GMainContext
28602  * and must be added to one with g_source_attach() before it will be
28603  * executed.
28604  *
28605  * The interval given is in terms of monotonic time, not wall clock
28606  * time.  See g_get_monotonic_time().
28607  *
28608  * Returns: the newly-created timeout source
28609  */
28610
28611
28612 /**
28613  * g_timeout_source_new_seconds:
28614  * @interval: the timeout interval in seconds
28615  *
28616  * Creates a new timeout source.
28617  *
28618  * The source will not initially be associated with any #GMainContext
28619  * and must be added to one with g_source_attach() before it will be
28620  * executed.
28621  *
28622  * The scheduling granularity/accuracy of this timeout source will be
28623  * in seconds.
28624  *
28625  * The interval given in terms of monotonic time, not wall clock time.
28626  * See g_get_monotonic_time().
28627  *
28628  * Returns: the newly-created timeout source
28629  * Since: 2.14
28630  */
28631
28632
28633 /**
28634  * g_timer_continue:
28635  * @timer: a #GTimer.
28636  *
28637  * Resumes a timer that has previously been stopped with
28638  * g_timer_stop(). g_timer_stop() must be called before using this
28639  * function.
28640  *
28641  * Since: 2.4
28642  */
28643
28644
28645 /**
28646  * g_timer_destroy:
28647  * @timer: a #GTimer to destroy.
28648  *
28649  * Destroys a timer, freeing associated resources.
28650  */
28651
28652
28653 /**
28654  * g_timer_elapsed:
28655  * @timer: a #GTimer.
28656  * @microseconds: return location for the fractional part of seconds elapsed, in microseconds (that is, the total number of microseconds elapsed, modulo 1000000), or %NULL
28657  *
28658  * If @timer has been started but not stopped, obtains the time since
28659  * the timer was started. If @timer has been stopped, obtains the
28660  * elapsed time between the time it was started and the time it was
28661  * stopped. The return value is the number of seconds elapsed,
28662  * including any fractional part. The @microseconds out parameter is
28663  * essentially useless.
28664  *
28665  * Returns: seconds elapsed as a floating point value, including any fractional part.
28666  */
28667
28668
28669 /**
28670  * g_timer_new:
28671  *
28672  * Creates a new timer, and starts timing (i.e. g_timer_start() is
28673  * implicitly called for you).
28674  *
28675  * Returns: a new #GTimer.
28676  */
28677
28678
28679 /**
28680  * g_timer_reset:
28681  * @timer: a #GTimer.
28682  *
28683  * This function is useless; it's fine to call g_timer_start() on an
28684  * already-started timer to reset the start time, so g_timer_reset()
28685  * serves no purpose.
28686  */
28687
28688
28689 /**
28690  * g_timer_start:
28691  * @timer: a #GTimer.
28692  *
28693  * Marks a start time, so that future calls to g_timer_elapsed() will
28694  * report the time since g_timer_start() was called. g_timer_new()
28695  * automatically marks the start time, so no need to call
28696  * g_timer_start() immediately after creating the timer.
28697  */
28698
28699
28700 /**
28701  * g_timer_stop:
28702  * @timer: a #GTimer.
28703  *
28704  * Marks an end time, so calls to g_timer_elapsed() will return the
28705  * difference between this end time and the start time.
28706  */
28707
28708
28709 /**
28710  * g_trash_stack_height:
28711  * @stack_p: a #GTrashStack
28712  *
28713  * Returns the height of a #GTrashStack.
28714  *
28715  * Note that execution of this function is of O(N) complexity
28716  * where N denotes the number of items on the stack.
28717  *
28718  * Returns: the height of the stack
28719  */
28720
28721
28722 /**
28723  * g_trash_stack_peek:
28724  * @stack_p: a #GTrashStack
28725  *
28726  * Returns the element at the top of a #GTrashStack
28727  * which may be %NULL.
28728  *
28729  * Returns: the element at the top of the stack
28730  */
28731
28732
28733 /**
28734  * g_trash_stack_pop:
28735  * @stack_p: a #GTrashStack
28736  *
28737  * Pops a piece of memory off a #GTrashStack.
28738  *
28739  * Returns: the element at the top of the stack
28740  */
28741
28742
28743 /**
28744  * g_trash_stack_push:
28745  * @stack_p: a #GTrashStack
28746  * @data_p: the piece of memory to push on the stack
28747  *
28748  * Pushes a piece of memory onto a #GTrashStack.
28749  */
28750
28751
28752 /**
28753  * g_tree_destroy:
28754  * @tree: a #GTree.
28755  *
28756  * Removes all keys and values from the #GTree and decreases its
28757  * reference count by one. If keys and/or values are dynamically
28758  * allocated, you should either free them first or create the #GTree
28759  * using g_tree_new_full().  In the latter case the destroy functions
28760  * you supplied will be called on all keys and values before destroying
28761  * the #GTree.
28762  */
28763
28764
28765 /**
28766  * g_tree_foreach:
28767  * @tree: a #GTree.
28768  * @func: the function to call for each node visited. If this function returns %TRUE, the traversal is stopped.
28769  * @user_data: user data to pass to the function.
28770  *
28771  * Calls the given function for each of the key/value pairs in the #GTree.
28772  * The function is passed the key and value of each pair, and the given
28773  * @data parameter. The tree is traversed in sorted order.
28774  *
28775  * The tree may not be modified while iterating over it (you can't
28776  * add/remove items). To remove all items matching a predicate, you need
28777  * to add each item to a list in your #GTraverseFunc as you walk over
28778  * the tree, then walk the list and remove each item.
28779  */
28780
28781
28782 /**
28783  * g_tree_height:
28784  * @tree: a #GTree.
28785  *
28786  * Gets the height of a #GTree.
28787  *
28788  * If the #GTree contains no nodes, the height is 0.
28789  * If the #GTree contains only one root node the height is 1.
28790  * If the root node has children the height is 2, etc.
28791  *
28792  * Returns: the height of the #GTree.
28793  */
28794
28795
28796 /**
28797  * g_tree_insert:
28798  * @tree: a #GTree.
28799  * @key: the key to insert.
28800  * @value: the value corresponding to the key.
28801  *
28802  * Inserts a key/value pair into a #GTree. If the given key already exists
28803  * in the #GTree its corresponding value is set to the new value. If you
28804  * supplied a value_destroy_func when creating the #GTree, the old value is
28805  * freed using that function. If you supplied a @key_destroy_func when
28806  * creating the #GTree, the passed key is freed using that function.
28807  *
28808  * The tree is automatically 'balanced' as new key/value pairs are added,
28809  * so that the distance from the root to every leaf is as small as possible.
28810  */
28811
28812
28813 /**
28814  * g_tree_lookup:
28815  * @tree: a #GTree.
28816  * @key: the key to look up.
28817  *
28818  * Gets the value corresponding to the given key. Since a #GTree is
28819  * automatically balanced as key/value pairs are added, key lookup is very
28820  * fast.
28821  *
28822  * Returns: the value corresponding to the key, or %NULL if the key was not found.
28823  */
28824
28825
28826 /**
28827  * g_tree_lookup_extended:
28828  * @tree: a #GTree.
28829  * @lookup_key: the key to look up.
28830  * @orig_key: returns the original key.
28831  * @value: returns the value associated with the key.
28832  *
28833  * Looks up a key in the #GTree, returning the original key and the
28834  * associated value and a #gboolean which is %TRUE if the key was found. This
28835  * is useful if you need to free the memory allocated for the original key,
28836  * for example before calling g_tree_remove().
28837  *
28838  * Returns: %TRUE if the key was found in the #GTree.
28839  */
28840
28841
28842 /**
28843  * g_tree_new:
28844  * @key_compare_func: the function used to order the nodes in the #GTree. It should return values similar to the standard strcmp() function - 0 if the two arguments are equal, a negative value if the first argument comes before the second, or a positive value if the first argument comes after the second.
28845  *
28846  * Creates a new #GTree.
28847  *
28848  * Returns: a new #GTree.
28849  */
28850
28851
28852 /**
28853  * g_tree_new_full:
28854  * @key_compare_func: qsort()-style comparison function.
28855  * @key_compare_data: data to pass to comparison function.
28856  * @key_destroy_func: a function to free the memory allocated for the key used when removing the entry from the #GTree or %NULL if you don't want to supply such a function.
28857  * @value_destroy_func: a function to free the memory allocated for the value used when removing the entry from the #GTree or %NULL if you don't want to supply such a function.
28858  *
28859  * Creates a new #GTree like g_tree_new() and allows to specify functions
28860  * to free the memory allocated for the key and value that get called when
28861  * removing the entry from the #GTree.
28862  *
28863  * Returns: a new #GTree.
28864  */
28865
28866
28867 /**
28868  * g_tree_new_with_data:
28869  * @key_compare_func: qsort()-style comparison function.
28870  * @key_compare_data: data to pass to comparison function.
28871  *
28872  * Creates a new #GTree with a comparison function that accepts user data.
28873  * See g_tree_new() for more details.
28874  *
28875  * Returns: a new #GTree.
28876  */
28877
28878
28879 /**
28880  * g_tree_nnodes:
28881  * @tree: a #GTree.
28882  *
28883  * Gets the number of nodes in a #GTree.
28884  *
28885  * Returns: the number of nodes in the #GTree.
28886  */
28887
28888
28889 /**
28890  * g_tree_ref:
28891  * @tree: a #GTree.
28892  *
28893  * Increments the reference count of @tree by one.  It is safe to call
28894  * this function from any thread.
28895  *
28896  * Returns: the passed in #GTree.
28897  * Since: 2.22
28898  */
28899
28900
28901 /**
28902  * g_tree_remove:
28903  * @tree: a #GTree.
28904  * @key: the key to remove.
28905  *
28906  * Removes a key/value pair from a #GTree.
28907  *
28908  * If the #GTree was created using g_tree_new_full(), the key and value
28909  * are freed using the supplied destroy functions, otherwise you have to
28910  * make sure that any dynamically allocated values are freed yourself.
28911  * If the key does not exist in the #GTree, the function does nothing.
28912  *
28913  * Returns: %TRUE if the key was found (prior to 2.8, this function returned nothing)
28914  */
28915
28916
28917 /**
28918  * g_tree_replace:
28919  * @tree: a #GTree.
28920  * @key: the key to insert.
28921  * @value: the value corresponding to the key.
28922  *
28923  * Inserts a new key and value into a #GTree similar to g_tree_insert().
28924  * The difference is that if the key already exists in the #GTree, it gets
28925  * replaced by the new key. If you supplied a @value_destroy_func when
28926  * creating the #GTree, the old value is freed using that function. If you
28927  * supplied a @key_destroy_func when creating the #GTree, the old key is
28928  * freed using that function.
28929  *
28930  * The tree is automatically 'balanced' as new key/value pairs are added,
28931  * so that the distance from the root to every leaf is as small as possible.
28932  */
28933
28934
28935 /**
28936  * g_tree_search:
28937  * @tree: a #GTree
28938  * @search_func: a function used to search the #GTree
28939  * @user_data: the data passed as the second argument to @search_func
28940  *
28941  * Searches a #GTree using @search_func.
28942  *
28943  * The @search_func is called with a pointer to the key of a key/value
28944  * pair in the tree, and the passed in @user_data. If @search_func returns
28945  * 0 for a key/value pair, then the corresponding value is returned as
28946  * the result of g_tree_search(). If @search_func returns -1, searching
28947  * will proceed among the key/value pairs that have a smaller key; if
28948  * @search_func returns 1, searching will proceed among the key/value
28949  * pairs that have a larger key.
28950  *
28951  * Returns: the value corresponding to the found key, or %NULL if the key was not found.
28952  */
28953
28954
28955 /**
28956  * g_tree_steal:
28957  * @tree: a #GTree.
28958  * @key: the key to remove.
28959  *
28960  * Removes a key and its associated value from a #GTree without calling
28961  * the key and value destroy functions.
28962  *
28963  * If the key does not exist in the #GTree, the function does nothing.
28964  *
28965  * Returns: %TRUE if the key was found (prior to 2.8, this function returned nothing)
28966  */
28967
28968
28969 /**
28970  * g_tree_traverse:
28971  * @tree: a #GTree.
28972  * @traverse_func: the function to call for each node visited. If this function returns %TRUE, the traversal is stopped.
28973  * @traverse_type: the order in which nodes are visited, one of %G_IN_ORDER, %G_PRE_ORDER and %G_POST_ORDER.
28974  * @user_data: user data to pass to the function.
28975  *
28976  * Calls the given function for each node in the #GTree.
28977  *
28978  * Deprecated: 2.2: The order of a balanced tree is somewhat arbitrary. If you just want to visit all nodes in sorted order, use g_tree_foreach() instead. If you really need to visit nodes in a different order, consider using an <link linkend="glib-N-ary-Trees">N-ary Tree</link>.
28979  */
28980
28981
28982 /**
28983  * g_tree_unref:
28984  * @tree: a #GTree.
28985  *
28986  * Decrements the reference count of @tree by one.  If the reference count
28987  * drops to 0, all keys and values will be destroyed (if destroy
28988  * functions were specified) and all memory allocated by @tree will be
28989  * released.
28990  *
28991  * It is safe to call this function from any thread.
28992  *
28993  * Since: 2.22
28994  */
28995
28996
28997 /**
28998  * g_try_malloc:
28999  * @n_bytes: number of bytes to allocate.
29000  *
29001  * Attempts to allocate @n_bytes, and returns %NULL on failure.
29002  * Contrast with g_malloc(), which aborts the program on failure.
29003  *
29004  * Returns: the allocated memory, or %NULL.
29005  */
29006
29007
29008 /**
29009  * g_try_malloc0:
29010  * @n_bytes: number of bytes to allocate
29011  *
29012  * Attempts to allocate @n_bytes, initialized to 0's, and returns %NULL on
29013  * failure. Contrast with g_malloc0(), which aborts the program on failure.
29014  *
29015  * Since: 2.8
29016  * Returns: the allocated memory, or %NULL
29017  */
29018
29019
29020 /**
29021  * g_try_malloc0_n:
29022  * @n_blocks: the number of blocks to allocate
29023  * @n_block_bytes: the size of each block in bytes
29024  *
29025  * This function is similar to g_try_malloc0(), allocating (@n_blocks * @n_block_bytes) bytes,
29026  * but care is taken to detect possible overflow during multiplication.
29027  *
29028  * Since: 2.24
29029  * Returns: the allocated memory, or %NULL
29030  */
29031
29032
29033 /**
29034  * g_try_malloc_n:
29035  * @n_blocks: the number of blocks to allocate
29036  * @n_block_bytes: the size of each block in bytes
29037  *
29038  * This function is similar to g_try_malloc(), allocating (@n_blocks * @n_block_bytes) bytes,
29039  * but care is taken to detect possible overflow during multiplication.
29040  *
29041  * Since: 2.24
29042  * Returns: the allocated memory, or %NULL.
29043  */
29044
29045
29046 /**
29047  * g_try_realloc:
29048  * @mem: (allow-none): previously-allocated memory, or %NULL.
29049  * @n_bytes: number of bytes to allocate.
29050  *
29051  * Attempts to realloc @mem to a new size, @n_bytes, and returns %NULL
29052  * on failure. Contrast with g_realloc(), which aborts the program
29053  * on failure. If @mem is %NULL, behaves the same as g_try_malloc().
29054  *
29055  * Returns: the allocated memory, or %NULL.
29056  */
29057
29058
29059 /**
29060  * g_try_realloc_n:
29061  * @mem: (allow-none): previously-allocated memory, or %NULL.
29062  * @n_blocks: the number of blocks to allocate
29063  * @n_block_bytes: the size of each block in bytes
29064  *
29065  * This function is similar to g_try_realloc(), allocating (@n_blocks * @n_block_bytes) bytes,
29066  * but care is taken to detect possible overflow during multiplication.
29067  *
29068  * Since: 2.24
29069  * Returns: the allocated memory, or %NULL.
29070  */
29071
29072
29073 /**
29074  * g_ucs4_to_utf16:
29075  * @str: a UCS-4 encoded string
29076  * @len: the maximum length (number of characters) of @str to use. If @len < 0, then the string is nul-terminated.
29077  * @items_read: (allow-none): location to store number of bytes read, or %NULL. If an error occurs then the index of the invalid input is stored here.
29078  * @items_written: (allow-none): location to store number of <type>gunichar2</type> written, or %NULL. The value stored here does not include the trailing 0.
29079  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError other than %G_CONVERT_ERROR_NO_CONVERSION may occur.
29080  *
29081  * Convert a string from UCS-4 to UTF-16. A 0 character will be
29082  * added to the result after the converted text.
29083  *
29084  * Returns: a pointer to a newly allocated UTF-16 string. This value must be freed with g_free(). If an error occurs, %NULL will be returned and @error set.
29085  */
29086
29087
29088 /**
29089  * g_ucs4_to_utf8:
29090  * @str: a UCS-4 encoded string
29091  * @len: the maximum length (number of characters) of @str to use. If @len < 0, then the string is nul-terminated.
29092  * @items_read: (allow-none): location to store number of characters read, or %NULL.
29093  * @items_written: (allow-none): location to store number of bytes written or %NULL. The value here stored does not include the trailing 0 byte.
29094  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError other than %G_CONVERT_ERROR_NO_CONVERSION may occur.
29095  *
29096  * Convert a string from a 32-bit fixed width representation as UCS-4.
29097  * to UTF-8. The result will be terminated with a 0 byte.
29098  *
29099  * Returns: a pointer to a newly allocated UTF-8 string. This value must be freed with g_free(). If an error occurs, %NULL will be returned and @error set. In that case, @items_read will be set to the position of the first invalid input character.
29100  */
29101
29102
29103 /**
29104  * g_unichar_break_type:
29105  * @c: a Unicode character
29106  *
29107  * Determines the break type of @c. @c should be a Unicode character
29108  * (to derive a character from UTF-8 encoded text, use
29109  * g_utf8_get_char()). The break type is used to find word and line
29110  * breaks ("text boundaries"), Pango implements the Unicode boundary
29111  * resolution algorithms and normally you would use a function such
29112  * as pango_break() instead of caring about break types yourself.
29113  *
29114  * Returns: the break type of @c
29115  */
29116
29117
29118 /**
29119  * g_unichar_combining_class:
29120  * @uc: a Unicode character
29121  *
29122  * Determines the canonical combining class of a Unicode character.
29123  *
29124  * Returns: the combining class of the character
29125  * Since: 2.14
29126  */
29127
29128
29129 /**
29130  * g_unichar_compose:
29131  * @a: a Unicode character
29132  * @b: a Unicode character
29133  * @ch: return location for the composed character
29134  *
29135  * Performs a single composition step of the
29136  * Unicode canonical composition algorithm.
29137  *
29138  * This function includes algorithmic Hangul Jamo composition,
29139  * but it is not exactly the inverse of g_unichar_decompose().
29140  * No composition can have either of @a or @b equal to zero.
29141  * To be precise, this function composes if and only if
29142  * there exists a Primary Composite P which is canonically
29143  * equivalent to the sequence <@a,@b>.  See the Unicode
29144  * Standard for the definition of Primary Composite.
29145  *
29146  * If @a and @b do not compose a new character, @ch is set to zero.
29147  *
29148  * See <ulink url="http://unicode.org/reports/tr15/">UAX#15</ulink>
29149  * for details.
29150  *
29151  * Returns: %TRUE if the characters could be composed
29152  * Since: 2.30
29153  */
29154
29155
29156 /**
29157  * g_unichar_decompose:
29158  * @ch: a Unicode character
29159  * @a: return location for the first component of @ch
29160  * @b: return location for the second component of @ch
29161  *
29162  * Performs a single decomposition step of the
29163  * Unicode canonical decomposition algorithm.
29164  *
29165  * This function does not include compatibility
29166  * decompositions. It does, however, include algorithmic
29167  * Hangul Jamo decomposition, as well as 'singleton'
29168  * decompositions which replace a character by a single
29169  * other character. In the case of singletons *@b will
29170  * be set to zero.
29171  *
29172  * If @ch is not decomposable, *@a is set to @ch and *@b
29173  * is set to zero.
29174  *
29175  * Note that the way Unicode decomposition pairs are
29176  * defined, it is guaranteed that @b would not decompose
29177  * further, but @a may itself decompose.  To get the full
29178  * canonical decomposition for @ch, one would need to
29179  * recursively call this function on @a.  Or use
29180  * g_unichar_fully_decompose().
29181  *
29182  * See <ulink url="http://unicode.org/reports/tr15/">UAX#15</ulink>
29183  * for details.
29184  *
29185  * Returns: %TRUE if the character could be decomposed
29186  * Since: 2.30
29187  */
29188
29189
29190 /**
29191  * g_unichar_digit_value:
29192  * @c: a Unicode character
29193  *
29194  * Determines the numeric value of a character as a decimal
29195  * digit.
29196  *
29197  * Returns: If @c is a decimal digit (according to g_unichar_isdigit()), its numeric value. Otherwise, -1.
29198  */
29199
29200
29201 /**
29202  * g_unichar_fully_decompose:
29203  * @ch: a Unicode character.
29204  * @compat: whether perform canonical or compatibility decomposition
29205  * @result: (allow-none): location to store decomposed result, or %NULL
29206  * @result_len: length of @result
29207  *
29208  * Computes the canonical or compatibility decomposition of a
29209  * Unicode character.  For compatibility decomposition,
29210  * pass %TRUE for @compat; for canonical decomposition
29211  * pass %FALSE for @compat.
29212  *
29213  * The decomposed sequence is placed in @result.  Only up to
29214  * @result_len characters are written into @result.  The length
29215  * of the full decomposition (irrespective of @result_len) is
29216  * returned by the function.  For canonical decomposition,
29217  * currently all decompositions are of length at most 4, but
29218  * this may change in the future (very unlikely though).
29219  * At any rate, Unicode does guarantee that a buffer of length
29220  * 18 is always enough for both compatibility and canonical
29221  * decompositions, so that is the size recommended. This is provided
29222  * as %G_UNICHAR_MAX_DECOMPOSITION_LENGTH.
29223  *
29224  * See <ulink url="http://unicode.org/reports/tr15/">UAX#15</ulink>
29225  * for details.
29226  *
29227  * Returns: the length of the full decomposition.
29228  * Since: 2.30
29229  */
29230
29231
29232 /**
29233  * g_unichar_get_mirror_char:
29234  * @ch: a Unicode character
29235  * @mirrored_ch: location to store the mirrored character
29236  *
29237  * In Unicode, some characters are <firstterm>mirrored</firstterm>. This
29238  * means that their images are mirrored horizontally in text that is laid
29239  * out from right to left. For instance, "(" would become its mirror image,
29240  * ")", in right-to-left text.
29241  *
29242  * If @ch has the Unicode mirrored property and there is another unicode
29243  * character that typically has a glyph that is the mirror image of @ch's
29244  * glyph and @mirrored_ch is set, it puts that character in the address
29245  * pointed to by @mirrored_ch.  Otherwise the original character is put.
29246  *
29247  * Returns: %TRUE if @ch has a mirrored character, %FALSE otherwise
29248  * Since: 2.4
29249  */
29250
29251
29252 /**
29253  * g_unichar_get_script:
29254  * @ch: a Unicode character
29255  *
29256  * Looks up the #GUnicodeScript for a particular character (as defined
29257  * by Unicode Standard Annex \#24). No check is made for @ch being a
29258  * valid Unicode character; if you pass in invalid character, the
29259  * result is undefined.
29260  *
29261  * This function is equivalent to pango_script_for_unichar() and the
29262  * two are interchangeable.
29263  *
29264  * Returns: the #GUnicodeScript for the character.
29265  * Since: 2.14
29266  */
29267
29268
29269 /**
29270  * g_unichar_isalnum:
29271  * @c: a Unicode character
29272  *
29273  * Determines whether a character is alphanumeric.
29274  * Given some UTF-8 text, obtain a character value
29275  * with g_utf8_get_char().
29276  *
29277  * Returns: %TRUE if @c is an alphanumeric character
29278  */
29279
29280
29281 /**
29282  * g_unichar_isalpha:
29283  * @c: a Unicode character
29284  *
29285  * Determines whether a character is alphabetic (i.e. a letter).
29286  * Given some UTF-8 text, obtain a character value with
29287  * g_utf8_get_char().
29288  *
29289  * Returns: %TRUE if @c is an alphabetic character
29290  */
29291
29292
29293 /**
29294  * g_unichar_iscntrl:
29295  * @c: a Unicode character
29296  *
29297  * Determines whether a character is a control character.
29298  * Given some UTF-8 text, obtain a character value with
29299  * g_utf8_get_char().
29300  *
29301  * Returns: %TRUE if @c is a control character
29302  */
29303
29304
29305 /**
29306  * g_unichar_isdefined:
29307  * @c: a Unicode character
29308  *
29309  * Determines if a given character is assigned in the Unicode
29310  * standard.
29311  *
29312  * Returns: %TRUE if the character has an assigned value
29313  */
29314
29315
29316 /**
29317  * g_unichar_isdigit:
29318  * @c: a Unicode character
29319  *
29320  * Determines whether a character is numeric (i.e. a digit).  This
29321  * covers ASCII 0-9 and also digits in other languages/scripts.  Given
29322  * some UTF-8 text, obtain a character value with g_utf8_get_char().
29323  *
29324  * Returns: %TRUE if @c is a digit
29325  */
29326
29327
29328 /**
29329  * g_unichar_isgraph:
29330  * @c: a Unicode character
29331  *
29332  * Determines whether a character is printable and not a space
29333  * (returns %FALSE for control characters, format characters, and
29334  * spaces). g_unichar_isprint() is similar, but returns %TRUE for
29335  * spaces. Given some UTF-8 text, obtain a character value with
29336  * g_utf8_get_char().
29337  *
29338  * Returns: %TRUE if @c is printable unless it's a space
29339  */
29340
29341
29342 /**
29343  * g_unichar_islower:
29344  * @c: a Unicode character
29345  *
29346  * Determines whether a character is a lowercase letter.
29347  * Given some UTF-8 text, obtain a character value with
29348  * g_utf8_get_char().
29349  *
29350  * Returns: %TRUE if @c is a lowercase letter
29351  */
29352
29353
29354 /**
29355  * g_unichar_ismark:
29356  * @c: a Unicode character
29357  *
29358  * Determines whether a character is a mark (non-spacing mark,
29359  * combining mark, or enclosing mark in Unicode speak).
29360  * Given some UTF-8 text, obtain a character value
29361  * with g_utf8_get_char().
29362  *
29363  * Note: in most cases where isalpha characters are allowed,
29364  * ismark characters should be allowed to as they are essential
29365  * for writing most European languages as well as many non-Latin
29366  * scripts.
29367  *
29368  * Returns: %TRUE if @c is a mark character
29369  * Since: 2.14
29370  */
29371
29372
29373 /**
29374  * g_unichar_isprint:
29375  * @c: a Unicode character
29376  *
29377  * Determines whether a character is printable.
29378  * Unlike g_unichar_isgraph(), returns %TRUE for spaces.
29379  * Given some UTF-8 text, obtain a character value with
29380  * g_utf8_get_char().
29381  *
29382  * Returns: %TRUE if @c is printable
29383  */
29384
29385
29386 /**
29387  * g_unichar_ispunct:
29388  * @c: a Unicode character
29389  *
29390  * Determines whether a character is punctuation or a symbol.
29391  * Given some UTF-8 text, obtain a character value with
29392  * g_utf8_get_char().
29393  *
29394  * Returns: %TRUE if @c is a punctuation or symbol character
29395  */
29396
29397
29398 /**
29399  * g_unichar_isspace:
29400  * @c: a Unicode character
29401  *
29402  * Determines whether a character is a space, tab, or line separator
29403  * (newline, carriage return, etc.).  Given some UTF-8 text, obtain a
29404  * character value with g_utf8_get_char().
29405  *
29406  * (Note: don't use this to do word breaking; you have to use
29407  * Pango or equivalent to get word breaking right, the algorithm
29408  * is fairly complex.)
29409  *
29410  * Returns: %TRUE if @c is a space character
29411  */
29412
29413
29414 /**
29415  * g_unichar_istitle:
29416  * @c: a Unicode character
29417  *
29418  * Determines if a character is titlecase. Some characters in
29419  * Unicode which are composites, such as the DZ digraph
29420  * have three case variants instead of just two. The titlecase
29421  * form is used at the beginning of a word where only the
29422  * first letter is capitalized. The titlecase form of the DZ
29423  * digraph is U+01F2 LATIN CAPITAL LETTTER D WITH SMALL LETTER Z.
29424  *
29425  * Returns: %TRUE if the character is titlecase
29426  */
29427
29428
29429 /**
29430  * g_unichar_isupper:
29431  * @c: a Unicode character
29432  *
29433  * Determines if a character is uppercase.
29434  *
29435  * Returns: %TRUE if @c is an uppercase character
29436  */
29437
29438
29439 /**
29440  * g_unichar_iswide:
29441  * @c: a Unicode character
29442  *
29443  * Determines if a character is typically rendered in a double-width
29444  * cell.
29445  *
29446  * Returns: %TRUE if the character is wide
29447  */
29448
29449
29450 /**
29451  * g_unichar_iswide_cjk:
29452  * @c: a Unicode character
29453  *
29454  * Determines if a character is typically rendered in a double-width
29455  * cell under legacy East Asian locales.  If a character is wide according to
29456  * g_unichar_iswide(), then it is also reported wide with this function, but
29457  * the converse is not necessarily true.  See the
29458  * <ulink url="http://www.unicode.org/reports/tr11/">Unicode Standard
29459  * Annex #11</ulink> for details.
29460  *
29461  * If a character passes the g_unichar_iswide() test then it will also pass
29462  * this test, but not the other way around.  Note that some characters may
29463  * pas both this test and g_unichar_iszerowidth().
29464  *
29465  * Returns: %TRUE if the character is wide in legacy East Asian locales
29466  * Since: 2.12
29467  */
29468
29469
29470 /**
29471  * g_unichar_isxdigit:
29472  * @c: a Unicode character.
29473  *
29474  * Determines if a character is a hexidecimal digit.
29475  *
29476  * Returns: %TRUE if the character is a hexadecimal digit
29477  */
29478
29479
29480 /**
29481  * g_unichar_iszerowidth:
29482  * @c: a Unicode character
29483  *
29484  * Determines if a given character typically takes zero width when rendered.
29485  * The return value is %TRUE for all non-spacing and enclosing marks
29486  * (e.g., combining accents), format characters, zero-width
29487  * space, but not U+00AD SOFT HYPHEN.
29488  *
29489  * A typical use of this function is with one of g_unichar_iswide() or
29490  * g_unichar_iswide_cjk() to determine the number of cells a string occupies
29491  * when displayed on a grid display (terminals).  However, note that not all
29492  * terminals support zero-width rendering of zero-width marks.
29493  *
29494  * Returns: %TRUE if the character has zero width
29495  * Since: 2.14
29496  */
29497
29498
29499 /**
29500  * g_unichar_to_utf8:
29501  * @c: a Unicode character code
29502  * @outbuf: output buffer, must have at least 6 bytes of space. If %NULL, the length will be computed and returned and nothing will be written to @outbuf.
29503  *
29504  * Converts a single character to UTF-8.
29505  *
29506  * Returns: number of bytes written
29507  */
29508
29509
29510 /**
29511  * g_unichar_tolower:
29512  * @c: a Unicode character.
29513  *
29514  * Converts a character to lower case.
29515  *
29516  * Returns: the result of converting @c to lower case. If @c is not an upperlower or titlecase character, or has no lowercase equivalent @c is returned unchanged.
29517  */
29518
29519
29520 /**
29521  * g_unichar_totitle:
29522  * @c: a Unicode character
29523  *
29524  * Converts a character to the titlecase.
29525  *
29526  * Returns: the result of converting @c to titlecase. If @c is not an uppercase or lowercase character, @c is returned unchanged.
29527  */
29528
29529
29530 /**
29531  * g_unichar_toupper:
29532  * @c: a Unicode character
29533  *
29534  * Converts a character to uppercase.
29535  *
29536  * Returns: the result of converting @c to uppercase. If @c is not an lowercase or titlecase character, or has no upper case equivalent @c is returned unchanged.
29537  */
29538
29539
29540 /**
29541  * g_unichar_type:
29542  * @c: a Unicode character
29543  *
29544  * Classifies a Unicode character by type.
29545  *
29546  * Returns: the type of the character.
29547  */
29548
29549
29550 /**
29551  * g_unichar_validate:
29552  * @ch: a Unicode character
29553  *
29554  * Checks whether @ch is a valid Unicode character. Some possible
29555  * integer values of @ch will not be valid. 0 is considered a valid
29556  * character, though it's normally a string terminator.
29557  *
29558  * Returns: %TRUE if @ch is a valid Unicode character
29559  */
29560
29561
29562 /**
29563  * g_unichar_xdigit_value:
29564  * @c: a Unicode character
29565  *
29566  * Determines the numeric value of a character as a hexidecimal
29567  * digit.
29568  *
29569  * Returns: If @c is a hex digit (according to g_unichar_isxdigit()), its numeric value. Otherwise, -1.
29570  */
29571
29572
29573 /**
29574  * g_unicode_canonical_decomposition:
29575  * @ch: a Unicode character.
29576  * @result_len: location to store the length of the return value.
29577  *
29578  * Computes the canonical decomposition of a Unicode character.
29579  *
29580  * Returns: a newly allocated string of Unicode characters. @result_len is set to the resulting length of the string.
29581  * Deprecated: 2.30: Use the more flexible g_unichar_fully_decompose() instead.
29582  */
29583
29584
29585 /**
29586  * g_unicode_canonical_ordering:
29587  * @string: a UCS-4 encoded string.
29588  * @len: the maximum length of @string to use.
29589  *
29590  * Computes the canonical ordering of a string in-place.
29591  * This rearranges decomposed characters in the string
29592  * according to their combining classes.  See the Unicode
29593  * manual for more information.
29594  */
29595
29596
29597 /**
29598  * g_unicode_script_from_iso15924:
29599  * @iso15924: a Unicode script
29600  *
29601  * Looks up the Unicode script for @iso15924.  ISO 15924 assigns four-letter
29602  * codes to scripts.  For example, the code for Arabic is 'Arab'.
29603  * This function accepts four letter codes encoded as a @guint32 in a
29604  * big-endian fashion.  That is, the code expected for Arabic is
29605  * 0x41726162 (0x41 is ASCII code for 'A', 0x72 is ASCII code for 'r', etc).
29606  *
29607  * See <ulink url="http://unicode.org/iso15924/codelists.html">Codes for the
29608  * representation of names of scripts</ulink> for details.
29609  *
29610  * Returns: the Unicode script for @iso15924, or of %G_UNICODE_SCRIPT_INVALID_CODE if @iso15924 is zero and %G_UNICODE_SCRIPT_UNKNOWN if @iso15924 is unknown.
29611  * Since: 2.30
29612  */
29613
29614
29615 /**
29616  * g_unicode_script_to_iso15924:
29617  * @script: a Unicode script
29618  *
29619  * Looks up the ISO 15924 code for @script.  ISO 15924 assigns four-letter
29620  * codes to scripts.  For example, the code for Arabic is 'Arab'.  The
29621  * four letter codes are encoded as a @guint32 by this function in a
29622  * big-endian fashion.  That is, the code returned for Arabic is
29623  * 0x41726162 (0x41 is ASCII code for 'A', 0x72 is ASCII code for 'r', etc).
29624  *
29625  * See <ulink url="http://unicode.org/iso15924/codelists.html">Codes for the
29626  * representation of names of scripts</ulink> for details.
29627  *
29628  * Returns: the ISO 15924 code for @script, encoded as an integer, of zero if @script is %G_UNICODE_SCRIPT_INVALID_CODE or ISO 15924 code 'Zzzz' (script code for UNKNOWN) if @script is not understood.
29629  * Since: 2.30
29630  */
29631
29632
29633 /**
29634  * g_unix_open_pipe:
29635  * @fds: Array of two integers
29636  * @flags: Bitfield of file descriptor flags, see "man 2 fcntl"
29637  * @error: a #GError
29638  *
29639  * Similar to the UNIX pipe() call, but on modern systems like Linux
29640  * uses the pipe2() system call, which atomically creates a pipe with
29641  * the configured flags.  The only supported flag currently is
29642  * <literal>FD_CLOEXEC</literal>.  If for example you want to configure
29643  * <literal>O_NONBLOCK</literal>, that must still be done separately with
29644  * fcntl().
29645  *
29646  * <note>This function does *not* take <literal>O_CLOEXEC</literal>, it takes
29647  * <literal>FD_CLOEXEC</literal> as if for fcntl(); these are
29648  * different on Linux/glibc.</note>
29649  *
29650  * Returns: %TRUE on success, %FALSE if not (and errno will be set).
29651  * Since: 2.30
29652  */
29653
29654
29655 /**
29656  * g_unix_set_fd_nonblocking:
29657  * @fd: A file descriptor
29658  * @nonblock: If %TRUE, set the descriptor to be non-blocking
29659  * @error: a #GError
29660  *
29661  * Control the non-blocking state of the given file descriptor,
29662  * according to @nonblock.  On most systems this uses <literal>O_NONBLOCK</literal>, but
29663  * on some older ones may use <literal>O_NDELAY</literal>.
29664  *
29665  * Returns: %TRUE if successful
29666  * Since: 2.30
29667  */
29668
29669
29670 /**
29671  * g_unix_signal_add:
29672  * @signum: Signal number
29673  * @handler: Callback
29674  * @user_data: Data for @handler
29675  *
29676  * A convenience function for g_unix_signal_source_new(), which
29677  * attaches to the default #GMainContext.  You can remove the watch
29678  * using g_source_remove().
29679  *
29680  * Returns: An ID (greater than 0) for the event source
29681  * Since: 2.30
29682  */
29683
29684
29685 /**
29686  * g_unix_signal_add_full:
29687  * @priority: the priority of the signal source. Typically this will be in the range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.
29688  * @signum: Signal number
29689  * @handler: Callback
29690  * @user_data: Data for @handler
29691  * @notify: #GDestroyNotify for @handler
29692  *
29693  * A convenience function for g_unix_signal_source_new(), which
29694  * attaches to the default #GMainContext.  You can remove the watch
29695  * using g_source_remove().
29696  *
29697  * Returns: An ID (greater than 0) for the event source
29698  * Since: 2.30
29699  */
29700
29701
29702 /**
29703  * g_unix_signal_source_new:
29704  * @signum: A signal number
29705  *
29706  * Create a #GSource that will be dispatched upon delivery of the UNIX
29707  * signal @signum.  In GLib versions before 2.36, only
29708  * <literal>SIGHUP</literal>, <literal>SIGINT</literal>,
29709  * <literal>SIGTERM</literal> can be monitored.  In GLib 2.36,
29710  * <literal>SIGUSR1</literal> and <literal>SIGUSR2</literal> were
29711  * added.
29712  *
29713  * Note that unlike the UNIX default, all sources which have created a
29714  * watch will be dispatched, regardless of which underlying thread
29715  * invoked g_unix_signal_source_new().
29716  *
29717  * For example, an effective use of this function is to handle <literal>SIGTERM</literal>
29718  * cleanly; flushing any outstanding files, and then calling
29719  * g_main_loop_quit ().  It is not safe to do any of this a regular
29720  * UNIX signal handler; your handler may be invoked while malloc() or
29721  * another library function is running, causing reentrancy if you
29722  * attempt to use it from the handler.  None of the GLib/GObject API
29723  * is safe against this kind of reentrancy.
29724  *
29725  * The interaction of this source when combined with native UNIX
29726  * functions like sigprocmask() is not defined.
29727  *
29728  * The source will not initially be associated with any #GMainContext
29729  * and must be added to one with g_source_attach() before it will be
29730  * executed.
29731  *
29732  * Returns: A newly created #GSource
29733  * Since: 2.30
29734  */
29735
29736
29737 /**
29738  * g_unlink:
29739  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
29740  *
29741  * A wrapper for the POSIX unlink() function. The unlink() function
29742  * deletes a name from the filesystem. If this was the last link to the
29743  * file and no processes have it opened, the diskspace occupied by the
29744  * file is freed.
29745  *
29746  * See your C library manual for more details about unlink(). Note
29747  * that on Windows, it is in general not possible to delete files that
29748  * are open to some process, or mapped into memory.
29749  *
29750  * Returns: 0 if the name was successfully deleted, -1 if an error occurred
29751  * Since: 2.6
29752  */
29753
29754
29755 /**
29756  * g_unsetenv:
29757  * @variable: the environment variable to remove, must not contain '='
29758  *
29759  * Removes an environment variable from the environment.
29760  *
29761  * Note that on some systems, when variables are overwritten, the
29762  * memory used for the previous variables and its value isn't reclaimed.
29763  *
29764  * <warning><para>
29765  * Environment variable handling in UNIX is not thread-safe, and your
29766  * program may crash if one thread calls g_unsetenv() while another
29767  * thread is calling getenv(). (And note that many functions, such as
29768  * gettext(), call getenv() internally.) This function is only safe
29769  * to use at the very start of your program, before creating any other
29770  * threads (or creating objects that create worker threads of their
29771  * own).
29772  * </para><para>
29773  * If you need to set up the environment for a child process, you can
29774  * use g_get_environ() to get an environment array, modify that with
29775  * g_environ_setenv() and g_environ_unsetenv(), and then pass that
29776  * array directly to execvpe(), g_spawn_async(), or the like.
29777  * </para></warning>
29778  *
29779  * Since: 2.4
29780  */
29781
29782
29783 /**
29784  * g_uri_escape_string:
29785  * @unescaped: the unescaped input string.
29786  * @reserved_chars_allowed: a string of reserved characters that are allowed to be used, or %NULL.
29787  * @allow_utf8: %TRUE if the result can include UTF-8 characters.
29788  *
29789  * Escapes a string for use in a URI.
29790  *
29791  * Normally all characters that are not "unreserved" (i.e. ASCII alphanumerical
29792  * characters plus dash, dot, underscore and tilde) are escaped.
29793  * But if you specify characters in @reserved_chars_allowed they are not
29794  * escaped. This is useful for the "reserved" characters in the URI
29795  * specification, since those are allowed unescaped in some portions of
29796  * a URI.
29797  *
29798  * Returns: an escaped version of @unescaped. The returned string should be freed when no longer needed.
29799  * Since: 2.16
29800  */
29801
29802
29803 /**
29804  * g_uri_list_extract_uris:
29805  * @uri_list: an URI list
29806  *
29807  * Splits an URI list conforming to the text/uri-list
29808  * mime type defined in RFC 2483 into individual URIs,
29809  * discarding any comments. The URIs are not validated.
29810  *
29811  * Returns: (transfer full): a newly allocated %NULL-terminated list of strings holding the individual URIs. The array should be freed with g_strfreev().
29812  * Since: 2.6
29813  */
29814
29815
29816 /**
29817  * g_uri_parse_scheme:
29818  * @uri: a valid URI.
29819  *
29820  * Gets the scheme portion of a URI string. RFC 3986 decodes the scheme as:
29821  * <programlisting>
29822  * URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
29823  * </programlisting>
29824  * Common schemes include "file", "http", "svn+ssh", etc.
29825  *
29826  * Returns: The "Scheme" component of the URI, or %NULL on error. The returned string should be freed when no longer needed.
29827  * Since: 2.16
29828  */
29829
29830
29831 /**
29832  * g_uri_unescape_segment:
29833  * @escaped_string: (allow-none): A string, may be %NULL
29834  * @escaped_string_end: (allow-none): Pointer to end of @escaped_string, may be %NULL
29835  * @illegal_characters: (allow-none): An optional string of illegal characters not to be allowed, may be %NULL
29836  *
29837  * Unescapes a segment of an escaped string.
29838  *
29839  * If any of the characters in @illegal_characters or the character zero appears
29840  * as an escaped character in @escaped_string then that is an error and %NULL
29841  * will be returned. This is useful it you want to avoid for instance having a
29842  * slash being expanded in an escaped path element, which might confuse pathname
29843  * handling.
29844  *
29845  * Returns: an unescaped version of @escaped_string or %NULL on error. The returned string should be freed when no longer needed.  As a special case if %NULL is given for @escaped_string, this function will return %NULL.
29846  * Since: 2.16
29847  */
29848
29849
29850 /**
29851  * g_uri_unescape_string:
29852  * @escaped_string: an escaped string to be unescaped.
29853  * @illegal_characters: an optional string of illegal characters not to be allowed.
29854  *
29855  * Unescapes a whole escaped string.
29856  *
29857  * If any of the characters in @illegal_characters or the character zero appears
29858  * as an escaped character in @escaped_string then that is an error and %NULL
29859  * will be returned. This is useful it you want to avoid for instance having a
29860  * slash being expanded in an escaped path element, which might confuse pathname
29861  * handling.
29862  *
29863  * Returns: an unescaped version of @escaped_string. The returned string should be freed when no longer needed.
29864  * Since: 2.16
29865  */
29866
29867
29868 /**
29869  * g_usleep:
29870  * @microseconds: number of microseconds to pause
29871  *
29872  * Pauses the current thread for the given number of microseconds.
29873  *
29874  * There are 1 million microseconds per second (represented by the
29875  * #G_USEC_PER_SEC macro). g_usleep() may have limited precision,
29876  * depending on hardware and operating system; don't rely on the exact
29877  * length of the sleep.
29878  */
29879
29880
29881 /**
29882  * g_utf16_to_ucs4:
29883  * @str: a UTF-16 encoded string
29884  * @len: the maximum length (number of <type>gunichar2</type>) of @str to use. If @len < 0, then the string is nul-terminated.
29885  * @items_read: (allow-none): location to store number of words read, or %NULL. If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be returned in case @str contains a trailing partial character. If an error occurs then the index of the invalid input is stored here.
29886  * @items_written: (allow-none): location to store number of characters written, or %NULL. The value stored here does not include the trailing 0 character.
29887  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError other than %G_CONVERT_ERROR_NO_CONVERSION may occur.
29888  *
29889  * Convert a string from UTF-16 to UCS-4. The result will be
29890  * nul-terminated.
29891  *
29892  * Returns: a pointer to a newly allocated UCS-4 string. This value must be freed with g_free(). If an error occurs, %NULL will be returned and @error set.
29893  */
29894
29895
29896 /**
29897  * g_utf16_to_utf8:
29898  * @str: a UTF-16 encoded string
29899  * @len: the maximum length (number of <type>gunichar2</type>) of @str to use. If @len < 0, then the string is nul-terminated.
29900  * @items_read: (allow-none): location to store number of words read, or %NULL. If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be returned in case @str contains a trailing partial character. If an error occurs then the index of the invalid input is stored here.
29901  * @items_written: (allow-none): location to store number of bytes written, or %NULL. The value stored here does not include the trailing 0 byte.
29902  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError other than %G_CONVERT_ERROR_NO_CONVERSION may occur.
29903  *
29904  * Convert a string from UTF-16 to UTF-8. The result will be
29905  * terminated with a 0 byte.
29906  *
29907  * Note that the input is expected to be already in native endianness,
29908  * an initial byte-order-mark character is not handled specially.
29909  * g_convert() can be used to convert a byte buffer of UTF-16 data of
29910  * ambiguous endianess.
29911  *
29912  * Further note that this function does not validate the result
29913  * string; it may e.g. include embedded NUL characters. The only
29914  * validation done by this function is to ensure that the input can
29915  * be correctly interpreted as UTF-16, i.e. it doesn't contain
29916  * things unpaired surrogates.
29917  *
29918  * Returns: a pointer to a newly allocated UTF-8 string. This value must be freed with g_free(). If an error occurs, %NULL will be returned and @error set.
29919  */
29920
29921
29922 /**
29923  * g_utf8_casefold:
29924  * @str: a UTF-8 encoded string
29925  * @len: length of @str, in bytes, or -1 if @str is nul-terminated.
29926  *
29927  * Converts a string into a form that is independent of case. The
29928  * result will not correspond to any particular case, but can be
29929  * compared for equality or ordered with the results of calling
29930  * g_utf8_casefold() on other strings.
29931  *
29932  * Note that calling g_utf8_casefold() followed by g_utf8_collate() is
29933  * only an approximation to the correct linguistic case insensitive
29934  * ordering, though it is a fairly good one. Getting this exactly
29935  * right would require a more sophisticated collation function that
29936  * takes case sensitivity into account. GLib does not currently
29937  * provide such a function.
29938  *
29939  * Returns: a newly allocated string, that is a case independent form of @str.
29940  */
29941
29942
29943 /**
29944  * g_utf8_collate:
29945  * @str1: a UTF-8 encoded string
29946  * @str2: a UTF-8 encoded string
29947  *
29948  * Compares two strings for ordering using the linguistically
29949  * correct rules for the <link linkend="setlocale">current locale</link>.
29950  * When sorting a large number of strings, it will be significantly
29951  * faster to obtain collation keys with g_utf8_collate_key() and
29952  * compare the keys with strcmp() when sorting instead of sorting
29953  * the original strings.
29954  *
29955  * Returns: &lt; 0 if @str1 compares before @str2, 0 if they compare equal, &gt; 0 if @str1 compares after @str2.
29956  */
29957
29958
29959 /**
29960  * g_utf8_collate_key:
29961  * @str: a UTF-8 encoded string.
29962  * @len: length of @str, in bytes, or -1 if @str is nul-terminated.
29963  *
29964  * Converts a string into a collation key that can be compared
29965  * with other collation keys produced by the same function using
29966  * strcmp().
29967  *
29968  * The results of comparing the collation keys of two strings
29969  * with strcmp() will always be the same as comparing the two
29970  * original keys with g_utf8_collate().
29971  *
29972  * Note that this function depends on the
29973  * <link linkend="setlocale">current locale</link>.
29974  *
29975  * Returns: a newly allocated string. This string should be freed with g_free() when you are done with it.
29976  */
29977
29978
29979 /**
29980  * g_utf8_collate_key_for_filename:
29981  * @str: a UTF-8 encoded string.
29982  * @len: length of @str, in bytes, or -1 if @str is nul-terminated.
29983  *
29984  * Converts a string into a collation key that can be compared
29985  * with other collation keys produced by the same function using strcmp().
29986  *
29987  * In order to sort filenames correctly, this function treats the dot '.'
29988  * as a special case. Most dictionary orderings seem to consider it
29989  * insignificant, thus producing the ordering "event.c" "eventgenerator.c"
29990  * "event.h" instead of "event.c" "event.h" "eventgenerator.c". Also, we
29991  * would like to treat numbers intelligently so that "file1" "file10" "file5"
29992  * is sorted as "file1" "file5" "file10".
29993  *
29994  * Note that this function depends on the
29995  * <link linkend="setlocale">current locale</link>.
29996  *
29997  * Returns: a newly allocated string. This string should be freed with g_free() when you are done with it.
29998  * Since: 2.8
29999  */
30000
30001
30002 /**
30003  * g_utf8_find_next_char:
30004  * @p: a pointer to a position within a UTF-8 encoded string
30005  * @end: a pointer to the byte following the end of the string, or %NULL to indicate that the string is nul-terminated.
30006  *
30007  * Finds the start of the next UTF-8 character in the string after @p.
30008  *
30009  * @p does not have to be at the beginning of a UTF-8 character. No check
30010  * is made to see if the character found is actually valid other than
30011  * it starts with an appropriate byte.
30012  *
30013  * Returns: a pointer to the found character or %NULL
30014  */
30015
30016
30017 /**
30018  * g_utf8_find_prev_char:
30019  * @str: pointer to the beginning of a UTF-8 encoded string
30020  * @p: pointer to some position within @str
30021  *
30022  * Given a position @p with a UTF-8 encoded string @str, find the start
30023  * of the previous UTF-8 character starting before @p. Returns %NULL if no
30024  * UTF-8 characters are present in @str before @p.
30025  *
30026  * @p does not have to be at the beginning of a UTF-8 character. No check
30027  * is made to see if the character found is actually valid other than
30028  * it starts with an appropriate byte.
30029  *
30030  * Returns: a pointer to the found character or %NULL.
30031  */
30032
30033
30034 /**
30035  * g_utf8_get_char:
30036  * @p: a pointer to Unicode character encoded as UTF-8
30037  *
30038  * Converts a sequence of bytes encoded as UTF-8 to a Unicode character.
30039  * If @p does not point to a valid UTF-8 encoded character, results are
30040  * undefined. If you are not sure that the bytes are complete
30041  * valid Unicode characters, you should use g_utf8_get_char_validated()
30042  * instead.
30043  *
30044  * Returns: the resulting character
30045  */
30046
30047
30048 /**
30049  * g_utf8_get_char_validated:
30050  * @p: a pointer to Unicode character encoded as UTF-8
30051  * @max_len: the maximum number of bytes to read, or -1, for no maximum or if @p is nul-terminated
30052  *
30053  * Convert a sequence of bytes encoded as UTF-8 to a Unicode character.
30054  * This function checks for incomplete characters, for invalid characters
30055  * such as characters that are out of the range of Unicode, and for
30056  * overlong encodings of valid characters.
30057  *
30058  * Returns: the resulting character. If @p points to a partial sequence at the end of a string that could begin a valid character (or if @max_len is zero), returns (gunichar)-2; otherwise, if @p does not point to a valid UTF-8 encoded Unicode character, returns (gunichar)-1.
30059  */
30060
30061
30062 /**
30063  * g_utf8_normalize:
30064  * @str: a UTF-8 encoded string.
30065  * @len: length of @str, in bytes, or -1 if @str is nul-terminated.
30066  * @mode: the type of normalization to perform.
30067  *
30068  * Converts a string into canonical form, standardizing
30069  * such issues as whether a character with an accent
30070  * is represented as a base character and combining
30071  * accent or as a single precomposed character. The
30072  * string has to be valid UTF-8, otherwise %NULL is
30073  * returned. You should generally call g_utf8_normalize()
30074  * before comparing two Unicode strings.
30075  *
30076  * The normalization mode %G_NORMALIZE_DEFAULT only
30077  * standardizes differences that do not affect the
30078  * text content, such as the above-mentioned accent
30079  * representation. %G_NORMALIZE_ALL also standardizes
30080  * the "compatibility" characters in Unicode, such
30081  * as SUPERSCRIPT THREE to the standard forms
30082  * (in this case DIGIT THREE). Formatting information
30083  * may be lost but for most text operations such
30084  * characters should be considered the same.
30085  *
30086  * %G_NORMALIZE_DEFAULT_COMPOSE and %G_NORMALIZE_ALL_COMPOSE
30087  * are like %G_NORMALIZE_DEFAULT and %G_NORMALIZE_ALL,
30088  * but returned a result with composed forms rather
30089  * than a maximally decomposed form. This is often
30090  * useful if you intend to convert the string to
30091  * a legacy encoding or pass it to a system with
30092  * less capable Unicode handling.
30093  *
30094  * Returns: a newly allocated string, that is the normalized form of @str, or %NULL if @str is not valid UTF-8.
30095  */
30096
30097
30098 /**
30099  * g_utf8_offset_to_pointer:
30100  * @str: a UTF-8 encoded string
30101  * @offset: a character offset within @str
30102  *
30103  * Converts from an integer character offset to a pointer to a position
30104  * within the string.
30105  *
30106  * Since 2.10, this function allows to pass a negative @offset to
30107  * step backwards. It is usually worth stepping backwards from the end
30108  * instead of forwards if @offset is in the last fourth of the string,
30109  * since moving forward is about 3 times faster than moving backward.
30110  *
30111  * <note><para>
30112  * This function doesn't abort when reaching the end of @str. Therefore
30113  * you should be sure that @offset is within string boundaries before
30114  * calling that function. Call g_utf8_strlen() when unsure.
30115  *
30116  * This limitation exists as this function is called frequently during
30117  * text rendering and therefore has to be as fast as possible.
30118  * </para></note>
30119  *
30120  * Returns: the resulting pointer
30121  */
30122
30123
30124 /**
30125  * g_utf8_pointer_to_offset:
30126  * @str: a UTF-8 encoded string
30127  * @pos: a pointer to a position within @str
30128  *
30129  * Converts from a pointer to position within a string to a integer
30130  * character offset.
30131  *
30132  * Since 2.10, this function allows @pos to be before @str, and returns
30133  * a negative offset in this case.
30134  *
30135  * Returns: the resulting character offset
30136  */
30137
30138
30139 /**
30140  * g_utf8_prev_char:
30141  * @p: a pointer to a position within a UTF-8 encoded string
30142  *
30143  * Finds the previous UTF-8 character in the string before @p.
30144  *
30145  * @p does not have to be at the beginning of a UTF-8 character. No check
30146  * is made to see if the character found is actually valid other than
30147  * it starts with an appropriate byte. If @p might be the first
30148  * character of the string, you must use g_utf8_find_prev_char() instead.
30149  *
30150  * Returns: a pointer to the found character.
30151  */
30152
30153
30154 /**
30155  * g_utf8_strchr:
30156  * @p: a nul-terminated UTF-8 encoded string
30157  * @len: the maximum length of @p
30158  * @c: a Unicode character
30159  *
30160  * Finds the leftmost occurrence of the given Unicode character
30161  * in a UTF-8 encoded string, while limiting the search to @len bytes.
30162  * If @len is -1, allow unbounded search.
30163  *
30164  * Returns: %NULL if the string does not contain the character, otherwise, a pointer to the start of the leftmost occurrence of the character in the string.
30165  */
30166
30167
30168 /**
30169  * g_utf8_strdown:
30170  * @str: a UTF-8 encoded string
30171  * @len: length of @str, in bytes, or -1 if @str is nul-terminated.
30172  *
30173  * Converts all Unicode characters in the string that have a case
30174  * to lowercase. The exact manner that this is done depends
30175  * on the current locale, and may result in the number of
30176  * characters in the string changing.
30177  *
30178  * Returns: a newly allocated string, with all characters converted to lowercase.
30179  */
30180
30181
30182 /**
30183  * g_utf8_strlen:
30184  * @p: pointer to the start of a UTF-8 encoded string
30185  * @max: the maximum number of bytes to examine. If @max is less than 0, then the string is assumed to be nul-terminated. If @max is 0, @p will not be examined and may be %NULL. If @max is greater than 0, up to @max bytes are examined
30186  *
30187  * Computes the length of the string in characters, not including
30188  * the terminating nul character. If the @max'th byte falls in the
30189  * middle of a character, the last (partial) character is not counted.
30190  *
30191  * Returns: the length of the string in characters
30192  */
30193
30194
30195 /**
30196  * g_utf8_strncpy:
30197  * @dest: buffer to fill with characters from @src
30198  * @src: UTF-8 encoded string
30199  * @n: character count
30200  *
30201  * Like the standard C strncpy() function, but
30202  * copies a given number of characters instead of a given number of
30203  * bytes. The @src string must be valid UTF-8 encoded text.
30204  * (Use g_utf8_validate() on all text before trying to use UTF-8
30205  * utility functions with it.)
30206  *
30207  * Returns: @dest
30208  */
30209
30210
30211 /**
30212  * g_utf8_strrchr:
30213  * @p: a nul-terminated UTF-8 encoded string
30214  * @len: the maximum length of @p
30215  * @c: a Unicode character
30216  *
30217  * Find the rightmost occurrence of the given Unicode character
30218  * in a UTF-8 encoded string, while limiting the search to @len bytes.
30219  * If @len is -1, allow unbounded search.
30220  *
30221  * Returns: %NULL if the string does not contain the character, otherwise, a pointer to the start of the rightmost occurrence of the character in the string.
30222  */
30223
30224
30225 /**
30226  * g_utf8_strreverse:
30227  * @str: a UTF-8 encoded string
30228  * @len: the maximum length of @str to use, in bytes. If @len < 0, then the string is nul-terminated.
30229  *
30230  * Reverses a UTF-8 string. @str must be valid UTF-8 encoded text.
30231  * (Use g_utf8_validate() on all text before trying to use UTF-8
30232  * utility functions with it.)
30233  *
30234  * This function is intended for programmatic uses of reversed strings.
30235  * It pays no attention to decomposed characters, combining marks, byte
30236  * order marks, directional indicators (LRM, LRO, etc) and similar
30237  * characters which might need special handling when reversing a string
30238  * for display purposes.
30239  *
30240  * Note that unlike g_strreverse(), this function returns
30241  * newly-allocated memory, which should be freed with g_free() when
30242  * no longer needed.
30243  *
30244  * Returns: a newly-allocated string which is the reverse of @str.
30245  * Since: 2.2
30246  */
30247
30248
30249 /**
30250  * g_utf8_strup:
30251  * @str: a UTF-8 encoded string
30252  * @len: length of @str, in bytes, or -1 if @str is nul-terminated.
30253  *
30254  * Converts all Unicode characters in the string that have a case
30255  * to uppercase. The exact manner that this is done depends
30256  * on the current locale, and may result in the number of
30257  * characters in the string increasing. (For instance, the
30258  * German ess-zet will be changed to SS.)
30259  *
30260  * Returns: a newly allocated string, with all characters converted to uppercase.
30261  */
30262
30263
30264 /**
30265  * g_utf8_substring:
30266  * @str: a UTF-8 encoded string
30267  * @start_pos: a character offset within @str
30268  * @end_pos: another character offset within @str
30269  *
30270  * Copies a substring out of a UTF-8 encoded string.
30271  * The substring will contain @end_pos - @start_pos
30272  * characters.
30273  *
30274  * Returns: a newly allocated copy of the requested substring. Free with g_free() when no longer needed.
30275  * Since: 2.30
30276  */
30277
30278
30279 /**
30280  * g_utf8_to_ucs4:
30281  * @str: a UTF-8 encoded string
30282  * @len: the maximum length of @str to use, in bytes. If @len < 0, then the string is nul-terminated.
30283  * @items_read: (allow-none): location to store number of bytes read, or %NULL. If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be returned in case @str contains a trailing partial character. If an error occurs then the index of the invalid input is stored here.
30284  * @items_written: (allow-none): location to store number of characters written or %NULL. The value here stored does not include the trailing 0 character.
30285  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError other than %G_CONVERT_ERROR_NO_CONVERSION may occur.
30286  *
30287  * Convert a string from UTF-8 to a 32-bit fixed width
30288  * representation as UCS-4. A trailing 0 character will be added to the
30289  * string after the converted text.
30290  *
30291  * Returns: a pointer to a newly allocated UCS-4 string. This value must be freed with g_free(). If an error occurs, %NULL will be returned and @error set.
30292  */
30293
30294
30295 /**
30296  * g_utf8_to_ucs4_fast:
30297  * @str: a UTF-8 encoded string
30298  * @len: the maximum length of @str to use, in bytes. If @len < 0, then the string is nul-terminated.
30299  * @items_written: (allow-none): location to store the number of characters in the result, or %NULL.
30300  *
30301  * Convert a string from UTF-8 to a 32-bit fixed width
30302  * representation as UCS-4, assuming valid UTF-8 input.
30303  * This function is roughly twice as fast as g_utf8_to_ucs4()
30304  * but does no error checking on the input. A trailing 0 character
30305  * will be added to the string after the converted text.
30306  *
30307  * Returns: a pointer to a newly allocated UCS-4 string. This value must be freed with g_free().
30308  */
30309
30310
30311 /**
30312  * g_utf8_to_utf16:
30313  * @str: a UTF-8 encoded string
30314  * @len: the maximum length (number of bytes) of @str to use. If @len < 0, then the string is nul-terminated.
30315  * @items_read: (allow-none): location to store number of bytes read, or %NULL. If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be returned in case @str contains a trailing partial character. If an error occurs then the index of the invalid input is stored here.
30316  * @items_written: (allow-none): location to store number of <type>gunichar2</type> written, or %NULL. The value stored here does not include the trailing 0.
30317  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError other than %G_CONVERT_ERROR_NO_CONVERSION may occur.
30318  *
30319  * Convert a string from UTF-8 to UTF-16. A 0 character will be
30320  * added to the result after the converted text.
30321  *
30322  * Returns: a pointer to a newly allocated UTF-16 string. This value must be freed with g_free(). If an error occurs, %NULL will be returned and @error set.
30323  */
30324
30325
30326 /**
30327  * g_utf8_validate:
30328  * @str: (array length=max_len) (element-type guint8): a pointer to character data
30329  * @max_len: max bytes to validate, or -1 to go until NUL
30330  * @end: (allow-none) (out) (transfer none): return location for end of valid data
30331  *
30332  * Validates UTF-8 encoded text. @str is the text to validate;
30333  * if @str is nul-terminated, then @max_len can be -1, otherwise
30334  * @max_len should be the number of bytes to validate.
30335  * If @end is non-%NULL, then the end of the valid range
30336  * will be stored there (i.e. the start of the first invalid
30337  * character if some bytes were invalid, or the end of the text
30338  * being validated otherwise).
30339  *
30340  * Note that g_utf8_validate() returns %FALSE if @max_len is
30341  * positive and any of the @max_len bytes are NUL.
30342  *
30343  * Returns %TRUE if all of @str was valid. Many GLib and GTK+
30344  * routines <emphasis>require</emphasis> valid UTF-8 as input;
30345  * so data read from a file or the network should be checked
30346  * with g_utf8_validate() before doing anything else with it.
30347  *
30348  * Returns: %TRUE if the text was valid UTF-8
30349  */
30350
30351
30352 /**
30353  * g_utime:
30354  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
30355  * @utb: a pointer to a struct utimbuf.
30356  *
30357  * A wrapper for the POSIX utime() function. The utime() function
30358  * sets the access and modification timestamps of a file.
30359  *
30360  * See your C library manual for more details about how utime() works
30361  * on your system.
30362  *
30363  * Returns: 0 if the operation was successful, -1 if an error occurred
30364  * Since: 2.18
30365  */
30366
30367
30368 /**
30369  * g_variant_builder_add: (skp)
30370  * @builder: a #GVariantBuilder
30371  * @format_string: a #GVariant varargs format string
30372  * @...: arguments, as per @format_string
30373  *
30374  * Adds to a #GVariantBuilder.
30375  *
30376  * This call is a convenience wrapper that is exactly equivalent to
30377  * calling g_variant_new() followed by g_variant_builder_add_value().
30378  *
30379  * This function might be used as follows:
30380  *
30381  * <programlisting>
30382  * GVariant *
30383  * make_pointless_dictionary (void)
30384  * {
30385  *   GVariantBuilder *builder;
30386  *   int i;
30387  *
30388  *   builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
30389  *   for (i = 0; i < 16; i++)
30390  *     {
30391  *       gchar buf[3];
30392  *
30393  *       sprintf (buf, "%d", i);
30394  *       g_variant_builder_add (builder, "{is}", i, buf);
30395  *     }
30396  *
30397  *   return g_variant_builder_end (builder);
30398  * }
30399  * </programlisting>
30400  *
30401  * Since: 2.24
30402  */
30403
30404
30405 /**
30406  * g_variant_builder_add_parsed:
30407  * @builder: a #GVariantBuilder
30408  * @format: a text format #GVariant
30409  * @...: arguments as per @format
30410  *
30411  * Adds to a #GVariantBuilder.
30412  *
30413  * This call is a convenience wrapper that is exactly equivalent to
30414  * calling g_variant_new_parsed() followed by
30415  * g_variant_builder_add_value().
30416  *
30417  * This function might be used as follows:
30418  *
30419  * <programlisting>
30420  * GVariant *
30421  * make_pointless_dictionary (void)
30422  * {
30423  *   GVariantBuilder *builder;
30424  *   int i;
30425  *
30426  *   builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
30427  *   g_variant_builder_add_parsed (builder, "{'width', <%i>}", 600);
30428  *   g_variant_builder_add_parsed (builder, "{'title', <%s>}", "foo");
30429  *   g_variant_builder_add_parsed (builder, "{'transparency', <0.5>}");
30430  *   return g_variant_builder_end (builder);
30431  * }
30432  * </programlisting>
30433  *
30434  * Since: 2.26
30435  */
30436
30437
30438 /**
30439  * g_variant_builder_add_value:
30440  * @builder: a #GVariantBuilder
30441  * @value: a #GVariant
30442  *
30443  * Adds @value to @builder.
30444  *
30445  * It is an error to call this function in any way that would create an
30446  * inconsistent value to be constructed.  Some examples of this are
30447  * putting different types of items into an array, putting the wrong
30448  * types or number of items in a tuple, putting more than one value into
30449  * a variant, etc.
30450  *
30451  * If @value is a floating reference (see g_variant_ref_sink()),
30452  * the @builder instance takes ownership of @value.
30453  *
30454  * Since: 2.24
30455  */
30456
30457
30458 /**
30459  * g_variant_builder_clear: (skip)
30460  * @builder: a #GVariantBuilder
30461  *
30462  * Releases all memory associated with a #GVariantBuilder without
30463  * freeing the #GVariantBuilder structure itself.
30464  *
30465  * It typically only makes sense to do this on a stack-allocated
30466  * #GVariantBuilder if you want to abort building the value part-way
30467  * through.  This function need not be called if you call
30468  * g_variant_builder_end() and it also doesn't need to be called on
30469  * builders allocated with g_variant_builder_new (see
30470  * g_variant_builder_unref() for that).
30471  *
30472  * This function leaves the #GVariantBuilder structure set to all-zeros.
30473  * It is valid to call this function on either an initialised
30474  * #GVariantBuilder or one that is set to all-zeros but it is not valid
30475  * to call this function on uninitialised memory.
30476  *
30477  * Since: 2.24
30478  */
30479
30480
30481 /**
30482  * g_variant_builder_close:
30483  * @builder: a #GVariantBuilder
30484  *
30485  * Closes the subcontainer inside the given @builder that was opened by
30486  * the most recent call to g_variant_builder_open().
30487  *
30488  * It is an error to call this function in any way that would create an
30489  * inconsistent value to be constructed (ie: too few values added to the
30490  * subcontainer).
30491  *
30492  * Since: 2.24
30493  */
30494
30495
30496 /**
30497  * g_variant_builder_end:
30498  * @builder: a #GVariantBuilder
30499  *
30500  * Ends the builder process and returns the constructed value.
30501  *
30502  * It is not permissible to use @builder in any way after this call
30503  * except for reference counting operations (in the case of a
30504  * heap-allocated #GVariantBuilder) or by reinitialising it with
30505  * g_variant_builder_init() (in the case of stack-allocated).
30506  *
30507  * It is an error to call this function in any way that would create an
30508  * inconsistent value to be constructed (ie: insufficient number of
30509  * items added to a container with a specific number of children
30510  * required).  It is also an error to call this function if the builder
30511  * was created with an indefinite array or maybe type and no children
30512  * have been added; in this case it is impossible to infer the type of
30513  * the empty array.
30514  *
30515  * Returns: (transfer none): a new, floating, #GVariant
30516  * Since: 2.24
30517  */
30518
30519
30520 /**
30521  * g_variant_builder_init: (skip)
30522  * @builder: a #GVariantBuilder
30523  * @type: a container type
30524  *
30525  * Initialises a #GVariantBuilder structure.
30526  *
30527  * @type must be non-%NULL.  It specifies the type of container to
30528  * construct.  It can be an indefinite type such as
30529  * %G_VARIANT_TYPE_ARRAY or a definite type such as "as" or "(ii)".
30530  * Maybe, array, tuple, dictionary entry and variant-typed values may be
30531  * constructed.
30532  *
30533  * After the builder is initialised, values are added using
30534  * g_variant_builder_add_value() or g_variant_builder_add().
30535  *
30536  * After all the child values are added, g_variant_builder_end() frees
30537  * the memory associated with the builder and returns the #GVariant that
30538  * was created.
30539  *
30540  * This function completely ignores the previous contents of @builder.
30541  * On one hand this means that it is valid to pass in completely
30542  * uninitialised memory.  On the other hand, this means that if you are
30543  * initialising over top of an existing #GVariantBuilder you need to
30544  * first call g_variant_builder_clear() in order to avoid leaking
30545  * memory.
30546  *
30547  * You must not call g_variant_builder_ref() or
30548  * g_variant_builder_unref() on a #GVariantBuilder that was initialised
30549  * with this function.  If you ever pass a reference to a
30550  * #GVariantBuilder outside of the control of your own code then you
30551  * should assume that the person receiving that reference may try to use
30552  * reference counting; you should use g_variant_builder_new() instead of
30553  * this function.
30554  *
30555  * Since: 2.24
30556  */
30557
30558
30559 /**
30560  * g_variant_builder_new:
30561  * @type: a container type
30562  *
30563  * Allocates and initialises a new #GVariantBuilder.
30564  *
30565  * You should call g_variant_builder_unref() on the return value when it
30566  * is no longer needed.  The memory will not be automatically freed by
30567  * any other call.
30568  *
30569  * In most cases it is easier to place a #GVariantBuilder directly on
30570  * the stack of the calling function and initialise it with
30571  * g_variant_builder_init().
30572  *
30573  * Returns: (transfer full): a #GVariantBuilder
30574  * Since: 2.24
30575  */
30576
30577
30578 /**
30579  * g_variant_builder_open:
30580  * @builder: a #GVariantBuilder
30581  * @type: a #GVariantType
30582  *
30583  * Opens a subcontainer inside the given @builder.  When done adding
30584  * items to the subcontainer, g_variant_builder_close() must be called.
30585  *
30586  * It is an error to call this function in any way that would cause an
30587  * inconsistent value to be constructed (ie: adding too many values or
30588  * a value of an incorrect type).
30589  *
30590  * Since: 2.24
30591  */
30592
30593
30594 /**
30595  * g_variant_builder_ref:
30596  * @builder: a #GVariantBuilder allocated by g_variant_builder_new()
30597  *
30598  * Increases the reference count on @builder.
30599  *
30600  * Don't call this on stack-allocated #GVariantBuilder instances or bad
30601  * things will happen.
30602  *
30603  * Returns: (transfer full): a new reference to @builder
30604  * Since: 2.24
30605  */
30606
30607
30608 /**
30609  * g_variant_builder_unref:
30610  * @builder: (transfer full): a #GVariantBuilder allocated by g_variant_builder_new()
30611  *
30612  * Decreases the reference count on @builder.
30613  *
30614  * In the event that there are no more references, releases all memory
30615  * associated with the #GVariantBuilder.
30616  *
30617  * Don't call this on stack-allocated #GVariantBuilder instances or bad
30618  * things will happen.
30619  *
30620  * Since: 2.24
30621  */
30622
30623
30624 /**
30625  * g_variant_byteswap:
30626  * @value: a #GVariant
30627  *
30628  * Performs a byteswapping operation on the contents of @value.  The
30629  * result is that all multi-byte numeric data contained in @value is
30630  * byteswapped.  That includes 16, 32, and 64bit signed and unsigned
30631  * integers as well as file handles and double precision floating point
30632  * values.
30633  *
30634  * This function is an identity mapping on any value that does not
30635  * contain multi-byte numeric data.  That include strings, booleans,
30636  * bytes and containers containing only these things (recursively).
30637  *
30638  * The returned value is always in normal form and is marked as trusted.
30639  *
30640  * Returns: (transfer full): the byteswapped form of @value
30641  * Since: 2.24
30642  */
30643
30644
30645 /**
30646  * g_variant_check_format_string:
30647  * @value: a #GVariant
30648  * @format_string: a valid #GVariant format string
30649  * @copy_only: %TRUE to ensure the format string makes deep copies
30650  *
30651  * Checks if calling g_variant_get() with @format_string on @value would
30652  * be valid from a type-compatibility standpoint.  @format_string is
30653  * assumed to be a valid format string (from a syntactic standpoint).
30654  *
30655  * If @copy_only is %TRUE then this function additionally checks that it
30656  * would be safe to call g_variant_unref() on @value immediately after
30657  * the call to g_variant_get() without invalidating the result.  This is
30658  * only possible if deep copies are made (ie: there are no pointers to
30659  * the data inside of the soon-to-be-freed #GVariant instance).  If this
30660  * check fails then a g_critical() is printed and %FALSE is returned.
30661  *
30662  * This function is meant to be used by functions that wish to provide
30663  * varargs accessors to #GVariant values of uncertain values (eg:
30664  * g_variant_lookup() or g_menu_model_get_item_attribute()).
30665  *
30666  * Returns: %TRUE if @format_string is safe to use
30667  * Since: 2.34
30668  */
30669
30670
30671 /**
30672  * g_variant_classify:
30673  * @value: a #GVariant
30674  *
30675  * Classifies @value according to its top-level type.
30676  *
30677  * Returns: the #GVariantClass of @value
30678  * Since: 2.24
30679  */
30680
30681
30682 /**
30683  * g_variant_compare:
30684  * @one: (type GVariant): a basic-typed #GVariant instance
30685  * @two: (type GVariant): a #GVariant instance of the same type
30686  *
30687  * Compares @one and @two.
30688  *
30689  * The types of @one and @two are #gconstpointer only to allow use of
30690  * this function with #GTree, #GPtrArray, etc.  They must each be a
30691  * #GVariant.
30692  *
30693  * Comparison is only defined for basic types (ie: booleans, numbers,
30694  * strings).  For booleans, %FALSE is less than %TRUE.  Numbers are
30695  * ordered in the usual way.  Strings are in ASCII lexographical order.
30696  *
30697  * It is a programmer error to attempt to compare container values or
30698  * two values that have types that are not exactly equal.  For example,
30699  * you cannot compare a 32-bit signed integer with a 32-bit unsigned
30700  * integer.  Also note that this function is not particularly
30701  * well-behaved when it comes to comparison of doubles; in particular,
30702  * the handling of incomparable values (ie: NaN) is undefined.
30703  *
30704  * If you only require an equality comparison, g_variant_equal() is more
30705  * general.
30706  *
30707  * Returns: negative value if a &lt; b; zero if a = b; positive value if a &gt; b.
30708  * Since: 2.26
30709  */
30710
30711
30712 /**
30713  * g_variant_dup_bytestring:
30714  * @value: an array-of-bytes #GVariant instance
30715  * @length: (out) (allow-none) (default NULL): a pointer to a #gsize, to store the length (not including the nul terminator)
30716  *
30717  * Similar to g_variant_get_bytestring() except that instead of
30718  * returning a constant string, the string is duplicated.
30719  *
30720  * The return value must be freed using g_free().
30721  *
30722  * Returns: (transfer full) (array zero-terminated=1 length=length) (element-type guint8): a newly allocated string
30723  * Since: 2.26
30724  */
30725
30726
30727 /**
30728  * g_variant_dup_bytestring_array:
30729  * @value: an array of array of bytes #GVariant ('aay')
30730  * @length: (out) (allow-none): the length of the result, or %NULL
30731  *
30732  * Gets the contents of an array of array of bytes #GVariant.  This call
30733  * makes a deep copy; the return result should be released with
30734  * g_strfreev().
30735  *
30736  * If @length is non-%NULL then the number of elements in the result is
30737  * stored there.  In any case, the resulting array will be
30738  * %NULL-terminated.
30739  *
30740  * For an empty array, @length will be set to 0 and a pointer to a
30741  * %NULL pointer will be returned.
30742  *
30743  * Returns: (array length=length) (transfer full): an array of strings
30744  * Since: 2.26
30745  */
30746
30747
30748 /**
30749  * g_variant_dup_objv:
30750  * @value: an array of object paths #GVariant
30751  * @length: (out) (allow-none): the length of the result, or %NULL
30752  *
30753  * Gets the contents of an array of object paths #GVariant.  This call
30754  * makes a deep copy; the return result should be released with
30755  * g_strfreev().
30756  *
30757  * If @length is non-%NULL then the number of elements in the result
30758  * is stored there.  In any case, the resulting array will be
30759  * %NULL-terminated.
30760  *
30761  * For an empty array, @length will be set to 0 and a pointer to a
30762  * %NULL pointer will be returned.
30763  *
30764  * Returns: (array length=length zero-terminated=1) (transfer full): an array of strings
30765  * Since: 2.30
30766  */
30767
30768
30769 /**
30770  * g_variant_dup_string:
30771  * @value: a string #GVariant instance
30772  * @length: (out): a pointer to a #gsize, to store the length
30773  *
30774  * Similar to g_variant_get_string() except that instead of returning
30775  * a constant string, the string is duplicated.
30776  *
30777  * The string will always be utf8 encoded.
30778  *
30779  * The return value must be freed using g_free().
30780  *
30781  * Returns: (transfer full): a newly allocated string, utf8 encoded
30782  * Since: 2.24
30783  */
30784
30785
30786 /**
30787  * g_variant_dup_strv:
30788  * @value: an array of strings #GVariant
30789  * @length: (out) (allow-none): the length of the result, or %NULL
30790  *
30791  * Gets the contents of an array of strings #GVariant.  This call
30792  * makes a deep copy; the return result should be released with
30793  * g_strfreev().
30794  *
30795  * If @length is non-%NULL then the number of elements in the result
30796  * is stored there.  In any case, the resulting array will be
30797  * %NULL-terminated.
30798  *
30799  * For an empty array, @length will be set to 0 and a pointer to a
30800  * %NULL pointer will be returned.
30801  *
30802  * Returns: (array length=length zero-terminated=1) (transfer full): an array of strings
30803  * Since: 2.24
30804  */
30805
30806
30807 /**
30808  * g_variant_equal:
30809  * @one: (type GVariant): a #GVariant instance
30810  * @two: (type GVariant): a #GVariant instance
30811  *
30812  * Checks if @one and @two have the same type and value.
30813  *
30814  * The types of @one and @two are #gconstpointer only to allow use of
30815  * this function with #GHashTable.  They must each be a #GVariant.
30816  *
30817  * Returns: %TRUE if @one and @two are equal
30818  * Since: 2.24
30819  */
30820
30821
30822 /**
30823  * g_variant_get: (skip)
30824  * @value: a #GVariant instance
30825  * @format_string: a #GVariant format string
30826  * @...: arguments, as per @format_string
30827  *
30828  * Deconstructs a #GVariant instance.
30829  *
30830  * Think of this function as an analogue to scanf().
30831  *
30832  * The arguments that are expected by this function are entirely
30833  * determined by @format_string.  @format_string also restricts the
30834  * permissible types of @value.  It is an error to give a value with
30835  * an incompatible type.  See the section on <link
30836  * linkend='gvariant-format-strings'>GVariant Format Strings</link>.
30837  * Please note that the syntax of the format string is very likely to be
30838  * extended in the future.
30839  *
30840  * @format_string determines the C types that are used for unpacking
30841  * the values and also determines if the values are copied or borrowed,
30842  * see the section on
30843  * <link linkend='gvariant-format-strings-pointers'>GVariant Format Strings</link>.
30844  *
30845  * Since: 2.24
30846  */
30847
30848
30849 /**
30850  * g_variant_get_boolean:
30851  * @value: a boolean #GVariant instance
30852  *
30853  * Returns the boolean value of @value.
30854  *
30855  * It is an error to call this function with a @value of any type
30856  * other than %G_VARIANT_TYPE_BOOLEAN.
30857  *
30858  * Returns: %TRUE or %FALSE
30859  * Since: 2.24
30860  */
30861
30862
30863 /**
30864  * g_variant_get_byte:
30865  * @value: a byte #GVariant instance
30866  *
30867  * Returns the byte value of @value.
30868  *
30869  * It is an error to call this function with a @value of any type
30870  * other than %G_VARIANT_TYPE_BYTE.
30871  *
30872  * Returns: a #guchar
30873  * Since: 2.24
30874  */
30875
30876
30877 /**
30878  * g_variant_get_bytestring:
30879  * @value: an array-of-bytes #GVariant instance
30880  *
30881  * Returns the string value of a #GVariant instance with an
30882  * array-of-bytes type.  The string has no particular encoding.
30883  *
30884  * If the array does not end with a nul terminator character, the empty
30885  * string is returned.  For this reason, you can always trust that a
30886  * non-%NULL nul-terminated string will be returned by this function.
30887  *
30888  * If the array contains a nul terminator character somewhere other than
30889  * the last byte then the returned string is the string, up to the first
30890  * such nul character.
30891  *
30892  * It is an error to call this function with a @value that is not an
30893  * array of bytes.
30894  *
30895  * The return value remains valid as long as @value exists.
30896  *
30897  * Returns: (transfer none) (array zero-terminated=1) (element-type guint8): the constant string
30898  * Since: 2.26
30899  */
30900
30901
30902 /**
30903  * g_variant_get_bytestring_array:
30904  * @value: an array of array of bytes #GVariant ('aay')
30905  * @length: (out) (allow-none): the length of the result, or %NULL
30906  *
30907  * Gets the contents of an array of array of bytes #GVariant.  This call
30908  * makes a shallow copy; the return result should be released with
30909  * g_free(), but the individual strings must not be modified.
30910  *
30911  * If @length is non-%NULL then the number of elements in the result is
30912  * stored there.  In any case, the resulting array will be
30913  * %NULL-terminated.
30914  *
30915  * For an empty array, @length will be set to 0 and a pointer to a
30916  * %NULL pointer will be returned.
30917  *
30918  * Returns: (array length=length) (transfer container): an array of constant strings
30919  * Since: 2.26
30920  */
30921
30922
30923 /**
30924  * g_variant_get_child: (skip)
30925  * @value: a container #GVariant
30926  * @index_: the index of the child to deconstruct
30927  * @format_string: a #GVariant format string
30928  * @...: arguments, as per @format_string
30929  *
30930  * Reads a child item out of a container #GVariant instance and
30931  * deconstructs it according to @format_string.  This call is
30932  * essentially a combination of g_variant_get_child_value() and
30933  * g_variant_get().
30934  *
30935  * @format_string determines the C types that are used for unpacking
30936  * the values and also determines if the values are copied or borrowed,
30937  * see the section on
30938  * <link linkend='gvariant-format-strings-pointers'>GVariant Format Strings</link>.
30939  *
30940  * Since: 2.24
30941  */
30942
30943
30944 /**
30945  * g_variant_get_child_value:
30946  * @value: a container #GVariant
30947  * @index_: the index of the child to fetch
30948  *
30949  * Reads a child item out of a container #GVariant instance.  This
30950  * includes variants, maybes, arrays, tuples and dictionary
30951  * entries.  It is an error to call this function on any other type of
30952  * #GVariant.
30953  *
30954  * It is an error if @index_ is greater than the number of child items
30955  * in the container.  See g_variant_n_children().
30956  *
30957  * The returned value is never floating.  You should free it with
30958  * g_variant_unref() when you're done with it.
30959  *
30960  * This function is O(1).
30961  *
30962  * Returns: (transfer full): the child at the specified index
30963  * Since: 2.24
30964  */
30965
30966
30967 /**
30968  * g_variant_get_data:
30969  * @value: a #GVariant instance
30970  *
30971  * Returns a pointer to the serialised form of a #GVariant instance.
30972  * The returned data may not be in fully-normalised form if read from an
30973  * untrusted source.  The returned data must not be freed; it remains
30974  * valid for as long as @value exists.
30975  *
30976  * If @value is a fixed-sized value that was deserialised from a
30977  * corrupted serialised container then %NULL may be returned.  In this
30978  * case, the proper thing to do is typically to use the appropriate
30979  * number of nul bytes in place of @value.  If @value is not fixed-sized
30980  * then %NULL is never returned.
30981  *
30982  * In the case that @value is already in serialised form, this function
30983  * is O(1).  If the value is not already in serialised form,
30984  * serialisation occurs implicitly and is approximately O(n) in the size
30985  * of the result.
30986  *
30987  * To deserialise the data returned by this function, in addition to the
30988  * serialised data, you must know the type of the #GVariant, and (if the
30989  * machine might be different) the endianness of the machine that stored
30990  * it. As a result, file formats or network messages that incorporate
30991  * serialised #GVariant<!---->s must include this information either
30992  * implicitly (for instance "the file always contains a
30993  * %G_VARIANT_TYPE_VARIANT and it is always in little-endian order") or
30994  * explicitly (by storing the type and/or endianness in addition to the
30995  * serialised data).
30996  *
30997  * Returns: (transfer none): the serialised form of @value, or %NULL
30998  * Since: 2.24
30999  */
31000
31001
31002 /**
31003  * g_variant_get_data_as_bytes:
31004  * @value: a #GVariant
31005  *
31006  * Returns a pointer to the serialised form of a #GVariant instance.
31007  * The semantics of this function are exactly the same as
31008  * g_variant_get_data(), except that the returned #GBytes holds
31009  * a reference to the variant data.
31010  *
31011  * Returns: (transfer full): A new #GBytes representing the variant data
31012  * Since: 2.36
31013  */
31014
31015
31016 /**
31017  * g_variant_get_double:
31018  * @value: a double #GVariant instance
31019  *
31020  * Returns the double precision floating point value of @value.
31021  *
31022  * It is an error to call this function with a @value of any type
31023  * other than %G_VARIANT_TYPE_DOUBLE.
31024  *
31025  * Returns: a #gdouble
31026  * Since: 2.24
31027  */
31028
31029
31030 /**
31031  * g_variant_get_fixed_array:
31032  * @value: a #GVariant array with fixed-sized elements
31033  * @n_elements: (out): a pointer to the location to store the number of items
31034  * @element_size: the size of each element
31035  *
31036  * Provides access to the serialised data for an array of fixed-sized
31037  * items.
31038  *
31039  * @value must be an array with fixed-sized elements.  Numeric types are
31040  * fixed-size, as are tuples containing only other fixed-sized types.
31041  *
31042  * @element_size must be the size of a single element in the array,
31043  * as given by the section on
31044  * <link linkend='gvariant-serialised-data-memory'>Serialised Data
31045  * Memory</link>.
31046  *
31047  * In particular, arrays of these fixed-sized types can be interpreted
31048  * as an array of the given C type, with @element_size set to
31049  * <code>sizeof</code> the appropriate type:
31050  *
31051  * <informaltable>
31052  * <tgroup cols='2'>
31053  * <thead><row><entry>element type</entry> <entry>C type</entry></row></thead>
31054  * <tbody>
31055  * <row><entry>%G_VARIANT_TYPE_INT16 (etc.)</entry>
31056  *   <entry>#gint16 (etc.)</entry></row>
31057  * <row><entry>%G_VARIANT_TYPE_BOOLEAN</entry>
31058  *   <entry>#guchar (not #gboolean!)</entry></row>
31059  * <row><entry>%G_VARIANT_TYPE_BYTE</entry> <entry>#guchar</entry></row>
31060  * <row><entry>%G_VARIANT_TYPE_HANDLE</entry> <entry>#guint32</entry></row>
31061  * <row><entry>%G_VARIANT_TYPE_DOUBLE</entry> <entry>#gdouble</entry></row>
31062  * </tbody>
31063  * </tgroup>
31064  * </informaltable>
31065  *
31066  * For example, if calling this function for an array of 32 bit integers,
31067  * you might say <code>sizeof (gint32)</code>.  This value isn't used
31068  * except for the purpose of a double-check that the form of the
31069  * serialised data matches the caller's expectation.
31070  *
31071  * @n_elements, which must be non-%NULL is set equal to the number of
31072  * items in the array.
31073  *
31074  * Returns: (array length=n_elements) (transfer none): a pointer to the fixed array
31075  * Since: 2.24
31076  */
31077
31078
31079 /**
31080  * g_variant_get_handle:
31081  * @value: a handle #GVariant instance
31082  *
31083  * Returns the 32-bit signed integer value of @value.
31084  *
31085  * It is an error to call this function with a @value of any type other
31086  * than %G_VARIANT_TYPE_HANDLE.
31087  *
31088  * By convention, handles are indexes into an array of file descriptors
31089  * that are sent alongside a D-Bus message.  If you're not interacting
31090  * with D-Bus, you probably don't need them.
31091  *
31092  * Returns: a #gint32
31093  * Since: 2.24
31094  */
31095
31096
31097 /**
31098  * g_variant_get_int16:
31099  * @value: a int16 #GVariant instance
31100  *
31101  * Returns the 16-bit signed integer value of @value.
31102  *
31103  * It is an error to call this function with a @value of any type
31104  * other than %G_VARIANT_TYPE_INT16.
31105  *
31106  * Returns: a #gint16
31107  * Since: 2.24
31108  */
31109
31110
31111 /**
31112  * g_variant_get_int32:
31113  * @value: a int32 #GVariant instance
31114  *
31115  * Returns the 32-bit signed integer value of @value.
31116  *
31117  * It is an error to call this function with a @value of any type
31118  * other than %G_VARIANT_TYPE_INT32.
31119  *
31120  * Returns: a #gint32
31121  * Since: 2.24
31122  */
31123
31124
31125 /**
31126  * g_variant_get_int64:
31127  * @value: a int64 #GVariant instance
31128  *
31129  * Returns the 64-bit signed integer value of @value.
31130  *
31131  * It is an error to call this function with a @value of any type
31132  * other than %G_VARIANT_TYPE_INT64.
31133  *
31134  * Returns: a #gint64
31135  * Since: 2.24
31136  */
31137
31138
31139 /**
31140  * g_variant_get_maybe:
31141  * @value: a maybe-typed value
31142  *
31143  * Given a maybe-typed #GVariant instance, extract its value.  If the
31144  * value is Nothing, then this function returns %NULL.
31145  *
31146  * Returns: (allow-none) (transfer full): the contents of @value, or %NULL
31147  * Since: 2.24
31148  */
31149
31150
31151 /**
31152  * g_variant_get_normal_form:
31153  * @value: a #GVariant
31154  *
31155  * Gets a #GVariant instance that has the same value as @value and is
31156  * trusted to be in normal form.
31157  *
31158  * If @value is already trusted to be in normal form then a new
31159  * reference to @value is returned.
31160  *
31161  * If @value is not already trusted, then it is scanned to check if it
31162  * is in normal form.  If it is found to be in normal form then it is
31163  * marked as trusted and a new reference to it is returned.
31164  *
31165  * If @value is found not to be in normal form then a new trusted
31166  * #GVariant is created with the same value as @value.
31167  *
31168  * It makes sense to call this function if you've received #GVariant
31169  * data from untrusted sources and you want to ensure your serialised
31170  * output is definitely in normal form.
31171  *
31172  * Returns: (transfer full): a trusted #GVariant
31173  * Since: 2.24
31174  */
31175
31176
31177 /**
31178  * g_variant_get_objv:
31179  * @value: an array of object paths #GVariant
31180  * @length: (out) (allow-none): the length of the result, or %NULL
31181  *
31182  * Gets the contents of an array of object paths #GVariant.  This call
31183  * makes a shallow copy; the return result should be released with
31184  * g_free(), but the individual strings must not be modified.
31185  *
31186  * If @length is non-%NULL then the number of elements in the result
31187  * is stored there.  In any case, the resulting array will be
31188  * %NULL-terminated.
31189  *
31190  * For an empty array, @length will be set to 0 and a pointer to a
31191  * %NULL pointer will be returned.
31192  *
31193  * Returns: (array length=length zero-terminated=1) (transfer container): an array of constant strings
31194  * Since: 2.30
31195  */
31196
31197
31198 /**
31199  * g_variant_get_size:
31200  * @value: a #GVariant instance
31201  *
31202  * Determines the number of bytes that would be required to store @value
31203  * with g_variant_store().
31204  *
31205  * If @value has a fixed-sized type then this function always returned
31206  * that fixed size.
31207  *
31208  * In the case that @value is already in serialised form or the size has
31209  * already been calculated (ie: this function has been called before)
31210  * then this function is O(1).  Otherwise, the size is calculated, an
31211  * operation which is approximately O(n) in the number of values
31212  * involved.
31213  *
31214  * Returns: the serialised size of @value
31215  * Since: 2.24
31216  */
31217
31218
31219 /**
31220  * g_variant_get_string:
31221  * @value: a string #GVariant instance
31222  * @length: (allow-none) (default 0) (out): a pointer to a #gsize, to store the length
31223  *
31224  * Returns the string value of a #GVariant instance with a string
31225  * type.  This includes the types %G_VARIANT_TYPE_STRING,
31226  * %G_VARIANT_TYPE_OBJECT_PATH and %G_VARIANT_TYPE_SIGNATURE.
31227  *
31228  * The string will always be utf8 encoded.
31229  *
31230  * If @length is non-%NULL then the length of the string (in bytes) is
31231  * returned there.  For trusted values, this information is already
31232  * known.  For untrusted values, a strlen() will be performed.
31233  *
31234  * It is an error to call this function with a @value of any type
31235  * other than those three.
31236  *
31237  * The return value remains valid as long as @value exists.
31238  *
31239  * Returns: (transfer none): the constant string, utf8 encoded
31240  * Since: 2.24
31241  */
31242
31243
31244 /**
31245  * g_variant_get_strv:
31246  * @value: an array of strings #GVariant
31247  * @length: (out) (allow-none): the length of the result, or %NULL
31248  *
31249  * Gets the contents of an array of strings #GVariant.  This call
31250  * makes a shallow copy; the return result should be released with
31251  * g_free(), but the individual strings must not be modified.
31252  *
31253  * If @length is non-%NULL then the number of elements in the result
31254  * is stored there.  In any case, the resulting array will be
31255  * %NULL-terminated.
31256  *
31257  * For an empty array, @length will be set to 0 and a pointer to a
31258  * %NULL pointer will be returned.
31259  *
31260  * Returns: (array length=length zero-terminated=1) (transfer container): an array of constant strings
31261  * Since: 2.24
31262  */
31263
31264
31265 /**
31266  * g_variant_get_type:
31267  * @value: a #GVariant
31268  *
31269  * Determines the type of @value.
31270  *
31271  * The return value is valid for the lifetime of @value and must not
31272  * be freed.
31273  *
31274  * Returns: a #GVariantType
31275  * Since: 2.24
31276  */
31277
31278
31279 /**
31280  * g_variant_get_type_string:
31281  * @value: a #GVariant
31282  *
31283  * Returns the type string of @value.  Unlike the result of calling
31284  * g_variant_type_peek_string(), this string is nul-terminated.  This
31285  * string belongs to #GVariant and must not be freed.
31286  *
31287  * Returns: the type string for the type of @value
31288  * Since: 2.24
31289  */
31290
31291
31292 /**
31293  * g_variant_get_uint16:
31294  * @value: a uint16 #GVariant instance
31295  *
31296  * Returns the 16-bit unsigned integer value of @value.
31297  *
31298  * It is an error to call this function with a @value of any type
31299  * other than %G_VARIANT_TYPE_UINT16.
31300  *
31301  * Returns: a #guint16
31302  * Since: 2.24
31303  */
31304
31305
31306 /**
31307  * g_variant_get_uint32:
31308  * @value: a uint32 #GVariant instance
31309  *
31310  * Returns the 32-bit unsigned integer value of @value.
31311  *
31312  * It is an error to call this function with a @value of any type
31313  * other than %G_VARIANT_TYPE_UINT32.
31314  *
31315  * Returns: a #guint32
31316  * Since: 2.24
31317  */
31318
31319
31320 /**
31321  * g_variant_get_uint64:
31322  * @value: a uint64 #GVariant instance
31323  *
31324  * Returns the 64-bit unsigned integer value of @value.
31325  *
31326  * It is an error to call this function with a @value of any type
31327  * other than %G_VARIANT_TYPE_UINT64.
31328  *
31329  * Returns: a #guint64
31330  * Since: 2.24
31331  */
31332
31333
31334 /**
31335  * g_variant_get_va: (skip)
31336  * @value: a #GVariant
31337  * @format_string: a string that is prefixed with a format string
31338  * @endptr: (allow-none) (default NULL): location to store the end pointer, or %NULL
31339  * @app: a pointer to a #va_list
31340  *
31341  * This function is intended to be used by libraries based on #GVariant
31342  * that want to provide g_variant_get()-like functionality to their
31343  * users.
31344  *
31345  * The API is more general than g_variant_get() to allow a wider range
31346  * of possible uses.
31347  *
31348  * @format_string must still point to a valid format string, but it only
31349  * need to be nul-terminated if @endptr is %NULL.  If @endptr is
31350  * non-%NULL then it is updated to point to the first character past the
31351  * end of the format string.
31352  *
31353  * @app is a pointer to a #va_list.  The arguments, according to
31354  * @format_string, are collected from this #va_list and the list is left
31355  * pointing to the argument following the last.
31356  *
31357  * These two generalisations allow mixing of multiple calls to
31358  * g_variant_new_va() and g_variant_get_va() within a single actual
31359  * varargs call by the user.
31360  *
31361  * @format_string determines the C types that are used for unpacking
31362  * the values and also determines if the values are copied or borrowed,
31363  * see the section on
31364  * <link linkend='gvariant-format-strings-pointers'>GVariant Format Strings</link>.
31365  *
31366  * Since: 2.24
31367  */
31368
31369
31370 /**
31371  * g_variant_get_variant:
31372  * @value: a variant #GVariant instance
31373  *
31374  * Unboxes @value.  The result is the #GVariant instance that was
31375  * contained in @value.
31376  *
31377  * Returns: (transfer full): the item contained in the variant
31378  * Since: 2.24
31379  */
31380
31381
31382 /**
31383  * g_variant_hash:
31384  * @value: (type GVariant): a basic #GVariant value as a #gconstpointer
31385  *
31386  * Generates a hash value for a #GVariant instance.
31387  *
31388  * The output of this function is guaranteed to be the same for a given
31389  * value only per-process.  It may change between different processor
31390  * architectures or even different versions of GLib.  Do not use this
31391  * function as a basis for building protocols or file formats.
31392  *
31393  * The type of @value is #gconstpointer only to allow use of this
31394  * function with #GHashTable.  @value must be a #GVariant.
31395  *
31396  * Returns: a hash value corresponding to @value
31397  * Since: 2.24
31398  */
31399
31400
31401 /**
31402  * g_variant_is_container:
31403  * @value: a #GVariant instance
31404  *
31405  * Checks if @value is a container.
31406  *
31407  * Returns: %TRUE if @value is a container
31408  * Since: 2.24
31409  */
31410
31411
31412 /**
31413  * g_variant_is_floating:
31414  * @value: a #GVariant
31415  *
31416  * Checks whether @value has a floating reference count.
31417  *
31418  * This function should only ever be used to assert that a given variant
31419  * is or is not floating, or for debug purposes. To acquire a reference
31420  * to a variant that might be floating, always use g_variant_ref_sink()
31421  * or g_variant_take_ref().
31422  *
31423  * See g_variant_ref_sink() for more information about floating reference
31424  * counts.
31425  *
31426  * Returns: whether @value is floating
31427  * Since: 2.26
31428  */
31429
31430
31431 /**
31432  * g_variant_is_normal_form:
31433  * @value: a #GVariant instance
31434  *
31435  * Checks if @value is in normal form.
31436  *
31437  * The main reason to do this is to detect if a given chunk of
31438  * serialised data is in normal form: load the data into a #GVariant
31439  * using g_variant_new_from_data() and then use this function to
31440  * check.
31441  *
31442  * If @value is found to be in normal form then it will be marked as
31443  * being trusted.  If the value was already marked as being trusted then
31444  * this function will immediately return %TRUE.
31445  *
31446  * Returns: %TRUE if @value is in normal form
31447  * Since: 2.24
31448  */
31449
31450
31451 /**
31452  * g_variant_is_object_path:
31453  * @string: a normal C nul-terminated string
31454  *
31455  * Determines if a given string is a valid D-Bus object path.  You
31456  * should ensure that a string is a valid D-Bus object path before
31457  * passing it to g_variant_new_object_path().
31458  *
31459  * A valid object path starts with '/' followed by zero or more
31460  * sequences of characters separated by '/' characters.  Each sequence
31461  * must contain only the characters "[A-Z][a-z][0-9]_".  No sequence
31462  * (including the one following the final '/' character) may be empty.
31463  *
31464  * Returns: %TRUE if @string is a D-Bus object path
31465  * Since: 2.24
31466  */
31467
31468
31469 /**
31470  * g_variant_is_of_type:
31471  * @value: a #GVariant instance
31472  * @type: a #GVariantType
31473  *
31474  * Checks if a value has a type matching the provided type.
31475  *
31476  * Returns: %TRUE if the type of @value matches @type
31477  * Since: 2.24
31478  */
31479
31480
31481 /**
31482  * g_variant_is_signature:
31483  * @string: a normal C nul-terminated string
31484  *
31485  * Determines if a given string is a valid D-Bus type signature.  You
31486  * should ensure that a string is a valid D-Bus type signature before
31487  * passing it to g_variant_new_signature().
31488  *
31489  * D-Bus type signatures consist of zero or more definite #GVariantType
31490  * strings in sequence.
31491  *
31492  * Returns: %TRUE if @string is a D-Bus type signature
31493  * Since: 2.24
31494  */
31495
31496
31497 /**
31498  * g_variant_iter_copy:
31499  * @iter: a #GVariantIter
31500  *
31501  * Creates a new heap-allocated #GVariantIter to iterate over the
31502  * container that was being iterated over by @iter.  Iteration begins on
31503  * the new iterator from the current position of the old iterator but
31504  * the two copies are independent past that point.
31505  *
31506  * Use g_variant_iter_free() to free the return value when you no longer
31507  * need it.
31508  *
31509  * A reference is taken to the container that @iter is iterating over
31510  * and will be releated only when g_variant_iter_free() is called.
31511  *
31512  * Returns: (transfer full): a new heap-allocated #GVariantIter
31513  * Since: 2.24
31514  */
31515
31516
31517 /**
31518  * g_variant_iter_free:
31519  * @iter: (transfer full): a heap-allocated #GVariantIter
31520  *
31521  * Frees a heap-allocated #GVariantIter.  Only call this function on
31522  * iterators that were returned by g_variant_iter_new() or
31523  * g_variant_iter_copy().
31524  *
31525  * Since: 2.24
31526  */
31527
31528
31529 /**
31530  * g_variant_iter_init: (skip)
31531  * @iter: a pointer to a #GVariantIter
31532  * @value: a container #GVariant
31533  *
31534  * Initialises (without allocating) a #GVariantIter.  @iter may be
31535  * completely uninitialised prior to this call; its old value is
31536  * ignored.
31537  *
31538  * The iterator remains valid for as long as @value exists, and need not
31539  * be freed in any way.
31540  *
31541  * Returns: the number of items in @value
31542  * Since: 2.24
31543  */
31544
31545
31546 /**
31547  * g_variant_iter_loop: (skip)
31548  * @iter: a #GVariantIter
31549  * @format_string: a GVariant format string
31550  * @...: the arguments to unpack the value into
31551  *
31552  * Gets the next item in the container and unpacks it into the variable
31553  * argument list according to @format_string, returning %TRUE.
31554  *
31555  * If no more items remain then %FALSE is returned.
31556  *
31557  * On the first call to this function, the pointers appearing on the
31558  * variable argument list are assumed to point at uninitialised memory.
31559  * On the second and later calls, it is assumed that the same pointers
31560  * will be given and that they will point to the memory as set by the
31561  * previous call to this function.  This allows the previous values to
31562  * be freed, as appropriate.
31563  *
31564  * This function is intended to be used with a while loop as
31565  * demonstrated in the following example.  This function can only be
31566  * used when iterating over an array.  It is only valid to call this
31567  * function with a string constant for the format string and the same
31568  * string constant must be used each time.  Mixing calls to this
31569  * function and g_variant_iter_next() or g_variant_iter_next_value() on
31570  * the same iterator causes undefined behavior.
31571  *
31572  * If you break out of a such a while loop using g_variant_iter_loop() then
31573  * you must free or unreference all the unpacked values as you would with
31574  * g_variant_get(). Failure to do so will cause a memory leak.
31575  *
31576  * See the section on <link linkend='gvariant-format-strings'>GVariant
31577  * Format Strings</link>.
31578  *
31579  * <example>
31580  *  <title>Memory management with g_variant_iter_loop()</title>
31581  *  <programlisting>
31582  *   /<!-- -->* Iterates a dictionary of type 'a{sv}' *<!-- -->/
31583  *   void
31584  *   iterate_dictionary (GVariant *dictionary)
31585  *   {
31586  *     GVariantIter iter;
31587  *     GVariant *value;
31588  *     gchar *key;
31589  *
31590  *     g_variant_iter_init (&iter, dictionary);
31591  *     while (g_variant_iter_loop (&iter, "{sv}", &key, &value))
31592  *       {
31593  *         g_print ("Item '%s' has type '%s'\n", key,
31594  *                  g_variant_get_type_string (value));
31595  *
31596  *         /<!-- -->* no need to free 'key' and 'value' here *<!-- -->/
31597  *         /<!-- -->* unless breaking out of this loop *<!-- -->/
31598  *       }
31599  *   }
31600  *  </programlisting>
31601  * </example>
31602  *
31603  * For most cases you should use g_variant_iter_next().
31604  *
31605  * This function is really only useful when unpacking into #GVariant or
31606  * #GVariantIter in order to allow you to skip the call to
31607  * g_variant_unref() or g_variant_iter_free().
31608  *
31609  * For example, if you are only looping over simple integer and string
31610  * types, g_variant_iter_next() is definitely preferred.  For string
31611  * types, use the '&' prefix to avoid allocating any memory at all (and
31612  * thereby avoiding the need to free anything as well).
31613  *
31614  * @format_string determines the C types that are used for unpacking
31615  * the values and also determines if the values are copied or borrowed,
31616  * see the section on
31617  * <link linkend='gvariant-format-strings-pointers'>GVariant Format Strings</link>.
31618  *
31619  * Returns: %TRUE if a value was unpacked, or %FALSE if there was no value
31620  * Since: 2.24
31621  */
31622
31623
31624 /**
31625  * g_variant_iter_n_children:
31626  * @iter: a #GVariantIter
31627  *
31628  * Queries the number of child items in the container that we are
31629  * iterating over.  This is the total number of items -- not the number
31630  * of items remaining.
31631  *
31632  * This function might be useful for preallocation of arrays.
31633  *
31634  * Returns: the number of children in the container
31635  * Since: 2.24
31636  */
31637
31638
31639 /**
31640  * g_variant_iter_new:
31641  * @value: a container #GVariant
31642  *
31643  * Creates a heap-allocated #GVariantIter for iterating over the items
31644  * in @value.
31645  *
31646  * Use g_variant_iter_free() to free the return value when you no longer
31647  * need it.
31648  *
31649  * A reference is taken to @value and will be released only when
31650  * g_variant_iter_free() is called.
31651  *
31652  * Returns: (transfer full): a new heap-allocated #GVariantIter
31653  * Since: 2.24
31654  */
31655
31656
31657 /**
31658  * g_variant_iter_next: (skip)
31659  * @iter: a #GVariantIter
31660  * @format_string: a GVariant format string
31661  * @...: the arguments to unpack the value into
31662  *
31663  * Gets the next item in the container and unpacks it into the variable
31664  * argument list according to @format_string, returning %TRUE.
31665  *
31666  * If no more items remain then %FALSE is returned.
31667  *
31668  * All of the pointers given on the variable arguments list of this
31669  * function are assumed to point at uninitialised memory.  It is the
31670  * responsibility of the caller to free all of the values returned by
31671  * the unpacking process.
31672  *
31673  * See the section on <link linkend='gvariant-format-strings'>GVariant
31674  * Format Strings</link>.
31675  *
31676  * <example>
31677  *  <title>Memory management with g_variant_iter_next()</title>
31678  *  <programlisting>
31679  *   /<!-- -->* Iterates a dictionary of type 'a{sv}' *<!-- -->/
31680  *   void
31681  *   iterate_dictionary (GVariant *dictionary)
31682  *   {
31683  *     GVariantIter iter;
31684  *     GVariant *value;
31685  *     gchar *key;
31686  *
31687  *     g_variant_iter_init (&iter, dictionary);
31688  *     while (g_variant_iter_next (&iter, "{sv}", &key, &value))
31689  *       {
31690  *         g_print ("Item '%s' has type '%s'\n", key,
31691  *                  g_variant_get_type_string (value));
31692  *
31693  *         /<!-- -->* must free data for ourselves *<!-- -->/
31694  *         g_variant_unref (value);
31695  *         g_free (key);
31696  *       }
31697  *   }
31698  *  </programlisting>
31699  * </example>
31700  *
31701  * For a solution that is likely to be more convenient to C programmers
31702  * when dealing with loops, see g_variant_iter_loop().
31703  *
31704  * @format_string determines the C types that are used for unpacking
31705  * the values and also determines if the values are copied or borrowed,
31706  * see the section on
31707  * <link linkend='gvariant-format-strings-pointers'>GVariant Format Strings</link>.
31708  *
31709  * Returns: %TRUE if a value was unpacked, or %FALSE if there as no value
31710  * Since: 2.24
31711  */
31712
31713
31714 /**
31715  * g_variant_iter_next_value:
31716  * @iter: a #GVariantIter
31717  *
31718  * Gets the next item in the container.  If no more items remain then
31719  * %NULL is returned.
31720  *
31721  * Use g_variant_unref() to drop your reference on the return value when
31722  * you no longer need it.
31723  *
31724  * <example>
31725  *  <title>Iterating with g_variant_iter_next_value()</title>
31726  *  <programlisting>
31727  *   /<!-- -->* recursively iterate a container *<!-- -->/
31728  *   void
31729  *   iterate_container_recursive (GVariant *container)
31730  *   {
31731  *     GVariantIter iter;
31732  *     GVariant *child;
31733  *
31734  *     g_variant_iter_init (&iter, container);
31735  *     while ((child = g_variant_iter_next_value (&iter)))
31736  *       {
31737  *         g_print ("type '%s'\n", g_variant_get_type_string (child));
31738  *
31739  *         if (g_variant_is_container (child))
31740  *           iterate_container_recursive (child);
31741  *
31742  *         g_variant_unref (child);
31743  *       }
31744  *   }
31745  * </programlisting>
31746  * </example>
31747  *
31748  * Returns: (allow-none) (transfer full): a #GVariant, or %NULL
31749  * Since: 2.24
31750  */
31751
31752
31753 /**
31754  * g_variant_lookup: (skip)
31755  * @dictionary: a dictionary #GVariant
31756  * @key: the key to lookup in the dictionary
31757  * @format_string: a GVariant format string
31758  * @...: the arguments to unpack the value into
31759  *
31760  * Looks up a value in a dictionary #GVariant.
31761  *
31762  * This function is a wrapper around g_variant_lookup_value() and
31763  * g_variant_get().  In the case that %NULL would have been returned,
31764  * this function returns %FALSE.  Otherwise, it unpacks the returned
31765  * value and returns %TRUE.
31766  *
31767  * @format_string determines the C types that are used for unpacking
31768  * the values and also determines if the values are copied or borrowed,
31769  * see the section on
31770  * <link linkend='gvariant-format-strings-pointers'>GVariant Format Strings</link>.
31771  *
31772  * Returns: %TRUE if a value was unpacked
31773  * Since: 2.28
31774  */
31775
31776
31777 /**
31778  * g_variant_lookup_value:
31779  * @dictionary: a dictionary #GVariant
31780  * @key: the key to lookup in the dictionary
31781  * @expected_type: (allow-none): a #GVariantType, or %NULL
31782  *
31783  * Looks up a value in a dictionary #GVariant.
31784  *
31785  * This function works with dictionaries of the type
31786  * <literal>a{s*}</literal> (and equally well with type
31787  * <literal>a{o*}</literal>, but we only further discuss the string case
31788  * for sake of clarity).
31789  *
31790  * In the event that @dictionary has the type <literal>a{sv}</literal>,
31791  * the @expected_type string specifies what type of value is expected to
31792  * be inside of the variant.  If the value inside the variant has a
31793  * different type then %NULL is returned.  In the event that @dictionary
31794  * has a value type other than <literal>v</literal> then @expected_type
31795  * must directly match the key type and it is used to unpack the value
31796  * directly or an error occurs.
31797  *
31798  * In either case, if @key is not found in @dictionary, %NULL is
31799  * returned.
31800  *
31801  * If the key is found and the value has the correct type, it is
31802  * returned.  If @expected_type was specified then any non-%NULL return
31803  * value will have this type.
31804  *
31805  * Returns: (transfer full): the value of the dictionary key, or %NULL
31806  * Since: 2.28
31807  */
31808
31809
31810 /**
31811  * g_variant_n_children:
31812  * @value: a container #GVariant
31813  *
31814  * Determines the number of children in a container #GVariant instance.
31815  * This includes variants, maybes, arrays, tuples and dictionary
31816  * entries.  It is an error to call this function on any other type of
31817  * #GVariant.
31818  *
31819  * For variants, the return value is always 1.  For values with maybe
31820  * types, it is always zero or one.  For arrays, it is the length of the
31821  * array.  For tuples it is the number of tuple items (which depends
31822  * only on the type).  For dictionary entries, it is always 2
31823  *
31824  * This function is O(1).
31825  *
31826  * Returns: the number of children in the container
31827  * Since: 2.24
31828  */
31829
31830
31831 /**
31832  * g_variant_new: (skip)
31833  * @format_string: a #GVariant format string
31834  * @...: arguments, as per @format_string
31835  *
31836  * Creates a new #GVariant instance.
31837  *
31838  * Think of this function as an analogue to g_strdup_printf().
31839  *
31840  * The type of the created instance and the arguments that are
31841  * expected by this function are determined by @format_string.  See the
31842  * section on <link linkend='gvariant-format-strings'>GVariant Format
31843  * Strings</link>.  Please note that the syntax of the format string is
31844  * very likely to be extended in the future.
31845  *
31846  * The first character of the format string must not be '*' '?' '@' or
31847  * 'r'; in essence, a new #GVariant must always be constructed by this
31848  * function (and not merely passed through it unmodified).
31849  *
31850  * Returns: a new floating #GVariant instance
31851  * Since: 2.24
31852  */
31853
31854
31855 /**
31856  * g_variant_new_array:
31857  * @child_type: (allow-none): the element type of the new array
31858  * @children: (allow-none) (array length=n_children): an array of #GVariant pointers, the children
31859  * @n_children: the length of @children
31860  *
31861  * Creates a new #GVariant array from @children.
31862  *
31863  * @child_type must be non-%NULL if @n_children is zero.  Otherwise, the
31864  * child type is determined by inspecting the first element of the
31865  * @children array.  If @child_type is non-%NULL then it must be a
31866  * definite type.
31867  *
31868  * The items of the array are taken from the @children array.  No entry
31869  * in the @children array may be %NULL.
31870  *
31871  * All items in the array must have the same type, which must be the
31872  * same as @child_type, if given.
31873  *
31874  * If the @children are floating references (see g_variant_ref_sink()), the
31875  * new instance takes ownership of them as if via g_variant_ref_sink().
31876  *
31877  * Returns: (transfer none): a floating reference to a new #GVariant array
31878  * Since: 2.24
31879  */
31880
31881
31882 /**
31883  * g_variant_new_boolean:
31884  * @value: a #gboolean value
31885  *
31886  * Creates a new boolean #GVariant instance -- either %TRUE or %FALSE.
31887  *
31888  * Returns: (transfer none): a floating reference to a new boolean #GVariant instance
31889  * Since: 2.24
31890  */
31891
31892
31893 /**
31894  * g_variant_new_byte:
31895  * @value: a #guint8 value
31896  *
31897  * Creates a new byte #GVariant instance.
31898  *
31899  * Returns: (transfer none): a floating reference to a new byte #GVariant instance
31900  * Since: 2.24
31901  */
31902
31903
31904 /**
31905  * g_variant_new_bytestring:
31906  * @string: (array zero-terminated=1) (element-type guint8): a normal nul-terminated string in no particular encoding
31907  *
31908  * Creates an array-of-bytes #GVariant with the contents of @string.
31909  * This function is just like g_variant_new_string() except that the
31910  * string need not be valid utf8.
31911  *
31912  * The nul terminator character at the end of the string is stored in
31913  * the array.
31914  *
31915  * Returns: (transfer none): a floating reference to a new bytestring #GVariant instance
31916  * Since: 2.26
31917  */
31918
31919
31920 /**
31921  * g_variant_new_bytestring_array:
31922  * @strv: (array length=length): an array of strings
31923  * @length: the length of @strv, or -1
31924  *
31925  * Constructs an array of bytestring #GVariant from the given array of
31926  * strings.
31927  *
31928  * If @length is -1 then @strv is %NULL-terminated.
31929  *
31930  * Returns: (transfer none): a new floating #GVariant instance
31931  * Since: 2.26
31932  */
31933
31934
31935 /**
31936  * g_variant_new_dict_entry: (constructor)
31937  * @key: a basic #GVariant, the key
31938  * @value: a #GVariant, the value
31939  *
31940  * Creates a new dictionary entry #GVariant. @key and @value must be
31941  * non-%NULL. @key must be a value of a basic type (ie: not a container).
31942  *
31943  * If the @key or @value are floating references (see g_variant_ref_sink()),
31944  * the new instance takes ownership of them as if via g_variant_ref_sink().
31945  *
31946  * Returns: (transfer none): a floating reference to a new dictionary entry #GVariant
31947  * Since: 2.24
31948  */
31949
31950
31951 /**
31952  * g_variant_new_double:
31953  * @value: a #gdouble floating point value
31954  *
31955  * Creates a new double #GVariant instance.
31956  *
31957  * Returns: (transfer none): a floating reference to a new double #GVariant instance
31958  * Since: 2.24
31959  */
31960
31961
31962 /**
31963  * g_variant_new_fixed_array:
31964  * @element_type: the #GVariantType of each element
31965  * @elements: a pointer to the fixed array of contiguous elements
31966  * @n_elements: the number of elements
31967  * @element_size: the size of each element
31968  *
31969  * Provides access to the serialised data for an array of fixed-sized
31970  * items.
31971  *
31972  * @value must be an array with fixed-sized elements.  Numeric types are
31973  * fixed-size as are tuples containing only other fixed-sized types.
31974  *
31975  * @element_size must be the size of a single element in the array.  For
31976  * example, if calling this function for an array of 32 bit integers,
31977  * you might say <code>sizeof (gint32)</code>.  This value isn't used
31978  * except for the purpose of a double-check that the form of the
31979  * serialised data matches the caller's expectation.
31980  *
31981  * @n_elements, which must be non-%NULL is set equal to the number of
31982  * items in the array.
31983  *
31984  * Returns: (transfer none): a floating reference to a new array #GVariant instance
31985  * Since: 2.32
31986  */
31987
31988
31989 /**
31990  * g_variant_new_from_bytes:
31991  * @type: a #GVariantType
31992  * @bytes: a #GBytes
31993  * @trusted: if the contents of @bytes are trusted
31994  *
31995  * Constructs a new serialised-mode #GVariant instance.  This is the
31996  * inner interface for creation of new serialised values that gets
31997  * called from various functions in gvariant.c.
31998  *
31999  * A reference is taken on @bytes.
32000  *
32001  * Returns: a new #GVariant with a floating reference
32002  * Since: 2.36
32003  */
32004
32005
32006 /**
32007  * g_variant_new_from_data:
32008  * @type: a definite #GVariantType
32009  * @data: (array length=size) (element-type guint8): the serialised data
32010  * @size: the size of @data
32011  * @trusted: %TRUE if @data is definitely in normal form
32012  * @notify: (scope async): function to call when @data is no longer needed
32013  * @user_data: data for @notify
32014  *
32015  * Creates a new #GVariant instance from serialised data.
32016  *
32017  * @type is the type of #GVariant instance that will be constructed.
32018  * The interpretation of @data depends on knowing the type.
32019  *
32020  * @data is not modified by this function and must remain valid with an
32021  * unchanging value until such a time as @notify is called with
32022  * @user_data.  If the contents of @data change before that time then
32023  * the result is undefined.
32024  *
32025  * If @data is trusted to be serialised data in normal form then
32026  * @trusted should be %TRUE.  This applies to serialised data created
32027  * within this process or read from a trusted location on the disk (such
32028  * as a file installed in /usr/lib alongside your application).  You
32029  * should set trusted to %FALSE if @data is read from the network, a
32030  * file in the user's home directory, etc.
32031  *
32032  * If @data was not stored in this machine's native endianness, any multi-byte
32033  * numeric values in the returned variant will also be in non-native
32034  * endianness. g_variant_byteswap() can be used to recover the original values.
32035  *
32036  * @notify will be called with @user_data when @data is no longer
32037  * needed.  The exact time of this call is unspecified and might even be
32038  * before this function returns.
32039  *
32040  * Returns: (transfer none): a new floating #GVariant of type @type
32041  * Since: 2.24
32042  */
32043
32044
32045 /**
32046  * g_variant_new_handle:
32047  * @value: a #gint32 value
32048  *
32049  * Creates a new handle #GVariant instance.
32050  *
32051  * By convention, handles are indexes into an array of file descriptors
32052  * that are sent alongside a D-Bus message.  If you're not interacting
32053  * with D-Bus, you probably don't need them.
32054  *
32055  * Returns: (transfer none): a floating reference to a new handle #GVariant instance
32056  * Since: 2.24
32057  */
32058
32059
32060 /**
32061  * g_variant_new_int16:
32062  * @value: a #gint16 value
32063  *
32064  * Creates a new int16 #GVariant instance.
32065  *
32066  * Returns: (transfer none): a floating reference to a new int16 #GVariant instance
32067  * Since: 2.24
32068  */
32069
32070
32071 /**
32072  * g_variant_new_int32:
32073  * @value: a #gint32 value
32074  *
32075  * Creates a new int32 #GVariant instance.
32076  *
32077  * Returns: (transfer none): a floating reference to a new int32 #GVariant instance
32078  * Since: 2.24
32079  */
32080
32081
32082 /**
32083  * g_variant_new_int64:
32084  * @value: a #gint64 value
32085  *
32086  * Creates a new int64 #GVariant instance.
32087  *
32088  * Returns: (transfer none): a floating reference to a new int64 #GVariant instance
32089  * Since: 2.24
32090  */
32091
32092
32093 /**
32094  * g_variant_new_maybe:
32095  * @child_type: (allow-none): the #GVariantType of the child, or %NULL
32096  * @child: (allow-none): the child value, or %NULL
32097  *
32098  * Depending on if @child is %NULL, either wraps @child inside of a
32099  * maybe container or creates a Nothing instance for the given @type.
32100  *
32101  * At least one of @child_type and @child must be non-%NULL.
32102  * If @child_type is non-%NULL then it must be a definite type.
32103  * If they are both non-%NULL then @child_type must be the type
32104  * of @child.
32105  *
32106  * If @child is a floating reference (see g_variant_ref_sink()), the new
32107  * instance takes ownership of @child.
32108  *
32109  * Returns: (transfer none): a floating reference to a new #GVariant maybe instance
32110  * Since: 2.24
32111  */
32112
32113
32114 /**
32115  * g_variant_new_object_path:
32116  * @object_path: a normal C nul-terminated string
32117  *
32118  * Creates a D-Bus object path #GVariant with the contents of @string.
32119  * @string must be a valid D-Bus object path.  Use
32120  * g_variant_is_object_path() if you're not sure.
32121  *
32122  * Returns: (transfer none): a floating reference to a new object path #GVariant instance
32123  * Since: 2.24
32124  */
32125
32126
32127 /**
32128  * g_variant_new_objv:
32129  * @strv: (array length=length) (element-type utf8): an array of strings
32130  * @length: the length of @strv, or -1
32131  *
32132  * Constructs an array of object paths #GVariant from the given array of
32133  * strings.
32134  *
32135  * Each string must be a valid #GVariant object path; see
32136  * g_variant_is_object_path().
32137  *
32138  * If @length is -1 then @strv is %NULL-terminated.
32139  *
32140  * Returns: (transfer none): a new floating #GVariant instance
32141  * Since: 2.30
32142  */
32143
32144
32145 /**
32146  * g_variant_new_parsed:
32147  * @format: a text format #GVariant
32148  * @...: arguments as per @format
32149  *
32150  * Parses @format and returns the result.
32151  *
32152  * @format must be a text format #GVariant with one extension: at any
32153  * point that a value may appear in the text, a '%' character followed
32154  * by a GVariant format string (as per g_variant_new()) may appear.  In
32155  * that case, the same arguments are collected from the argument list as
32156  * g_variant_new() would have collected.
32157  *
32158  * Consider this simple example:
32159  *
32160  * <informalexample><programlisting>
32161  *  g_variant_new_parsed ("[('one', 1), ('two', %i), (%s, 3)]", 2, "three");
32162  * </programlisting></informalexample>
32163  *
32164  * In the example, the variable argument parameters are collected and
32165  * filled in as if they were part of the original string to produce the
32166  * result of <code>[('one', 1), ('two', 2), ('three', 3)]</code>.
32167  *
32168  * This function is intended only to be used with @format as a string
32169  * literal.  Any parse error is fatal to the calling process.  If you
32170  * want to parse data from untrusted sources, use g_variant_parse().
32171  *
32172  * You may not use this function to return, unmodified, a single
32173  * #GVariant pointer from the argument list.  ie: @format may not solely
32174  * be anything along the lines of "%*", "%?", "\%r", or anything starting
32175  * with "%@".
32176  *
32177  * Returns: a new floating #GVariant instance
32178  */
32179
32180
32181 /**
32182  * g_variant_new_parsed_va:
32183  * @format: a text format #GVariant
32184  * @app: a pointer to a #va_list
32185  *
32186  * Parses @format and returns the result.
32187  *
32188  * This is the version of g_variant_new_parsed() intended to be used
32189  * from libraries.
32190  *
32191  * The return value will be floating if it was a newly created GVariant
32192  * instance.  In the case that @format simply specified the collection
32193  * of a #GVariant pointer (eg: @format was "%*") then the collected
32194  * #GVariant pointer will be returned unmodified, without adding any
32195  * additional references.
32196  *
32197  * In order to behave correctly in all cases it is necessary for the
32198  * calling function to g_variant_ref_sink() the return result before
32199  * returning control to the user that originally provided the pointer.
32200  * At this point, the caller will have their own full reference to the
32201  * result.  This can also be done by adding the result to a container,
32202  * or by passing it to another g_variant_new() call.
32203  *
32204  * Returns: a new, usually floating, #GVariant
32205  */
32206
32207
32208 /**
32209  * g_variant_new_signature:
32210  * @signature: a normal C nul-terminated string
32211  *
32212  * Creates a D-Bus type signature #GVariant with the contents of
32213  * @string.  @string must be a valid D-Bus type signature.  Use
32214  * g_variant_is_signature() if you're not sure.
32215  *
32216  * Returns: (transfer none): a floating reference to a new signature #GVariant instance
32217  * Since: 2.24
32218  */
32219
32220
32221 /**
32222  * g_variant_new_string:
32223  * @string: a normal utf8 nul-terminated string
32224  *
32225  * Creates a string #GVariant with the contents of @string.
32226  *
32227  * @string must be valid utf8.
32228  *
32229  * Returns: (transfer none): a floating reference to a new string #GVariant instance
32230  * Since: 2.24
32231  */
32232
32233
32234 /**
32235  * g_variant_new_strv:
32236  * @strv: (array length=length) (element-type utf8): an array of strings
32237  * @length: the length of @strv, or -1
32238  *
32239  * Constructs an array of strings #GVariant from the given array of
32240  * strings.
32241  *
32242  * If @length is -1 then @strv is %NULL-terminated.
32243  *
32244  * Returns: (transfer none): a new floating #GVariant instance
32245  * Since: 2.24
32246  */
32247
32248
32249 /**
32250  * g_variant_new_tuple:
32251  * @children: (array length=n_children): the items to make the tuple out of
32252  * @n_children: the length of @children
32253  *
32254  * Creates a new tuple #GVariant out of the items in @children.  The
32255  * type is determined from the types of @children.  No entry in the
32256  * @children array may be %NULL.
32257  *
32258  * If @n_children is 0 then the unit tuple is constructed.
32259  *
32260  * If the @children are floating references (see g_variant_ref_sink()), the
32261  * new instance takes ownership of them as if via g_variant_ref_sink().
32262  *
32263  * Returns: (transfer none): a floating reference to a new #GVariant tuple
32264  * Since: 2.24
32265  */
32266
32267
32268 /**
32269  * g_variant_new_uint16:
32270  * @value: a #guint16 value
32271  *
32272  * Creates a new uint16 #GVariant instance.
32273  *
32274  * Returns: (transfer none): a floating reference to a new uint16 #GVariant instance
32275  * Since: 2.24
32276  */
32277
32278
32279 /**
32280  * g_variant_new_uint32:
32281  * @value: a #guint32 value
32282  *
32283  * Creates a new uint32 #GVariant instance.
32284  *
32285  * Returns: (transfer none): a floating reference to a new uint32 #GVariant instance
32286  * Since: 2.24
32287  */
32288
32289
32290 /**
32291  * g_variant_new_uint64:
32292  * @value: a #guint64 value
32293  *
32294  * Creates a new uint64 #GVariant instance.
32295  *
32296  * Returns: (transfer none): a floating reference to a new uint64 #GVariant instance
32297  * Since: 2.24
32298  */
32299
32300
32301 /**
32302  * g_variant_new_va: (skip)
32303  * @format_string: a string that is prefixed with a format string
32304  * @endptr: (allow-none) (default NULL): location to store the end pointer, or %NULL
32305  * @app: a pointer to a #va_list
32306  *
32307  * This function is intended to be used by libraries based on
32308  * #GVariant that want to provide g_variant_new()-like functionality
32309  * to their users.
32310  *
32311  * The API is more general than g_variant_new() to allow a wider range
32312  * of possible uses.
32313  *
32314  * @format_string must still point to a valid format string, but it only
32315  * needs to be nul-terminated if @endptr is %NULL.  If @endptr is
32316  * non-%NULL then it is updated to point to the first character past the
32317  * end of the format string.
32318  *
32319  * @app is a pointer to a #va_list.  The arguments, according to
32320  * @format_string, are collected from this #va_list and the list is left
32321  * pointing to the argument following the last.
32322  *
32323  * These two generalisations allow mixing of multiple calls to
32324  * g_variant_new_va() and g_variant_get_va() within a single actual
32325  * varargs call by the user.
32326  *
32327  * The return value will be floating if it was a newly created GVariant
32328  * instance (for example, if the format string was "(ii)").  In the case
32329  * that the format_string was '*', '?', 'r', or a format starting with
32330  * '@' then the collected #GVariant pointer will be returned unmodified,
32331  * without adding any additional references.
32332  *
32333  * In order to behave correctly in all cases it is necessary for the
32334  * calling function to g_variant_ref_sink() the return result before
32335  * returning control to the user that originally provided the pointer.
32336  * At this point, the caller will have their own full reference to the
32337  * result.  This can also be done by adding the result to a container,
32338  * or by passing it to another g_variant_new() call.
32339  *
32340  * Returns: a new, usually floating, #GVariant
32341  * Since: 2.24
32342  */
32343
32344
32345 /**
32346  * g_variant_new_variant: (constructor)
32347  * @value: a #GVariant instance
32348  *
32349  * Boxes @value.  The result is a #GVariant instance representing a
32350  * variant containing the original value.
32351  *
32352  * If @child is a floating reference (see g_variant_ref_sink()), the new
32353  * instance takes ownership of @child.
32354  *
32355  * Returns: (transfer none): a floating reference to a new variant #GVariant instance
32356  * Since: 2.24
32357  */
32358
32359
32360 /**
32361  * g_variant_parse:
32362  * @type: (allow-none): a #GVariantType, or %NULL
32363  * @text: a string containing a GVariant in text form
32364  * @limit: (allow-none): a pointer to the end of @text, or %NULL
32365  * @endptr: (allow-none): a location to store the end pointer, or %NULL
32366  * @error: (allow-none): a pointer to a %NULL #GError pointer, or %NULL
32367  *
32368  * Parses a #GVariant from a text representation.
32369  *
32370  * A single #GVariant is parsed from the content of @text.
32371  *
32372  * The format is described <link linkend='gvariant-text'>here</link>.
32373  *
32374  * The memory at @limit will never be accessed and the parser behaves as
32375  * if the character at @limit is the nul terminator.  This has the
32376  * effect of bounding @text.
32377  *
32378  * If @endptr is non-%NULL then @text is permitted to contain data
32379  * following the value that this function parses and @endptr will be
32380  * updated to point to the first character past the end of the text
32381  * parsed by this function.  If @endptr is %NULL and there is extra data
32382  * then an error is returned.
32383  *
32384  * If @type is non-%NULL then the value will be parsed to have that
32385  * type.  This may result in additional parse errors (in the case that
32386  * the parsed value doesn't fit the type) but may also result in fewer
32387  * errors (in the case that the type would have been ambiguous, such as
32388  * with empty arrays).
32389  *
32390  * In the event that the parsing is successful, the resulting #GVariant
32391  * is returned.
32392  *
32393  * In case of any error, %NULL will be returned.  If @error is non-%NULL
32394  * then it will be set to reflect the error that occurred.
32395  *
32396  * Officially, the language understood by the parser is "any string
32397  * produced by g_variant_print()".
32398  *
32399  * Returns: a reference to a #GVariant, or %NULL
32400  */
32401
32402
32403 /**
32404  * g_variant_print:
32405  * @value: a #GVariant
32406  * @type_annotate: %TRUE if type information should be included in the output
32407  *
32408  * Pretty-prints @value in the format understood by g_variant_parse().
32409  *
32410  * The format is described <link linkend='gvariant-text'>here</link>.
32411  *
32412  * If @type_annotate is %TRUE, then type information is included in
32413  * the output.
32414  *
32415  * Returns: (transfer full): a newly-allocated string holding the result.
32416  * Since: 2.24
32417  */
32418
32419
32420 /**
32421  * g_variant_print_string: (skip)
32422  * @value: a #GVariant
32423  * @string: (allow-none) (default NULL): a #GString, or %NULL
32424  * @type_annotate: %TRUE if type information should be included in the output
32425  *
32426  * Behaves as g_variant_print(), but operates on a #GString.
32427  *
32428  * If @string is non-%NULL then it is appended to and returned.  Else,
32429  * a new empty #GString is allocated and it is returned.
32430  *
32431  * Returns: a #GString containing the string
32432  * Since: 2.24
32433  */
32434
32435
32436 /**
32437  * g_variant_ref:
32438  * @value: a #GVariant
32439  *
32440  * Increases the reference count of @value.
32441  *
32442  * Returns: the same @value
32443  * Since: 2.24
32444  */
32445
32446
32447 /**
32448  * g_variant_ref_sink:
32449  * @value: a #GVariant
32450  *
32451  * #GVariant uses a floating reference count system.  All functions with
32452  * names starting with <literal>g_variant_new_</literal> return floating
32453  * references.
32454  *
32455  * Calling g_variant_ref_sink() on a #GVariant with a floating reference
32456  * will convert the floating reference into a full reference.  Calling
32457  * g_variant_ref_sink() on a non-floating #GVariant results in an
32458  * additional normal reference being added.
32459  *
32460  * In other words, if the @value is floating, then this call "assumes
32461  * ownership" of the floating reference, converting it to a normal
32462  * reference.  If the @value is not floating, then this call adds a
32463  * new normal reference increasing the reference count by one.
32464  *
32465  * All calls that result in a #GVariant instance being inserted into a
32466  * container will call g_variant_ref_sink() on the instance.  This means
32467  * that if the value was just created (and has only its floating
32468  * reference) then the container will assume sole ownership of the value
32469  * at that point and the caller will not need to unreference it.  This
32470  * makes certain common styles of programming much easier while still
32471  * maintaining normal refcounting semantics in situations where values
32472  * are not floating.
32473  *
32474  * Returns: the same @value
32475  * Since: 2.24
32476  */
32477
32478
32479 /**
32480  * g_variant_store:
32481  * @value: the #GVariant to store
32482  * @data: the location to store the serialised data at
32483  *
32484  * Stores the serialised form of @value at @data.  @data should be
32485  * large enough.  See g_variant_get_size().
32486  *
32487  * The stored data is in machine native byte order but may not be in
32488  * fully-normalised form if read from an untrusted source.  See
32489  * g_variant_get_normal_form() for a solution.
32490  *
32491  * As with g_variant_get_data(), to be able to deserialise the
32492  * serialised variant successfully, its type and (if the destination
32493  * machine might be different) its endianness must also be available.
32494  *
32495  * This function is approximately O(n) in the size of @data.
32496  *
32497  * Since: 2.24
32498  */
32499
32500
32501 /**
32502  * g_variant_take_ref:
32503  * @value: a #GVariant
32504  *
32505  * If @value is floating, sink it.  Otherwise, do nothing.
32506  *
32507  * Typically you want to use g_variant_ref_sink() in order to
32508  * automatically do the correct thing with respect to floating or
32509  * non-floating references, but there is one specific scenario where
32510  * this function is helpful.
32511  *
32512  * The situation where this function is helpful is when creating an API
32513  * that allows the user to provide a callback function that returns a
32514  * #GVariant.  We certainly want to allow the user the flexibility to
32515  * return a non-floating reference from this callback (for the case
32516  * where the value that is being returned already exists).
32517  *
32518  * At the same time, the style of the #GVariant API makes it likely that
32519  * for newly-created #GVariant instances, the user can be saved some
32520  * typing if they are allowed to return a #GVariant with a floating
32521  * reference.
32522  *
32523  * Using this function on the return value of the user's callback allows
32524  * the user to do whichever is more convenient for them.  The caller
32525  * will alway receives exactly one full reference to the value: either
32526  * the one that was returned in the first place, or a floating reference
32527  * that has been converted to a full reference.
32528  *
32529  * This function has an odd interaction when combined with
32530  * g_variant_ref_sink() running at the same time in another thread on
32531  * the same #GVariant instance.  If g_variant_ref_sink() runs first then
32532  * the result will be that the floating reference is converted to a hard
32533  * reference.  If g_variant_take_ref() runs first then the result will
32534  * be that the floating reference is converted to a hard reference and
32535  * an additional reference on top of that one is added.  It is best to
32536  * avoid this situation.
32537  *
32538  * Returns: the same @value
32539  */
32540
32541
32542 /**
32543  * g_variant_type_copy:
32544  * @type: a #GVariantType
32545  *
32546  * Makes a copy of a #GVariantType.  It is appropriate to call
32547  * g_variant_type_free() on the return value.  @type may not be %NULL.
32548  *
32549  * Returns: (transfer full): a new #GVariantType  Since 2.24
32550  */
32551
32552
32553 /**
32554  * g_variant_type_dup_string:
32555  * @type: a #GVariantType
32556  *
32557  * Returns a newly-allocated copy of the type string corresponding to
32558  * @type.  The returned string is nul-terminated.  It is appropriate to
32559  * call g_free() on the return value.
32560  *
32561  * Returns: (transfer full): the corresponding type string  Since 2.24
32562  */
32563
32564
32565 /**
32566  * g_variant_type_element:
32567  * @type: an array or maybe #GVariantType
32568  *
32569  * Determines the element type of an array or maybe type.
32570  *
32571  * This function may only be used with array or maybe types.
32572  *
32573  * Returns: (transfer none): the element type of @type  Since 2.24
32574  */
32575
32576
32577 /**
32578  * g_variant_type_equal:
32579  * @type1: (type GVariantType): a #GVariantType
32580  * @type2: (type GVariantType): a #GVariantType
32581  *
32582  * Compares @type1 and @type2 for equality.
32583  *
32584  * Only returns %TRUE if the types are exactly equal.  Even if one type
32585  * is an indefinite type and the other is a subtype of it, %FALSE will
32586  * be returned if they are not exactly equal.  If you want to check for
32587  * subtypes, use g_variant_type_is_subtype_of().
32588  *
32589  * The argument types of @type1 and @type2 are only #gconstpointer to
32590  * allow use with #GHashTable without function pointer casting.  For
32591  * both arguments, a valid #GVariantType must be provided.
32592  *
32593  * Returns: %TRUE if @type1 and @type2 are exactly equal  Since 2.24
32594  */
32595
32596
32597 /**
32598  * g_variant_type_first:
32599  * @type: a tuple or dictionary entry #GVariantType
32600  *
32601  * Determines the first item type of a tuple or dictionary entry
32602  * type.
32603  *
32604  * This function may only be used with tuple or dictionary entry types,
32605  * but must not be used with the generic tuple type
32606  * %G_VARIANT_TYPE_TUPLE.
32607  *
32608  * In the case of a dictionary entry type, this returns the type of
32609  * the key.
32610  *
32611  * %NULL is returned in case of @type being %G_VARIANT_TYPE_UNIT.
32612  *
32613  * This call, together with g_variant_type_next() provides an iterator
32614  * interface over tuple and dictionary entry types.
32615  *
32616  * Returns: (transfer none): the first item type of @type, or %NULL  Since 2.24
32617  */
32618
32619
32620 /**
32621  * g_variant_type_free:
32622  * @type: (allow-none): a #GVariantType, or %NULL
32623  *
32624  * Frees a #GVariantType that was allocated with
32625  * g_variant_type_copy(), g_variant_type_new() or one of the container
32626  * type constructor functions.
32627  *
32628  * In the case that @type is %NULL, this function does nothing.
32629  *
32630  * Since 2.24
32631  */
32632
32633
32634 /**
32635  * g_variant_type_get_string_length:
32636  * @type: a #GVariantType
32637  *
32638  * Returns the length of the type string corresponding to the given
32639  * @type.  This function must be used to determine the valid extent of
32640  * the memory region returned by g_variant_type_peek_string().
32641  *
32642  * Returns: the length of the corresponding type string  Since 2.24
32643  */
32644
32645
32646 /**
32647  * g_variant_type_hash:
32648  * @type: (type GVariantType): a #GVariantType
32649  *
32650  * Hashes @type.
32651  *
32652  * The argument type of @type is only #gconstpointer to allow use with
32653  * #GHashTable without function pointer casting.  A valid
32654  * #GVariantType must be provided.
32655  *
32656  * Returns: the hash value  Since 2.24
32657  */
32658
32659
32660 /**
32661  * g_variant_type_is_array:
32662  * @type: a #GVariantType
32663  *
32664  * Determines if the given @type is an array type.  This is true if the
32665  * type string for @type starts with an 'a'.
32666  *
32667  * This function returns %TRUE for any indefinite type for which every
32668  * definite subtype is an array type -- %G_VARIANT_TYPE_ARRAY, for
32669  * example.
32670  *
32671  * Returns: %TRUE if @type is an array type  Since 2.24
32672  */
32673
32674
32675 /**
32676  * g_variant_type_is_basic:
32677  * @type: a #GVariantType
32678  *
32679  * Determines if the given @type is a basic type.
32680  *
32681  * Basic types are booleans, bytes, integers, doubles, strings, object
32682  * paths and signatures.
32683  *
32684  * Only a basic type may be used as the key of a dictionary entry.
32685  *
32686  * This function returns %FALSE for all indefinite types except
32687  * %G_VARIANT_TYPE_BASIC.
32688  *
32689  * Returns: %TRUE if @type is a basic type  Since 2.24
32690  */
32691
32692
32693 /**
32694  * g_variant_type_is_container:
32695  * @type: a #GVariantType
32696  *
32697  * Determines if the given @type is a container type.
32698  *
32699  * Container types are any array, maybe, tuple, or dictionary
32700  * entry types plus the variant type.
32701  *
32702  * This function returns %TRUE for any indefinite type for which every
32703  * definite subtype is a container -- %G_VARIANT_TYPE_ARRAY, for
32704  * example.
32705  *
32706  * Returns: %TRUE if @type is a container type  Since 2.24
32707  */
32708
32709
32710 /**
32711  * g_variant_type_is_definite:
32712  * @type: a #GVariantType
32713  *
32714  * Determines if the given @type is definite (ie: not indefinite).
32715  *
32716  * A type is definite if its type string does not contain any indefinite
32717  * type characters ('*', '?', or 'r').
32718  *
32719  * A #GVariant instance may not have an indefinite type, so calling
32720  * this function on the result of g_variant_get_type() will always
32721  * result in %TRUE being returned.  Calling this function on an
32722  * indefinite type like %G_VARIANT_TYPE_ARRAY, however, will result in
32723  * %FALSE being returned.
32724  *
32725  * Returns: %TRUE if @type is definite  Since 2.24
32726  */
32727
32728
32729 /**
32730  * g_variant_type_is_dict_entry:
32731  * @type: a #GVariantType
32732  *
32733  * Determines if the given @type is a dictionary entry type.  This is
32734  * true if the type string for @type starts with a '{'.
32735  *
32736  * This function returns %TRUE for any indefinite type for which every
32737  * definite subtype is a dictionary entry type --
32738  * %G_VARIANT_TYPE_DICT_ENTRY, for example.
32739  *
32740  * Returns: %TRUE if @type is a dictionary entry type  Since 2.24
32741  */
32742
32743
32744 /**
32745  * g_variant_type_is_maybe:
32746  * @type: a #GVariantType
32747  *
32748  * Determines if the given @type is a maybe type.  This is true if the
32749  * type string for @type starts with an 'm'.
32750  *
32751  * This function returns %TRUE for any indefinite type for which every
32752  * definite subtype is a maybe type -- %G_VARIANT_TYPE_MAYBE, for
32753  * example.
32754  *
32755  * Returns: %TRUE if @type is a maybe type  Since 2.24
32756  */
32757
32758
32759 /**
32760  * g_variant_type_is_subtype_of:
32761  * @type: a #GVariantType
32762  * @supertype: a #GVariantType
32763  *
32764  * Checks if @type is a subtype of @supertype.
32765  *
32766  * This function returns %TRUE if @type is a subtype of @supertype.  All
32767  * types are considered to be subtypes of themselves.  Aside from that,
32768  * only indefinite types can have subtypes.
32769  *
32770  * Returns: %TRUE if @type is a subtype of @supertype  Since 2.24
32771  */
32772
32773
32774 /**
32775  * g_variant_type_is_tuple:
32776  * @type: a #GVariantType
32777  *
32778  * Determines if the given @type is a tuple type.  This is true if the
32779  * type string for @type starts with a '(' or if @type is
32780  * %G_VARIANT_TYPE_TUPLE.
32781  *
32782  * This function returns %TRUE for any indefinite type for which every
32783  * definite subtype is a tuple type -- %G_VARIANT_TYPE_TUPLE, for
32784  * example.
32785  *
32786  * Returns: %TRUE if @type is a tuple type  Since 2.24
32787  */
32788
32789
32790 /**
32791  * g_variant_type_is_variant:
32792  * @type: a #GVariantType
32793  *
32794  * Determines if the given @type is the variant type.
32795  *
32796  * Returns: %TRUE if @type is the variant type  Since 2.24
32797  */
32798
32799
32800 /**
32801  * g_variant_type_key:
32802  * @type: a dictionary entry #GVariantType
32803  *
32804  * Determines the key type of a dictionary entry type.
32805  *
32806  * This function may only be used with a dictionary entry type.  Other
32807  * than the additional restriction, this call is equivalent to
32808  * g_variant_type_first().
32809  *
32810  * Returns: (transfer none): the key type of the dictionary entry  Since 2.24
32811  */
32812
32813
32814 /**
32815  * g_variant_type_n_items:
32816  * @type: a tuple or dictionary entry #GVariantType
32817  *
32818  * Determines the number of items contained in a tuple or
32819  * dictionary entry type.
32820  *
32821  * This function may only be used with tuple or dictionary entry types,
32822  * but must not be used with the generic tuple type
32823  * %G_VARIANT_TYPE_TUPLE.
32824  *
32825  * In the case of a dictionary entry type, this function will always
32826  * return 2.
32827  *
32828  * Returns: the number of items in @type  Since 2.24
32829  */
32830
32831
32832 /**
32833  * g_variant_type_new:
32834  * @type_string: a valid GVariant type string
32835  *
32836  * Creates a new #GVariantType corresponding to the type string given
32837  * by @type_string.  It is appropriate to call g_variant_type_free() on
32838  * the return value.
32839  *
32840  * It is a programmer error to call this function with an invalid type
32841  * string.  Use g_variant_type_string_is_valid() if you are unsure.
32842  *
32843  * Returns: (transfer full): a new #GVariantType
32844  * Since: 2.24
32845  */
32846
32847
32848 /**
32849  * g_variant_type_new_array: (constructor)
32850  * @element: a #GVariantType
32851  *
32852  * Constructs the type corresponding to an array of elements of the
32853  * type @type.
32854  *
32855  * It is appropriate to call g_variant_type_free() on the return value.
32856  *
32857  * Returns: (transfer full): a new array #GVariantType  Since 2.24
32858  */
32859
32860
32861 /**
32862  * g_variant_type_new_dict_entry: (constructor)
32863  * @key: a basic #GVariantType
32864  * @value: a #GVariantType
32865  *
32866  * Constructs the type corresponding to a dictionary entry with a key
32867  * of type @key and a value of type @value.
32868  *
32869  * It is appropriate to call g_variant_type_free() on the return value.
32870  *
32871  * Returns: (transfer full): a new dictionary entry #GVariantType  Since 2.24
32872  */
32873
32874
32875 /**
32876  * g_variant_type_new_maybe: (constructor)
32877  * @element: a #GVariantType
32878  *
32879  * Constructs the type corresponding to a maybe instance containing
32880  * type @type or Nothing.
32881  *
32882  * It is appropriate to call g_variant_type_free() on the return value.
32883  *
32884  * Returns: (transfer full): a new maybe #GVariantType  Since 2.24
32885  */
32886
32887
32888 /**
32889  * g_variant_type_new_tuple:
32890  * @items: (array length=length): an array of #GVariantTypes, one for each item
32891  * @length: the length of @items, or -1
32892  *
32893  * Constructs a new tuple type, from @items.
32894  *
32895  * @length is the number of items in @items, or -1 to indicate that
32896  * @items is %NULL-terminated.
32897  *
32898  * It is appropriate to call g_variant_type_free() on the return value.
32899  *
32900  * Returns: (transfer full): a new tuple #GVariantType  Since 2.24
32901  */
32902
32903
32904 /**
32905  * g_variant_type_next:
32906  * @type: a #GVariantType from a previous call
32907  *
32908  * Determines the next item type of a tuple or dictionary entry
32909  * type.
32910  *
32911  * @type must be the result of a previous call to
32912  * g_variant_type_first() or g_variant_type_next().
32913  *
32914  * If called on the key type of a dictionary entry then this call
32915  * returns the value type.  If called on the value type of a dictionary
32916  * entry then this call returns %NULL.
32917  *
32918  * For tuples, %NULL is returned when @type is the last item in a tuple.
32919  *
32920  * Returns: (transfer none): the next #GVariantType after @type, or %NULL  Since 2.24
32921  */
32922
32923
32924 /**
32925  * g_variant_type_peek_string: (skip)
32926  * @type: a #GVariantType
32927  *
32928  * Returns the type string corresponding to the given @type.  The
32929  * result is not nul-terminated; in order to determine its length you
32930  * must call g_variant_type_get_string_length().
32931  *
32932  * To get a nul-terminated string, see g_variant_type_dup_string().
32933  *
32934  * Returns: the corresponding type string (not nul-terminated)  Since 2.24
32935  */
32936
32937
32938 /**
32939  * g_variant_type_string_is_valid:
32940  * @type_string: a pointer to any string
32941  *
32942  * Checks if @type_string is a valid GVariant type string.  This call is
32943  * equivalent to calling g_variant_type_string_scan() and confirming
32944  * that the following character is a nul terminator.
32945  *
32946  * Returns: %TRUE if @type_string is exactly one valid type string  Since 2.24
32947  */
32948
32949
32950 /**
32951  * g_variant_type_string_scan:
32952  * @string: a pointer to any string
32953  * @limit: (allow-none): the end of @string, or %NULL
32954  * @endptr: (out) (allow-none): location to store the end pointer, or %NULL
32955  *
32956  * Scan for a single complete and valid GVariant type string in @string.
32957  * The memory pointed to by @limit (or bytes beyond it) is never
32958  * accessed.
32959  *
32960  * If a valid type string is found, @endptr is updated to point to the
32961  * first character past the end of the string that was found and %TRUE
32962  * is returned.
32963  *
32964  * If there is no valid type string starting at @string, or if the type
32965  * string does not end before @limit then %FALSE is returned.
32966  *
32967  * For the simple case of checking if a string is a valid type string,
32968  * see g_variant_type_string_is_valid().
32969  *
32970  * Returns: %TRUE if a valid type string was found
32971  * Since: 2.24
32972  */
32973
32974
32975 /**
32976  * g_variant_type_value:
32977  * @type: a dictionary entry #GVariantType
32978  *
32979  * Determines the value type of a dictionary entry type.
32980  *
32981  * This function may only be used with a dictionary entry type.
32982  *
32983  * Returns: (transfer none): the value type of the dictionary entry  Since 2.24
32984  */
32985
32986
32987 /**
32988  * g_variant_unref:
32989  * @value: a #GVariant
32990  *
32991  * Decreases the reference count of @value.  When its reference count
32992  * drops to 0, the memory used by the variant is freed.
32993  *
32994  * Since: 2.24
32995  */
32996
32997
32998 /**
32999  * g_vasprintf:
33000  * @string: the return location for the newly-allocated string.
33001  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
33002  * @args: the list of arguments to insert in the output.
33003  *
33004  * An implementation of the GNU vasprintf() function which supports
33005  * positional parameters, as specified in the Single Unix Specification.
33006  * This function is similar to g_vsprintf(), except that it allocates a
33007  * string to hold the output, instead of putting the output in a buffer
33008  * you allocate in advance.
33009  *
33010  * Returns: the number of bytes printed.
33011  * Since: 2.4
33012  */
33013
33014
33015 /**
33016  * g_vfprintf:
33017  * @file: the stream to write to.
33018  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
33019  * @args: the list of arguments to insert in the output.
33020  *
33021  * An implementation of the standard fprintf() function which supports
33022  * positional parameters, as specified in the Single Unix Specification.
33023  *
33024  * Returns: the number of bytes printed.
33025  * Since: 2.2
33026  */
33027
33028
33029 /**
33030  * g_vprintf:
33031  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
33032  * @args: the list of arguments to insert in the output.
33033  *
33034  * An implementation of the standard vprintf() function which supports
33035  * positional parameters, as specified in the Single Unix Specification.
33036  *
33037  * Returns: the number of bytes printed.
33038  * Since: 2.2
33039  */
33040
33041
33042 /**
33043  * g_vsnprintf:
33044  * @string: the buffer to hold the output.
33045  * @n: the maximum number of bytes to produce (including the terminating nul character).
33046  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
33047  * @args: the list of arguments to insert in the output.
33048  *
33049  * A safer form of the standard vsprintf() function. The output is guaranteed
33050  * to not exceed @n characters (including the terminating nul character), so
33051  * it is easy to ensure that a buffer overflow cannot occur.
33052  *
33053  * See also g_strdup_vprintf().
33054  *
33055  * In versions of GLib prior to 1.2.3, this function may return -1 if the
33056  * output was truncated, and the truncated string may not be nul-terminated.
33057  * In versions prior to 1.3.12, this function returns the length of the output
33058  * string.
33059  *
33060  * The return value of g_vsnprintf() conforms to the vsnprintf() function
33061  * as standardized in ISO C99. Note that this is different from traditional
33062  * vsnprintf(), which returns the length of the output string.
33063  *
33064  * The format string may contain positional parameters, as specified in
33065  * the Single Unix Specification.
33066  *
33067  * Returns: the number of bytes which would be produced if the buffer was large enough.
33068  */
33069
33070
33071 /**
33072  * g_vsprintf:
33073  * @string: the buffer to hold the output.
33074  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
33075  * @args: the list of arguments to insert in the output.
33076  *
33077  * An implementation of the standard vsprintf() function which supports
33078  * positional parameters, as specified in the Single Unix Specification.
33079  *
33080  * Returns: the number of bytes printed.
33081  * Since: 2.2
33082  */
33083
33084
33085 /**
33086  * g_wakeup_acknowledge:
33087  * @wakeup: a #GWakeup
33088  *
33089  * Acknowledges receipt of a wakeup signal on @wakeup.
33090  *
33091  * You must call this after @wakeup polls as ready.  If not, it will
33092  * continue to poll as ready until you do so.
33093  *
33094  * If you call this function and @wakeup is not signaled, nothing
33095  * happens.
33096  *
33097  * Since: 2.30
33098  */
33099
33100
33101 /**
33102  * g_wakeup_free:
33103  * @wakeup: a #GWakeup
33104  *
33105  * Frees @wakeup.
33106  *
33107  * You must not currently be polling on the #GPollFD returned by
33108  * g_wakeup_get_pollfd(), or the result is undefined.
33109  */
33110
33111
33112 /**
33113  * g_wakeup_get_pollfd:
33114  * @wakeup: a #GWakeup
33115  * @poll_fd: a #GPollFD
33116  *
33117  * Prepares a @poll_fd such that polling on it will succeed when
33118  * g_wakeup_signal() has been called on @wakeup.
33119  *
33120  * @poll_fd is valid until @wakeup is freed.
33121  *
33122  * Since: 2.30
33123  */
33124
33125
33126 /**
33127  * g_wakeup_new:
33128  *
33129  * Creates a new #GWakeup.
33130  *
33131  * You should use g_wakeup_free() to free it when you are done.
33132  *
33133  * Returns: a new #GWakeup
33134  * Since: 2.30
33135  */
33136
33137
33138 /**
33139  * g_wakeup_signal:
33140  * @wakeup: a #GWakeup
33141  *
33142  * Signals @wakeup.
33143  *
33144  * Any future (or present) polling on the #GPollFD returned by
33145  * g_wakeup_get_pollfd() will immediately succeed until such a time as
33146  * g_wakeup_acknowledge() is called.
33147  *
33148  * This function is safe to call from a UNIX signal handler.
33149  *
33150  * Since: 2.30
33151  */
33152
33153
33154 /**
33155  * g_warning:
33156  * @...: format string, followed by parameters to insert into the format string (as with printf())
33157  *
33158  * A convenience function/macro to log a warning message.
33159  *
33160  * You can make warnings fatal at runtime by setting the
33161  * <envar>G_DEBUG</envar> environment variable (see
33162  * <ulink url="glib-running.html">Running GLib Applications</ulink>).
33163  */
33164
33165
33166 /**
33167  * g_win32_error_message:
33168  * @error: error code.
33169  *
33170  * Translate a Win32 error code (as returned by GetLastError()) into
33171  * the corresponding message. The message is either language neutral,
33172  * or in the thread's language, or the user's language, the system's
33173  * language, or US English (see docs for FormatMessage()). The
33174  * returned string is in UTF-8. It should be deallocated with
33175  * g_free().
33176  *
33177  * Returns: newly-allocated error message
33178  */
33179
33180
33181 /**
33182  * g_win32_get_package_installation_directory:
33183  * @package: (allow-none): You should pass %NULL for this.
33184  * @dll_name: (allow-none): The name of a DLL that a package provides in UTF-8, or %NULL.
33185  *
33186  * Try to determine the installation directory for a software package.
33187  *
33188  * This function is deprecated. Use
33189  * g_win32_get_package_installation_directory_of_module() instead.
33190  *
33191  * The use of @package is deprecated. You should always pass %NULL. A
33192  * warning is printed if non-NULL is passed as @package.
33193  *
33194  * The original intended use of @package was for a short identifier of
33195  * the package, typically the same identifier as used for
33196  * <literal>GETTEXT_PACKAGE</literal> in software configured using GNU
33197  * autotools. The function first looks in the Windows Registry for the
33198  * value <literal>&num;InstallationDirectory</literal> in the key
33199  * <literal>&num;HKLM\Software\@package</literal>, and if that value
33200  * exists and is a string, returns that.
33201  *
33202  * It is strongly recommended that packagers of GLib-using libraries
33203  * for Windows do not store installation paths in the Registry to be
33204  * used by this function as that interfers with having several
33205  * parallel installations of the library. Enabling multiple
33206  * installations of different versions of some GLib-using library, or
33207  * GLib itself, is desirable for various reasons.
33208  *
33209  * For this reason it is recommeded to always pass %NULL as
33210  * @package to this function, to avoid the temptation to use the
33211  * Registry. In version 2.20 of GLib the @package parameter
33212  * will be ignored and this function won't look in the Registry at all.
33213  *
33214  * If @package is %NULL, or the above value isn't found in the
33215  * Registry, but @dll_name is non-%NULL, it should name a DLL loaded
33216  * into the current process. Typically that would be the name of the
33217  * DLL calling this function, looking for its installation
33218  * directory. The function then asks Windows what directory that DLL
33219  * was loaded from. If that directory's last component is "bin" or
33220  * "lib", the parent directory is returned, otherwise the directory
33221  * itself. If that DLL isn't loaded, the function proceeds as if
33222  * @dll_name was %NULL.
33223  *
33224  * If both @package and @dll_name are %NULL, the directory from where
33225  * the main executable of the process was loaded is used instead in
33226  * the same way as above.
33227  *
33228  * Returns: a string containing the installation directory for @package. The string is in the GLib file name encoding, i.e. UTF-8. The return value should be freed with g_free() when not needed any longer. If the function fails %NULL is returned.
33229  * Deprecated: 2.18: Pass the HMODULE of a DLL or EXE to g_win32_get_package_installation_directory_of_module() instead.
33230  */
33231
33232
33233 /**
33234  * g_win32_get_package_installation_directory_of_module:
33235  * @hmodule: (allow-none): The Win32 handle for a DLL loaded into the current process, or %NULL
33236  *
33237  * This function tries to determine the installation directory of a
33238  * software package based on the location of a DLL of the software
33239  * package.
33240  *
33241  * @hmodule should be the handle of a loaded DLL or %NULL. The
33242  * function looks up the directory that DLL was loaded from. If
33243  * @hmodule is NULL, the directory the main executable of the current
33244  * process is looked up. If that directory's last component is "bin"
33245  * or "lib", its parent directory is returned, otherwise the directory
33246  * itself.
33247  *
33248  * It thus makes sense to pass only the handle to a "public" DLL of a
33249  * software package to this function, as such DLLs typically are known
33250  * to be installed in a "bin" or occasionally "lib" subfolder of the
33251  * installation folder. DLLs that are of the dynamically loaded module
33252  * or plugin variety are often located in more private locations
33253  * deeper down in the tree, from which it is impossible for GLib to
33254  * deduce the root of the package installation.
33255  *
33256  * The typical use case for this function is to have a DllMain() that
33257  * saves the handle for the DLL. Then when code in the DLL needs to
33258  * construct names of files in the installation tree it calls this
33259  * function passing the DLL handle.
33260  *
33261  * Returns: a string containing the guessed installation directory for the software package @hmodule is from. The string is in the GLib file name encoding, i.e. UTF-8. The return value should be freed with g_free() when not needed any longer. If the function fails %NULL is returned.
33262  * Since: 2.16
33263  */
33264
33265
33266 /**
33267  * g_win32_get_package_installation_subdirectory:
33268  * @package: (allow-none): You should pass %NULL for this.
33269  * @dll_name: (allow-none): The name of a DLL that a package provides, in UTF-8, or %NULL.
33270  * @subdir: A subdirectory of the package installation directory, also in UTF-8
33271  *
33272  * This function is deprecated. Use
33273  * g_win32_get_package_installation_directory_of_module() and
33274  * g_build_filename() instead.
33275  *
33276  * Returns a newly-allocated string containing the path of the
33277  * subdirectory @subdir in the return value from calling
33278  * g_win32_get_package_installation_directory() with the @package and
33279  * @dll_name parameters. See the documentation for
33280  * g_win32_get_package_installation_directory() for more details. In
33281  * particular, note that it is deprecated to pass anything except NULL
33282  * as @package.
33283  *
33284  * Returns: a string containing the complete path to @subdir inside the installation directory of @package. The returned string is in the GLib file name encoding, i.e. UTF-8. The return value should be freed with g_free() when no longer needed. If something goes wrong, %NULL is returned.
33285  * Deprecated: 2.18: Pass the HMODULE of a DLL or EXE to g_win32_get_package_installation_directory_of_module() instead, and then construct a subdirectory pathname with g_build_filename().
33286  */
33287
33288
33289 /**
33290  * g_win32_get_windows_version:
33291  *
33292  * Returns version information for the Windows operating system the
33293  * code is running on. See MSDN documentation for the GetVersion()
33294  * function. To summarize, the most significant bit is one on Win9x,
33295  * and zero on NT-based systems. Since version 2.14, GLib works only
33296  * on NT-based systems, so checking whether your are running on Win9x
33297  * in your own software is moot. The least significant byte is 4 on
33298  * Windows NT 4, and 5 on Windows XP. Software that needs really
33299  * detailed version and feature information should use Win32 API like
33300  * GetVersionEx() and VerifyVersionInfo().
33301  *
33302  * Returns: The version information.
33303  * Since: 2.6
33304  */
33305
33306
33307 /**
33308  * g_win32_getlocale:
33309  *
33310  * The setlocale() function in the Microsoft C library uses locale
33311  * names of the form "English_United States.1252" etc. We want the
33312  * UNIXish standard form "en_US", "zh_TW" etc. This function gets the
33313  * current thread locale from Windows - without any encoding info -
33314  * and returns it as a string of the above form for use in forming
33315  * file names etc. The returned string should be deallocated with
33316  * g_free().
33317  *
33318  * Returns: newly-allocated locale name.
33319  */
33320
33321
33322 /**
33323  * g_win32_locale_filename_from_utf8:
33324  * @utf8filename: a UTF-8 encoded filename.
33325  *
33326  * Converts a filename from UTF-8 to the system codepage.
33327  *
33328  * On NT-based Windows, on NTFS file systems, file names are in
33329  * Unicode. It is quite possible that Unicode file names contain
33330  * characters not representable in the system codepage. (For instance,
33331  * Greek or Cyrillic characters on Western European or US Windows
33332  * installations, or various less common CJK characters on CJK Windows
33333  * installations.)
33334  *
33335  * In such a case, and if the filename refers to an existing file, and
33336  * the file system stores alternate short (8.3) names for directory
33337  * entries, the short form of the filename is returned. Note that the
33338  * "short" name might in fact be longer than the Unicode name if the
33339  * Unicode name has very short pathname components containing
33340  * non-ASCII characters. If no system codepage name for the file is
33341  * possible, %NULL is returned.
33342  *
33343  * The return value is dynamically allocated and should be freed with
33344  * g_free() when no longer needed.
33345  *
33346  * Returns: The converted filename, or %NULL on conversion failure and lack of short names.
33347  * Since: 2.8
33348  */
33349
33350
33351 /**
33352  * gboolean:
33353  *
33354  * A standard boolean type.
33355  * Variables of this type should only contain the value
33356  * %TRUE or %FALSE.
33357  */
33358
33359
33360 /**
33361  * gchar:
33362  *
33363  * Corresponds to the standard C <type>char</type> type.
33364  */
33365
33366
33367 /**
33368  * gconstpointer:
33369  *
33370  * An untyped pointer to constant data.
33371  * The data pointed to should not be changed.
33372  *
33373  * This is typically used in function prototypes to indicate
33374  * that the data pointed to will not be altered by the function.
33375  */
33376
33377
33378 /**
33379  * gdouble:
33380  *
33381  * Corresponds to the standard C <type>double</type> type.
33382  * Values of this type can range from -#G_MAXDOUBLE to #G_MAXDOUBLE.
33383  */
33384
33385
33386 /**
33387  * gfloat:
33388  *
33389  * Corresponds to the standard C <type>float</type> type.
33390  * Values of this type can range from -#G_MAXFLOAT to #G_MAXFLOAT.
33391  */
33392
33393
33394 /**
33395  * gint:
33396  *
33397  * Corresponds to the standard C <type>int</type> type.
33398  * Values of this type can range from #G_MININT to #G_MAXINT.
33399  */
33400
33401
33402 /**
33403  * gint16:
33404  *
33405  * A signed integer guaranteed to be 16 bits on all platforms.
33406  * Values of this type can range from #G_MININT16 (= -32,768) to
33407  * #G_MAXINT16 (= 32,767).
33408  *
33409  * To print or scan values of this type, use
33410  * %G_GINT16_MODIFIER and/or %G_GINT16_FORMAT.
33411  */
33412
33413
33414 /**
33415  * gint32:
33416  *
33417  * A signed integer guaranteed to be 32 bits on all platforms.
33418  * Values of this type can range from #G_MININT32 (= -2,147,483,648)
33419  * to #G_MAXINT32 (= 2,147,483,647).
33420  *
33421  * To print or scan values of this type, use
33422  * %G_GINT32_MODIFIER and/or %G_GINT32_FORMAT.
33423  */
33424
33425
33426 /**
33427  * gint64:
33428  *
33429  * A signed integer guaranteed to be 64 bits on all platforms.
33430  * Values of this type can range from #G_MININT64
33431  * (= -9,223,372,036,854,775,808) to #G_MAXINT64
33432  * (= 9,223,372,036,854,775,807).
33433  *
33434  * To print or scan values of this type, use
33435  * %G_GINT64_MODIFIER and/or %G_GINT64_FORMAT.
33436  */
33437
33438
33439 /**
33440  * gint8:
33441  *
33442  * A signed integer guaranteed to be 8 bits on all platforms.
33443  * Values of this type can range from #G_MININT8 (= -128) to
33444  * #G_MAXINT8 (= 127).
33445  */
33446
33447
33448 /**
33449  * gintptr:
33450  *
33451  * Corresponds to the C99 type <type>intptr_t</type>,
33452  * a signed integer type that can hold any pointer.
33453  *
33454  * To print or scan values of this type, use
33455  * %G_GINTPTR_MODIFIER and/or %G_GINTPTR_FORMAT.
33456  *
33457  * Since: 2.18
33458  */
33459
33460
33461 /**
33462  * glib__private__:
33463  * @arg: Do not use this argument
33464  *
33465  * Do not call this function; it is used to share private
33466  * API between glib, gobject, and gio.
33467  */
33468
33469
33470 /**
33471  * glib_check_version:
33472  * @required_major: the required major version.
33473  * @required_minor: the required minor version.
33474  * @required_micro: the required micro version.
33475  *
33476  * Checks that the GLib library in use is compatible with the
33477  * given version. Generally you would pass in the constants
33478  * #GLIB_MAJOR_VERSION, #GLIB_MINOR_VERSION, #GLIB_MICRO_VERSION
33479  * as the three arguments to this function; that produces
33480  * a check that the library in use is compatible with
33481  * the version of GLib the application or module was compiled
33482  * against.
33483  *
33484  * Compatibility is defined by two things: first the version
33485  * of the running library is newer than the version
33486  * @required_major.required_minor.@required_micro. Second
33487  * the running library must be binary compatible with the
33488  * version @required_major.required_minor.@required_micro
33489  * (same major version.)
33490  *
33491  * Returns: %NULL if the GLib library is compatible with the given version, or a string describing the version mismatch. The returned string is owned by GLib and must not be modified or freed.
33492  * Since: 2.6
33493  */
33494
33495
33496 /**
33497  * glib_gettext:
33498  * @str: The string to be translated
33499  *
33500  * Returns the translated string from the glib translations.
33501  * This is an internal function and should only be used by
33502  * the internals of glib (such as libgio).
33503  *
33504  * Returns: the transation of @str to the current locale
33505  */
33506
33507
33508 /**
33509  * glib_mem_profiler_table:
33510  *
33511  * A #GMemVTable containing profiling variants of the memory
33512  * allocation functions. Use them together with g_mem_profile()
33513  * in order to get information about the memory allocation pattern
33514  * of your program.
33515  */
33516
33517
33518 /**
33519  * glib_pgettext:
33520  * @msgctxtid: a combined message context and message id, separated by a \004 character
33521  * @msgidoffset: the offset of the message id in @msgctxid
33522  *
33523  * This function is a variant of glib_gettext() which supports
33524  * a disambiguating message context. See g_dpgettext() for full
33525  * details.
33526  *
33527  * This is an internal function and should only be used by
33528  * the internals of glib (such as libgio).
33529  *
33530  * Returns: the translation of @str to the current locale
33531  */
33532
33533
33534 /**
33535  * glong:
33536  *
33537  * Corresponds to the standard C <type>long</type> type.
33538  * Values of this type can range from #G_MINLONG to #G_MAXLONG.
33539  */
33540
33541
33542 /**
33543  * goffset:
33544  *
33545  * A signed integer type that is used for file offsets,
33546  * corresponding to the C99 type <type>off64_t</type>.
33547  * Values of this type can range from #G_MINOFFSET to
33548  * #G_MAXOFFSET.
33549  *
33550  * To print or scan values of this type, use
33551  * %G_GOFFSET_MODIFIER and/or %G_GOFFSET_FORMAT.
33552  *
33553  * Since: 2.14
33554  */
33555
33556
33557 /**
33558  * gpointer:
33559  *
33560  * An untyped pointer.
33561  * #gpointer looks better and is easier to use
33562  * than <type>void*</type>.
33563  */
33564
33565
33566 /**
33567  * gshort:
33568  *
33569  * Corresponds to the standard C <type>short</type> type.
33570  * Values of this type can range from #G_MINSHORT to #G_MAXSHORT.
33571  */
33572
33573
33574 /**
33575  * gsize:
33576  *
33577  * An unsigned integer type of the result of the sizeof operator,
33578  * corresponding to the <type>size_t</type> type defined in C99.
33579  * This type is wide enough to hold the numeric value of a pointer,
33580  * so it is usually 32bit wide on a 32bit platform and 64bit wide
33581  * on a 64bit platform. Values of this type can range from 0 to
33582  * #G_MAXSIZE.
33583  *
33584  * To print or scan values of this type, use
33585  * %G_GSIZE_MODIFIER and/or %G_GSIZE_FORMAT.
33586  */
33587
33588
33589 /**
33590  * gssize:
33591  *
33592  * A signed variant of #gsize, corresponding to the
33593  * <type>ssize_t</type> defined on most platforms.
33594  * Values of this type can range from #G_MINSSIZE
33595  * to #G_MAXSSIZE.
33596  *
33597  * To print or scan values of this type, use
33598  * %G_GSIZE_MODIFIER and/or %G_GSSIZE_FORMAT.
33599  */
33600
33601
33602 /**
33603  * guchar:
33604  *
33605  * Corresponds to the standard C <type>unsigned char</type> type.
33606  */
33607
33608
33609 /**
33610  * guint:
33611  *
33612  * Corresponds to the standard C <type>unsigned int</type> type.
33613  * Values of this type can range from 0 to #G_MAXUINT.
33614  */
33615
33616
33617 /**
33618  * guint16:
33619  *
33620  * An unsigned integer guaranteed to be 16 bits on all platforms.
33621  * Values of this type can range from 0 to #G_MAXUINT16 (= 65,535).
33622  *
33623  * To print or scan values of this type, use
33624  * %G_GINT16_MODIFIER and/or %G_GUINT16_FORMAT.
33625  */
33626
33627
33628 /**
33629  * guint32:
33630  *
33631  * An unsigned integer guaranteed to be 32 bits on all platforms.
33632  * Values of this type can range from 0 to #G_MAXUINT32 (= 4,294,967,295).
33633  *
33634  * To print or scan values of this type, use
33635  * %G_GINT32_MODIFIER and/or %G_GUINT32_FORMAT.
33636  */
33637
33638
33639 /**
33640  * guint64:
33641  *
33642  * An unsigned integer guaranteed to be 64 bits on all platforms.
33643  * Values of this type can range from 0 to #G_MAXUINT64
33644  * (= 18,446,744,073,709,551,615).
33645  *
33646  * To print or scan values of this type, use
33647  * %G_GINT64_MODIFIER and/or %G_GUINT64_FORMAT.
33648  */
33649
33650
33651 /**
33652  * guint8:
33653  *
33654  * An unsigned integer guaranteed to be 8 bits on all platforms.
33655  * Values of this type can range from 0 to #G_MAXUINT8 (= 255).
33656  */
33657
33658
33659 /**
33660  * guintptr:
33661  *
33662  * Corresponds to the C99 type <type>uintptr_t</type>,
33663  * an unsigned integer type that can hold any pointer.
33664  *
33665  * To print or scan values of this type, use
33666  * %G_GINTPTR_MODIFIER and/or %G_GUINTPTR_FORMAT.
33667  *
33668  * Since: 2.18
33669  */
33670
33671
33672 /**
33673  * gulong:
33674  *
33675  * Corresponds to the standard C <type>unsigned long</type> type.
33676  * Values of this type can range from 0 to #G_MAXULONG.
33677  */
33678
33679
33680 /**
33681  * gushort:
33682  *
33683  * Corresponds to the standard C <type>unsigned short</type> type.
33684  * Values of this type can range from 0 to #G_MAXUSHORT.
33685  */
33686
33687
33688
33689 /************************************************************/
33690 /* THIS FILE IS GENERATED DO NOT EDIT */
33691 /************************************************************/